[CP] fix: ObConfigMgr::got_version() maybe leave out to update local version
This commit is contained in:
@ -321,8 +321,6 @@ int ObConfigManager::update_local(int64_t expected_version)
|
|||||||
system_config_.get_version(),
|
system_config_.get_version(),
|
||||||
"current_version",
|
"current_version",
|
||||||
current_version_,
|
current_version_,
|
||||||
"newest_version",
|
|
||||||
newest_version_,
|
|
||||||
"expected_version",
|
"expected_version",
|
||||||
expected_version);
|
expected_version);
|
||||||
} else {
|
} else {
|
||||||
@ -370,26 +368,16 @@ int ObConfigManager::got_version(int64_t version, const bool remove_repeat /* =
|
|||||||
} else if (version < current_version_) {
|
} else if (version < current_version_) {
|
||||||
LOG_WARN("Local config is newer than rs, weird", K_(current_version), K(version));
|
LOG_WARN("Local config is newer than rs, weird", K_(current_version), K(version));
|
||||||
} else if (version > current_version_) {
|
} else if (version > current_version_) {
|
||||||
mutex_.lock();
|
// local:current_version_, got:version
|
||||||
if (version > newest_version_) {
|
LOG_INFO("Got new config version", K_(current_version), K(version));
|
||||||
// local:current_version_, newest:newest_version, got:version
|
update_task_.update_local_ = true;
|
||||||
LOG_INFO("Got new config version", K_(current_version), K_(newest_version), K(version));
|
schedule_task = true;
|
||||||
newest_version_ = version; // for rootserver hb to others
|
|
||||||
update_task_.update_local_ = true;
|
|
||||||
schedule_task = true;
|
|
||||||
} else if (version < newest_version_) {
|
|
||||||
// In order to prevent the new version from being
|
|
||||||
// overwritten by the old version, take the latest value here
|
|
||||||
version = newest_version_;
|
|
||||||
}
|
|
||||||
mutex_.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (schedule_task) {
|
if (schedule_task) {
|
||||||
bool schedule = true;
|
bool schedule = true;
|
||||||
if (!inited_) {
|
if (!inited_) {
|
||||||
// if got a config version before manager init, ignore this version
|
// if got a config version before manager init, ignore this version
|
||||||
newest_version_ = current_version_;
|
|
||||||
schedule = false;
|
schedule = false;
|
||||||
ret = OB_NOT_INIT;
|
ret = OB_NOT_INIT;
|
||||||
LOG_WARN("Couldn't update config because timer is NULL", K(ret));
|
LOG_WARN("Couldn't update config because timer is NULL", K(ret));
|
||||||
@ -409,7 +397,7 @@ int ObConfigManager::got_version(int64_t version, const bool remove_repeat /* =
|
|||||||
int tmp_ret = TG_TASK_EXIST(lib::TGDefIDs::CONFIG_MGR, update_task_, task_exist);
|
int tmp_ret = TG_TASK_EXIST(lib::TGDefIDs::CONFIG_MGR, update_task_, task_exist);
|
||||||
if (task_exist) {
|
if (task_exist) {
|
||||||
TG_CANCEL(lib::TGDefIDs::CONFIG_MGR, update_task_);
|
TG_CANCEL(lib::TGDefIDs::CONFIG_MGR, update_task_);
|
||||||
LOG_INFO("Cancel pending update task", K(tmp_ret), K_(current_version), K_(newest_version), K(version));
|
LOG_INFO("Cancel pending update task", K(tmp_ret), K_(current_version), K(version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,7 +429,7 @@ void ObConfigManager::UpdateTask::runTimerTask()
|
|||||||
THIS_WORKER.set_timeout_ts(INT64_MAX);
|
THIS_WORKER.set_timeout_ts(INT64_MAX);
|
||||||
if (config_mgr_->current_version_ == version) {
|
if (config_mgr_->current_version_ == version) {
|
||||||
ret = OB_ALREADY_DONE;
|
ret = OB_ALREADY_DONE;
|
||||||
} else if (config_mgr_->newest_version_ > version) {
|
} else if (config_mgr_->current_version_ > version) {
|
||||||
ret = OB_CANCELED;
|
ret = OB_CANCELED;
|
||||||
} else if (update_local_) {
|
} else if (update_local_) {
|
||||||
config_mgr_->current_version_ = version;
|
config_mgr_->current_version_ = version;
|
||||||
@ -469,8 +457,6 @@ void ObConfigManager::UpdateTask::runTimerTask()
|
|||||||
old_current_version,
|
old_current_version,
|
||||||
"current_version",
|
"current_version",
|
||||||
config_mgr_->current_version_,
|
config_mgr_->current_version_,
|
||||||
"newest_version",
|
|
||||||
config_mgr_->newest_version_,
|
|
||||||
"expected_version",
|
"expected_version",
|
||||||
version);
|
version);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,11 +85,9 @@ private:
|
|||||||
ObMySQLProxy* sql_proxy_;
|
ObMySQLProxy* sql_proxy_;
|
||||||
ObSystemConfig system_config_;
|
ObSystemConfig system_config_;
|
||||||
ObServerConfig& server_config_;
|
ObServerConfig& server_config_;
|
||||||
int64_t newest_version_;
|
|
||||||
int64_t current_version_;
|
int64_t current_version_;
|
||||||
char dump_path_[OB_MAX_FILE_NAME_LENGTH];
|
char dump_path_[OB_MAX_FILE_NAME_LENGTH];
|
||||||
ObReloadConfig& reload_config_func_;
|
ObReloadConfig& reload_config_func_;
|
||||||
obutil::Mutex mutex_;
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ObConfigManager);
|
DISALLOW_COPY_AND_ASSIGN(ObConfigManager);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -101,10 +99,8 @@ inline ObConfigManager::ObConfigManager(ObServerConfig& server_config, ObReloadC
|
|||||||
sql_proxy_(NULL),
|
sql_proxy_(NULL),
|
||||||
system_config_(),
|
system_config_(),
|
||||||
server_config_(server_config),
|
server_config_(server_config),
|
||||||
newest_version_(1),
|
|
||||||
current_version_(1),
|
current_version_(1),
|
||||||
reload_config_func_(reload_config),
|
reload_config_func_(reload_config)
|
||||||
mutex_()
|
|
||||||
{
|
{
|
||||||
dump_path_[0] = '\0';
|
dump_path_[0] = '\0';
|
||||||
}
|
}
|
||||||
@ -114,11 +110,6 @@ inline int64_t ObConfigManager::get_current_version() const
|
|||||||
return current_version_;
|
return current_version_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const int64_t& ObConfigManager::get_version() const
|
|
||||||
{
|
|
||||||
return newest_version_;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline ObServerConfig& ObConfigManager::get_config(void)
|
inline ObServerConfig& ObConfigManager::get_config(void)
|
||||||
{
|
{
|
||||||
return server_config_;
|
return server_config_;
|
||||||
|
|||||||
Reference in New Issue
Block a user