[MDEV-18219] Assertion `index->n_core_null_bytes <= (((index->n_nullable) + 7) / 8)' failed in rec_init_offsets Created: 2019-01-12  Updated: 2019-04-02  Resolved: 2019-02-08

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4
Fix Version/s: 10.4.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-19030 Assertion `index->n_core_null_bytes <... Closed

 Description   

--source include/have_innodb.inc
 
CREATE TABLE t1 (a INT, b INT NOT NULL) ENGINE=InnoDB;
INSERT INTO t1 VALUES 
(0,9),(2,7),(3,1),(3,4),(8,4),(3,7),(6,1),(3,8),(1,2),(4,1),(0,8),(5,3),
(1,3),(1,6),(2,1),(8,7),(6,0),(1,9),(9,4),(0,6),(9,3),(0,9),(9,4),(2,4),
(2,7),(7,8),(8,2),(2,5),(6,1),(4,5),(5,3),(6,8),(4,9),(5,7),(7,5),(5,1),
(8,8),(5,7),(3,8),(0,1),(8,4),(8,3),(9,7),(4,8),(1,1),(0,4),(2,6),(8,5),
(8,8),(8,7),(6,7),(1,7),(9,6),(3,6),(1,9),(0,3),(5,3),(2,4),(0,6),(2,0),
(6,5),(1,6),(2,4),(9,1),(3,0),(6,4),(1,3),(0,8),(3,5),(3,1),(8,9),(9,9),
(7,9),(4,5),(2,2),(3,8),(0,8),(7,1),(2,0),(1,5),(7,3),(4,4),(3,9),(7,2),
(6,2),(0,4),(2,0),(1,5),(5,7),(4,5),(3,7),(6,0),(2,1),(5,0),(1,0),(2,0),
(8,4),(5,7),(3,5),(0,5),(7,6),(5,9),(1,2),(4,2),(8,5),(8,7),(2,8),(1,8),
(4,3),(1,6),(7,8),(3,7),(4,6),(1,1),(3,0),(1,6),(2,0),(3,4),(4,8),(3,9),
(8,0),(4,9),(4,0),(3,9),(6,4),(7,4),(5,8),(4,7),(7,3),(5,9),(2,3),(7,3),
(0,4),(5,9),(9,8),(4,2),(3,6),(2,6),(1,8),(7,0),(0,0),(2,3),(1,2),(3,3),
(2,7),(6,0),(9,0),(6,9),(4,6),(9,8),(0,7),(9,1),(9,6),(4,3),(7,7),(7,7),
(4,1),(4,7),(7,3),(2,8),(5,8),(8,9),(3,9),(7,7),(0,8),(4,9),(3,2),(5,0),
(1,7),(0,3),(2,9),(9,7),(7,5),(6,9),(8,5),(3,6),(1,1),(2,8),(7,9),(4,9),
(6,6),(5,9),(5,3),(9,8),(3,3),(5,6),(0,9),(3,9),(7,9),(7,3),(5,2),(1,4),
(4,4),(8,2),(2,2),(8,3),(9,1),(4,9),(9,8),(1,8),(1,8),(9,1),(1,1),(3,0),
(4,6),(9,3),(3,3),(5,2),(0,1),(3,4),(3,2),(1,3),(4,4),(7,0),(4,6),(7,2),
(4,5),(8,7),(7,8),(8,1),(3,5),(0,6),(3,5),(2,1),(4,4),(3,4),(2,1),(4,1);
INSERT INTO t1 SELECT * FROM t1;
ALTER TABLE t1 DROP a;
 
--source include/restart_mysqld.inc
 
DROP TABLE t1;

10.4 4edb29380c

