Fixed unit stuck in the deleting state when being deleted

This commit is contained in:
obdev
2023-01-28 15:09:23 +08:00
committed by ob-robot
parent 6bbb04a7e9
commit 7fb284784d
4 changed files with 12 additions and 21 deletions

View File

@ -1291,6 +1291,10 @@ int ObMultiTenant::remove_tenant(const uint64_t tenant_id, bool &try_clock_succ)
} else if (OB_FAIL(GCTX.session_mgr_->kill_tenant(tenant_id))) {
LOG_ERROR("fail to kill tenant session", K(ret), K(tenant_id));
} else {
LOG_INFO("removed_tenant begin to stop", K(tenant_id));
removed_tenant->stop();
LOG_INFO("removed_tenant begin to wait", K(tenant_id));
removed_tenant->wait();
LOG_INFO("removed_tenant begin to try wlock", K(tenant_id));
ObLDHandle handle;
for (int i = 0; i < DEL_TRY_TIMES && !try_clock_succ; ++i) {
@ -1306,10 +1310,6 @@ int ObMultiTenant::remove_tenant(const uint64_t tenant_id, bool &try_clock_succ)
KP(removed_tenant), K(removed_tenant->lock_));
removed_tenant->lock_.ld_.print();
} else {
LOG_INFO("removed_tenant begin to stop", K(tenant_id));
removed_tenant->stop();
LOG_INFO("removed_tenant begin to wait", K(tenant_id));
removed_tenant->wait();
ObTenant *removed_tenant_tmp = nullptr;
SpinWLockGuard guard(lock_);
@ -1442,7 +1442,7 @@ int ObMultiTenant::del_tenant(const uint64_t tenant_id)
ObTenant *tenant = nullptr;
bool lock_succ = false;
int64_t bucket_lock_idx = -1;
TIMEGUARD_INIT(SERVER_OMT, 30_s, 60_s); // report hung cost more than 60s
TIMEGUARD_INIT(SERVER_OMT, 60_s, 120_s); // report hung cost more than 120s
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;

View File

@ -182,7 +182,7 @@ void ObTenantBase::stop_mtl_module()
int64_t start_time_us = ObTimeUtility::current_time(); \
this->stop_m##IDX##_func(this->m##IDX##_); \
int64_t cost_time_us = ObTimeUtility::current_time() - start_time_us; \
LOG_INFO("finish stop mtl"#IDX, K(cost_time_us)); \
FLOG_INFO("finish stop mtl"#IDX, K(cost_time_us)); \
}; \
func_arr.push_back(fw); \
}
@ -205,7 +205,7 @@ void ObTenantBase::wait_mtl_module()
int64_t start_time_us = ObTimeUtility::current_time(); \
this->wait_m##IDX##_func(this->m##IDX##_); \
int64_t cost_time_us = ObTimeUtility::current_time() - start_time_us; \
LOG_INFO("finish wait mtl"#IDX, K(cost_time_us)); \
FLOG_INFO("finish wait mtl"#IDX, K(cost_time_us)); \
}; \
func_arr.push_back(fw); \
}
@ -239,7 +239,7 @@ void ObTenantBase::destroy_mtl_module()
int64_t start_time_us = ObTimeUtility::current_time(); \
this->destroy_m##IDX##_func(this->m##IDX##_); \
int64_t cost_time_us = ObTimeUtility::current_time() - start_time_us; \
LOG_INFO("finish destroy mtl"#IDX, K(cost_time_us)); \
FLOG_INFO("finish destroy mtl"#IDX, K(cost_time_us)); \
}; \
func_arr.push_back(fw); \
}

View File

@ -558,7 +558,10 @@ int ObServerCheckpointSlogHandler::replay_delete_tenant_prepare(const char *buf,
} else {
LOG_WARN("failed to get tenant meta", K(ret), K(tenant_id));
}
} else if (omt::ObTenantCreateStatus::CREATE_COMMIT != meta.create_status_) {
// meta.create_status_== DELETING may because the status in memory is set to DELETING
// and a checkpoint is created when exit the lock for preventing to do ckpt.
} else if (omt::ObTenantCreateStatus::CREATE_COMMIT != meta.create_status_ &&
omt::ObTenantCreateStatus::DELETING != meta.create_status_) {
ret = OB_ERR_UNEXPECTED;
LOG_ERROR("tenant create_status mismatch", K(ret), K(meta));
} else if (FALSE_IT(meta.create_status_ = omt::ObTenantCreateStatus::DELETING)) {

View File

@ -835,9 +835,6 @@ int ObLSService::get_ls(
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("not init", K(ret));
} else if (OB_UNLIKELY(!is_running_)) {
ret = OB_NOT_RUNNING;
LOG_WARN("ls service is not running.", K(ret));
} else if (OB_UNLIKELY(!ls_id.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ls_id));
@ -1107,9 +1104,6 @@ int ObLSService::check_ls_exist(const share::ObLSID &ls_id, bool &exist)
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("not init", K(ret));
} else if (OB_UNLIKELY(!is_running_)) {
ret = OB_NOT_RUNNING;
LOG_WARN("ls service is not running.", K(ret));
} else if (OB_UNLIKELY(!ls_id.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(ls_id));
@ -1137,9 +1131,6 @@ int ObLSService::check_ls_waiting_safe_destroy(const share::ObLSID &ls_id, bool
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("not init", K(ret));
} else if (OB_UNLIKELY(!is_running_)) {
ret = OB_NOT_RUNNING;
LOG_WARN("ls service is not running.", K(ret));
} else if (OB_UNLIKELY(!ls_id.is_valid())) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(ls_id));
@ -1168,9 +1159,6 @@ int ObLSService::get_ls_iter(common::ObSharedGuard<ObLSIterator> &guard, ObLSGet
if (IS_NOT_INIT) {
ret = OB_NOT_INIT;
LOG_WARN("not init", K(ret));
} else if (OB_UNLIKELY(!is_running_)) {
ret = OB_NOT_RUNNING;
LOG_WARN("ls service is not running.", K(ret));
} else if (NULL == (buf = iter_allocator_.alloc(sizeof(ObLSIterator), attr))) {
ret = OB_ALLOCATE_MEMORY_FAILED;
LOG_ERROR("Fail to allocate memory for log stream iterator.", K(ret));