fix backup delete skip tablet timeout

This commit is contained in:
hamstersox
2023-09-14 02:40:26 +00:00
committed by ob-robot
parent 8f2327f912
commit 424a6e09d6
6 changed files with 71 additions and 36 deletions

View File

@ -1184,15 +1184,9 @@ int ObUserTenantBackupJobMgr::move_to_history_()
{
int ret = OB_SUCCESS;
LOG_INFO("start to move backup job to history", KPC(job_attr_));
ObMySQLTransaction trans;
ObBackupSetTaskMgr set_task_mgr;
ObTimeoutCtx timeout_ctx;
if (is_sys_tenant(job_attr_->initiator_tenant_id_) && OB_FAIL(report_failed_to_initiator_())) {
LOG_WARN("fail to report job finish to initiator tenant id", K(ret), KPC(job_attr_));
} else if (OB_FAIL(trans.start(sql_proxy_, tenant_id_))) {
LOG_WARN("[DATA_BACKUP]failed to start trans", K(ret));
} else if (OB_FAIL(set_query_timeout_and_trx_timeout_(timeout_ctx))) {
LOG_WARN("failed to set query timeout and trx timeout", K(ret));
} else {
if (OB_FAIL(set_task_mgr.init(tenant_id_, *job_attr_, *sql_proxy_,
*rpc_proxy_, *task_scheduler_, *schema_service_, *backup_service_))) {
@ -1201,46 +1195,33 @@ int ObUserTenantBackupJobMgr::move_to_history_()
} else {
LOG_WARN("[DATA_BACKUP]failed to init set task mgr", K(ret), KPC(job_attr_));
}
} else if (OB_FAIL(set_task_mgr.do_clean_up(trans))) {
} else if (OB_FAIL(set_task_mgr.do_clean_up())) {
LOG_WARN("[DATA_BACKUP]failed to do clean up", K(ret), K(set_task_mgr));
}
ObMySQLTransaction trans;
if (OB_FAIL(ret)) {
} else if (OB_FAIL(trans.start(sql_proxy_, gen_meta_tenant_id(job_attr_->tenant_id_)))) {
LOG_WARN("failed to start trans", K(ret));
} else if (OB_FAIL(ObBackupJobOperator::move_job_to_his(trans, job_attr_->tenant_id_, job_attr_->job_id_))) {
LOG_WARN("[DATA_BACKUP]failed to move job to history", K(ret), KPC(job_attr_));
}
if (OB_SUCC(ret)) {
if (OB_FAIL(trans.end(true))) {
LOG_WARN("[DATA_BACKUP]failed to commit trans", K(ret));
} else {
if (trans.is_started()) {
int tmp_ret = OB_SUCCESS;
if (OB_TMP_FAIL(trans.end(OB_SUCC(ret)))) {
LOG_WARN("failed to end trans", K(ret), K(tmp_ret));
ret = OB_SUCC(ret) ? tmp_ret : ret;
}
if (OB_SUCC(ret)) {
LOG_INFO("succeed to move job to history. backup job finish", "tenant_id", job_attr_->tenant_id_, "job_id", job_attr_->job_id_);
backup_service_->wakeup();
}
} else {
int tmp_ret = OB_SUCCESS;
if (OB_SUCCESS != (tmp_ret = trans.end(false))) {
LOG_WARN("[DATA_BACKUP]failed to roll back status", K(ret));
}
}
}
return ret;
}
int ObUserTenantBackupJobMgr::set_query_timeout_and_trx_timeout_(ObTimeoutCtx &timeout_ctx)
{
int ret = OB_SUCCESS;
const int64_t ob_query_timeout = 600 * 1000 * 1000; // 600s
const int64_t ob_trx_timeout = 600 * 1000 * 1000; // 600s
const int64_t abs_timeout = ObTimeUtility::current_time() + ob_query_timeout;
if (OB_FAIL(timeout_ctx.set_trx_timeout_us(ob_trx_timeout))) {
LOG_WARN("failed to set trx timeout us", K(ret), K(ob_trx_timeout));
} else if (OB_FAIL(timeout_ctx.set_abs_timeout(abs_timeout))) {
LOG_WARN("failed to set abs timeout", K(ret));
}
return ret;
}
int ObUserTenantBackupJobMgr::report_failed_to_initiator_()
{
int ret = OB_SUCCESS;