Skip to content

Commit 396208b

Browse files
obdevob-robot
authored andcommitted
fix forktable cases
1 parent b5e9821 commit 396208b

File tree

2 files changed

+40
-6
lines changed

2 files changed

+40
-6
lines changed

tools/deploy/mysql_test/test_suite/fork_table/r/mysql/fork_table_basic.result

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,41 @@ id name
359359
3 Data3
360360
4 Fork_Data
361361
============================================
362+
10. Fork Table复制truncate info功能验证
363+
============================================
364+
alter system set _ob_enable_truncate_partition_preserve_global_index = true;
365+
drop table if exists t_trunc;
366+
Warnings:
367+
Note 1051 Unknown table 'db_fork_basic.t_trunc'
368+
drop table if exists t_trunc_fork;
369+
Warnings:
370+
Note 1051 Unknown table 'db_fork_basic.t_trunc_fork'
371+
create table t_trunc (
372+
id int primary key,
373+
k int,
374+
c varchar(20)
375+
) partition by range(id) (
376+
partition p0 values less than (100),
377+
partition p1 values less than (200)
378+
);
379+
create unique index idx_k on t_trunc(k) global partition by hash(k) partitions 2;
380+
insert into t_trunc values (1, 1, 'a'), (2, 2, 'b'), (120, 3, 'c');
381+
# 生成truncate info并保留索引
382+
alter table t_trunc truncate partition p0;
383+
# 截断后重新写入数据,验证旧数据不会被fork带回
384+
insert into t_trunc values (5, 5, 'p0_new'), (6, 6, 'p0_new2');
385+
# 源表校验(使用全局索引访问)
386+
select /*+index(t_trunc idx_k)*/ count(*) from t_trunc;
387+
count(*)
388+
3
389+
select /*+index(t_trunc idx_k)*/ count(*) from t_trunc where id in (1,2);
390+
count(*)
391+
0
392+
# 执行Fork并等待完成
393+
fork table t_trunc to t_trunc_fork;
394+
ERROR 0A000: fork table on partitioned table with global index is not supported
395+
# 目标表校验:应只包含新数据,截断过的数据不应出现
396+
============================================
362397
6. 清理
363398
============================================
364399
drop table if exists t1;
@@ -372,8 +407,6 @@ drop table if exists t4_fork;
372407
drop table if exists t5;
373408
drop table if exists t5_fork;
374409
drop table if exists t_trunc;
375-
Warnings:
376-
Note 1051 Unknown table 'db_fork_basic.t_trunc'
377410
drop table if exists t_trunc_fork;
378411
Warnings:
379412
Note 1051 Unknown table 'db_fork_basic.t_trunc_fork'

tools/deploy/mysql_test/test_suite/fork_table/t/fork_table_basic.test

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ select * from t5 order by id, name;
277277
insert into t5_fork(name) values ('Fork_Data');
278278
select * from t5_fork order by id, name;
279279

280-
--disable_parsing
280+
281281

282282
--echo ============================================
283283
--echo 10. Fork Table复制truncate info功能验证
@@ -313,14 +313,15 @@ select /*+index(t_trunc idx_k)*/ count(*) from t_trunc;
313313
select /*+index(t_trunc idx_k)*/ count(*) from t_trunc where id in (1,2);
314314

315315
--echo # 执行Fork并等待完成
316+
--error 1235
316317
fork table t_trunc to t_trunc_fork;
317318
--source mysql_test/test_suite/fork_table/include/wait_fork_table.inc
318319

319320
--echo # 目标表校验:应只包含新数据,截断过的数据不应出现
320-
select /*+index(t_trunc_fork idx_k)*/ count(*) from t_trunc_fork;
321-
select /*+index(t_trunc_fork idx_k)*/ count(*) from t_trunc_fork where id in (1,2);
321+
#select /*+index(t_trunc_fork idx_k)*/ count(*) from t_trunc_fork;
322+
#select /*+index(t_trunc_fork idx_k)*/ count(*) from t_trunc_fork where id in (1,2);
323+
322324

323-
--enable_parsing
324325

325326
--echo ============================================
326327
--echo 6. 清理

0 commit comments

Comments
 (0)