Bug #16385 Partitions: crash when updating a range partitioned NDB table
Submitted: 11 Jan 2006 19:40 Modified: 21 Sep 2006 13:45
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S1 (Critical)
Version:5.1 OS:
Assigned to: Jonathan Miller CPU Architecture:Any

[11 Jan 2006 19:40] Matthias Leich
Description:
SET SESSION storage_engine='NDB';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
PARTITION BY RANGE(f1)
( PARTITION part1 VALUES LESS THAN (2),
PARTITION part2 VALUES LESS THAN (1000));
INSERT INTO t1 VALUES(1, '---1---');
INSERT INTO t1 VALUES(2, '---2---');
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
   --> Crash

The crash disappears, when the MyISAM storage engine
is used.

The "crashing" update causes that the record with f1 =1
has to be moved from the partition part1 to the partition
part2. I guess that is the reason for the crash, because
the first update (causing no move between partitions)
is harmless.

My environment:
   - Intel PC with Linux(SuSE 9.3)
   - MySQL compiled from source
         bk-internal.mysql.com:/home/bk/mysql-5.1-wl2604-new
               ChangeSet@1.2031, 2006-01-11
         bk-internal.mysql.com:/home/bk/mysql-5.1-new
               last Changeset around 2006-01-09

How to repeat:
Please execute the statements above or use my attached 
testscript ml088.test
  copy it to mysql-test/t
  echo "Dummy" > r/ml088.result   # Produce a dummy file with 
                                                   # expected results
  ./mysql-test-run ml088
[11 Jan 2006 19:41] Matthias Leich
testscript

Attachment: ml088.test (application/test, text), 656 bytes.

[24 Feb 2006 9:47] Martin Skold
This test example works for me:
-- source include/have_ndb.inc
-- source include/not_embedded.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE=NDB
	     	PARTITION BY RANGE(f1)
     		( PARTITION part1 VALUES LESS THAN (2),
       		  PARTITION part2 VALUES LESS THAN (1000));
INSERT INTO t1 VALUES(1, '---1---');
INSERT INTO t1 VALUES(2, '---2---');

# This update is harmless, 
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2;

# This update shifts the record from the first partition into the second
# but does NOT crash the server.
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;

DROP TABLE t1;

Please verify if bug still exists.

However, partition_03ndb.test is disabled with reference to this bug, but if enabled it is skipped. Adding -- source include/not_embedded.inc  causes it to run, but it hangs on query: ALTER TABLE t1 ADD PARTITION (PARTITION part1)
Maybe a different bug.

BR
-- Martin
[24 Feb 2006 11:29] Matthias Leich
1. Reexecution of the test causing the crash

MySQL 5.1 source distrib
last ChangeSet@1.2166, 2006-02-23

-- source include/have_ndb.inc
-- source include/not_embedded.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 ( f1 INTEGER, f2 char(20)) ENGINE=NDB
PARTITION BY RANGE(f1)
( PARTITION part1 VALUES LESS THAN (2),
PARTITION part2 VALUES LESS THAN (1000));
INSERT INTO t1 VALUES(1, '---1---');
INSERT INTO t1 VALUES(2, '---2---');
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 2; 
UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1;
          <----------
mysqltest: At line 14: query 'UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1' 
failed: 2013: Lost connection to MySQL server during query

Snip from var/log/master.err
-----------------------------------
thd=0x42d4d398
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...
Cannot determine thread, fp=0x42fa834c, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x820e8a5
0xffffe420
0x6
0x83bda62
0x8301cb1
0x829f1d7
0x822b657
0x8232eaf
0x8227707
0x8226eec
0x8225f61
0x40173aa7
0x402a4c2e
New value of fp=(nil) failed sanity check, terminating stack trace!
Please read http://dev.mysql.com/doc/mysql/en/Using_stack_trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x8acfd28 = UPDATE t1 SET f1 = f1 + 4 WHERE f1 = 1
thd->thread_id=2
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file

Please tell me if and how I can send more informations.

2. I can confirm the an ugly effect.
    I store the code above as testfile t/ml1107.test the test gets skipped.
    If I rename the test to t/ndb_ml1107.test it gets executed.
    BTW: I do not need to include "-- source include/not_embedded.inc".
    There seems to be something wrong within our tools.
[28 Feb 2006 10:34] 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/3231
[28 Feb 2006 12:41] Tomas Ulin
committed with wrong bug number, resetting to verified
[1 Mar 2006 13:09] Jonathan Miller
http://bugs.mysql.com/?id=17806 maybe a duplicate of this one according to Tomas, but with out the stack trace having been done it is hard from me to tell. Any way you may want to look at 17806 to see if these are the same.

Thanks
JBM
[1 Mar 2006 14:27] Tomas Ulin
pushed to 5.1.8
[2 Mar 2006 6:43] Jon Stephens
Documented as fix for this bug and Bug #17806 in 5.1.8 changelog. Closed.
[15 Sep 2006 15:54] Lars Thalmann
Test case 'partition_03ndb' still disabled in test suite.
Reopening this bug.  Please change bug number if this
is not the correct bug report.
[21 Sep 2006 13:45] Jonathan Miller
Trying to create an NDB table using Range Partitions now returns a 1005