[MDEV-23469] Assertion `size == space->size' failed in buf_read_ahead_random Created: 2020-08-13  Updated: 2023-04-27

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

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Marko Mäkelä
Resolution: Unresolved Votes: 0
Labels: not-10.1, not-10.5

Issue Links:
Relates
relates to MDEV-22710 Assertion `mode == 16 || mode == 12 |... Closed

 Description   

USE test;
SET SQL_MODE='';
SET GLOBAL innodb_random_read_ahead=1;
CREATE TABLE u (c1 INT, c2 INT, c3 INT, c4 INT, c5 INT) ROW_FORMAT=COMPRESSED;
SET GLOBAL innodb_limit_optimistic_insert_debug=2;
CREATE TABLE t (c INT);
INSERT INTO t VALUES (0),(0),(0),(0);
INSERT INTO t SELECT t.* FROM t,t t2,t t3,t t4,t t5,t t6,t t7;
INSERT INTO u VALUES(0,0,0,0,0);

Leads to:

10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03 (Debug)

mysqld: /test/10.4_dbg/storage/innobase/buf/buf0rea.cc:282: ulint buf_read_ahead_random(page_id_t, ulint, bool): Assertion `size == space->size' failed.

10.4.15 eae968f62d285de97ed607c87bc131cd863d5d03 (Debug)

Core was generated by `/test/MD110820-mariadb-10.4.15-linux-x86_64-dbg/bin/mysqld --no-defaults --core'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
    at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
