Bug #17499 Alter table of ndb partitioned tables causes mysqld to core
Submitted: 17 Feb 2006 1:51 Modified: 28 Feb 2006 19:37
Reporter: Nikolay Grishakin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Partitions Severity:S1 (Critical)
Version: OS:
Assigned to: Tomas Ulin CPU Architecture:Any

[17 Feb 2006 1:51] Nikolay Grishakin
Description:
The following test case caused core:

CREATE LOGFILE GROUP listgroup_lg
ADD UNDOFILE './listgroup_lg/undofile.dat'
INITIAL_SIZE 16M
UNDO_BUFFER_SIZE = 3M
ENGINE=NDB;

CREATE TABLESPACE listgroup_ts
ADD DATAFILE './listgroup_ts/datafile.dat'
USE LOGFILE GROUP listgroup_lg
INITIAL_SIZE 15M
ENGINE NDB;

CREATE TABLE test.t1 (
  a1 INT,
  a2 TEXT NOT NULL,
  a3 BIT NOT NULL,
  a4 DECIMAL(8,3),
  a5 INT NOT NULL,
  a6 VARCHAR(255),
  PRIMARY KEY(a1))
  TABLESPACE listgroup_ts STORAGE DISK ENGINE=NDB
  PARTITION BY LIST (a1)
 (PARTITION p0 VALUES IN (1,2,3,4,5),
  PARTITION p1 VALUES IN (6,7,8,9, 10),
  PARTITION p2 VALUES IN (11, 12, 13, 14, 15));

let $j= 15;
--disable_query_log
while ($j)
{
#eval INSERT INTO test.t1 VALUES ($j, $j+1);
eval INSERT INTO test.t1 VALUES ($j, "Tested Remotely from Texas, USA", b'1',$j.00,$j+1,"By NIK $j");
dec $j;
}
--enable_query_log

ALTER TABLE test.t1 DROP COLUMN a4;
mysqltest: At line 63: query 'ALTER TABLE test.t1 DROP COLUMN a4' failed: 2013: Lost connection to MySQL server during query.

MySQLD Back Trace:

#0  0x005a7402 in __kernel_vsyscall ()
#1  0x0074655f in pthread_kill () from /lib/libpthread.so.0
#2  0x082f3849 in write_core (sig=8521) at stacktrace.c:220
#3  0x081d3c8d in handle_segfault (sig=11) at mysqld.cc:2196
#4  <signal handler called>
#5  NdbScanOperation::executeCursor (this=0x9755250, nodeId=2)
    at NdbScanOperation.cpp:372
#6  0x085414e2 in NdbTransaction::executeAsynchPrepare (this=0x9737e58,
    aTypeOfExec=Commit, aCallback=0, anyObject=0x0, abortOption=AbortOnError)
    at NdbTransaction.cpp:518
#7  0x08541773 in NdbTransaction::executeNoBlobs (this=0x9737e58,
    aTypeOfExec=Prepare, abortOption=AbortOnError, forceSend=1)
    at NdbTransaction.cpp:438
#8  0x08541cdc in NdbTransaction::execute (this=0x9737e58, aTypeOfExec=Commit,
    abortOption=AbortOnError, forceSend=1) at NdbTransaction.cpp:273
#9  0x0834be09 in ndbcluster_commit (thd=0xb7e21218, all=false)
    at ha_ndbcluster.cc:298
#10 0x082a77c2 in ha_commit_one_phase (thd=0xb7e21218, all=false)
    at handler.cc:742
#11 0x082a8586 in ha_commit_trans (thd=0xb7e21218, all=false) at handler.cc:712
#12 0x082a871f in ha_enable_transaction (thd=0xb7e21218, on=true)
    at handler.cc:2118
#13 0x082bd7fa in mysql_alter_table (thd=0xb7e21218, new_db=0x972bc40 "test",

How to repeat:
see above
[17 Feb 2006 8:42] Jonas Oreland
Hi,

I tried this on a 1 node and a 2 node cluster wo/ success.
I use a release compiled clone.

/Jonas
[17 Feb 2006 16:46] Jonathan Miller
Developer has asked that you simplify the test case as he was able to reproduce.
[17 Feb 2006 20:28] Nikolay Grishakin
I attached test case that alters table created with and without partitions. Fails with partitions only. Test case attached. Please run it with mysql-test.
Reassigning Category to Partitioning.
[22 Feb 2006 3:44] Nikolay Grishakin
I got the same problem with partitioning by HASH:

CREATE TABLE test.t1 (
  a1 INT,
  a2 TEXT NOT NULL,
  a3 BIT NOT NULL,
  a4 DECIMAL(8,3),
  a5 INT NOT NULL,
  a6 VARCHAR(255),
  PRIMARY KEY(a1))
  TABLESPACE hash_ts STORAGE DISK ENGINE=NDB
  PARTITION BY HASH(a1)
  PARTITIONS 4;

let $j= 15;
--disable_query_log
while ($j)
{
eval INSERT INTO test.t1 VALUES ($j, "Tested Remotely from Texas, USA", b'1',$j.00,$j+1,"By NIK $j");
dec $j;
}
--enable_query_log

SELECT COUNT(*) FROM test.t1;

ALTER TABLE test.t1 DROP COLUMN a4;

The problem looks similar to original bug so I decided to put this under the same bug.
Alter table causes core:

(gdb) bt
#0  0x00dcb402 in __kernel_vsyscall ()
#1  0x0074655f in pthread_kill () from /lib/libpthread.so.0
#2  0x082f4fc9 in write_core (sig=723) at stacktrace.c:220
#3  0x081d436d in handle_segfault (sig=11) at mysqld.cc:2196
#4  <signal handler called>
#5  NdbScanOperation::executeCursor (this=0x8b2b3a0, nodeId=2)
    at NdbScanOperation.cpp:372
#6  0x08544722 in NdbTransaction::executeAsynchPrepare (this=0x8b100e0,
    aTypeOfExec=Commit, aCallback=0, anyObject=0x0,
    abortOption=AbortOnError) at NdbTransaction.cpp:518
#7  0x085449b3 in NdbTransaction::executeNoBlobs (this=0x8b100e0,
    aTypeOfExec=Prepare, abortOption=AbortOnError, forceSend=1)
    at NdbTransaction.cpp:438
#8  0x08544f1c in NdbTransaction::execute (this=0x8b100e0,
    aTypeOfExec=Commit, abortOption=AbortOnError, forceSend=1)
    at NdbTransaction.cpp:273
#9  0x0834e3a9 in ndbcluster_commit (thd=0xb76f7540, all=false)
    at ha_ndbcluster.cc:299
#10 0x082a84f2 in ha_commit_one_phase (thd=0xb76f7540, all=false)
    at handler.cc:743
#11 0x082a92b6 in ha_commit_trans (thd=0xb76f7540, all=false)
    at handler.cc:713
#12 0x082a944f in ha_enable_transaction (thd=0xb76f7540, on=true)
[27 Feb 2006 15:08] Tomas Ulin
updated synopsis
[27 Feb 2006 15: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/3194
[27 Feb 2006 15: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/3196
[28 Feb 2006 12:34] Sergey Petrunya
Approved the changed patch discussed on irc.
[28 Feb 2006 12:35] 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/3239
[28 Feb 2006 12:45] Tomas Ulin
pushed to 5.1.8
[28 Feb 2006 14: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/3243
[28 Feb 2006 15: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/3248
[28 Feb 2006 19:37] Jon Stephens
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Documented fix in 5.1.8 changelog. Closed.