maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #11981
Re: 7a331ec820b: MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val.
Hi, Alexey!
On Oct 25, Alexey Botchkov wrote:
> revision-id: 7a331ec820b (mariadb-10.3.18-65-g7a331ec820b)
> parent(s): 716d396bb3b
> author: Alexey Botchkov <holyfoot@xxxxxxxxxxx>
> committer: Alexey Botchkov <holyfoot@xxxxxxxxxxx>
> timestamp: 2019-10-22 01:40:48 +0400
> message:
>
> MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val.
>
> Autoincrement calculation should check if tables were opened.
>
> ---
> mysql-test/main/partition_innodb.result | 13 +++++++++++++
> mysql-test/main/partition_innodb.test | 15 +++++++++++++++
> sql/ha_partition.cc | 2 ++
> 3 files changed, 30 insertions(+)
>
> diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result
> index f3d24347ff9..93a73a785fe 100644
> --- a/mysql-test/main/partition_innodb.result
> +++ b/mysql-test/main/partition_innodb.result
> @@ -1028,5 +1028,18 @@ COUNT(*)
> 2
> DROP TABLE t1;
> #
> +# MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
> +#
> +CREATE TABLE t1 (a INT)
> +ENGINE=InnoDB
> +PARTITION BY RANGE (a) (
> +PARTITION p0 VALUES LESS THAN (6),
> +PARTITION pn VALUES LESS THAN MAXVALUE
> +);
> +INSERT INTO t1 VALUES (4),(5),(6);
> +ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
> +UPDATE t1 PARTITION (p0) SET a = 3 WHERE a = 5;
> +DROP TABLE t1;
> +#
> # End of 10.3 tests
> #
> diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test
> index 629bc29e758..1e0af06b4da 100644
> --- a/mysql-test/main/partition_innodb.test
> +++ b/mysql-test/main/partition_innodb.test
> @@ -1105,6 +1105,21 @@ INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL)
> SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
> DROP TABLE t1;
>
> +--echo #
> +--echo # MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
> +--echo #
> +
> +CREATE TABLE t1 (a INT)
> + ENGINE=InnoDB
> + PARTITION BY RANGE (a) (
> + PARTITION p0 VALUES LESS THAN (6),
> + PARTITION pn VALUES LESS THAN MAXVALUE
> + );
> +INSERT INTO t1 VALUES (4),(5),(6);
> +ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
> +UPDATE t1 PARTITION (p0) SET a = 3 WHERE a = 5;
> +DROP TABLE t1;
> +
> --echo #
> --echo # End of 10.3 tests
> --echo #
> diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
> index 5a78249644d..e461532db1a 100644
> --- a/sql/ha_partition.cc
> +++ b/sql/ha_partition.cc
> @@ -8174,6 +8174,8 @@ int ha_partition::info(uint flag)
> ("checking all partitions for auto_increment_value"));
> do
> {
> + if (!bitmap_is_set(&m_opened_partitions, (uint)(file_array - m_file)))
> + continue;
> file= *file_array;
> file->info(HA_STATUS_AUTO | no_lock_flag);
> set_if_bigger(auto_increment_value,
It seems that the intention was to find the max auto_increment_value
over all partitions. If you skip some, it won't be max anymore.
On the other hand, I don't see why UPDATE should get the max auto-inc of
all partitions. May be the correct fix would be not to do it in UPDATE?
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx