@@ -119,8 +119,8 @@ Outputs & filters:
119119 force partition granule
120120 3 - output([t2_fork.id], [t2_fork.name], [t2_fork.age], [t2_fork.email]), filter(nil), rowset=16
121121 access([t2_fork.id], [t2_fork.name], [t2_fork.age], [t2_fork.email]), partitions(p[0-1])
122- is_index_back=true, is_global_index=false,
123- range_key([t2_fork.name], [t2_fork.id]), range(Alice,MIN ; Alice,MAX),
122+ is_index_back=true, is_global_index=false,
123+ range_key([t2_fork.name], [t2_fork.id]), range(Alice,MIN ; Alice,MAX),
124124 range_cond([t2_fork.name = 'Alice'])
125125explain select * from t2_fork where age = 30;
126126Query Plan
@@ -141,8 +141,8 @@ Outputs & filters:
141141 force partition granule
142142 3 - output([t2_fork.id], [t2_fork.age], [t2_fork.name], [t2_fork.email]), filter(nil), rowset=16
143143 access([t2_fork.id], [t2_fork.age], [t2_fork.name], [t2_fork.email]), partitions(p[0-1])
144- is_index_back=true, is_global_index=false,
145- range_key([t2_fork.age], [t2_fork.id]), range(30,MIN ; 30,MAX),
144+ is_index_back=true, is_global_index=false,
145+ range_key([t2_fork.age], [t2_fork.id]), range(30,MIN ; 30,MAX),
146146 range_cond([t2_fork.age = 30])
147147============================================
1481482.1 Fork Table with Index Building
@@ -249,6 +249,63 @@ t2c_fork CREATE TABLE `t2c_fork` (
249249 VECTOR KEY `idx_vec_emb` (`emb`) WITH (DISTANCE=L2, TYPE=HNSW, LIB=VSAG, M=16, EF_CONSTRUCTION=200, EF_SEARCH=64) BLOCK_SIZE 16384
250250) ORGANIZATION INDEX DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = replica_num BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE ENABLE_MACRO_BLOCK_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
251251============================================
252+ 2.4 Fork未完成时删除源表向量索引(debug sync)
253+ ============================================
254+ drop table if exists t2d;
255+ Warnings:
256+ Note 1051 Unknown table 'db_fork_index.t2d'
257+ drop table if exists t2d_fork;
258+ Warnings:
259+ Note 1051 Unknown table 'db_fork_index.t2d_fork'
260+ create table t2d (
261+ id int primary key,
262+ name varchar(50),
263+ age int,
264+ email varchar(100),
265+ emb vector(3)
266+ );
267+ insert into t2d values (1, 'Alice', 25, 'alice@example.com', '[0.203846,0.205289,0.880265]');
268+ insert into t2d values (2, 'Bob', 30, 'bob@example.com', '[0.1,0.2,0.3]');
269+ create vector index idx_vec_race on t2d(emb) with (distance=l2, type=hnsw, lib=vsag);
270+ # 获取源表table_id(用于等待fork任务阶段)
271+ # 卡在FORK_TABLE_SUCCESS:RS 侧任务已到 SUCCESS 但未执行完 cleanup(fork 仍未完成)
272+ alter system set debug_sync_timeout = '120s';
273+ set ob_global_debug_sync = 'reset';
274+ set ob_global_debug_sync = 'FORK_TABLE_SUCCESS wait_for signal_fork_success_resume execute 10000';
275+ # fork table 客户端返回后 RS 侧任务继续;此处与 lock 用例一致不使用 --send
276+ fork table t2d to t2d_fork;
277+ set ob_trx_timeout = 100000000;
278+ set ob_query_timeout = 100000000;
279+ use db_fork_index;
280+ # fork未完成:发起删除源表向量索引(与 fork cleanup 并发;历史问题:可能卡死/泄漏锁)
281+ # drop index 会等待 fork 在 SUCCESS 卡点之前仍持有的 DDL/表锁;同步执行会与 signal 死锁,故对 drop 使用 --send
282+ drop index idx_vec_race on t2d;;
283+ set ob_global_debug_sync = 'FORK_TABLE_SUCCESS clear';
284+ set ob_global_debug_sync = 'now signal signal_fork_success_resume';
285+ # 验证:源表向量索引已删除;fork表仍保留向量索引定义
286+ show create table t2d;
287+ Table Create Table
288+ t2d CREATE TABLE `t2d` (
289+ `id` int(11) NOT NULL,
290+ `name` varchar(50) DEFAULT NULL,
291+ `age` int(11) DEFAULT NULL,
292+ `email` varchar(100) DEFAULT NULL,
293+ `emb` VECTOR(3) DEFAULT NULL,
294+ PRIMARY KEY (`id`)
295+ ) ORGANIZATION INDEX DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = replica_num BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE ENABLE_MACRO_BLOCK_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
296+ show create table t2d_fork;
297+ Table Create Table
298+ t2d_fork CREATE TABLE `t2d_fork` (
299+ `id` int(11) NOT NULL,
300+ `name` varchar(50) DEFAULT NULL,
301+ `age` int(11) DEFAULT NULL,
302+ `email` varchar(100) DEFAULT NULL,
303+ `emb` VECTOR(3) DEFAULT NULL,
304+ PRIMARY KEY (`id`),
305+ VECTOR KEY `idx_vec_race` (`emb`) WITH (DISTANCE=L2, TYPE=HNSW, LIB=VSAG, M=16, EF_CONSTRUCTION=200, EF_SEARCH=64) BLOCK_SIZE 16384
306+ ) ORGANIZATION INDEX DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE ENABLE_MACRO_BLOCK_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0
307+ set ob_global_debug_sync = 'reset';
308+ ============================================
2523093. Fork Table with Unique Index
253310============================================
254311drop table if exists t3;
@@ -381,6 +438,8 @@ drop table if exists t2b;
381438drop table if exists t2b_fork;
382439drop table if exists t2c;
383440drop table if exists t2c_fork;
441+ drop table if exists t2d;
442+ drop table if exists t2d_fork;
384443drop table if exists t3;
385444drop table if exists t3_fork;
386445drop table if exists t4;
0 commit comments