Bug #105817 InnoDB: Corruption of an index tree when I insert into table using pt-archiver
Submitted: 7 Dec 2021 8:39 Modified: 7 Dec 2021 13:19
Reporter: Peter Jin Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.7.24 OS:CentOS (CentOS Linux release 7.2.1511 (Core))
Assigned to: CPU Architecture:x86 (Intel(R) Xeon(R) Silver 4208 CPU @ 2.10GHz)
Tags: corruption, INDEX

[7 Dec 2021 8:39] Peter Jin
Description:
When I used pt-archiver to insert into a table, DB crashed and could not restart.I tried setting innodb_force_recovery=6 but still not work. 
Finally I moved the crashed table data files to other directory and then I can start db.
Why it happened? If it's due to pt-archiver, but I use it for several years and this is the first time error.

The pt-archiver command:
pt-archiver --source h=a,u=ygadmin,p='xxx',D=xxx,t=${ARC_TABLE},A=utf8 --dest h=b,u=ygadmin,p='xxx',D=xxx,t=${ARC_TABLE},A=utf8 --no-delete --charset=utf8 --limit=10000 --txn-size 10000 --progress 10000 --statistics --no-check-columns --ignore --no-check-charset --max-lag 100 --where "archive_time > '2021-11-24'" > log/${ARC_TABLE}_`date +%F`.log

The error message in log:
2021-12-06T13:43:38.198642+08:00 2082387 [ERROR] InnoDB: Corruption of an index tree: table `yg_history_2021`.`express_order_202110` index `idx_archive_time`, father ptr page no 1101157, child page no 1101158
PHYSICAL RECORD: n_fields 2; compact format; info bits 0
 0: len 5; hex 99ab32049c; asc   2  ;;
 1: len 8; hex 14247fdaa9421000; asc  $   B  ;;
PHYSICAL RECORD: n_fields 3; compact format; info bits 0
 0: len 5; hex 99ab320494; asc   2  ;;
 1: len 8; hex 142473d9aa8c5000; asc  $s   P ;;
 2: len 4; hex 0010cd65; asc    e;;
2021-12-06T13:43:38.307860+08:00 2082387 [ERROR] [FATAL] InnoDB: You should dump + drop + reimport the table to fix the corruption. If the crash happens at database startup. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery. Then dump + drop + reimport.
2021-12-06 13:43:38 0x7f66f1a7b700  InnoDB: Assertion failure in thread 140080117692160 in file ut0ut.cc line 942
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
05:43:38 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=16777216
max_used_connections=8
max_threads=5000
thread_count=38
connection_count=4
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 163915067 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7f6698847960
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 7f66f1a7ae80 thread_stack 0x12c0000
/usr/local/mysql/bin/mysqld(my_print_stacktrace+0x2c)[0xebae3c]
/usr/local/mysql/bin/mysqld(handle_fatal_signal+0x451)[0x7a9971]
/lib64/libpthread.so.0(+0xf630)[0x7f68fa392630]
/lib64/libc.so.6(gsignal+0x37)[0x7f68f9188387]
/lib64/libc.so.6(abort+0x148)[0x7f68f9189a78]
/usr/local/mysql/bin/mysqld[0x779f49]
/usr/local/mysql/bin/mysqld(_ZN2ib5fatalD1Ev+0x4d)[0x108462d]
/usr/local/mysql/bin/mysqld[0x108cc9a]
/usr/local/mysql/bin/mysqld[0x108e1ed]
/usr/local/mysql/bin/mysqld(_Z25btr_page_split_and_insertmP9btr_cur_tPPmPP16mem_block_info_tPK8dtuple_tmP5mtr_t+0x234)[0x1091a34]
/usr/local/mysql/bin/mysqld(_Z26btr_cur_pessimistic_insertmP9btr_cur_tPPmPP16mem_block_info_tP8dtuple_tPPhPP9big_rec_tmP9que_thr_tP5mtr_t+0x2a7)[0x109f6d7]
/usr/local/mysql/bin/mysqld(_Z27row_ins_sec_index_entry_lowmmP12dict_index_tP16mem_block_info_tS2_P8dtuple_tmP9que_thr_tb+0x1087)[0xfc3a17]
/usr/local/mysql/bin/mysqld(_Z23row_ins_sec_index_entryP12dict_index_tP8dtuple_tP9que_thr_tb+0x2c4)[0xfc78a4]
/usr/local/mysql/bin/mysqld(_Z12row_ins_stepP9que_thr_t+0x2d0)[0xfc9b10]
/usr/local/mysql/bin/mysqld[0xfdb3bf]
/usr/local/mysql/bin/mysqld(_ZN11ha_innobase9write_rowEPh+0x193)[0xf00e63]
/usr/local/mysql/bin/mysqld(_ZN7handler12ha_write_rowEPh+0x102)[0x7fb8a2]
/usr/local/mysql/bin/mysqld(_Z12write_recordP3THDP5TABLEP9COPY_INFOS4_+0xaa)[0xe0756a]
/usr/local/mysql/bin/mysqld(_ZN14Sql_cmd_insert12mysql_insertEP3THDP10TABLE_LIST+0x885)[0xe087f5]
/usr/local/mysql/bin/mysqld(_ZN14Sql_cmd_insert7executeEP3THD+0xca)[0xe08fea]
/usr/local/mysql/bin/mysqld(_Z21mysql_execute_commandP3THDb+0x5b0)[0xc91d60]
/usr/local/mysql/bin/mysqld(_Z11mysql_parseP3THDP12Parser_state+0x38d)[0xc97f5d]
/usr/local/mysql/bin/mysqld(_Z16dispatch_commandP3THDPK8COM_DATA19enum_server_command+0xa14)[0xc98a54]
/usr/local/mysql/bin/mysqld(_Z10do_commandP3THD+0x177)[0xc9a3a7]
/usr/local/mysql/bin/mysqld(handle_connection+0x270)[0xd56520]
/usr/local/mysql/bin/mysqld(pfs_spawn_thread+0x1b1)[0x121fdf1]
/lib64/libpthread.so.0(+0x7ea5)[0x7f68fa38aea5]
/lib64/libc.so.6(clone+0x6d)[0x7f68f9250b0d]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7f66986d8cd0): is an invalid pointer
Connection ID (thread ID): 2082387
Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

How to repeat:
I didn't try cause I must recover db and check the data first.
[7 Dec 2021 13:19] MySQL Verification Team
Hi Mr. Jin,

Thank you for your bug report.

However, we can not proceed in processing your report any further.

First of all, we accept here bug reports for MySQL@Oracle products only, not for any other tools available for the community.

Also, 5.7.24 is an ancient release and there are so many bugs fixed interim that one and our latest release. We urge you to try our tools and our latest  5.7 or 8.0 release.

Unsupported.