[CP] add tenant config lock when cluster config do dump2file

This commit is contained in:
obdev
2023-04-27 11:41:39 +00:00
committed by ob-robot
parent c5756c1799
commit bc6d08172d
3 changed files with 12 additions and 10 deletions

View File

@ -90,7 +90,7 @@ int64_t TenantConfigInfo::to_string(char *buf, const int64_t buf_len) const
}
ObTenantConfigMgr::ObTenantConfigMgr()
: inited_(false), self_(), sql_proxy_(nullptr), rwlock_(ObLatchIds::CONFIG_LOCK),
: rwlock_(ObLatchIds::CONFIG_LOCK), inited_(false), self_(), sql_proxy_(nullptr),
config_map_(), config_version_map_(), sys_config_mgr_(nullptr),
version_has_refreshed_(false), update_tenant_config_cb_()
{

View File

@ -162,7 +162,8 @@ public:
}
return id;
}
// protect config_map_
mutable common::DRWLock rwlock_;
OB_UNIS_VERSION(1);
private:
@ -171,8 +172,6 @@ private:
bool inited_;
common::ObAddr self_;
common::ObMySQLProxy *sql_proxy_;
// protect config_map_
mutable common::DRWLock rwlock_;
// 租户配置项的映射
TenantConfigMap config_map_;
TenantConfigVersionMap config_version_map_;

View File

@ -345,13 +345,16 @@ int ObConfigManager::update_local(int64_t expected_version)
LOG_ERROR("Read server config failed", K(ret));
} else if (OB_FAIL(reload_config())) {
LOG_WARN("Reload configuration failed", K(ret));
} else if (OB_FAIL(dump2file())) {
LOG_WARN("Dump to file failed", K_(dump_path), K(ret));
} else {
GCONF.cluster.set_dumped_version(GCONF.cluster.version());
LOG_INFO("Reload server config successfully!");
ret = config_backup();
}
DRWLock::RDLockGuard guard(OTC_MGR.rwlock_); // need protect tenant config because it will also serialize tenant config
if (OB_FAIL(dump2file())) {
LOG_WARN("Dump to file failed", K_(dump_path), K(ret));
} else {
GCONF.cluster.set_dumped_version(GCONF.cluster.version());
LOG_INFO("Reload server config successfully!");
ret = config_backup();
}
}
server_config_.print();
} else {
LOG_WARN("Read system config from inner table error", K(ret));