Fix reinitialized max id due to unexpected 4018 from sql read

This commit is contained in:
Hongqin-Li 2023-09-04 02:14:31 +00:00 committed by ob-robot
parent 5cfa6d074f
commit 5ae3de7429

View File

@ -449,6 +449,7 @@ int ObMaxIdFetcher::fetch_max_id(ObISQLClient &sql_client, const uint64_t tenant
ObZone zone;
const char *id_name = NULL;
const uint64_t exec_tenant_id = ObSchemaUtils::get_exec_tenant_id(tenant_id);
bool no_max_id = false;
if (OB_INVALID_ID == tenant_id || !valid_max_id_type(max_id_type)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("invalid argument", K(ret), K(tenant_id), K(max_id_type));
@ -487,13 +488,20 @@ int ObMaxIdFetcher::fetch_max_id(ObISQLClient &sql_client, const uint64_t tenant
}
} else {
if (OB_ITER_END == ret) {
ret = OB_ENTRY_NOT_EXIST;
no_max_id = true;
} else {
LOG_WARN("fail to get id", "name", id_name, K(ret));
}
}
}
}
if (OB_ENTRY_NOT_EXIST == ret) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("4018 not caused by no max id", K(ret));
} else if (OB_ITER_END == ret && no_max_id) {
ret = OB_ENTRY_NOT_EXIST;
}
return ret;
}