Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
feat: add a new app_env to limit scan time (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
hycdong authored and neverchanje committed Mar 30, 2020
1 parent 95a0bef commit 8bd8cef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/dsn/dist/replication/replica_envs.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class replica_envs
static const std::string ROCKSDB_USAGE_SCENARIO;
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 MANUAL_COMPACT_DISABLED;
static const std::string MANUAL_COMPACT_MAX_CONCURRENT_RUNNING_COUNT;
static const std::string MANUAL_COMPACT_ONCE_TRIGGER_TIME;
Expand Down
2 changes: 2 additions & 0 deletions src/dist/replication/common/replication_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ const std::string
replica_envs::ROCKSDB_CHECKPOINT_RESERVE_MIN_COUNT("rocksdb.checkpoint.reserve_min_count");
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::BUSINESS_INFO("business.info");

namespace cold_backup {
Expand Down
12 changes: 12 additions & 0 deletions src/dist/replication/meta_server/app_env_validator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ bool check_slow_query(const std::string &env_value, std::string &hint_message)
return true;
}

bool check_rocksdb_iteration(const std::string &env_value, std::string &hint_message)
{
uint64_t threshold = 0;
if (!dsn::buf2uint64(env_value, threshold) || threshold < 0) {
hint_message = "Rocksdb iteration threshold must be greater than zero";
return false;
}
return true;
}

bool check_write_throttling(const std::string &env_value, std::string &hint_message)
{
std::vector<std::string> sargs;
Expand Down Expand Up @@ -141,6 +151,8 @@ void app_env_validator::register_all_validators()
std::bind(&check_write_throttling, std::placeholders::_1, std::placeholders::_2)},
{replica_envs::WRITE_SIZE_THROTTLING,
std::bind(&check_write_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)},
// TODO(zhaoliwei): not implemented
{replica_envs::BUSINESS_INFO, nullptr},
{replica_envs::DENY_CLIENT_WRITE, nullptr},
Expand Down

0 comments on commit 8bd8cef

Please sign in to comment.