some comment change

This commit is contained in:
Changyu Bi 2024-11-20 19:20:18 -08:00
parent 14676f78b4
commit f65b1f535c
7 changed files with 10 additions and 9 deletions

View File

@ -1515,9 +1515,9 @@ class DBImpl : public DB {
// REQUIRES: this thread is currently at the front of the main writer queue. // REQUIRES: this thread is currently at the front of the main writer queue.
// @param prep_log refers to the WAL that contains prepare record // @param prep_log refers to the WAL that contains prepare record
// for the transaction based on wbwi. // for the transaction based on wbwi.
// @param assigned_seqno Sequence number for the ingested memtable. // @param assigned_seqno Sequence numbers for the ingested memtable.
// @param the value of versions_->LastSequence() after the write ingests // @param last_seqno the value of versions_->LastSequence() after the write
// `wbwi` is done. // ingests `wbwi` is done.
Status IngestWBWI(std::shared_ptr<WriteBatchWithIndex> wbwi, Status IngestWBWI(std::shared_ptr<WriteBatchWithIndex> wbwi,
const WBWIMemTable::SeqnoRange& assigned_seqno, const WBWIMemTable::SeqnoRange& assigned_seqno,
uint64_t min_prep_log, SequenceNumber last_seqno); uint64_t min_prep_log, SequenceNumber last_seqno);

View File

@ -600,7 +600,8 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
// the seq per valid written key to mem. // the seq per valid written key to mem.
size_t seq_inc = seq_per_batch_ ? valid_batches : total_count; size_t seq_inc = seq_per_batch_ ? valid_batches : total_count;
if (wbwi) { if (wbwi) {
// Reserve sequence numbers for recovery. During recovery, // Reserve sequence numbers for the ingested memtable. We need to reserve
// at lease this amount for recovery. During recovery,
// transactions do not commit by ingesting WBWI. The sequence number // transactions do not commit by ingesting WBWI. The sequence number
// associated with the commit entry in WAL is used as the starting // associated with the commit entry in WAL is used as the starting
// sequence number for inserting into memtable. We need to reserve // sequence number for inserting into memtable. We need to reserve

View File

@ -447,6 +447,7 @@ void MemTableList::PickMemtablesToFlush(uint64_t max_memtable_id,
} }
} }
if (!ret->empty() && it != memlist.rend()) { if (!ret->empty() && it != memlist.rend()) {
// checks that the first memtable not picked to flush is not ingested wbwi.
// Ingested memtable should be flushed together with the memtable before it // Ingested memtable should be flushed together with the memtable before it
// since they map to the same WAL and have the same NextLogNumber(). // since they map to the same WAL and have the same NextLogNumber().
assert(strcmp((*it)->Name(), "WBWIMemTable") != 0); assert(strcmp((*it)->Name(), "WBWIMemTable") != 0);

View File

@ -346,8 +346,9 @@ struct TransactionOptions {
// makes Commit() much faster for transactions with many operations. // makes Commit() much faster for transactions with many operations.
// //
// Note that the transaction will be ingested as an immutable memtable for // Note that the transaction will be ingested as an immutable memtable for
// each CF it updates. So ingesting many transactions in a short period of // CFs it updates, and the current memtable will be switched to a new one.
// time may cause stall due to too many memtables. // So ingesting many transactions in a short period of time may cause stall
// due to too many memtables.
bool commit_bypass_memtable = false; bool commit_bypass_memtable = false;
}; };

View File

@ -358,7 +358,7 @@ class WriteBatchWithIndex : public WriteBatchBase {
uint32_t entry_count = 0; uint32_t entry_count = 0;
uint32_t overwritten_sd_count = 0; uint32_t overwritten_sd_count = 0;
}; };
// Will track CF ID, per CF entry count and overwritten sd count writes. // Will track CF ID, per CF entry count and overwritten sd count.
// Should be enabled when WBWI is empty for correct tracking. // Should be enabled when WBWI is empty for correct tracking.
void SetTrackPerCFStat(bool track); void SetTrackPerCFStat(bool track);
const std::unordered_map<uint32_t, CFStat>& GetCFStats() const; const std::unordered_map<uint32_t, CFStat>& GetCFStats() const;

View File

@ -25,7 +25,6 @@ namespace ROCKSDB_NAMESPACE {
// - live memtable contains SD(k) // - live memtable contains SD(k)
// - flush memtable and compact with L0 will drop SD(k) and PUT(k) // - flush memtable and compact with L0 will drop SD(k) and PUT(k)
// - the PUT(k) in L1 incorrectly becomes visible // - the PUT(k) in L1 incorrectly becomes visible
//
// So during flush, iterator from this memtable will need emit overwritten // So during flush, iterator from this memtable will need emit overwritten
// single deletion. These single deletion entries will be // single deletion. These single deletion entries will be
// assigned seqno.upper_bound - 1. // assigned seqno.upper_bound - 1.

View File

@ -123,7 +123,6 @@ bool WriteBatchWithIndex::Rep::UpdateExistingEntryWithCfId(
if (track_cf_stat) { if (track_cf_stat) {
if (non_const_entry->has_single_del && if (non_const_entry->has_single_del &&
!non_const_entry->has_overwritten_single_del) { !non_const_entry->has_overwritten_single_del) {
// increment count here
cf_id_to_stat[column_family_id].overwritten_sd_count++; cf_id_to_stat[column_family_id].overwritten_sd_count++;
non_const_entry->has_overwritten_single_del = true; non_const_entry->has_overwritten_single_del = true;
} }