Skip to content

Commit ef2fa9e

Browse files
committed
Merge ../mysql-5.6-cluster-7.4 into mysql-5.7-cluster-7.5
2 parents 17e912d + fc8e43b commit ef2fa9e

File tree

3 files changed

+80
-5
lines changed

3 files changed

+80
-5
lines changed

mysql-test/suite/ndb_rpl/r/ndb_rpl_backup_epoch.result

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ truncate table test.ticker;
8181
delete from mysql.ndb_apply_status;
8282
start slave;
8383
select @log_rows:=count(1) from test.ticker;
84-
select @log_max_val:=max(a) from test.ticker;
84+
select @log_max_val:=ifnull(max(a),200) from test.ticker;
8585
Expect 200 when adding backup and log rows
8686
select @backup_rows + @log_rows;
8787
@backup_rows + @log_rows
@@ -112,7 +112,7 @@ truncate table test.ticker;
112112
delete from mysql.ndb_apply_status;
113113
start slave;
114114
select @log_rows:=count(1) from test.ticker;
115-
select @log_max_val:=max(a) from test.ticker;
115+
select @log_max_val:=ifnull(max(a),200) from test.ticker;
116116
Expect 200 when adding backup and log rows
117117
select @backup_rows + @log_rows;
118118
@backup_rows + @log_rows

mysql-test/suite/ndb_rpl/t/ndb_rpl_backup_epoch.test

+3-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ select sleep(2);
8383

8484
--let $first_backup_id = $the_backup_id
8585

86+
# select sleep(20); # Force second backup to run after all changes
87+
8688
select sleep(2);
8789

8890
--echo Run backup snapshotstart
@@ -184,7 +186,7 @@ while($backup_count)
184186

185187
--disable_result_log
186188
select @log_rows:=count(1) from test.ticker;
187-
select @log_max_val:=max(a) from test.ticker;
189+
select @log_max_val:=ifnull(max(a),200) from test.ticker;
188190
--enable_result_log
189191

190192
--echo Expect 200 when adding backup and log rows

mysql-test/suite/ndb_rpl/t/ndb_rpl_change_master_to_epoch.inc

+75-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,82 @@
1515
--connection master
1616
#--eval select * from mysql.ndb_binlog_index where epoch > $first_backup_epoch LIMIT 1;
1717

18-
eval select @the_pos:=position,
18+
let $exact_count=0;
19+
let $after_count=0;
20+
let $before_count=0;
21+
22+
set @exact_count = 0;
23+
eval select @exact_count:=count(1)
24+
from mysql.ndb_binlog_index where epoch = $the_epoch LIMIT 1;
25+
let $exact_count = query_get_value(select @exact_count as ec, ec, 1);
26+
27+
set @after_count = 0;
28+
eval select @after_count:=count(1)
29+
from mysql.ndb_binlog_index where epoch > $the_epoch
30+
order by epoch asc LIMIT 1;
31+
let $after_count = query_get_value(select @after_count as ac, ac, 1);
32+
33+
set @before_count = 0;
34+
eval select @before_count:=count(1)
35+
from mysql.ndb_binlog_index where epoch < $the_epoch
36+
order by epoch desc LIMIT 1;
37+
let $before_count = query_get_value(select @before_count as bc, bc, 1);
38+
39+
40+
if ($exact_count)
41+
{
42+
# Have an entry corresponding exactly to the restore-point epoch
43+
# So start from *next* location in the Binlog described in that entry
44+
eval select @the_pos:=next_position,
45+
@the_file:=SUBSTRING_INDEX(REPLACE(next_file,'\\\\','/'), '/', -1)
46+
from mysql.ndb_binlog_index where epoch = $the_epoch LIMIT 1;
47+
48+
#--echo Choosing exact position for $the_epoch
49+
}
50+
if (!$exact_count)
51+
{
52+
if ($after_count)
53+
{
54+
# Have an entry after the restore point epoch
55+
# Assume that nothing is missing between restore point and this first
56+
# following epoch
57+
# Start from beginning of this following epoch
58+
eval select @the_pos:=position,
1959
@the_file:=SUBSTRING_INDEX(REPLACE(file,'\\\\','/'), '/', -1)
20-
from mysql.ndb_binlog_index where epoch > $the_epoch LIMIT 1;
60+
from mysql.ndb_binlog_index where epoch > $the_epoch
61+
order by epoch asc LIMIT 1;
62+
#--echo Choosing first position after restore point for $the_epoch
63+
}
64+
if (!$after_count)
65+
{
66+
if ($before_count)
67+
{
68+
# Have no entry with the exact epoch, or following it
69+
# However we can get a binlog start point by starting from just after
70+
# the preceding epoch in the binlog, assuming nothing is missing.
71+
#
72+
eval select @the_pos:=next_position,
73+
@the_file:=SUBSTRING_INDEX(REPLACE(next_file,'\\\\','/'), '/', -1)
74+
from mysql.ndb_binlog_index where epoch < $the_epoch
75+
order by epoch desc LIMIT 1;
76+
#--echo Choosing last position before restore point for $the_epoch
77+
}
78+
if (!$before_count)
79+
{
80+
# Have no position at all binlog index table is empty
81+
# Could be optional to allow this and just start from first binlog etc
82+
# But let's leave this
83+
#
84+
--echo No position info available in masters ndb_binlog_index table
85+
--echo Epoch : $the_epoch
86+
select * from mysql.ndb_binlog_index;
87+
--die Cannot continue
88+
}
89+
}
90+
}
91+
92+
let $the_pos=0;
93+
let $the_file="BADFILE";
2194
let $the_pos = query_get_value(select @the_pos as pos, pos, 1);
2295
let $the_file = query_get_value(select @the_file as file, file, 1);
2396

0 commit comments

Comments
 (0)