[FTS][BUG.FIX] the aux table name for domain index may be same.
This commit is contained in:
@ -7076,67 +7076,44 @@ int ObDDLService::check_aux_index_schema_exist(
|
||||
index_table_name))) {
|
||||
LOG_WARN("failed to construct index table name", K(ret),
|
||||
K(arg.index_name_));
|
||||
} else if (share::schema::is_fts_index(index_type)) {
|
||||
/* is_fts_index means: rowkey-doc, doc-rowkey, fts, word-doc multivalue-index, fts-index all run here*/
|
||||
} else if (share::schema::is_fts_or_multivalue_index(index_type)
|
||||
|| share::schema::is_vec_index(index_type)) {
|
||||
const uint64_t database_id = data_schema->get_database_id();
|
||||
if (OB_FAIL(schema_guard.get_table_schema(tenant_id,
|
||||
data_schema->get_database_id(),
|
||||
database_id,
|
||||
index_table_name,
|
||||
true/*is_index*/,
|
||||
index_schema,
|
||||
false/*with_hidden_flag*/,
|
||||
share::schema::is_built_in_fts_index(index_type)))) {
|
||||
if (OB_TABLE_NOT_EXIST == ret) {
|
||||
is_exist = false;
|
||||
index_schema = nullptr;
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("failed to get index schema", K(ret), K(tenant_id), K(index_table_name));
|
||||
}
|
||||
} else if (OB_NOT_NULL(index_schema)) {
|
||||
is_exist = true;
|
||||
LOG_INFO("fts index aux table already exist, no need to generate",
|
||||
K(index_table_name));
|
||||
true/*is_built_in_index*/))) {
|
||||
LOG_WARN("failed to get index schema",
|
||||
K(ret), K(tenant_id), K(index_table_name));
|
||||
}
|
||||
} else if (share::schema::is_vec_index(index_type)) {
|
||||
if (OB_FAIL(schema_guard.get_table_schema(tenant_id,
|
||||
data_schema->get_database_id(),
|
||||
index_table_name,
|
||||
true/*is_index*/,
|
||||
index_schema,
|
||||
false/*with_hidden_flag*/,
|
||||
share::schema::is_built_in_vec_index(index_type)))) {
|
||||
if (OB_TABLE_NOT_EXIST == ret) {
|
||||
is_exist = false;
|
||||
index_schema = nullptr;
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("failed to get index schema", K(ret), K(tenant_id), K(index_table_name));
|
||||
|
||||
if (OB_SUCC(ret) && OB_ISNULL(index_schema)) {
|
||||
if (OB_FAIL(schema_guard.get_table_schema(tenant_id,
|
||||
database_id,
|
||||
index_table_name,
|
||||
true/*is_index*/,
|
||||
index_schema,
|
||||
false/*with_hidden_flag*/,
|
||||
false/*is_built_in_index*/))) {
|
||||
LOG_WARN("failed to get index schema",
|
||||
K(ret), K(tenant_id), K(index_table_name));
|
||||
}
|
||||
} else if (OB_NOT_NULL(index_schema)) {
|
||||
is_exist = true;
|
||||
LOG_INFO("vec index aux table already exist, no need to generate",
|
||||
K(index_table_name));
|
||||
}
|
||||
} else if (share::schema::is_multivalue_index_aux(index_type)) {
|
||||
/* only multivalue index 3rd table run here */
|
||||
if (OB_FAIL(schema_guard.get_table_schema(tenant_id,
|
||||
data_schema->get_database_id(),
|
||||
index_table_name,
|
||||
true/*is_index*/,
|
||||
index_schema,
|
||||
false/*with_hidden_flag*/,
|
||||
share::schema::is_built_in_multivalue_index(index_type)))) {
|
||||
if (OB_TABLE_NOT_EXIST == ret) {
|
||||
is_exist = false;
|
||||
index_schema = nullptr;
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("failed to get index schema", K(ret), K(tenant_id), K(index_table_name));
|
||||
}
|
||||
|
||||
if (OB_FAIL(ret)) {
|
||||
} else if (OB_NOT_NULL(index_schema)) {
|
||||
is_exist = true;
|
||||
LOG_INFO("multivalue index aux table already exist, no need to generate",
|
||||
K(index_table_name));
|
||||
if (index_schema->get_index_type() == index_type) {
|
||||
is_exist = true;
|
||||
LOG_INFO("fts index aux table already exist, no need to generate",
|
||||
K(index_table_name), K(index_schema->get_index_type()), K(index_type));
|
||||
} else {
|
||||
ret = OB_ERR_KEY_NAME_DUPLICATE;
|
||||
LOG_WARN("the index name is too special" \
|
||||
"the index name is not supported", K(ret), K(arg.index_name_));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
|
||||
@ -44,7 +44,8 @@ ObCreateTableResolver::ObCreateTableResolver(ObResolverParams ¶ms)
|
||||
cur_udt_set_id_(0),
|
||||
vec_index_col_ids_(),
|
||||
has_vec_index_(false),
|
||||
has_fts_index_(false)
|
||||
has_fts_index_(false),
|
||||
has_multivalue_index_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -2682,6 +2683,11 @@ int ObCreateTableResolver::resolve_index(
|
||||
SQL_RESV_LOG(WARN, "resolve index node failed", K(ret));
|
||||
} else { /*do nothing*/ }
|
||||
}
|
||||
if (OB_SUCC(ret) && (has_fts_index_ || has_multivalue_index_ || has_vec_index_)) {
|
||||
if (OB_FAIL(check_building_domain_index_legal())) {
|
||||
LOG_WARN("fail to check building domain index legal", K(ret));
|
||||
}
|
||||
}
|
||||
current_index_name_set_.reset();
|
||||
}
|
||||
|
||||
@ -3226,6 +3232,8 @@ int ObCreateTableResolver::resolve_index_node(const ParseNode *node)
|
||||
index_arg_list,
|
||||
allocator_))) {
|
||||
LOG_WARN("failed to append fts args", K(ret));
|
||||
} else {
|
||||
has_multivalue_index_ = true;
|
||||
}
|
||||
} else {
|
||||
if (OB_FAIL(resolve_results.push_back(resolve_result))) {
|
||||
@ -3655,5 +3663,39 @@ int ObCreateTableResolver::check_max_row_data_length(const ObTableSchema &table_
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ObCreateTableResolver::check_building_domain_index_legal()
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
if (!index_aux_name_set_.created() &&
|
||||
OB_FAIL(index_aux_name_set_.create(common::OB_MAX_COLUMN_NUMBER))) {
|
||||
LOG_WARN("fail to init index aux name set", K(ret));
|
||||
} else {
|
||||
ObCreateTableStmt *create_table_stmt = static_cast<ObCreateTableStmt*>(stmt_);
|
||||
const ObSArray<obrpc::ObCreateIndexArg> &index_arg_list = create_table_stmt->get_index_arg_list();
|
||||
for (int64_t i = 0; OB_SUCC(ret) && i < index_arg_list.count(); ++i) {
|
||||
const obrpc::ObCreateIndexArg &index_arg = index_arg_list.at(i);
|
||||
ObIndexNameHashWrapper index_name_key(index_arg.index_name_);
|
||||
if (OB_FAIL(index_aux_name_set_.exist_refactored(index_name_key))) {
|
||||
if (OB_HASH_EXIST == ret) {
|
||||
ret = OB_ERR_KEY_NAME_DUPLICATE;
|
||||
LOG_USER_ERROR(OB_ERR_KEY_NAME_DUPLICATE,
|
||||
index_arg.index_name_.length(), index_arg.index_name_.ptr());
|
||||
LOG_WARN("there is duplicate index aux name", K(ret), K(index_arg.index_name_));
|
||||
} else if (OB_HASH_NOT_EXIST == ret) {
|
||||
ret = OB_SUCCESS;
|
||||
} else {
|
||||
LOG_WARN("fail to search index aux name set", K(ret), K(index_arg.index_name_));
|
||||
}
|
||||
if (OB_SUCC(ret)) {
|
||||
if (OB_FAIL(index_aux_name_set_.set_refactored(index_name_key))) {
|
||||
LOG_WARN("fail to insert index aux name set", K(ret), K(index_arg.index_name_));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
}//end namespace sql
|
||||
}//end namespace oceanbase
|
||||
|
||||
@ -137,6 +137,7 @@ private:
|
||||
int check_max_row_data_length(const ObTableSchema &table_schema);
|
||||
int create_default_partition_for_table(ObTableSchema &table_schema);
|
||||
int set_default_micro_index_clustered_(share::schema::ObTableSchema &table_schema);
|
||||
int check_building_domain_index_legal();
|
||||
|
||||
private:
|
||||
// data members
|
||||
@ -148,7 +149,7 @@ private:
|
||||
bool is_temp_table_pk_added_;
|
||||
obrpc::ObCreateIndexArg index_arg_;
|
||||
IndexNameSet current_index_name_set_;
|
||||
|
||||
common::hash::ObHashSet<share::schema::ObIndexNameHashWrapper> index_aux_name_set_;
|
||||
common::ObSEArray<GenColExpr, 5> gen_col_exprs_;//store generated column and dependent exprs
|
||||
common::ObSEArray<ObRawExpr *, 5> constraint_exprs_;//store constraint exprs
|
||||
|
||||
@ -156,6 +157,7 @@ private:
|
||||
common::ObSEArray<uint64_t, 4> vec_index_col_ids_;
|
||||
bool has_vec_index_;
|
||||
bool has_fts_index_;
|
||||
bool has_multivalue_index_;
|
||||
};
|
||||
|
||||
} // end namespace sql
|
||||
|
||||
Reference in New Issue
Block a user