diff --git a/src/share/schema/ob_schema_printer.cpp b/src/share/schema/ob_schema_printer.cpp index d2c518f488e2c556cf23d1d246c01d67f2011375..6595487ed08399443428f77b0b4c97f7f273b9ea 100644 --- a/src/share/schema/ob_schema_printer.cpp +++ b/src/share/schema/ob_schema_printer.cpp @@ -826,7 +826,7 @@ int ObSchemaPrinter::print_table_definition_indexes(const ObTableSchema &table_s // Do not print global index. } else if (index_schema->is_built_in_index()) { // For full-text or vector index search index, only inverted table can be printed, and others table will not be printed. - } else if (index_schema->is_vec_index() && index_schema->get_index_status() != INDEX_STATUS_AVAILABLE) { + } else if (index_schema->is_vec_index() && !ObVectorIndexUtil::check_index_is_all_ready(schema_guard_, table_schema, *index_schema)) { // Not show vec index which in unavaliable status } else if (OB_FAIL(print_single_index_definition(index_schema, table_schema, arena_allocator, buf, buf_len, pos, is_unique_index, is_oracle_mode, false, sql_mode, tz_info))) { diff --git a/src/share/vector_index/ob_vector_index_util.cpp b/src/share/vector_index/ob_vector_index_util.cpp index 2c52035d9f79b79a96b5350339e8b08b79757477..fe1a91fb4f233f2dbb44117d372fa7e60d28ad7f 100644 --- a/src/share/vector_index/ob_vector_index_util.cpp +++ b/src/share/vector_index/ob_vector_index_util.cpp @@ -4476,6 +4476,29 @@ int ObVectorIndexUtil::get_vector_index_column_name( return ret; } +bool ObVectorIndexUtil::check_index_is_all_ready( + ObSchemaGetterGuard &schema_guard, + const schema::ObTableSchema &table_schema, + const schema::ObTableSchema &index_schema) +{ + int ret = OB_SUCCESS; + bool is_all_ready = false; + + ObArray vec_column_names; + if (index_schema.is_built_in_index()) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected index type", K(ret), K(index_schema)); + } else if (OB_FAIL(get_vector_index_column_name(table_schema, index_schema, vec_column_names))) { + LOG_WARN("fail to get vector index column name", K(ret)); + } else if (vec_column_names.count() <= 0) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected vec column count", K(ret), K(index_schema)); + } else if (OB_FAIL(check_vector_index_by_column_name(schema_guard, table_schema, vec_column_names.at(0), is_all_ready))) { + LOG_WARN("fail to check vector index by column name", K(ret), K(vec_column_names)); + } + return is_all_ready; +} + bool ObVectorIndexUtil::is_match_index_column_name( const schema::ObTableSchema &table_schema, const schema::ObTableSchema &index_schema, diff --git a/src/share/vector_index/ob_vector_index_util.h b/src/share/vector_index/ob_vector_index_util.h index 38b2d471174e30e1fb39fcb0ae3c4418f0bde487..2c28a135a3482ea7dc19a4f16a089351266e6242 100644 --- a/src/share/vector_index/ob_vector_index_util.h +++ b/src/share/vector_index/ob_vector_index_util.h @@ -748,6 +748,10 @@ public: const uint64_t tenant_id, const int64_t tablet_row_count, int64_t &estimate_memory); + static bool check_index_is_all_ready( + ObSchemaGetterGuard &schema_guard, + const schema::ObTableSchema &table_schema, + const schema::ObTableSchema &index_schema); static int alter_vec_aux_column_schema(const ObTableSchema &aux_table_schema, const ObColumnSchemaV2 &new_column_schema, ObColumnSchemaV2 &new_aux_column_schema);