Fix sst_dump not able to open ingested file (#6673)
Summary:
When investigating https://github.com/facebook/rocksdb/issues/6666, we encounter an error for sst_dump to dump an ingested SST file with global seqno.
```
Corruption: An external sst file with version 2 have global seqno property with value ��/, while largest seqno in the file is 0)
```
Same as https://github.com/facebook/rocksdb/pull/5097, it is due to SstFileReader don't know the largest seqno of a file, it will fail this check when it open a file with global seqno. ca89ac2ba9/table/block_based_table_reader.cc (L730)
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6673
Test Plan: run it manually
Reviewed By: cheng-chang
Differential Revision: D20937546
Pulled By: ajkr
fbshipit-source-id: c3fd04d60916a738533ee1885f3ea844669a9479
This commit is contained in:
parent
9e89ffb776
commit
c8c739a877
@ -131,20 +131,22 @@ Status SstFileDumper::NewTableReader(
|
||||
const ImmutableCFOptions& /*ioptions*/, const EnvOptions& /*soptions*/,
|
||||
const InternalKeyComparator& /*internal_comparator*/, uint64_t file_size,
|
||||
std::unique_ptr<TableReader>* /*table_reader*/) {
|
||||
auto t_opt = TableReaderOptions(ioptions_, moptions_.prefix_extractor.get(),
|
||||
soptions_, internal_comparator_);
|
||||
// Allow open file with global sequence number for backward compatibility.
|
||||
t_opt.largest_seqno = kMaxSequenceNumber;
|
||||
|
||||
// We need to turn off pre-fetching of index and filter nodes for
|
||||
// BlockBasedTable
|
||||
if (BlockBasedTableFactory::kName == options_.table_factory->Name()) {
|
||||
return options_.table_factory->NewTableReader(
|
||||
TableReaderOptions(ioptions_, moptions_.prefix_extractor.get(),
|
||||
soptions_, internal_comparator_),
|
||||
std::move(file_), file_size, &table_reader_, /*enable_prefetch=*/false);
|
||||
return options_.table_factory->NewTableReader(t_opt, std::move(file_),
|
||||
file_size, &table_reader_,
|
||||
/*enable_prefetch=*/false);
|
||||
}
|
||||
|
||||
// For all other factory implementation
|
||||
return options_.table_factory->NewTableReader(
|
||||
TableReaderOptions(ioptions_, moptions_.prefix_extractor.get(), soptions_,
|
||||
internal_comparator_),
|
||||
std::move(file_), file_size, &table_reader_);
|
||||
return options_.table_factory->NewTableReader(t_opt, std::move(file_),
|
||||
file_size, &table_reader_);
|
||||
}
|
||||
|
||||
Status SstFileDumper::VerifyChecksum() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user