github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/consistent_partition_table/data/prepare.sql (about)

     1  use `partition_table`;
     2  
     3  insert into t values (1),(2),(3),(4),(5),(6);
     4  insert into t values (7),(8),(9);
     5  update t set a=a+10 where a=2;
     6  
     7  
     8  insert into t1 values (1),(2),(3),(4),(5),(6);
     9  insert into t1 values (7),(8),(9);
    10  insert into t1 values (11),(12),(20);
    11  insert into t1 values (25),(29),(35); /*these values in p3,p4*/
    12  alter table t1 drop partition p1;
    13  insert into t1 values (7),(8),(9);
    14  update t1 set a=a+10 where a=9;
    15  
    16  /* exchange partition case 1: source table and target table in same database */
    17  ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE t2;
    18  insert into t2 values (100),(101),(102),(103),(104),(105); /*these values will be replicated to in downstream t2*/
    19  insert into t1 values (25),(29); /*these values will be replicated to in downstream t1.p3*/
    20  
    21  /* exchange partition ccase 2: source table and target table in different database */
    22  ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE partition_table2.t2;
    23  insert into partition_table2.t2 values (1002),(1012),(1022),(1032),(1042),(1052); /*these values will be replicated to in downstream t2*/
    24  insert into t1 values (21),(28); /*these values will be replicated to in downstream t1.p3*/
    25  
    26  ALTER TABLE t1 REORGANIZE PARTITION p0,p2 INTO (PARTITION p0 VALUES LESS THAN (5), PARTITION p1 VALUES LESS THAN (10), PARTITION p2 VALUES LESS THAN (21));
    27  -- insert into t1 values (-1),(6),(13);
    28  -- update t1 set a=a-22 where a=20;
    29  -- delete from t1 where a = 5;
    30  -- ALTER TABLE t1 REORGANIZE PARTITION p2,p3,p4 INTO (PARTITION p2 VALUES LESS THAN (20), PARTITION p3 VALUES LESS THAN (26), PARTITION p4 VALUES LESS THAN (35), PARTITION pMax VALUES LESS THAN (MAXVALUE));
    31  -- insert into t1 values (-3),(5),(14),(22),(30),(100);
    32  -- update t1 set a=a-16 where a=12;
    33  -- delete from t1 where a = 29;
    34  
    35  -- create table finish_mark (a int primary key);