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

batch_cop with union_scan return wrong result when using dynamic partition prune #33111

Closed
windtalker opened this issue Mar 16, 2022 · 0 comments · Fixed by #33112
Closed

batch_cop with union_scan return wrong result when using dynamic partition prune #33111

windtalker opened this issue Mar 16, 2022 · 0 comments · Fixed by #33112
Labels
severity/critical type/bug The issue is confirmed as a bug.

Comments

@windtalker
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> show create table employees;
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table     | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| employees | CREATE TABLE `employees` (
  `id` int(11) NOT NULL,
  `fname` varchar(30) DEFAULT NULL,
  `lname` varchar(30) DEFAULT NULL,
  `hired` date NOT NULL DEFAULT '1970-01-01',
  `separated` date DEFAULT '9999-12-31',
  `job_code` int(11) DEFAULT NULL,
  `store_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY RANGE (`store_id`)
(PARTITION `p0` VALUES LESS THAN (6),
 PARTITION `p1` VALUES LESS THAN (11),
 PARTITION `p2` VALUES LESS THAN (16),
 PARTITION `p3` VALUES LESS THAN (21),
 PARTITION `p4` VALUES LESS THAN (MAXVALUE)) |
+-----------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> alter table test.employees set tiflash replica 1;
mysql> set tidb_partition_prune_mode=dynamic; begin; insert into test.employees values(100,'aa','aa','2020-01-01',null,10,10); set session tidb_allow_batch_cop=2; select count(*) from test.employees;
+----------+
| count(*) |
+----------+
|        0 |
+----------+

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

mysql> set tidb_partition_prune_mode=dynamic; begin; insert into test.employees values(100,'aa','aa','2020-01-01',null,10,10); set session tidb_allow_batch_cop=2; select count(*) from test.employees;
+----------+
| count(*) |
+----------+
|        1 |
+----------+

3. What did you see instead (Required)

mysql> set tidb_partition_prune_mode=dynamic; begin; insert into test.employees values(100,'aa','aa','2020-01-01',null,10,10); set session tidb_allow_batch_cop=2; select count(*) from test.employees;
+----------+
| count(*) |
+----------+
|        0 |
+----------+

4. What is your TiDB version? (Required)

master @ 41fb3e7

@windtalker windtalker added the type/bug The issue is confirmed as a bug. label Mar 16, 2022
@ti-chi-bot ti-chi-bot added may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. labels Mar 16, 2022
@windtalker windtalker removed may-affects-4.0 This bug maybe affects 4.0.x versions. may-affects-5.1 This bug maybe affects 5.1.x versions. may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-5.0 This bug maybe affects 5.0.x versions. labels Mar 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/critical type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants