@@ -3117,9 +3117,6 @@ Status DBImpl::DoCompactionWork(CompactionState* compact,
3117
3117
const uint64_t start_micros = env_->NowMicros ();
3118
3118
unique_ptr<Iterator> input (versions_->MakeInputIterator (compact->compaction ));
3119
3119
input->SeekToFirst ();
3120
- shared_ptr<Iterator> backup_input (
3121
- versions_->MakeInputIterator (compact->compaction ));
3122
- backup_input->SeekToFirst ();
3123
3120
3124
3121
Status status;
3125
3122
ParsedInternalKey ikey;
@@ -3132,14 +3129,30 @@ Status DBImpl::DoCompactionWork(CompactionState* compact,
3132
3129
auto compaction_filter_v2 =
3133
3130
compaction_filter_from_factory_v2.get ();
3134
3131
3135
- // temp_backup_input always point to the start of the current buffer
3136
- // temp_backup_input = backup_input;
3137
- // iterate through input,
3138
- // 1) buffer ineligible keys and value keys into 2 separate buffers;
3139
- // 2) send value_buffer to compaction filter and alternate the values;
3140
- // 3) merge value_buffer with ineligible_value_buffer;
3141
- // 4) run the modified "compaction" using the old for loop.
3142
- if (compaction_filter_v2) {
3132
+ if (!compaction_filter_v2) {
3133
+ status = ProcessKeyValueCompaction (
3134
+ is_snapshot_supported,
3135
+ visible_at_tip,
3136
+ earliest_snapshot,
3137
+ latest_snapshot,
3138
+ deletion_state,
3139
+ bottommost_level,
3140
+ imm_micros,
3141
+ input.get (),
3142
+ compact,
3143
+ false ,
3144
+ log_buffer);
3145
+ } else {
3146
+ // temp_backup_input always point to the start of the current buffer
3147
+ // temp_backup_input = backup_input;
3148
+ // iterate through input,
3149
+ // 1) buffer ineligible keys and value keys into 2 separate buffers;
3150
+ // 2) send value_buffer to compaction filter and alternate the values;
3151
+ // 3) merge value_buffer with ineligible_value_buffer;
3152
+ // 4) run the modified "compaction" using the old for loop.
3153
+ shared_ptr<Iterator> backup_input (
3154
+ versions_->MakeInputIterator (compact->compaction ));
3155
+ backup_input->SeekToFirst ();
3143
3156
while (backup_input->Valid () && !shutting_down_.Acquire_Load () &&
3144
3157
!cfd->IsDropped ()) {
3145
3158
// FLUSH preempts compaction
@@ -3267,21 +3280,6 @@ Status DBImpl::DoCompactionWork(CompactionState* compact,
3267
3280
log_buffer);
3268
3281
} // checking for compaction filter v2
3269
3282
3270
- if (!compaction_filter_v2) {
3271
- status = ProcessKeyValueCompaction (
3272
- is_snapshot_supported,
3273
- visible_at_tip,
3274
- earliest_snapshot,
3275
- latest_snapshot,
3276
- deletion_state,
3277
- bottommost_level,
3278
- imm_micros,
3279
- input.get (),
3280
- compact,
3281
- false ,
3282
- log_buffer);
3283
- }
3284
-
3285
3283
if (status.ok () && (shutting_down_.Acquire_Load () || cfd->IsDropped ())) {
3286
3284
status = Status::ShutdownInProgress (
3287
3285
" Database shutdown or Column family drop during compaction" );
0 commit comments