Bug #91987 Assertion `rc == TYPE_OK' failed.
Submitted: 13 Aug 2018 4:34 Modified: 25 Oct 2018 9:51
Reporter: Roel Van de Paar Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any
Tags: debug

[13 Aug 2018 4:34] Roel Van de Paar
Description:
mysqld: /git/MS-8.0.12_dbg/sql/dd/impl/raw/raw_record.cc:171: bool dd::Raw_record::store(int, ulonglong, bool): Assertion `rc == TYPE_OK' failed.

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 0x7fc730766700 (LWP 26258))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x00005604a327c78d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x00005604a1fd0d94 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  0x00007fc7307a7801 in __GI_abort () at abort.c:79
#6  0x00007fc73079739a in __assert_fail_base (fmt=0x7fc73091e7d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=assertion@entry=0x5604a4767edd "rc == TYPE_OK",
    file=file@entry=0x5604a4767e88 "/git/MS-8.0.12_dbg/sql/dd/impl/raw/raw_record.cc", line=line@entry=171,
    function=function@entry=0x5604a4768040 <dd::Raw_record::store(int, unsigned long long, bool)::__PRETTY_FUNCTION__> "bool dd::Raw_record::store(int, ulonglong, bool)") at assert.c:92
#7  0x00007fc730797412 in __GI___assert_fail (assertion=0x5604a4767edd "rc == TYPE_OK",
    file=0x5604a4767e88 "/git/MS-8.0.12_dbg/sql/dd/impl/raw/raw_record.cc", line=171,
    function=0x5604a4768040 <dd::Raw_record::store(int, unsigned long long, bool)::__PRETTY_FUNCTION__> "bool dd::Raw_record::store(int, ulonglong, bool)") at assert.c:101
#8  0x00005604a30e32e9 in dd::Raw_record::store (this=0x7fc707caa1e0, field_no=11, ull=4294967296, is_null=false)
    at /git/MS-8.0.12_dbg/sql/dd/impl/raw/raw_record.cc:171
#9  0x00005604a3183b53 in dd::Trigger_impl::store_attributes (this=0x7fc707ca9880, r=0x7fc707caa1e0)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/trigger_impl.cc:166
#10 0x00005604a318b060 in dd::Weak_object_impl::store (this=0x7fc707ca9960, otx=0x7fc730760e90)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/weak_object_impl.cc:119
#11 0x00005604a2f3c313 in dd::Collection<dd::Trigger*>::store_items (this=0x7fc707c1ec38, otx=0x7fc730760e90)
    at /git/MS-8.0.12_dbg/sql/dd/collection.cc:220
#12 0x00005604a3170f4b in dd::Table_impl::store_triggers (this=0x7fc707c1ea00, otx=0x7fc730760e90)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/table_impl.cc:350
#13 0x00005604a3170ffc in dd::Table_impl::store_children (this=0x7fc707c1ea00, otx=0x7fc730760e90)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/table_impl.cc:360
#14 0x00005604a318afd4 in dd::Weak_object_impl::store (this=0x7fc707c1ea00, otx=0x7fc730760e90)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/weak_object_impl.cc:110
#15 0x00005604a30cbad8 in dd::cache::Storage_adapter::store<dd::Table> (thd=0x7fc707c23000, object=0x7fc707c1ec78)
   _dbg/sql/dd/impl/cache/storage_adapter.cc:296
#16 0x00005604a2fc3a48 in dd::cache::Dictionary_client::update<dd::Table> (this=0x7fc707c49000, new_object=0x7fc707c1ec78)
    at /git/MS-8.0.12_dbg/sql/dd/impl/cache/dictionary_client.cc:2491
#17 0x00005604a2f8ba48 in dd::create_trigger (thd=0x7fc707c23000, new_trigger=0x7fc707c46158, ordering_clause=TRG_ORDER_NONE, 
    referenced_trigger_name=...) at /git/MS-8.0.12_dbg/sql/dd/dd_trigger.cc:234
#18 0x00005604a1f76757 in Table_trigger_dispatcher::create_trigger (this=0x7fc707c45e28, thd=0x7fc707c23000, 
    binlog_create_trigger_stmt=0x7fc730763100) at /git/MS-8.0.12_dbg/sql/table_trigger_dispatcher.cc:315
#19 0x00005604a1f161d3 in Sql_cmd_create_trigger::execute (this=0x7fc707c701f0, thd=0x7fc707c23000)
    at /git/MS-8.0.12_dbg/sql/sql_trigger.cc:501
#20 0x00005604a1e27957 in mysql_execute_command (thd=0x7fc707c23000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4146
#21 0x00005604a1e29f94 in mysql_parse (thd=0x7fc707c23000, parser_state=0x7fc730765330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#22 0x00005604a1e1faeb in dispatch_command (thd=0x7fc707c23000, com_data=0x7fc730765c90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#23 0x00005604a1e1e3c6 in do_command (thd=0x7fc707c23000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#24 0x00005604a1fbe678 in handle_connection (arg=0x7fc71dfa5480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#25 0x00005604a392d422 in pfs_spawn_thread (arg=0x7fc723fe7720) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#26 0x00007fc7321936db in start_thread (arg=0x7fc730766700) at pthread_create.c:463
#27 0x00007fc73088888f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

How to repeat:
CREATE DATABASE test;
USE test;
CREATE TABLE t1 (a INT PRIMARY KEY, b LONGBLOB, c INT, UNIQUE(c)) ENGINE=InnoDB;
SET sql_mode=2147483648*2;
CREATE TRIGGER t1_before_insert BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t3 VALUES (1, NEW.a, NULL, CONCAT("BI: ", NEW.b)); ;
[13 Aug 2018 4:35] Roel Van de Paar
Please check if no connection with bug 86282
[13 Aug 2018 5:38] MySQL Verification Team
Hello Roel,

Thank you for the report.
Observed that 8.0.12 debug build is affected.

thanks,
Umesh
[13 Aug 2018 20:18] Roel Van de Paar
This bug is all over the runs.
[13 Aug 2018 20:20] Roel Van de Paar
Secondary testcase. To run this one, use mysql> SOURCE bug91987_testcase2.sql

Attachment: bug91987_testcase2.sql (application/sql, text), 259 bytes.

[13 Aug 2018 20:21] Roel Van de Paar
Stack for secondary testcase above

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 0x7f881aef0700 (LWP 29939))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055b2faeaa78d in my_write_core (sig=6) at /git/MS-8.0.12_dbg/mysys/stacktrace.cc:278
#2  0x000055b2f9bfed94 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  0x00007f881af31801 in __GI_abort () at abort.c:79
#6  0x00007f881af2139a in __assert_fail_base (fmt=0x7f881b0a87d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x55b2fc395edd "rc == TYPE_OK", 
    file=file@entry=0x55b2fc395e88 "/git/MS-8.0.12_dbg/sql/dd/impl/raw/raw_record.cc", line=line@entry=158, 
    function=function@entry=0x55b2fc396000 <dd::Raw_record::store(int, std::__cxx11::basic_string<char, std::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, bool)::__PRETTY_FUNCTION__> "bool dd::Raw_record::store(int, const String_type&, bool)") at assert.c:92
#7  0x00007f881af21412 in __GI___assert_fail (assertion=0x55b2fc395edd "rc == TYPE_OK", 
    file=0x55b2fc395e88 "/git/MS-8.0.12_dbg/sql/dd/impl/raw/raw_record.cc", line=158, 
    function=0x55b2fc396000 <dd::Raw_record::store(int, std::__cxx11::basic_string<char, std::char_traits<char>, Stateless_allocator<char, dd::String_type_alloc, My_free_functor> > const&, bool)::__PRETTY_FUNCTION__> "bool dd::Raw_record::store(int, const String_type&, bool)") at assert.c:101
#8  0x000055b2fad1124a in dd::Raw_record::store (this=0x7f87ec4aa1b8, field_no=22, 
    s="\202\240\202\242\202\244\203G\202\250\202\251\202\253\202\255\202\257\202\261\202\240\202\242\202\244\202\246\202\250\202\251\202\253\202\255\202\257\202\261\202\240\202\242\202\244\202\246\202\250\202\251\202\253\202\255\202\257\202\261\202\240\202\242\202\244\202\246\202\250\202\251\202\253\202\255\202\257\202\261\202\240\202\242\202\244\202\246\202\250\202\251\202\253\202\255\202\257\202\261\202\240\202\242\202\244\202\246\202\250\202\251\202\253\202\255\202\257\202\261", is_null=false)
    at /git/MS-8.0.12_dbg/sql/dd/impl/raw/raw_record.cc:158
#9  0x000055b2fad740cf in dd::Column_impl::store_attributes (this=0x7f87ec5a6800, r=0x7f87ec4aa1b8)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/column_impl.cc:318
#10 0x000055b2fadb9060 in dd::Weak_object_impl::store (this=0x7f87ec5a6800, otx=0x7f881aee9430)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/weak_object_impl.cc:119
#11 0x000055b2fab683a0 in dd::Collection<dd::Column*>::store_items (this=0x7f87ec41ea58, otx=0x7f881aee9430)
    at /git/MS-8.0.12_dbg/sql/dd/collection.cc:220
#12 0x000055b2fad6aedf in dd::Abstract_table_impl::store_children (this=0x7f87ec41ea00, otx=0x7f881aee9430)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/abstract_table_impl.cc:110
#13 0x000055b2fad9ef8b in dd::Table_impl::store_children (this=0x7f87ec41ea00, otx=0x7f881aee9430)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/table_impl.cc:356
#14 0x000055b2fadb9199 in dd::Weak_object_impl::store (this=0x7f87ec41ea00, otx=0x7f881aee9430)
    at /git/MS-8.0.12_dbg/sql/dd/impl/types/weak_object_impl.cc:147
#15 0x000055b2facf9ad8 in dd::cache::Storage_adapter::store<dd::Table> (thd=0x7f87ec423000, object=0x7f87ec41ec78)
    at /git/MS-8.0.12_dbg/sql/dd/impl/cache/storage_adapter.cc:296
#16 0x000055b2fabf15cf in dd::cache::Dictionary_client::store<dd::Table> (this=0x7f87ec449000, object=0x7f87ec41ec78)
    at /git/MS-8.0.12_dbg/sql/dd/impl/cache/dictionary_client.cc:2418
#17 0x000055b2f9b0616f in mysql_inplace_alter_table (thd=0x7f87ec423000, schema=..., new_schema=..., table_def=0x0, 
    altered_table_def=0x7f87ec41ec78, table_list=0x7f87ec470058, table=0x0, altered_table=0x7f87ec4ca820, 
    ha_alter_info=0x7f881aeeaee0, inplace_supported=HA_ALTER_INPLACE_INSTANT, target_mdl_request=0x7f881aeebff0, 
    alter_ctx=0x7f881aeec900, columns=std::set with 0 elements, fk_key_info=0x7f87ec5ae410, fk_key_count=0, 
    fk_invalidator=0x7f881aee9f70) at /git/MS-8.0.12_dbg/sql/sql_table.cc:10727
#18 0x000055b2f9b0f9c0 in mysql_alter_table (thd=0x7f87ec423000, new_db=0x7f87ec4705e0 "test", new_name=0x0, 
    create_info=0x7f881aeed8b0, table_list=0x7f87ec470058, alter_info=0x7f881aeed9a0) at /git/MS-8.0.12_dbg/sql/sql_table.cc:13760
#19 0x000055b2f9fdce7a in Sql_cmd_alter_table::execute (this=0x7f87ec4706c0, thd=0x7f87ec423000)
    at /git/MS-8.0.12_dbg/sql/sql_alter.cc:330
#20 0x000055b2f9a55a19 in mysql_execute_command (thd=0x7f87ec423000, first_level=true) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4210
#21 0x000055b2f9a57f94 in mysql_parse (thd=0x7f87ec423000, parser_state=0x7f881aeef330) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:4925
#22 0x000055b2f9a4daeb in dispatch_command (thd=0x7f87ec423000, com_data=0x7f881aeefc90, command=COM_QUERY)
    at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1607
#23 0x000055b2f9a4c3c6 in do_command (thd=0x7f87ec423000) at /git/MS-8.0.12_dbg/sql/sql_parse.cc:1232
#24 0x000055b2f9bec678 in handle_connection (arg=0x7f88087bc480)
    at /git/MS-8.0.12_dbg/sql/conn_handler/connection_handler_per_thread.cc:308
#25 0x000055b2fb55b422 in pfs_spawn_thread (arg=0x7f880e7e7820) at /git/MS-8.0.12_dbg/storage/perfschema/pfs.cc:2836
#26 0x00007f881c91d6db in start_thread (arg=0x7f881aef0700) at pthread_create.c:463
#27 0x00007f881b01288f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
[13 Aug 2018 20:41] Roel Van de Paar
Another testcase

CREATE DATABASE test;
USE test;
set time_zone='-6:00';
CREATE TABLE t1(a int key,b int,key (b));
create view v1 as select 5 FROM t1 order by 1;
SET TIMESTAMP=1235;
DROP TABLE t1;
CREATE TABLE t1(c1 REAL,c2 CHAR,c3 INT,c4 CHAR KEY,c5 REAL UNIQUE KEY,c6 DECIMAL(0,0)DEFAULT 3.141592);
[13 Aug 2018 20:42] Roel Van de Paar
Another one

CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 INT,c2 BINARY (1),c3 INT(1),c4 VARBINARY(1) KEY,c5 INT UNIQUE KEY,c6 FIXED(0,0) DEFAULT 3.141592);
CREATE VIEW v1 AS SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1(c1 CHAR (1));
alter view v1 as select * FROM t1 with cascaded check option;
set timestamp=1;
DROP TABLE t1;
SET @@time_zone="-12:00";
CREATE TABLE t1(c1 INT);
[13 Aug 2018 20:43] Roel Van de Paar
Please fix this bug. Please also check if this issue is not present in optimized binaries.
[15 Aug 2018 8:05] Tor Didriksen
Posted by developer:
 
This may actually be several bugs, I don't know. Analyzed this a bit:

CREATE TABLE t1 (a INT PRIMARY KEY, b LONGBLOB, c INT, UNIQUE(c))
ENGINE=InnoDB;
#SET sql_mode=2147483648*2;
#SET sql_mode=4294967296;
SET sql_mode='time_truncate_fractional';
#SET sql_mode=4294967295;
CREATE TRIGGER t1_before_insert BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO
t3 VALUES (1, NEW.a, NULL, CONCAT("BI: ", NEW.b)); ;

This one fails, seemingly because the underlying typelib for sql_mode has too small range.

commit 52e261fb51bcdf6cf0d246ae292090d615627fa0
Author: Gopal Shankar <gopal.shankar@oracle.com>
    
Added internal/mysql-test/std_data/new_dd.sql

+# Added sql_mode elements and making it as SET, instead of ENUM
+CREATE TABLE IF NOT EXISTS triggers (
...
...
+sql_mode SET(
+'MODE_REAL_AS_FLOAT', 'MODE_PIPES_AS_CONCAT', 'MODE_ANSI_QUOTES', 'MODE_IGNORE_SPACE',
+'MODE_NOT_USED', 'MODE_ONLY_FULL_GROUP_BY', 'MODE_NO_UNSIGNED_SUBTRACTION', 'MODE_NO_DIR_IN_CREATE',
+'MODE_POSTGRESQL', 'MODE_ORACLE', 'MODE_MSSQL', 'MODE_DB2', 'MODE_MAXDB', 'MODE_NO_KEY_OPTIONS',
+'MODE_NO_TABLE_OPTIONS', 'MODE_NO_FIELD_OPTIONS', 'MODE_MYSQL323', 'MODE_MYSQL40', 'MODE_ANSI',
+'MODE_NO_AUTO_VALUE_ON_ZERO', 'MODE_NO_BACKSLASH_ESCAPES', 'MODE_STRICT_TRANS_TABLES',
+'MODE_STRICT_ALL_TABLES', 'MODE_NO_ZERO_IN_DATE', 'MODE_NO_ZERO_DATE', 'MODE_INVALID_DATES',
+'MODE_ERROR_FOR_DIVISION_BY_ZERO', 'MODE_TRADITIONAL', 'MODE_NO_AUTO_CREATE_USER',
+'MODE_HIGH_NOT_PRECEDENCE', 'MODE_NO_ENGINE_SUBSTITUTION', 'MODE_PAD_CHAR_TO_FULL_LENGTH'
+) NOT NULL,

i.e. not support for time_truncate_fractional
[24 Sep 2018 14:04] Dyre Tjeldvoll
Posted by developer:
 
Duplicate of bug#28642918
[25 Oct 2018 9:51] Erlend Dahl
Fixed in 8.0.14 under the heading of

Bug#28642918 ASSERTION `RC == TYPE_OK' FAILED IN RAW_RECORD.CC