diff options
author | unknown <tomas@poseidon.ndb.mysql.com> | 2005-01-23 12:12:50 +0100 |
---|---|---|
committer | unknown <tomas@poseidon.ndb.mysql.com> | 2005-01-23 12:12:50 +0100 |
commit | fdedd0fc5b75c98d3fb8a84448e14942309445d4 (patch) | |
tree | a9a365c81c7656093a603935453a609e23ae79d3 /ndb | |
parent | d3db70de4c6027b9ae62b0814cdd45718e58a556 (diff) | |
download | mariadb-git-fdedd0fc5b75c98d3fb8a84448e14942309445d4.tar.gz |
backported from 5.0 extra option to ndb_waiter
Diffstat (limited to 'ndb')
-rw-r--r-- | ndb/tools/waiter.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/ndb/tools/waiter.cpp b/ndb/tools/waiter.cpp index 4b86de36514..dfdb11524e3 100644 --- a/ndb/tools/waiter.cpp +++ b/ndb/tools/waiter.cpp @@ -31,11 +31,13 @@ waitClusterStatus(const char* _addr, ndb_mgm_node_status _status, unsigned int _timeout); enum ndb_waiter_options { - NDB_STD_OPTS_OPTIONS + NDB_STD_OPTS_OPTIONS, + OPT_WAIT_STATUS_NOT_STARTED }; NDB_STD_OPTS_VARS; static int _no_contact = 0; +static int _not_started = 0; static int _timeout = 120; static struct my_option my_long_options[] = { @@ -43,6 +45,9 @@ static struct my_option my_long_options[] = { "no-contact", 'n', "Wait for cluster no contact", (gptr*) &_no_contact, (gptr*) &_no_contact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, + { "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started", + (gptr*) &_not_started, (gptr*) &_not_started, 0, + GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "timeout", 't', "Timeout to wait", (gptr*) &_timeout, (gptr*) &_timeout, 0, GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 }, @@ -91,12 +96,22 @@ int main(int argc, char** argv){ if (_hostName == 0) _hostName= opt_connect_str; - if (_no_contact) { - if (waitClusterStatus(_hostName, NDB_MGM_NODE_STATUS_NO_CONTACT, _timeout) != 0) - return NDBT_ProgramExit(NDBT_FAILED); - } else if (waitClusterStatus(_hostName, NDB_MGM_NODE_STATUS_STARTED, _timeout) != 0) - return NDBT_ProgramExit(NDBT_FAILED); + enum ndb_mgm_node_status wait_status; + if (_no_contact) + { + wait_status= NDB_MGM_NODE_STATUS_NO_CONTACT; + } + else if (_not_started) + { + wait_status= NDB_MGM_NODE_STATUS_NOT_STARTED; + } + else + { + wait_status= NDB_MGM_NODE_STATUS_STARTED; + } + if (waitClusterStatus(_hostName, wait_status, _timeout) != 0) + return NDBT_ProgramExit(NDBT_FAILED); return NDBT_ProgramExit(NDBT_OK); } |