Description:
Crash recovery asserts if table has invisible fields:
2022-06-03T11:49:48.791406Z 1 [ERROR] [MY-013183] [InnoDB] Assertion failure: mtr0log.cc:1020:n_inst > 0 thread 140217102108416
InnoDB: We intentionally generate a memory trap.
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff7569859 in __GI_abort () at abort.c:79
#2 0x0000555558c234a8 in my_server_abort () at /work/mysql/src/sql/signal_handler.cc:258
#3 0x000055555a1a3611 in my_abort () at /work/mysql/src/mysys/my_init.cc:258
#4 0x000055555a674b07 in ut_dbg_assertion_failed (expr=0x55555c5233f2 "n_inst > 0", file=0x55555c523068 "/work/mysql/src/storage/innobase/mtr/mtr0log.cc", line=1020) at /work/mysql/src/storage/innobase/ut/ut0dbg.cc:99
#5 0x000055555a48ba80 in parse_index_versioned_fields (ptr=0x0, end_ptr=0x7fffe9375098 "7-17847158587-43119055979-04550423016-72563410183-74462563179-26152580729 68599167776-44799133593-27876650845-73741390746-57887599559 \200", f=std::vector of length 0, capacity 0, crv=@0x7fffeb359676: 0, n_dropped=@0x7fffeb359688: 0) at /work/mysql/src/storage/innobase/mtr/mtr0log.cc:1020
#6 0x000055555a48c428 in mlog_parse_index (ptr=0x7fffe9375098 "7-17847158587-43119055979-04550423016-72563410183-74462563179-26152580729 68599167776-44799133593-27876650845-73741390746-57887599559 \200", end_ptr=0x7fffe9375098 "7-17847158587-43119055979-04550423016-72563410183-74462563179-26152580729 68599167776-44799133593-27876650845-73741390746-57887599559 \200", index=0x7fffeb359748) at /work/mysql/src/storage/innobase/mtr/mtr0log.cc:1200
#7 0x000055555a4601e2 in recv_parse_or_apply_log_rec_body (type=MLOG_PAGE_REORGANIZE, ptr=0x7fffe9375084 "", end_ptr=0x7fffe9375098 "7-17847158587-43119055979-04550423016-72563410183-74462563179-26152580729 68599167776-44799133593-27876650845-73741390746-57887599559 \200", space_id=2, page_no=271, block=0x0, mtr=0x0, parsed_bytes=4, start_lsn=30564293) at /work/mysql/src/storage/innobase/log/log0recv.cc:2195
#8 0x000055555a46263b in recv_parse_log_rec (type=0x7fffeb359aa0, ptr=0x7fffe9375080 "H\002\201\017", end_ptr=0x7fffe9375098 "7-17847158587-43119055979-04550423016-72563410183-74462563179-26152580729 68599167776-44799133593-27876650845-73741390746-57887599559 \200", space_id=0x7fffeb359aa8, page_no=0x7fffeb359aa4, body=0x7fffeb359ab0) at /work/mysql/src/storage/innobase/log/log0recv.cc:2987
#9 0x000055555a462aff in recv_multi_rec (ptr=0x7fffe9375080 "H\002\201\017", end_ptr=0x7fffe9375098 "7-17847158587-43119055979-04550423016-72563410183-74462563179-26152580729 68599167776-44799133593-27876650845-73741390746-57887599559 \200") at /work/mysql/src/storage/innobase/log/log0recv.cc:3181
#10 0x000055555a46314c in recv_parse_log_recs () at /work/mysql/src/storage/innobase/log/log0recv.cc:3362
#11 0x000055555a463dc4 in recv_scan_log_recs (log=..., max_memory=130023424, buf=0x7fffb1ffd400 "\200", len=65536, start_lsn=30498816, contiguous_lsn=0x7fffeb359e10, read_upto_lsn=0x7fffe5d31dc0) at /work/mysql/src/storage/innobase/log/log0recv.cc:3668
#12 0x000055555a4643a0 in recv_recovery_begin (log=..., contiguous_lsn=0x7fffeb359e10) at /work/mysql/src/storage/innobase/log/log0recv.cc:3865
#13 0x000055555a464cfe in recv_recovery_from_checkpoint_start (log=..., flush_lsn=18839288) at /work/mysql/src/storage/innobase/log/log0recv.cc:4079
#14 0x000055555a5d7236 in srv_start (create_new_db=false) at /work/mysql/src/storage/innobase/srv/srv0start.cc:2507
#15 0x000055555a2f3f5b in innobase_init_files (dict_init_mode=DICT_INIT_CHECK_FILES, tablespaces=0x7fffeb361780) at /work/mysql/src/storage/innobase/handler/ha_innodb.cc:5313
#16 0x000055555a30613d in innobase_ddse_dict_init (dict_init_mode=DICT_INIT_CHECK_FILES, tables=0x7fffeb361760, tablespaces=0x7fffeb361780) at /work/mysql/src/storage/innobase/handler/ha_innodb.cc:12734
#17 0x0000555559f3935a in dd::bootstrap::DDSE_dict_init (thd=0x5555602712e0, dict_init_mode=DICT_INIT_CHECK_FILES, version=80023) at /work/mysql/src/sql/dd/impl/bootstrap/bootstrapper.cc:737
#18 0x000055555a167376 in dd::upgrade_57::do_pre_checks_and_initialize_dd (thd=0x5555602712e0) at /work/mysql/src/sql/dd/upgrade_57/upgrade.cc:915
#19 0x0000555558d65f65 in bootstrap::handle_bootstrap (arg=0x7fffffffcd00) at /work/mysql/src/sql/bootstrap.cc:327
#20 0x000055555aae4e10 in pfs_spawn_thread (arg=0x5555601fe540) at /work/mysql/src/storage/perfschema/pfs.cc:2942
#21 0x00007ffff7f8f609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#22 0x00007ffff7666163 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
From this point forward you can only start your database with --innodb_force_recovery=6
How to repeat:
run below script:
WRITE_IP=127.1
WRITE_PORT=3306
rm -rf data/
bin/mysqld --initialize-insecure
bin/mysqld &
PID_OF_MYSQLD=$!
for i in $(seq 1 50);
do
bin/mysqladmin -u root -P 3306 ping > /dev/null 2>&1
if [ $? -eq 0 ]; then
break;
fi
sleep 1
done
mysql -u root -P 3306 -e "CREATE DATABASE sbtest"
sysbench --db-driver=mysql --db-ps-mode=disable --mysql-host=${WRITE_IP} --mysql-port=${WRITE_PORT} --mysql-user=root --table_size=20000 --tables=1 /usr/share/sysbench/oltp_read_write.lua prepare
mysql -P 3306 -e "ALTER TABLE sbtest.sbtest1 ADD COLUMN invisible int DEFAULT 1 invisible first;" &&
for i in $(seq 1 50)
do
echo "Run ${i}"
mysql -P 3306 -e "UPDATE sbtest.sbtest1 SET invisible = ${i};" &&
kill -9 ${PID_OF_MYSQLD}
bin/mysqld &
PID_OF_MYSQLD=$!
for b in $(seq 1 10);
do
bin/mysqladmin -u root -P 3306 ping > /dev/null 2>&1
if [ $? -eq 0 ]; then
break;
fi
sleep 1
done
bin/mysqladmin -u root -P 3306 ping > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "MySQL crashed"
exit 1
fi
done