Debian Codegraph @

mysql-test/suite/ndb/r/ndb_restore_apply_status.result

raw
1 CREATE TABLE t1 (
2 id INT,
3 col INT
4 ) ENGINE=ndbcluster;
5 INSERT INTO test.t1 VALUES
6 (7,7),(8,8),(6,6),(1,1),(4,4),(5,5),(8,8),(2,2),(9,9),(6,6),(3,3),(7,7),
7 (1,1),(4,4),(6,6),(8,8),(1,1),(5,5),(3,3),(1,1),(4,4),(9,9),(3,3),(5,5);
8 INSERT INTO mysql.ndb_apply_status VALUES
9 (1,12,_binary 'logname',123,1234), (2,12,_binary 'logname',123,1234),
10 (3,12,_binary 'logname',123,1234), (4,12,_binary 'logname',123,1234),
11 (5,12,_binary 'logname',123,1234), (6,12,_binary 'logname',123,1234),
12 (7,12,_binary 'logname',123,1234), (8,12,_binary 'logname',123,1234),
13 (9,12,_binary 'logname',123,1234), (10,12,_binary 'logname',123,1234);
14 # Take backup and drop the tables
15 DROP TABLE test.t1;
16 DELETE FROM mysql.ndb_apply_status;
17 # Use case #1: Restore epoch along with replication status
18 SELECT COUNT(*) FROM test.t1;
19 COUNT(*)
20 24
21 # 10 rows will be restored to ndb_apply_status and another row will be generated with server_id = 0
22 SELECT COUNT(*) FROM mysql.ndb_apply_status;
23 COUNT(*)
24 11
25 SELECT COUNT(*) FROM mysql.ndb_apply_status WHERE server_id=0;
26 COUNT(*)
27 1
28 # Drop the tables to restore them again with a different use case
29 DROP TABLE test.t1;
30 DELETE FROM mysql.ndb_apply_status;
31 # Use case #2: Restore epoch after replication status is restored with data restore
32 SELECT COUNT(*) FROM test.t1;
33 COUNT(*)
34 24
35 SELECT COUNT(*) FROM mysql.ndb_apply_status;
36 COUNT(*)
37 11
38 # Drop the tables to restore them again with a different use case
39 DROP TABLE test.t1;
40 DELETE FROM mysql.ndb_apply_status;
41 # Use case #3: Restore replication status without epoch with server_id = 0
42 SELECT COUNT(*) FROM test.t1;
43 COUNT(*)
44 24
45 # Only 10 rows will be restored to ndb_apply_status
46 SELECT * FROM mysql.ndb_apply_status ORDER BY server_id;
47 server_id epoch log_name start_pos end_pos
48 1 12 logname 123 1234
49 2 12 logname 123 1234
50 3 12 logname 123 1234
51 4 12 logname 123 1234
52 5 12 logname 123 1234
53 6 12 logname 123 1234
54 7 12 logname 123 1234
55 8 12 logname 123 1234
56 9 12 logname 123 1234
57 10 12 logname 123 1234
58 # Drop the tables to restore them again with a different use case
59 DROP TABLE test.t1;
60 DELETE FROM mysql.ndb_apply_status;
61 # Use case #4: Attempt to restore replication status without restore-data/print-data/print-log/print-sql-log
62 # Drop the tables to restore them again with a different use case
63 DROP TABLE test.t1;
64 DELETE FROM mysql.ndb_apply_status;
65 # Use case #5: Restore appropriate replication status when the backup already contains a row with server_id=0
66 INSERT INTO mysql.ndb_apply_status VALUES (0,12,_binary 'logname',0,0),
67 (1,12,_binary 'logname',123,1234), (2,12,_binary 'logname',123,1234),
68 (3,12,_binary 'logname',123,1234), (4,12,_binary 'logname',123,1234),
69 (5,12,_binary 'logname',123,1234), (6,12,_binary 'logname',123,1234),
70 (7,12,_binary 'logname',123,1234), (8,12,_binary 'logname',123,1234),
71 (9,12,_binary 'logname',123,1234), (10,12,_binary 'logname',123,1234);
72 # Take backup and drop the tables
73 DELETE FROM mysql.ndb_apply_status;
74 SELECT COUNT(*) FROM mysql.ndb_apply_status WHERE server_id = 0;
75 COUNT(*)
76 1
77 # Truncate the table to restore again with a different use case
78 DELETE FROM mysql.ndb_apply_status;
79 # Use case #5: Restore appropriate replication status when the backup already contains a row with server_id=0 without --restore-epoch
80 SELECT * FROM mysql.ndb_apply_status ORDER BY server_id;
81 server_id epoch log_name start_pos end_pos
82 1 12 logname 123 1234
83 2 12 logname 123 1234
84 3 12 logname 123 1234
85 4 12 logname 123 1234
86 5 12 logname 123 1234
87 6 12 logname 123 1234
88 7 12 logname 123 1234
89 8 12 logname 123 1234
90 9 12 logname 123 1234
91 10 12 logname 123 1234
92 # cleanup
93 DELETE FROM mysql.ndb_apply_status;