Bug #92993 Assertion "all .. .xs->is_binlogged"
Submitted: 29 Oct 2018 16:23 Modified: 30 Oct 2018 5:40
Reporter: Hrvoje Matijakovic Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: XA transactions Severity:S6 (Debug Builds)
Version:8.0.13, 5.7.24 OS:CentOS
Assigned to: CPU Architecture:Any
Tags: debug

[29 Oct 2018 16:23] Hrvoje Matijakovic
Description:
gdb:

(gdb) bt
+bt
#0  0x00007fbef9101a01 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x000000000416d7dd in my_write_core (sig=6) at /home/hrvoje/worktable/MS-8.0.13_dbg/mysys/stacktrace.cc:278
#2  0x0000000002f3a56a in handle_fatal_signal (sig=6) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  0x00007fbef7205277 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007fbef7206968 in __GI_abort () at abort.c:90
#6  0x00007fbef71fe096 in __assert_fail_base (fmt=0x7fbef7359580 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55e9c10 "all || !xs->is_binlogged() || (!xs->is_in_recovery() && thd->is_error())", file=file@entry=
0x55e8d08 "/home/hrvoje/worktable/MS-8.0.13_dbg/sql/binlog.cc", line=line@entry=2287, function=function@entry=0x55ee0c0 <MYSQL_BIN_LOG::rollback(THD*, bool)::__PRETTY_FUNCTION__> "virtual int MYSQL_BIN_LOG::rollback(THD*, bool)") at asser
t.c:92
#7  0x00007fbef71fe142 in __GI___assert_fail (assertion=0x55e9c10 "all || !xs->is_binlogged() || (!xs->is_in_recovery() && thd->is_error())", file=0x55e8d08 "/home/hrvoje/worktable/MS-8.0.13_dbg/sql/binlog.cc", line=2287, function=0x55ee0
c0 <MYSQL_BIN_LOG::rollback(THD*, bool)::__PRETTY_FUNCTION__> "virtual int MYSQL_BIN_LOG::rollback(THD*, bool)") at assert.c:101
#8  0x0000000003d9ea8d in MYSQL_BIN_LOG::rollback (this=0x68bbc00 <mysql_bin_log>, thd=0x7fbea1419000, all=false) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/binlog.cc:2286
#9  0x0000000002ee9bd5 in trans_rollback_stmt (thd=0x7fbea1419000) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/transaction.cc:529
#10 0x0000000002cf5cae in open_ltable (thd=0x7fbea1419000, table_list=0x7fbef5ba96d0, lock_type=TL_WRITE_CONCURRENT_INSERT, lock_flags=2075) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/sql_base.cc:6331
#11 0x0000000002cfe90b in open_log_table (thd=0x7fbea1419000, one_table=0x7fbef5ba96d0, backup=0x7fbef5ba9440) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/sql_base.cc:9839
#12 0x0000000003254687 in Log_to_csv_event_handler::log_general (this=0x68b9740 <query_logger+64>, thd=0x7fbea1419000, event_utime=1540829845603401, user_host=0x7fbef5ba9d40 "root[root] @ localhost []", user_host_len=25, thread_id=8, comm
and_type=0x513d0d5 "Query", command_type_len=5, sql_text=0x7fbea1467028 "xa rollback 'tx1'", sql_text_len=17, client_cs=0x682aee0 <my_charset_utf8mb4_0900_ai_ci>) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/log.cc:818
#13 0x00000000032562d4 in Query_logger::general_log_write (this=0x68b9700 <query_logger>, thd=0x7fbea1419000, command=COM_QUERY, query=0x7fbea1467028 "xa rollback 'tx1'", query_length=17) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/log.cc
:1308
#14 0x0000000002d9f3a6 in mysql_parse (thd=0x7fbea1419000, parser_state=0x7fbef5baa1e0, force_primary_storage_engine=false) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/sql_parse.cc:4990
#15 0x0000000002d95a87 in dispatch_command (thd=0x7fbea1419000, com_data=0x7fbef5baab40, command=COM_QUERY) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/sql_parse.cc:1687
#16 0x0000000002d941ad in do_command (thd=0x7fbea1419000) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/sql_parse.cc:1260
#17 0x0000000002f26fe6 in handle_connection (arg=0x7fbee2b56a00) at /home/hrvoje/worktable/MS-8.0.13_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#18 0x00000000042fefbb in pfs_spawn_thread (arg=0x7fbef501b220) at /home/hrvoje/worktable/MS-8.0.13_dbg/storage/perfschema/pfs.cc:2836
#19 0x00007fbef90fce25 in start_thread (arg=0x7fbef5bab700) at pthread_create.c:308
#20 0x00007fbef72cdbad in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113
(gdb)

How to repeat:
sql:
CREATE DATABASE test;
USE test;
SET GLOBAL general_log=ON;
create table t1(a1 int)partition by range (a1) (partition p0 values less than (3),partition p1 values less than (6),partition p2 values less than (9));
drop table mysql.general_log;
xa start 'test1';
INSERT INTO t1 VALUES();
XA END 'test1';
XA PREPARE 'test1';
SET @@global.log_output='TABLE';
xa rollback 'tx1';

On release build last statement results in:
mysql> xa rollback 'tx1';
ERROR 1399 (XAE07): XAER_RMFAIL: The command cannot be executed when global transaction is in the  PREPARED state
[30 Oct 2018 5:40] MySQL Verification Team
Hello Hrvoje Matijakovic,

Thank you for the report and test case.
Observed that 8.0.13 debug build is affected.

regards,
Umesh