Bug #59419 Alter table with multiple alters causes 'lost connection to MySQL server'
Submitted: 11 Jan 2011 14:51 Modified: 23 Jan 2011 16:05
Reporter: Jeremy Jones Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.1.40-community, 5.1.41-community OS:Linux
Assigned to: CPU Architecture:Any

[11 Jan 2011 14:51] Jeremy Jones
Description:
When trying to run an ALTER command which contains 2 commands - one to drop a text column and another to add a text column, the connection to the server is terminated and the alter does not go through.

How to repeat:
mysql> show create table futureproof_data \G
*************************** 1. row ***************************
       Table: futureproof_data
Create Table: 

mysql> CREATE TABLE `futureproof_data` (
    ->   `email_address` varchar(128) NOT NULL,
    ->   `filename` varchar(255) NOT NULL,
    ->   `xml_file` text NOT NULL,
    ->   PRIMARY KEY (`email_address`,`filename`),
    ->   UNIQUE KEY `filename` (`filename`,`email_address`)
    -> ) ENGINE=MyISAM DEFAULT CHARSET=latin1
    -> ;
Query OK, 0 rows affected (0.06 sec)

mysql>
mysql> alter table futureproof_data add xml_data text not null, drop xml_file;
ERROR 2013 (HY000): Lost connection to MySQL server during query

mysql> alter table futureproof_data drop xml_file, add xml_data text not null;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql>
[11 Jan 2011 15:18] Peter Laursen
Not reproducible for me with 5.1.54 on Windows.

(and besides if it is a server crash, category should not be 'client').

Peter
(not a MySQL person)
[11 Jan 2011 15:19] Valeriy Kravchuk
Please, check if the same problem happens with a newer version, 5.1.54.
[11 Jan 2011 15:42] Jeremy Jones
Hi just to clarify, the server doesn't crash but the client reports the connection is broken, and the alter doesn't go through. Separating the alter into two separate commands works ok.
[11 Jan 2011 16:09] Peter Laursen
OK .. the server disconnects the client. But it is still a server issue then. You should not expect any activity as long as you have not verified on 5.1.54.  :-)
[11 Jan 2011 16:41] Jeremy Jones
Ok thanks for the information.
[11 Jan 2011 17:28] Valeriy Kravchuk
So, is it repeatable with 5.1.54?
[23 Jan 2011 16:05] Jeremy Jones
Hi,

Ok this one is ok in 5.1.54 on Linux. Sorry about that.

Thanks,
Jeremy

mysql> show variables like '%version%';
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| protocol_version        | 10                           |
| version                 | 5.1.54                       |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86_64                       |
| version_compile_os      | unknown-linux-gnu            |
+-------------------------+------------------------------+
5 rows in set (0.00 sec)

mysql> show create table futureproof_data \G
*************************** 1. row ***************************
       Table: futureproof_data
Create Table: CREATE TABLE `futureproof_data` (
  `email_address` varchar(128) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `xml_data` text NOT NULL,
  PRIMARY KEY (`email_address`,`filename`),
  UNIQUE KEY `filename` (`filename`,`email_address`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> show variables like '%version%';
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| protocol_version        | 10                           |
| version                 | 5.1.54                       |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86_64                       |
| version_compile_os      | unknown-linux-gnu            |
+-------------------------+------------------------------+
5 rows in set (0.00 sec)

mysql> show create table futureproof_data \G
*************************** 1. row ***************************
       Table: futureproof_data
Create Table: CREATE TABLE `futureproof_data` (
  `email_address` varchar(128) NOT NULL,
  `filename` varchar(255) NOT NULL,
  `xml_data` text NOT NULL,
  PRIMARY KEY (`email_address`,`filename`),
  UNIQUE KEY `filename` (`filename`,`email_address`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

mysql> alter table futureproof_data add xml_data text not null, drop xml_file;
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql>