New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error messages for SST footer and size errors #11009
Closed
pdillinger
wants to merge
1
commit into
facebook:main
from
pdillinger:better_file_size_footer_reporting
Closed
Improve error messages for SST footer and size errors #11009
pdillinger
wants to merge
1
commit into
facebook:main
from
pdillinger:better_file_size_footer_reporting
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary: Previously, you could get a format_version error if SST file size was too small in manifest, or a weird "too short" error if too big in manifest. Now we ensure: * Magic number error is reported first if we attempt to open an SST file and the footer is bad. * Footer errors are reported with affected file. * If manifest file size doesn't match actual, then the error includes expected and actual sizes (if an error is reported; in some cases we allow the file to be too big) Test Plan: unit tests added Previously, the code for "file too short" in footer processing was only covered by some tests attempting to verify SST checksums on non-SST files (fixed).
@pdillinger has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
siying
approved these changes
Dec 7, 2022
@pdillinger merged this pull request in 433d7e4. |
git-hulk
pushed a commit
to apache/kvrocks
that referenced
this pull request
Aug 15, 2023
When the SST file corrupts, which is an unrecoverable error for the rocksdb, then rocksdb will go into read-only mode(https://github.com/facebook/rocksdb/wiki/Background-Error-Handling). Only restart rocksdb to try to recover from the error. When does sst file corruption occur? The error message looks like this: ``` 1. Corruption: Corrupt or unsupported format_version: 1005 in /tmp/kvrocks/data/db/000038.sst 2. Corruption: Bad table magic number: expected 9863518390377041911, found 9863518390377041912 in /tmp/kvrocks_db/data/db/000038.sst 3. Corruption: block checksum mismatch: stored = 3308200672, computed = 51173877, type = 4 in /tmp/kvrocks_db/data/db/000038.sst offset 0 size 15715 ``` The cause of the error is usually a hardware issue or a problem with the network or cloud disk (when using the cloud disk). The most common place we see this error is when a file is generated by `Compaction` or `Flush` and the `Version` applies the result. In this case, the result of the compaction is not actually applied, so we can ignore the error and avoid restarting the rocksdb. Tikv introduces this check when sst file corruption occurs, you can refer to: - tikv/tikv#10578 - tikv/tikv#10961 Let's try it on Kvrocks: 1. Extract the sst file from the background error message 2. Determine if it is a living file 3. If not, we ignore the error and force recovery from the background error For the rocksdb error message, before the rocksdb v7.10.2, the error message was imperfect and we could only recover from a limited number of errors. Thanks to this PR facebook/rocksdb#11009, the error message is enriched and we can recover from more scenarios.
p1u3o
pushed a commit
to p1u3o/incubator-kvrocks
that referenced
this pull request
Aug 15, 2023
…che#1667) When the SST file corrupts, which is an unrecoverable error for the rocksdb, then rocksdb will go into read-only mode(https://github.com/facebook/rocksdb/wiki/Background-Error-Handling). Only restart rocksdb to try to recover from the error. When does sst file corruption occur? The error message looks like this: ``` 1. Corruption: Corrupt or unsupported format_version: 1005 in /tmp/kvrocks/data/db/000038.sst 2. Corruption: Bad table magic number: expected 9863518390377041911, found 9863518390377041912 in /tmp/kvrocks_db/data/db/000038.sst 3. Corruption: block checksum mismatch: stored = 3308200672, computed = 51173877, type = 4 in /tmp/kvrocks_db/data/db/000038.sst offset 0 size 15715 ``` The cause of the error is usually a hardware issue or a problem with the network or cloud disk (when using the cloud disk). The most common place we see this error is when a file is generated by `Compaction` or `Flush` and the `Version` applies the result. In this case, the result of the compaction is not actually applied, so we can ignore the error and avoid restarting the rocksdb. Tikv introduces this check when sst file corruption occurs, you can refer to: - tikv/tikv#10578 - tikv/tikv#10961 Let's try it on Kvrocks: 1. Extract the sst file from the background error message 2. Determine if it is a living file 3. If not, we ignore the error and force recovery from the background error For the rocksdb error message, before the rocksdb v7.10.2, the error message was imperfect and we could only recover from a limited number of errors. Thanks to this PR facebook/rocksdb#11009, the error message is enriched and we can recover from more scenarios.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary: Previously, you could get a format_version error if SST file size was too small in manifest, or a weird "too short" error if too big in manifest. Now we ensure:
Test Plan: unit tests added, some manual
Previously, the code for "file too short" in footer processing was only covered by some tests attempting to verify SST checksums on non-SST files (fixed).