[MDEV-16887] innobase/trx/trx0rec.cc .. Assertion `n_idx > 0' failed Created: 2018-08-02  Updated: 2021-07-05  Resolved: 2021-07-05

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Virtual Columns
Affects Version/s: 10.2.17, 10.3.9
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Matthias Leich Assignee: Nikita Malyavin
Resolution: Duplicate Votes: 0
Labels: None
Environment:

Ubuntu 17.10 but most probably unimportant


Attachments: File 7_1.log     File 7_1.tgz     File combinations.cc    
Issue Links:
Duplicate
duplicates MDEV-24971 SEGV in in row_create_prebuilt Closed
Problem/Incident
is caused by MDEV-5800 indexes on virtual (not materialized)... Closed

 Description   

Assert hit during RQG testing.
   10.3 commit 1b87cd80a268d333acbf4fc4a3d7527cb5da3d4d 2018-08-02
compiled from source with debug.
Version: '10.3.9-MariaDB-debug-log'  ...
mysqld: storage/innobase/trx/trx0rec.cc:237: byte* trx_undo_log_v_idx(buf_block_t*, const dict_table_t*, ulint, byte*, bool): Assertion `n_idx > 0' failed.
# 2018-08-02T17:37:00 [17435] | 180802 17:36:55 [ERROR] mysqld got signal 6 ;
...
Query (0x7f4698012d70): INSERT INTO t1 (col1,col2,col_int,col_text) VALUES (1,1,1,REPEAT(CAST( 1 AS CHAR(1)), @fill_amount) ), (1,1,1,REPEAT(CAST( 1 AS CHAR(1)), @fill_amount) ) /* E_R Thread6 QNO 34 CON_ID 20 */
Connection ID (thread ID): 20
Status: NOT_KILLED
...
#3  <signal handler called>
#4  __GI_raise (sig=sig@entry=6)
    at ../sysdeps/unix/sysv/linux/raise.c:51
#5  __GI_abort () 
    at abort.c:90
#6  __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x564f493f1680 "n_idx > 0", file=file@entry=0x564f493f1568 "storage/innobase/trx/trx0rec.cc", line=line@entry=237, function=function@entry=0x564f493f2a80 <trx_undo_log_v_idx(buf_block_t*, dict_table_t const*, unsigned long, unsigned char*, bool)::__PRETTY_FUNCTION__> "byte* trx_undo_log_v_idx(buf_block_t*, const dict_table_t*, ulint, byte*, bool)") 
    at assert.c:92
#7  __GI___assert_fail (assertion=0x564f493f1680 "n_idx > 0", file=0x564f493f1568 "storage/innobase/trx/trx0rec.cc", line=237, function=0x564f493f2a80 <trx_undo_log_v_idx(buf_block_t*, dict_table_t const*, unsigned long, unsigned char*, bool)::__PRETTY_FUNCTION__> "byte* trx_undo_log_v_idx(buf_block_t*, const dict_table_t*, ulint, byte*, bool)") 
    at assert.c:101
#8  trx_undo_log_v_idx (undo_block=0x7f4727fcc400, table=0x7f469c031858, pos=0, ptr=0x7f4728b7b024 "", first_v_col=true) 
    at storage/innobase/trx/trx0rec.cc:237
#9  trx_undo_report_insert_virtual (undo_block=0x7f4727fcc400, table=0x7f469c031858, row=0x7f46a801d3c8, ptr=0x7f473c45aee8) 
    at storage/innobase/trx/trx0rec.cc:417
#10 trx_undo_page_report_insert (undo_block=0x7f4727fcc400, trx=0x7f473e667ad8, index=0x7f469c036a98, clust_entry=0x7f46a801d3c8, mtr=0x7f473c45afe0) 
    at storage/innobase/trx/trx0rec.cc:541
#11 trx_undo_report_row_operation (thr=0x7f4698026940, index=0x7f469c036a98, clust_entry=0x7f46a801d3c8, update=0x0, cmpl_info=0, rec=0x0, offsets=0x0, roll_ptr=0x7f473c45b580) 
    at storage/innobase/trx/trx0rec.cc:2023
#12 btr_cur_ins_lock_and_undo (flags=0, cursor=0x7f473c45ba90, entry=0x7f46a801d3c8, thr=0x7f4698026940, mtr=0x7f473c45beb0, inherit=0x7f473c45b605) 
    at storage/innobase/btr/btr0cur.cc:3018
