[MDEV-19663] Got error 127 and ER_CRASHED_ON_USAGE upon SELECT from temporary MyISAM table Created: 2019-05-31  Updated: 2021-04-03  Resolved: 2021-04-03

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Temporary, Storage Engine - MyISAM
Affects Version/s: 10.2, 10.3, 10.4
Fix Version/s: 10.2.26, 10.3.17, 10.4.6

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

Issue Links:
Relates
relates to MDEV-20467 Multiple "Warning: Enabling keys got ... Open

 Description   

CREATE TEMPORARY TABLE t1 (c VARCHAR(8)) ENGINE=MyISAM;
INSERT INTO t1 () VALUES ();
DELETE FROM t1 LIMIT 1;
SELECT * FROM t1 t1a, t1 t1b;
OPTIMIZE TABLE t1;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP x, CHANGE COLUMN IF EXISTS a b BINARY;
INSERT INTO t1 () VALUES ();
SELECT * FROM t1 t1a, t1 t1b;

10.2 1d0c2741

mysqltest: At line 9: query 'SELECT * FROM t1 t1a, t1 t1b' failed: 1194: Table 't1' is marked as crashed and should be repaired

2019-05-31 16:35:51 139826620962560 [ERROR] Got error 127 when reading table '/data/bld/10.2-rel/mysql-test/var/tmp/mysqld.1/#sql6fe2_4_0'
2019-05-31 16:35:51 139826620962560 [ERROR] mysqld: Table 't1' is marked as crashed and should be repaired

Debug and non-debug builds are equally affected.
The test case is not applicable to 10.1 which couldn't re-open a temporary table.



 Comments   
Comment by Elena Stepanova [ 2019-05-31 ]

Taking it a little further, we can also get a debug assertion failure:

CREATE TEMPORARY TABLE t1 (c VARCHAR(8), KEY(c)) ENGINE=MyISAM;
ALTER TABLE t1 DISABLE KEYS;
INSERT INTO t1 () VALUES ();
DELETE FROM t1 LIMIT 1;
SELECT * FROM t1 t1a, t1 t1b;
OPTIMIZE TABLE t1;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP x, CHANGE COLUMN IF EXISTS a b BINARY;
INSERT INTO t1 () VALUES ();
--error 1194
SELECT * FROM t1 t1a, t1 t1b;
ALTER TABLE t1 ENABLE KEYS;

10.3 e99ed820

2019-05-31 16:58:00 4 [ERROR] Got error 127 when reading table '/data/bld/10.3-debug/mysql-test/var/tmp/mysqld.1/#sql410c_4_0'
2019-05-31 16:58:00 4 [ERROR] mysqld: Table 't1' is marked as crashed and should be repaired
mysqld: /data/src/10.3/sql/sql_error.cc:335: void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*): Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed.
190531 16:58:00 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f6f271a8f12 in __GI___assert_fail (assertion=0x559cc571b4d8 "!is_set() || (m_status == DA_OK_BULK && is_bulk_op())", file=0x559cc571b418 "/data/src/10.3/sql/sql_error.cc", line=335, function=0x559cc571b7c0 <Diagnostics_area::set_ok_status(unsigned long long, unsigned long long, char const*)::__PRETTY_FUNCTION__> "void Diagnostics_area::set_ok_status(ulonglong, ulonglong, const char*)") at assert.c:101
#8  0x0000559cc4b6f4e7 in Diagnostics_area::set_ok_status (this=0x7f6f10006078, affected_rows=0, last_insert_id=0, message=0x0) at /data/src/10.3/sql/sql_error.cc:335
#9  0x0000559cc4b1e4d2 in my_ok (thd=0x7f6f10000b00, affected_rows_arg=0, id=0, message=0x0) at /data/src/10.3/sql/sql_class.h:4877
#10 0x0000559cc4c94f5e in simple_tmp_rename_or_index_change (thd=0x7f6f10000b00, table_list=0x7f6f100128f0, keys_onoff=Alter_info::ENABLE, alter_ctx=0x7f6f213a58d0) at /data/src/10.3/sql/sql_table.cc:8920
#11 0x0000559cc4c966e7 in mysql_alter_table (thd=0x7f6f10000b00, new_db=0x7f6f100051d8, new_name=0x7f6f10005598, create_info=0x7f6f213a64c0, table_list=0x7f6f100128f0, alter_info=0x7f6f213a6400, order_num=0, order=0x0, ignore=false) at /data/src/10.3/sql/sql_table.cc:9464
#12 0x0000559cc4d1eb6b in Sql_cmd_alter_table::execute (this=0x7f6f10012f40, thd=0x7f6f10000b00) at /data/src/10.3/sql/sql_alter.cc:488
#13 0x0000559cc4bbf677 in mysql_execute_command (thd=0x7f6f10000b00) at /data/src/10.3/sql/sql_parse.cc:6299
#14 0x0000559cc4bc4988 in mysql_parse (thd=0x7f6f10000b00, rawbuf=0x7f6f10012808 "ALTER TABLE t1 ENABLE KEYS", length=26, parser_state=0x7f6f213a75f0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:8105
#15 0x0000559cc4bb19ca in dispatch_command (command=COM_QUERY, thd=0x7f6f10000b00, packet=0x7f6f10008c61 "ALTER TABLE t1 ENABLE KEYS", packet_length=26, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1858
#16 0x0000559cc4bb03ed in do_command (thd=0x7f6f10000b00) at /data/src/10.3/sql/sql_parse.cc:1403
#17 0x0000559cc4d19133 in do_handle_one_connection (connect=0x559cc84f6f50) at /data/src/10.3/sql/sql_connect.cc:1402
#18 0x0000559cc4d18eaa in handle_one_connection (arg=0x559cc84f6f50) at /data/src/10.3/sql/sql_connect.cc:1308
#19 0x0000559cc55f17e0 in pfs_spawn_thread (arg=0x559cc8511e50) at /data/src/10.3/storage/perfschema/pfs.cc:1862
#20 0x00007f6f28d1d4a4 in start_thread (arg=0x7f6f213a8700) at pthread_create.c:456
#21 0x00007f6f27265d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

or, on a non-debug build, ER_NOT_KEYFILE:

mysqltest: At line 12: query 'ALTER TABLE t1 ENABLE KEYS' failed: 1034: Number of rows changed from 1 to 0

Comment by Elena Stepanova [ 2021-04-03 ]

Both ER_CRASHED_ON_USAGE and the assertion failure disappeared after this commit:

commit c8b5fa4afc6c233101b8163ef19c1abc1be0373d
Author: Michael Widenius
Date:   Mon Jun 17 17:50:08 2019 +0300
 
    MDEV-19055 Failures with temporary tables and Aria

It looks very related. Closing as fixed.

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