Debian Codegraph @

mysql-test/suite/ndb/t/ndb_restore_conv_remap_auto.test

raw
1 -- source include/have_ndb.inc
2 -- source suite/ndb/include/backup_restore_setup.inc
3
4 #
5 # Test autoincrement behaviours with remap column offset
6 #
7
8 create table t1 (a bigint auto_increment primary key,
9 d int) engine = ndb;
10 create table t2 (a int auto_increment primary key,
11 d int) engine = ndb;
12
13 insert into t1 values (400,0), (401,1), (402,2), (403,3);
14 insert into t2 values (100,0), (101,1), (102,2), (103,3);
15
16 select * from test.t1 order by a;
17 select * from test.t2 order by a;
18
19 select table_name, auto_increment
20 from information_schema.tables where table_schema='test';
21
22 --echo Run backup
23 --source include/ndb_backup.inc
24
25 --echo Restore with positive offset of 200
26 --let remap_args = -x test.t1.a:offset:200
27 --let remap_args = $remap_args -x test.t2.a:offset:200
28 truncate test.t1;
29 truncate test.t2;
30 --exec $NDB_RESTORE -b $the_backup_id -n 1 -r $remap_args $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
31 --exec $NDB_RESTORE -b $the_backup_id -n 2 -r $remap_args $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
32
33 --echo Expect that next autoincrement value
34 --echo has moved forward accordingly
35
36 insert into t1 (d) values (4);
37 insert into t2 (d) values (4);
38
39 select * from test.t1 order by a;
40 select * from test.t2 order by a;
41
42 show create table t1;
43 show create table t2;
44
45 --echo Restore with negative offset of 50
46 --let remap_args = -x test.t1.a:offset:-50
47 --let remap_args = $remap_args -x test.t2.a:offset:-50
48 truncate test.t1;
49 truncate test.t2;
50 --exec $NDB_RESTORE -b $the_backup_id -n 1 -r $remap_args $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
51 --exec $NDB_RESTORE -b $the_backup_id -n 2 -r $remap_args $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
52
53 --echo Expect that next autoincrement value has *not*
54 --echo moved back
55
56 insert into t1 (d) values (4);
57 insert into t2 (d) values (4);
58
59 select * from test.t1 order by a;
60 select * from test.t2 order by a;
61
62 show create table t1;
63 show create table t2;
64
65 --echo Restore with negative offset of 200
66 --let remap_args = -x test.t1.a:offset:-200
67 --let remap_args = $remap_args -x test.t2.a:offset:-200
68 truncate test.t1;
69 truncate test.t2;
70 --exec $NDB_RESTORE -b $the_backup_id -n 1 -r $remap_args $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
71 --exec $NDB_RESTORE -b $the_backup_id -n 2 -r $remap_args $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
72
73 --echo Expect that next autoincrement value has *not*
74 --echo moved back
75
76 insert into t1 (d) values (4);
77 insert into t2 (d) values (4);
78
79 select * from test.t1 order by a;
80 select * from test.t2 order by a;
81
82 show create table t1;
83 show create table t2;
84
85 drop table test.t1;
86 drop table test.t2;
87
88 --source suite/ndb/include/backup_restore_cleanup.inc
89 --remove_file $NDB_TOOLS_OUTPUT