Fix block cache size error and improve logging. (#11681)
This commit is contained in:
parent
70f9440e7d
commit
83dd1f202e
|
@ -607,7 +607,7 @@ 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 : 2 << 30); // 2GB
|
||||
init( SHARDED_ROCKSDB_BLOCK_CACHE_SIZE, isSimulated? 128 << 20 : 2LL << 30); // 2GB
|
||||
init( SHARDED_ROCKSDB_CACHE_HIGH_PRI_POOL_RATIO, 0.5 ); /* Share of high priority Index&filter blocks in cache */
|
||||
init( SHARDED_ROCKSDB_CACHE_INDEX_AND_FILTER_BLOCKS, true );
|
||||
// Set to 0 to disable rocksdb write rate limiting. Rate limiter unit: bytes per second.
|
||||
|
|
|
@ -140,6 +140,45 @@ int getWriteStallState(const rocksdb::WriteStallCondition& condition) {
|
|||
return 3;
|
||||
}
|
||||
|
||||
// RocksDB's reason string contains spaces and will break trace events.
|
||||
// Reference https://sourcegraph.com/github.com/facebook/rocksdb/-/blob/db/flush_job.cc?L52
|
||||
const char* getFlushReasonString(FlushReason flush_reason) {
|
||||
switch (flush_reason) {
|
||||
case FlushReason::kOthers:
|
||||
return "ReasonOthers";
|
||||
case FlushReason::kGetLiveFiles:
|
||||
return "ReasonGetLiveFiles";
|
||||
case FlushReason::kShutDown:
|
||||
return "ReasonShutdown";
|
||||
case FlushReason::kExternalFileIngestion:
|
||||
return "ReasonExternalFileIngestion";
|
||||
case FlushReason::kManualCompaction:
|
||||
return "ReasonManualCompaction";
|
||||
case FlushReason::kWriteBufferManager:
|
||||
return "ReasonWriteBufferManager";
|
||||
case FlushReason::kWriteBufferFull:
|
||||
return "ReasonWriteBufferFull";
|
||||
case FlushReason::kTest:
|
||||
return "ReasonTest";
|
||||
case FlushReason::kDeleteFiles:
|
||||
return "ReasonDeleteFiles";
|
||||
case FlushReason::kAutoCompaction:
|
||||
return "ReasonAutoCompaction";
|
||||
case FlushReason::kManualFlush:
|
||||
return "ReasonManualFlush";
|
||||
case FlushReason::kErrorRecovery:
|
||||
return "ReasonErrorRecovery";
|
||||
case FlushReason::kErrorRecoveryRetryFlush:
|
||||
return "ReasonErrorRecoveryRetryFlush";
|
||||
case FlushReason::kWalFull:
|
||||
return "ReasonWALFull";
|
||||
case FlushReason::kCatchUpAfterErrorRecovery:
|
||||
return "ReasonCatchUpAfterErrorRecovery";
|
||||
default:
|
||||
return "ReasonInvalid";
|
||||
}
|
||||
}
|
||||
|
||||
class RocksDBEventListener : public rocksdb::EventListener {
|
||||
public:
|
||||
RocksDBEventListener(UID id)
|
||||
|
@ -193,7 +232,7 @@ public:
|
|||
e.detail("DurationSeconds", now() - lastResetTime);
|
||||
e.detail("FlushCountTotal", flushCount);
|
||||
for (int i = 0; i < ROCKSDB_NUM_FLUSH_REASONS; ++i) {
|
||||
e.detail(rocksdb::GetFlushReasonString((rocksdb::FlushReason)i), flushReasons[i]);
|
||||
e.detail(getFlushReasonString((rocksdb::FlushReason)i), flushReasons[i]);
|
||||
}
|
||||
}
|
||||
if (compactionCount > 0) {
|
||||
|
|
Loading…
Reference in New Issue