fix: add recycle config latency check
This commit is contained in:
@ -37,7 +37,7 @@ ObTenantConfig::ObTenantConfig(uint64_t tenant_id)
|
|||||||
: tenant_id_(tenant_id), current_version_(INITIAL_TENANT_CONF_VERSION),
|
: tenant_id_(tenant_id), current_version_(INITIAL_TENANT_CONF_VERSION),
|
||||||
mutex_(),
|
mutex_(),
|
||||||
update_task_(), system_config_(), config_mgr_(nullptr),
|
update_task_(), system_config_(), config_mgr_(nullptr),
|
||||||
lock_(ObLatchIds::CONFIG_LOCK), is_deleting_(false)
|
lock_(ObLatchIds::CONFIG_LOCK), is_deleting_(false), create_timestamp_(0L)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,6 +45,7 @@ int ObTenantConfig::init(ObTenantConfigMgr *config_mgr)
|
|||||||
{
|
{
|
||||||
int ret = OB_SUCCESS;
|
int ret = OB_SUCCESS;
|
||||||
config_mgr_ = config_mgr;
|
config_mgr_ = config_mgr;
|
||||||
|
create_timestamp_ = ObTimeUtility::current_time();
|
||||||
if (OB_FAIL(system_config_.init())) {
|
if (OB_FAIL(system_config_.init())) {
|
||||||
LOG_ERROR("init system config failed", K(ret));
|
LOG_ERROR("init system config failed", K(ret));
|
||||||
} else if (OB_FAIL(update_task_.init(config_mgr, this))) {
|
} else if (OB_FAIL(update_task_.init(config_mgr, this))) {
|
||||||
|
|||||||
@ -88,6 +88,7 @@ public:
|
|||||||
uint64_t get_tenant_id() const { return tenant_id_; }
|
uint64_t get_tenant_id() const { return tenant_id_; }
|
||||||
int64_t get_current_version() const { return current_version_; }
|
int64_t get_current_version() const { return current_version_; }
|
||||||
const TenantConfigUpdateTask &get_update_task() const { return update_task_; }
|
const TenantConfigUpdateTask &get_update_task() const { return update_task_; }
|
||||||
|
int64_t get_create_timestamp() const { return create_timestamp_; }
|
||||||
int got_version(int64_t version, const bool remove_repeat);
|
int got_version(int64_t version, const bool remove_repeat);
|
||||||
int update_local(int64_t expected_version, common::ObMySQLProxy::MySQLResult &result,
|
int update_local(int64_t expected_version, common::ObMySQLProxy::MySQLResult &result,
|
||||||
bool save2file = true);
|
bool save2file = true);
|
||||||
@ -106,6 +107,7 @@ private:
|
|||||||
// protect this object from being deleted in OTC_MGR.del_tenant_config
|
// protect this object from being deleted in OTC_MGR.del_tenant_config
|
||||||
mutable common::DRWLock lock_;
|
mutable common::DRWLock lock_;
|
||||||
bool is_deleting_;
|
bool is_deleting_;
|
||||||
|
int64_t create_timestamp_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -307,7 +307,7 @@ int ObTenantConfigMgr::del_tenant_config(uint64_t tenant_id)
|
|||||||
LOG_WARN("get tenant config failed", K(tenant_id), K(ret));
|
LOG_WARN("get tenant config failed", K(tenant_id), K(ret));
|
||||||
} else if (OB_FAIL(GSCHEMASERVICE.check_if_tenant_has_been_dropped(tenant_id, has_dropped))) {
|
} else if (OB_FAIL(GSCHEMASERVICE.check_if_tenant_has_been_dropped(tenant_id, has_dropped))) {
|
||||||
LOG_WARN("failed to check tenant has been dropped", K(tenant_id));
|
LOG_WARN("failed to check tenant has been dropped", K(tenant_id));
|
||||||
} else if (!has_dropped) {
|
} else if (!has_dropped && ObTimeUtility::current_time() - config->get_create_timestamp() < RECYCLE_LATENCY) {
|
||||||
LOG_WARN("tenant still exist, try to delete tenant config later...", K(tenant_id));
|
LOG_WARN("tenant still exist, try to delete tenant config later...", K(tenant_id));
|
||||||
} else {
|
} else {
|
||||||
static const int DEL_TRY_TIMES = 30;
|
static const int DEL_TRY_TIMES = 30;
|
||||||
|
|||||||
@ -166,6 +166,7 @@ public:
|
|||||||
OB_UNIS_VERSION(1);
|
OB_UNIS_VERSION(1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static const int64_t RECYCLE_LATENCY = 30L * 60L * 1000L * 1000L;
|
||||||
ObTenantConfigMgr();
|
ObTenantConfigMgr();
|
||||||
bool inited_;
|
bool inited_;
|
||||||
common::ObAddr self_;
|
common::ObAddr self_;
|
||||||
|
|||||||
Reference in New Issue
Block a user