-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
block-size not sanitized, set it larger than 4GB by mistake may cause data corruption #5486
Comments
I wrote a test but was unable to reproduce the failure, do you mind taking a look?
|
@miasantreble try having two >4GB size values in a data block? |
@miasantreble as what @yiwu-arbug said, our restart offset is encoded as fixed uint32. If there is only one key in the block, the offset of the key is 0. But if there are multiple keys, the offset of the key might excceeds max of uint32_t. There is also a a keys per restart index setting, so that you might want to have many keys, or tune the restart index to be 1 to reproduce it. But clearly block size over max uint32_t won't work. |
Summary: `Block::restart_index_`, `Block::restarts_`, and `Block::current_` are defined as uint32_t but `BlockBasedTableOptions::block_size` is defined as a size_t so user might see corruption as in #5486. This PR adds a check in `BlockBasedTableFactory::SanitizeOptions` to disallow such configurations. yiwu-arbug Pull Request resolved: #5492 Differential Revision: D15914047 Pulled By: miasantreble fbshipit-source-id: c943f153d967e15aee7f2795730ab8259e2be201
Summary: `Block::restart_index_`, `Block::restarts_`, and `Block::current_` are defined as uint32_t but `BlockBasedTableOptions::block_size` is defined as a size_t so user might see corruption as in facebook#5486. This PR adds a check in `BlockBasedTableFactory::SanitizeOptions` to disallow such configurations. yiwu-arbug Pull Request resolved: facebook#5492 Differential Revision: D15914047 Pulled By: miasantreble fbshipit-source-id: c943f153d967e15aee7f2795730ab8259e2be201
Expected behavior
When set block-size larger than 4GB, it should be forbidden.
Actual behavior
When i set block-size as 8GB, RocksDB started up and encountered "Corruption: bad entry in block" error after some compaction.
Steps to reproduce the behavior
@siddontang @yiwu-arbug
The text was updated successfully, but these errors were encountered: