Bug #44695 ALTER TABLE during START BACKUP crashes mysqld
Submitted: 6 May 2009 13:41 Modified: 17 Sep 2009 9:55
Reporter: Andrew Hutchings Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: Martin Skold CPU Architecture:Any

[6 May 2009 13:41] Andrew Hutchings
Description:
When running ALTER TABLE whilst a backup is executing with START BACKUP the mysqld node running the ALTER TABLE crashes with an assert.

mysqld: protocol.cc:416: void net_end_statement(THD*): Assertion `0' failed.
090506 15:33:52 - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8384512
read_buffer_size=131072
max_used_connections=1
max_threads=151
threads_connected=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 338315 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x184fcb8
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0x451601b8 thread_stack 0x40000
/data1/mysql/ndb-6.3.23/libexec/mysqld(my_print_stacktrace+0x2f)[0xa9a3ae]
/data1/mysql/ndb-6.3.23/libexec/mysqld(handle_segfault+0x253)[0x68fb43]
/lib64/tls/libpthread.so.0[0x3243b0c320]
/lib64/tls/libc.so.6(gsignal+0x3d)[0x324322e37d]
/lib64/tls/libc.so.6(abort+0xfe)[0x324322faae]
/lib64/tls/libc.so.6(__assert_fail+0xf1)[0x3243227c31]
/data1/mysql/ndb-6.3.23/libexec/mysqld(_Z17net_end_statementP3THD+0x184)[0x684ff0]
/data1/mysql/ndb-6.3.23/libexec/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1790)[0x69ee60]
/data1/mysql/ndb-6.3.23/libexec/mysqld(_Z10do_commandP3THD+0x234)[0x69d47c]
/data1/mysql/ndb-6.3.23/libexec/mysqld(handle_one_connection+0x128)[0x69baf8]
/lib64/tls/libpthread.so.0[0x3243b060aa]
/lib64/tls/libc.so.6(__clone+0x73)[0x32432c5b43]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x185a6c8 = ALTER TABLE test2 ADD KEY(a)
thd->thread_id=2
thd->killed=NOT_KILLED
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

How to repeat:
Single ndbd with single mysqld

1. mysql> CREATE TABLE t1 (a int) ENGINE=NDB;
2. ndb_mgm> START BACKUP
3. mysql> ALTER TABLE t1 ADD KEY (a);

There should be roughly 0.25 - 0.5 second gap between executing the statements in points 2 & 3.
[11 May 2009 13:15] Jonathan Miller
6.3.23
[10 Sep 2009 9:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/82914

2993 Martin Skold	2009-09-10
      bug#44695  ALTER TABLE during START BACKUP crashes mysqld: Informing mysqld properly about encountered errors
      modified:
        sql/ha_ndbcluster.cc
[10 Sep 2009 10:00] Martin Skold
Now behavior will be this:
mysql> create table t1(k int not null primary key auto_increment) engine=ndb;
Query OK, 0 rows affected (0.87 sec)

Starting backup ...
mysql> ALTER ONLINE TABLE t1 ADD b VARCHAR(255);
ERROR 762 (HY000): Unknown error 762
mysql> show errors;
+-------+------+-------------------------------------------------------------------------+
| Level | Code | Message                                                                 |
+-------+------+-------------------------------------------------------------------------+
| Error | 1296 | Got error 762 'Unable to alter table as backup is in progress' from NDB | 
| Error |  762 | Unknown error 762                                                       | 
+-------+------+-------------------------------------------------------------------------+
[14 Sep 2009 8:33] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/83142

2993 Martin Skold	2009-09-14
      bug#44695 ALTER TABLE during START BACKUP crashes mysqld: Adding test case
      modified:
        mysql-test/suite/ndb/r/ndb_alter_table_online.result
        mysql-test/suite/ndb/t/ndb_alter_table_online.test
[15 Sep 2009 12:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/83269

2994 Martin Skold	2009-09-15
      bug#44695  ALTER TABLE during START BACKUP crashes mysqld: Informing mysqld properly about encountered errors
      modified:
        sql/ha_ndbcluster.cc
[15 Sep 2009 12:30] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/83271

2996 Martin Skold	2009-09-15 [merge]
      Merge
      modified:
        sql/ha_ndbcluster.cc
[15 Sep 2009 13:42] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/83281

3050 Martin Skold	2009-09-15 [merge]
      Merge
      modified:
        mysql-test/suite/ndb/r/ndb_alter_table_online.result
        mysql-test/suite/ndb/t/ndb_alter_table_online.test
        sql/ha_ndbcluster.cc
[15 Sep 2009 14:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/83289

3009 Martin Skold	2009-09-15 [merge]
      Merge
      modified:
        mysql-test/suite/ndb/r/ndb_alter_table_online.result
        mysql-test/suite/ndb/t/ndb_alter_table_online.test
        sql/ha_ndbcluster.cc
[15 Sep 2009 14:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/83290

3007 Martin Skold	2009-09-15 [merge]
      Merge
      modified:
        mysql-test/suite/ndb/r/ndb_alter_table_online.result
        mysql-test/suite/ndb/t/ndb_alter_table_online.test
        sql/ha_ndbcluster.cc
[15 Sep 2009 20:48] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:martin.skold@mysql.com-20090915203941-irnhiwgl1r3lqew8) (version source revid:martin.skold@mysql.com-20090915141307-hgbj6q5bitzcw1gj) (merge vers: 5.1.35-ndb-7.1.0) (pib:11)
[15 Sep 2009 21:02] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:martin.skold@mysql.com-20090915210254-genzgtskg84v98t6) (version source revid:martin.skold@mysql.com-20090915141032-wxbwef8bwx4f0r6x) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[15 Sep 2009 21:04] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:martin.skold@mysql.com-20090915210501-qscircc8x2ksskjs) (version source revid:martin.skold@mysql.com-20090915134229-198icn7cs39eywxl) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[15 Sep 2009 21:09] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:martin.skold@mysql.com-20090915210931-6v0pijw3x3lbul22) (version source revid:martin.skold@mysql.com-20090915122648-lijqldvl63eqyl12) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[17 Sep 2009 9:55] Jon Stephens
Documented bugfix in the NDB-6.2.19, 6.3.27, and 7.0.8 changelogs, as follows:

        Running an ALTER TABLE statement while an NDB backup was in
        progress caused mysqld to crash.

Closed.