|
|
@ -594,7 +594,7 @@ void DBImpl::CompactRange(const Slice* begin, const Slice* end) { |
|
|
|
} |
|
|
|
} |
|
|
|
TEST_CompactMemTable(); // TODO(sanjay): Skip if memtable does not overlap
|
|
|
|
for (int level = 0; level < max_level_with_files; level++) { |
|
|
|
for (int level = 0; level < max_level_with_files + 1; level++) { |
|
|
|
TEST_CompactRange(level, begin, end); |
|
|
|
} |
|
|
|
} |
|
|
@ -602,7 +602,11 @@ void DBImpl::CompactRange(const Slice* begin, const Slice* end) { |
|
|
|
void DBImpl::TEST_CompactRange(int level, const Slice* begin, |
|
|
|
const Slice* end) { |
|
|
|
assert(level >= 0); |
|
|
|
assert(level + 1 < config::kNumLevels); |
|
|
|
assert(level <= config::kNumLevels); |
|
|
|
|
|
|
|
if (level == config::kNumLevels) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
InternalKey begin_storage, end_storage; |
|
|
|
|
|
|
@ -966,6 +970,11 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) { |
|
|
|
last_sequence_for_key = kMaxSequenceNumber; |
|
|
|
} |
|
|
|
|
|
|
|
std::string value = input->value().ToString(); |
|
|
|
uint64_t ddl; |
|
|
|
DecodeDeadLineValue(&value, ddl); |
|
|
|
|
|
|
|
|
|
|
|
if (last_sequence_for_key <= compact->smallest_snapshot) { |
|
|
|
// Hidden by an newer entry for same user key
|
|
|
|
drop = true; // (A)
|
|
|
@ -980,6 +989,9 @@ Status DBImpl::DoCompactionWork(CompactionState* compact) { |
|
|
|
// few iterations of this loop (by rule (A) above).
|
|
|
|
// Therefore this deletion marker is obsolete and can be dropped.
|
|
|
|
drop = true; |
|
|
|
} else if (ddl <= std::time(nullptr)) { |
|
|
|
// TTL: data expired
|
|
|
|
drop = true; |
|
|
|
} |
|
|
|
|
|
|
|
last_sequence_for_key = ikey.sequence; |
|
|
|