Skip to content

Commit

Permalink
[fix][store] Support dynamic adjust some gflag variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
rock-git authored and ketor committed Nov 1, 2024
1 parent 8894417 commit c765dff
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 4 deletions.
6 changes: 3 additions & 3 deletions conf/coordinator-gflags.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
-free_memory_to_system_interval=60
-enable_dir_service=false
-enable_threads_service=false
-dingo_log_switch_coor_kv=true
-dingo_log_switch_coor_watch=true
-dingo_log_switch_coor_lease=true
-dingo_log_switch_coor_kv=false
-dingo_log_switch_coor_watch=false
-dingo_log_switch_coor_lease=false
-default_replica_num=$DEFAULT_REPLICA_NUM$
-dingo_log_switch_scalar_speed_up_detail=true
-service_log_threshold_time_ns=100000000
Expand Down
14 changes: 13 additions & 1 deletion src/coordinator/coordinator_control_meta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,23 @@
namespace dingodb {

DEFINE_int64(max_partition_num_of_table, 1024, "max partition num of table");
BRPC_VALIDATE_GFLAG(max_partition_num_of_table, brpc::NonNegativeInteger);

DEFINE_int64(max_table_count, 10000, "max table num of dingo");
BRPC_VALIDATE_GFLAG(max_table_count, brpc::NonNegativeInteger);

DEFINE_int64(max_index_count, 10000, "max index num of dingo");
BRPC_VALIDATE_GFLAG(max_index_count, brpc::NonNegativeInteger);

DEFINE_int64(max_tenant_count, 1024, "max tenant num of dingo");
DEFINE_uint32(default_replica_num, 3, "default replica number");
BRPC_VALIDATE_GFLAG(max_tenant_count, brpc::NonNegativeInteger);

DEFINE_int32(default_replica_num, 3, "default replica number");
BRPC_VALIDATE_GFLAG(default_replica_num, brpc::NonNegativeInteger);

DEFINE_bool(enable_lite, false, "enable lite");
BRPC_VALIDATE_GFLAG(enable_lite, brpc::PassValidate);

butil::Status CoordinatorControl::GenerateTableIdAndPartIds(int64_t schema_id, int64_t part_count,
pb::meta::EntityType entity_type,
pb::coordinator_internal::MetaIncrement& meta_increment,
Expand Down
12 changes: 12 additions & 0 deletions src/coordinator/kv_control_kv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "common/helper.h"
#include "common/logging.h"
#include "coordinator/kv_control.h"
#include "fmt/format.h"
#include "gflags/gflags.h"
#include "proto/common.pb.h"
#include "proto/coordinator_internal.pb.h"
Expand All @@ -33,12 +34,22 @@
namespace dingodb {

DEFINE_int64(max_kv_key_size, 4096, "max kv put count");
BRPC_VALIDATE_GFLAG(max_kv_key_size, brpc::NonNegativeInteger);

DEFINE_int64(max_kv_value_size, 8192, "max kv put count");
BRPC_VALIDATE_GFLAG(max_kv_value_size, brpc::NonNegativeInteger);

DEFINE_int64(compaction_retention_rev_count, 1000, "max revision count retention for compaction");
BRPC_VALIDATE_GFLAG(compaction_retention_rev_count, brpc::NonNegativeInteger);

DEFINE_bool(auto_compaction, false, "auto compaction on/off");
BRPC_VALIDATE_GFLAG(auto_compaction, brpc::PassValidate);

DEFINE_int64(version_kv_max_count, 100000, "max kv count for version kv");
BRPC_VALIDATE_GFLAG(version_kv_max_count, brpc::NonNegativeInteger);

DEFINE_bool(dingo_log_switch_coor_kv, false, "log switch for kv control");
BRPC_VALIDATE_GFLAG(dingo_log_switch_coor_kv, brpc::PassValidate);

std::string KvControl::RevisionToString(const pb::coordinator_internal::RevisionInternal &revision) {
Buf buf(17);
Expand Down Expand Up @@ -700,6 +711,7 @@ butil::Status KvControl::KvPutApply(const std::string &key,
DINGO_LOG(ERROR) << "KvPutApply PutRawKvIndex failed, key: " << key << "(" << Helper::StringToHex(key)
<< "), kv_index: " << kv_index.ShortDebugString() << ", error: " << ret.error_str();
}

DINGO_LOG_IF(INFO, FLAGS_dingo_log_switch_coor_kv)
<< "KvPutApply PutRawKvIndex success, key: " << key << "(" << Helper::StringToHex(key)
<< "), kv_index: " << kv_index.ShortDebugString();
Expand Down
8 changes: 8 additions & 0 deletions src/coordinator/kv_control_lease.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,19 @@
namespace dingodb {

DEFINE_int64(version_lease_max_ttl_seconds, 300, "max ttl seconds for version lease");
BRPC_VALIDATE_GFLAG(version_lease_max_ttl_seconds, brpc::NonNegativeInteger);

DEFINE_int64(version_lease_min_ttl_seconds, 3, "min ttl seconds for version lease");
BRPC_VALIDATE_GFLAG(version_lease_min_ttl_seconds, brpc::NonNegativeInteger);

DEFINE_int64(version_lease_max_count, 50000, "max lease count");
BRPC_VALIDATE_GFLAG(version_lease_max_count, brpc::NonNegativeInteger);

DEFINE_int64(version_lease_print_ttl_remaining_seconds, 10, "print ttl remaining seconds if value is less than this");
BRPC_VALIDATE_GFLAG(version_lease_print_ttl_remaining_seconds, brpc::NonNegativeInteger);

DEFINE_bool(dingo_log_switch_coor_lease, false, "switch for dingo log of kv control lease");
BRPC_VALIDATE_GFLAG(dingo_log_switch_coor_lease, brpc::PassValidate);

butil::Status KvControl::LeaseGrant(int64_t lease_id, int64_t ttl_seconds, int64_t &granted_id,
int64_t &granted_ttl_seconds,
Expand Down
2 changes: 2 additions & 0 deletions src/coordinator/kv_control_watch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
namespace dingodb {

DEFINE_int64(version_watch_max_count, 50000, "max count of version watch");
BRPC_VALIDATE_GFLAG(version_watch_max_count, brpc::NonNegativeInteger);

DEFINE_bool(dingo_log_switch_coor_watch, false, "switch for dingo log of kv control lease");
BRPC_VALIDATE_GFLAG(dingo_log_switch_coor_watch, brpc::PassValidate);

void WatchCancelCallback(KvControl* kv_control, uint64_t closure_id) {
kv_control->CancelOneTimeWatchClosure(closure_id);
Expand Down

0 comments on commit c765dff

Please sign in to comment.