Skip to content

Commit 6b4b639

Browse files
Martin SköldMartin Sköld
authored andcommitted
WL#7162 Move ndb_binlog_index table from MyISAM to transactional storage
Removed output of binlog file path to be file system independent.
1 parent 6b1f917 commit 6b4b639

File tree

3 files changed

+61
-30
lines changed

3 files changed

+61
-30
lines changed

mysql-test/suite/ndb_binlog/r/ndb_binlog_purge_lock.result

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,52 +16,57 @@ insert into test.t1 select NULL, a from test.t1;
1616
insert into test.t1 select NULL, a from test.t1;
1717
insert into test.t1 select NULL, a from test.t1;
1818
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;
1921
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;
2123
count(*)/100 > 0
2224
1
2325
Flush log to get onto the next file...
2426
FLUSH LOGS;
27+
select concat(@file_prefix, "mysqld-bin.000002") into @file2;
28+
create table test.files(file1 varchar(255), file2 varchar(255));
29+
insert into test.files values(@file1, @file2);
2530
Pick one row from ndb_binlog_index
2631
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;
2833
select epoch from my_ndb_binlog_index into @epoch;
2934
select orig_server_id from my_ndb_binlog_index into @orig_server_id;
3035
select orig_epoch from my_ndb_binlog_index into @orig_epoch;
3136
Lock one row to block purge
3237
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;
3439
count(1)
3540
1
3641
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;
3843
count(*)=0
3944
1
4045
Start the purge that will get stuck on one row
4146
PURGE BINARY LOGS TO 'mysqld-bin.000002';
4247
Wait 10 sec for purge to run into the row lock
4348
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;
4550
count(*)>0
4651
1
4752
Insert some more rows
4853
insert into test.t1 select NULL, a from test.t1;
4954
Wait for rows to be committed to binlog
5055
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;
5257
count(*)>0
5358
1
5459
Release the purge
5560
commit;
5661
Purge done
5762
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;
5964
count(*)=0
6065
1
6166
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;
6368
count(*)>0
6469
1
6570
cleanup
66-
drop table test.t1;
71+
drop table test.t1, test.files;
6772
Done

mysql-test/suite/ndb_binlog/r/ndb_binlog_purge_upgrade.result

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,52 +31,57 @@ insert into test.t1 select NULL, a from test.t1;
3131
insert into test.t1 select NULL, a from test.t1;
3232
insert into test.t1 select NULL, a from test.t1;
3333
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;
3436
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;
3638
count(*)/100 > 0
3739
1
3840
Flush log to get onto the next file...
3941
FLUSH LOGS;
42+
select concat(@file_prefix, "mysqld-bin.000002") into @file2;
43+
create table test.files(file1 varchar(255), file2 varchar(255));
44+
insert into test.files values(@file1, @file2);
4045
Pick one row from ndb_binlog_index
4146
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;
4348
select epoch from my_ndb_binlog_index into @epoch;
4449
select orig_server_id from my_ndb_binlog_index into @orig_server_id;
4550
select orig_epoch from my_ndb_binlog_index into @orig_epoch;
4651
Lock one row to block purge
4752
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;
4954
count(1)
5055
1
5156
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;
5358
count(*)=0
5459
1
5560
Start the purge that will get stuck on one row
5661
PURGE BINARY LOGS TO 'mysqld-bin.000002';
5762
Wait 10 sec for purge to run into the row lock
5863
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;
6065
count(*)>0
6166
1
6267
Insert some more rows
6368
insert into test.t1 select NULL, a from test.t1;
6469
Wait for rows to be committed to binlog
6570
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;
6772
count(*)>0
6873
1
6974
Release the purge
7075
commit;
7176
Purge done
7277
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;
7479
count(*)=0
7580
1
7681
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;
7883
count(*)>0
7984
1
8085
cleanup
81-
drop table test.t1;
86+
drop table test.t1, test.files;
8287
Done

mysql-test/suite/ndb_binlog/t/ndb_binlog_purge_lock.inc

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,47 +37,68 @@ insert into test.t1 select NULL, a from test.t1;
3737
--source include/wait_for_ndb_committed_to_binlog.inc
3838

