Debian Codegraph @

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

raw
1 ###################################
2 # Test intended for testing different aspects of updating
3 # PK columns during backup, and restore of these.
4 #
5 -- source have_ndb_error_insert.inc
6
7 -- source include/have_ndb.inc
8 -- source suite/ndb/include/backup_restore_setup.inc
9
10 ####################################
11 #
12 # Bug#35420131
13 # 'NDB: Restore will not update 'equal' PK values changed during backup'
14 #
15 use test;
16 create table test.t1 (
17 a varchar(20) not null,
18 b varchar(20) not null,
19 c varchar(20) not null,
20 d varchar(20),
21 primary key(a,b)
22 ) engine=ndb;
23
24 insert into test.t1 values
25 ("1a","1b","1c","1d"),
26 ("2a","2b","2c","2d"),
27 ("3a","3b","3c","3d");
28
29 --echo Stall backup completion *after* table is scanned.
30 --echo ... We will still collect log entries on table updates.
31 --exec $NDB_MGM -e "all error 10040"
32
33 --echo Run backup
34 --source suite/ndb/t/ndb_backup_nowait_start.inc
35
36 --echo Update 'a' to a 'compared as equal'-value
37 update test.t1 set a="1A" where a="1a";
38
39 --echo Create log entries with insert and delete as well
40 insert into test.t1 values("6a","6b","6c","6d");
41 delete from test.t1 where a="2a";
42
43 --echo Now allow backup to complete...
44 --exec $NDB_MGM -e "all error 0"
45 --source suite/ndb/t/ndb_backup_nowait_wait.inc
46
47 truncate t1;
48
49 --echo Run restore
50 --exec $NDB_RESTORE -b $the_backup_id -n 1 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1
51 --exec $NDB_RESTORE -b $the_backup_id -n 2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT 2>&1
52
53 --echo Restored table should show 'a=1a' updated to "1A"
54 --echo , as well as '2a' deleted and '6a' inserted .
55 select * from test.t1 order by b;
56
57 drop table test.t1;
58
59 --source suite/ndb/include/backup_restore_cleanup.inc
60 --remove_file $NDB_TOOLS_OUTPUT