summaryrefslogtreecommitdiff
path: root/mysql-test/suite/binlog/t/binlog_truncate_multi_engine.inc
blob: f3801070851340e1b3b229f6f9493a6563edf116 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# Invoked by binlog_truncate_multi_engine.test
# Parameters:
#   $debug_sync_action  describes debug-sync actions
#   $kill_server        1 when to crash, 0 for regular restart
#   $restart_parameters the caller may simulate partial commit at recovery
#   $test_outcome       summary of extected results
#   $MYSQLD_DATADIR

--echo #
--echo #
--echo # Case $case : $description
--echo #
RESET MASTER;
FLUSH LOGS;
SET GLOBAL max_binlog_size= 4096;

connect(con1,localhost,root,,);
--echo List of binary logs before rotation
--source include/show_binary_logs.inc
INSERT INTO t1 VALUES (1, REPEAT("x", 1));
INSERT INTO t2 VALUES (1, REPEAT("x", 1));
--let $is_case_B=`SELECT $case = "B"`

if ($is_case_B)
{
  --write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait-binlog_truncate_multi_engine.test
EOF

  SET GLOBAL debug_dbug="d,enable_log_write_upto_crash";
}
BEGIN;
  INSERT INTO t2 VALUES (2, REPEAT("x", 4100));
  INSERT INTO t1 VALUES (2, REPEAT("x", 4100));

if (`SELECT $debug_sync_action != ""`)
{
  --eval SET DEBUG_SYNC= $debug_sync_action
}
send COMMIT;

--connection default
if ($is_case_B)
{
  --source include/wait_until_disconnected.inc
  --source include/start_mysqld.inc
}
if (!$is_case_B)
{
  SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
  --echo List of binary logs after rotation
  --source include/show_binary_logs.inc

  --echo # restart the server with $restart_parameters
  --echo # the server is restarted
  --source include/restart_mysqld.inc
}

--connection default
--echo #
--echo # *** Summary: $test_outcome:
--echo #
SELECT COUNT(*) FROM t1;
SELECT COUNT(*) FROM t2;
SELECT @@GLOBAL.gtid_binlog_state;
SELECT @@GLOBAL.gtid_binlog_pos;
--echo List of binary logs at the end of the tests
--source include/show_binary_logs.inc
--echo # ***
# cleanup
DELETE FROM t1;
DELETE FROM t2;
--disconnect con1
--echo #