diff --git a/src/storage/ls/ob_ls.cpp b/src/storage/ls/ob_ls.cpp index 3b543d8df5..101a1de4be 100644 --- a/src/storage/ls/ob_ls.cpp +++ b/src/storage/ls/ob_ls.cpp @@ -698,7 +698,8 @@ int ObLS::offline_() LOG_WARN("lock table offline failed", K(ret), K(ls_meta_)); } else if (OB_FAIL(ls_tablet_svr_.offline())) { LOG_WARN("tablet service offline failed", K(ret), K(ls_meta_)); - } else if (FALSE_IT(tablet_gc_handler_.offline())) { + } else if (OB_FAIL(tablet_gc_handler_.offline())) { + LOG_WARN("tablet gc handler offline failed", K(ret), K(ls_meta_)); } else { // do nothing } diff --git a/src/storage/tx_storage/ob_tablet_gc_service.cpp b/src/storage/tx_storage/ob_tablet_gc_service.cpp index 4cab9a7af6..4d0f3da617 100644 --- a/src/storage/tx_storage/ob_tablet_gc_service.cpp +++ b/src/storage/tx_storage/ob_tablet_gc_service.cpp @@ -435,11 +435,17 @@ int ObTabletGCHandler::gc_tablets(const common::ObTabletIDArray &tablet_ids) return ret; } -void ObTabletGCHandler::offline() +int ObTabletGCHandler::offline() { + int ret = OB_SUCCESS; set_stop(); - wait_stop(); - STORAGE_LOG(INFO, "tablet gc handler offline", KPC(this), KPC(ls_), K(ls_->get_ls_meta())); + if (!is_finish()) { + ret = OB_EAGAIN; + STORAGE_LOG(INFO, "tablet gc handler not finish, retry", KR(ret), KPC(this), KPC(ls_), K(ls_->get_ls_meta())); + } else { + STORAGE_LOG(INFO, "tablet gc handler offline", KPC(this), KPC(ls_), K(ls_->get_ls_meta())); + } + return ret; } void ObTabletGCHandler::online() diff --git a/src/storage/tx_storage/ob_tablet_gc_service.h b/src/storage/tx_storage/ob_tablet_gc_service.h index 8485f040ea..31bbc37619 100644 --- a/src/storage/tx_storage/ob_tablet_gc_service.h +++ b/src/storage/tx_storage/ob_tablet_gc_service.h @@ -58,7 +58,7 @@ public: const int64_t checkpoint_ts); int gc_tablets(const common::ObTabletIDArray &tablet_ids); bool check_stop() { return ATOMIC_LOAD(&update_enabled_) == false; } - void offline(); + int offline(); void online(); TO_STRING_KV(K_(tablet_persist_trigger), K_(is_inited)); @@ -68,7 +68,7 @@ private: int freeze_unpersist_tablet_ids(const common::ObTabletIDArray &unpersist_tablet_ids); int wait_unpersist_tablet_ids_flushed(const common::ObTabletIDArray &unpersist_tablet_ids, const int64_t checkpoint_ts); - void wait_stop() { obsys::ObWLockGuard lock(wait_lock_); } + bool is_finish() { obsys::ObWLockGuard lock(wait_lock_, false); return lock.acquired(); } void set_stop() { ATOMIC_STORE(&update_enabled_, false); } void set_start() { ATOMIC_STORE(&update_enabled_, true); }