3939
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 select trim(trailing "$master_log_file" from File) from mysql.ndb_binlog_index where epoch in (select max(epoch) from mysql.ndb_binlog_index) into @file_prefix;
41+
eval select concat(@file_prefix, "$master_log_file") into @file1;
4242

4343
--echo Have at least 100 epoch rows
44-
eval select count(*)/100 > 0 from mysql.ndb_binlog_index where File='$file1';
44+
select count(*)/100 > 0 from mysql.ndb_binlog_index where File=@file1;
4545

4646
--echo Flush log to get onto the next file...
4747
FLUSH LOGS;
4848

4949
let $master_log_file2 = query_get_value("SHOW MASTER STATUS", "File", 1);
50-
let $file2 = `select concat("$file_prefix", "$master_log_file2");`;
50+
eval select concat(@file_prefix, "$master_log_file2") into @file2;
51+
52+
create table test.files(file1 varchar(255), file2 varchar(255));
53+
insert into test.files values(@file1, @file2);
54+
55+
disable_query_log;
56+
connection con1;
57+
select file1 from test.files into @file1;
58+
select file2 from test.files into @file2;
59+
60+
connection con2;
61+
select file1 from test.files into @file1;
62+
select file2 from test.files into @file2;
63+
64+
connection con3;
65+
select file1 from test.files into @file1;
66+
select file2 from test.files into @file2;
67+
68+
connection con4;
69+
select file1 from test.files into @file1;
70+
select file2 from test.files into @file2;
71+
enable_query_log;
5172

5273
connection con1;
5374
--echo Pick one row from ndb_binlog_index
5475
create temporary table my_ndb_binlog_index like mysql.ndb_binlog_index;
55-
eval insert into my_ndb_binlog_index select * from mysql.ndb_binlog_index where File='$file1' limit 1;
76+
insert into my_ndb_binlog_index select * from mysql.ndb_binlog_index where File=@file1 limit 1;
5677
select epoch from my_ndb_binlog_index into @epoch;
5778
select orig_server_id from my_ndb_binlog_index into @orig_server_id;
5879
select orig_epoch from my_ndb_binlog_index into @orig_epoch;
5980

6081
--echo Lock one row to block purge
6182
start transaction;
62-
eval 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;
83+
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;
6384

6485
connection con2;
6586
--echo Check that there are no rows in the next file
66-
eval select count(*)=0 from mysql.ndb_binlog_index where File='$file2';
87+
select count(*)=0 from mysql.ndb_binlog_index where File=@file2;
6788
--echo Start the purge that will get stuck on one row
6889
--send_eval PURGE BINARY LOGS TO '$master_log_file2'
6990

7091
connection con3;
7192
--echo Wait 10 sec for purge to run into the row lock
7293
sleep 10;
7394
--echo Now we should still have some rows in the first file (since the purge is stuck)
74-
eval select count(*)>0 from mysql.ndb_binlog_index where File='$file1';
95+
select count(*)>0 from mysql.ndb_binlog_index where File=@file1;
7596
--echo Insert some more rows
7697
insert into test.t1 select NULL, a from test.t1;
7798
--echo Wait for rows to be committed to binlog
7899
--source include/wait_for_ndb_committed_to_binlog.inc
79100
--echo Now we see rows in the next file (which means there is no table lock)
80-
eval select count(*)>0 from mysql.ndb_binlog_index where File='$file2';
101+
select count(*)>0 from mysql.ndb_binlog_index where File=@file2;
81102

82103
connection con1;
83104
--echo Release the purge
@@ -89,13 +110,13 @@ connection con2;
89110

90111
connection con4;
91112
--echo Now we should have no rows in the first file
92-
eval select count(*)=0 from mysql.ndb_binlog_index where File='$file1';
113+
select count(*)=0 from mysql.ndb_binlog_index where File=@file1;
93114
--echo Now we still should see rows in the next file
94-
eval select count(*)>0 from mysql.ndb_binlog_index where File='$file2';
115+
select count(*)>0 from mysql.ndb_binlog_index where File=@file2;
95116

96117
connection default;
97118
--echo cleanup
98-
drop table test.t1;
119+
drop table test.t1, test.files;
99120

100121
--echo Done
101122

0 commit comments

Comments
 (0)