#13 btr_cur_optimistic_insert (flags=0, cursor=0x7f473c45ba90, offsets=0x7f473c45ba30, heap=0x7f473c45ba28, entry=0x7f46a801d3c8, rec=0x7f473c45ba38, big_rec=0x7f473c45ba20, n_ext=0, thr=0x7f4698026940, mtr=0x7f473c45beb0) 
    at storage/innobase/btr/btr0cur.cc:3225
#14 row_ins_clust_index_entry_low (flags=0, mode=2, index=0x7f469c036a98, n_uniq=0, entry=0x7f46a801d3c8, n_ext=0, thr=0x7f4698026940, dup_chk_only=false) 
    at storage/innobase/row/row0ins.cc:2757
#15 row_ins_clust_index_entry (index=0x7f469c036a98, entry=0x7f46a801d3c8, thr=0x7f4698026940, n_ext=0, dup_chk_only=false) 
    at storage/innobase/row/row0ins.cc:3262
#16 row_ins_index_entry (index=0x7f469c036a98, entry=0x7f46a801d3c8, thr=0x7f4698026940) 
    at storage/innobase/row/row0ins.cc:3389
#17 row_ins_index_entry_step (node=0x7f4698026650, thr=0x7f4698026940) 
    at storage/innobase/row/row0ins.cc:3539
#18 row_ins (node=0x7f4698026650, thr=0x7f4698026940) 
    at storage/innobase/row/row0ins.cc:3681
#19 row_ins_step (thr=0x7f4698026940) 
    at storage/innobase/row/row0ins.cc:3935
#20 row_insert_for_mysql (mysql_rec=0x7f46980238f0 "\360\001", prebuilt=0x7f4698026038, ins_mode=ROW_INS_NORMAL) 
    at storage/innobase/row/row0mysql.cc:1453
#21 ha_innobase::write_row (this=0x7f4698024c30, record=0x7f46980238f0 "\360\001") 
    at storage/innobase/handler/ha_innodb.cc:8169
#22 handler::ha_write_row (this=0x7f4698024c30, buf=0x7f46980238f0 "\360\001") 
    at sql/handler.cc:6196
#23 write_record (thd=0x7f4698000ce8, table=0x7f4698023cc8, info=0x7f473c45cb90) 
    at sql/sql_insert.cc:2020
#24 mysql_insert (thd=0x7f4698000ce8, table_list=0x7f4698012f98, fields=..., values_list=..., update_fields=..., update_values=..., duplic=DUP_ERROR, ignore=false) 
    at sql/sql_insert.cc:1063
#25 mysql_execute_command (thd=0x7f4698000ce8) 
    at sql/sql_parse.cc:4721
...
 
 
 
 



 Comments   
Comment by Matthias Leich [ 2018-08-02 ]

Content of attached files
-------------------------------
Protocol of RQG run : 7_1.log
Archive (data dir, core, grammars) of RQG run showing the issue: 7_1.tgz
combinations.cc : config file for rqg_batch.pl
Elapsed runtime of rqg_batch.pl till first replay : 89s with 12 RQG runs in parallel
The RQG grammar used is already significant simplified.
rqg_batch.pl with the original grammar (not yet pushed table_stress.yy) replays in a few minutes.

I am currently working on some more simplified grammar.
With some luck I am able to offer some MTR based replay test.

Some replay based on RQG requires my experimental version of RQG.
git clone https://github.com/mleich1/rqg --branch experimental RQG_mleich1

Comment by Matthias Leich [ 2018-08-02 ]

Replay on
10.2 commit ef3070e997a6e90c8eadaa833dc47324c2167bb4 2018-08-02
10.2.17-MariaDB-debug-log

Comment by Matthias Leich [ 2018-08-03 ]

Simplified RQG grammar
-------------------------------
query:
ALTER TABLE t1 ADD UNIQUE ( col_int_g ) |
INSERT INTO t1 (col_int) VALUES (1) ;

thread1_init:
CREATE TABLE t1 (col_int INT , col_int_g INT GENERATED ALWAYS AS (col_int) VIRTUAL) ENGINE = InnoDB ;

Experiments showed that the likelihood/speed to replay depends strong on how heavy the CPU load on the box is.
one RQG runner – quite low likelihood to replay at all
nproc concurrent RQG runner – On my notebook the first "replayer" needs less than 60s.

Comment by Nikita Malyavin [ 2021-07-05 ]

see also MDEV-26057

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