| 1 |
include/master-slave.inc |
| 2 |
Warnings: |
| 3 |
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. |
| 4 |
Note #### Storing MySQL user name or password information in the connection metadata repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START REPLICA; see the 'START REPLICA Syntax' in the MySQL Manual for more information. |
| 5 |
[connection master] |
| 6 |
Test to show that combination of Backup + Restore and |
| 7 |
Binlog positioning correctly recovers a slave |
| 8 |
stop slave; |
| 9 |
Warnings: |
| 10 |
Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead |
| 11 |
use test; |
| 12 |
create table ticker (a int primary key) engine=ndb; |
| 13 |
reset master; |
| 14 |
use test; |
| 15 |
create procedure tick(times int) |
| 16 |
begin |
| 17 |
set @x = 1; |
| 18 |
repeat |
| 19 |
insert into test.ticker values (@x); |
| 20 |
select sleep(0.1); |
| 21 |
set @x = @x + 1; |
| 22 |
until @x > times |
| 23 |
end repeat; |
| 24 |
end % |
| 25 |
Insert ticks into the table every 100 millis for 20s |
| 26 |
call tick(200);; |
| 27 |
select sleep(2); |
| 28 |
sleep(2) |
| 29 |
0 |
| 30 |
Run backup snapshotend |
| 31 |
Starting backup |
| 32 |
Backup started |
| 33 |
Waiting for backup to complete |
| 34 |
Backup completed |
| 35 |
select sleep(2); |
| 36 |
sleep(2) |
| 37 |
0 |
| 38 |
Run backup snapshotstart |
| 39 |
Starting SNAPSHOTSTART backup |
| 40 |
Backup started |
| 41 |
Waiting for backup to complete |
| 42 |
Backup completed |
| 43 |
Wait for ticker to stop |
| 44 |
Expect 200 entries on Master |
| 45 |
select count(1) from test.ticker; |
| 46 |
count(1) |
| 47 |
200 |
| 48 |
select max(a) from test.ticker; |
| 49 |
max(a) |
| 50 |
200 |
| 51 |
Replicate as normal |
| 52 |
use test; |
| 53 |
create table ticker (a int primary key) engine=ndb; |
| 54 |
start slave; |
| 55 |
Warnings: |
| 56 |
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead |
| 57 |
Expect 200 entries on Slave |
| 58 |
select count(1) from test.ticker; |
| 59 |
count(1) |
| 60 |
200 |
| 61 |
select max(a) from test.ticker; |
| 62 |
max(a) |
| 63 |
200 |
| 64 |
Verify backup restoration is correct wrt binlog positions |
| 65 |
Restore backup on the slave |
| 66 |
stop slave; |
| 67 |
Warnings: |
| 68 |
Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead |
| 69 |
truncate table test.ticker; |
| 70 |
delete from mysql.ndb_apply_status; |
| 71 |
select @backup_rows:=count(1) from test.ticker; |
| 72 |
select @backup_max_val:=max(a) from test.ticker; |
| 73 |
select @backup_rows - @backup_max_val; |
| 74 |
@backup_rows - @backup_max_val |
| 75 |
0 |
| 76 |
start slave; |
| 77 |
Warnings: |
| 78 |
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead |
| 79 |
Expect 200 rows when backup and binlog subset combined on slave |
| 80 |
select count(1) from test.ticker; |
| 81 |
count(1) |
| 82 |
200 |
| 83 |
select max(a) from test.ticker; |
| 84 |
max(a) |
| 85 |
200 |
| 86 |
Now check Binlog apply alone |
| 87 |
stop slave; |
| 88 |
Warnings: |
| 89 |
Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead |
| 90 |
truncate table test.ticker; |
| 91 |
delete from mysql.ndb_apply_status; |
| 92 |
start slave; |
| 93 |
Warnings: |
| 94 |
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead |
| 95 |
select @log_rows:=count(1) from test.ticker; |
| 96 |
select @log_max_val:=ifnull(max(a),200) from test.ticker; |
| 97 |
Expect 200 when adding backup and log rows |
| 98 |
select @backup_rows + @log_rows; |
| 99 |
@backup_rows + @log_rows |
| 100 |
200 |
| 101 |
select @log_max_val; |
| 102 |
@log_max_val |
| 103 |
200 |
| 104 |
Restore backup on the slave |
| 105 |
stop slave; |
| 106 |
Warnings: |
| 107 |
Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead |
| 108 |
truncate table test.ticker; |
| 109 |
delete from mysql.ndb_apply_status; |
| 110 |
select @backup_rows:=count(1) from test.ticker; |
| 111 |
select @backup_max_val:=max(a) from test.ticker; |
| 112 |
select @backup_rows - @backup_max_val; |
| 113 |
@backup_rows - @backup_max_val |
| 114 |
0 |
| 115 |
start slave; |
| 116 |
Warnings: |
| 117 |
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead |
| 118 |
Expect 200 rows when backup and binlog subset combined on slave |
| 119 |
select count(1) from test.ticker; |
| 120 |
count(1) |
| 121 |
200 |
| 122 |
select max(a) from test.ticker; |
| 123 |
max(a) |
| 124 |
200 |
| 125 |
Now check Binlog apply alone |
| 126 |
stop slave; |
| 127 |
Warnings: |
| 128 |
Warning 1287 'STOP SLAVE' is deprecated and will be removed in a future release. Please use STOP REPLICA instead |
| 129 |
truncate table test.ticker; |
| 130 |
delete from mysql.ndb_apply_status; |
| 131 |
start slave; |
| 132 |
Warnings: |
| 133 |
Warning 1287 'START SLAVE' is deprecated and will be removed in a future release. Please use START REPLICA instead |
| 134 |
select @log_rows:=count(1) from test.ticker; |
| 135 |
select @log_max_val:=ifnull(max(a),200) from test.ticker; |
| 136 |
Expect 200 when adding backup and log rows |
| 137 |
select @backup_rows + @log_rows; |
| 138 |
@backup_rows + @log_rows |
| 139 |
200 |
| 140 |
select @log_max_val; |
| 141 |
@log_max_val |
| 142 |
200 |
| 143 |
Cleanup |
| 144 |
drop procedure tick; |
| 145 |
drop table ticker; |
| 146 |
reset master; |
| 147 |
include/rpl_end.inc |