[CP] drop_tenant clear rs job
This commit is contained in:
parent
852f63a7b3
commit
178a91b61c
@ -27484,8 +27484,6 @@ int ObDDLService::drop_resource_pool_pre(const uint64_t tenant_id,
|
||||
LOG_WARN("get_pool_names_of_tenant failed", K(tenant_id), KR(ret));
|
||||
} else if (OB_FAIL(unit_mgr_->revoke_pools(trans, drop_ug_id_array, pool_names, tenant_id))) {
|
||||
LOG_WARN("revoke_pools failed", K(pool_names), K(tenant_id), KR(ret));
|
||||
} else if (OB_FAIL(unit_mgr_->try_complete_shrink_tenant_pool_unit_num_rs_job(tenant_id, trans))) {
|
||||
LOG_WARN("complete shrinking tenant job failed", K(pool_names), K(tenant_id), KR(ret));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -436,6 +436,24 @@ int ObRsJobTableOperator::complete_job(int64_t job_id, int result_code, common::
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObRsJobTableOperator::complete_all_job_for_dropping_tenant(int64_t tenant_id, common::ObISQLClient &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObSqlString sql;
|
||||
int64_t affected_rows = 0;
|
||||
if (OB_FAIL(sql.assign_fmt("UPDATE %s SET job_status = '%s', result_code = %d "
|
||||
"WHERE tenant_id = %lu AND job_status = '%s'",
|
||||
OB_ALL_ROOTSERVICE_JOB_TNAME, job_status_str_array[JOB_STATUS_FAILED], OB_TENANT_NOT_EXIST,
|
||||
tenant_id, job_status_str_array[JOB_STATUS_INPROGRESS]))) {
|
||||
LOG_WARN("format sql failed", K(sql), K(ret));
|
||||
} else if (OB_FAIL(trans.write(OB_SYS_TENANT_ID, sql.ptr(), affected_rows))) {
|
||||
LOG_WARN("execute sql failed", K(sql), K(ret));
|
||||
} else {
|
||||
LOG_INFO("the tenant is dropped, set all its inprogress rs job as FAILED", K(tenant_id), K(affected_rows));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObRsJobTableOperator::load_max_job_id(int64_t &max_job_id, int64_t &row_count)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
|
@ -182,6 +182,7 @@ public:
|
||||
int update_job(int64_t job_id, share::ObDMLSqlSplicer &pairs, common::ObISQLClient &trans);
|
||||
int update_job_progress(int64_t job_id, int64_t progress, common::ObISQLClient &trans);
|
||||
int complete_job(int64_t job_id, int result_code, common::ObISQLClient &trans);
|
||||
int complete_all_job_for_dropping_tenant(int64_t tenant_id, common::ObISQLClient &trans);
|
||||
|
||||
// misc
|
||||
int64_t get_max_job_id() const { return max_job_id_; }
|
||||
@ -289,4 +290,7 @@ public:
|
||||
tmp_ret; \
|
||||
})
|
||||
|
||||
#define RS_JOB_COMPLETE_ALL_JOB_FOR_DROPPING_TENANT(tenant_id, trans) \
|
||||
THE_RS_JOB_TABLE.complete_all_job_for_dropping_tenant((tenant_id), (trans))
|
||||
|
||||
#endif /* _OB_RS_JOB_TABLE_OPERATOR_H */
|
||||
|
@ -2056,29 +2056,6 @@ int ObUnitManager::rollback_alter_resource_tenant_unit_num_rs_job(
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObUnitManager::try_complete_shrink_tenant_pool_unit_num_rs_job(
|
||||
const uint64_t tenant_id,
|
||||
common::ObMySQLTransaction &trans)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
// this function is called by ObDDLService::drop_resource_pool_pre
|
||||
const int check_ret = OB_SUCCESS; // no need to check ls status
|
||||
int64_t job_id = 0;
|
||||
if (OB_FAIL(find_alter_resource_tenant_unit_num_rs_job(tenant_id, job_id, trans))) {
|
||||
if (OB_ENTRY_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("fail to execute find_alter_resource_tenant_unit_num_rs_job", KR(ret), K(tenant_id));
|
||||
}
|
||||
} else {
|
||||
ret = complete_shrink_tenant_pool_unit_num_rs_job_(
|
||||
tenant_id, job_id, check_ret, trans);
|
||||
FLOG_INFO("[ALTER_RESOURCE_TENANT_UNIT_NUM NOTICE] complete an inprogress rs job DROP_TENANT_FORCE",
|
||||
KR(ret), K(tenant_id), K(job_id));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObUnitManager::complete_shrink_tenant_pool_unit_num_rs_job_(
|
||||
const uint64_t tenant_id,
|
||||
const int64_t job_id,
|
||||
|
@ -206,9 +206,6 @@ public:
|
||||
common::ObIArray<uint64_t> &new_ug_id_array,
|
||||
const common::ObIArray<share::ObResourcePoolName> &pool_names,
|
||||
const uint64_t tenant_id);
|
||||
virtual int try_complete_shrink_tenant_pool_unit_num_rs_job(
|
||||
const uint64_t tenant_id,
|
||||
common::ObMySQLTransaction &trans);
|
||||
virtual int get_tenant_alive_servers_non_block(const uint64_t tenant_id,
|
||||
common::ObIArray<common::ObAddr> &servers);
|
||||
virtual int get_pool_ids_of_tenant(const uint64_t tenant_id,
|
||||
|
@ -169,6 +169,10 @@ int ObTenantSqlService::delete_tenant(
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILEDx(RS_JOB_COMPLETE_ALL_JOB_FOR_DROPPING_TENANT(tenant_id, sql_client))) {
|
||||
LOG_WARN("fail to complete all rs job for dropping tenant", KR(ret), K(tenant_id));
|
||||
}
|
||||
|
||||
if (OB_SUCC(ret)) {
|
||||
ObSchemaOperation delete_tenant_op;
|
||||
delete_tenant_op.tenant_id_ = tenant_id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user