Hex values in TSS logs and rocksb debuglogs mode knob (#10231)
This commit is contained in:
parent
c59e418d0f
commit
854464a6af
|
@ -478,6 +478,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
|
|||
init( ROCKSDB_DISABLE_WAL_EXPERIMENTAL, false );
|
||||
init( ROCKSDB_WAL_TTL_SECONDS, 0 );
|
||||
init( ROCKSDB_WAL_SIZE_LIMIT_MB, 0 );
|
||||
init( ROCKSDB_LOG_LEVEL_DEBUG, false );
|
||||
// If ROCKSDB_SINGLEKEY_DELETES_ON_CLEARRANGE is enabled, disable ROCKSDB_ENABLE_CLEAR_RANGE_EAGER_READS knob.
|
||||
// These knobs have contrary functionality.
|
||||
init( ROCKSDB_SINGLEKEY_DELETES_ON_CLEARRANGE, true );
|
||||
|
|
|
@ -149,6 +149,16 @@ static void traceKeyValuesSummary(TraceEvent& event,
|
|||
.detail("TSSReplySummary", tssSummaryString);
|
||||
}
|
||||
|
||||
// convert a StringRef to Hex string
|
||||
static std::string hexStringRef(const StringRef& s) {
|
||||
std::string result;
|
||||
result.reserve(s.size() * 2);
|
||||
for (int i = 0; i < s.size(); i++) {
|
||||
result.append(format("%02x", s[i]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static void traceKeyValuesDiff(TraceEvent& event,
|
||||
const KeySelectorRef& begin,
|
||||
const KeySelectorRef& end,
|
||||
|
@ -168,11 +178,17 @@ static void traceKeyValuesDiff(TraceEvent& event,
|
|||
event.detail("MismatchIndex", i);
|
||||
if (i >= ssKV.size() || i >= tssKV.size() || ssKV[i].key != tssKV[i].key) {
|
||||
event.detail("MismatchSSKey", i < ssKV.size() ? ssKV[i].key : "missing"_sr);
|
||||
event.detail("MismatchSSKeyHex", i < ssKV.size() ? hexStringRef(ssKV[i].key) : "missing"_sr);
|
||||
event.detail("MismatchTSSKey", i < tssKV.size() ? tssKV[i].key : "missing"_sr);
|
||||
event.detail("MismatchTSSKeyHex", i < tssKV.size() ? hexStringRef(tssKV[i].key) : "missing"_sr)
|
||||
.setMaxFieldLength(-1);
|
||||
} else {
|
||||
event.detail("MismatchKey", ssKV[i].key);
|
||||
event.detail("MismatchSSValue", traceChecksumValue(ssKV[i].value));
|
||||
event.detail("MismatchSSValueHex", hexStringRef(traceChecksumValue(ssKV[i].value)));
|
||||
event.detail("MismatchTSSValue", traceChecksumValue(tssKV[i].value));
|
||||
event.detail("MismatchTSSValueHex", hexStringRef(traceChecksumValue(tssKV[i].value)))
|
||||
.setMaxFieldLength(-1);
|
||||
}
|
||||
mismatchFound = true;
|
||||
break;
|
||||
|
|
|
@ -432,6 +432,7 @@ public:
|
|||
bool ROCKSDB_DISABLE_WAL_EXPERIMENTAL;
|
||||
int64_t ROCKSDB_WAL_TTL_SECONDS;
|
||||
int64_t ROCKSDB_WAL_SIZE_LIMIT_MB;
|
||||
bool ROCKSDB_LOG_LEVEL_DEBUG;
|
||||
bool ROCKSDB_SINGLEKEY_DELETES_ON_CLEARRANGE;
|
||||
int ROCKSDB_SINGLEKEY_DELETES_MAX;
|
||||
bool ROCKSDB_ENABLE_CLEAR_RANGE_EAGER_READS;
|
||||
|
|
|
@ -258,6 +258,9 @@ rocksdb::DBOptions SharedRocksDBState::initialDbOptions() {
|
|||
options.statistics->set_stats_level(rocksdb::StatsLevel(SERVER_KNOBS->ROCKSDB_STATS_LEVEL));
|
||||
|
||||
options.db_log_dir = g_network->isSimulated() ? "" : SERVER_KNOBS->LOG_DIRECTORY;
|
||||
if (SERVER_KNOBS->ROCKSDB_LOG_LEVEL_DEBUG) {
|
||||
options.info_log_level = rocksdb::InfoLogLevel::DEBUG_LEVEL;
|
||||
}
|
||||
|
||||
if (!SERVER_KNOBS->ROCKSDB_MUTE_LOGS) {
|
||||
options.info_log = std::make_shared<RocksDBLogForwarder>(id, options.info_log_level);
|
||||
|
|
|
@ -472,6 +472,9 @@ rocksdb::Options getOptions() {
|
|||
options.statistics = rocksdb::CreateDBStatistics();
|
||||
options.statistics->set_stats_level(rocksdb::kExceptHistogramOrTimers);
|
||||
options.db_log_dir = g_network->isSimulated() ? "" : SERVER_KNOBS->LOG_DIRECTORY;
|
||||
if (SERVER_KNOBS->ROCKSDB_LOG_LEVEL_DEBUG) {
|
||||
options.info_log_level = rocksdb::InfoLogLevel::DEBUG_LEVEL;
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue