Bug #31754 ndb_mgm -e "start backup wait started" does not display output on stdout
Submitted: 22 Oct 2007 14:50 Modified: 13 Apr 2009 14:52
Reporter: Oli Sennhauser Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:5.1.21 OS:Any
Assigned to: jack andrews CPU Architecture:Any

[22 Oct 2007 14:50] Oli Sennhauser
Description:
Customer wants to use output of command:

ndb_mgm -e "start backup wait started"

to parse the backup id!

How to repeat:
ndb_mgm> start backup nowait
Connected to Management Server at: localhost:1186
ndb_mgm> Node 2: Backup 15 started from node 1

Works as expected. But

# ndb_mgm -e "start backup wait started"
Connected to Management Server at: localhost:1186
Waiting for started, this may take several minutes

Does not provide this information. So customer cannot use this output for parsing...

Suggested fix:
Output should be identical for both methods. Seems to be a design bug?
[21 Nov 2007 18:26] Tomas Ulin
Workaround, and much more reliable way to get the backup id

ndb_select_all --ndb-connectstring="localhost:$NDBCLUSTER_PORT" -d sys --delimiter=',' SYSTAB_0 | grep 520093696 > $MYSQLTEST_VARDIR/tmp.dat

CREATE TEMPORARY TABLE IF NOT EXISTS test.backup_info (id INT, backup_id INT) ENGINE = HEAP;
DELETE FROM test.backup_info;
LOAD DATA INFILE '../tmp.dat' INTO TABLE test.backup_info FIELDS TERMINATED BY ',';
SELECT @the_backup_id:=backup_id FROM test.backup_info;
[21 Nov 2007 22:19] MySQL Verification Team
Simpler method for selecting backup id is:

$ ndb_select_all --ndb-connectstring="$NDB_CONNECT_STRING" -d sys SYSTAB_0 | grep 520093696 | cut -f 2
[21 Nov 2007 23:14] Hartmut Holzgraefe
ndb_backup tool source

Attachment: ndb_backup-0.1.tar.gz (application/x-gunzip, text), 299.40 KiB.

[21 Nov 2007 23:24] Hartmut Holzgraefe
Given that the ndm_mgm_start_backup() MGMAPI call
returns the backup id anyway the attached source
for a "ndb_backup" binary seems to be a cleaner
approach to me.

Usage: ndb_backup [-c connectstring] [-w wait]

"wait" can be 0, 1, or 2 for NOWAIT, WAIT STARTED
and WAIT_COMPLETED, the default is 2 for wait
completed.

The output looks like this:

  starting backup
  backup 6 started

If "wait" is set to 0 for NOWAIT the backup id
will be reported as 0 as in this case the API
call will not wait for the cluster nodes to
report the backup id.
[5 Dec 2007 1:22] Stewart Smith
I'd be happy to add this to the standard distribution - it seems useful. Care to prepare a patch?
[31 Mar 2009 9:05] 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/70866

2862 jack andrews	2009-03-31
      bug#31754 ndb_mgm -e 'start backup wait started' does not display output on stdout
[31 Mar 2009 11:07] Magnus BlÄudd
Approved for MySQL CLuster 7.0

Remember to file new bug about "ndb_backup" tool
[1 Apr 2009 11:01] Bugs System
Pushed into 5.1.32-ndb-7.0.5 (revid:jack@sun.com-20090401104309-3ywt3htkjxd4evef) (version source revid:jack@sun.com-20090331090422-rehidt7tiljfr0p5) (merge vers: 5.1.32-ndb-7.0.4) (pib:6)
[13 Apr 2009 14:52] Jon Stephens
Documented in the NDB-7.0.5 changelog as follows:

        Invoking the management client START BACKUP command from the system
        shell (for example, as ndb_mgm -e "START BACKUP") did not work
        correctly, unless the backup ID was included when the command was
        invoked.

        Now, the backup ID is no longer required in such cases, and the backup
        ID that is automatically generated is printed to stdout, similar to how
        this is done when invoking START BACKUP within the management client.

Also updated the following Note in http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-backup-using-management-client.html from 

        *Note* If you start a backup using ndb_mgm -e "START BACKUP", the 
        backup_id is required.

to

        *Note* Prior to MySQL Cluster NDB 7.0.5, when starting a backup 
        using ndb_mgm -e "START BACKUP", the backup_id was required. 
        (Bug #31754)