diff options
author | Yuchen Pei <yuchen.pei@mariadb.com> | 2022-12-15 10:42:07 +1100 |
---|---|---|
committer | Yuchen Pei <yuchen.pei@mariadb.com> | 2022-12-15 10:42:07 +1100 |
commit | c758eda7d43d1a83ca975796a8893424104f6443 (patch) | |
tree | 013393fefe94212300b235f225e82083c4898f5a | |
parent | 87eccd78a791ff3acfa00914254f0bf858a14aa4 (diff) | |
download | mariadb-git-bb-10.4-MDEV-21007.tar.gz |
MDEV-21007 Do not assert auto_increment_value unless all parts openbb-10.4-MDEV-21007
Commit 6dce6aecebe6ef78a14cb5c5c5daa8a355551e40 breaks out of a loop
in ha_partition::info when some partitions aren't opened, in which
case auto_increment_value assertion will fail. This commit patches
that hole.
Signed-off-by: Yuchen Pei <yuchen.pei@mariadb.com>
Reviewed-by: Alexey Botchkov <holyfoot@mariadb.com>
-rw-r--r-- | mysql-test/suite/parts/r/mdev_21007.result | 5 | ||||
-rw-r--r-- | mysql-test/suite/parts/t/mdev_21007.test | 9 | ||||
-rw-r--r-- | sql/ha_partition.cc | 4 |
3 files changed, 17 insertions, 1 deletions
diff --git a/mysql-test/suite/parts/r/mdev_21007.result b/mysql-test/suite/parts/r/mdev_21007.result new file mode 100644 index 00000000000..fb2417ac3ae --- /dev/null +++ b/mysql-test/suite/parts/r/mdev_21007.result @@ -0,0 +1,5 @@ +CREATE TABLE t1 (a INT) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1), PARTITION p1 VALUES LESS THAN (MAXVALUE)); +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY; +UPDATE t1 PARTITION (p1) SET a=9 ORDER BY a LIMIT 1; +DROP TABLE t1; diff --git a/mysql-test/suite/parts/t/mdev_21007.test b/mysql-test/suite/parts/t/mdev_21007.test new file mode 100644 index 00000000000..ec6fbe4d108 --- /dev/null +++ b/mysql-test/suite/parts/t/mdev_21007.test @@ -0,0 +1,9 @@ +--source include/have_partition.inc + +CREATE TABLE t1 (a INT) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (1), PARTITION p1 VALUES LESS THAN (MAXVALUE)); +INSERT INTO t1 VALUES (1),(2); +ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY; +UPDATE t1 PARTITION (p1) SET a=9 ORDER BY a LIMIT 1; + +# Cleanup +DROP TABLE t1; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 06ae329ee3a..4b153ba1135 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -8413,7 +8413,9 @@ int ha_partition::info(uint flag) file->stats.auto_increment_value); } while (*(++file_array)); - DBUG_ASSERT(auto_increment_value); + if (all_parts_opened) { + DBUG_ASSERT(auto_increment_value); + } stats.auto_increment_value= auto_increment_value; if (all_parts_opened && auto_inc_is_first_in_idx) { |