Skip to content

PointGet/BatchPointGet will break partition selection #19141

Closed
@zyguan

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t;
create table t (c_int int, primary key (c_int)) partition by hash ( c_int ) partitions 4;
insert into t values (1), (2), (3), (4);
select * from t partition (p0); -- only 4 is in p0
select * from t partition (p0) where c_int = 1;
update t partition (p0) set c_int = -c_int where c_int in (2, 3);
select * from t;

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

Partition selection should prevent all rows in other partitions from being selected in any situation.

3. What did you see instead (Required)

mysql> select * from t partition (p0);
+-------+
| c_int |
+-------+
|     4 |
+-------+
1 row in set (0.05 sec)

mysql> select * from t partition (p0) where c_int = 1;
+-------+
| c_int |
+-------+
|     1 |
+-------+
1 row in set (0.05 sec)

mysql> update t partition (p0) set c_int = -c_int where c_int in (2, 3);
Query OK, 2 rows affected (0.05 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> select * from t;
+-------+
| c_int |
+-------+
|     4 |
|    -2 |
|     1 |
|    -3 |
+-------+
4 rows in set (0.06 sec)

4. What is your TiDB version? (Required)

master @ 8978773
release-4.0 @ 3948c7b

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions