add timeout for wait time elapsed

This commit is contained in:
simonjoylet 2023-08-14 06:42:36 +00:00 committed by ob-robot
parent 579631624e
commit 942ee07d47
2 changed files with 4 additions and 2 deletions

View File

@ -592,10 +592,12 @@ int ObUniqueIndexChecker::wait_trans_end(ObIDag *dag)
LOG_WARN("get ls failed", K(ret), K(ls_id_));
} else {
const int64_t now = ObTimeUtility::current_time();
const int64_t timeout_us = 1000L * 1000L * 60L; // 1 min
while (OB_SUCC(ret) && !dag->has_set_stop()) {
transaction::ObTransID pending_tx_id;
if (OB_FAIL(ls_handle.get_ls()->check_modify_time_elapsed(tablet_id_, now, pending_tx_id))) {
if (OB_EAGAIN == ret) {
// when timeout with EAGAIN, ddl scheduler of root service will retry
if (OB_EAGAIN == ret && ObTimeUtility::current_time() - now < timeout_us) {
ret = OB_SUCCESS;
ob_usleep(RETRY_INTERVAL);
dag_yield();

View File

@ -907,7 +907,7 @@ int ObPartTransCtx::check_modify_time_elapsed(
} else if (is_exiting_) {
// do nothing
} else if (is_follower_()) {
ret = OB_EAGAIN;
ret = OB_NOT_MASTER;
TRANS_LOG(WARN, "current transaction not master, need retry later", K(ret),
K(tablet_id), K(timestamp), "context", *this);
} else if (OB_FAIL(mt_ctx_.check_modify_time_elapsed(tablet_id,