[CP] [4.0] retry lock in offline of tablet gc handler

This commit is contained in:
obdev
2022-11-25 10:40:26 +00:00
committed by wangzelin.wzl
parent 842dc28be7
commit 5697e0f25b
3 changed files with 13 additions and 6 deletions

View File

@ -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
}

View File

@ -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();
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()

View File

@ -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); }