diff --git a/db/column_family.cc b/db/column_family.cc index b00eda074..b4ff92951 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -626,7 +626,7 @@ void ColumnFamilyData::RecalculateWriteStallConditions( if (imm()->NumNotFlushed() >= mutable_cf_options.max_write_buffer_number) { write_controller_token_ = write_controller->GetStopToken(); - internal_stats_->AddCFStats(InternalStats::MEMTABLE_COMPACTION, 1); + internal_stats_->AddCFStats(InternalStats::MEMTABLE_LIMIT_STOPS, 1); ROCKS_LOG_WARN( ioptions_.info_log, "[%s] Stopping writes because we have %d immutable memtables " @@ -637,10 +637,10 @@ void ColumnFamilyData::RecalculateWriteStallConditions( vstorage->l0_delay_trigger_count() >= mutable_cf_options.level0_stop_writes_trigger) { write_controller_token_ = write_controller->GetStopToken(); - internal_stats_->AddCFStats(InternalStats::LEVEL0_NUM_FILES_TOTAL, 1); + internal_stats_->AddCFStats(InternalStats::L0_FILE_COUNT_LIMIT_STOPS, 1); if (compaction_picker_->IsLevel0CompactionInProgress()) { internal_stats_->AddCFStats( - InternalStats::LEVEL0_NUM_FILES_WITH_COMPACTION, 1); + InternalStats::LOCKED_L0_FILE_COUNT_LIMIT_STOPS, 1); } ROCKS_LOG_WARN(ioptions_.info_log, "[%s] Stopping writes because we have %d level-0 files", @@ -651,7 +651,7 @@ void ColumnFamilyData::RecalculateWriteStallConditions( mutable_cf_options.hard_pending_compaction_bytes_limit) { write_controller_token_ = write_controller->GetStopToken(); internal_stats_->AddCFStats( - InternalStats::HARD_PENDING_COMPACTION_BYTES_LIMIT, 1); + InternalStats::PENDING_COMPACTION_BYTES_LIMIT_STOPS, 1); ROCKS_LOG_WARN( ioptions_.info_log, "[%s] Stopping writes because of estimated pending compaction " @@ -664,7 +664,7 @@ void ColumnFamilyData::RecalculateWriteStallConditions( SetupDelay(write_controller, compaction_needed_bytes, prev_compaction_needed_bytes_, was_stopped, mutable_cf_options.disable_auto_compactions); - internal_stats_->AddCFStats(InternalStats::MEMTABLE_SLOWDOWN, 1); + internal_stats_->AddCFStats(InternalStats::MEMTABLE_LIMIT_SLOWDOWNS, 1); ROCKS_LOG_WARN( ioptions_.info_log, "[%s] Stalling writes because we have %d immutable memtables " @@ -684,10 +684,11 @@ void ColumnFamilyData::RecalculateWriteStallConditions( SetupDelay(write_controller, compaction_needed_bytes, prev_compaction_needed_bytes_, was_stopped || near_stop, mutable_cf_options.disable_auto_compactions); - internal_stats_->AddCFStats(InternalStats::LEVEL0_SLOWDOWN_TOTAL, 1); + internal_stats_->AddCFStats(InternalStats::L0_FILE_COUNT_LIMIT_SLOWDOWNS, + 1); if (compaction_picker_->IsLevel0CompactionInProgress()) { internal_stats_->AddCFStats( - InternalStats::LEVEL0_SLOWDOWN_WITH_COMPACTION, 1); + InternalStats::LOCKED_L0_FILE_COUNT_LIMIT_SLOWDOWNS, 1); } ROCKS_LOG_WARN(ioptions_.info_log, "[%s] Stalling writes because we have %d level-0 files " @@ -714,7 +715,7 @@ void ColumnFamilyData::RecalculateWriteStallConditions( prev_compaction_needed_bytes_, was_stopped || near_stop, mutable_cf_options.disable_auto_compactions); internal_stats_->AddCFStats( - InternalStats::SOFT_PENDING_COMPACTION_BYTES_LIMIT, 1); + InternalStats::PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS, 1); ROCKS_LOG_WARN( ioptions_.info_log, "[%s] Stalling writes because of estimated pending compaction " diff --git a/db/internal_stats.cc b/db/internal_stats.cc index 463f67b8e..a56c05001 100644 --- a/db/internal_stats.cc +++ b/db/internal_stats.cc @@ -991,31 +991,30 @@ void InternalStats::DumpCFMapStats( void InternalStats::DumpCFMapStatsIOStalls( std::map* cf_stats) { (*cf_stats)["io_stalls.level0_slowdown"] = - std::to_string(cf_stats_count_[LEVEL0_SLOWDOWN_TOTAL]); + std::to_string(cf_stats_count_[L0_FILE_COUNT_LIMIT_SLOWDOWNS]); (*cf_stats)["io_stalls.level0_slowdown_with_compaction"] = - std::to_string(cf_stats_count_[LEVEL0_SLOWDOWN_WITH_COMPACTION]); + std::to_string(cf_stats_count_[LOCKED_L0_FILE_COUNT_LIMIT_SLOWDOWNS]); (*cf_stats)["io_stalls.level0_numfiles"] = - std::to_string(cf_stats_count_[LEVEL0_NUM_FILES_TOTAL]); + std::to_string(cf_stats_count_[L0_FILE_COUNT_LIMIT_STOPS]); (*cf_stats)["io_stalls.level0_numfiles_with_compaction"] = - std::to_string(cf_stats_count_[LEVEL0_NUM_FILES_WITH_COMPACTION]); + std::to_string(cf_stats_count_[LOCKED_L0_FILE_COUNT_LIMIT_STOPS]); (*cf_stats)["io_stalls.stop_for_pending_compaction_bytes"] = - std::to_string(cf_stats_count_[HARD_PENDING_COMPACTION_BYTES_LIMIT]); + std::to_string(cf_stats_count_[PENDING_COMPACTION_BYTES_LIMIT_STOPS]); (*cf_stats)["io_stalls.slowdown_for_pending_compaction_bytes"] = - std::to_string(cf_stats_count_[SOFT_PENDING_COMPACTION_BYTES_LIMIT]); + std::to_string(cf_stats_count_[PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS]); (*cf_stats)["io_stalls.memtable_compaction"] = - std::to_string(cf_stats_count_[MEMTABLE_COMPACTION]); + std::to_string(cf_stats_count_[MEMTABLE_LIMIT_STOPS]); (*cf_stats)["io_stalls.memtable_slowdown"] = - std::to_string(cf_stats_count_[MEMTABLE_SLOWDOWN]); + std::to_string(cf_stats_count_[MEMTABLE_LIMIT_SLOWDOWNS]); - uint64_t total_stop = - cf_stats_count_[LEVEL0_NUM_FILES_TOTAL] + - cf_stats_count_[HARD_PENDING_COMPACTION_BYTES_LIMIT] + - cf_stats_count_[MEMTABLE_COMPACTION]; + uint64_t total_stop = cf_stats_count_[L0_FILE_COUNT_LIMIT_STOPS] + + cf_stats_count_[PENDING_COMPACTION_BYTES_LIMIT_STOPS] + + cf_stats_count_[MEMTABLE_LIMIT_STOPS]; uint64_t total_slowdown = - cf_stats_count_[LEVEL0_SLOWDOWN_TOTAL] + - cf_stats_count_[SOFT_PENDING_COMPACTION_BYTES_LIMIT] + - cf_stats_count_[MEMTABLE_SLOWDOWN]; + cf_stats_count_[L0_FILE_COUNT_LIMIT_SLOWDOWNS] + + cf_stats_count_[PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS] + + cf_stats_count_[MEMTABLE_LIMIT_SLOWDOWNS]; (*cf_stats)["io_stalls.total_stop"] = std::to_string(total_stop); (*cf_stats)["io_stalls.total_slowdown"] = std::to_string(total_slowdown); @@ -1055,11 +1054,12 @@ void InternalStats::DumpCFStatsNoFileHistogram(std::string* value) { uint64_t ingest_keys_addfile = cf_stats_value_[INGESTED_NUM_KEYS_TOTAL]; // Cumulative summary uint64_t total_stall_count = - cf_stats_count_[LEVEL0_SLOWDOWN_TOTAL] + - cf_stats_count_[LEVEL0_NUM_FILES_TOTAL] + - cf_stats_count_[SOFT_PENDING_COMPACTION_BYTES_LIMIT] + - cf_stats_count_[HARD_PENDING_COMPACTION_BYTES_LIMIT] + - cf_stats_count_[MEMTABLE_COMPACTION] + cf_stats_count_[MEMTABLE_SLOWDOWN]; + cf_stats_count_[L0_FILE_COUNT_LIMIT_SLOWDOWNS] + + cf_stats_count_[L0_FILE_COUNT_LIMIT_STOPS] + + cf_stats_count_[PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS] + + cf_stats_count_[PENDING_COMPACTION_BYTES_LIMIT_STOPS] + + cf_stats_count_[MEMTABLE_LIMIT_STOPS] + + cf_stats_count_[MEMTABLE_LIMIT_SLOWDOWNS]; // Interval summary uint64_t interval_flush_ingest = flush_ingest - cf_stats_snapshot_.ingest_bytes_flush; @@ -1148,31 +1148,32 @@ void InternalStats::DumpCFStatsNoFileHistogram(std::string* value) { cf_stats_snapshot_.compact_bytes_read = compact_bytes_read; cf_stats_snapshot_.compact_micros = compact_micros; - snprintf(buf, sizeof(buf), "Stalls(count): %" PRIu64 - " level0_slowdown, " - "%" PRIu64 - " level0_slowdown_with_compaction, " - "%" PRIu64 - " level0_numfiles, " - "%" PRIu64 - " level0_numfiles_with_compaction, " - "%" PRIu64 - " stop for pending_compaction_bytes, " - "%" PRIu64 - " slowdown for pending_compaction_bytes, " - "%" PRIu64 - " memtable_compaction, " - "%" PRIu64 - " memtable_slowdown, " - "interval %" PRIu64 " total count\n", - cf_stats_count_[LEVEL0_SLOWDOWN_TOTAL], - cf_stats_count_[LEVEL0_SLOWDOWN_WITH_COMPACTION], - cf_stats_count_[LEVEL0_NUM_FILES_TOTAL], - cf_stats_count_[LEVEL0_NUM_FILES_WITH_COMPACTION], - cf_stats_count_[HARD_PENDING_COMPACTION_BYTES_LIMIT], - cf_stats_count_[SOFT_PENDING_COMPACTION_BYTES_LIMIT], - cf_stats_count_[MEMTABLE_COMPACTION], - cf_stats_count_[MEMTABLE_SLOWDOWN], + snprintf(buf, sizeof(buf), + "Stalls(count): %" PRIu64 + " level0_slowdown, " + "%" PRIu64 + " level0_slowdown_with_compaction, " + "%" PRIu64 + " level0_numfiles, " + "%" PRIu64 + " level0_numfiles_with_compaction, " + "%" PRIu64 + " stop for pending_compaction_bytes, " + "%" PRIu64 + " slowdown for pending_compaction_bytes, " + "%" PRIu64 + " memtable_compaction, " + "%" PRIu64 + " memtable_slowdown, " + "interval %" PRIu64 " total count\n", + cf_stats_count_[L0_FILE_COUNT_LIMIT_SLOWDOWNS], + cf_stats_count_[LOCKED_L0_FILE_COUNT_LIMIT_SLOWDOWNS], + cf_stats_count_[L0_FILE_COUNT_LIMIT_STOPS], + cf_stats_count_[LOCKED_L0_FILE_COUNT_LIMIT_STOPS], + cf_stats_count_[PENDING_COMPACTION_BYTES_LIMIT_STOPS], + cf_stats_count_[PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS], + cf_stats_count_[MEMTABLE_LIMIT_STOPS], + cf_stats_count_[MEMTABLE_LIMIT_SLOWDOWNS], total_stall_count - cf_stats_snapshot_.stall_count); value->append(buf); diff --git a/db/internal_stats.h b/db/internal_stats.h index 66b9a9149..342e7d7d0 100644 --- a/db/internal_stats.h +++ b/db/internal_stats.h @@ -86,14 +86,14 @@ class InternalStats { static const std::map compaction_level_stats; enum InternalCFStatsType { - LEVEL0_SLOWDOWN_TOTAL, - LEVEL0_SLOWDOWN_WITH_COMPACTION, - MEMTABLE_COMPACTION, - MEMTABLE_SLOWDOWN, - LEVEL0_NUM_FILES_TOTAL, - LEVEL0_NUM_FILES_WITH_COMPACTION, - SOFT_PENDING_COMPACTION_BYTES_LIMIT, - HARD_PENDING_COMPACTION_BYTES_LIMIT, + L0_FILE_COUNT_LIMIT_SLOWDOWNS, + LOCKED_L0_FILE_COUNT_LIMIT_SLOWDOWNS, + MEMTABLE_LIMIT_STOPS, + MEMTABLE_LIMIT_SLOWDOWNS, + L0_FILE_COUNT_LIMIT_STOPS, + LOCKED_L0_FILE_COUNT_LIMIT_STOPS, + PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS, + PENDING_COMPACTION_BYTES_LIMIT_STOPS, WRITE_STALLS_ENUM_MAX, BYTES_FLUSHED, BYTES_INGESTED_ADD_FILE, @@ -496,14 +496,14 @@ class InternalStats { class InternalStats { public: enum InternalCFStatsType { - LEVEL0_SLOWDOWN_TOTAL, - LEVEL0_SLOWDOWN_WITH_COMPACTION, - MEMTABLE_COMPACTION, - MEMTABLE_SLOWDOWN, - LEVEL0_NUM_FILES_TOTAL, - LEVEL0_NUM_FILES_WITH_COMPACTION, - SOFT_PENDING_COMPACTION_BYTES_LIMIT, - HARD_PENDING_COMPACTION_BYTES_LIMIT, + L0_FILE_COUNT_LIMIT_SLOWDOWNS, + LOCKED_L0_FILE_COUNT_LIMIT_SLOWDOWNS, + MEMTABLE_LIMIT_STOPS, + MEMTABLE_LIMIT_SLOWDOWNS, + L0_FILE_COUNT_LIMIT_STOPS, + LOCKED_L0_FILE_COUNT_LIMIT_STOPS, + PENDING_COMPACTION_BYTES_LIMIT_SLOWDOWNS, + PENDING_COMPACTION_BYTES_LIMIT_STOPS, WRITE_STALLS_ENUM_MAX, BYTES_FLUSHED, BYTES_INGESTED_ADD_FILE,