TiDBer_Jack
(Ti D Ber Mk Wfi W Zy)
1
【 TiDB 使用环境】生产环境
【 TiDB 版本】v8.5.4
【复现路径】批量 delete 数据
SET session tidb_isolation_read_engines = ‘tikv’;
select count(1) from xxx.xxx where statisticsTime >= ‘2025-11-01 00:00:00’ and statisticsTime < ‘2025-12-01 00:00:00’;
±---------+
| count(1) |
±---------+
| 43245000 |
±---------+
1 row in set (8.86 sec)
mysql> SET session tidb_isolation_read_engines = ‘tiflash’;
Query OK, 0 rows affected (0.00 sec)
mysql> select count(1) from xxx.xxx where statisticsTime >= ‘2025-11-01 00:00:00’ and statisticsTime < ‘2025-12-01 00:00:00’;
±---------+
| count(1) |
±---------+
| 43522530 |
±---------+
1 row in set (0.20 sec)
查询 tikv 跟 tiflash 结构不一致,查了之前的论坛也有类似的问题,但是是老版本才出现
异乡的大人
(Ti D Ber 2 Qs S2z Ws)
2
估计可能是 TiFlash 作为列式存储副本,数据同步存在延迟 / 一致性机制差异导致的
TiDBer_Jack
(Ti D Ber Mk Wfi W Zy)
3
不是 
是批量删除导致的,是历史数据,修复数据的时候有批量 delete,我重新做了tiflash 副本就正常了
https://tidb.net/book/tidb-monthly/2022/2022-05/trouble-shooting/tiflash
这里的 trouble shooting 中有记载,但是是旧版本的,没想到在最新版本 8.5.4 也有这个情况
异乡的大人
(Ti D Ber 2 Qs S2z Ws)
4
我还以为是这个设置tidb_read_consistency设置成weak弱一致性导致的 
TiDBer_Jack
(Ti D Ber Mk Wfi W Zy)
5
这是有 bug,我们大数据使用才会去修数据,有批量 delete 的操作,之前的旧版本 6.5.9就没有这个问题
lmdb
( : " One day my life will end, and you will wear the crown.")
7
意思就是因为版本不同才会有这个问题的吗,v8.5.4版本有类似bug哈
TiDBer_00001
(Ti D Ber R Vkz Ii Rf)
12
v8.5.4 批量删数据致 TiKV 与 TiFlash 查询不一致,试试重建 TiFlash 副本修复
1 个赞
一般对于精确性要求不高的场景,可以用这个时间删除, 对于精度要求高的,用主键把
system
(system)
关闭
15
此话题已在最后回复的 7 天后被自动关闭。不再允许新回复。