Bug #91980 Assertion `head->variables.gtid_next.type == ANONYMOUS_GTID' failed.
Submitted: 11 Aug 2018 7:27 Modified: 20 Nov 2018 13:17
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Replication Severity:S6 (Debug Builds)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[11 Aug 2018 7:27] Roel Van de Paar
Description:
mysqld: /git/MS-8.0.12_dbg/sql/binlog.cc:1422: bool MYSQL_BIN_LOG::assign_automatic_gtids_to_flush_group(THD*): Assertion `head->variables.gtid_next.type == ANONYMOUS_GTID' failed.
07:24:37 UTC - mysqld got signal 6 ;

Core was generated by `/sda/MS300718-mysql-8.0.12-linux-x86_64-debug/bin/mysqld --no-defaults --core-f'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
57	../sysdeps/unix/sysv/linux/pthread_kill.c: No such file or directory.
[Current thread is 1 (Thread 0x7f26d39a5700 (LWP 31993))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x00005619f713778d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x00005619f5e8bd94 in handle_fatal_signal (sig=6) at /git/MS-8.0.12_dbg/sql/signal_handler.cc:249
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x00007f26d39e6801 in __GI_abort () at abort.c:79
#6  0x00007f26d39d639a in __assert_fail_base (fmt=0x7f26d3b5d7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x5619f85c7068 "head->variables.gtid_next.type == ANONYMOUS_GTID", 
    file=file@entry=0x5619f85c6998 "/git/MS-8.0.12_dbg/sql/binlog.cc", line=line@entry=1422, 
    function=function@entry=0x5619f85cb8c0 <MYSQL_BIN_LOG::assign_automatic_gtids_to_flush_group(THD*)::__PRETTY_FUNCTION__> "bool MYSQL_BIN_LOG::assign_automatic_gtids_to_flush_group(THD*)") at assert.c:92
#7  0x00007f26d39d6412 in __GI___assert_fail (assertion=0x5619f85c7068 "head->variables.gtid_next.type == ANONYMOUS_GTID", 
    file=0x5619f85c6998 "/git/MS-8.0.12_dbg/sql/binlog.cc", line=1422, 
    function=0x5619f85cb8c0 <MYSQL_BIN_LOG::assign_automatic_gtids_to_flush_group(THD*)::__PRETTY_FUNCTION__> "bool MYSQL_BIN_LOG::assign_automatic_gtids_to_flush_group(THD*)") at assert.c:101
#8  0x00005619f6d44024 in MYSQL_BIN_LOG::assign_automatic_gtids_to_flush_group (this=0x5619f97e4dc0 <mysql_bin_log>, first_seen=
    0x7f26aa023000) at /git/MS-8.0.12_dbg/sql/binlog.cc:1422
#9  0x00005619f6d5bef6 in MYSQL_BIN_LOG::process_flush_stage_queue (this=0x5619f97e4dc0 <mysql_bin_log>, 
    total_bytes_var=0x7f26d39a1dd0, rotate_var=0x7f26d39a1dc2, out_queue_var=0x7f26d39a1dd8) at /git/MS-8.0.12_dbg/sql/binlog.cc:8265
#10 0x00005619f6d5d6ff in MYSQL_BIN_LOG::ordered_commit (this=0x5619f97e4dc0 <mysql_bin_log>, thd=0x7f26aa023000, all=true, 
    skip_commit=false) at /git/MS-8.0.12_dbg/sql/binlog.cc:8835
#11 0x00005619f6d5bb4f in MYSQL_BIN_LOG::commit (this=0x5619f97e4dc0 <mysql_bin_log>, thd=0x7f26aa023000, all=true)
    at /git/MS-8.0.12_dbg/sql/binlog.cc:8173
#12 0x00005619f600c2e9 in ha_commit_trans (thd=0x7f26aa023000, all=true, ignore_global_read_lock=false)
    at /git/MS-8.0.12_dbg/sql/handler.cc:1684
#13 0x00005619f5e381c3 in trans_commit_implicit (thd=0x7f26aa023000, ignore_global_read_lock=false)
    at /git/MS-8.0.12_dbg/sql/transaction.cc:325
#14 0x00005619f5cddd47 in mysql_execute_command (thd=0x7f26aa023000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:2691
#15 0x00005619f5ce4f94 in mysql_parse (thd=0x7f26aa023000, parser_state=0x7f26d39a4330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#16 0x00005619f5cdaaeb in dispatch_command (thd=0x7f26aa023000, com_data=0x7f26d39a4c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#17 0x00005619f5cd93c6 in do_command (thd=0x7f26aa023000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#18 0x00005619f5e79678 in handle_connection (arg=0x7f26c13a5480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#19 0x00005619f77e8422 in pfs_spawn_thread (arg=0x7f26c73e7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#20 0x00007f26d53d26db in start_thread (arg=0x7f26d39a5700) at pthread_create.c:463
#21 0x00007f26d3ac788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
# mysqld options required for replay: --sql_mode= 
CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 DOUBLE UNSIGNED ZEROFILL);
SET autocommit=FALSE;
INSERT INTO t1 VALUES(CONVERT(_ucs2 0x06A906270631064A USING utf8));
BINLOG 'wlZOTw8BAAAA8QAAAPUAAAAAAAQANS41LjIxLU1hcmlhREItZGVidWctbG9nAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAEzgNAAgAEgAEBAQEEgAA2QAEGggAAAAICAgCAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAA371saA==';
CREATE TABLE t2(a INT UNSIGNED,b INT UNSIGNED,c BINARY(1),d BINARY (1),e BINARY (1),f VARBINARY(1),g BLOB,h BLOB,id INT,KEY(b));
[12 Aug 2018 1:15] Miguel Solorzano
Thank you for the bug report.
[20 Nov 2018 13:17] Margaret Fisher
Posted by developer:
 
Changelog entry added for MySQL 8.0.14:

An assertion was raised in debug builds if an implicit commit was attempted when the GTID value for the next transaction had not yet been determined (gtid_next=NOT_YET_DETERMINED). The gtid_next system variable has this value immediately after the internal-use statement BINLOG has been issued by mysqlbinlog to execute a format description event. If a statement with an implicit commit was attempted next (such as a CREATE TABLE statement), the gtid_next setting did not transition to AUTOMATIC state, and was left in an unacceptable state. If autocommit was on, the error ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON was also logged when the statement was attempted. 

To fix this issue, the use of the BINLOG statement is now prevented during transactions if it would change the state of gtid_next. The error ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION is returned if this is attempted. Also, when GTIDs are in use and the value of gtid_next is NOT_YET_DETERMINED, the next statement must either explicitly set gtid_next to a valid value or leave the GTID state unaffected. Otherwise the error ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON is returned.