Incorrect Results in Multiple TiFlash Queries

This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: TiFlash多次结果查询不正确

| username: wakaka

[TiDB Usage Environment] Production Environment
[TiDB Version] 5.1.4
[Reproduction Path] Previously, we found that the results of concat queries using TiKV and TiFlash were inconsistent, concat导致查询结果不正确 - TiDB 的问答社区. Later, we canceled and rebuilt all TiFlash replicas. After some time, now even when querying solely with TiFlash, we are encountering inconsistent results.
[Encountered Problem: Phenomenon and Impact]
[Resource Configuration]
[Attachments: Screenshots/Logs/Monitoring]

The data has been confirmed to be unchanged, but with continuous queries, the actrows data fluctuates between 1,411,689 and 1,412,703.

| username: tidb菜鸟一只 | Original post link

Are there many columns in the table? Check the count of each column to see how many rows there are.

| username: hey-hoho | Original post link

Has this table been subjected to a delete operation?

| username: hey-hoho | Original post link

I encountered a similar issue before. The results of count queries on tables using the TiFlash engine were unstable. This is a known bug, and a hotfix was applied to resolve it at that time. It is expected to be fixed in version 5.1.5 (which is about to be released).

| username: hey-hoho | Original post link

You can delete the TiFlash replica of this table and resynchronize it once, which can temporarily solve the issue. However, if it involves table data deletion, the problem will still persist.

| username: WalterWj | Original post link

Is the result correct? This is just the execution plan showing how much data was scanned.

| username: wakaka | Original post link

Previously, when I found something wrong, I deleted it and resynchronized it. Now it’s wrong again. Is there an existing version that has solved this problem?

| username: wakaka | Original post link

actrows is accurate.

| username: wakaka | Original post link

Does it have anything to do with the number of columns?

| username: tidb菜鸟一只 | Original post link

I suspect that count(1) is applied to different columns, which leads to this issue. Since TiFlash stores data by columns, it is possible that the results of different columns are inconsistent.

| username: wakaka | Original post link

If there is such a problem, it is also a serious bug.

| username: yilong | Original post link

You can check the release notes for version 5.1.5 to see if there are any issues similar to your scenario.

| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.