MINI MINI MANI MO

Path : /opt/mysql/mysql-test/suite/ndb_rpl/t/
File Upload :
Current File : //opt/mysql/mysql-test/suite/ndb_rpl/t/ndb_rpl_slave_binlog_index.test

--source include/have_ndb.inc
--source include/have_binlog_format_mixed_or_row.inc
--source suite/ndb_rpl/ndb_master-slave.inc
--source include/have_debug.inc
--source include/not_valgrind.inc

--connection slave
STOP SLAVE;

set @save_debug= @@global.debug;
set global debug='+d,ndb_injector_binlog_index_write_fail_random';

--connection master

USE test;

CREATE TABLE `t1` (
  `a` int(11) NOT NULL,
  `b` varchar(1000) DEFAULT NULL,
  PRIMARY KEY (`a`)
) ENGINE=ndbcluster;

DELIMITER %;


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;     set @x = @x + 1;   until @x = total   end repeat; end%

DELIMITER ;%

call loadgen(2000);

--connection slave
START SLAVE;

--echo Wait for replication to catch up
--connection master
--sync_slave_with_master

--connection slave
--echo Check that we got some warnings...
# Code taken from /include/check-warnings.test
--disable_query_log
--disable_result_log

create temporary table error_log (
  row int auto_increment primary key,
  suspicious int default 1,
  file_name varchar(255),
  line varchar(1024) default null
) engine=myisam;

# Get the name of servers error log
let $log_error= $SLAVE_ERRFILE;

# Try tload the warnings into a temporary table,
# it might fail with error saying "The MySQL server is
# running with the --secure-file-priv" in which case
# an attempt to load the file using LOAD DATA LOCAL is made
--error 0,1290
eval load data infile '$log_error' into table error_log
  fields terminated by 'xykls37' escaped by ''
  ignore 1 lines
  (line)
  set file_name='$log_error';

if ($mysql_errno)
{
  # Try LOAD DATA LOCAL
  eval load data local infile '$log_error' into table error_log
    fields terminated by 'xykls37' escaped by ''
    ignore 1 lines
    (line)
    set file_name='$log_error';
}
--enable_result_log
--enable_query_log
# end of code from /include/check-warnings.test

--echo Show that the test resulted in some extended error output...
select count(1) > 1 as InjectCount from error_log where line like '%NDB Binlog%Injecting random write failure%';
select count(1) > 1 as BasicError from error_log where line like '%NDB Binlog% failed writing to ndb_binlog_index%';
select count(1) > 1 as DetailError from error_log where line like '%NDB Binlog%Writing row%to ndb_binlog_index%';

drop table error_log;

set global debug= @save_debug;

--connection master

drop table test.t1;
drop procedure loadgen;

--sync_slave_with_master

--source include/rpl_end.inc

OHA YOOOO