Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TiDB may dispatch duplicated tasks to different TiFlash node and produce wrong result. #32814

Closed
LittleFall opened this issue Mar 3, 2022 · 0 comments · Fixed by #32813
Closed
Assignees
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@LittleFall
Copy link
Contributor

LittleFall commented Mar 3, 2022

Bug Report

completely same as pingcap/tiflash#4163

use test;
create table t(a int not null);
create table s(a int not null);
alter table t set tiflash replica 1;
alter table s set tiflash replica 1;

insert into t values (1);
insert into s values (1);

explain analyze SELECT count(distinct a) as x from t having exists(select a from s where x=s.a);
+--------------------------------------+---------+---------+-------------------+---------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------+--------+------+
| id                                   | estRows | actRows | task              | access object | execution info                                                                                           | operator info                             | memory | disk |
+--------------------------------------+---------+---------+-------------------+---------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------+--------+------+
| TableReader_23                       | 0.80    | 2       | root              |               | time:72.4ms, loops:2, cop_task: {num: 4, max: 0s, min: 0s, avg: 0s, p95: 0s, copr_cache_hit_ratio: 0.00} | data:ExchangeSender_22                    | N/A    | N/A  |
| └─ExchangeSender_22                  | 0.80    | 2       | batchCop[tiflash] |               | tiflash_task:{proc max:7.03ms, min:6.36ms, p80:7.03ms, p95:7.03ms, iters:2, tasks:2, threads:48}         | ExchangeType: PassThrough                 | N/A    | N/A  |
|   └─HashJoin_10                      | 0.80    | 2       | batchCop[tiflash] |               | tiflash_task:{proc max:7.03ms, min:6.36ms, p80:7.03ms, p95:7.03ms, iters:2, tasks:2, threads:48}         | semi join, equal:[eq(Column#5, test.s.a)] | N/A    | N/A  |
|     ├─ExchangeReceiver_21(Build)     | 1.00    | 2       | batchCop[tiflash] |               | tiflash_task:{proc max:7.03ms, min:6.36ms, p80:7.03ms, p95:7.03ms, iters:2, tasks:2, threads:48}         |                                           | N/A    | N/A  |
|     │ └─ExchangeSender_20            | 1.00    | 1       | batchCop[tiflash] |               | tiflash_task:{proc max:1.8ms, min:0s, p80:1.8ms, p95:1.8ms, iters:1, tasks:2, threads:1}                 | ExchangeType: Broadcast                   | N/A    | N/A  |
|     │   └─TableFullScan_19           | 1.00    | 1       | batchCop[tiflash] | table:s       | tiflash_task:{proc max:1.8ms, min:0s, p80:1.8ms, p95:1.8ms, iters:1, tasks:2, threads:1}                 | keep order:false, stats:pseudo            | N/A    | N/A  |
|     └─Projection_15(Probe)           | 1.00    | 2       | batchCop[tiflash] |               | tiflash_task:{proc max:6.36ms, min:6.03ms, p80:6.36ms, p95:6.36ms, iters:2, tasks:2, threads:48}         | Column#5                                  | N/A    | N/A  |
|       └─HashAgg_16                   | 1.00    | 2       | batchCop[tiflash] |               | tiflash_task:{proc max:6.36ms, min:6.03ms, p80:6.36ms, p95:6.36ms, iters:2, tasks:2, threads:2}          | funcs:count(distinct test.t.a)->Column#5  | N/A    | N/A  |
|         └─ExchangeReceiver_18        | 1.00    | 2       | batchCop[tiflash] |               | tiflash_task:{proc max:6.36ms, min:6.03ms, p80:6.36ms, p95:6.36ms, iters:2, tasks:2, threads:48}         |                                           | N/A    | N/A  |
|           └─ExchangeSender_17        | 1.00    | 1       | batchCop[tiflash] |               | tiflash_task:{proc max:2.32ms, min:0s, p80:2.32ms, p95:2.32ms, iters:1, tasks:2, threads:1}              | ExchangeType: PassThrough                 | N/A    | N/A  |
|             └─HashAgg_13             | 1.00    | 1       | batchCop[tiflash] |               | tiflash_task:{proc max:2.32ms, min:0s, p80:2.32ms, p95:2.32ms, iters:1, tasks:2, threads:1}              | group by:test.t.a,                        | N/A    | N/A  |
|               └─TableFullScan_14     | 1.00    | 1       | batchCop[tiflash] | table:t       | tiflash_task:{proc max:2.32ms, min:0s, p80:2.32ms, p95:2.32ms, iters:1, tasks:2, threads:1}              | keep order:false, stats:pseudo            | N/A    | N/A  |
+--------------------------------------+---------+---------+-------------------+---------------+----------------------------------------------------------------------------------------------------------+-------------------------------------------+--------+------+
12 rows in set (0.18 sec)
@LittleFall LittleFall added the type/bug The issue is confirmed as a bug. label Mar 3, 2022
@LittleFall LittleFall added sig/planner SIG: Planner affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. severity/critical labels Mar 3, 2022
@ti-chi-bot ti-chi-bot added the may-affects-4.0 This bug maybe affects 4.0.x versions. label Mar 3, 2022
@LittleFall LittleFall removed the may-affects-4.0 This bug maybe affects 4.0.x versions. label Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. severity/critical sig/planner SIG: Planner type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants