Squashed 'src/leveldb/' changes from 7924331..7d41e6f
7d41e6f Merge upstream LevelDB 1.18 803d692 Release 1.18 git-subtree-dir: src/leveldb git-subtree-split: 7d41e6f89ff04ce9e6a742932924796f69c6e23d
This commit is contained in:
@@ -41,7 +41,7 @@ Status Table::Open(const Options& options,
|
||||
Table** table) {
|
||||
*table = NULL;
|
||||
if (size < Footer::kEncodedLength) {
|
||||
return Status::InvalidArgument("file is too short to be an sstable");
|
||||
return Status::Corruption("file is too short to be an sstable");
|
||||
}
|
||||
|
||||
char footer_space[Footer::kEncodedLength];
|
||||
@@ -58,7 +58,11 @@ Status Table::Open(const Options& options,
|
||||
BlockContents contents;
|
||||
Block* index_block = NULL;
|
||||
if (s.ok()) {
|
||||
s = ReadBlock(file, ReadOptions(), footer.index_handle(), &contents);
|
||||
ReadOptions opt;
|
||||
if (options.paranoid_checks) {
|
||||
opt.verify_checksums = true;
|
||||
}
|
||||
s = ReadBlock(file, opt, footer.index_handle(), &contents);
|
||||
if (s.ok()) {
|
||||
index_block = new Block(contents);
|
||||
}
|
||||
@@ -92,6 +96,9 @@ void Table::ReadMeta(const Footer& footer) {
|
||||
// TODO(sanjay): Skip this if footer.metaindex_handle() size indicates
|
||||
// it is an empty block.
|
||||
ReadOptions opt;
|
||||
if (rep_->options.paranoid_checks) {
|
||||
opt.verify_checksums = true;
|
||||
}
|
||||
BlockContents contents;
|
||||
if (!ReadBlock(rep_->file, opt, footer.metaindex_handle(), &contents).ok()) {
|
||||
// Do not propagate errors since meta info is not needed for operation
|
||||
@@ -120,6 +127,9 @@ void Table::ReadFilter(const Slice& filter_handle_value) {
|
||||
// We might want to unify with ReadBlock() if we start
|
||||
// requiring checksum verification in Table::Open.
|
||||
ReadOptions opt;
|
||||
if (rep_->options.paranoid_checks) {
|
||||
opt.verify_checksums = true;
|
||||
}
|
||||
BlockContents block;
|
||||
if (!ReadBlock(rep_->file, opt, filter_handle, &block).ok()) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user