Bug #88258 `trans_table || !changed || thd->get_transaction()->cannot_safely_rollback...
Submitted: 27 Oct 2017 22:53 Modified: 15 Nov 2017 16:30
Reporter: Roel Van de Paar (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:8.0.3 RC OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[27 Oct 2017 22:53] Roel Van de Paar
Description:
2017-10-27T22:21:06.872531Z 0 [Note] /sda/MS201017-mysql-8.0.3-rc-linux-x86_64-debug/bin/mysqld: ready for connections. Version: '8.0.3-rc-debug-log'  socket: '/sda/MS201017-mysql-8.0.3-rc-linux-x86_64-debug/socket.sock'  port: 16654  MySQL Community Server (GPL)
mysqld: /git/mysql-server_dbg/sql/sql_insert.cc:2312: virtual bool Query_result_insert::send_eof(): Assertion `trans_table || !changed || thd->get_transaction()->cannot_safely_rollback( Transaction_ctx::STMT)' failed.
22:22:54 UTC - mysqld got signal 6 ;

Core was generated by `/sda/MS201017-mysql-8.0.3-rc-linux-x86_64-debug/bin/mysqld --no-defaults --core'.
Program terminated with signal 6, Aborted.
#0  0x00007f81ecb0a9b1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
61	  val = INTERNAL_SYSCALL (tgkill, err, 3, THREAD_GETMEM (THREAD_SELF, pid),
(gdb) bt
#0  0x00007f81ecb0a9b1 in __pthread_kill (threadid=<optimized out>, signo=6) at ../nptl/sysdeps/unix/sysv/linux/pthread_kill.c:61
#1  0x000000000369e428 in my_write_core (sig=6) at /git/mysql-server_dbg/mysys/stacktrace.cc:291
#2  0x000000000286b8f6 in handle_fatal_signal (sig=6) at /git/mysql-server_dbg/sql/signal_handler.cc:234
#3  <signal handler called>
#4  0x00007f81eae221f7 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#5  0x00007f81eae238e8 in __GI_abort () at abort.c:90
#6  0x00007f81eae1b266 in __assert_fail_base (fmt=0x7f81eaf6de68 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x44a58b0 "trans_table || !changed || thd->get_transaction()->cannot_safely_rollback( Transaction_ctx::STMT)", file=file@entry=0x44a5170 "/git/mysql-server_dbg/sql/sql_insert.cc", line=line@entry=2312, 
    function=function@entry=0x44a6680 <Query_result_insert::send_eof()::__PRETTY_FUNCTION__> "virtual bool Query_result_insert::send_eof()") at assert.c:92
#7  0x00007f81eae1b312 in __GI___assert_fail (
    assertion=0x44a58b0 "trans_table || !changed || thd->get_transaction()->cannot_safely_rollback( Transaction_ctx::STMT)", 
    file=0x44a5170 "/git/mysql-server_dbg/sql/sql_insert.cc", line=2312, 
    function=0x44a6680 <Query_result_insert::send_eof()::__PRETTY_FUNCTION__> "virtual bool Query_result_insert::send_eof()")
    at assert.c:101
#8  0x0000000002c151b7 in Query_result_insert::send_eof (this=0x7f81a5c30660) at /git/mysql-server_dbg/sql/sql_insert.cc:2310
#9  0x0000000002c1747d in Query_result_create::send_eof (this=0x7f81a5c30660) at /git/mysql-server_dbg/sql/sql_insert.cc:3067
#10 0x0000000002460a3a in JOIN::exec (this=0x7f81a5ad6830) at /git/mysql-server_dbg/sql/sql_executor.cc:241
#11 0x00000000025116ac in handle_query (thd=0x7f81a5c19000, lex=0x7f81a5c1b1e8, result=0x7f81a5c30660, added_options=268435456, 
    removed_options=0) at /git/mysql-server_dbg/sql/sql_select.cc:203
#12 0x0000000002c04081 in Sql_cmd_create_table::execute (this=0x7f81a5c30410, thd=0x7f81a5c19000)
    at /git/mysql-server_dbg/sql/sql_cmd_ddl_table.cc:331
#13 0x00000000024bad4d in mysql_execute_command (thd=0x7f81a5c19000, first_level=true) at /git/mysql-server_dbg/sql/sql_parse.cc:3441
#14 0x00000000024c042b in mysql_parse (thd=0x7f81a5c19000, parser_state=0x7f81ed0b02f0) at /git/mysql-server_dbg/sql/sql_parse.cc:5414
#15 0x00000000024b68e7 in dispatch_command (thd=0x7f81a5c19000, com_data=0x7f81ed0b0b80, command=COM_QUERY)
    at /git/mysql-server_dbg/sql/sql_parse.cc:1708
#16 0x00000000024b53f5 in do_command (thd=0x7f81a5c19000) at /git/mysql-server_dbg/sql/sql_parse.cc:1291
#17 0x000000000285b2d6 in handle_connection (arg=0x7f81d8eeb3c0)
    at /git/mysql-server_dbg/sql/conn_handler/connection_handler_per_thread.cc:328
#18 0x00000000036ec54d in pfs_spawn_thread (arg=0x7f81d8f91620) at /git/mysql-server_dbg/storage/perfschema/pfs.cc:2985
#19 0x00007f81ecb05e25 in start_thread (arg=0x7f81ed0b1700) at pthread_create.c:308
#20 0x00007f81eaee534d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

How to repeat:
CREATE DATABASE test;
USE test;
CREATE TABLE t1(a int key)engine=InnoDB;
SET @@session.default_storage_engine='MEMORY';
CALL sys.create_synonym_db('test','test1');
DROP TABLE t1;
CREATE TABLE t1 SELECT 1;
[27 Oct 2017 23:23] Miguel Solorzano
Thank you for the bug report.
[27 Oct 2017 23:33] Roel Van de Paar
This bug is all over the runs. Will add few more testcases.
[27 Oct 2017 23:39] Roel Van de Paar
# mysqld options required for replay:  --sql_mode=
CREATE DATABASE test;
USE test;
SET @@session.default_storage_engine=MYISAM;
CREATE TABLE t4(id INT,KEY (id)) ENGINE=none;
CREATE TABLE t1(a int KEY,b int)ENGINE=INNODB;
INSERT INTO t1(a,b)VALUES (1.25e-94,1.25e-94);
CREATE VIEW bug48506_t2 AS SELECT * FROM t4;
CREATE TEMPORARY TABLE t1(c1 INT);
drop table if exists t1,t2,t3,t1m,t1i,t2m,t2i,t4;
create table t4 select t1.* from t1;

# mysqld options required for replay:  --sql_mode=
CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 SMALLINT ,c2 INTEGER ,c3 INT ,c4 VARCHAR(1) );
CREATE VIEW test.v2 AS SELECT * FROM test.t1;
SET default_storage_engine=MyISAM;
DROP TABLE t1;
create TABLE t1 as select concat(tan(0.5)) as c1;
[15 Nov 2017 16:30] Paul Dubois
Posted by developer:
 
Fixed in 8.0.4, 9.0.0.

CREATE TABLE ... SELECT statements that attempted to create a
non-InnoDB table raised an assertion if a pre-existing view
referenced the table to be created.