polardbxengine/mysql-test/t/mysqlbinlog_raw_mode.test

55 lines
1.9 KiB
Plaintext

--source include/have_log_bin.inc
--source include/not_windows.inc
-- source include/mysqlbinlog_raw_mode.inc
# Test --stop-never
# If exit code is good or bad then entry in raw_mode_exit table will be created
# Anything above exit code 1 is bad. We wait for this
CREATE TABLE raw_mode_exit (exit_code INT);
# Now jump some loops to have mysqlbinlog executed in the background
--write_file $MYSQL_TMP_DIR/mbl.sh
(`$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQL_TMP_DIR/ binlog.000001 ; [ $? -le 1 ]` && $MYSQL -e "use test; INSERT INTO raw_mode_exit VALUES (1);") < /dev/null > /dev/null 2>&1 &
EOF
--exec /bin/bash $MYSQL_TMP_DIR/mbl.sh
let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
--source include/wait_condition.inc
# Wait until creating binlog files by mysqlbinlog
--perl
$timeout= 30;
$binlog= $ENV{'MYSQL_TMP_DIR'} . '/binlog.000003';
$binlog_exists= 0;
while ($timeout > 0 && $binlog_exists == 0)
{
if (-e $binlog)
{
$binlog_exists= 1;
}
sleep 1;
$timeout--;
}
if ($timeout == 0 && $binlog_exists == 0)
{
print "Timeout reached but binlog file $binlog was not created";
}
EOF
--diff_files $MYSQL_TMP_DIR/binlog.000001 $MYSQLD_DATADIR/binlog.000001
--diff_files $MYSQL_TMP_DIR/binlog.000002 $MYSQLD_DATADIR/binlog.000002
SELECT ((@id := id) - id) from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
# Test killing from mysql server
kill @id;
--let $wait_condition= SELECT count(*) = 1 FROM raw_mode_exit WHERE exit_code = 1;
--source include/wait_condition.inc
DROP TABLE raw_mode_exit;
--remove_file $MYSQL_TMP_DIR/binlog.000001
--remove_file $MYSQL_TMP_DIR/binlog.000002
--remove_file $MYSQL_TMP_DIR/binlog.000003
--remove_file $MYSQL_TMP_DIR/mbl.sh
--echo End of tests