diff --git a/db/compaction/compaction_job.cc b/db/compaction/compaction_job.cc index 0bdc9fd522..9480907763 100644 --- a/db/compaction/compaction_job.cc +++ b/db/compaction/compaction_job.cc @@ -13,14 +13,12 @@ #include #include #include -#include #include #include #include "db/blob/blob_counting_iterator.h" #include "db/blob/blob_file_addition.h" #include "db/blob/blob_file_builder.h" -#include "db/builder.h" #include "db/compaction/clipping_iterator.h" #include "db/compaction/compaction_state.h" #include "db/db_impl/db_impl.h" @@ -49,7 +47,6 @@ #include "rocksdb/options.h" #include "rocksdb/statistics.h" #include "rocksdb/status.h" -#include "rocksdb/table.h" #include "rocksdb/utilities/options_type.h" #include "table/merging_iterator.h" #include "table/table_builder.h" @@ -219,8 +216,8 @@ void CompactionJob::ReportStartedCompaction(Compaction* compaction) { ThreadStatusUtil::SetThreadOperationProperty( ThreadStatus::COMPACTION_PROP_FLAGS, - compaction->is_manual_compaction() + - (compaction->deletion_compaction() << 1)); + static_cast(compaction->is_manual_compaction()) + + (static_cast(compaction->deletion_compaction()) << 1)); ThreadStatusUtil::SetThreadOperationProperty( ThreadStatus::COMPACTION_TOTAL_INPUT_BYTES, @@ -260,7 +257,7 @@ void CompactionJob::Prepare() { StopWatch sw(db_options_.clock, stats_, SUBCOMPACTION_SETUP_TIME); GenSubcompactionBoundaries(); } - if (boundaries_.size() >= 1) { + if (!boundaries_.empty()) { for (size_t i = 0; i <= boundaries_.size(); i++) { compact_->sub_compact_states.emplace_back( c, (i != 0) ? std::optional(boundaries_[i - 1]) : std::nullopt, @@ -1051,12 +1048,10 @@ void CompactionJob::NotifyOnSubcompactionBegin( listener->OnSubcompactionBegin(info); } info.status.PermitUncheckedError(); - } void CompactionJob::NotifyOnSubcompactionCompleted( SubcompactionState* sub_compact) { - if (db_options_.listeners.empty()) { return; } @@ -1064,7 +1059,7 @@ void CompactionJob::NotifyOnSubcompactionCompleted( return; } - if (sub_compact->notify_on_subcompaction_completion == false) { + if (!sub_compact->notify_on_subcompaction_completion) { return; } @@ -1562,7 +1557,7 @@ Status CompactionJob::FinishCompactionOutputFile( // Add range tombstones auto earliest_snapshot = kMaxSequenceNumber; - if (existing_snapshots_.size() > 0) { + if (!existing_snapshots_.empty()) { earliest_snapshot = existing_snapshots_[0]; } if (s.ok()) { @@ -1690,7 +1685,7 @@ Status CompactionJob::FinishCompactionOutputFile( // Report new file to SstFileManagerImpl auto sfm = - static_cast(db_options_.sst_file_manager.get()); + dynamic_cast(db_options_.sst_file_manager.get()); if (sfm && meta != nullptr && meta->fd.GetPathId() == 0) { Status add_s = sfm->OnAddFile(fname); if (!add_s.ok() && s.ok()) {