[MDEV-24420] Assertion `readbytes != (size_t)-1 || (*__errno_location ()) != 9' failed upon ALTER on ARCHIVE table Created: 2020-12-16  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - Archive
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

INSTALL SONAME 'ha_archive';
 
CREATE TEMPORARY TABLE t (a INT) ENGINE=ARCHIVE;
OPTIMIZE TABLE t;
--error ER_CANT_CREATE_TABLE
ALTER TABLE t ADD PRIMARY KEY(a);
 
# Cleanup
DROP TABLE t;
UNINSTALL SONAME 'ha_archive';

10.2 aebb1112

mysqld: /data/src/10.2/mysys/my_pread.c:72: my_pread: Assertion `readbytes != (size_t)-1 || (*__errno_location ()) != 9' failed.
201216 17:33:25 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f3655b84f36 in __GI___assert_fail (assertion=0x55f2dca685e0 "readbytes != (size_t)-1 || (*__errno_location ()) != 9", file=0x55f2dca68570 "/data/src/10.2/mysys/my_pread.c", line=72, function=0x55f2dca686b0 <__PRETTY_FUNCTION__.14575> "my_pread") at assert.c:101
#8  0x000055f2dc7244a7 in my_pread (Filedes=-1, Buffer=0x7f36504dc790 "\320\307MP6\177", Count=78, offset=0, MyFlags=0) at /data/src/10.2/mysys/my_pread.c:72
#9  0x00007f36504862e6 in azflush (s=0x7f3634055c20, flush=2) at /data/src/10.2/storage/archive/azio.c:691
#10 0x00007f365048baf9 in ha_archive::info (this=0x7f3634055798, flag=64) at /data/src/10.2/storage/archive/ha_archive.cc:1714
#11 0x00007f365048b7b9 in ha_archive::update_create_info (this=0x7f3634055798, create_info=0x7f36504de290) at /data/src/10.2/storage/archive/ha_archive.cc:1661
#12 0x000055f2dbe27ed1 in mysql_prepare_alter_table (thd=0x7f3634000d90, table=0x7f3634034e80, create_info=0x7f36504de290, alter_info=0x7f36504de1e0, alter_ctx=0x7f36504dd670) at /data/src/10.2/sql/sql_table.cc:8282
#13 0x000055f2dbe2a8ab in mysql_alter_table (thd=0x7f3634000d90, new_db=0x7f3634012df8 "test", new_name=0x0, create_info=0x7f36504de290, table_list=0x7f36340127e0, alter_info=0x7f36504de1e0, order_num=0, order=0x0, ignore=false) at /data/src/10.2/sql/sql_table.cc:9286
#14 0x000055f2dbea9824 in Sql_cmd_alter_table::execute (this=0x7f3634012ec0, thd=0x7f3634000d90) at /data/src/10.2/sql/sql_alter.cc:333
#15 0x000055f2dbd5816a in mysql_execute_command (thd=0x7f3634000d90) at /data/src/10.2/sql/sql_parse.cc:5993
#16 0x000055f2dbd5d181 in mysql_parse (thd=0x7f3634000d90, rawbuf=0x7f36340126f8 "ALTER TABLE t ADD PRIMARY KEY(a)", length=32, parser_state=0x7f36504df5f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7762
#17 0x000055f2dbd4b47a in dispatch_command (command=COM_QUERY, thd=0x7f3634000d90, packet=0x7f3634008b51 "ALTER TABLE t ADD PRIMARY KEY(a)", packet_length=32, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
#18 0x000055f2dbd49f75 in do_command (thd=0x7f3634000d90) at /data/src/10.2/sql/sql_parse.cc:1381
#19 0x000055f2dbea4219 in do_handle_one_connection (connect=0x55f2de0989c0) at /data/src/10.2/sql/sql_connect.cc:1336
#20 0x000055f2dbea3f7e in handle_one_connection (arg=0x55f2de0989c0) at /data/src/10.2/sql/sql_connect.cc:1241
#21 0x000055f2dc6cb95c in pfs_spawn_thread (arg=0x55f2de07bd80) at /data/src/10.2/storage/perfschema/pfs.cc:1869
#22 0x00007f3656094609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#23 0x00007f3655c70293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Reproducible on 10.2-10.6.
No obvious problem on a non-debug build (it returns ER_CANT_CREATE_TABLE on ALTER, which is probably expected).



 Comments   
Comment by Roel Van de Paar [ 2021-05-04 ]

INSTALL PLUGIN ARCHIVE SONAME 'ha_archive.so';
CREATE TABLE t1 (c1 VARCHAR(10)) ENGINE=ARCHIVE;
LOCK TABLE t1 WRITE;
REPAIR TABLE t1;
ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1 (c1);

Leads to:

10.6.1 9db14e93acc4ec9023d50686c66dbef7d4d8c15c (Debug)

