summaryrefslogtreecommitdiff
path: root/mysql-test/suite/binlog/t/binlog_xa_checkpoint.test
blob: b208d02cf2a53dcc377abdf0125b21cf87ad4144 (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
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_binlog_format_row.inc

RESET MASTER;

CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;

# Test that
# 1. XA PREPARE is binlogged before the XA has been prepared in Engine
# 2. While XA PREPARE already binlogged in an old binlog file which has been rotated,
#    Binlog checkpoint is not generated for the latest log until
#    XA PREPARE returns, e.g OK to the client.


# con1 will hang before doing commit checkpoint, blocking RESET MASTER.
connect(con1,localhost,root,,);
SET DEBUG_SYNC= "at_unlog_xa_prepare SIGNAL con1_ready WAIT_FOR con1_go";
XA START '1';
INSERT INTO t1 SET a=1;
XA END '1';
--send XA PREPARE '1';


connection default;
SET DEBUG_SYNC= "now WAIT_FOR con1_ready";
FLUSH LOGS;
FLUSH LOGS;
FLUSH LOGS;

--source include/show_binary_logs.inc
--let $binlog_file= master-bin.000004
--let $binlog_start= 4
--source include/show_binlog_events.inc

SET DEBUG_SYNC= "now SIGNAL con1_go";

connection con1;
reap;
--echo *** master-bin.000004 checkpoint must show up now ***
--source include/wait_for_binlog_checkpoint.inc

# Todo: think about the error code returned, move to an appropriate test, or remove
# connection default;
#--error 1399
# DROP TABLE t1;

connection con1;
XA ROLLBACK '1';
SET debug_sync = 'reset';

# Clean up.
connection default;

DROP TABLE t1;
SET debug_sync = 'reset';