1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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.
This commit is contained in:
Jan Lindström
2016-08-11 14:39:47 +03:00
parent b3df257cfd
commit 9b23f8054d
4 changed files with 89 additions and 6 deletions

View File

@ -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;