[CP] fix circular dependencies lead to inconsistent schema status

This commit is contained in:
obdev
2024-02-06 16:17:24 +00:00
committed by ob-robot
parent 60b885ce98
commit c81a04702a
2 changed files with 16 additions and 2 deletions

View File

@ -404,6 +404,15 @@ int ObDependencyInfo::collect_all_dep_objs(uint64_t tenant_id,
uint64_t ref_obj_id,
common::ObISQLClient &sql_proxy,
common::ObIArray<std::pair<uint64_t, share::schema::ObObjectType>> &objs)
{
return collect_all_dep_objs_inner(tenant_id, ref_obj_id, ref_obj_id, sql_proxy, objs);
}
int ObDependencyInfo::collect_all_dep_objs_inner(uint64_t tenant_id,
uint64_t root_obj_id,
uint64_t ref_obj_id,
common::ObISQLClient &sql_proxy,
common::ObIArray<std::pair<uint64_t, share::schema::ObObjectType>> &objs)
{
int ret = OB_SUCCESS;
ObSqlString sql;
@ -433,7 +442,7 @@ int ObDependencyInfo::collect_all_dep_objs(uint64_t tenant_id,
|| tmp_type >= static_cast<int64_t> (share::schema::ObObjectType::MAX_TYPE)) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get wrong obj type", K(ret));
} else if (ref_obj_id == tmp_obj_id) {
} else if (ref_obj_id == tmp_obj_id || root_obj_id == tmp_obj_id) {
// skip
} else if (has_exist_in_array(objs, {static_cast<uint64_t> (tmp_obj_id), static_cast<share::schema::ObObjectType> (tmp_type)})) {
// dedpulicate
@ -459,7 +468,7 @@ int ObDependencyInfo::collect_all_dep_objs(uint64_t tenant_id,
LOG_WARN("too deep recusive", K(ret));
} else {
for (int64_t i = init_count; OB_SUCC(ret) && i < objs.count(); ++i) {
if (OB_FAIL(collect_all_dep_objs(tenant_id, objs.at(i).first, sql_proxy, objs))) {
if (OB_FAIL(collect_all_dep_objs_inner(tenant_id, root_obj_id, objs.at(i).first, sql_proxy, objs))) {
LOG_WARN("failed to collect all dep objs", K(ret), K(objs.count()), K(init_count), K(i));
}
}

View File

@ -153,6 +153,11 @@ public:
uint64_t ref_obj_id,
common::ObISQLClient &sql_proxy,
common::ObIArray<std::pair<uint64_t, share::schema::ObObjectType>> &objs);
static int collect_all_dep_objs_inner(uint64_t tenant_id,
uint64_t root_obj_id,
uint64_t ref_obj_id,
common::ObISQLClient &sql_proxy,
common::ObIArray<std::pair<uint64_t, share::schema::ObObjectType>> &objs);
static int cascading_modify_obj_status(common::ObMySQLTransaction &trans,
uint64_t tenant_id,
uint64_t obj_id,