提交 1c5798c4 编写于 作者: H Hongqin-Li 提交者: OB-robot

[CP] Fix schema guard reset due to double get_tenant_schema_guard

上级 2ce29562
......@@ -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;
......
......@@ -4995,6 +4995,7 @@ int ObDDLService::alter_table_index(const obrpc::ObAlterTableArg &alter_table_ar
if (OB_FAIL(rename_dropping_index_name(origin_table_schema.get_table_id(),
origin_table_schema.get_database_id(),
*drop_index_arg,
schema_guard,
ddl_operator,
trans,
new_index_schema))) {
......@@ -5813,9 +5814,7 @@ int ObDDLService::get_index_schema_by_name(
const ObString &index_name = drop_index_arg.index_name_;
//build index name and get index schema
if (OB_FAIL(schema_service_->get_tenant_schema_guard(tenant_id, schema_guard))) {
LOG_WARN("failed to get schema guard", K(ret));
} else if (OB_FAIL(ObTableSchema::build_index_table_name(allocator,
if (OB_FAIL(ObTableSchema::build_index_table_name(allocator,
data_table_id,
index_name,
index_table_name))) {
......@@ -5847,12 +5846,12 @@ int ObDDLService::rename_dropping_index_name(
const uint64_t data_table_id,
const uint64_t database_id,
const ObDropIndexArg &drop_index_arg,
ObSchemaGetterGuard &schema_guard,
ObDDLOperator &ddl_operator,
common::ObMySQLTransaction &trans,
share::schema::ObTableSchema &new_index_schema)
{
int ret = OB_SUCCESS;
ObSchemaGetterGuard schema_guard;
const ObTableSchema *index_table_schema = nullptr;
int nwrite = 0;
const int64_t buf_size = number::ObNumber::MAX_PRINTABLE_SIZE;
......@@ -938,6 +938,7 @@ public:
const uint64_t data_table_id,
const uint64_t database_id,
const obrpc::ObDropIndexArg &drop_index_arg,
ObSchemaGetterGuard &schema_guard,
ObDDLOperator &ddl_operator,
ObMySQLTransaction &trans,
share::schema::ObTableSchema &new_index_schema);
......
......@@ -181,6 +181,7 @@ int ObIndexBuilder::drop_index(const ObDropIndexArg &arg, obrpc::ObDropIndexRes
table_schema->get_table_id(),
table_schema->get_database_id(),
arg,
schema_guard,
ddl_operator,
trans,
new_index_schema))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册