summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Setiya <sachinsetia1001@gmail.com>2018-02-13 19:34:33 +0530
committerSachin Setiya <sachinsetia1001@gmail.com>2018-02-13 19:34:33 +0530
commit723de90ec84c2e8b1838d1d83a124f1fc710bbb3 (patch)
treed7c4b2fd11ec18fa48680cd9bde32dfd02c9d8dd
parent89480d1930e709bcc020f4aabbcc5fa3244fa767 (diff)
downloadmariadb-git-bb-mdev-15167.tar.gz
MDEV-15167 Server crashes in in bitmap_bits_set upon REPAIR PARTITION ...bb-mdev-15167
If we are doing alter related to partitioning then simple alter stmt like adding column(or any alter stmt) can't be combined with partition alter, this will generate a syntax error. But IF we add SET debug_dbug="+d,test_pseudo_invisible"; or test_completely_invisible this will add a column to table with have an already partitioning related alter. This execution of wrong stmt will crash the server on later stages. (like on repair partition). So we will simply return 1 if we any of these debug_dbug flags turned on.
-rw-r--r--mysql-test/r/invisible_2.result10
-rw-r--r--mysql-test/t/invisible_2.test9
-rw-r--r--sql/sql_partition.cc11
3 files changed, 25 insertions, 5 deletions
diff --git a/mysql-test/r/invisible_2.result b/mysql-test/r/invisible_2.result
new file mode 100644
index 00000000000..590e0032934
--- /dev/null
+++ b/mysql-test/r/invisible_2.result
@@ -0,0 +1,10 @@
+CREATE TABLE t1 (a INT NOT NULL, KEY (a)) ENGINE=MEMORY PARTITION BY KEY(a) PARTITIONS 4;
+INSERT INTO t1 VALUES (1),(2);
+SET debug_dbug="+d,test_pseudo_invisible";
+ALTER TABLE t1 REBUILD PARTITION p2;
+ERROR HY000: Internal error: Don't to it with test_pseudo_invisible
+SET debug_dbug='';
+ALTER TABLE t1 REPAIR PARTITION p1,p2,p3;
+Table Op Msg_type Msg_text
+test.t1 repair status OK
+DROP TABLE t1;
diff --git a/mysql-test/t/invisible_2.test b/mysql-test/t/invisible_2.test
index bbfa7b1df1e..85c26edd833 100644
--- a/mysql-test/t/invisible_2.test
+++ b/mysql-test/t/invisible_2.test
@@ -1,14 +1,13 @@
--source include/have_partition.inc
--source include/have_binlog_format_row.inc
-
+
CREATE TABLE t1 (a INT NOT NULL, KEY (a)) ENGINE=MEMORY PARTITION BY KEY(a) PARTITIONS 4;
INSERT INTO t1 VALUES (1),(2);
SET debug_dbug="+d,test_pseudo_invisible";
-alter table t1 add column abs int;
-SET debug_dbug='';
-ALTER TABLE t1 add column c int, REBUILD PARTITION p2;
+--error ER_INTERNAL_ERROR
ALTER TABLE t1 REBUILD PARTITION p2;
+SET debug_dbug='';
ALTER TABLE t1 REPAIR PARTITION p1,p2,p3;
-
+
# Cleanup
DROP TABLE t1;
diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc
index a4d940670e5..a526ba74847 100644
--- a/sql/sql_partition.cc
+++ b/sql/sql_partition.cc
@@ -4583,6 +4583,17 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
Alter_info::ALTER_TABLE_REORG |
Alter_info::ALTER_REBUILD_PARTITION))
{
+ /*
+ You can't add column when we are doing alter related to partition
+ */
+ DBUG_EXECUTE_IF("test_pseudo_invisible", {
+ my_error(ER_INTERNAL_ERROR, MYF(0), "Don't to it with test_pseudo_invisible");
+ DBUG_RETURN(1);
+ });
+ DBUG_EXECUTE_IF("test_completely_invisible", {
+ my_error(ER_INTERNAL_ERROR, MYF(0), "Don't to it with test_pseudo_invisible");
+ DBUG_RETURN(1);
+ });
partition_info *tab_part_info;
uint flags= 0;
bool is_last_partition_reorged= FALSE;