You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysql-test/suite/ndb_binlog/r/ndb_binlog_purge_lock.result
+14-9Lines changed: 14 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -16,52 +16,57 @@ insert into test.t1 select NULL, a from test.t1;
16
16
insert into test.t1 select NULL, a from test.t1;
17
17
insert into test.t1 select NULL, a from test.t1;
18
18
insert into test.t1 select NULL, a from test.t1;
19
+
select trim(trailing "mysqld-bin.000001" from File) from mysql.ndb_binlog_index where epoch in (select max(epoch) from mysql.ndb_binlog_index) into @file_prefix;
20
+
select concat(@file_prefix, "mysqld-bin.000001") into @file1;
19
21
Have at least 100 epoch rows
20
-
select count(*)/100 > 0 from mysql.ndb_binlog_index where File='./mysqld-bin.000001';
22
+
select count(*)/100 > 0 from mysql.ndb_binlog_index where File=@file1;
21
23
count(*)/100 > 0
22
24
1
23
25
Flush log to get onto the next file...
24
26
FLUSH LOGS;
27
+
select concat(@file_prefix, "mysqld-bin.000002") into @file2;
create temporary table my_ndb_binlog_index like mysql.ndb_binlog_index;
27
-
insert into my_ndb_binlog_index select * from mysql.ndb_binlog_index where File='./mysqld-bin.000001' limit 1;
32
+
insert into my_ndb_binlog_index select * from mysql.ndb_binlog_index where File=@file1 limit 1;
28
33
select epoch from my_ndb_binlog_index into @epoch;
29
34
select orig_server_id from my_ndb_binlog_index into @orig_server_id;
30
35
select orig_epoch from my_ndb_binlog_index into @orig_epoch;
31
36
Lock one row to block purge
32
37
start transaction;
33
-
select count(1) from mysql.ndb_binlog_index where epoch = @epoch and orig_server_id = @orig_server_id and orig_epoch = @orig_epoch and File='./mysqld-bin.000001' for update;
38
+
select count(1) from mysql.ndb_binlog_index where epoch = @epoch and orig_server_id = @orig_server_id and orig_epoch = @orig_epoch and File=@file1 for update;
34
39
count(1)
35
40
1
36
41
Check that there are no rows in the next file
37
-
select count(*)=0 from mysql.ndb_binlog_index where File='./mysqld-bin.000002';
42
+
select count(*)=0 from mysql.ndb_binlog_index where File=@file2;
38
43
count(*)=0
39
44
1
40
45
Start the purge that will get stuck on one row
41
46
PURGE BINARY LOGS TO 'mysqld-bin.000002';
42
47
Wait 10 sec for purge to run into the row lock
43
48
Now we should still have some rows in the first file (since the purge is stuck)
44
-
select count(*)>0 from mysql.ndb_binlog_index where File='./mysqld-bin.000001';
49
+
select count(*)>0 from mysql.ndb_binlog_index where File=@file1;
45
50
count(*)>0
46
51
1
47
52
Insert some more rows
48
53
insert into test.t1 select NULL, a from test.t1;
49
54
Wait for rows to be committed to binlog
50
55
Now we see rows in the next file (which means there is no table lock)
51
-
select count(*)>0 from mysql.ndb_binlog_index where File='./mysqld-bin.000002';
56
+
select count(*)>0 from mysql.ndb_binlog_index where File=@file2;
52
57
count(*)>0
53
58
1
54
59
Release the purge
55
60
commit;
56
61
Purge done
57
62
Now we should have no rows in the first file
58
-
select count(*)=0 from mysql.ndb_binlog_index where File='./mysqld-bin.000001';
63
+
select count(*)=0 from mysql.ndb_binlog_index where File=@file1;
59
64
count(*)=0
60
65
1
61
66
Now we still should see rows in the next file
62
-
select count(*)>0 from mysql.ndb_binlog_index where File='./mysqld-bin.000002';
67
+
select count(*)>0 from mysql.ndb_binlog_index where File=@file2;
Copy file name to clipboardExpand all lines: mysql-test/suite/ndb_binlog/r/ndb_binlog_purge_upgrade.result
+14-9Lines changed: 14 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -31,52 +31,57 @@ insert into test.t1 select NULL, a from test.t1;
31
31
insert into test.t1 select NULL, a from test.t1;
32
32
insert into test.t1 select NULL, a from test.t1;
33
33
insert into test.t1 select NULL, a from test.t1;
34
+
select trim(trailing "mysqld-bin.000001" from File) from mysql.ndb_binlog_index where epoch in (select max(epoch) from mysql.ndb_binlog_index) into @file_prefix;
35
+
select concat(@file_prefix, "mysqld-bin.000001") into @file1;
34
36
Have at least 100 epoch rows
35
-
select count(*)/100 > 0 from mysql.ndb_binlog_index where File='./mysqld-bin.000001';
37
+
select count(*)/100 > 0 from mysql.ndb_binlog_index where File=@file1;
36
38
count(*)/100 > 0
37
39
1
38
40
Flush log to get onto the next file...
39
41
FLUSH LOGS;
42
+
select concat(@file_prefix, "mysqld-bin.000002") into @file2;
create temporary table my_ndb_binlog_index like mysql.ndb_binlog_index;
42
-
insert into my_ndb_binlog_index select * from mysql.ndb_binlog_index where File='./mysqld-bin.000001' limit 1;
47
+
insert into my_ndb_binlog_index select * from mysql.ndb_binlog_index where File=@file1 limit 1;
43
48
select epoch from my_ndb_binlog_index into @epoch;
44
49
select orig_server_id from my_ndb_binlog_index into @orig_server_id;
45
50
select orig_epoch from my_ndb_binlog_index into @orig_epoch;
46
51
Lock one row to block purge
47
52
start transaction;
48
-
select count(1) from mysql.ndb_binlog_index where epoch = @epoch and orig_server_id = @orig_server_id and orig_epoch = @orig_epoch and File='./mysqld-bin.000001' for update;
53
+
select count(1) from mysql.ndb_binlog_index where epoch = @epoch and orig_server_id = @orig_server_id and orig_epoch = @orig_epoch and File=@file1 for update;
49
54
count(1)
50
55
1
51
56
Check that there are no rows in the next file
52
-
select count(*)=0 from mysql.ndb_binlog_index where File='./mysqld-bin.000002';
57
+
select count(*)=0 from mysql.ndb_binlog_index where File=@file2;
53
58
count(*)=0
54
59
1
55
60
Start the purge that will get stuck on one row
56
61
PURGE BINARY LOGS TO 'mysqld-bin.000002';
57
62
Wait 10 sec for purge to run into the row lock
58
63
Now we should still have some rows in the first file (since the purge is stuck)
59
-
select count(*)>0 from mysql.ndb_binlog_index where File='./mysqld-bin.000001';
64
+
select count(*)>0 from mysql.ndb_binlog_index where File=@file1;
60
65
count(*)>0
61
66
1
62
67
Insert some more rows
63
68
insert into test.t1 select NULL, a from test.t1;
64
69
Wait for rows to be committed to binlog
65
70
Now we see rows in the next file (which means there is no table lock)
66
-
select count(*)>0 from mysql.ndb_binlog_index where File='./mysqld-bin.000002';
71
+
select count(*)>0 from mysql.ndb_binlog_index where File=@file2;
67
72
count(*)>0
68
73
1
69
74
Release the purge
70
75
commit;
71
76
Purge done
72
77
Now we should have no rows in the first file
73
-
select count(*)=0 from mysql.ndb_binlog_index where File='./mysqld-bin.000001';
78
+
select count(*)=0 from mysql.ndb_binlog_index where File=@file1;
74
79
count(*)=0
75
80
1
76
81
Now we still should see rows in the next file
77
-
select count(*)>0 from mysql.ndb_binlog_index where File='./mysqld-bin.000002';
82
+
select count(*)>0 from mysql.ndb_binlog_index where File=@file2;
let $master_log_file = query_get_value("SHOW MASTER STATUS", "File", 1);
40
-
let $file_prefix =`select trim(trailing "$master_log_file" from File) from mysql.ndb_binlog_index where epoch in (select max(epoch) from mysql.ndb_binlog_index);`;
41
-
let $file1 =`select concat("$file_prefix", "$master_log_file");`;
40
+
eval selecttrim(trailing "$master_log_file"from File) frommysql.ndb_binlog_indexwhere epoch in (selectmax(epoch) frommysql.ndb_binlog_index) into @file_prefix;
41
+
eval select concat(@file_prefix, "$master_log_file") into @file1;
eval insert into my_ndb_binlog_index select*frommysql.ndb_binlog_indexwhere File='$file1'limit1;
76
+
insert into my_ndb_binlog_index select*frommysql.ndb_binlog_indexwhere File=@file1 limit1;
56
77
select epoch from my_ndb_binlog_index into @epoch;
57
78
select orig_server_id from my_ndb_binlog_index into @orig_server_id;
58
79
select orig_epoch from my_ndb_binlog_index into @orig_epoch;
59
80
60
81
--echo Lock one row to block purge
61
82
start transaction;
62
-
eval selectcount(1) frommysql.ndb_binlog_indexwhere epoch = @epoch and orig_server_id = @orig_server_id and orig_epoch = @orig_epoch and File='$file1' for update;
83
+
selectcount(1) frommysql.ndb_binlog_indexwhere epoch = @epoch and orig_server_id = @orig_server_id and orig_epoch = @orig_epoch and File=@file1 for update;
63
84
64
85
connection con2;
65
86
--echo Check that there are no rows in the next file
0 commit comments