Skip to content

Commit

Permalink
[CP] [CP] add config parameter role_change_timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
jiadebinmary@gmail.com authored and junye committed Sep 8, 2023
1 parent b4c6e7b commit 7a4fcc3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/clog/ob_log_state_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2701,7 +2701,8 @@ ObVersion ObLogStateMgr::get_freeze_version() const
void ObLogStateMgr::check_role_change_warn_interval_(bool& is_role_change_timeout) const
{
const int64_t current = ObTimeUtility::current_time();
if (current - role_change_time_ > ROLE_CHANGE_WARN_INTERVAL) {
const int64_t role_change_timeout = GCONF.role_change_timeout;
if (current - role_change_time_ > role_change_timeout) {
is_role_change_timeout = true;
if (REACH_TIME_INTERVAL(1000 * 1000)) {
CLOG_LOG(ERROR,
Expand All @@ -2712,7 +2713,8 @@ void ObLogStateMgr::check_role_change_warn_interval_(bool& is_role_change_timeou
"interval",
current - role_change_time_,
K_(role),
K_(state));
K_(state),
K(role_change_timeout));
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/clog/ob_log_state_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,6 @@ class ObLogStateMgr : public ObILogStateMgrForService,
typedef common::SpinRWLock RWLock;
typedef common::SpinRLockGuard RLockGuard;
typedef common::SpinWLockGuard WLockGuard;
enum { ROLE_CHANGE_WARN_INTERVAL = 10 * 1000 * 1000 };
static const int64_t START_PARTITION_WARN_INTERVAL = 1 * 1000;
static const int64_t BUF_SIZE = 2048;
static const int64_t STANDBY_CHECK_SYNC_START_ID_INTERVAL = 3l * 1000l * 1000l;
Expand Down
4 changes: 4 additions & 0 deletions src/share/parameter/ob_parameter_seed.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -779,6 +779,10 @@ DEF_INT(clog_max_unconfirmed_log_count, OB_TENANT_PARAMETER, "1500", "[100, 5000
"maximum of unconfirmed logs in clog module. "
"Range: [100, 50000]",
ObParameterAttr(Section::TRANS, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));
DEF_TIME(role_change_timeout, OB_CLUSTER_PARAMETER, "10s", "(0s,]",
"The time interval of partition's role changing (revoke/takeover). "
"Range: (0s, +∞)",
ObParameterAttr(Section::TRANS, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE));

DEF_TIME(_ob_clog_timeout_to_force_switch_leader, OB_CLUSTER_PARAMETER, "10s", "[0s, 60m]",
"When log sync is blocking, leader need wait this interval before revoke."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ replica_safe_remove_time
resource_hard_limit
resource_soft_limit
restore_concurrency
role_change_timeout
rootservice_async_task_queue_size
rootservice_async_task_thread_count
rootservice_list
Expand Down

0 comments on commit 7a4fcc3

Please sign in to comment.