if is_remove of ObLS is true, skip it in ObLSService::enable_replay.

This commit is contained in:
obdev
2023-07-05 03:12:16 +00:00
committed by ob-robot
parent 7be502c0ca
commit cbeb742405
3 changed files with 14 additions and 1 deletions

View File

@ -90,6 +90,7 @@ ObLS::ObLS()
tenant_id_(OB_INVALID_TENANT_ID), tenant_id_(OB_INVALID_TENANT_ID),
is_stopped_(false), is_stopped_(false),
is_offlined_(false), is_offlined_(false),
is_remove_(false),
ls_meta_(), ls_meta_(),
rs_reporter_(nullptr), rs_reporter_(nullptr),
startup_transfer_info_() startup_transfer_info_()
@ -1809,6 +1810,9 @@ int ObLS::enable_replay()
if (IS_NOT_INIT) { if (IS_NOT_INIT) {
ret = OB_NOT_INIT; ret = OB_NOT_INIT;
LOG_WARN("ls is not inited", K(ret)); 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(), } else if (OB_FAIL(log_handler_.enable_replay(ls_meta_.get_clog_base_lsn(),
ls_meta_.get_clog_checkpoint_scn()))) { ls_meta_.get_clog_checkpoint_scn()))) {
LOG_WARN("failed to enable replay", K(ret)); LOG_WARN("failed to enable replay", K(ret));

View File

@ -185,6 +185,8 @@ public:
int offline_without_lock(); int offline_without_lock();
int enable_for_restore(); int enable_for_restore();
bool is_offline() const { return is_offlined_; } // mock function, TODO(@yanyuan) 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_; } ObLSTxService *get_tx_svr() { return &ls_tx_svr_; }
ObLockTable *get_lock_table() { return &lock_table_; } ObLockTable *get_lock_table() { return &lock_table_; }
@ -863,6 +865,7 @@ private:
uint64_t tenant_id_; uint64_t tenant_id_;
bool is_stopped_; bool is_stopped_;
bool is_offlined_; bool is_offlined_;
bool is_remove_;
ObLSMeta ls_meta_; ObLSMeta ls_meta_;
observer::ObIMetaReport *rs_reporter_; observer::ObIMetaReport *rs_reporter_;
ObLSLock lock_; ObLSLock lock_;

View File

@ -739,7 +739,12 @@ int ObLSService::enable_replay()
} else if (!can_replay) { } else if (!can_replay) {
// ls can not enable replay // ls can not enable replay
} else if (OB_FAIL(ls->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) { if (OB_ITER_END == ret) {
@ -918,6 +923,7 @@ int ObLSService::remove_ls(
} else if (OB_ISNULL(ls = handle.get_ls())) { } else if (OB_ISNULL(ls = handle.get_ls())) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_ERROR("log stream is null, unexpected error", K(ls_id)); 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. // ls leader gc must has block tx start, gracefully kill tx and write offline log before here.
} else if (OB_FAIL(ls->offline())) { } else if (OB_FAIL(ls->offline())) {
LOG_WARN("ls offline failed", K(ret), K(ls_id), KP(ls)); LOG_WARN("ls offline failed", K(ret), K(ls_id), KP(ls));