mysql索引损坏,Record in index `log_time` of table `lts`.`lts_job_log_po` was not found on update
【1】错误信息
[ERROR] [MY-012869] [InnoDB] Record in index `log_time` of table `lts`.`lts_job_log_po` was not found on update: TUPLE (info_bits=0, 2 n_cmp=2, fields) 2023-05-29T23:03:05.146242Z 193 [ERROR] [MY-013183] [InnoDB] Assertion failure: row0upd.cc:2358:0 thread 140238624069376 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/8.0/en/forcing-innodb-recovery.html InnoDB: about forcing recovery. 23:03:05 UTC - mysqld got signal 6 ; Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.
【2】处理办法
初步确定为因为名为 t_idx 的索引损坏导致的大量报错,并在处理 update 语句时导致 crash。
(1)确认表有错误
CHECK TABLE `$db_name`.`$tb_name`;
(2)修复
方式1:optimize table `$db_name`.`$tb_name`;
方式2:alter table `$db_name`.`$tb_name` engine=innodb;