| 1 |
--source include/have_ndb.inc |
| 2 |
--source include/have_binlog_format_mixed_or_row.inc |
| 3 |
--source suite/ndb_rpl/ndb_master-slave.inc |
| 4 |
--source include/have_debug.inc |
| 5 |
--source include/not_valgrind.inc |
| 6 |
|
| 7 |
--connection slave |
| 8 |
STOP SLAVE; |
| 9 |
|
| 10 |
set @save_debug= @@global.debug; |
| 11 |
set global debug='+d,ndb_injector_binlog_index_write_fail_random'; |
| 12 |
|
| 13 |
--connection master |
| 14 |
|
| 15 |
USE test; |
| 16 |
|
| 17 |
CREATE TABLE `t1` ( |
| 18 |
`a` int(11) NOT NULL, |
| 19 |
`b` varchar(1000) DEFAULT NULL, |
| 20 |
PRIMARY KEY (`a`) |
| 21 |
) ENGINE=ndbcluster; |
| 22 |
|
| 23 |
DELIMITER %; |
| 24 |
|
| 25 |
|
| 26 |
CREATE DEFINER=`root`@`localhost` PROCEDURE `loadgen`(total int) begin set @x = 0; repeat insert into test.t1 values (1, repeat('B', 10)); insert into test.t1 values (2, repeat('I', 10)); insert into test.t1 values (3,repeat('W', 10)); insert into test.t1 values (4, repeat('G', 10)); insert into test.t1 values (5, repeat('V', 10)); insert into test.t1 values (6, repeat('D', 10)); insert into test.t1 values (7, repeat('P', 10)); delete from test.t1; select sleep(0.1); set @x = @x + 1; until @x = total end repeat; end% |
| 27 |
|
| 28 |
DELIMITER ;% |
| 29 |
|
| 30 |
--disable_result_log |
| 31 |
call loadgen(400); |
| 32 |
--enable_result_log |
| 33 |
|
| 34 |
--connection slave |
| 35 |
START SLAVE; |
| 36 |
|
| 37 |
--echo Wait for replication to catch up |
| 38 |
--connection master |
| 39 |
--sync_slave_with_master |
| 40 |
|
| 41 |
--connection slave |
| 42 |
--echo Check that we got some warnings... |
| 43 |
# Code taken from /include/check-warnings.test |
| 44 |
--disable_query_log |
| 45 |
--disable_result_log |
| 46 |
|
| 47 |
create temporary table error_log ( |
| 48 |
`row` int auto_increment primary key, |
| 49 |
suspicious int default 1, |
| 50 |
file_name varchar(255), |
| 51 |
line varchar(1024) default null |
| 52 |
) engine=myisam; |
| 53 |
|
| 54 |
# Get the name of servers error log |
| 55 |
let $log_error= $SLAVE_ERRFILE; |
| 56 |
|
| 57 |
# Try tload the warnings into a temporary table, |
| 58 |
# it might fail with error saying "The MySQL server is |
| 59 |
# running with the --secure-file-priv" in which case |
| 60 |
# an attempt to load the file using LOAD DATA LOCAL is made |
| 61 |
--error 0,1290 |
| 62 |
eval load data infile '$log_error' into table error_log |
| 63 |
fields terminated by 'xykls37' escaped by '' |
| 64 |
ignore 1 lines |
| 65 |
(line) |
| 66 |
set file_name='$log_error'; |
| 67 |
|
| 68 |
if ($mysql_errno) |
| 69 |
{ |
| 70 |
# Try LOAD DATA LOCAL |
| 71 |
eval load data local infile '$log_error' into table error_log |
| 72 |
fields terminated by 'xykls37' escaped by '' |
| 73 |
ignore 1 lines |
| 74 |
(line) |
| 75 |
set file_name='$log_error'; |
| 76 |
} |
| 77 |
--enable_result_log |
| 78 |
--enable_query_log |
| 79 |
# end of code from /include/check-warnings.test |
| 80 |
|
| 81 |
--echo Show that the test resulted in some extended error output... |
| 82 |
select count(1) > 0 as InjectCount from error_log where line like '%Binlog%Injecting random write failure%'; |
| 83 |
select count(1) > 0 as BasicError from error_log where line like '%Binlog% failed writing to ndb_binlog_index%'; |
| 84 |
select count(1) > 0 as DetailError from error_log where line like '%Binlog%Writing row%to ndb_binlog_index%'; |
| 85 |
|
| 86 |
drop table error_log; |
| 87 |
|
| 88 |
set global debug= @save_debug; |
| 89 |
|
| 90 |
--connection master |
| 91 |
|
| 92 |
drop table test.t1; |
| 93 |
drop procedure loadgen; |
| 94 |
|
| 95 |
--sync_slave_with_master |
| 96 |
|
| 97 |
--source include/rpl_end.inc |