Fix schema guard reset due to double get_tenant_schema_guard
This commit is contained in:
parent
ef466e89a3
commit
34b77b6f1e
@ -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;
|
||||
|
@ -4978,6 +4978,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))) {
|
||||
@ -5796,9 +5797,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))) {
|
||||
@ -5830,12 +5829,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;
|
||||
|
@ -939,6 +939,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);
|
||||
|
@ -183,6 +183,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))) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user