pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.32k stars 5.72k forks source link

Inconsistent result when using hash partition and auto_increment constraint #53338

Open Nickelth opened 2 weeks ago

Nickelth commented 2 weeks ago

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)


CREATE TABLE t0(c0 INTEGER UNSIGNED NOT NULL  AUTO_INCREMENT ) PARTITION BY HASH(c0) PARTITIONS 2;
CREATE TABLE t1(c0 INTEGER UNSIGNED NOT NULL  AUTO_INCREMENT );

INSERT INTO t0 VALUES (1), (2);
INSERT INTO t1 VALUES (1), (2);
UPDATE t0 SET c0=1;
UPDATE t1 SET c0=1;

insert into t0 values(0);
insert into t1 values(0);

SELECT t0.c0 FROM t0 order by c0;
SELECT t1.c0 FROM t1 order by c0;

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

two queries produce same result

3. What did you see instead (Required)

MySQL [d0]> SELECT t0.c0 FROM t0 order by c0;
+----+
| c0 |
+----+
|  1 |
|  1 |
|  6 |
+----+
3 rows in set (0.01 sec)

MySQL [d0]> SELECT t1.c0 FROM t1 order by c0;
+----+
| c0 |
+----+
|  1 |
|  1 |
|  5 |
+----+
3 rows in set (0.00 sec)

4. What is your TiDB version? (Required)

release version 8.0.0