diff --git a/src/storage/ls/ob_ls.cpp b/src/storage/ls/ob_ls.cpp index bf94980e24..eee1cfc065 100755 --- a/src/storage/ls/ob_ls.cpp +++ b/src/storage/ls/ob_ls.cpp @@ -90,6 +90,7 @@ ObLS::ObLS() tenant_id_(OB_INVALID_TENANT_ID), is_stopped_(false), is_offlined_(false), + is_remove_(false), ls_meta_(), rs_reporter_(nullptr), startup_transfer_info_() @@ -1809,6 +1810,9 @@ int ObLS::enable_replay() if (IS_NOT_INIT) { ret = OB_NOT_INIT; LOG_WARN("ls is not inited", K(ret)); + } else if (is_remove()) { + ret = OB_LS_IS_DELETED; + LOG_WARN("ls status is WAIT_GC when enable replay", K(get_ls_id())); } else if (OB_FAIL(log_handler_.enable_replay(ls_meta_.get_clog_base_lsn(), ls_meta_.get_clog_checkpoint_scn()))) { LOG_WARN("failed to enable replay", K(ret)); diff --git a/src/storage/ls/ob_ls.h b/src/storage/ls/ob_ls.h index 13ca8b9695..9da3e2da35 100755 --- a/src/storage/ls/ob_ls.h +++ b/src/storage/ls/ob_ls.h @@ -185,6 +185,8 @@ public: int offline_without_lock(); int enable_for_restore(); bool is_offline() const { return is_offlined_; } // mock function, TODO(@yanyuan) + bool is_remove() const { return ATOMIC_LOAD(&is_remove_); } + void set_is_remove() { return ATOMIC_STORE(&is_remove_, true); } ObLSTxService *get_tx_svr() { return &ls_tx_svr_; } ObLockTable *get_lock_table() { return &lock_table_; } @@ -863,6 +865,7 @@ private: uint64_t tenant_id_; bool is_stopped_; bool is_offlined_; + bool is_remove_; ObLSMeta ls_meta_; observer::ObIMetaReport *rs_reporter_; ObLSLock lock_; diff --git a/src/storage/tx_storage/ob_ls_service.cpp b/src/storage/tx_storage/ob_ls_service.cpp index 70300f918d..0cd29274e8 100644 --- a/src/storage/tx_storage/ob_ls_service.cpp +++ b/src/storage/tx_storage/ob_ls_service.cpp @@ -739,7 +739,12 @@ int ObLSService::enable_replay() } else if (!can_replay) { // ls can not enable replay } else if (OB_FAIL(ls->enable_replay())) { - LOG_ERROR("fail to enable replay", K(ret)); + if (OB_LS_IS_DELETED == ret) { + ret = OB_SUCCESS; + LOG_WARN("ls status is WAIT_GC, skip it", K(ls->get_ls_id())); + } else { + LOG_ERROR("fail to enable replay", K(ret)); + } } } if (OB_ITER_END == ret) { @@ -918,6 +923,7 @@ int ObLSService::remove_ls( } else if (OB_ISNULL(ls = handle.get_ls())) { ret = OB_ERR_UNEXPECTED; LOG_ERROR("log stream is null, unexpected error", K(ls_id)); + } else if (FALSE_IT(ls->set_is_remove())) { // ls leader gc must has block tx start, gracefully kill tx and write offline log before here. } else if (OB_FAIL(ls->offline())) { LOG_WARN("ls offline failed", K(ret), K(ls_id), KP(ls));