[TiDB Usage Environment] Production Environment
[TiDB Version] v6.5.3
The index and main table data in TiDB are inconsistent, and the count and select * return different numbers. Through ADMIN CHECK INDEX, it was found that the index is indeed inconsistent.
Is the issue here referring only to inconsistent data, or could the incrementally generated index data also be affected?
PS: In my scenario, the data with more indexes are all historical data and will not be modified. However, this table still has data being written to it normally. I wonder if I can directly use CLEANUP to fix it?
PPS: I suspect that some issues might have been left over when setting up a new cluster and upgrading from 4.0 to 6.1, using tidb-lightning’s physical mode for multiple imports.
I haven’t operated it before. According to the documentation, the risk is still quite high. I suggest backing up during maintenance time before proceeding. Don’t do it when there is business activity.
The key sentence is: “* If you are using TiDB Enterprise Edition, it is recommended to submit a ticket to contact PingCAP support engineers for handling.” It might require the vendor to handle it.
I see that your current version is 6.5.3. The Lightning import in the house mode was done when upgrading from 4.0 to 6.1. Did you perform similar checks when you were on version 6.1?
Did you perform any import operations during the upgrade from 6.1 to 6.5? When did you upgrade to 6.5?
Have you used breakpoints for multiple lightning imports? After importing, have you used admin check table to check? Sync-diff cannot detect data index inconsistencies.
From 6.1 to 6.5, it was directly upgraded online, so it should not be caused by this upgrade. Additionally, the inconsistent data are all historical data from a long time ago, which also indicates that it should have been caused by errors during the import from 4.0 to 6.1.
The problematic table is an archive table, and it already has 10 billion records. The historical partitions are still on SATA disks, so the cost of rebuilding the index is very high.
I have also encountered this problem. At that time, there wasn’t much data, and the import using the lightning physical mode failed. In the end, the entire table was rebuilt. Waiting for a better solution.