Compare commits

...

2 Commits

Author SHA1 Message Date
sdong
913c664f25 tt<Replace this line with a title. Use 1 line only, 67 chars or less>
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
2019-12-16 14:54:02 -08:00
sdong
772c07e65a Fix VerifyChecksum readahead with mmap mode
Summary: A recent change introduced readahead inside VerifyChecksum(). However it is not compatible with mmap mode and generated wrong checksum verification failure. Fix it by not enabling readahead in mmap mode.

Test Plan: Add a new unit test which failed without the failure.
2019-10-18 16:19:19 -07:00
3 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,4 @@
test
# Rocksdb Change Log
## Unreleased
### Bug Fixes

View File

@ -369,6 +369,12 @@ TEST_F(CorruptionTest, VerifyChecksumReadahead) {
ASSERT_GE(senv.random_read_counter_.Read(), 213);
ASSERT_LE(senv.random_read_counter_.Read(), 447);
// Test readahead shouldn't break mmap mode (where it should be
// disabled).
options.allow_mmap_reads = true;
Reopen(&options);
ASSERT_OK(dbi->VerifyChecksum(ro));
CloseDb();
}

View File

@ -3750,8 +3750,11 @@ Status BlockBasedTable::VerifyChecksumInBlocks(
size_t readahead_size = (read_options.readahead_size != 0)
? read_options.readahead_size
: kMaxAutoReadaheadSize;
// FilePrefetchBuffer doesn't work in mmap mode and readahead is not
// needed there.
FilePrefetchBuffer prefetch_buffer(rep_->file.get(), readahead_size,
readahead_size);
readahead_size,
!rep_->ioptions.allow_mmap_reads);
for (index_iter->SeekToFirst(); index_iter->Valid(); index_iter->Next()) {
s = index_iter->status();