Bug Report Clearly and accurately describe the issue you found. Providing any steps to reproduce the problem can help the development team address it promptly.
[TiDB Version]
4.0.13
[Impact of the Bug]
No change in health status after analyze
Phenomenon:
Log error:
Errors for two tables
[error=“[types:1406]Data Too Long, field len 40, data len 64”]
[error=“[types:1406]Data Too Long, field len 10, data len 16”]
etc.
Trigger method:
Triggered every time analyze is called, the field lengths of the analyzed table are 40 and 10.
Impact:
After calling analyze, the client can execute normally, and no warning information is returned to the client. However, the log records the above warning information, and there is no change in health status after analyze.
Methods tried:
DROP STATS TableName; had no effect
Set the auto-analyze to a non-current time to ensure it won’t auto-analyze at the moment.
set global tidb_auto_analyze_start_time='00:00 +0000'
Delete the statistics of the table.
DROP STATS db_name.table_name
Manually analyze the table.
analyze table db_name.table_name
(At this point, the issue is resolved, and the health status is restored to 100.)
Restore auto-analyze.
set global tidb_auto_analyze_start_time=
Reason: It might be due to inaccurate statistics, which caused the auto-analyze to fail continuously. Therefore, the above steps are needed.
However, the root cause still needs to be reviewed by the development experts.
Additionally, there is another phenomenon. I observed several tables with alerts, and the phenomenon is consistent:
Data Too Long, field len 255, data len 284
For example, this error indicates that a field in the table is defined with a length of 255, but the maximum length of this field is 142. All such data length alerts are twice the maximum field length.