mysqld: /data/src/10.4/storage/innobase/rem/rem0rec.cc:615: void rec_init_offsets(const rec_t*, const dict_index_t*, bool, ulint*): Assertion `index->n_core_null_bytes <= ((
(index->n_nullable) + 7) / 8)' failed.
190118 15:14:24 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f18f24d2ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x0000564785a7d495 in rec_init_offsets (rec=0x7f18e7c9807e "", index=0x7f18c0014eb8, leaf=false, offsets=0x7f18ce7f9f10) at /data/src/10.4/storage/innobase/rem/rem0rec.cc:615
#9  0x0000564785a7e474 in rec_get_offsets_func (rec=0x7f18e7c9807e "", index=0x7f18c0014eb8, offsets=0x7f18ce7f9f10, leaf=false, n_fields=18446744073709551615, file=0x5647861b97d0 "/data/src/10.4/storage/innobase/btr/btr0cur.cc", line=2759, heap=0x7f18ce7f9818) at /data/src/10.4/storage/innobase/rem/rem0rec.cc:927
#10 0x0000564785bbfae6 in btr_cur_open_at_index_side_func (from_left=true, index=0x7f18c0014eb8, latch_mode=1, cursor=0x7f18ce7fa300, level=0, file=0x5647861b97d0 "/data/src/10.4/storage/innobase/btr/btr0cur.cc", line=426, mtr=0x7f18ce7fa540) at /data/src/10.4/storage/innobase/btr/btr0cur.cc:2759
#11 0x0000564785bb8d7c in btr_cur_instant_init_low (index=0x7f18c0014eb8, mtr=0x7f18ce7fa540) at /data/src/10.4/storage/innobase/btr/btr0cur.cc:425
#12 0x0000564785bb9870 in btr_cur_instant_init (table=0x7f18c0013898) at /data/src/10.4/storage/innobase/btr/btr0cur.cc:616
#13 0x0000564785c6205a in dict_load_table_one (name=..., cached=true, ignore_err=DICT_ERR_IGNORE_NONE, fk_tables=std::deque with 0 elements) at /data/src/10.4/storage/innobase/dict/dict0load.cc:3014
#14 0x0000564785c6116c in dict_load_table (name=0x7f18c000b5b8 "test/t1", cached=true, ignore_err=DICT_ERR_IGNORE_NONE) at /data/src/10.4/storage/innobase/dict/dict0load.cc:2766
#15 0x0000564785c62914 in dict_load_table_on_id (table_id=20, ignore_err=DICT_ERR_IGNORE_NONE) at /data/src/10.4/storage/innobase/dict/dict0load.cc:3178
#16 0x0000564785c40e0a in dict_table_open_on_id_low (table_id=20, ignore_err=DICT_ERR_IGNORE_NONE, cached_only=false) at /data/src/10.4/storage/innobase/dict/dict0dict.cc:424
#17 0x0000564785c424d8 in dict_table_open_on_id (table_id=20, dict_locked=0, table_op=DICT_TABLE_OP_NORMAL) at /data/src/10.4/storage/innobase/dict/dict0dict.cc:1010
#18 0x0000564785aef78a in row_purge_parse_undo_rec (node=0x564787da8798, undo_rec=0x7f18b8015808 "", updated_extern=0x7f18ce7fbdce, thr=0x564787da82f0) at /data/src/10.4/storage/innobase/row/row0purge.cc:1080
#19 0x0000564785af0105 in row_purge (node=0x564787da8798, undo_rec=0x7f18b8015808 "", thr=0x564787da82f0) at /data/src/10.4/storage/innobase/row/row0purge.cc:1258
#20 0x0000564785af03cf in row_purge_step (thr=0x564787da82f0) at /data/src/10.4/storage/innobase/row/row0purge.cc:1347
#21 0x0000564785a720b6 in que_thr_step (thr=0x564787da82f0) at /data/src/10.4/storage/innobase/que/que0que.cc:1042
#22 0x0000564785a722e9 in que_run_threads_low (thr=0x564787da82f0) at /data/src/10.4/storage/innobase/que/que0que.cc:1104
#23 0x0000564785a724da in que_run_threads (thr=0x564787da82f0) at /data/src/10.4/storage/innobase/que/que0que.cc:1144
#24 0x0000564785b2fa37 in srv_task_execute () at /data/src/10.4/storage/innobase/srv/srv0srv.cc:2443
#25 0x0000564785b2fbed in srv_worker_thread (arg=0x0) at /data/src/10.4/storage/innobase/srv/srv0srv.cc:2491
#26 0x00007f18f41a9494 in start_thread (arg=0x7f18ce7fc700) at pthread_create.c:333
#27 0x00007f18f258f93f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Not reproducible on 10.3.



 Comments   
Comment by Elena Stepanova [ 2019-01-13 ]

New occurrence on 10.4: https://travis-ci.org/elenst/travis-tests/jobs/478904041

Comment by Marko Mäkelä [ 2019-02-08 ]

This can be reproduced without restarting by exploiting MDEV-17468 and replacing the end of the test with

ALTER TABLE t1 DROP a;
ALTER TABLE t1 ADD vb INT AS (b) VIRTUAL;
DROP TABLE t1;

It would crash on the ADD, because adding a virtual column will evict and reload the table definition.

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