Skip to content

Commit 0a0803f

Browse files
committed
outdated code/comment
1 parent 9724b37 commit 0a0803f

7 files changed

+12
-13
lines changed

db/convenience.cc

-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ Status VerifySstFileChecksum(const Options& options,
6464
options.block_protection_bytes_per_key, false /* skip_filters */,
6565
!kImmortal, false /* force_direct_prefetch */, -1 /* level */);
6666
reader_options.largest_seqno = largest_seqno;
67-
reader_options.block_protection_bytes_per_key =
68-
options.block_protection_bytes_per_key;
6967
s = ioptions.table_factory->NewTableReader(
7068
reader_options, std::move(file_reader), file_size, &table_reader,
7169
false /* prefetch_index_and_filter_in_cache */);

db/external_sst_file_ingestion_job.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,7 @@ Status ExternalSstFileIngestionJob::GetIngestedFileInfo(
683683
/*force_direct_prefetch*/ false, /*level*/ -1,
684684
/*block_cache_tracer*/ nullptr,
685685
/*max_file_size_for_l0_meta_pin*/ 0, versions_->DbSessionId(),
686-
/*cur_file_num*/ new_file_number, /*unique_id*/ {},
687-
/*largest_seqno*/ 0),
686+
/*cur_file_num*/ new_file_number),
688687
std::move(sst_file_reader), file_to_ingest->file_size, &table_reader);
689688
if (!status.ok()) {
690689
return status;

db/kv_checksum.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ void ProtectionInfoKVOS<T>::UpdateS(SequenceNumber old_sequence_number,
427427
}
428428

429429
inline void EncodeKVChecksum(uint64_t checksum,
430-
uint32_t protection_bytes_per_key, char* dst) {
430+
uint8_t protection_bytes_per_key, char* dst) {
431431
switch (protection_bytes_per_key) {
432432
case 1:
433433
dst[0] = static_cast<uint8_t>(checksum);

db/memtable.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,9 @@ void MemTable::UpdateEntryChecksum(const ProtectionInfoKVOS64* kv_prot_info,
674674
} else {
675675
checksum = kv_prot_info->GetVal();
676676
}
677-
EncodeKVChecksum(checksum, moptions_.protection_bytes_per_key, checksum_ptr);
677+
EncodeKVChecksum(checksum,
678+
static_cast<uint8_t>(moptions_.protection_bytes_per_key),
679+
checksum_ptr);
678680
}
679681

680682
Status MemTable::Add(SequenceNumber s, ValueType type,

table/block_based/block.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,9 @@ bool DataBlockIter::SeekForGetImpl(const Slice& target) {
396396
// we stop at the first potential matching user key.
397397
break;
398398
}
399+
// If the loop exits due to CompareCurrentKey(target) >= 0, then current key
400+
// exists, and its checksum verification will be done in UpdateKey() called
401+
// in SeekForGet().
399402
TEST_SYNC_POINT_CALLBACK("DataBlockIter::SeekForGetImpl::value",
400403
(void*)value_.data());
401404
if (!Block::VerifyChecksum(
@@ -405,9 +408,6 @@ bool DataBlockIter::SeekForGetImpl(const Slice& target) {
405408
PerKVChecksumCorruptionError();
406409
return true;
407410
}
408-
// If the loop exits due to CompareCurrentKey(target) >= 0, then current key
409-
// exists, and its checksum verification will be done in UpdateKey() called
410-
// in SeekForGet().
411411
}
412412

413413
if (current_ == restarts_) {

table/block_based/block.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,13 @@ class Block {
273273
return VerifyKVChecksum(checksum_len, checksum_ptr, expected);
274274
}
275275

276-
static void GenerateKVChecksum(char* checksum_ptr, uint32_t checksum_len,
276+
static void GenerateKVChecksum(char* checksum_ptr, uint8_t checksum_len,
277277
const Slice& key, const Slice& value) {
278278
uint64_t checksum = ProtectionInfo64().ProtectKV(key, value).GetVal();
279279
EncodeKVChecksum(checksum, checksum_len, checksum_ptr);
280280
}
281281

282-
[[nodiscard]] const char* TEST_GetKVChecksum() const { return kv_checksum_; }
282+
const char* TEST_GetKVChecksum() const { return kv_checksum_; }
283283

284284
private:
285285
BlockContents contents_;

table/block_based/block_test.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1290,8 +1290,8 @@ TEST_P(DataBlockKVChecksumCorruptionTest, CorruptInUpdateKey) {
12901290
}
12911291

12921292
// Test checksum verification in SeekForGetImpl()
1293-
// check kNumRecords == 1 so that data_block_hash_index does not have
1294-
// kCollision entry in it, and the callback below will be called.
1293+
// Only test when kNumRecords == 1 since otherwise there could be collision
1294+
// in data_block_hash_index and the callback below will not be called.
12951295
if (GetDataBlockIndexType() == BlockBasedTableOptions::DataBlockIndexType::
12961296
kDataBlockBinaryAndHash &&
12971297
kNumRecords == 1) {

0 commit comments

Comments
 (0)