fix shardedrocksdb knob and add ENFORCE_SHARDED_ROCKSDB_SIM_IF_AVALIABLE (#11916)
This commit is contained in:
parent
b3c9c4a04d
commit
b0ff9187ad
|
|
@ -641,12 +641,13 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
|
|||
init( SHARDED_ROCKSDB_LEVEL0_FILENUM_COMPACTION_TRIGGER, 4 );
|
||||
init( SHARDED_ROCKSDB_LEVEL0_SLOWDOWN_WRITES_TRIGGER, 20 ); // RocksDB default.
|
||||
init( SHARDED_ROCKSDB_LEVEL0_STOP_WRITES_TRIGGER, 36 ); // RocksDB default.
|
||||
init( SHARDED_ROCKSDB_DELAY_COMPACTION_FOR_DATA_MOVE, false ); if (isSimulated) SHARDED_ROCKSDB_DELAY_COMPACTION_FOR_DATA_MOVE = true;
|
||||
init( SHARDED_ROCKSDB_DELAY_COMPACTION_FOR_DATA_MOVE, false ); // Open the knob can significantly slow down the simulation
|
||||
init( SHARDED_ROCKSDB_MAX_OPEN_FILES, 50000 ); // Should be smaller than OS's fd limit.
|
||||
init (SHARDED_ROCKSDB_READ_ASYNC_IO, false ); if (isSimulated) SHARDED_ROCKSDB_READ_ASYNC_IO = deterministicRandom()->coinflip();
|
||||
init( SHARDED_ROCKSDB_PREFIX_LEN, 0 ); if( randomize && BUGGIFY ) SHARDED_ROCKSDB_PREFIX_LEN = deterministicRandom()->randomInt(1, 20);
|
||||
init( SHARDED_ROCKSDB_HISTOGRAMS_SAMPLE_RATE, 0.001 ); if( randomize && BUGGIFY ) SHARDED_ROCKSDB_HISTOGRAMS_SAMPLE_RATE = 0;
|
||||
init( SHARDED_ROCKSDB_USE_DIRECT_IO, false ); if (isSimulated) SHARDED_ROCKSDB_USE_DIRECT_IO = deterministicRandom()->coinflip();
|
||||
init( SHARDED_ROCKSDB_USE_DIRECT_IO, false ); if (isSimulated) SHARDED_ROCKSDB_USE_DIRECT_IO = deterministicRandom()->coinflip();
|
||||
init( ENFORCE_SHARDED_ROCKSDB_SIM_IF_AVALIABLE, false ); // Turn off by default.
|
||||
|
||||
|
||||
// Leader election
|
||||
|
|
|
|||
|
|
@ -619,6 +619,7 @@ public:
|
|||
int SHARDED_ROCKSDB_PREFIX_LEN;
|
||||
double SHARDED_ROCKSDB_HISTOGRAMS_SAMPLE_RATE;
|
||||
bool SHARDED_ROCKSDB_USE_DIRECT_IO;
|
||||
bool ENFORCE_SHARDED_ROCKSDB_SIM_IF_AVALIABLE; // set to enforce shardedrocks in simulation as much as possible
|
||||
|
||||
// Leader election
|
||||
int MAX_NOTIFICATIONS;
|
||||
|
|
|
|||
|
|
@ -1846,7 +1846,12 @@ SimulationStorageEngine chooseSimulationStorageEngine(const TestConfig& testConf
|
|||
StringRef reason;
|
||||
SimulationStorageEngine result = SimulationStorageEngine::SIMULATION_STORAGE_ENGINE_INVALID_VALUE;
|
||||
|
||||
if (testConfig.storageEngineType.present()) {
|
||||
if (isEncryptionEnabled) {
|
||||
// Only storage engine supporting encryption is Redwood.
|
||||
reason = "EncryptionEnabled"_sr;
|
||||
result = SimulationStorageEngine::REDWOOD;
|
||||
|
||||
} else if (testConfig.storageEngineType.present()) {
|
||||
reason = "ConfigureSpecified"_sr;
|
||||
result = testConfig.storageEngineType.get();
|
||||
if (testConfig.excludedStorageEngineType(result) ||
|
||||
|
|
@ -1856,6 +1861,13 @@ SimulationStorageEngine chooseSimulationStorageEngine(const TestConfig& testConf
|
|||
TraceEvent(SevError, "StorageEngineNotSupported").detail("StorageEngineType", result);
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
} else if (SERVER_KNOBS->ENFORCE_SHARDED_ROCKSDB_SIM_IF_AVALIABLE &&
|
||||
testConfig.storageEngineExcludeTypes.find(SimulationStorageEngine::SHARDED_ROCKSDB) ==
|
||||
testConfig.storageEngineExcludeTypes.end()) {
|
||||
reason = "ENFORCE_SHARDED_ROCKSDB_SIM_IF_AVALIABLE is enabled"_sr;
|
||||
result = SimulationStorageEngine::SHARDED_ROCKSDB;
|
||||
|
||||
} else {
|
||||
std::unordered_set<SimulationStorageEngine> storageEngineAvailable;
|
||||
for (const auto& storageEngine : SIMULATION_STORAGE_ENGINE) {
|
||||
|
|
@ -1897,12 +1909,6 @@ SimulationStorageEngine chooseSimulationStorageEngine(const TestConfig& testConf
|
|||
}
|
||||
}
|
||||
|
||||
if (isEncryptionEnabled) {
|
||||
// Only storage engine supporting encryption is Redwood.
|
||||
reason = "EncryptionEnabled"_sr;
|
||||
result = SimulationStorageEngine::REDWOOD;
|
||||
}
|
||||
|
||||
TraceEvent(SevInfo, "SimulationStorageEngine")
|
||||
.detail("StorageEngine", static_cast<uint8_t>(result))
|
||||
.detail("Reason", reason)
|
||||
|
|
|
|||
Loading…
Reference in New Issue