Bug #48005 ndb backup / restore does not restore the auto_increment
Submitted: 12 Oct 2009 17:23 Modified: 5 Dec 2009 10:18
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
Tags: 6.3.26

[12 Oct 2009 17:23] Andrew Hutchings
Description:
When doing a backup of an ndb table with a non-sequential auto_increment this auto_increment is not restored.

How to repeat:
mysql> create table t1 (a int primary key auto_increment, b int) auto_increment=200 engine=ndb;

mysql> show table status\G
*************************** 1. row ***************************
           Name: t1
         Engine: ndbcluster
        Version: 10
     Row_format: Fixed
           Rows: 0
 Avg_row_length: 0
    Data_length: 0
Max_data_length: 0
   Index_length: 0
      Data_free: 0
 Auto_increment: 200
    Create_time: NULL
    Update_time: NULL
     Check_time: NULL
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options: 
        Comment: 
1 row in set (0.00 sec)

ndb_mgm> start backup

mysql> drop table t1;
Query OK, 0 rows affected (1.13 sec)

shell> ndb_restore -m -n2 -b1 BACKUP/BACKUP-1/

mysql> show table status\G
*************************** 1. row ***************************
           Name: t1
         Engine: ndbcluster
        Version: 10
     Row_format: Fixed
           Rows: 0
 Avg_row_length: 0
    Data_length: 0
Max_data_length: 0
   Index_length: 0
      Data_free: 0
 Auto_increment: 18446744073709551615
    Create_time: NULL
    Update_time: NULL
     Check_time: NULL
      Collation: latin1_swedish_ci
       Checksum: NULL
 Create_options: 
        Comment: 
1 row in set (0.00 sec)

Suggested fix:
Either the auto_increment is not backed-up or not restored.  Not sure which needs fixing
[25 Nov 2009 12:37] 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/91591

3038 Martin Skold	2009-11-25
      Bug#48005 ndb backup / restore does not restore the auto_increment: Restoring auto_increment values directly from SYSTAB_0
      modified:
        mysql-test/suite/ndb/r/ndb_restore.result
        mysql-test/suite/ndb/t/ndb_restore.test
        storage/ndb/include/ndbapi/NdbDictionary.hpp
        storage/ndb/src/ndbapi/NdbDictionary.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
        storage/ndb/tools/restore/Restore.cpp
        storage/ndb/tools/restore/Restore.hpp
        storage/ndb/tools/restore/consumer_printer.cpp
        storage/ndb/tools/restore/consumer_restore.cpp
        storage/ndb/tools/restore/consumer_restore.hpp
        storage/ndb/tools/restore/restore_main.cpp
[1 Dec 2009 8:56] 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/92225

3039 Martin Skold	2009-12-01
      Bug#48005 ndb backup / restore does not restore the auto_increment: Post review changes
      modified:
        storage/ndb/tools/restore/Restore.cpp
[1 Dec 2009 9: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/92231

3169 Martin Skold	2009-12-01 [merge]
      Merge
      modified:
        mysql-test/suite/ndb/r/ndb_restore.result
        mysql-test/suite/ndb/t/ndb_restore.test
        storage/ndb/include/ndbapi/NdbDictionary.hpp
        storage/ndb/src/ndbapi/NdbDictionary.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
        storage/ndb/tools/restore/Restore.cpp
        storage/ndb/tools/restore/Restore.hpp
        storage/ndb/tools/restore/consumer_printer.cpp
        storage/ndb/tools/restore/consumer_restore.cpp
        storage/ndb/tools/restore/consumer_restore.hpp
        storage/ndb/tools/restore/restore_main.cpp
[1 Dec 2009 10:16] 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/92239

3243 Martin Skold	2009-12-01 [merge]
      Bug#48005 ndb backup / restore does not restore the auto_increment: Merge
      modified:
        mysql-test/suite/ndb/r/ndb_restore.result
        mysql-test/suite/ndb/t/ndb_restore.test
        storage/ndb/include/ndbapi/NdbDictionary.hpp
        storage/ndb/src/ndbapi/NdbDictionary.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
        storage/ndb/tools/restore/Restore.cpp
        storage/ndb/tools/restore/Restore.hpp
        storage/ndb/tools/restore/consumer_printer.cpp
        storage/ndb/tools/restore/consumer_restore.cpp
        storage/ndb/tools/restore/consumer_restore.hpp
        storage/ndb/tools/restore/restore_main.cpp
[1 Dec 2009 10:41] 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/92242

3166 Martin Skold	2009-12-01 [merge]
      Bug#48005 ndb backup / restore does not restore the auto_increment: Merge
      modified:
        mysql-test/suite/ndb/r/ndb_restore.result
        mysql-test/suite/ndb/t/ndb_restore.test
        storage/ndb/include/ndbapi/NdbDictionary.hpp
        storage/ndb/src/ndbapi/NdbDictionary.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
        storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
        storage/ndb/tools/restore/Restore.cpp
        storage/ndb/tools/restore/Restore.hpp
        storage/ndb/tools/restore/consumer_printer.cpp
        storage/ndb/tools/restore/consumer_restore.cpp
        storage/ndb/tools/restore/consumer_restore.hpp
        storage/ndb/tools/restore/restore_main.cpp
[1 Dec 2009 13:03] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:martin.skold@mysql.com-20091201130213-a9j68fah3ipy7k14) (version source revid:martin.skold@mysql.com-20091201103858-tr0703x6c8oryqdh) (merge vers: 5.1.39-ndb-7.1.0) (pib:13)
[1 Dec 2009 13:56] Bugs System
Pushed into 5.1.39-ndb-7.0.10 (revid:martin.skold@mysql.com-20091201133250-evnzqq7qygz0fa9n) (version source revid:martin.skold@mysql.com-20091201101525-z3gdvs3i75cirlxx) (merge vers: 5.1.39-ndb-7.0.10) (pib:13)
[1 Dec 2009 14:14] Bugs System
Pushed into 5.1.39-ndb-6.3.29 (revid:martin.skold@mysql.com-20091201140159-7rlpu813i56ye1s8) (version source revid:martin.skold@mysql.com-20091201093523-n1rerybwg6gjvodc) (merge vers: 5.1.39-ndb-6.3.29) (pib:13)
[1 Dec 2009 14:24] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:martin.skold@mysql.com-20091201142220-m02zfuchngatu8ja) (version source revid:martin.skold@mysql.com-20091201085639-iq2asun30d6qasoh) (merge vers: 5.1.39-ndb-6.2.19) (pib:13)
[5 Dec 2009 10:18] Jon Stephens
Documented bugfix in the NDB-6.2.19, 6.3.29, and 7.0.10 changelogs, as follows:

        When employing NDB native backup to back up and restore an empty 
        NDB table that used AUTO_INCREMENT, the AUTO_INCREMENT value was 
        not restored correctly.

Closed.