[CP] fix circular dependencies lead to inconsistent schema status
This commit is contained in:
@ -404,6 +404,15 @@ int ObDependencyInfo::collect_all_dep_objs(uint64_t tenant_id,
|
|||||||
uint64_t ref_obj_id,
|
uint64_t ref_obj_id,
|
||||||
common::ObISQLClient &sql_proxy,
|
common::ObISQLClient &sql_proxy,
|
||||||
common::ObIArray<std::pair<uint64_t, share::schema::ObObjectType>> &objs)
|
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;
|
int ret = OB_SUCCESS;
|
||||||
ObSqlString sql;
|
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)) {
|
|| tmp_type >= static_cast<int64_t> (share::schema::ObObjectType::MAX_TYPE)) {
|
||||||
ret = OB_ERR_UNEXPECTED;
|
ret = OB_ERR_UNEXPECTED;
|
||||||
LOG_WARN("get wrong obj type", K(ret));
|
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
|
// skip
|
||||||
} else if (has_exist_in_array(objs, {static_cast<uint64_t> (tmp_obj_id), static_cast<share::schema::ObObjectType> (tmp_type)})) {
|
} else if (has_exist_in_array(objs, {static_cast<uint64_t> (tmp_obj_id), static_cast<share::schema::ObObjectType> (tmp_type)})) {
|
||||||
// dedpulicate
|
// dedpulicate
|
||||||
@ -459,7 +468,7 @@ int ObDependencyInfo::collect_all_dep_objs(uint64_t tenant_id,
|
|||||||
LOG_WARN("too deep recusive", K(ret));
|
LOG_WARN("too deep recusive", K(ret));
|
||||||
} else {
|
} else {
|
||||||
for (int64_t i = init_count; OB_SUCC(ret) && i < objs.count(); ++i) {
|
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));
|
LOG_WARN("failed to collect all dep objs", K(ret), K(objs.count()), K(init_count), K(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,6 +153,11 @@ public:
|
|||||||
uint64_t ref_obj_id,
|
uint64_t ref_obj_id,
|
||||||
common::ObISQLClient &sql_proxy,
|
common::ObISQLClient &sql_proxy,
|
||||||
common::ObIArray<std::pair<uint64_t, share::schema::ObObjectType>> &objs);
|
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,
|
static int cascading_modify_obj_status(common::ObMySQLTransaction &trans,
|
||||||
uint64_t tenant_id,
|
uint64_t tenant_id,
|
||||||
uint64_t obj_id,
|
uint64_t obj_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user