[Current thread is 1 (Thread 0x14a367e17700 (LWP 211761))]
(gdb) bt
#0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
#1  0x000055f1322618a6 in my_write_core (sig=sig@entry=6) at /test/10.4_dbg/mysys/stacktrace.c:482
#2  0x000055f1319ddcdc in handle_fatal_signal (sig=6) at /test/10.4_dbg/sql/signal_handler.cc:343
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#5  0x000014a3660ae8b1 in __GI_abort () at abort.c:79
#6  0x000014a36609e42a in __assert_fail_base (fmt=0x14a366225a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55f1325e0a86 "size == space->size", file=file@entry=0x55f1325e6f78 "/test/10.4_dbg/storage/innobase/buf/buf0rea.cc", line=line@entry=282, function=function@entry=0x55f1325e7d40 <buf_read_ahead_random(page_id_t, unsigned long, bool)::__PRETTY_FUNCTION__> "ulint buf_read_ahead_random(page_id_t, ulint, bool)") at assert.c:92
#7  0x000014a36609e4a2 in __GI___assert_fail (assertion=assertion@entry=0x55f1325e0a86 "size == space->size", file=file@entry=0x55f1325e6f78 "/test/10.4_dbg/storage/innobase/buf/buf0rea.cc", line=line@entry=282, function=function@entry=0x55f1325e7d40 <buf_read_ahead_random(page_id_t, unsigned long, bool)::__PRETTY_FUNCTION__> "ulint buf_read_ahead_random(page_id_t, ulint, bool)") at assert.c:101
#8  0x000055f131f2ba59 in buf_read_ahead_random (page_id={m_space = 5, m_page_no = 3}, zip_size=zip_size@entry=8192, ibuf=<optimized out>) at /test/10.4_dbg/storage/innobase/buf/buf0rea.cc:282
#9  0x000055f131ef4525 in buf_page_get_low (page_id={m_space = 5, m_page_no = 3}, zip_size=zip_size@entry=8192, rw_latch=rw_latch@entry=1, guess=<optimized out>, guess@entry=0x0, mode=mode@entry=10, file=file@entry=0x55f132587fa0 "/test/10.4_dbg/storage/innobase/row/row0ins.cc", line=<optimized out>, mtr=<optimized out>, err=<optimized out>) at /test/10.4_dbg/storage/innobase/buf/buf0buf.cc:4419
#10 0x000055f131ef6112 in buf_page_get_gen (page_id={m_space = 2, m_page_no = 0}, zip_size=zip_size@entry=8192, rw_latch=rw_latch@entry=1, guess=guess@entry=0x0, mode=mode@entry=10, file=file@entry=0x55f132587fa0 "/test/10.4_dbg/storage/innobase/row/row0ins.cc", line=2613, mtr=0x14a367e12de0, err=0x14a367e1185c) at /test/10.4_dbg/storage/innobase/buf/buf0buf.cc:4942
#11 0x000055f131eae3b8 in btr_cur_search_to_nth_level_func (index=index@entry=0x14a340079980, level=<optimized out>, tuple=tuple@entry=0x14a3400d3100, mode=mode@entry=PAGE_CUR_LE, latch_mode=<optimized out>, latch_mode@entry=2, cursor=cursor@entry=0x14a367e12720, ahi_latch=<optimized out>, file=<optimized out>, line=<optimized out>, mtr=<optimized out>, autoinc=<optimized out>) at /test/10.4_dbg/storage/innobase/btr/btr0cur.cc:1629
#12 0x000055f131d6940f in btr_pcur_open_low (index=index@entry=0x14a340079980, level=<optimized out>, level@entry=0, tuple=tuple@entry=0x14a3400d3100, mode=mode@entry=PAGE_CUR_LE, latch_mode=latch_mode@entry=2, cursor=cursor@entry=0x14a367e12720, file=<optimized out>, line=<optimized out>, autoinc=0, mtr=0x14a367e12de0) at /test/10.4_dbg/storage/innobase/include/btr0pcur.ic:441
#13 0x000055f131d69fa5 in row_ins_clust_index_entry_low (flags=flags@entry=0, mode=mode@entry=2, index=index@entry=0x14a340079980, n_uniq=n_uniq@entry=0, entry=entry@entry=0x14a3400d3100, n_ext=n_ext@entry=0, thr=0x14a3401f88d8) at /test/10.4_dbg/storage/innobase/row/row0ins.cc:2612
#14 0x000055f131d7260b in row_ins_clust_index_entry (index=index@entry=0x14a340079980, entry=entry@entry=0x14a3400d3100, thr=thr@entry=0x14a3401f88d8, n_ext=n_ext@entry=0) at /test/10.4_dbg/storage/innobase/row/row0ins.cc:3195
#15 0x000055f131d7427f in row_ins_index_entry (thr=0x14a3401f88d8, entry=0x14a3400d3100, index=0x14a340079980) at /test/10.4_dbg/storage/innobase/row/row0ins.cc:3320
#16 row_ins_index_entry_step (thr=0x14a3401f88d8, node=0x14a3401f8640) at /test/10.4_dbg/storage/innobase/row/row0ins.cc:3489
#17 row_ins (thr=0x14a3401f88d8, node=0x14a3401f8640) at /test/10.4_dbg/storage/innobase/row/row0ins.cc:3626
#18 row_ins_step (thr=thr@entry=0x14a3401f88d8) at /test/10.4_dbg/storage/innobase/row/row0ins.cc:3765
#19 0x000055f131d94c77 in row_insert_for_mysql (mysql_rec=mysql_rec@entry=0x14a340048990 "\301", prebuilt=0x14a3401f8080, ins_mode=ROW_INS_NORMAL) at /test/10.4_dbg/storage/innobase/row/row0mysql.cc:1422
#20 0x000055f131c18c84 in ha_innobase::write_row (this=0x14a34008a888, record=0x14a340048990 "\301") at /test/10.4_dbg/storage/innobase/handler/ha_innodb.cc:7982
#21 0x000055f1319f01f6 in handler::ha_write_row (this=0x14a34008a888, buf=0x14a340048990 "\301") at /test/10.4_dbg/sql/handler.cc:6742
#22 0x000055f1316ebc74 in write_record (thd=thd@entry=0x14a340015070, table=table@entry=0x14a3400d2070, info=info@entry=0x14a367e13fe0) at /test/10.4_dbg/sql/sql_insert.cc:2060
#23 0x000055f1316f63ba in mysql_insert (thd=thd@entry=0x14a340015070, table_list=0x14a34006d170, fields=@0x14a340019e48: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55f132eaa000 <end_of_list>, last = 0x14a340019e48, elements = 0}, <No data fields>}, values_list=@0x14a340019e90: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14a34006e000, last = 0x14a34006e000, elements = 1}, <No data fields>}, update_fields=@0x14a340019e78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55f132eaa000 <end_of_list>, last = 0x14a340019e78, elements = 0}, <No data fields>}, update_values=@0x14a340019e60: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x55f132eaa000 <end_of_list>, last = 0x14a340019e60, elements = 0}, <No data fields>}, duplic=<optimized out>, ignore=<optimized out>) at /test/10.4_dbg/sql/sql_insert.cc:1078
#24 0x000055f13172da63 in mysql_execute_command (thd=thd@entry=0x14a340015070) at /test/10.4_dbg/sql/sql_parse.cc:4519
#25 0x000055f131735090 in mysql_parse (thd=thd@entry=0x14a340015070, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14a367e16460, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:7896
#26 0x000055f131737920 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14a340015070, packet=packet@entry=0x14a340057071 "INSERT INTO u VALUES(0,0,0,0,0)", packet_length=packet_length@entry=31, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.4_dbg/sql/sql_parse.cc:1834
#27 0x000055f13173b35b in do_command (thd=0x14a340015070) at /test/10.4_dbg/sql/sql_parse.cc:1352
#28 0x000055f1318678b6 in do_handle_one_connection (connect=connect@entry=0x14a364c35790) at /test/10.4_dbg/sql/sql_connect.cc:1412
#29 0x000055f1318679d6 in handle_one_connection (arg=0x14a364c35790) at /test/10.4_dbg/sql/sql_connect.cc:1316
#30 0x000014a3670156db in start_thread (arg=0x14a367e17700) at pthread_create.c:463
#31 0x000014a36618fa3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Bug confirmed present in:
MariaDB: 10.2.34 (dbg), 10.3.25 (dbg), 10.4.15 (dbg)

Bug confirmed not present in:
MariaDB: 10.1.47 (dbg), 10.1.47 (opt), 10.2.34 (opt), 10.3.25 (opt), 10.4.15 (opt), 10.5.6 (dbg), 10.5.6 (opt)
MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)



 Comments   
Comment by Roel Van de Paar [ 2020-08-13 ]

Seems a bit like the opposite of MDEV-22710. This issue is also not stable (sporadic + possibly different stacks).

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