Fix unavailable hidden table index after ddl
This commit is contained in:
@ -14313,33 +14313,43 @@ int ObDDLService::rebuild_hidden_table_index(obrpc::ObAlterTableArg &alter_table
|
|||||||
orig_table_schema,
|
orig_table_schema,
|
||||||
hidden_table_schema))) {
|
hidden_table_schema))) {
|
||||||
LOG_WARN("failed to get orig and hidden table schema", K(ret));
|
LOG_WARN("failed to get orig and hidden table schema", K(ret));
|
||||||
} else if (OB_FAIL(col_name_map.init(*orig_table_schema, alter_table_schema))) {
|
} else if (hidden_table_schema->get_simple_index_infos().count() > 0) {
|
||||||
LOG_WARN("failed to init column name map", K(ret), K(alter_table_schema), KPC(orig_table_schema));
|
// if there is any index in the hidden table, all indexes are already rebuilt because the rebuild is wrap in a transaction
|
||||||
} else if (OB_FAIL(get_all_dropped_column_ids(alter_table_arg, *orig_table_schema, drop_cols_id_arr))) {
|
const common::ObIArray<ObAuxTableMetaInfo> &index_infos = hidden_table_schema->get_simple_index_infos();
|
||||||
LOG_WARN("fail to get drop cols id set", K(ret));
|
for (int64_t i = 0; OB_SUCC(ret) && i < index_infos.count(); ++i) {
|
||||||
} else if (OB_FAIL(reconstruct_index_schema(*orig_table_schema,
|
if (OB_FAIL(index_ids.push_back(index_infos.at(i).table_id_))) {
|
||||||
*hidden_table_schema,
|
LOG_WARN("push back index id failed", K(ret));
|
||||||
schema_guard,
|
}
|
||||||
drop_cols_id_arr,
|
}
|
||||||
col_name_map,
|
} else {
|
||||||
*tz_info_wrap.get_time_zone_info(),
|
if (OB_FAIL(col_name_map.init(*orig_table_schema, alter_table_schema))) {
|
||||||
alter_table_arg.allocator_,
|
LOG_WARN("failed to init column name map", K(ret), K(alter_table_schema), KPC(orig_table_schema));
|
||||||
new_table_schemas,
|
} else if (OB_FAIL(get_all_dropped_column_ids(alter_table_arg, *orig_table_schema, drop_cols_id_arr))) {
|
||||||
index_ids))) {
|
LOG_WARN("fail to get drop cols id set", K(ret));
|
||||||
LOG_WARN("failed to reconstruct index schema", K(ret));
|
} else if (OB_FAIL(reconstruct_index_schema(*orig_table_schema,
|
||||||
} else if (OB_FAIL(add_new_index_schema(alter_table_arg,
|
*hidden_table_schema,
|
||||||
*orig_table_schema,
|
schema_guard,
|
||||||
*hidden_table_schema,
|
drop_cols_id_arr,
|
||||||
schema_guard,
|
col_name_map,
|
||||||
new_table_schemas,
|
*tz_info_wrap.get_time_zone_info(),
|
||||||
index_ids))) {
|
alter_table_arg.allocator_,
|
||||||
LOG_WARN("failed to add new index schema", K(ret));
|
new_table_schemas,
|
||||||
} else if (OB_FAIL(rebuild_hidden_table_index_in_trans(alter_table_arg,
|
index_ids))) {
|
||||||
*hidden_table_schema,
|
LOG_WARN("failed to reconstruct index schema", K(ret));
|
||||||
schema_guard,
|
} else if (OB_FAIL(add_new_index_schema(alter_table_arg,
|
||||||
trans,
|
*orig_table_schema,
|
||||||
new_table_schemas))) {
|
*hidden_table_schema,
|
||||||
LOG_WARN("failed to rebuild hidden table index in trans", K(ret));
|
schema_guard,
|
||||||
|
new_table_schemas,
|
||||||
|
index_ids))) {
|
||||||
|
LOG_WARN("failed to add new index schema", K(ret));
|
||||||
|
} else if (OB_FAIL(rebuild_hidden_table_index_in_trans(alter_table_arg,
|
||||||
|
*hidden_table_schema,
|
||||||
|
schema_guard,
|
||||||
|
trans,
|
||||||
|
new_table_schemas))) {
|
||||||
|
LOG_WARN("failed to rebuild hidden table index in trans", K(ret));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int tmp_ret = OB_SUCCESS;
|
int tmp_ret = OB_SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user