|
|
@ -6,26 +6,46 @@ |
|
|
|
#include "db/write_stall_stats.h" |
|
|
|
#include "db/write_stall_stats.h" |
|
|
|
|
|
|
|
|
|
|
|
namespace ROCKSDB_NAMESPACE { |
|
|
|
namespace ROCKSDB_NAMESPACE { |
|
|
|
const std::string kInvalidWriteStallCauseHyphenString = "invalid"; |
|
|
|
const std::string& InvalidWriteStallHyphenString() { |
|
|
|
|
|
|
|
static const std::string kInvalidWriteStallHyphenString = "invalid"; |
|
|
|
const std::array<std::string, static_cast<uint32_t>(WriteStallCause::kNone)> |
|
|
|
return kInvalidWriteStallHyphenString; |
|
|
|
kWriteStallCauseToHyphenString{{ |
|
|
|
} |
|
|
|
"memtable-limit", |
|
|
|
|
|
|
|
"l0-file-count-limit", |
|
|
|
const std::string& WriteStallCauseToHyphenString(WriteStallCause cause) { |
|
|
|
"pending-compaction-bytes", |
|
|
|
static const std::string kMemtableLimit = "memtable-limit"; |
|
|
|
// WriteStallCause::kCFScopeWriteStallCauseEnumMax
|
|
|
|
static const std::string kL0FileCountLimit = "l0-file-count-limit"; |
|
|
|
kInvalidWriteStallCauseHyphenString, |
|
|
|
static const std::string kPendingCompactionBytes = "pending-compaction-bytes"; |
|
|
|
"write-buffer-manager-limit", |
|
|
|
static const std::string kWriteBufferManagerLimit = |
|
|
|
// WriteStallCause::kDBScopeWriteStallCauseEnumMax
|
|
|
|
"write-buffer-manager-limit"; |
|
|
|
kInvalidWriteStallCauseHyphenString, |
|
|
|
switch (cause) { |
|
|
|
}}; |
|
|
|
case WriteStallCause::kMemtableLimit: |
|
|
|
|
|
|
|
return kMemtableLimit; |
|
|
|
const std::array<std::string, |
|
|
|
case WriteStallCause::kL0FileCountLimit: |
|
|
|
static_cast<uint32_t>(WriteStallCondition::kNormal)> |
|
|
|
return kL0FileCountLimit; |
|
|
|
kWriteStallConditionToHyphenString{{ |
|
|
|
case WriteStallCause::kPendingCompactionBytes: |
|
|
|
"delays", |
|
|
|
return kPendingCompactionBytes; |
|
|
|
"stops", |
|
|
|
case WriteStallCause::kWriteBufferManagerLimit: |
|
|
|
}}; |
|
|
|
return kWriteBufferManagerLimit; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return InvalidWriteStallHyphenString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const std::string& WriteStallConditionToHyphenString( |
|
|
|
|
|
|
|
WriteStallCondition condition) { |
|
|
|
|
|
|
|
static const std::string kDelayed = "delays"; |
|
|
|
|
|
|
|
static const std::string kStopped = "stops"; |
|
|
|
|
|
|
|
switch (condition) { |
|
|
|
|
|
|
|
case WriteStallCondition::kDelayed: |
|
|
|
|
|
|
|
return kDelayed; |
|
|
|
|
|
|
|
case WriteStallCondition::kStopped: |
|
|
|
|
|
|
|
return kStopped; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return InvalidWriteStallHyphenString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
InternalStats::InternalCFStatsType InternalCFStat( |
|
|
|
InternalStats::InternalCFStatsType InternalCFStat( |
|
|
|
WriteStallCause cause, WriteStallCondition condition) { |
|
|
|
WriteStallCause cause, WriteStallCondition condition) { |
|
|
@ -139,14 +159,14 @@ std::string WriteStallStatsMapKeys::CauseConditionCount( |
|
|
|
|
|
|
|
|
|
|
|
std::string cause_name; |
|
|
|
std::string cause_name; |
|
|
|
if (isCFScopeWriteStallCause(cause) || isDBScopeWriteStallCause(cause)) { |
|
|
|
if (isCFScopeWriteStallCause(cause) || isDBScopeWriteStallCause(cause)) { |
|
|
|
cause_name = kWriteStallCauseToHyphenString[static_cast<uint32_t>(cause)]; |
|
|
|
cause_name = WriteStallCauseToHyphenString(cause); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
assert(false); |
|
|
|
assert(false); |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const std::string& condition_name = |
|
|
|
const std::string& condition_name = |
|
|
|
kWriteStallConditionToHyphenString[static_cast<uint32_t>(condition)]; |
|
|
|
WriteStallConditionToHyphenString(condition); |
|
|
|
|
|
|
|
|
|
|
|
cause_condition_count_name.reserve(cause_name.size() + 1 + |
|
|
|
cause_condition_count_name.reserve(cause_name.size() + 1 + |
|
|
|
condition_name.size()); |
|
|
|
condition_name.size()); |
|
|
|