Bug #33801 ndb_restore on particular table fails
Submitted: 10 Jan 2008 16:48 Modified: 5 Oct 2008 18:38
Reporter: Johan Andersson
Status: Closed
Category:Server: Cluster Severity:S3 (Non-critical)
Version:>= telco-6.2 OS:Linux
Assigned to: Bugs System Target Version:6.0
Tags: ndb_restore
Triage: Triaged: D2 (Serious)

[10 Jan 2008 16:48] Johan Andersson
Description:
I have a backup containing tables t1 and t2.
I want to restore only table t1.

ndb_restore  -c ps-ndb01 -b 1 -n 2 -r -m /data1/johan/mysqlcluster/BACKUP/BACKUP-1/ test
t1

Backup Id = 1
Nodeid = 2
backup path = /data1/johan/mysqlcluster/BACKUP/BACKUP-1/
Restoring only from database test
Restoring only tables: t1
Opening file '/data1/johan/mysqlcluster/BACKUP/BACKUP-1/BACKUP-1.2.ctl'
Ndb version in backup files: ndb-6.3.7
Connected to ndb!!
Successfully restored table `test/def/t1`
Event for table test/def/t1 already exists, removing.
Successfully restored table event REPL$test/t1
Successfully created index `PRIMARY` on `t1`
Successfully created index `b` on `t1`
Unable to find table: t2
Restore: Failed to restore data, test/def/t2 table structure doesn't match backup ...
Exiting 

The problem above is that only the meta data for table t1 has been restored, but  this is
not respected when later restoring the data. Then it expects t2 to be there as well.

I have to restore the meta data for _all_ tables (t1 and t2):
ndb_restore  -c ps-ndb01 -b 1 -n 2 -m /data1/johan/mysqlcluster/BACKUP/BACKUP-1/ 

and then restore the data from table t1:

ndb_restore  -c ps-ndb01 -b 1 -n 2 -r /data1/johan/mysqlcluster/BACKUP/BACKUP-1/ test t1

I think it should not be necessary to have all tables restored to the database in order to
restore the data for just one table. 

How to repeat:
See above

Suggested fix:
-
[10 Jan 2008 16:59] Tomas Ulin
my guess it is the same problem in 6.2
[10 Jan 2008 22:03] David Shrewsbury
Verified
[24 Jan 2008 8:07] 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/41189

ChangeSet@1.2660, 2008-01-24 15:06:49+08:00, gni@dev3-221.dev.cn.tlan +1 -0
  BUG#33801 ndb_restore on non-restored table fails
[9 Apr 2008 11:56] Jonas Oreland
please also add a testcase
[10 Apr 2008 5:59] 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/45169

ChangeSet@1.2661, 2008-04-10 11:56:10+08:00, gni@dev3-221.ts.cn.tlan +2 -0
  BUG#33801 Add test case for it.
[30 May 2008 8:28] Jonas Oreland
ok to push to 6.2
when merging to 6.3, fix also attribute promotion branch
[21 Jul 2008 16:22] Michael Neubert
Hello,

it would be nice, if the Patch for this solved Bug will be included in the next release of
6.2.x (maybe 6.2.16?), because in my opinion this Backup problem has a higher severity
than S3. At the moment I am not able to use the not patched 6.2.x binaries at the MySQL
Cluster website and everytime I want to upgrade the cluster I have to use a source
distribution, that I have to patch manually.

Thank you very much!

Best wishes
Michael
[23 Jul 2008 4:43] Guangbao Ni
Hello Michael,
  
  I will push it into telco-6.2 tree and merge it into telco-6.3 tree as soon as
possible.

/Guangbao
[24 Jul 2008 8:04] 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/50374

2633 Guangbao Ni	2008-07-24
      BUG#33801 ndb_restore on non-restored tables fails
[24 Jul 2008 11:29] 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/50392

2633 Guangbao Ni	2008-07-24
      BUG#33801 ndb_restore fails when not all tables are restored once
[24 Jul 2008 12:21] 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/50393

2642 Guangbao Ni	2008-07-24 [merge]
      BUG#33801 ndb_restore fails when not all table is restored once
[24 Jul 2008 13:04] 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/50396

2642 Guangbao Ni	2008-07-24 [merge]
      BUG#33801 ndb_restore fails when not all tables are restored once
[24 Jul 2008 13:44] 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/50398

2678 Guangbao Ni	2008-07-24 [merge]
      BUG#33801 ndb_restore fails when not all tables are restored once
[25 Jul 2008 8:33] Guangbao Ni
pushed into mysql-5.1-telco-6.2 and merged into mysql-5.1-telco-6.3 and
mysql-5.1-telco-6.4
[11 Sep 2008 19:14] Jon Stephens
Documented in the NDB 6.2.16 and 6.3.17 changelogs as follows:

        ndb_restore failed when a single table was specified.

Left in PQ status.
[5 Oct 2008 18:38] Jon Stephens
Already documented for NDB 6.2/6.2; closed.
[13 Dec 2008 0:25] Bugs System
Pushed into 6.0.6-alpha  (revid:gni@mysql.com-20080724092305-hod3wc04sboy4fk0) (version
source revid:jonas@mysql.com-20080812185642-1nevjb94zj621dqx) (pib:5)