[MDEV-15742] bb-10.2-compatibility: Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed in handler::ha_write_row Created: 2018-03-30  Updated: 2018-04-06  Resolved: 2018-04-06

Status: Closed
Project: MariaDB Server
Component/s: Sequences
Affects Version/s: N/A
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None


 Description   

CREATE SEQUENCE s;
LOCK TABLE s READ;
SELECT NEXTVAL(s);
 
# Cleanup
DROP SEQUENCE s;

bb-10.2-compatibility 025aee64e0

mysqld: /data/src/bb-10.2-compatibility/sql/handler.cc:6135: int handler::ha_write_row(uchar*): Assertion `table_share->tmp_table != NO_TMP_TABLE || m_lock_type == 1' failed.
180331  1:24:47 [ERROR] mysqld got signal 6 ;
 
#7  0x00007ffa43a83ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x000055d037dee244 in handler::ha_write_row (this=0x7ffa2c0779a8, buf=0x7ffa2c006878 "\377\351\003") at /data/src/bb-10.2-compatibility/sql/handler.cc:6134
#9  0x000055d037d0a729 in sequence_definition::write (this=0x7ffa2c08fd58, table=0x7ffa2c076d70, all_fields=false) at /data/src/bb-10.2-compatibility/sql/sql_sequence.cc:603
#10 0x000055d037d0aa8f in SEQUENCE::next_value (this=0x7ffa2c08fd58, table=0x7ffa2c076d70, second_round=false, error=0x7ffa3dc28250) at /data/src/bb-10.2-compatibility/sql/sql_sequence.cc:710
#11 0x000055d037e6c9ac in Item_func_nextval::val_int (this=0x7ffa2c012f10) at /data/src/bb-10.2-compatibility/sql/item_func.cc:6939
#12 0x000055d037cf4605 in Type_handler::Item_send_longlong (this=0x55d0391f4930 <type_handler_longlong>, item=0x7ffa2c012f10, protocol=0x7ffa2c0010c0, buf=0x7ffa3dc28440) at /data/src/bb-10.2-compatibility/sql/sql_type.cc:5289
#13 0x000055d037cf85de in Type_handler_longlong::Item_send (this=0x55d0391f4930 <type_handler_longlong>, item=0x7ffa2c012f10, protocol=0x7ffa2c0010c0, buf=0x7ffa3dc28440) at /data/src/bb-10.2-compatibility/sql/sql_type.h:2232
#14 0x000055d037a38d40 in Item::send (this=0x7ffa2c012f10, protocol=0x7ffa2c0010c0, buffer=0x7ffa3dc28440) at /data/src/bb-10.2-compatibility/sql/item.h:807
#15 0x000055d037a347ba in Protocol::send_result_set_row (this=0x7ffa2c0010c0, row_items=0x7ffa2c005088) at /data/src/bb-10.2-compatibility/sql/protocol.cc:985
#16 0x000055d037ad3d86 in select_send::send_data (this=0x7ffa2c013098, items=...) at /data/src/bb-10.2-compatibility/sql/sql_class.cc:2921
#17 0x000055d037b6f90f in JOIN::exec_inner (this=0x7ffa2c0130b8) at /data/src/bb-10.2-compatibility/sql/sql_select.cc:3505
#18 0x000055d037b6f382 in JOIN::exec (this=0x7ffa2c0130b8) at /data/src/bb-10.2-compatibility/sql/sql_select.cc:3424
#19 0x000055d037b7054d in mysql_select (thd=0x7ffa2c000b00, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2149845760, result=0x7ffa2c013098, unit=0x7ffa2c004820, select_lex=0x7ffa2c004f60) at /data/src/bb-10.2-compatibility/sql/sql_select.cc:3824
#20 0x000055d037b64950 in handle_select (thd=0x7ffa2c000b00, lex=0x7ffa2c004758, result=0x7ffa2c013098, setup_tables_done_option=0) at /data/src/bb-10.2-compatibility/sql/sql_select.cc:379
#21 0x000055d037b30f93 in execute_sqlcom_select (thd=0x7ffa2c000b00, all_tables=0x7ffa2c0128f8) at /data/src/bb-10.2-compatibility/sql/sql_parse.cc:6511
#22 0x000055d037b2792e in mysql_execute_command (thd=0x7ffa2c000b00) at /data/src/bb-10.2-compatibility/sql/sql_parse.cc:3736
#23 0x000055d037b34a64 in mysql_parse (thd=0x7ffa2c000b00, rawbuf=0x7ffa2c012828 "SELECT NEXTVAL(s)", length=17, parser_state=0x7ffa3dc2a200, is_com_multi=false, is_next_command=false) at /data/src/bb-10.2-compatibility/sql/sql_parse.cc:7978
#24 0x000055d037b226d5 in dispatch_command (command=COM_QUERY, thd=0x7ffa2c000b00, packet=0x7ffa2c08bca1 "", packet_length=17, is_com_multi=false, is_next_command=false) at /data/src/bb-10.2-compatibility/sql/sql_parse.cc:1835
#25 0x000055d037b21019 in do_command (thd=0x7ffa2c000b00) at /data/src/bb-10.2-compatibility/sql/sql_parse.cc:1383
#26 0x000055d037c736a6 in do_handle_one_connection (connect=0x55d03b5c9b90) at /data/src/bb-10.2-compatibility/sql/sql_connect.cc:1335
#27 0x000055d037c73433 in handle_one_connection (arg=0x55d03b5c9b90) at /data/src/bb-10.2-compatibility/sql/sql_connect.cc:1241
#28 0x000055d0380ca66c in pfs_spawn_thread (arg=0x55d03b513560) at /data/src/bb-10.2-compatibility/storage/perfschema/pfs.cc:1862
#29 0x00007ffa4575a494 in start_thread (arg=0x7ffa3dc2b700) at pthread_create.c:333
#30 0x00007ffa43b4093f in clone () from /lib/x86_64-linux-gnu/libc.so.6

A non-debug build produces an odd error

mysqltest: At line 3: query 'SELECT NEXTVAL(s)' failed: 1036: Table './test/s.MYI' is read only

Neither is reproducible on 10.3 (no assertion, and non-debug build produces the more reasonable ER_TABLE_NOT_LOCKED_FOR_WRITE).



 Comments   
Comment by Michael Widenius [ 2018-04-06 ]

The issue is that the compatibility tree is missing some patches that are in 10.3.

Comment by Michael Widenius [ 2018-04-06 ]

Cherry-picked 7 patches from 10.3 to get this fixed.

Other things fixed are:
MDEV-14762 Server crashes in MDL_ticket::has_stronger_or_equal_type
MDEV-14831 CREATE OR REPLACE SEQUENCE under LOCK TABLE corrupts the sequence, causes ER_KEY_NOT_FOUND
MDEV-15149 Assert upon concurrent creating / querying sequences
MDEV 13679 Enabled sequences to be used in DEFAULT

Generated at Thu Feb 08 08:23:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.