Bug #27775 mediumint auto_increment with ndb_restore
Submitted: 12 Apr 2007 4:34 Modified: 17 Apr 2007 11:35
Reporter: Adam Dixon Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:5.0.40, 5.1.16 OS:Any
Assigned to: Tomas Ulin CPU Architecture:Any
Tags: auto_increment, mediumint, ndb_restore

[12 Apr 2007 4:34] Adam Dixon
Description:
Cluster mediumint columns with auto_increment, when restored with ndb_restore does not maintain the Auto_increment (and causes duplicate key errors).

How to repeat:
CREATE TABLE `t1` (`c1` mediumint(5) NOT NULL auto_increment, `c2` varchar(4) default NULL, PRIMARY KEY (`c1`)) ENGINE=ndbcluster;
INSERT INTO t1 (c2) VALUES (1),(1),(1),(1),(1),(1),(1), (1),(1),(1),(1),(1),(1),(1), (1),(1),(1),(1),(1),(1),(1), (1),(1),(1),(1),(1),(1),(1), (1),(1),(1),(1),(1),(1),(1), (1),(1),(1),(1);
INSERT INTO t1 (c2) SELECT c2 FROM t1;INSERT INTO t1 (c2) SELECT c2 FROM t1;INSERT INTO t1 (c2) SELECT c2 FROM t1;INSERT INTO t1 (c2) SELECT c2 FROM t1;INSERT INTO t1 (c2) SELECT c2 FROM t1;

ndb_mgm> start backup
ndb_mgm> all restart -i

/usr/local/mysql50/bin/ndb_restore -c localhost /usr/local/mysqlcluster/ndbd1/BACKUP/BACKUP-1/ -p 1 -n 2 -b 1 -m
/usr/local/mysql50/bin/ndb_restore -c localhost /usr/local/mysqlcluster/ndbd1/BACKUP/BACKUP-1/ -p 1 -n 2 -b 1 -r
/usr/local/mysql50/bin/ndb_restore -c localhost /usr/local/mysqlcluster/ndbd2/BACKUP/BACKUP-1/ -p 1 -n 3 -b 1 -r

mysql> show table status\G
*************************** 1. row ***************************
           Name: t1
         Engine: ndbcluster
        Version: 10
     Row_format: Dynamic
           Rows: 624
 Avg_row_length: 28
    Data_length: 131072
Max_data_length: 0
   Index_length: 0
      Data_free: 0
 Auto_increment: 256

Where as before backup this was 600 odd.
[12 Apr 2007 4:39] Adam Dixon
Does not seem to effect tinyint, int or bigint in the same way.
[12 Apr 2007 23:22] 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/24438

ChangeSet@1.2448, 2007-04-13 01:37:24+02:00, tomas@whalegate.ndb.mysql.com +4 -0
  Bug#27775 mediumint auto_increment with ndb_restore
  - autoincrement column of size medium int not handled in ndb_restore
  - added testcase also for other types, tiny, small... etc
[15 Apr 2007 16:48] Bugs System
Pushed into 5.1.18-beta
[15 Apr 2007 16:53] Bugs System
Pushed into 5.0.40
[17 Apr 2007 11:35] 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 bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.0.40 and 5.1.18 changelogs.