pingcap / pingcap/tidb

Data inconsistency between TiKV and TiFlash after adding a NOT NULL BLOB column

Open
#63,758 0 comments 0 reactions 0 assignees View on GitHub
contribution sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
```sql
DROP TABLE IF EXISTS tb3;

CREATE TABLE tb3 (id INT UNIQUE AUTO_INCREMENT NOT NULL, c0 INT);
INSERT INTO tb3 (c0) VALUES (-101022856);
ALTER TABLE tb3 SET TIFLASH REPLICA 1;
ALTER TABLE tb3 ADD COLUMN auto_col_34406 BLOB NOT NULL;

SELECT /*+ read_from_storage(tikv[t0]) */ t0.id AS id, BIT_LENGTH(t0.auto_col_34406) as col_2 FROM tb3 AS t0;
SELECT /*+ read_from_storage(tiflash[t0]) */ t0.id AS id, BIT_LENGTH(t0.auto_col_34406) as col_2 FROM tb3 AS t0;

```

### 2. What did you expect to see? (Required)
same result
### 3. What did you see instead (Required)
```
mysql> SELECT /*+ read_from_storage(tikv[t0]) */ t0.id AS id, BIT_LENGTH(t0.auto_col_34406) as col_2 FROM tb3 AS t0;
+----+-------+
| id | col_2 |
+----+-------+
| 1 | 0 |
+----+-------+
1 row in set (0.003 sec)

mysql> SELECT /*+ read_from_storage(tiflash[t0]) */ t0.id AS id, BIT_LENGTH(t0.auto_col_34406) as col_2 FROM tb3 AS t0;
+----+--------+
| id | col_2 |
+----+--------+
| 1 | 524280 |
+----+--------+
1 row in set (0.007 sec)
```
### 4. What is your TiDB version? (Required)
```
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.5.3
Edition: Community
Git Commit Hash: dc2548aac79a712265e831cff2a3a896bc0a5a38
Git Branch: HEAD
UTC Build Time: 2025-07-31 13:54:59
GoVersion: go1.23.6
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.