mysqld: /test/10.6_dbg/mysys/my_pread.c:72: my_pread: Assertion `readbytes != (size_t)-1 || (*__errno_location ()) != 9' failed.

10.6.1 9db14e93acc4ec9023d50686c66dbef7d4d8c15c (Debug)

Core was generated by `/test/MD270421-mariadb-10.6.1-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
[Current thread is 1 (Thread 0x147e780fd700 (LWP 106576))]
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x0000147e8c96f859 in __GI_abort () at abort.c:79
#2  0x0000147e8c96f729 in __assert_fail_base (fmt=0x147e8cb05588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x556941069630 "readbytes != (size_t)-1 || (*__errno_location ()) != 9", file=0x5569410695d0 "/test/10.6_dbg/mysys/my_pread.c", line=72, function=<optimized out>) at assert.c:92
#3  0x0000147e8c980f36 in __GI___assert_fail (assertion=assertion@entry=0x556941069630 "readbytes != (size_t)-1 || (*__errno_location ()) != 9", file=file@entry=0x5569410695d0 "/test/10.6_dbg/mysys/my_pread.c", line=line@entry=72, function=function@entry=0x556941069720 <__PRETTY_FUNCTION__.16547> "my_pread") at assert.c:101
#4  0x0000556940c0a0af in my_pread (Filedes=-1, Buffer=Buffer@entry=0x147e780f8db0 " \216\017x~\024", Count=Count@entry=78, offset=offset@entry=0, MyFlags=MyFlags@entry=0) at /test/10.6_dbg/mysys/my_pread.c:72
#5  0x0000147e78092196 in azflush (s=s@entry=0x147e4004e0b0, flush=flush@entry=2) at /test/10.6_dbg/storage/archive/azio.c:691
#6  0x0000147e78097168 in ha_archive::info (this=this@entry=0x147e4004db80, flag=flag@entry=64) at /test/10.6_dbg/storage/archive/ha_archive.cc:1727
#7  0x0000147e78097229 in ha_archive::update_create_info (this=0x147e4004db80, create_info=0x147e780fb540) at /test/10.6_dbg/storage/archive/ha_archive.cc:1674
#8  0x00005569401ada61 in mysql_prepare_alter_table (thd=thd@entry=0x147e40000db8, table=table@entry=0x147e40033df8, create_info=create_info@entry=0x147e780fb540, alter_info=alter_info@entry=0x147e780fb450, alter_ctx=alter_ctx@entry=0x147e780fa910) at /test/10.6_dbg/sql/sql_table.cc:9334
#9  0x00005569401bc159 in mysql_alter_table (thd=thd@entry=0x147e40000db8, new_db=new_db@entry=0x147e400059d8, new_name=new_name@entry=0x147e40005e00, create_info=create_info@entry=0x147e780fb540, table_list=<optimized out>, table_list@entry=0x147e400140d8, alter_info=alter_info@entry=0x147e780fb450, order_num=0, order=0x0, ignore=false, if_exists=false) at /test/10.6_dbg/sql/sql_table.cc:10533
#10 0x000055694024170f in Sql_cmd_alter_table::execute (this=<optimized out>, thd=0x147e40000db8) at /test/10.6_dbg/sql/structs.h:564
#11 0x00005569400e69a1 in mysql_execute_command (thd=thd@entry=0x147e40000db8) at /test/10.6_dbg/sql/sql_parse.cc:5986
#12 0x00005569400ccf81 in mysql_parse (thd=thd@entry=0x147e40000db8, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x147e780fc410) at /test/10.6_dbg/sql/sql_parse.cc:8018
#13 0x00005569400dbdb3 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x147e40000db8, packet=packet@entry=0x147e4000b789 "ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1 (c1)", packet_length=packet_length@entry=48, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_class.h:1332
#14 0x00005569400df1a6 in do_command (thd=0x147e40000db8, blocking=blocking@entry=true) at /test/10.6_dbg/sql/sql_parse.cc:1406
#15 0x0000556940239a6a in do_handle_one_connection (connect=<optimized out>, connect@entry=0x55694381db08, put_in_cache=put_in_cache@entry=true) at /test/10.6_dbg/sql/sql_connect.cc:1410
#16 0x000055694023a06f in handle_one_connection (arg=arg@entry=0x55694381db08) at /test/10.6_dbg/sql/sql_connect.cc:1312
#17 0x00005569406ec2ca in pfs_spawn_thread (arg=0x556943707348) at /test/10.6_dbg/storage/perfschema/pfs.cc:2201
#18 0x0000147e8ce7d609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#19 0x0000147e8ca6c293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.2.38 (dbg), 10.3.29 (dbg), 10.4.19 (dbg), 10.5.10 (dbg), 10.6.1 (dbg)

Bug (or feature/syntax) confirmed not present in:
MariaDB: 10.2.38 (opt), 10.3.29 (opt), 10.4.19 (opt), 10.5.10 (opt), 10.6.1 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.51 (dbg), 5.6.51 (opt), 5.7.34 (dbg), 5.7.34 (opt), 8.0.24 (dbg), 8.0.24 (opt)

Generated at Thu Feb 08 09:29:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.