| 1 |
CREATE TABLE t1 ( |
| 2 |
id int, |
| 3 |
name varchar(255), |
| 4 |
age int, |
| 5 |
PRIMARY KEY(id) |
| 6 |
) engine=ndbcluster; |
| 7 |
INSERT INTO test.t1 VALUES |
| 8 |
(1, 'p1', 19), (2, 'p0', 11), (3, 'p2', 43), |
| 9 |
(4, 'p3', 99), (5, 'p4', 33), (6, 'p5', 45); |
| 10 |
INSERT INTO mysql.ndb_apply_status VALUES |
| 11 |
(1,12,_binary 'position',123,1234), (2,12,_binary 'position',123,1234), |
| 12 |
(3,12,_binary 'position',123,1234), (4,12,_binary 'position',123,1234), |
| 13 |
(5,12,_binary 'position',123,1234), (6,12,_binary 'position',123,1234), |
| 14 |
(7,12,_binary 'position',123,1234), (8,12,_binary 'position',123,1234), |
| 15 |
(9,12,_binary 'position',123,1234), (10,12,_binary 'position',123,1234); |
| 16 |
Run backup snapshotend |
| 17 |
Starting backup |
| 18 |
Backup started |
| 19 |
Make a set of changes which we expect to be logged |
| 20 |
4 new rows |
| 21 |
INSERT INTO mysql.ndb_apply_status VALUES |
| 22 |
(11,12,_binary 'position',123,1234), (12,12,_binary 'position',123,1234), |
| 23 |
(13,12,_binary 'position',123,1234), (14,12,_binary 'position',123,1234); |
| 24 |
Waiting for backup to complete |
| 25 |
Backup completed |
| 26 |
4 new rows after backup is completed |
| 27 |
INSERT INTO mysql.ndb_apply_status VALUES |
| 28 |
(15,12,_binary 'position',123,1234), (16,12,_binary 'position',123,1234), |
| 29 |
(17,12,_binary 'position',123,1234), (18,12,_binary 'position',123,1234); |
| 30 |
DROP TABLE test.t1; |
| 31 |
DELETE FROM mysql.ndb_apply_status; |
| 32 |
# Use case #1: Restore epoch along with replication status |
| 33 |
SELECT COUNT(*) FROM test.t1; |
| 34 |
COUNT(*) |
| 35 |
6 |
| 36 |
# 14 rows will be restored to ndb_apply_status and another row will be generated with server_id = 0 |
| 37 |
SELECT server_id FROM mysql.ndb_apply_status ORDER BY server_id; |
| 38 |
server_id |
| 39 |
0 |
| 40 |
1 |
| 41 |
2 |
| 42 |
3 |
| 43 |
4 |
| 44 |
5 |
| 45 |
6 |
| 46 |
7 |
| 47 |
8 |
| 48 |
9 |
| 49 |
10 |
| 50 |
11 |
| 51 |
12 |
| 52 |
13 |
| 53 |
14 |
| 54 |
# cleanup |
| 55 |
TRUNCATE test.t1; |
| 56 |
DELETE FROM mysql.ndb_apply_status; |
| 57 |
INSERT INTO test.t1 VALUES |
| 58 |
(1, 'p1', 19), (2, 'p0', 11), (3, 'p2', 43), |
| 59 |
(4, 'p3', 99), (5, 'p4', 33), (6, 'p5', 45); |
| 60 |
INSERT INTO mysql.ndb_apply_status VALUES |
| 61 |
(1,12,_binary 'position',123,1234), (2,12,_binary 'position',123,1234), |
| 62 |
(3,12,_binary 'position',123,1234), (4,12,_binary 'position',123,1234), |
| 63 |
(5,12,_binary 'position',123,1234), (6,12,_binary 'position',123,1234), |
| 64 |
(7,12,_binary 'position',123,1234), (8,12,_binary 'position',123,1234), |
| 65 |
(9,12,_binary 'position',123,1234), (10,12,_binary 'position',123,1234); |
| 66 |
Run backup snapshotstart |
| 67 |
Starting SNAPSHOTSTART backup |
| 68 |
Backup started |
| 69 |
Make a set of changes which we expect to be logged |
| 70 |
4 new rows |
| 71 |
INSERT INTO test.t1 VALUES |
| 72 |
(7, 'p1', 19), (8, 'p0', 11), |
| 73 |
(9, 'p2', 43), (10, 'p0', 11); |
| 74 |
INSERT INTO mysql.ndb_apply_status VALUES |
| 75 |
(11,12,_binary 'position',123,1234), (12,12,_binary 'position',123,1234), |
| 76 |
(13,12,_binary 'position',123,1234), (14,12,_binary 'position',123,1234); |
| 77 |
Waiting for backup to complete |
| 78 |
Backup completed |
| 79 |
4 new rows after backup is completed |
| 80 |
INSERT INTO mysql.ndb_apply_status VALUES |
| 81 |
(15,12,_binary 'position',123,1234), (16,12,_binary 'position',123,1234), |
| 82 |
(17,12,_binary 'position',123,1234), (18,12,_binary 'position',123,1234); |
| 83 |
DROP TABLE test.t1; |
| 84 |
DELETE FROM mysql.ndb_apply_status; |
| 85 |
# Use case #2: Restore epoch along with replication status |
| 86 |
SELECT COUNT(*) FROM test.t1; |
| 87 |
COUNT(*) |
| 88 |
6 |
| 89 |
# 10 rows will be restored to ndb_apply_status and another row will be generated with server_id = 0 |
| 90 |
SELECT server_id FROM mysql.ndb_apply_status ORDER BY server_id; |
| 91 |
server_id |
| 92 |
0 |
| 93 |
1 |
| 94 |
2 |
| 95 |
3 |
| 96 |
4 |
| 97 |
5 |
| 98 |
6 |
| 99 |
7 |
| 100 |
8 |
| 101 |
9 |
| 102 |
10 |
| 103 |
# cleanup |
| 104 |
DROP TABLE test.t1; |
| 105 |
DELETE FROM mysql.ndb_apply_status; |