@ -30,7 +30,6 @@ CompactionIterator::CompactionIterator(
BlobFileBuilder * blob_file_builder , bool allow_data_in_errors ,
BlobFileBuilder * blob_file_builder , bool allow_data_in_errors ,
const Compaction * compaction , const CompactionFilter * compaction_filter ,
const Compaction * compaction , const CompactionFilter * compaction_filter ,
const std : : atomic < bool > * shutting_down ,
const std : : atomic < bool > * shutting_down ,
const SequenceNumber preserve_deletes_seqnum ,
const std : : atomic < int > * manual_compaction_paused ,
const std : : atomic < int > * manual_compaction_paused ,
const std : : atomic < bool > * manual_compaction_canceled ,
const std : : atomic < bool > * manual_compaction_canceled ,
const std : : shared_ptr < Logger > info_log ,
const std : : shared_ptr < Logger > info_log ,
@ -42,9 +41,8 @@ CompactionIterator::CompactionIterator(
blob_file_builder , allow_data_in_errors ,
blob_file_builder , allow_data_in_errors ,
std : : unique_ptr < CompactionProxy > (
std : : unique_ptr < CompactionProxy > (
compaction ? new RealCompaction ( compaction ) : nullptr ) ,
compaction ? new RealCompaction ( compaction ) : nullptr ) ,
compaction_filter , shutting_down , preserve_deletes_seqnum ,
compaction_filter , shutting_down , manual_compaction_paused ,
manual_compaction_paused , manual_compaction_canceled , info_log ,
manual_compaction_canceled , info_log , full_history_ts_low ) { }
full_history_ts_low ) { }
CompactionIterator : : CompactionIterator (
CompactionIterator : : CompactionIterator (
InternalIterator * input , const Comparator * cmp , MergeHelper * merge_helper ,
InternalIterator * input , const Comparator * cmp , MergeHelper * merge_helper ,
@ -57,7 +55,6 @@ CompactionIterator::CompactionIterator(
std : : unique_ptr < CompactionProxy > compaction ,
std : : unique_ptr < CompactionProxy > compaction ,
const CompactionFilter * compaction_filter ,
const CompactionFilter * compaction_filter ,
const std : : atomic < bool > * shutting_down ,
const std : : atomic < bool > * shutting_down ,
const SequenceNumber preserve_deletes_seqnum ,
const std : : atomic < int > * manual_compaction_paused ,
const std : : atomic < int > * manual_compaction_paused ,
const std : : atomic < bool > * manual_compaction_canceled ,
const std : : atomic < bool > * manual_compaction_canceled ,
const std : : shared_ptr < Logger > info_log ,
const std : : shared_ptr < Logger > info_log ,
@ -80,7 +77,6 @@ CompactionIterator::CompactionIterator(
shutting_down_ ( shutting_down ) ,
shutting_down_ ( shutting_down ) ,
manual_compaction_paused_ ( manual_compaction_paused ) ,
manual_compaction_paused_ ( manual_compaction_paused ) ,
manual_compaction_canceled_ ( manual_compaction_canceled ) ,
manual_compaction_canceled_ ( manual_compaction_canceled ) ,
preserve_deletes_seqnum_ ( preserve_deletes_seqnum ) ,
info_log_ ( info_log ) ,
info_log_ ( info_log ) ,
allow_data_in_errors_ ( allow_data_in_errors ) ,
allow_data_in_errors_ ( allow_data_in_errors ) ,
timestamp_size_ ( cmp_ ? cmp_ - > timestamp_size ( ) : 0 ) ,
timestamp_size_ ( cmp_ ? cmp_ - > timestamp_size ( ) : 0 ) ,
@ -758,7 +754,6 @@ void CompactionIterator::NextFromInput() {
( ikey_ . type = = kTypeDeletionWithTimestamp & &
( ikey_ . type = = kTypeDeletionWithTimestamp & &
cmp_with_history_ts_low_ < 0 ) ) & &
cmp_with_history_ts_low_ < 0 ) ) & &
DefinitelyInSnapshot ( ikey_ . sequence , earliest_snapshot_ ) & &
DefinitelyInSnapshot ( ikey_ . sequence , earliest_snapshot_ ) & &
ikeyNotNeededForIncrementalSnapshot ( ) & &
compaction_ - > KeyNotExistsBeyondOutputLevel ( ikey_ . user_key ,
compaction_ - > KeyNotExistsBeyondOutputLevel ( ikey_ . user_key ,
& level_ptrs_ ) ) {
& level_ptrs_ ) ) {
// TODO(noetzli): This is the only place where we use compaction_
// TODO(noetzli): This is the only place where we use compaction_
@ -792,7 +787,7 @@ void CompactionIterator::NextFromInput() {
} else if ( ( ikey_ . type = = kTypeDeletion | |
} else if ( ( ikey_ . type = = kTypeDeletion | |
( ikey_ . type = = kTypeDeletionWithTimestamp & &
( ikey_ . type = = kTypeDeletionWithTimestamp & &
cmp_with_history_ts_low_ < 0 ) ) & &
cmp_with_history_ts_low_ < 0 ) ) & &
bottommost_level_ & & ikeyNotNeededForIncrementalSnapshot ( ) ) {
bottommost_level_ ) {
// Handle the case where we have a delete key at the bottom most level
// Handle the case where we have a delete key at the bottom most level
// We can skip outputting the key iff there are no subsequent puts for this
// We can skip outputting the key iff there are no subsequent puts for this
// key
// key
@ -1060,8 +1055,7 @@ void CompactionIterator::PrepareOutput() {
// Can we do the same for levels above bottom level as long as
// Can we do the same for levels above bottom level as long as
// KeyNotExistsBeyondOutputLevel() return true?
// KeyNotExistsBeyondOutputLevel() return true?
if ( valid_ & & compaction_ ! = nullptr & &
if ( valid_ & & compaction_ ! = nullptr & &
! compaction_ - > allow_ingest_behind ( ) & &
! compaction_ - > allow_ingest_behind ( ) & & bottommost_level_ & &
ikeyNotNeededForIncrementalSnapshot ( ) & & bottommost_level_ & &
DefinitelyInSnapshot ( ikey_ . sequence , earliest_snapshot_ ) & &
DefinitelyInSnapshot ( ikey_ . sequence , earliest_snapshot_ ) & &
ikey_ . type ! = kTypeMerge ) {
ikey_ . type ! = kTypeMerge ) {
assert ( ikey_ . type ! = kTypeDeletion ) ;
assert ( ikey_ . type ! = kTypeDeletion ) ;
@ -1139,13 +1133,6 @@ inline SequenceNumber CompactionIterator::findEarliestVisibleSnapshot(
return kMaxSequenceNumber ;
return kMaxSequenceNumber ;
}
}
// used in 2 places - prevents deletion markers to be dropped if they may be
// needed and disables seqnum zero-out in PrepareOutput for recent keys.
inline bool CompactionIterator : : ikeyNotNeededForIncrementalSnapshot ( ) {
return ( ! compaction_ - > preserve_deletes ( ) ) | |
( ikey_ . sequence < preserve_deletes_seqnum_ ) ;
}
uint64_t CompactionIterator : : ComputeBlobGarbageCollectionCutoffFileNumber (
uint64_t CompactionIterator : : ComputeBlobGarbageCollectionCutoffFileNumber (
const CompactionProxy * compaction ) {
const CompactionProxy * compaction ) {
if ( ! compaction ) {
if ( ! compaction ) {