From 55d88c17c9657eddf338366bd05f42973736ee24 Mon Sep 17 00:00:00 2001 From: Yao Xiao <87789492+yao-xiao-github@users.noreply.github.com> Date: Wed, 17 Jan 2024 16:26:26 -0800 Subject: [PATCH] Rename knobs and clean up some trace events. (#11135) --- fdbclient/ServerKnobs.cpp | 3 +++ fdbclient/include/fdbclient/ServerKnobs.h | 2 ++ .../KeyValueStoreShardedRocksDB.actor.cpp | 23 ++++++++++--------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/fdbclient/ServerKnobs.cpp b/fdbclient/ServerKnobs.cpp index 77b04bc4f4..ada4a7de70 100644 --- a/fdbclient/ServerKnobs.cpp +++ b/fdbclient/ServerKnobs.cpp @@ -568,6 +568,9 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi init( SHARDED_ROCKSDB_TARGET_FILE_SIZE_MULTIPLIER, 1 ); // RocksDB default. init( SHARDED_ROCKSDB_SUGGEST_COMPACT_CLEAR_RANGE, true ); init( SHARDED_ROCKSDB_MAX_BACKGROUND_JOBS, 4 ); + init( SHARDED_ROCKSDB_BLOCK_CACHE_SIZE, isSimulated? 16 * 1024 : 134217728 /* 128MB */); + // Set to 0 to disable rocksdb write rate limiting. Rate limiter unit: bytes per second. + init( SHARDED_ROCKSDB_WRITE_RATE_LIMITER_BYTES_PER_SEC, 33554432 ); // Leader election bool longLeaderElection = randomize && BUGGIFY; diff --git a/fdbclient/include/fdbclient/ServerKnobs.h b/fdbclient/include/fdbclient/ServerKnobs.h index 60406c39dd..0ad446e236 100644 --- a/fdbclient/include/fdbclient/ServerKnobs.h +++ b/fdbclient/include/fdbclient/ServerKnobs.h @@ -524,6 +524,8 @@ public: int SHARDED_ROCKSDB_TARGET_FILE_SIZE_MULTIPLIER; bool SHARDED_ROCKSDB_SUGGEST_COMPACT_CLEAR_RANGE; int SHARDED_ROCKSDB_MAX_BACKGROUND_JOBS; + int64_t SHARDED_ROCKSDB_BLOCK_CACHE_SIZE; + int64_t SHARDED_ROCKSDB_WRITE_RATE_LIMITER_BYTES_PER_SEC; // Leader election int MAX_NOTIFICATIONS; diff --git a/fdbserver/KeyValueStoreShardedRocksDB.actor.cpp b/fdbserver/KeyValueStoreShardedRocksDB.actor.cpp index db7d8ea50b..e7cd8b7bb5 100644 --- a/fdbserver/KeyValueStoreShardedRocksDB.actor.cpp +++ b/fdbserver/KeyValueStoreShardedRocksDB.actor.cpp @@ -141,11 +141,12 @@ public: void OnStallConditionsChanged(const rocksdb::WriteStallInfo& info) override { auto curState = getWriteStallState(info.condition.cur); auto prevState = getWriteStallState(info.condition.prev); - auto severity = curState == 1 ? SevWarnAlways : SevInfo; - TraceEvent(severity, "WriteStallInfo", logId) - .detail("CF", info.cf_name) - .detail("CurrentState", curState) - .detail("PrevState", prevState); + if (curState == 1) { + TraceEvent(SevWarn, "WriteStallInfo", logId) + .detail("CF", info.cf_name) + .detail("CurrentState", curState) + .detail("PrevState", prevState); + } } // Flush reason code: @@ -749,8 +750,8 @@ rocksdb::ColumnFamilyOptions getCFOptions() { bbOpts.whole_key_filtering = false; } - if (rocksdb_block_cache == nullptr && SERVER_KNOBS->ROCKSDB_BLOCK_CACHE_SIZE > 0) { - rocksdb_block_cache = rocksdb::NewLRUCache(SERVER_KNOBS->ROCKSDB_BLOCK_CACHE_SIZE); + if (rocksdb_block_cache == nullptr && SERVER_KNOBS->SHARDED_ROCKSDB_BLOCK_CACHE_SIZE > 0) { + rocksdb_block_cache = rocksdb::NewLRUCache(SERVER_KNOBS->SHARDED_ROCKSDB_BLOCK_CACHE_SIZE); } bbOpts.block_cache = rocksdb_block_cache; @@ -1274,7 +1275,7 @@ public: const double start = now(); // Open instance. TraceEvent(SevInfo, "ShardedRocksDBInitBegin", this->logId).detail("DataPath", path); - if (SERVER_KNOBS->ROCKSDB_WRITE_RATE_LIMITER_BYTES_PER_SEC > 0) { + if (SERVER_KNOBS->SHARDED_ROCKSDB_WRITE_RATE_LIMITER_BYTES_PER_SEC > 0) { // Set rate limiter to a higher rate to avoid blocking storage engine initialization. auto rateLimiter = rocksdb::NewGenericRateLimiter((int64_t)5 << 30, // 5GB 100 * 1000, // refill_period_us @@ -1433,8 +1434,8 @@ public: writeBatch = std::make_unique(); dirtyShards = std::make_unique>(); - if (SERVER_KNOBS->ROCKSDB_WRITE_RATE_LIMITER_BYTES_PER_SEC > 0) { - dbOptions.rate_limiter->SetBytesPerSecond(SERVER_KNOBS->ROCKSDB_WRITE_RATE_LIMITER_BYTES_PER_SEC); + if (SERVER_KNOBS->SHARDED_ROCKSDB_WRITE_RATE_LIMITER_BYTES_PER_SEC > 0) { + dbOptions.rate_limiter->SetBytesPerSecond(SERVER_KNOBS->SHARDED_ROCKSDB_WRITE_RATE_LIMITER_BYTES_PER_SEC); } TraceEvent(SevInfo, "ShardedRocksDBInitEnd", this->logId) .detail("DataPath", path) @@ -2891,7 +2892,7 @@ struct ShardedRocksDBKeyValueStore : IKeyValueStore { } } - if (SERVER_KNOBS->ROCKSDB_SUGGEST_COMPACT_CLEAR_RANGE) { + if (SERVER_KNOBS->SHARDED_ROCKSDB_SUGGEST_COMPACT_CLEAR_RANGE) { for (const auto& [id, range] : deletes) { auto cf = columnFamilyMap->find(id); ASSERT(cf != columnFamilyMap->end());