diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-08-11 14:39:47 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2016-08-13 09:27:50 +0300 |
commit | 9b23f8054d2f37458901b4505429c30eddc440bc (patch) | |
tree | 419bc0c5507124bbf7fe21dc55280f726c5ac739 /mysql-test/suite | |
parent | b3df257cfde490066933c4dc8329f9670aa8de58 (diff) | |
download | mariadb-git-9b23f8054d2f37458901b4505429c30eddc440bc.tar.gz |
MDEV-10535: ALTER TABLE causes standalone/wsrep cluster crash
When checking is any of the renamed columns part of the
columns for new indexes we accessed NULL pointer if checked
column used on index was added on same statement. Additionally,
we tried to check too many indexes, added_index_count
is enough here.
Diffstat (limited to 'mysql-test/suite')
-rw-r--r-- | mysql-test/suite/innodb/r/innodb-alter-table.result | 50 | ||||
-rw-r--r-- | mysql-test/suite/innodb/t/innodb-alter-table.test | 33 |
2 files changed, 83 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/innodb-alter-table.result b/mysql-test/suite/innodb/r/innodb-alter-table.result index 514b8b7935f..c4460a7226b 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-table.result +++ b/mysql-test/suite/innodb/r/innodb-alter-table.result @@ -135,3 +135,53 @@ child CREATE TABLE `child` ( CONSTRAINT `child_ibfk_1` FOREIGN KEY (`c`) REFERENCES `parent` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE child, parent; +CREATE TABLE IF NOT EXISTS ticket ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +mask VARCHAR(16) DEFAULT '' NOT NULL, +subject VARCHAR(255) DEFAULT '' NOT NULL, +is_closed TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, +is_deleted TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, +team_id INT UNSIGNED DEFAULT 0 NOT NULL, +category_id INT UNSIGNED DEFAULT 0 NOT NULL, +first_message_id INT UNSIGNED DEFAULT 0 NOT NULL, +created_date INT UNSIGNED, +updated_date INT UNSIGNED, +due_date INT UNSIGNED, +first_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, +last_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, +spam_score DECIMAL(4,4) NOT NULL DEFAULT 0, +spam_training VARCHAR(1) NOT NULL DEFAULT '', +interesting_words VARCHAR(255) NOT NULL DEFAULT '', +next_action VARCHAR(255) NOT NULL DEFAULT '', +PRIMARY KEY (id) +) ENGINE=InnoDB; +ALTER TABLE ticket +CHANGE COLUMN team_id group_id INT UNSIGNED NOT NULL DEFAULT 0, +CHANGE COLUMN category_id bucket_id INT UNSIGNED NOT NULL DEFAULT 0, +ADD COLUMN org_id INT UNSIGNED NOT NULL DEFAULT 0, +ADD INDEX org_id (org_id); +SHOW CREATE TABLE ticket; +Table Create Table +ticket CREATE TABLE `ticket` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mask` varchar(16) NOT NULL DEFAULT '', + `subject` varchar(255) NOT NULL DEFAULT '', + `is_closed` tinyint(1) unsigned NOT NULL DEFAULT '0', + `is_deleted` tinyint(1) unsigned NOT NULL DEFAULT '0', + `group_id` int(10) unsigned NOT NULL DEFAULT '0', + `bucket_id` int(10) unsigned NOT NULL DEFAULT '0', + `first_message_id` int(10) unsigned NOT NULL DEFAULT '0', + `created_date` int(10) unsigned DEFAULT NULL, + `updated_date` int(10) unsigned DEFAULT NULL, + `due_date` int(10) unsigned DEFAULT NULL, + `first_wrote_address_id` int(10) unsigned NOT NULL DEFAULT '0', + `last_wrote_address_id` int(10) unsigned NOT NULL DEFAULT '0', + `spam_score` decimal(4,4) NOT NULL DEFAULT '0.0000', + `spam_training` varchar(1) NOT NULL DEFAULT '', + `interesting_words` varchar(255) NOT NULL DEFAULT '', + `next_action` varchar(255) NOT NULL DEFAULT '', + `org_id` int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`id`), + KEY `org_id` (`org_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE ticket; diff --git a/mysql-test/suite/innodb/t/innodb-alter-table.test b/mysql-test/suite/innodb/t/innodb-alter-table.test index 2ad9c8791cb..45342b4a218 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-table.test +++ b/mysql-test/suite/innodb/t/innodb-alter-table.test @@ -138,3 +138,36 @@ SHOW CREATE TABLE child; DROP TABLE child, parent; +# +# MDEV-10535: ALTER TABLE causes standalone/wsrep cluster crash +# +CREATE TABLE IF NOT EXISTS ticket ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + mask VARCHAR(16) DEFAULT '' NOT NULL, + subject VARCHAR(255) DEFAULT '' NOT NULL, + is_closed TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, + is_deleted TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, + team_id INT UNSIGNED DEFAULT 0 NOT NULL, + category_id INT UNSIGNED DEFAULT 0 NOT NULL, + first_message_id INT UNSIGNED DEFAULT 0 NOT NULL, + created_date INT UNSIGNED, + updated_date INT UNSIGNED, + due_date INT UNSIGNED, + first_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, + last_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, + spam_score DECIMAL(4,4) NOT NULL DEFAULT 0, + spam_training VARCHAR(1) NOT NULL DEFAULT '', + interesting_words VARCHAR(255) NOT NULL DEFAULT '', + next_action VARCHAR(255) NOT NULL DEFAULT '', + PRIMARY KEY (id) +) ENGINE=InnoDB; + +ALTER TABLE ticket + CHANGE COLUMN team_id group_id INT UNSIGNED NOT NULL DEFAULT 0, + CHANGE COLUMN category_id bucket_id INT UNSIGNED NOT NULL DEFAULT 0, + ADD COLUMN org_id INT UNSIGNED NOT NULL DEFAULT 0, + ADD INDEX org_id (org_id); + +SHOW CREATE TABLE ticket; + +DROP TABLE ticket; |