diff --git a/fdbclient/ServerKnobs.cpp b/fdbclient/ServerKnobs.cpp index 735bc807f7..656c22c8b0 100644 --- a/fdbclient/ServerKnobs.cpp +++ b/fdbclient/ServerKnobs.cpp @@ -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 diff --git a/fdbclient/include/fdbclient/ServerKnobs.h b/fdbclient/include/fdbclient/ServerKnobs.h index 7fdf2498f5..b65729bd4f 100644 --- a/fdbclient/include/fdbclient/ServerKnobs.h +++ b/fdbclient/include/fdbclient/ServerKnobs.h @@ -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; diff --git a/fdbserver/SimulatedCluster.actor.cpp b/fdbserver/SimulatedCluster.actor.cpp index f4aa2535bf..36c79860db 100644 --- a/fdbserver/SimulatedCluster.actor.cpp +++ b/fdbserver/SimulatedCluster.actor.cpp @@ -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 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(result)) .detail("Reason", reason)