Bug #48907 ndb_restore with both --include-databases and -tables ignores databases
Submitted: 19 Nov 2009 14:01 Modified: 6 Dec 2009 23:41
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:ndb-6.3.28, ndb-7.0.9 OS:Any
Assigned to: Martin Skold CPU Architecture:Any

[19 Nov 2009 14:01] Hartmut Holzgraefe
Description:
Documentation says 

  You can use these two options together. For example, 
  the following causes all tables in databases db1 and db2, 
  together with the tables t1 and t2 in database db3, to be 
  restored (and no other databases or tables):

  shell> ndb_restore [...] --include-databases=db1,db2 --include-tables=db3.t1,db3.t2

but this actually only restores db3.t1 and db3.t2 and no tables from db1 or db2

How to repeat:
Try the example from the docs and check ndb_restore output for actually restored tables

Suggested fix:
Make checkDoRestore() in storage/ndb/tools/restore/restore_main.cpp merge the tables and databases results instead of overwriting the databases check result with the table check result
[30 Nov 2009 14:40] Martin Skold
Actually there are tests for this, but the expected result is wrong.
After a discussion with Jonas the preferred semantics is that arguments
are accumulative:
--include-tables db1.t1 --include-tables db1.t2
would restore both tables
--exclude-tables db1.t1 --exclude-tables db1.t2
would skip both tables (but include all other tables)
and search for a match should be right to left.
for example,
--include-databases db1 --exclude-tables db1.t1
would include all tables from db1 except db1.t1,
but
--exclude-tables db1.t1 --include-databases db1
would include all tables from db1 including db1.t1
[2 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/92424

3171 Martin Skold	2009-12-02
      Bug #48907  ndb_restore with both --include-databases and -tables ignores databases: Changed semantics of include/exclude flags to be accumulative and evaluated right to left
      modified:
        mysql-test/suite/ndb/r/ndb_restore_options.result
        mysql-test/suite/ndb/t/ndb_restore_options.test
        storage/ndb/tools/restore/restore_main.cpp
[2 Dec 2009 13:54] 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/92457

3245 Martin Skold	2009-12-02 [merge]
      Bug #48907  ndb_restore with both --include-databases and -tables ignores databases: Changed semantics of include/exclude flags to be accumulative and evaluated right to left
      modified:
        mysql-test/suite/ndb/r/ndb_restore_options.result
        mysql-test/suite/ndb/t/ndb_restore_options.test
        storage/ndb/tools/restore/restore_main.cpp
[2 Dec 2009 14:12] 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/92463

3168 Martin Skold	2009-12-02 [merge]
      Bug #48907  ndb_restore with both --include-databases and -tables ignores databases: Changed semantics of include/exclude flags to be accumulative and evaluated right to left
      modified:
        mysql-test/suite/ndb/r/ndb_restore_options.result
        mysql-test/suite/ndb/t/ndb_restore_options.test
        storage/ndb/tools/restore/restore_main.cpp
[2 Dec 2009 14:14] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:martin.skold@mysql.com-20091202141146-7djalxpju7bfcaga) (version source revid:martin.skold@mysql.com-20091202141146-7djalxpju7bfcaga) (merge vers: 5.1.39-ndb-7.1.0) (pib:13)
[2 Dec 2009 14:15] Bugs System
Pushed into 5.1.39-ndb-7.0.10 (revid:martin.skold@mysql.com-20091202135407-t3mmgyhpl34j786d) (version source revid:martin.skold@mysql.com-20091202135407-t3mmgyhpl34j786d) (merge vers: 5.1.39-ndb-7.0.10) (pib:13)
[6 Dec 2009 23:41] Jon Stephens
Documented bugfix in the NDB-6.3.29 and 7.0.10 changelogs as follows:

      When evaluating the options --include-databases, 
      --include-tables, --exclude-databases, and --exclude-tables, 
      the ndb_restore program overwrote the result of the database-level 
      options with the result of the table-level options rather than 
      merging these results together.

      As part of the fix for this problem, the semantics of these options
      have been clarified; because of this, the rules governing their 
      evaluation have changed slightly. These changes be summed up as 
      follows:
      
      ·All --include-* and --exclude-* options are now evaluated, and 
      none are discarded. 
      
      ·All --include-* and --exclude-* options are evaluated from right 
      to left, in the order that they are passed to ndb_restore.
      
      ·In the event of a conflict, the first (rightmost) option takes 
      precedence.
      
      For more detailed information and examples, see "ndb_restore — 
      Restore a MySQL Cluster Backup".

Also updated option descriptions and examples in the indicated section of the Manual.

Closed.