Skip to content

Data Too Long, field len X error when loading stats for a bit column #59759

@time-and-fate

Description

@time-and-fate

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set tidb_stats_load_sync_wait = 5000;
create table t(a bit(1));
insert into t value(1),(0);
analyze table t all columns with 0 topn;
explain select * from t where a = 0;

2. What did you expect to see? (Required)

Stats loading success.

3. What did you see instead (Required)

Both async and sync load failed.

127.0.0.1:4000[test]> explain select * from t where a = 0;
+-------------------------+---------+-----------+---------------+-----------------------------------------------+
| id                      | estRows | task      | access object | operator info                                 |
+-------------------------+---------+-----------+---------------+-----------------------------------------------+
| TableReader_7           | 0.00    | root      |               | data:Selection_6                              |
| └─Selection_6           | 0.00    | cop[tikv] |               | eq(test.t.a, 0)                               |
|   └─TableFullScan_5     | 2.00    | cop[tikv] | table:t       | keep order:false, stats:partial[a:allEvicted] |
+-------------------------+---------+-----------+---------------+-----------------------------------------------+
3 rows in set (0.635 sec)

In tidb log:

[2025/02/25 21:35:53.446 +08:00] [WARN] [stats_syncload.go:142] ["SyncWaitStatsLoad meets error"] [errors="[\"tableID:110, id:1, isIndex:false, err:[types:1406]Data Too Long, field len 1\"]"]
[2025/02/25 21:35:55.796 +08:00] [INFO] [owner_daemon.go:56] ["daemon became owner"] [id=a2ab1778-2b94-4749-b4b2-22fcb8fe60e8] [daemon-id=LogBackup::Advancer]
[2025/02/25 21:35:55.797 +08:00] [INFO] [advancer.go:518] ["Subscription handler spawned."] [category="log backup subscription manager"]
[2025/02/25 21:35:55.797 +08:00] [INFO] [advancer.go:664] ["No tasks yet, skipping advancing."]
[2025/02/25 21:35:55.824 +08:00] [WARN] [domain.go:2605] ["load histograms failed"] [error="[types:1406]Data Too Long, field len 1"]
[2025/02/25 21:35:58.825 +08:00] [WARN] [domain.go:2605] ["load histograms failed"] [error="[types:1406]Data Too Long, field len 1"]
[2025/02/25 21:36:01.234 +08:00] [WARN] [stats_syncload.go:142] ["SyncWaitStatsLoad meets error"] [errors="[\"tableID:110, id:1, isIndex:false, err:[types:1406]Data Too Long, field len 1\"]"]
[2025/02/25 21:36:01.825 +08:00] [WARN] [domain.go:2605] ["load histograms failed"] [error="[types:1406]Data Too Long, field len 1"]
[2025/02/25 21:36:04.428 +08:00] [WARN] [stats_syncload.go:142] ["SyncWaitStatsLoad meets error"] [errors="[\"tableID:110, id:1, isIndex:false, err:[types:1406]Data Too Long, field len 1\"]"]
[2025/02/25 21:36:04.819 +08:00] [WARN] [domain.go:2605] ["load histograms failed"] [error="[types:1406]Data Too Long, field len 1"]
[2025/02/25 21:36:07.796 +08:00] [INFO] [advancer.go:664] ["No tasks yet, skipping advancing."]
[2025/02/25 21:36:07.824 +08:00] [WARN] [domain.go:2605] ["load histograms failed"] [error="[types:1406]Data Too Long, field len 1"]
[2025/02/25 21:36:10.816 +08:00] [WARN] [domain.go:2605] ["load histograms failed"] [error="[types:1406]Data Too Long, field len 1"]

4. What is your TiDB version? (Required)

from v7.5 to nightly (pre-v9.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.report/customerCustomers have encountered this bug.severity/majorsig/plannerSIG: Plannertype/bugThe issue is confirmed as a bug.type/regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions