diff --git a/mittest/mtlenv/mock_tenant_module_env.h b/mittest/mtlenv/mock_tenant_module_env.h index c750a1d268..87c9ee1771 100644 --- a/mittest/mtlenv/mock_tenant_module_env.h +++ b/mittest/mtlenv/mock_tenant_module_env.h @@ -258,6 +258,11 @@ public: MonotonicTs unused; return source_.get_gts(stc, NULL, gts, unused); } + virtual int remove_dropped_tenant(const uint64_t tenant_id) + { + UNUSED(tenant_id); + return OB_SUCCESS; + } private: MockObGtsSource &source_; }; diff --git a/src/storage/tx/ob_trans_part_ctx.cpp b/src/storage/tx/ob_trans_part_ctx.cpp index caef58351d..49ef01d873 100644 --- a/src/storage/tx/ob_trans_part_ctx.cpp +++ b/src/storage/tx/ob_trans_part_ctx.cpp @@ -1196,12 +1196,15 @@ int ObPartTransCtx::gts_callback_interrupted(const int errcode) if (IS_NOT_INIT) { ret = OB_NOT_INIT; TRANS_LOG(ERROR, "ObPartTransCtx not inited", K(ret)); - } else if (OB_UNLIKELY(is_exiting_)) { + } else if (OB_UNLIKELY(!is_exiting_)) { + // at this time, ObTxCtxMgr should already be stopped, + // so ObPartTransCtx should already be killed + ret = OB_ERR_UNEXPECTED; + TRANS_LOG(ERROR, "ObPartTransCtx is not exiting", K(ret)); + } else { need_revert_ctx = true; sub_state_.clear_gts_waiting(); TRANS_LOG(INFO, "transaction is interruputed gts callback", KR(ret), "context", *this); - } else { - ret = OB_EAGAIN; } } if (need_revert_ctx) { diff --git a/src/storage/tx/ob_trans_service.cpp b/src/storage/tx/ob_trans_service.cpp index edeff492c3..9087fac75b 100644 --- a/src/storage/tx/ob_trans_service.cpp +++ b/src/storage/tx/ob_trans_service.cpp @@ -260,6 +260,8 @@ void ObTransService::stop() TRANS_LOG(WARN, "ObTransTimer stop error", K(ret)); } else if (OB_FAIL(dup_table_scan_timer_.stop())) { TRANS_LOG(WARN, "dup_table_scan_timer_ stop error", K(ret)); + } else if (OB_FAIL(ts_mgr_->remove_dropped_tenant(tenant_id_))) { + TRANS_LOG(WARN, "gts_mgr stop error", K(ret)); } else { rpc_->stop(); dup_table_rpc_->stop(); diff --git a/src/storage/tx/ob_ts_mgr.cpp b/src/storage/tx/ob_ts_mgr.cpp index d6f06e44e3..9ecfa1264e 100644 --- a/src/storage/tx/ob_ts_mgr.cpp +++ b/src/storage/tx/ob_ts_mgr.cpp @@ -509,7 +509,7 @@ void ObTsMgr::run1() ids.reset(); for (int64_t i = 0; i < check_ids.count(); i++) { const uint64_t tenant_id = check_ids.at(i); - if (OB_FAIL(remove_dropped_tenant_(tenant_id))) { + if (OB_FAIL(remove_dropped_tenant(tenant_id))) { TRANS_LOG(WARN, "remove dropped tenant failed", K(ret), K(tenant_id)); // ignore ret ret = OB_SUCCESS; @@ -743,7 +743,7 @@ int ObTsMgr::delete_tenant_(const uint64_t tenant_id) return ret; } -int ObTsMgr::remove_dropped_tenant_(const uint64_t tenant_id) +int ObTsMgr::remove_dropped_tenant(const uint64_t tenant_id) { int ret = OB_SUCCESS; ObTsTenantInfo tenant_info(tenant_id); diff --git a/src/storage/tx/ob_ts_mgr.h b/src/storage/tx/ob_ts_mgr.h index 2e2e437a6f..e5f3574135 100644 --- a/src/storage/tx/ob_ts_mgr.h +++ b/src/storage/tx/ob_ts_mgr.h @@ -100,6 +100,7 @@ public: bool &need_wait) = 0; virtual int wait_gts_elapse(const uint64_t tenant_id, const share::SCN &scn) = 0; virtual bool is_external_consistent(const uint64_t tenant_id) = 0; + virtual int remove_dropped_tenant(const uint64_t tenant_id) = 0; public: VIRTUAL_TO_STRING_KV("", ""); }; @@ -405,6 +406,7 @@ public: int wait_gts_elapse(const uint64_t tenant_id, const share::SCN &scn); bool is_external_consistent(const uint64_t tenant_id); int refresh_gts_location(const uint64_t tenant_id); + int remove_dropped_tenant(const uint64_t tenant_id); public: TO_STRING_KV("ts_source", "GTS"); public: @@ -420,7 +422,6 @@ private: void revert_ts_source_info_(ObTsSourceInfoGuard &guard); int add_tenant_(const uint64_t tenant_id); int delete_tenant_(const uint64_t tenant_id); - int remove_dropped_tenant_(const uint64_t tenant_id); static ObTsMgr* &get_instance_inner(); private: bool is_inited_; diff --git a/unittest/storage/tx/mock_utils/basic_fake_define.h b/unittest/storage/tx/mock_utils/basic_fake_define.h index 25b1b2ebf7..c4b508270c 100644 --- a/unittest/storage/tx/mock_utils/basic_fake_define.h +++ b/unittest/storage/tx/mock_utils/basic_fake_define.h @@ -326,6 +326,11 @@ public: return ret; } + int remove_dropped_tenant(const uint64_t tenant_id) { + UNUSED(tenant_id); + return OB_SUCCESS; + } + int update_base_ts(const int64_t base_ts) { return OB_SUCCESS; } int get_base_ts(int64_t &base_ts) { return OB_SUCCESS; } bool is_external_consistent(const uint64_t tenant_id) { return true; }