Fix schema guard reset due to double get_tenant_schema_guard

This commit is contained in:
Hongqin-Li
2022-11-28 13:40:19 +00:00
committed by ob-robot
parent ef466e89a3
commit 34b77b6f1e
4 changed files with 10 additions and 7 deletions

View File

@ -261,6 +261,10 @@ int ObColumnRedefinitionTask::copy_table_indexes()
}
DEBUG_SYNC(COLUMN_REDEFINITION_COPY_TABLE_INDEXES);
if (OB_SUCC(ret) && index_ids.count() > 0) {
ObSchemaGetterGuard new_schema_guard;
if (OB_FAIL(root_service->get_ddl_service().get_tenant_schema_guard_with_version_in_inner_table(tenant_id_, new_schema_guard))) {
LOG_WARN("failed to refresh schema guard", K(ret));
}
for (int64_t i = 0; OB_SUCC(ret) && i < index_ids.count(); ++i) {
const uint64_t index_id = index_ids.at(i);
const ObTableSchema *index_schema = nullptr;
@ -271,9 +275,7 @@ int ObColumnRedefinitionTask::copy_table_indexes()
create_index_arg.nls_date_format_ = alter_table_arg_.nls_formats_[0];
create_index_arg.nls_timestamp_format_ = alter_table_arg_.nls_formats_[1];
create_index_arg.nls_timestamp_tz_format_ = alter_table_arg_.nls_formats_[2];
if (OB_FAIL(root_service->get_ddl_service().get_tenant_schema_guard_with_version_in_inner_table(tenant_id_, schema_guard))) {
LOG_WARN("get schema guard failed", K(ret));
} else if (OB_FAIL(schema_guard.get_table_schema(tenant_id_, index_ids.at(i), index_schema))) {
if (OB_FAIL(new_schema_guard.get_table_schema(tenant_id_, index_ids.at(i), index_schema))) {
LOG_WARN("get table schema failed", K(ret));
} else if (OB_ISNULL(index_schema)) {
ret = OB_ERR_SYS;