Fix ls rebuild check tenant gc condition bug

This commit is contained in:
godyangfight
2024-02-10 00:43:19 +00:00
committed by ob-robot
parent f2645d2551
commit 0247a71c69
4 changed files with 16 additions and 24 deletions

View File

@ -329,7 +329,7 @@ int ObLSCompleteMigrationDagNet::trans_rebuild_fail_status_(
bool is_valid_member = true;
bool is_ls_deleted = false;
new_migration_status = ObMigrationStatus::OB_MIGRATION_STATUS_MAX;
bool is_tenant_dropping_or_dropped = false;
bool is_tenant_dropped = false;
if (!ObMigrationStatusHelper::is_valid(current_migration_status)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("current migration status is invalid", K(ret), K(current_migration_status));
@ -348,12 +348,12 @@ int ObLSCompleteMigrationDagNet::trans_rebuild_fail_status_(
is_ls_deleted = false; // reset value if fail
LOG_WARN("failed to get ls status from inner table", K(ret), K(tmp_ret), K(ls));
}
if (OB_TMP_FAIL(check_tenant_is_dropping_or_dropped_(is_tenant_dropping_or_dropped))) {
is_tenant_dropping_or_dropped = false;
if (OB_TMP_FAIL(check_tenant_is_dropped_(is_tenant_dropped))) {
is_tenant_dropped = false;
LOG_WARN("failed to check tenant is droppping or dropped", K(ret), K(tmp_ret), K(ctx_));
}
if (FAILEDx(ObMigrationStatusHelper::trans_rebuild_fail_status(
current_migration_status, is_valid_member, is_ls_deleted, is_tenant_dropping_or_dropped, new_migration_status))) {
current_migration_status, is_valid_member, is_ls_deleted, is_tenant_dropped, new_migration_status))) {
LOG_WARN("failed to trans rebuild fail status", K(ret), K(ctx_));
}
}
@ -522,13 +522,13 @@ int ObLSCompleteMigrationDagNet::report_ls_meta_table_(ObLS *ls)
return ret;
}
int ObLSCompleteMigrationDagNet::check_tenant_is_dropping_or_dropped_(
bool &is_tenant_dropping_or_dropped)
int ObLSCompleteMigrationDagNet::check_tenant_is_dropped_(
bool &is_tenant_dropped)
{
int ret = OB_SUCCESS;
schema::ObMultiVersionSchemaService *schema_service = GCTX.schema_service_;
schema::ObSchemaGetterGuard guard;
is_tenant_dropping_or_dropped = false;
is_tenant_dropped = false;
const ObTenantSchema *tenant_schema = nullptr;
if (OB_ISNULL(schema_service)) {
@ -536,18 +536,10 @@ int ObLSCompleteMigrationDagNet::check_tenant_is_dropping_or_dropped_(
CLOG_LOG(WARN, "schema_service is nullptr", KR(ret));
} else if (OB_FAIL(schema_service->get_tenant_schema_guard(OB_SYS_TENANT_ID, guard))) {
LOG_WARN("fail to get schema guard", KR(ret), K(ctx_));
} else if (OB_FAIL(guard.get_tenant_info(ctx_.tenant_id_, tenant_schema))) {
LOG_WARN("get tenant info failed", KR(ret), K(ctx_));
} else if (OB_ISNULL(tenant_schema)) {
// Double check the tenant status to avoid any potential problems in the schema module.
if (OB_FAIL(guard.check_if_tenant_has_been_dropped(ctx_.tenant_id_, is_tenant_dropping_or_dropped))) {
LOG_WARN("fail to check if tenant has been dropped", KR(ret), K(ctx_));
} else {
LOG_INFO("tenant info is nullptr, check the tenant status",
K(ctx_), K(is_tenant_dropping_or_dropped));
}
} else {
is_tenant_dropping_or_dropped = tenant_schema->is_dropping();
} else if (OB_FAIL(guard.check_if_tenant_has_been_dropped(ctx_.tenant_id_, is_tenant_dropped))) {
LOG_WARN("fail to check if tenant has been dropped", KR(ret), K(ctx_));
} else if (is_tenant_dropped) {
LOG_INFO("tenant is already dropped", K(ctx_), K(is_tenant_dropped));
}
return ret;
}

View File

@ -99,8 +99,8 @@ private:
ObLS &ls,
const ObMigrationStatus &current_migration_status,
ObMigrationStatus &new_migration_status);
int check_tenant_is_dropping_or_dropped_(
bool &is_tenant_dropping_or_dropped);
int check_tenant_is_dropped_(
bool &is_tenan_dropped);
private:
bool is_inited_;

View File

@ -786,7 +786,7 @@ int ObMigrationStatusHelper::trans_rebuild_fail_status(
const ObMigrationStatus &cur_status,
const bool is_in_member_list,
const bool is_ls_deleted,
const bool is_tenant_dropping_or_dropped,
const bool is_tenant_dropped,
ObMigrationStatus &fail_status)
{
int ret = OB_SUCCESS;
@ -795,7 +795,7 @@ int ObMigrationStatusHelper::trans_rebuild_fail_status(
if (OB_MIGRATION_STATUS_REBUILD != cur_status && OB_MIGRATION_STATUS_REBUILD_WAIT != cur_status) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid args", K(ret), K(cur_status));
} else if (is_tenant_dropping_or_dropped || !is_in_member_list || is_ls_deleted) {
} else if (is_tenant_dropped || !is_in_member_list || is_ls_deleted) {
fail_status = OB_MIGRATION_STATUS_REBUILD_FAIL;
} else {
fail_status = OB_MIGRATION_STATUS_REBUILD;

View File

@ -93,7 +93,7 @@ public:
const ObMigrationStatus &cur_status,
const bool is_in_member_list,
const bool is_ls_deleted,
const bool is_tenant_dropping_or_dropped,
const bool is_tenant_dropped,
ObMigrationStatus &fail_status);
static int check_migration_in_final_state(
const ObMigrationStatus &status,