diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-04-16 00:18:54 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:50:40 -0500 |
commit | c9f04d8648cfdd573d45d47467bc964ef01f754d (patch) | |
tree | 115acf98b7b136f07dd8b16bbd50c9f7cbcdd3bb /source4/cluster/ctdb/tests/ctdb_test.c | |
parent | bb36705c8d360a2ba865a3d8118c52afa1e46f4e (diff) | |
download | samba-c9f04d8648cfdd573d45d47467bc964ef01f754d.tar.gz samba-c9f04d8648cfdd573d45d47467bc964ef01f754d.tar.bz2 samba-c9f04d8648cfdd573d45d47467bc964ef01f754d.zip |
r22231: merge from bzr ctdb tree
(This used to be commit 807b959082d3b9a929c9f6597714e636638a940e)
Diffstat (limited to 'source4/cluster/ctdb/tests/ctdb_test.c')
-rw-r--r-- | source4/cluster/ctdb/tests/ctdb_test.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source4/cluster/ctdb/tests/ctdb_test.c b/source4/cluster/ctdb/tests/ctdb_test.c index 908a2eaac7..62c7d1c552 100644 --- a/source4/cluster/ctdb/tests/ctdb_test.c +++ b/source4/cluster/ctdb/tests/ctdb_test.c @@ -81,6 +81,7 @@ int main(int argc, const char *argv[]) const char *transport = "tcp"; const char *myaddress = NULL; int self_connect=0; + int daemon_mode=0; struct poptOption popt_options[] = { POPT_AUTOHELP @@ -88,6 +89,7 @@ int main(int argc, const char *argv[]) { "listen", 0, POPT_ARG_STRING, &myaddress, 0, "address to listen on", "address" }, { "transport", 0, POPT_ARG_STRING, &transport, 0, "protocol transport", NULL }, { "self-connect", 0, POPT_ARG_NONE, &self_connect, 0, "enable self connect", "boolean" }, + { "daemon", 0, POPT_ARG_NONE, &daemon_mode, 0, "spawn a ctdb daemon", "boolean" }, POPT_TABLEEND }; int opt; @@ -134,6 +136,17 @@ int main(int argc, const char *argv[]) ctdb_set_flags(ctdb, CTDB_FLAG_SELF_CONNECT); } + if (daemon_mode) { + ctdb_set_flags(ctdb, CTDB_FLAG_DAEMON_MODE); + } + + /* this flag is only used by test code and it makes ctdb_start() block until all + nodes have connected. + until we do better recovery and cluster rebuild it is probably good to use this flag + in applications. + */ + ctdb_set_flags(ctdb, CTDB_FLAG_CONNECT_WAIT); + ret = ctdb_set_transport(ctdb, transport); if (ret == -1) { printf("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb)); @@ -168,10 +181,6 @@ int main(int argc, const char *argv[]) /* start the protocol running */ ret = ctdb_start(ctdb); - /* wait until all nodes are connected (should not be needed - outide of test code) */ - ctdb_connect_wait(ctdb); - ZERO_STRUCT(call); call.key.dptr = discard_const("test"); call.key.dsize = strlen("test")+1; @@ -210,6 +219,11 @@ int main(int argc, const char *argv[]) /* go into a wait loop to allow other nodes to complete */ ctdb_wait_loop(ctdb); + /*talloc_report_full(ctdb, stdout);*/ + +/* sleep for a while so that our daemon will remaining alive for the other nodes in the cluster */ +sleep(10); + /* shut it down */ talloc_free(ctdb); return 0; |