1
################################################################################
2
# Bug #1037379: SQL_THREAD left in stopped state of safe-slave-backup-timeout is
4
# Bug #887803: innobackupex --safe-slave-backup-timeout option doesn't work
5
################################################################################
9
################################################################################
10
# Create a temporary table and pause "indefinitely" to keep the connection open
11
################################################################################
12
function create_temp_table()
14
switch_server $master_id
15
run_cmd $MYSQL $MYSQL_ARGS test <<EOF
16
CREATE TEMPORARY TABLE tmp(a INT);
17
INSERT INTO tmp VALUES (1);
25
start_server_with_id $master_id
26
start_server_with_id $slave_id
28
setup_slave $slave_id $master_id
33
sync_slave_with_master $slave_id $master_id
35
switch_server $slave_id
37
################################################################################
38
# First check if the SQL thread is left in the running state
39
# if it is running when taking a backup
40
################################################################################
42
# The following will fail due to a timeout
43
run_cmd_expect_failure $IB_BIN $IB_ARGS --no-timestamp --safe-slave-backup \
44
--safe-slave-backup-timeout=3 $topdir/backup1
46
grep -q "Slave_open_temp_tables did not become zero" $OUTFILE
48
# Check that the SQL thread is running
49
run_cmd $MYSQL $MYSQL_ARGS -e "SHOW SLAVE STATUS\G" |
50
egrep 'Slave_SQL_Running:[[:space:]]+Yes'
52
################################################################################
53
# Now check if the SQL thread is left in the stopped state
54
# if it is stopped when taking a backup
55
################################################################################
57
run_cmd $MYSQL $MYSQL_ARGS -e "STOP SLAVE SQL_THREAD"
59
# The following will fail due to a timeout
60
run_cmd_expect_failure $IB_BIN $IB_ARGS --no-timestamp --safe-slave-backup \
61
--safe-slave-backup-timeout=3 $topdir/backup2
63
grep -c "Slave_open_temp_tables did not become zero" $OUTFILE | grep -w 2
65
# Check that the SQL thread is stopped
66
run_cmd $MYSQL $MYSQL_ARGS -e "SHOW SLAVE STATUS\G" |
67
egrep 'Slave_SQL_Running:[[:space:]]+No'
69
kill -SIGKILL $job_master