diff --git a/deps/oblib/src/lib/ob_define.h b/deps/oblib/src/lib/ob_define.h
index cc23495f51..bb6658590d 100644
--- a/deps/oblib/src/lib/ob_define.h
+++ b/deps/oblib/src/lib/ob_define.h
@@ -1725,6 +1725,7 @@ const int64_t OB_OLD_MAX_VARCHAR_LENGTH = 64 * 1024; // for compatible purpose
// For compatibility we set max default value as 256K bytes/64K chars.
// Otherwise inner core tables schema would changes that hard to upgrade.
const int64_t OB_MAX_DEFAULT_VALUE_LENGTH = 256 * 1024L;
+const int64_t OB_MAX_INDEX_PARAMS_LENGTH = 256;
const int64_t OB_MAX_BINARY_LENGTH = 255;
const int64_t OB_MAX_VARBINARY_LENGTH = 64 * 1024L;
const int64_t OB_MAX_EXTENDED_TYPE_INFO_LENGTH = OB_MAX_VARBINARY_LENGTH;//TODO(yts): large object
diff --git a/deps/oblib/src/rpc/obrpc/ob_rpc_packet_list.h b/deps/oblib/src/rpc/obrpc/ob_rpc_packet_list.h
index 05e736cf1a..b815aee874 100644
--- a/deps/oblib/src/rpc/obrpc/ob_rpc_packet_list.h
+++ b/deps/oblib/src/rpc/obrpc/ob_rpc_packet_list.h
@@ -326,6 +326,7 @@ PCODE_DEF(OB_CREATE_DIRECTORY, 0x381)
PCODE_DEF(OB_DROP_DIRECTORY, 0x382)
PCODE_DEF(OB_UPDATE_MAX_USED_TENANT_ID, 0x383)
PCODE_DEF(OB_REFRESH_SCHEMA, 0x384)
+PCODE_DEF(OB_REBUILD_VEC_INDEX, 0x385)
// ob server
//PCODE_DEF(OB_MIGRATE_OVER, 0x402)
//PCODE_DEF(OB_CLEAR_REBUILD_ROOT_PARTITION, 0x403): not supported on 4.0
diff --git a/src/observer/ob_srv_xlator_rootserver.cpp b/src/observer/ob_srv_xlator_rootserver.cpp
index 027e9efef6..8a1fe117e9 100644
--- a/src/observer/ob_srv_xlator_rootserver.cpp
+++ b/src/observer/ob_srv_xlator_rootserver.cpp
@@ -165,6 +165,7 @@ void oceanbase::observer::init_srv_xlator_for_rootserver(ObSrvRpcXlator *xlator)
RPC_PROCESSOR(rootserver::ObRpcTryAddDepInfosForSynonymBatchP, *gctx_.root_service_);
RPC_PROCESSOR(rootserver::ObRpcMViewCompleteRefreshP, *gctx_.root_service_);
RPC_PROCESSOR(rootserver::ObRpcUpdateMViewTableStatusP, *gctx_.root_service_);
+ RPC_PROCESSOR(rootserver::ObRpcRebuildVecIndexP, *gctx_.root_service_);
//ob_admin
RPC_PROCESSOR(rootserver::ObForceCreateSysTableP, *gctx_.root_service_);
RPC_PROCESSOR(rootserver::ObForceSetLocalityP, *gctx_.root_service_);
diff --git a/src/rootserver/ob_root_service.cpp b/src/rootserver/ob_root_service.cpp
index 6c0aeb0cae..78ef4739a0 100755
--- a/src/rootserver/ob_root_service.cpp
+++ b/src/rootserver/ob_root_service.cpp
@@ -4996,6 +4996,14 @@ int ObRootService::drop_index(const obrpc::ObDropIndexArg &arg, obrpc::ObDropInd
return ret;
}
+int ObRootService::rebuild_vec_index(const obrpc::ObRebuildIndexArg &arg, obrpc::ObAlterTableRes &res)
+{
+ int ret = OB_NOT_SUPPORTED;
+ UNUSED(arg);
+ UNUSED(res);
+ return ret;
+}
+
int ObRootService::rebuild_index(const obrpc::ObRebuildIndexArg &arg, obrpc::ObAlterTableRes &res)
{
int ret = OB_SUCCESS;
diff --git a/src/rootserver/ob_root_service.h b/src/rootserver/ob_root_service.h
index b15305f61a..5586f98517 100644
--- a/src/rootserver/ob_root_service.h
+++ b/src/rootserver/ob_root_service.h
@@ -529,6 +529,7 @@ public:
int drop_index(const obrpc::ObDropIndexArg &arg, obrpc::ObDropIndexRes &res);
int create_mlog(const obrpc::ObCreateMLogArg &arg, obrpc::ObCreateMLogRes &res);
int rebuild_index(const obrpc::ObRebuildIndexArg &arg, obrpc::ObAlterTableRes &res);
+ int rebuild_vec_index(const obrpc::ObRebuildIndexArg &arg, obrpc::ObAlterTableRes &res);
int clone_tenant(const obrpc::ObCloneTenantArg &arg, obrpc::ObCloneTenantRes &res);
//the interface only for switchover: execute skip check enable_ddl
int flashback_index(const obrpc::ObFlashBackIndexArg &arg);
diff --git a/src/rootserver/ob_rs_rpc_processor.h b/src/rootserver/ob_rs_rpc_processor.h
index af9354b988..1ad5a48caa 100644
--- a/src/rootserver/ob_rs_rpc_processor.h
+++ b/src/rootserver/ob_rs_rpc_processor.h
@@ -346,6 +346,7 @@ DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_TRUNCATE_TABLE_V2, ObRpcTruncateTableV2P,
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_GENERATE_AUX_INDEX_SCHEMA, ObRpcGenerateAuxIndexSchemaP, generate_aux_index_schema(arg_, result_));
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_CREATE_INDEX, ObRpcCreateIndexP, create_index(arg_, result_));
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_DROP_INDEX, ObRpcDropIndexP, drop_index(arg_, result_));
+DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_REBUILD_VEC_INDEX, ObRpcRebuildVecIndexP, rebuild_vec_index(arg_, result_));
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_CREATE_MLOG, ObRpcCreateMLogP, create_mlog(arg_, result_));
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_CREATE_TABLE_LIKE, ObRpcCreateTableLikeP, create_table_like(arg_));
DEFINE_DDL_RS_RPC_PROCESSOR(obrpc::OB_CREATE_USER, ObRpcCreateUserP, create_user(arg_, result_));
diff --git a/src/share/inner_table/ob_inner_table_schema.101_150.cpp b/src/share/inner_table/ob_inner_table_schema.101_150.cpp
index 48b0b955a5..a83d3dfb29 100644
--- a/src/share/inner_table/ob_inner_table_schema.101_150.cpp
+++ b/src/share/inner_table/ob_inner_table_schema.101_150.cpp
@@ -6935,6 +6935,25 @@ int ObInnerTableSchema::all_table_history_schema(ObTableSchema &table_schema)
true, //is_nullable
false); //is_autoincrement
}
+
+ if (OB_SUCC(ret)) {
+ ObObj index_params_default;
+ index_params_default.set_varchar(ObString::make_string(""));
+ ADD_COLUMN_SCHEMA_T("index_params", //column_name
+ ++column_id, //column_id
+ 0, //rowkey_id
+ 0, //index_id
+ 0, //part_key_pos
+ ObVarcharType, //column_type
+ CS_TYPE_INVALID, //column_collation_type
+ OB_MAX_INDEX_PARAMS_LENGTH, //column_length
+ -1, //column_precision
+ -1, //column_scale
+ true, //is_nullable
+ false, //is_autoincrement
+ index_params_default,
+ index_params_default); //default_value
+ }
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
diff --git a/src/share/inner_table/ob_inner_table_schema.11001_11050.cpp b/src/share/inner_table/ob_inner_table_schema.11001_11050.cpp
index d367f92c8d..2e42b4613d 100644
--- a/src/share/inner_table/ob_inner_table_schema.11001_11050.cpp
+++ b/src/share/inner_table/ob_inner_table_schema.11001_11050.cpp
@@ -14570,6 +14570,25 @@ int ObInnerTableSchema::all_virtual_core_all_table_schema(ObTableSchema &table_s
true, //is_nullable
false); //is_autoincrement
}
+
+ if (OB_SUCC(ret)) {
+ ObObj index_params_default;
+ index_params_default.set_varchar(ObString::make_string(""));
+ ADD_COLUMN_SCHEMA_T("index_params", //column_name
+ ++column_id, //column_id
+ 0, //rowkey_id
+ 0, //index_id
+ 0, //part_key_pos
+ ObVarcharType, //column_type
+ CS_TYPE_INVALID, //column_collation_type
+ OB_MAX_INDEX_PARAMS_LENGTH, //column_length
+ -1, //column_precision
+ -1, //column_scale
+ false, //is_nullable
+ false, //is_autoincrement
+ index_params_default,
+ index_params_default); //default_value
+ }
table_schema.set_index_using_type(USING_HASH);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
diff --git a/src/share/inner_table/ob_inner_table_schema.12051_12100.cpp b/src/share/inner_table/ob_inner_table_schema.12051_12100.cpp
index 436d81426c..c0defe55be 100644
--- a/src/share/inner_table/ob_inner_table_schema.12051_12100.cpp
+++ b/src/share/inner_table/ob_inner_table_schema.12051_12100.cpp
@@ -6845,6 +6845,25 @@ int ObInnerTableSchema::all_virtual_table_schema(ObTableSchema &table_schema)
true, //is_nullable
false); //is_autoincrement
}
+
+ if (OB_SUCC(ret)) {
+ ObObj index_params_default;
+ index_params_default.set_varchar(ObString::make_string(""));
+ ADD_COLUMN_SCHEMA_T("index_params", //column_name
+ ++column_id, //column_id
+ 0, //rowkey_id
+ 0, //index_id
+ 0, //part_key_pos
+ ObVarcharType, //column_type
+ CS_TYPE_INVALID, //column_collation_type
+ OB_MAX_INDEX_PARAMS_LENGTH, //column_length
+ -1, //column_precision
+ -1, //column_scale
+ false, //is_nullable
+ false, //is_autoincrement
+ index_params_default,
+ index_params_default); //default_value
+ }
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
@@ -8375,6 +8394,25 @@ int ObInnerTableSchema::all_virtual_table_history_schema(ObTableSchema &table_sc
true, //is_nullable
false); //is_autoincrement
}
+
+ if (OB_SUCC(ret)) {
+ ObObj index_params_default;
+ index_params_default.set_varchar(ObString::make_string(""));
+ ADD_COLUMN_SCHEMA_T("index_params", //column_name
+ ++column_id, //column_id
+ 0, //rowkey_id
+ 0, //index_id
+ 0, //part_key_pos
+ ObVarcharType, //column_type
+ CS_TYPE_INVALID, //column_collation_type
+ OB_MAX_INDEX_PARAMS_LENGTH, //column_length
+ -1, //column_precision
+ -1, //column_scale
+ true, //is_nullable
+ false, //is_autoincrement
+ index_params_default,
+ index_params_default); //default_value
+ }
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
diff --git a/src/share/inner_table/ob_inner_table_schema.15101_15150.cpp b/src/share/inner_table/ob_inner_table_schema.15101_15150.cpp
index 49fe12e76b..1035fe35b6 100644
--- a/src/share/inner_table/ob_inner_table_schema.15101_15150.cpp
+++ b/src/share/inner_table/ob_inner_table_schema.15101_15150.cpp
@@ -6721,6 +6721,21 @@ int ObInnerTableSchema::all_virtual_table_real_agent_ora_schema(ObTableSchema &t
false); //is_autoincrement
}
+ if (OB_SUCC(ret)) {
+ ADD_COLUMN_SCHEMA("INDEX_PARAMS", //column_name
+ ++column_id, //column_id
+ 0, //rowkey_id
+ 0, //index_id
+ 0, //part_key_pos
+ ObVarcharType, //column_type
+ CS_TYPE_UTF8MB4_BIN, //column_collation_type
+ OB_MAX_INDEX_PARAMS_LENGTH, //column_length
+ 2, //column_precision
+ -1, //column_scale
+ true, //is_nullable
+ false); //is_autoincrement
+ }
+
if (OB_SUCC(ret)) {
ADD_COLUMN_SCHEMA("GMT_CREATE", //column_name
++column_id, //column_id
diff --git a/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp b/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp
index f7a6609995..d8e97822fc 100644
--- a/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp
+++ b/src/share/inner_table/ob_inner_table_schema.15201_15250.cpp
@@ -6526,6 +6526,21 @@ int ObInnerTableSchema::all_virtual_core_all_table_ora_schema(ObTableSchema &tab
true, //is_nullable
false); //is_autoincrement
}
+
+ if (OB_SUCC(ret)) {
+ ADD_COLUMN_SCHEMA("INDEX_PARAMS", //column_name
+ ++column_id, //column_id
+ 0, //rowkey_id
+ 0, //index_id
+ 0, //part_key_pos
+ ObVarcharType, //column_type
+ CS_TYPE_UTF8MB4_BIN, //column_collation_type
+ OB_MAX_INDEX_PARAMS_LENGTH, //column_length
+ 2, //column_precision
+ -1, //column_scale
+ true, //is_nullable
+ false); //is_autoincrement
+ }
table_schema.set_index_using_type(USING_HASH);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
diff --git a/src/share/inner_table/ob_inner_table_schema.1_50.cpp b/src/share/inner_table/ob_inner_table_schema.1_50.cpp
index 2a007eb9c5..a2c6db2c22 100644
--- a/src/share/inner_table/ob_inner_table_schema.1_50.cpp
+++ b/src/share/inner_table/ob_inner_table_schema.1_50.cpp
@@ -1693,6 +1693,25 @@ int ObInnerTableSchema::all_table_schema(ObTableSchema &table_schema)
true, //is_nullable
false); //is_autoincrement
}
+
+ if (OB_SUCC(ret)) {
+ ObObj index_params_default;
+ index_params_default.set_varchar(ObString::make_string(""));
+ ADD_COLUMN_SCHEMA_T("index_params", //column_name
+ ++column_id, //column_id
+ 0, //rowkey_id
+ 0, //index_id
+ 0, //part_key_pos
+ ObVarcharType, //column_type
+ CS_TYPE_INVALID, //column_collation_type
+ OB_MAX_INDEX_PARAMS_LENGTH, //column_length
+ -1, //column_precision
+ -1, //column_scale
+ false, //is_nullable
+ false, //is_autoincrement
+ index_params_default,
+ index_params_default); //default_value
+ }
table_schema.set_index_using_type(USING_BTREE);
table_schema.set_row_store_type(ENCODING_ROW_STORE);
table_schema.set_store_format(OB_STORE_FORMAT_DYNAMIC_MYSQL);
diff --git a/src/share/inner_table/ob_inner_table_schema_def.py b/src/share/inner_table/ob_inner_table_schema_def.py
index e87cd61498..3dd7085c53 100644
--- a/src/share/inner_table/ob_inner_table_schema_def.py
+++ b/src/share/inner_table/ob_inner_table_schema_def.py
@@ -315,7 +315,8 @@ all_table_def = dict(
('auto_increment_cache_size', 'int', 'false', '0'),
('local_session_vars', 'longtext', 'true'),
('duplicate_read_consistency', 'int', 'false', '0'),
- ('external_properties', 'varbinary:OB_MAX_VARCHAR_LENGTH', 'true')
+ ('external_properties', 'varbinary:OB_MAX_VARCHAR_LENGTH', 'true'),
+ ('index_params', 'varchar:OB_MAX_INDEX_PARAMS_LENGTH', 'false', '')
],
)
diff --git a/src/share/ob_common_rpc_proxy.h b/src/share/ob_common_rpc_proxy.h
index 3891de0367..a5c598a0b3 100644
--- a/src/share/ob_common_rpc_proxy.h
+++ b/src/share/ob_common_rpc_proxy.h
@@ -79,6 +79,7 @@ public:
RPC_S(PRD generate_aux_index_schema, obrpc::OB_GENERATE_AUX_INDEX_SCHEMA, (obrpc::ObGenerateAuxIndexSchemaArg), obrpc::ObGenerateAuxIndexSchemaRes);
RPC_S(PRD create_index, obrpc::OB_CREATE_INDEX, (ObCreateIndexArg), ObAlterTableRes);
RPC_S(PRD drop_index, obrpc::OB_DROP_INDEX, (ObDropIndexArg), ObDropIndexRes);
+ RPC_S(PRD rebuild_vec_index, obrpc::OB_REBUILD_VEC_INDEX, (ObRebuildIndexArg), ObAlterTableRes);
RPC_S(PRD create_mlog, obrpc::OB_CREATE_MLOG, (ObCreateMLogArg), ObCreateMLogRes);
RPC_S(PRD flashback_index, obrpc::OB_FLASHBACK_INDEX, (ObFlashBackIndexArg));
RPC_S(PRD purge_index, obrpc::OB_PURGE_INDEX, (ObPurgeIndexArg));
diff --git a/src/share/ob_ddl_common.h b/src/share/ob_ddl_common.h
index 74a0771b40..d5c01315cd 100644
--- a/src/share/ob_ddl_common.h
+++ b/src/share/ob_ddl_common.h
@@ -69,6 +69,7 @@ enum ObDDLType
DDL_DROP_VEC_INDEX = 14,
DDL_CREATE_VEC_INDEX = 15,
DDL_CREATE_MULTIVALUE_INDEX = 16,
+ DDL_REBUILD_INDEX = 17,
///< @note tablet split.
DDL_AUTO_SPLIT_BY_RANGE = 100,
@@ -178,6 +179,8 @@ enum ObDDLTaskStatus {
WAIT_VEC_AUX_TABLE_COMPLEMENT = 32,
GENERATE_VID_ROWKEY_SCHEMA = 33,
WAIT_VID_ROWKEY_TABLE_COMPLEMENT = 34,
+ REBUILD_SCHEMA = 35,
+ SWITCH_INDEX_NAME = 36,
FAIL = 99,
SUCCESS = 100
};
@@ -315,6 +318,12 @@ static const char* ddl_task_status_to_str(const ObDDLTaskStatus &task_status) {
case ObDDLTaskStatus::WAIT_VID_ROWKEY_TABLE_COMPLEMENT:
str = "WAIT_VID_ROWKEY_TABLE_COMPLEMENT";
break;
+ case ObDDLTaskStatus::REBUILD_SCHEMA:
+ str = "REBUILD_SCHEMA";
+ break;
+ case ObDDLTaskStatus::SWITCH_INDEX_NAME:
+ str = "SWITCH_INDEX_NAME";
+ break;
case ObDDLTaskStatus::FAIL:
str = "FAIL";
break;
diff --git a/src/share/ob_ddl_sim_point_define.h b/src/share/ob_ddl_sim_point_define.h
index 423b25d977..3c64d1dcdf 100644
--- a/src/share/ob_ddl_sim_point_define.h
+++ b/src/share/ob_ddl_sim_point_define.h
@@ -158,4 +158,5 @@ DDL_SIM_POINT_DEFINE(SIM_TYPE_DDL, DDL_REDO_WRITER_WRITE_COMMIT_LOG_FAILED, 128,
DDL_SIM_POINT_DEFINE(SIM_TYPE_DDL, DDL_INSERT_SSTABLE_GET_NEXT_ROW_FAILED, 129, "ddl insert sstable get next row failed", RET_ERR(OB_REPLICA_NOT_READABLE, OB_ERR_INSUFFICIENT_PX_WORKER, OB_TABLE_NOT_EXIST))
DDL_SIM_POINT_DEFINE(SIM_TYPE_DDL, COMPLEMENT_DATA_TASK_SPLIT_RANGE_FAILED, 130, "complement data task split range failed", RET_ERR(OB_EAGAIN))
DDL_SIM_POINT_DEFINE(SIM_TYPE_DDL, COMPLEMENT_DATA_TASK_LOCAL_SCAN_FAILED, 131, "complement data task local scan failed", RET_ERR(OB_EAGAIN))
+DDL_SIM_POINT_DEFINE(SIM_TYPE_DDL, DDL_TASK_SWITCH_INDEX_NAME_FAILED, 132, "ddl task switch index name failed", N_RET_ERR(5, OB_EAGAIN))
#endif
diff --git a/src/share/ob_rpc_struct.cpp b/src/share/ob_rpc_struct.cpp
index 781d65263b..63ec7248ee 100644
--- a/src/share/ob_rpc_struct.cpp
+++ b/src/share/ob_rpc_struct.cpp
@@ -3267,7 +3267,8 @@ DEF_TO_STRING(ObCreateIndexArg)
K_(inner_sql_exec_addr),
K_(local_session_var),
K_(exist_all_column_group),
- K_(index_cgs));
+ K_(index_cgs),
+ K_(is_rebuild_index));
J_OBJ_END();
return pos;
}
@@ -3293,7 +3294,9 @@ OB_SERIALIZE_MEMBER((ObCreateIndexArg, ObIndexArg),
inner_sql_exec_addr_,
local_session_var_,
exist_all_column_group_,
- index_cgs_);
+ index_cgs_,
+ vidx_refresh_info_,
+ is_rebuild_index_);
int ObGenerateAuxIndexSchemaArg::assign(const ObGenerateAuxIndexSchemaArg &other)
{
@@ -3348,7 +3351,8 @@ DEF_TO_STRING(ObDropIndexArg) {
K_(is_add_to_scheduler),
K_(is_in_recyclebin),
K_(is_hidden),
- K_(is_inner));
+ K_(is_inner),
+ K_(is_rebuild_drop));
J_OBJ_END();
return pos;
}
@@ -3362,7 +3366,8 @@ OB_SERIALIZE_MEMBER((ObDropIndexArg, ObIndexArg),
is_add_to_scheduler_,
is_in_recyclebin_,
is_hidden_,
- is_inner_);
+ is_inner_,
+ is_rebuild_drop_);
OB_SERIALIZE_MEMBER(ObDropIndexRes, tenant_id_, index_table_id_, schema_version_, task_id_);
diff --git a/src/share/ob_rpc_struct.h b/src/share/ob_rpc_struct.h
index 6f7a2370fb..bc605efaea 100644
--- a/src/share/ob_rpc_struct.h
+++ b/src/share/ob_rpc_struct.h
@@ -1389,6 +1389,7 @@ public:
is_hidden_ = false;
is_in_recyclebin_ = false;
is_inner_ = false;
+ is_rebuild_drop_ = false;
}
virtual ~ObDropIndexArg() {}
void reset()
@@ -1399,6 +1400,7 @@ public:
is_hidden_ = false;
is_in_recyclebin_ = false;
is_inner_ = false;
+ is_rebuild_drop_ = false;
}
bool is_valid() const { return ObIndexArg::is_valid(); }
uint64_t index_table_id_;
@@ -1406,6 +1408,7 @@ public:
bool is_hidden_;
bool is_in_recyclebin_;
bool is_inner_;
+ bool is_rebuild_drop_;
DECLARE_VIRTUAL_TO_STRING;
};
@@ -2629,7 +2632,9 @@ public:
allocator_(),
local_session_var_(&allocator_),
exist_all_column_group_(false),
- index_cgs_()
+ index_cgs_(),
+ vidx_refresh_info_(),
+ is_rebuild_index_(false)
{
index_action_type_ = ADD_INDEX;
index_using_type_ = share::schema::USING_BTREE;
@@ -2661,6 +2666,8 @@ public:
allocator_.reset();
exist_all_column_group_ = false;
index_cgs_.reset();
+ vidx_refresh_info_.reset();
+ is_rebuild_index_ = false;
}
void set_index_action_type(const IndexActionType type) { index_action_type_ = type; }
bool is_valid() const;
@@ -2698,6 +2705,8 @@ public:
inner_sql_exec_addr_ = other.inner_sql_exec_addr_;
consumer_group_id_ = other.consumer_group_id_;
exist_all_column_group_ = other.exist_all_column_group_;
+ vidx_refresh_info_ = other.vidx_refresh_info_;
+ is_rebuild_index_ = other.is_rebuild_index_;
}
return ret;
}
@@ -2765,6 +2774,8 @@ public:
ObLocalSessionVar local_session_var_;
bool exist_all_column_group_;
common::ObSEArray index_cgs_;
+ share::schema::ObVectorIndexRefreshInfo vidx_refresh_info_;
+ bool is_rebuild_index_;
};
struct ObGenerateAuxIndexSchemaArg : public ObDDLArg
diff --git a/src/share/schema/ob_schema_struct.cpp b/src/share/schema/ob_schema_struct.cpp
index 58ccc28aa3..f74da18a69 100644
--- a/src/share/schema/ob_schema_struct.cpp
+++ b/src/share/schema/ob_schema_struct.cpp
@@ -8025,6 +8025,9 @@ int ObPartitionUtils::check_interval_partition_table(
return ret;
}
+OB_SERIALIZE_MEMBER(ObVectorIndexRefreshInfo,
+ exec_env_);
+
OB_SERIALIZE_MEMBER(ObMVRefreshInfo,
refresh_method_,
refresh_mode_,
diff --git a/src/share/schema/ob_schema_struct.h b/src/share/schema/ob_schema_struct.h
index 84a1dfd7fc..d9cc7b028a 100755
--- a/src/share/schema/ob_schema_struct.h
+++ b/src/share/schema/ob_schema_struct.h
@@ -130,6 +130,8 @@ static const uint64_t OB_MIN_ID = 0;//used for lower_bound
#define MULTIVALUE_INDEX_GENERATED_COLUMN_FLAG (INT64_C(1) << 23) // for multivalue index
#define MULTIVALUE_INDEX_GENERATED_ARRAY_COLUMN_FLAG (INT64_C(1) << 24) // for multivalue index
#define GENERATED_FTS_WORD_SEGMENT_COLUMN_FLAG (INT64_C(1) << 25) // word segment column for full-text search flag
+#define GENERATED_VEC_VID_COLUMN_FLAG (INT64_C(1) << 26)
+#define GENERATED_VEC_VECTOR_COLUMN_FLAG (INT64_C(1) << 27)
//the high 32-bit flag isn't stored in __all_column
#define GENERATED_DEPS_CASCADE_FLAG (INT64_C(1) << 32)
@@ -141,6 +143,11 @@ static const uint64_t OB_MIN_ID = 0;//used for lower_bound
#define TABLE_PART_KEY_COLUMN_ORG_FLAG (INT64_C(1) << 37) //column is part key, or column is depened by part key(gc col)
#define SPATIAL_INDEX_GENERATED_COLUMN_FLAG (INT64_C(1) << 38) // for spatial index
#define GENERATED_FTS_DOC_LENGTH_COLUMN_FLAG (INT64_C(1) << 39) // doc length column for full-text search index
+/* vector index hidden column */
+#define GENERATED_VEC_TYPE_COLUMN_FLAG (INT64_C(1) << 40)
+#define GENERATED_VEC_SCN_COLUMN_FLAG (INT64_C(1) << 41)
+#define GENERATED_VEC_KEY_COLUMN_FLAG (INT64_C(1) << 42)
+#define GENERATED_VEC_DATA_COLUMN_FLAG (INT64_C(1) << 43)
#define SPATIAL_COLUMN_SRID_MASK (0xffffffffffffffe0L)
#define STORED_COLUMN_FLAGS_MASK 0xFFFFFFFF
@@ -3484,6 +3491,23 @@ enum class ObMVRefreshStatsCollectionLevel : int64_t
MAX
};
+struct ObVectorIndexRefreshInfo
+{
+ OB_UNIS_VERSION(1);
+public:
+ ObString exec_env_;
+ // TODO:(@wangmiao) more infos for complete refresh (aka. rebuild)
+ ObVectorIndexRefreshInfo():
+ exec_env_() {}
+ void reset() {
+ exec_env_.reset();
+ }
+ bool operator == (const ObVectorIndexRefreshInfo &other) const {
+ return exec_env_ == other.exec_env_;
+ }
+ TO_STRING_KV(K_(exec_env));
+};
+
struct ObMVRefreshInfo
{
OB_UNIS_VERSION(1);
diff --git a/src/share/schema/ob_table_schema.cpp b/src/share/schema/ob_table_schema.cpp
index cea62ad394..9c864bf911 100644
--- a/src/share/schema/ob_table_schema.cpp
+++ b/src/share/schema/ob_table_schema.cpp
@@ -1475,7 +1475,8 @@ ObTableSchema::ObTableSchema(ObIAllocator *allocator)
rls_context_ids_(SCHEMA_SMALL_MALLOC_BLOCK_SIZE, ModulePageAllocator(*allocator)),
name_generated_type_(GENERATED_TYPE_UNKNOWN),
lob_inrow_threshold_(OB_DEFAULT_LOB_INROW_THRESHOLD),
- local_session_vars_(allocator)
+ local_session_vars_(allocator),
+ index_params_()
{
reset();
}
@@ -1720,6 +1721,10 @@ int ObTableSchema::assign(const ObTableSchema &src_schema)
LOG_WARN("deep copy kv attributes failed", K(ret));
}
+ if (OB_SUCC(ret) && OB_FAIL(deep_copy_str(src_schema.index_params_, index_params_))) {
+ LOG_WARN("deep copy vector index param failed", K(ret));
+ }
+
if (OB_FAIL(ret)) {
LOG_WARN("failed to assign table schema", K(ret));
}
@@ -3393,6 +3398,7 @@ int64_t ObTableSchema::get_convert_size() const
convert_size += external_file_pattern_.length() + 1;
convert_size += ttl_definition_.length() + 1;
convert_size += kv_attributes_.length() + 1;
+ convert_size += index_params_.length() + 1;
convert_size += get_hash_array_mem_size(column_group_cnt_);
convert_size += get_hash_array_mem_size(column_group_cnt_);
@@ -3486,6 +3492,7 @@ void ObTableSchema::reset()
external_properties_.reset();
ttl_definition_.reset();
kv_attributes_.reset();
+ index_params_.reset();
name_generated_type_ = GENERATED_TYPE_UNKNOWN;
lob_inrow_threshold_ = OB_DEFAULT_LOB_INROW_THRESHOLD;
auto_increment_cache_size_ = 0;
@@ -6553,7 +6560,8 @@ int64_t ObTableSchema::to_string(char *buf, const int64_t buf_len) const
"column_group_array", ObArrayWrap(column_group_arr_, column_group_cnt_),
K_(mlog_tid),
K_(auto_increment_cache_size),
- K_(local_session_vars));
+ K_(local_session_vars),
+ K_(index_params));
J_OBJ_END();
return pos;
@@ -6840,6 +6848,9 @@ OB_DEF_SERIALIZE(ObTableSchema)
LST_DO_CODE(OB_UNIS_ENCODE,
external_properties_);
}
+ if (OB_SUCC(ret)) {
+ OB_UNIS_ENCODE(index_params_);
+ }
return ret;
}
@@ -7000,6 +7011,7 @@ OB_DEF_DESERIALIZE(ObTableSchema)
ObString expire_info;
ObString ttl_definition;
ObString kv_attributes;
+ ObString index_params;
LST_DO_CODE(OB_UNIS_DECODE,
tenant_id_,
@@ -7275,6 +7287,13 @@ OB_DEF_DESERIALIZE(ObTableSchema)
LST_DO_CODE(OB_UNIS_DECODE,
external_properties_);
}
+
+ if (OB_SUCC(ret)) {
+ OB_UNIS_DECODE(index_params);
+ if (OB_SUCC(ret) && OB_FAIL(deep_copy_str(index_params, index_params_))) {
+ LOG_WARN("deep_copy_str failed", K(ret), K(index_params));
+ }
+ }
return ret;
}
@@ -7428,6 +7447,7 @@ OB_DEF_SERIALIZE_SIZE(ObTableSchema)
OB_UNIS_ADD_LEN(local_session_vars_);
OB_UNIS_ADD_LEN(duplicate_read_consistency_);
OB_UNIS_ADD_LEN(external_properties_);
+ OB_UNIS_ADD_LEN(index_params_);
return len;
}
diff --git a/src/share/schema/ob_table_schema.h b/src/share/schema/ob_table_schema.h
index 230f7063d1..8f908adede 100644
--- a/src/share/schema/ob_table_schema.h
+++ b/src/share/schema/ob_table_schema.h
@@ -1287,6 +1287,7 @@ public:
void clear_constraint();
int set_ttl_definition(const common::ObString &ttl_definition) { return deep_copy_str(ttl_definition, ttl_definition_); }
int set_kv_attributes(const common::ObString &kv_attributes) { return deep_copy_str(kv_attributes, kv_attributes_); }
+ int set_index_params(const common::ObString &index_params) { return deep_copy_str(index_params, index_params_); }
void set_lob_inrow_threshold(const int64_t lob_inrow_threshold) { lob_inrow_threshold_ = lob_inrow_threshold;}
inline void set_auto_increment_cache_size(const int64_t auto_increment_cache_size)
{ auto_increment_cache_size_ = auto_increment_cache_size; }
@@ -1379,6 +1380,7 @@ public:
inline const ObViewSchema &get_view_schema() const { return view_schema_; }
inline const common::ObString &get_ttl_definition() const { return ttl_definition_; }
inline const common::ObString &get_kv_attributes() const { return kv_attributes_; }
+ inline const common::ObString &get_index_params() const { return index_params_; }
inline int64_t get_lob_inrow_threshold() const { return lob_inrow_threshold_; }
inline int64_t get_auto_increment_cache_size() const { return auto_increment_cache_size_; }
bool has_check_constraint() const;
@@ -1999,6 +2001,8 @@ protected:
CgNameHashArray *cg_name_hash_arr_;
uint64_t mlog_tid_;
ObLocalSessionVar local_session_vars_;
+ // vector index
+ common::ObString index_params_;
};
class ObPrintableTableSchema final : public ObTableSchema
diff --git a/src/sql/resolver/ddl/ob_ddl_resolver.cpp b/src/sql/resolver/ddl/ob_ddl_resolver.cpp
index c74473a94b..366b7514fe 100644
--- a/src/sql/resolver/ddl/ob_ddl_resolver.cpp
+++ b/src/sql/resolver/ddl/ob_ddl_resolver.cpp
@@ -120,7 +120,8 @@ ObDDLResolver::ObDDLResolver(ObResolverParams ¶ms)
lob_inrow_threshold_(OB_DEFAULT_LOB_INROW_THRESHOLD),
auto_increment_cache_size_(0),
external_table_format_type_(ObExternalFileFormat::INVALID_FORMAT),
- mocked_external_table_column_ids_()
+ mocked_external_table_column_ids_(),
+ index_params_()
{
table_mode_.reset();
}
diff --git a/src/sql/resolver/ddl/ob_ddl_resolver.h b/src/sql/resolver/ddl/ob_ddl_resolver.h
index 4998299c05..13861f8db6 100644
--- a/src/sql/resolver/ddl/ob_ddl_resolver.h
+++ b/src/sql/resolver/ddl/ob_ddl_resolver.h
@@ -1036,6 +1036,7 @@ protected:
int64_t auto_increment_cache_size_;
ObExternalFileFormat::FormatType external_table_format_type_;
common::ObBitSet<> mocked_external_table_column_ids_;
+ common::ObString index_params_;
private:
template
DISALLOW_COPY_AND_ASSIGN(ObDDLResolver);
diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result
index af8aade42d..286690729a 100644
--- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result
+++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_mysql.result
@@ -885,6 +885,7 @@ auto_increment_cache_size bigint(20) NO 0
local_session_vars longtext YES NULL
duplicate_read_consistency bigint(20) NO 0
external_properties varbinary(1048576) YES NULL
+index_params varchar(256) NO
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_core_all_table;
IF(count(*) >= 0, 1, 0)
1
@@ -1813,6 +1814,7 @@ auto_increment_cache_size bigint(20) NO 0
local_session_vars longtext YES NULL
duplicate_read_consistency bigint(20) NO 0
external_properties varbinary(1048576) YES NULL
+index_params varchar(256) NO
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_table;
IF(count(*) >= 0, 1, 0)
1
diff --git a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result
index 5c1b07fce2..2ea818a9d0 100644
--- a/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result
+++ b/tools/deploy/mysql_test/test_suite/inner_table/r/mysql/desc_virtual_table_in_sys.result
@@ -958,6 +958,7 @@ auto_increment_cache_size bigint(20) NO 0
local_session_vars longtext YES NULL
duplicate_read_consistency bigint(20) NO 0
external_properties varbinary(1048576) YES NULL
+index_params varchar(256) NO
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_core_all_table;
IF(count(*) >= 0, 1, 0)
1
@@ -2705,6 +2706,7 @@ auto_increment_cache_size bigint(20) NO 0
local_session_vars longtext YES NULL
duplicate_read_consistency bigint(20) NO 0
external_properties varbinary(1048576) YES NULL
+index_params varchar(256) NO
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_table;
IF(count(*) >= 0, 1, 0)
1
@@ -2798,6 +2800,7 @@ auto_increment_cache_size bigint(20) YES 0
local_session_vars longtext YES NULL
duplicate_read_consistency bigint(20) YES 0
external_properties varbinary(1048576) YES NULL
+index_params varchar(256) YES
select /*+QUERY_TIMEOUT(60000000)*/ IF(count(*) >= 0, 1, 0) from oceanbase.__all_virtual_table_history;
IF(count(*) >= 0, 1, 0)
1