switchover to primary check ls is sync on RS side

This commit is contained in:
obdev
2023-02-06 16:03:49 +08:00
committed by ob-robot
parent d4c5f954f7
commit 924a6b6d92
10 changed files with 96 additions and 62 deletions

View File

@ -1822,11 +1822,24 @@ int ObSwitchTenantExecutor::execute(ObExecContext &ctx, ObSwitchTenantStmt &stmt
ObSwitchTenantArg &arg = stmt.get_arg();
arg.set_stmt_str(first_stmt);
//left 200ms to return result
const int64_t remain_timeout_interval_us = THIS_WORKER.get_timeout_remain();
const int64_t execute_timeout_interval_us = remain_timeout_interval_us - 200 * 1000; // left 200ms to return result
const int64_t original_timeout_abs_us = THIS_WORKER.get_timeout_ts();
if (0 < execute_timeout_interval_us) {
THIS_WORKER.set_timeout_ts(ObTimeUtility::current_time() + execute_timeout_interval_us);
}
// TODO support specify ALL
if (OB_FAIL(ret)) {
} else if (OB_FAIL(OB_PRIMARY_STANDBY_SERVICE.switch_tenant(arg))) {
LOG_WARN("failed to switch_tenant", KR(ret), K(arg));
}
//set timeout back
if (0 < execute_timeout_interval_us) {
THIS_WORKER.set_timeout_ts(original_timeout_abs_us);
}
}
return ret;
}