DROP PROCEDURE IF EXISTS prcTest5; CREATE PROCEDURE prcTest5(in ic int) BEGIN declare i int; set i=0; while(i<5) DO truncate table alarmtest5; insert into alarmtest5 select * from port limit ic; set i=i+1; END WHILE;
DROP PROCEDURE IF EXISTS prcTest4; CREATE PROCEDURE prcTest4(in ic int) BEGIN declare i int; set i=0; while(i<5) DO delete from alarmtest4; insert into alarmtest4 select * from port limit ic; set i=i+1; END WHILE;
END; 7、查看MySQL官方文档,When a table is truncated, it is dropped and re-created in a new .ibd file,结合自测的情况,怀疑是我们每张表使用一个ibd文件,TRUNCATE表是重建ibd文件过程中mysql进程中断,导致ibd文件损坏。