From b505b8306229ea19fecd00a04c0c491f26d9e280 Mon Sep 17 00:00:00 2001 From: chinaxing Date: Sat, 16 Sep 2023 02:10:14 +0000 Subject: [PATCH] [CP] [master] fix handle tenant drop --- src/storage/tx/ob_location_adapter.cpp | 14 ++++++++++++-- src/storage/tx/ob_trans_rpc.cpp | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/storage/tx/ob_location_adapter.cpp b/src/storage/tx/ob_location_adapter.cpp index 94090792c1..daac537684 100644 --- a/src/storage/tx/ob_location_adapter.cpp +++ b/src/storage/tx/ob_location_adapter.cpp @@ -151,7 +151,12 @@ int ObLocationAdapter::get_leader_(const int64_t cluster_id, if (OB_SUCCESS != (tmp_ret = ObLocationService::check_ls_exist(tenant_id, ls_id, state))) { TRANS_LOG(WARN, "check if ls exist failed", K(tmp_ret), K(ls_id)); if (OB_TENANT_NOT_EXIST == tmp_ret) { - ret = tmp_ret; + bool has_dropped = false; + if (OB_TMP_FAIL(GSCHEMASERVICE.check_if_tenant_has_been_dropped(tenant_id, has_dropped))) { + TRANS_LOG(WARN, "failed to check tenant has been dropped", K(tmp_ret), K(tenant_id)); + } else if (has_dropped) { + ret = OB_TENANT_HAS_BEEN_DROPPED; + } } } else if (state.is_deleted()) { // rewrite ret @@ -234,7 +239,12 @@ int ObLocationAdapter::nonblock_get(const int64_t cluster_id, if (OB_SUCCESS != (tmp_ret = ObLocationService::check_ls_exist(tenant_id, ls_id, state))) { TRANS_LOG(WARN, "check if ls exist failed", K(tmp_ret), K(ls_id)); if (OB_TENANT_NOT_EXIST == tmp_ret) { - ret = tmp_ret; + bool has_dropped = false; + if (OB_TMP_FAIL(GSCHEMASERVICE.check_if_tenant_has_been_dropped(tenant_id, has_dropped))) { + TRANS_LOG(WARN, "failed to check tenant has been dropped", K(tmp_ret), K(tenant_id)); + } else if (has_dropped) { + ret = OB_TENANT_HAS_BEEN_DROPPED; + } } } else if (state.is_deleted()) { // rewrite ret diff --git a/src/storage/tx/ob_trans_rpc.cpp b/src/storage/tx/ob_trans_rpc.cpp index 1c2312934a..fc46078451 100644 --- a/src/storage/tx/ob_trans_rpc.cpp +++ b/src/storage/tx/ob_trans_rpc.cpp @@ -452,7 +452,7 @@ int ObTransRpc::post_msg(const ObLSID &ls_id, ObTxMsg &msg) } else if (OB_FAIL(trans_service_->get_location_adapter()->nonblock_get_leader(cluster_id, tenant_id, ls_id, server))) { TRANS_LOG(WARN, "get leader failed", KR(ret), K(msg), K(cluster_id), K(ls_id)); if (ObTxMsgTypeChecker::is_2pc_msg_type(msg.get_msg_type())) { - if (OB_LS_IS_DELETED == ret || OB_TENANT_NOT_EXIST == ret) { + if (OB_LS_IS_DELETED == ret) { int tmp_ret = trans_service_->handle_ls_deleted(msg); if (OB_SUCCESS == tmp_ret) { ret = OB_SUCCESS;