[MDEV-19055] Assertion `(_my_thread_var())->thr_errno != 0' failed in pagecache_read Created: 2019-03-26  Updated: 2019-06-18  Resolved: 2019-06-18

Status: Closed
Project: MariaDB Server
Component/s: Data Definition - Alter Table, Data Definition - Temporary, Storage Engine - Aria
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: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-17636 Assertion `pagecache->block_root[i].s... Closed
is duplicated by MDEV-17659 Error 175 "File too short; Expected m... Closed

 Description   

Note: It's probably related to a dozen of other bugs which end up with corrupted Aria tables, but I can't tell which, so I'm filing it separately.

CREATE TABLE t1 (x INT) ENGINE=Aria;
CREATE TEMPORARY TABLE t2 (a TIME) ENGINE=Aria;
ALTER TABLE t2 ADD b DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE t2 ADD CHECK (b = 4);
INSERT IGNORE INTO t2 () VALUES (),(),(),();
ALTER IGNORE TABLE t2 ADD c INT;
DELETE FROM t2 ORDER BY c LIMIT 1;
INSERT IGNORE INTO t2 SELECT * FROM t2;
OPTIMIZE TABLE t2;
SET SQL_MODE= 'STRICT_ALL_TABLES';
--error ER_TRUNCATED_WRONG_VALUE
ALTER TABLE t2 CHANGE IF EXISTS d c INT;
--error ER_GET_ERRNO
ALTER IGNORE TABLE t2 ADD IF NOT EXISTS e BIT;
ALTER TABLE t1 MODIFY IF EXISTS xx INT;
INSERT IGNORE INTO t2 () VALUES (),(),(),();
 
# Cleanup
DROP TABLE t1;

Of course, by the time ER_GET_ERRNO occurs, it is already in trouble, but we allow to proceed it to reach the assertion failure.

10.4 8b480df6

mysqld: /data/src/10.4/storage/maria/ma_pagecache.c:3500: pagecache_read: Assertion `(_my_thread_var())->thr_errno != 0' failed.
190327  0:04:00 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f97dad22ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000558c93bd568b in pagecache_read (pagecache=0x558c9575f900 <maria_pagecache_var>, file=0x7f97c4047820, pageno=1, level=0, buff=0x7f97d5a4e080 "", type=PAGECACHE_PLAIN_PAGE, lock=PAGECACHE_LOCK_WRITE, page_link=0x7f97d4e9af00) at /data/src/10.4/storage/maria/ma_pagecache.c:3500
#9  0x0000558c93c0cd50 in get_head_or_tail_page (info=0x7f97c40473d0, block=0x7f97c41348a8, buff=0x7f97c4047b00 "", length=16, page_type=1, lock=PAGECACHE_LOCK_WRITE, res=0x7f97d4e9afc0) at /data/src/10.4/storage/maria/ma_blockrec.c:1780
#10 0x0000558c93c11801 in allocate_and_write_block_record (info=0x7f97c40473d0, record=0x7f97c41509e0 "\377\200", row=0x7f97c4047440, undo_lsn=1) at /data/src/10.4/storage/maria/ma_blockrec.c:3543
#11 0x0000558c93c11abe in _ma_write_init_block_record (info=0x7f97c40473d0, record=0x7f97c41509e0 "\377\200") at /data/src/10.4/storage/maria/ma_blockrec.c:3604
#12 0x0000558c93c23aef in maria_write (info=0x7f97c40473d0, record=0x7f97c41509e0 "\377\200") at /data/src/10.4/storage/maria/ma_write.c:157
#13 0x0000558c93ba6f19 in ha_maria::write_row (this=0x7f97c4150e38, buf=0x7f97c41509e0 "\377\200") at /data/src/10.4/storage/maria/ha_maria.cc:1326
#14 0x0000558c9398e3b6 in handler::ha_write_row (this=0x7f97c4150e38, buf=0x7f97c41509e0 "\377\200") at /data/src/10.4/sql/handler.cc:6704
#15 0x0000558c935f22a1 in write_record (thd=0x7f97c4000b00, table=0x7f97c414fb70, info=0x7f97d4e9b470) at /data/src/10.4/sql/sql_insert.cc:2021
#16 0x0000558c935ef65f in mysql_insert (thd=0x7f97c4000b00, table_list=0x7f97c40156e0, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=true) at /data/src/10.4/sql/sql_insert.cc:1067
#17 0x0000558c9363b5ed in mysql_execute_command (thd=0x7f97c4000b00) at /data/src/10.4/sql/sql_parse.cc:4790
#18 0x0000558c93647342 in mysql_parse (thd=0x7f97c4000b00, rawbuf=0x7f97c40155d8 "INSERT IGNORE INTO t2 () VALUES (),(),(),()", length=43, parser_state=0x7f97d4e9c180, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8152
#19 0x0000558c93632ad2 in dispatch_command (command=COM_QUERY, thd=0x7f97c4000b00, packet=0x7f97c4139251 "INSERT IGNORE INTO t2 () VALUES (),(),(),()", packet_length=43, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1832
#20 0x0000558c936312b8 in do_command (thd=0x7f97c4000b00) at /data/src/10.4/sql/sql_parse.cc:1365
#21 0x0000558c937aafef in do_handle_one_connection (connect=0x558c960814e0) at /data/src/10.4/sql/sql_connect.cc:1398
#22 0x0000558c937aad60 in handle_one_connection (arg=0x558c960814e0) at /data/src/10.4/sql/sql_connect.cc:1301
#23 0x0000558c93ca09bd in pfs_spawn_thread (arg=0x558c961738b0) at /data/src/10.4/storage/perfschema/pfs.cc:1862
#24 0x00007f97dcc11494 in start_thread (arg=0x7f97d4e9d700) at pthread_create.c:333
#25 0x00007f97daddf93f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Michael Widenius [ 2019-06-17 ]

There was two separate problems:

  • Aria pagecache didn't properly handle re-reading of blocks that have given errors before (this triggered an assert)
  • Temporary tables that where opened several times where not properly closed in ALTER, REPAIR or OPTIMIZE table
Comment by Michael Widenius [ 2019-06-18 ]

Pushed to 10.2 tree

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