~percona-core/percona-xtrabackup/2.1

« back to all changes in this revision

Viewing changes to test/t/bug1037379.sh

  • Committer: Alexey Kopytov
  • Date: 2012-10-16 15:38:42 UTC
  • mfrom: (391.52.2 2.0)
  • Revision ID: akopytov@gmail.com-20121016153842-6gfig6g8fwg9ogf3
Manual merge from 2.0 (conflict in innobackupex).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
################################################################################
 
2
# Bug #1037379: SQL_THREAD left in stopped state of safe-slave-backup-timeout is
 
3
#               reached
 
4
# Bug #887803: innobackupex --safe-slave-backup-timeout option doesn't work
 
5
################################################################################
 
6
 
 
7
. inc/common.sh
 
8
 
 
9
################################################################################
 
10
# Create a temporary table and pause "indefinitely" to keep the connection open
 
11
################################################################################
 
12
function create_temp_table()
 
13
{
 
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);
 
18
SELECT SLEEP(10000);
 
19
EOF
 
20
}
 
21
 
 
22
master_id=1
 
23
slave_id=2
 
24
 
 
25
start_server_with_id $master_id
 
26
start_server_with_id $slave_id
 
27
 
 
28
setup_slave $slave_id $master_id
 
29
 
 
30
create_temp_table &
 
31
job_master=$!
 
32
 
 
33
sync_slave_with_master $slave_id $master_id
 
34
 
 
35
switch_server $slave_id
 
36
 
 
37
################################################################################
 
38
# First check if the SQL thread is left in the running state
 
39
# if it is running when taking a backup
 
40
################################################################################
 
41
 
 
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
 
45
 
 
46
grep -q "Slave_open_temp_tables did not become zero" $OUTFILE
 
47
 
 
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'
 
51
 
 
52
################################################################################
 
53
# Now check if the SQL thread is left in the stopped state
 
54
# if it is stopped when taking a backup
 
55
################################################################################
 
56
 
 
57
run_cmd $MYSQL $MYSQL_ARGS -e "STOP SLAVE SQL_THREAD"
 
58
 
 
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
 
62
 
 
63
grep -c "Slave_open_temp_tables did not become zero" $OUTFILE | grep -w 2
 
64
 
 
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'
 
68
 
 
69
kill -SIGKILL $job_master