summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-02-01 18:43:07 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2021-02-01 18:45:35 +0200
commit324e5f02a98be3f3acaf8fd6ee7f55d8d439afd9 (patch)
treeca3199edb73191b883f5c4736282ec4cdd23733e
parentb1241585b2baf2e62b75febdee2757fc2d3f6488 (diff)
downloadmariadb-git-324e5f02a98be3f3acaf8fd6ee7f55d8d439afd9.tar.gz
MDEV-24754 Crash in ha_partition_inplace_ctx::~ha_partition_inplace_ctx()
ha_innobase::commit_inplace_alter_table(): Fix a regression that was introduced in 6d1f1b61b59310027698a92ccf533a3093f1ce04 (MDEV-24564).
-rw-r--r--mysql-test/suite/innodb/r/alter_partitioned.result8
-rw-r--r--mysql-test/suite/innodb/t/alter_partitioned.test9
-rw-r--r--storage/innobase/handler/handler0alter.cc2
3 files changed, 18 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb/r/alter_partitioned.result b/mysql-test/suite/innodb/r/alter_partitioned.result
index 1e7ac1dadae..cbdfab36499 100644
--- a/mysql-test/suite/innodb/r/alter_partitioned.result
+++ b/mysql-test/suite/innodb/r/alter_partitioned.result
@@ -8,3 +8,11 @@ PARTITION BY RANGE(a)
PARTITION pb VALUES LESS THAN (4));
ERROR HY000: Partitioned tables do not support FOREIGN KEY
DROP TABLE t1;
+#
+# MDEV-24754 Server crash in
+# ha_partition_inplace_ctx::~ha_partition_inplace_ctx
+#
+CREATE TABLE t1 (id INT PRIMARY KEY, a INT, va INT AS (a) VIRTUAL)
+ENGINE=InnoDB PARTITION BY HASH(id) PARTITIONS 2;
+ALTER TABLE t1 ADD b INT, ALGORITHM=INSTANT;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/alter_partitioned.test b/mysql-test/suite/innodb/t/alter_partitioned.test
index 19b712c2657..e443f92bc8c 100644
--- a/mysql-test/suite/innodb/t/alter_partitioned.test
+++ b/mysql-test/suite/innodb/t/alter_partitioned.test
@@ -13,3 +13,12 @@ PARTITION BY RANGE(a)
PARTITION pb VALUES LESS THAN (4));
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-24754 Server crash in
+--echo # ha_partition_inplace_ctx::~ha_partition_inplace_ctx
+--echo #
+CREATE TABLE t1 (id INT PRIMARY KEY, a INT, va INT AS (a) VIRTUAL)
+ENGINE=InnoDB PARTITION BY HASH(id) PARTITIONS 2;
+ALTER TABLE t1 ADD b INT, ALGORITHM=INSTANT;
+DROP TABLE t1;
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 4248442f3da..54a20a95a31 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -11271,7 +11271,7 @@ foreign_fail:
auto ctx= static_cast<ha_innobase_inplace_ctx*>(*pctx);
ctx->prebuilt->table = innobase_reload_table(
m_user_thd, ctx->prebuilt->table,
- table->s->table_name, *ctx0);
+ table->s->table_name, *ctx);
innobase_copy_frm_flags_from_table_share(
ctx->prebuilt->table, altered_table->s);
}