diff --git a/include/dsn/dist/replication/replica_envs.h b/include/dsn/dist/replication/replica_envs.h index 9b70796ccb..21446597c4 100644 --- a/include/dsn/dist/replication/replica_envs.h +++ b/include/dsn/dist/replication/replica_envs.h @@ -45,6 +45,7 @@ class replica_envs static const std::string ROCKSDB_CHECKPOINT_RESERVE_MIN_COUNT; static const std::string ROCKSDB_CHECKPOINT_RESERVE_TIME_SECONDS; static const std::string ROCKSDB_ITERATION_THRESHOLD_TIME_MS; + static const std::string ROCKSDB_BLOCK_CACHE_ENABLED; static const std::string MANUAL_COMPACT_DISABLED; static const std::string MANUAL_COMPACT_MAX_CONCURRENT_RUNNING_COUNT; static const std::string MANUAL_COMPACT_ONCE_TRIGGER_TIME; diff --git a/src/common/replication_common.cpp b/src/common/replication_common.cpp index 31a8eb772e..8f9989f1fd 100644 --- a/src/common/replication_common.cpp +++ b/src/common/replication_common.cpp @@ -651,6 +651,7 @@ const std::string replica_envs::ROCKSDB_CHECKPOINT_RESERVE_TIME_SECONDS( "rocksdb.checkpoint.reserve_time_seconds"); const std::string replica_envs::ROCKSDB_ITERATION_THRESHOLD_TIME_MS( "replica.rocksdb_iteration_threshold_time_ms"); +const std::string replica_envs::ROCKSDB_BLOCK_CACHE_ENABLED("replica.rocksdb_block_cache_enabled"); const std::string replica_envs::BUSINESS_INFO("business.info"); const std::string replica_envs::REPLICA_ACCESS_CONTROLLER_ALLOWED_USERS( "replica_access_controller.allowed_users"); diff --git a/src/meta/app_env_validator.cpp b/src/meta/app_env_validator.cpp index c54624c537..c9bf3dbbc8 100644 --- a/src/meta/app_env_validator.cpp +++ b/src/meta/app_env_validator.cpp @@ -124,6 +124,16 @@ bool check_split_validation(const std::string &env_value, std::string &hint_mess return true; } +bool check_rocksdb_block_cache_enabled(const std::string &env_value, std::string &hint_message) +{ + bool result = false; + if (!dsn::buf2bool(env_value, result)) { + hint_message = fmt::format("invalid string {}, should be \"true\" or \"false\"", env_value); + return false; + } + return true; +} + bool app_env_validator::validate_app_env(const std::string &env_name, const std::string &env_value, std::string &hint_message) @@ -154,6 +164,9 @@ void app_env_validator::register_all_validators() std::bind(&check_throttling, std::placeholders::_1, std::placeholders::_2)}, {replica_envs::ROCKSDB_ITERATION_THRESHOLD_TIME_MS, std::bind(&check_rocksdb_iteration, std::placeholders::_1, std::placeholders::_2)}, + {replica_envs::ROCKSDB_BLOCK_CACHE_ENABLED, + std::bind( + &check_rocksdb_block_cache_enabled, std::placeholders::_1, std::placeholders::_2)}, // TODO(zhaoliwei): not implemented {replica_envs::BUSINESS_INFO, nullptr}, {replica_envs::DENY_CLIENT_WRITE, nullptr},