Skip to content

Commit 5fd1620

Browse files
author
s.sujatha
committed
Bug#19928622: ASSERTION `! IS_SET()' FAILED. | ABORT IN
DIAGNOSTICS_AREA::SET_OK_STATUS Analysis: ======== When XA transaction is active trying to execute an internal rollback will result in error ER_XAER_RMFAIL.i.e ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state. In the bug scenario a format description BINLOG command is being executed. While applying Format_description event there a peace of code which handles a special scenario. i.e a transaction NEVER spans on 2 or more binlogs: if we have an active transaction at this point, the master died while writing the transaction to the binary log, i.e. while flushing the binlog cache to the binlog. XA guarantees that master has rolled back. So we roll back. This rollback fails as an XA transaction is active and results in error 1399 and error diagnostic area is set to DA_ERROR. Post execution of the roll back, code tries to execute my_ok(thd). This my_ok(thd) expects diagnostic are to be DA_EMPTY since this contradicts with DA_ERROR an assert is generated. Fix: === The above mentioned rollback scenario should happen only for real slave when transaction spans across multiple binlogs. Roll back should not happen if the Format_description comes through BINLOG command from client. Hence avoid the call to rollback so that the Format_description event gets applied successfully.
1 parent 5284fc5 commit 5fd1620

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CREATE TABLE t1(f1 int);
2+
XA START'','';
3+
INSERT INTO t1 VALUES(10);
4+
BINLOG '
5+
SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
6+
AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
7+
XA END'';
8+
XA PREPARE'';
9+
XA COMMIT'';
10+
DROP TABLE t1;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
###############################################################################
2+
# Bug#19928622: ASSERTION `! IS_SET()' FAILED. | ABORT IN
3+
# DIAGNOSTICS_AREA::SET_OK_STATUS
4+
#
5+
# Test:
6+
# =====
7+
# Begin an XA transaction and execte a DML statement so that XA state becomes
8+
# XA_ACTIVE. Execute the BINLOG command it should not cause any assert.
9+
# Execution should be successful.
10+
###############################################################################
11+
--source include/have_log_bin.inc
12+
13+
CREATE TABLE t1(f1 int);
14+
XA START'','';
15+
INSERT INTO t1 VALUES(10);
16+
BINLOG '
17+
SOgWTg8BAAAAbgAAAHIAAAAAAAQANS42LjMtbTUtZGVidWctbG9nAAAAAAAAAAAAAAAAAAAAAAAA
18+
AAAAAAAAAAAAAAAAAABI6BZOEzgNAAgAEgAEBAQEEgAAVgAEGggAAAAICAgCAAAAAAVAYI8=';
19+
XA END'';
20+
XA PREPARE'';
21+
XA COMMIT'';
22+
DROP TABLE t1;

sql/log_event.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5734,7 +5734,8 @@ int Format_description_log_event::do_apply_event(Relay_log_info const *rli)
57345734
original place when it comes to us; we'll know this by checking
57355735
log_pos ("artificial" events have log_pos == 0).
57365736
*/
5737-
if (!is_artificial_event() && created && thd->transaction.all.ha_list)
5737+
if (!thd->rli_fake && !is_artificial_event() && created
5738+
&& thd->transaction.all.ha_list)
57385739
{
57395740
/* This is not an error (XA is safe), just an information */
57405741
rli->report(INFORMATION_LEVEL, 0,

0 commit comments

Comments
 (0)