[SCM] CTDB repository - branch master updated - ctdb-1.11-19-g3ce1d3d

Ronnie Sahlberg sahlberg at samba.org
Wed Sep 7 19:34:15 MDT 2011


The branch, master has been updated
       via  3ce1d3d6c8b8fd3097b8efd2c75797ed7682a562 (commit)
       via  7bebfc7bad8f36e54003b8e25372fdaf54836e21 (commit)
       via  2165a6f5117a71f9f97f46be9708fa34c037e17c (commit)
       via  b63333fb81aadc451df47c0c3c038e6165f0eac2 (commit)
       via  80ad2979804f5bba29020ace46e114a45fa6cb66 (commit)
       via  137b498c75c55c966999cd788f12ed9010cfed3a (commit)
       via  28df6fbf1273b8d095a2bc38dca6a6c35c5c31bd (commit)
       via  fe7f69d6fc37661c2f1caa11de4ed3a7940d0a2f (commit)
       via  3885141f37724b3dea61b45fbac38489ec356588 (commit)
       via  9e178671560cb95121e11d718a76b05380ecd6c5 (commit)
       via  0634d0305f42f17048b6830733767e8dc300e11c (commit)
      from  a3e8784bb107f7acd2a95913c1e6def52ce96105 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3ce1d3d6c8b8fd3097b8efd2c75797ed7682a562
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Sep 8 09:28:33 2011 +1000

    Drop loglevel for a tevent message from FATAL to ERROR
    
    CQ S1028400

commit 7bebfc7bad8f36e54003b8e25372fdaf54836e21
Merge: a3e8784bb107f7acd2a95913c1e6def52ce96105 2165a6f5117a71f9f97f46be9708fa34c037e17c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Sep 8 11:22:53 2011 +1000

    Merge remote branch 'ddiss/master_pmda_and_client_timeouts'

commit 2165a6f5117a71f9f97f46be9708fa34c037e17c
Author: David Disseldorp <ddiss at suse.de>
Date:   Fri Sep 2 17:34:19 2011 +0200

    pmda: handle struct latency_counter and add num_recoveries
    
    Rebase the CTDB PMDA from 1.0.114 to master:
    - Add tevent and ctdb_protocol includes
    - Handle latency metrics now stored under struct latency_counter
    - Add new metric for the num_recoveries counter

commit b63333fb81aadc451df47c0c3c038e6165f0eac2
Author: David Disseldorp <ddiss at suse.de>
Date:   Fri Sep 2 17:43:13 2011 +0200

    pmda: document in README how to add a new metric

commit 80ad2979804f5bba29020ace46e114a45fa6cb66
Author: David Disseldorp <ddiss at suse.de>
Date:   Fri Sep 2 13:26:04 2011 +0200

    pmda: Use CTDB_PATH macro for default socket path
    
    Also includes some code cleanup changes.

commit 137b498c75c55c966999cd788f12ed9010cfed3a
Author: David Disseldorp <ddiss at suse.de>
Date:   Mon Aug 8 11:15:06 2011 +0200

    pmda: Pull ctdb statistics once per fetch
    
    Currently ctdb statistics are pulled in the PMDA fetch callback, which
    results in a CTDB_CONTROL_STATISTICS call for each metric.
    Do this once per fetch instead, and have the per-metric callbacks pull
    data from the last counter cache.

commit 28df6fbf1273b8d095a2bc38dca6a6c35c5c31bd
Author: David Disseldorp <ddiss at suse.de>
Date:   Wed Aug 3 10:38:27 2011 +0200

    pmda: Attempt reconnects while ctdbd is unavailable
    
    Attempt to reconnect to ctdbd on fetch while it is unreachable.
    
    We must provide our own queue callback wrapper, as ctdb_client_read_cb()
    exits on transport failure.

commit fe7f69d6fc37661c2f1caa11de4ed3a7940d0a2f
Author: David Disseldorp <ddiss at suse.de>
Date:   Wed Jul 13 18:11:23 2011 +0200

    pmda: Initial ctdb pmda check-in
    
    The CTDB Performance Metrics Domain Agent (PMDA) is compiled when
    Performance Co-Pilot (PCP) header files are present.
    
    The CTDB PMDA periodically requests runtime counters from ctdbd (similar
    to ctdb statistics) and exports these values via PCP for capture and
    charting etc.

commit 3885141f37724b3dea61b45fbac38489ec356588
Author: David Disseldorp <ddiss at suse.de>
Date:   Wed Aug 24 11:34:56 2011 +0200

    client: flag local node in ctdb -Y status output
    
    Regular "ctdb status" output flags which node is the local node, do the
    same for machine readable output.

commit 9e178671560cb95121e11d718a76b05380ecd6c5
Author: David Disseldorp <ddiss at suse.de>
Date:   Mon Aug 8 16:35:56 2011 +0200

    client: add timeout argument to ctdb_attach
    
    Rather than using a fixed 2 second CTDB_CONTROL_GETDBPATH timeout.

commit 0634d0305f42f17048b6830733767e8dc300e11c
Author: David Disseldorp <ddiss at suse.de>
Date:   Mon Aug 8 14:09:46 2011 +0200

    client: add req timeout argument to ctdb_cmdline_client
    
    Following connection to the local ctdbd, ctdb_cmdline_client() currently
    issues a CTDB_CONTROL_GET_PNN request with a fixed 3 second timeout.
    
    The ctdb cmd line client accepts a --timelimit argument for specifying
    a per request timeout, pass this value through to ctdb_cmdline_client()
    for use as a CTDB_CONTROL_GET_PNN request timeout.

-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                  |   18 ++-
 client/ctdb_client.c         |   10 +-
 common/cmdline.c             |    5 +-
 configure.ac                 |   20 ++
 include/ctdb_client.h        |   10 +-
 include/ctdb_private.h       |    1 +
 lib/tevent/tevent_util.c     |    2 +-
 server/ctdb_recoverd.c       |    2 +-
 tests/src/ctdb_bench.c       |    5 +-
 tests/src/ctdb_fetch.c       |    5 +-
 tests/src/ctdb_fetch_one.c   |    5 +-
 tests/src/ctdb_persistent.c  |    8 +-
 tests/src/ctdb_randrec.c     |    5 +-
 tests/src/ctdb_store.c       |    4 +-
 tests/src/ctdb_transaction.c |    8 +-
 tests/src/ctdb_traverse.c    |    4 +-
 tools/ctdb.c                 |   33 ++--
 tools/ctdb_vacuum.c          |    4 +-
 utils/pmda/Install           |   36 +++
 utils/pmda/README            |   84 ++++++
 utils/pmda/Remove            |   29 ++
 utils/pmda/domain.h          |   19 ++
 utils/pmda/help              |  106 ++++++++
 utils/pmda/pmda_ctdb.c       |  596 ++++++++++++++++++++++++++++++++++++++++++
 utils/pmda/pmns              |   73 +++++
 utils/pmda/root              |   10 +
 26 files changed, 1055 insertions(+), 47 deletions(-)
 create mode 100644 utils/pmda/Install
 create mode 100644 utils/pmda/README
 create mode 100644 utils/pmda/Remove
 create mode 100644 utils/pmda/domain.h
 create mode 100644 utils/pmda/help
 create mode 100644 utils/pmda/pmda_ctdb.c
 create mode 100644 utils/pmda/pmns
 create mode 100644 utils/pmda/root


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index df1d010..01483d0 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -29,6 +29,10 @@ POPT_LIBS = @POPT_LIBS@
 POPT_CFLAGS = @POPT_CFLAGS@
 POPT_OBJ = @POPT_OBJ@
 
+PMDA_LIBS = -lpcp -lpcp_pmda
+PMDA_INSTALL = @CTDB_PMDA_INSTALL@
+PMDA_DEST_DIR = /var/lib/pcp/pmdas
+
 CFLAGS=-g -I$(srcdir)/include -Iinclude -Ilib -Ilib/util -I$(srcdir) \
        -I at tallocdir@ -I at tdbdir@/include -I at libreplacedir@ \
 	-DVARDIR=\"$(localstatedir)\" -DETCDIR=\"$(etcdir)\" \
@@ -73,7 +77,8 @@ TEST_BINS=tests/bin/ctdb_bench tests/bin/ctdb_fetch tests/bin/ctdb_fetch_one \
 	tests/bin/ctdb_takeover_tests
 	@INFINIBAND_BINS@
 
-BINS = bin/ctdb @CTDB_SCSI_IO@ bin/smnotify bin/ping_pong bin/ltdbtool
+BINS = bin/ctdb @CTDB_SCSI_IO@ bin/smnotify bin/ping_pong bin/ltdbtool @CTDB_PMDA@
+
 SBINS = bin/ctdbd
 
 DIRS = lib bin tests/bin
@@ -150,6 +155,9 @@ bin/ping_pong: utils/ping_pong/ping_pong.o
 	@echo Linking $@
 	@$(CC) $(CFLAGS) -o $@ utils/ping_pong/ping_pong.o
 
+bin/pmdactdb: $(CTDB_CLIENT_OBJ) utils/pmda/pmda_ctdb.o
+	@echo Linking $@
+	@$(CC) $(CFLAGS) -o $@ utils/pmda/pmda_ctdb.o $(CTDB_CLIENT_OBJ) $(LIB_FLAGS) $(PMDA_LIBS)
 
 tests/bin/rb_test: $(CTDB_CLIENT_OBJ) tests/src/rb_test.o 
 	@echo Linking $@
@@ -224,7 +232,7 @@ distclean: clean
 	rm -f config.log config.status config.cache config.h
 	rm -f Makefile
 
-install: all
+install: all $(PMDA_INSTALL)
 	mkdir -p $(DESTDIR)$(libdir)/pkgconfig
 	mkdir -p $(DESTDIR)$(bindir)
 	mkdir -p $(DESTDIR)$(sbindir)
@@ -277,6 +285,12 @@ install: all
 	if [ ! -f $(DESTDIR)$(etcdir)/ctdb/notify.sh ];then ${INSTALLCMD} -m 755 config/notify.sh $(DESTDIR)$(etcdir)/ctdb; fi
 	if [ ! -f $(DESTDIR)$(etcdir)/ctdb/ctdb-crash-cleanup.sh ];then ${INSTALLCMD} -m 755 config/ctdb-crash-cleanup.sh $(DESTDIR)$(etcdir)/ctdb; fi
 
+install_pmda:
+	$(INSTALLCMD) -m 755 -d $(PMDA_DEST_DIR)
+	$(INSTALLCMD) -m 755 pmda/Install pmda/Remove $(PMDA_DEST_DIR)
+	$(INSTALLCMD) -m 644 pmda/pmns pmda/domain.h pmda/help pmda/README $(PMDA_DEST_DIR)
+	$(INSTALLCMD) -m 755 bin/pmdactdb $(PMDA_DEST_DIR)
+
 test: all
 	tests/run_tests.sh
 
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 55c3273..0828e98 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -186,7 +186,7 @@ static void ctdb_client_reply_control(struct ctdb_context *ctdb, struct ctdb_req
 /*
   this is called in the client, when data comes in from the daemon
  */
-static void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args)
+void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args)
 {
 	struct ctdb_context *ctdb = talloc_get_type(args, struct ctdb_context);
 	struct ctdb_req_header *hdr = (struct ctdb_req_header *)data;
@@ -1696,7 +1696,11 @@ static int ctdb_fetch_func(struct ctdb_call_info *call)
 /*
   attach to a specific database - client call
 */
-struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent, uint32_t tdb_flags)
+struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
+				    struct timeval timeout,
+				    const char *name,
+				    bool persistent,
+				    uint32_t tdb_flags)
 {
 	struct ctdb_db_context *ctdb_db;
 	TDB_DATA data;
@@ -1731,7 +1735,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name,
 	ctdb_db->db_id = *(uint32_t *)data.dptr;
 	talloc_free(data.dptr);
 
-	ret = ctdb_ctrl_getdbpath(ctdb, timeval_current_ofs(2, 0), CTDB_CURRENT_NODE, ctdb_db->db_id, ctdb_db, &ctdb_db->db_path);
+	ret = ctdb_ctrl_getdbpath(ctdb, timeout, CTDB_CURRENT_NODE, ctdb_db->db_id, ctdb_db, &ctdb_db->db_path);
 	if (ret != 0) {
 		DEBUG(DEBUG_ERR,("Failed to get dbpath for database '%s'\n", name));
 		talloc_free(ctdb_db);
diff --git a/common/cmdline.c b/common/cmdline.c
index 145a13a..5c00763 100644
--- a/common/cmdline.c
+++ b/common/cmdline.c
@@ -111,7 +111,8 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
 /*
   startup a client only ctdb context
  */
-struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
+struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
+					 struct timeval req_timeout)
 {
 	struct ctdb_context *ctdb;
 	char *socket_name;
@@ -152,7 +153,7 @@ struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
 	}
 
 	/* get our pnn */
-	ctdb->pnn = ctdb_ctrl_getpnn(ctdb, timeval_current_ofs(3, 0), CTDB_CURRENT_NODE);
+	ctdb->pnn = ctdb_ctrl_getpnn(ctdb, req_timeout, CTDB_CURRENT_NODE);
 	if (ctdb->pnn == (uint32_t)-1) {
 		DEBUG(DEBUG_CRIT,(__location__ " Failed to get ctdb pnn\n"));
 		talloc_free(ctdb);
diff --git a/configure.ac b/configure.ac
index cc3a114..adcc5da 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,15 @@ m4_include(lib/util/signal.m4)
 m4_include(lib/util/fault.m4)
 
 AC_CHECK_HEADERS(sched.h)
+AC_CHECK_HEADERS(pcp/pmapi.h pcp/impl.h pcp/pmda.h, [], [],
+[[#ifdef HAVE_PCP_PMAPI_H
+# include <pcp/pmapi.h>
+#endif
+#ifdef HAVE_PCP_IMPL_H
+# include <pcp/impl.h>
+#endif
+]])
+
 AC_CHECK_FUNCS(sched_setscheduler)
 AC_CHECK_FUNCS(mlockall)
 
@@ -77,9 +86,20 @@ if test x"$ctdb_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then
     AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property])
 fi
 
+if test x"$ac_cv_header_pcp_pmda_h" = x"yes"; then
+    CTDB_PMDA=bin/pmdactdb
+    CTDB_PMDA_INSTALL=install_pmda
+else
+    CTDB_PMDA=
+    CTDB_PMDA_INSTALL=
+fi
+
+
 AC_SUBST(EXTRA_OBJ)
 AC_SUBST(CTDB_SYSTEM_OBJ)
 AC_SUBST(CTDB_SCSI_IO)
 AC_SUBST(CTDB_PCAP_LDFLAGS)
+AC_SUBST(CTDB_PMDA)
+AC_SUBST(CTDB_PMDA_INSTALL)
 
 AC_OUTPUT(Makefile ctdb.pc)
diff --git a/include/ctdb_client.h b/include/ctdb_client.h
index 3dc115f..95b9073 100644
--- a/include/ctdb_client.h
+++ b/include/ctdb_client.h
@@ -105,7 +105,12 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog,
 /*
   attach to a ctdb database
 */
-struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, bool persistent, uint32_t tdb_flags);
+struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb,
+				    struct timeval timeout,
+				    const char *name,
+				    bool persistent,
+				    uint32_t tdb_flags);
+
 
 /*
   find an attached ctdb_db handle given a name
@@ -188,7 +193,8 @@ int ctdb_register_message_handler(struct ctdb_context *ctdb,
 struct ctdb_db_context *find_ctdb_db(struct ctdb_context *ctdb, uint32_t id);
 
 
-struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev);
+struct ctdb_context *ctdb_cmdline_client(struct tevent_context *ev,
+					 struct timeval req_timeout);
 
 struct ctdb_statistics;
 int ctdb_ctrl_statistics(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_statistics *status);
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index b74cbcf..edf1d88 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -798,6 +798,7 @@ int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
 void ctdb_recv_raw_pkt(void *p, uint8_t *data, uint32_t length);
 
 int ctdb_socket_connect(struct ctdb_context *ctdb);
+void ctdb_client_read_cb(uint8_t *data, size_t cnt, void *args);
 
 #define CTDB_BAD_REQID ((uint32_t)-1)
 uint32_t ctdb_reqid_new(struct ctdb_context *ctdb, void *state);
diff --git a/lib/tevent/tevent_util.c b/lib/tevent/tevent_util.c
index 28c9da3..54c1787 100644
--- a/lib/tevent/tevent_util.c
+++ b/lib/tevent/tevent_util.c
@@ -107,7 +107,7 @@ void tevent_before_wait(struct event_context *ev) {
 	if (!tevent_timeval_is_zero(&tevent_after_wait_ts)) {
 		diff = tevent_timeval_until(&tevent_after_wait_ts, &now);
 		if (diff.tv_sec > 3) {
-			tevent_debug(ev, TEVENT_DEBUG_FATAL,  __location__ 
+			tevent_debug(ev, TEVENT_DEBUG_ERROR,  __location__ 
 				     " Handling event took %d seconds!",
 				     (int) diff.tv_sec);
 		}
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 2db9109..0fcfd33 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -841,7 +841,7 @@ static void vacuum_fetch_handler(struct ctdb_context *ctdb, uint64_t srvid,
 	}
 
 	/* attach to it */
-	ctdb_db = ctdb_attach(ctdb, name, persistent, 0);
+	ctdb_db = ctdb_attach(ctdb, CONTROL_TIMEOUT(), name, persistent, 0);
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,(__location__ " Failed to attach to database '%s'\n", name));
 		talloc_free(tmp_ctx);
diff --git a/tests/src/ctdb_bench.c b/tests/src/ctdb_bench.c
index 6d81223..8e0e0d7 100644
--- a/tests/src/ctdb_bench.c
+++ b/tests/src/ctdb_bench.c
@@ -222,10 +222,11 @@ int main(int argc, const char *argv[])
 	ev = event_context_init(NULL);
 
 	/* initialise ctdb */
-	ctdb = ctdb_cmdline_client(ev);
+	ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
 
 	/* attach to a specific database */
-	ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
+	ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0), "test.tdb",
+			      false, 0);
 	if (!ctdb_db) {
 		printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
 		exit(1);
diff --git a/tests/src/ctdb_fetch.c b/tests/src/ctdb_fetch.c
index a8f38ee..f0311c8 100644
--- a/tests/src/ctdb_fetch.c
+++ b/tests/src/ctdb_fetch.c
@@ -207,7 +207,7 @@ int main(int argc, const char *argv[])
 
 	ev = event_context_init(NULL);
 
-	ctdb = ctdb_cmdline_client(ev);
+	ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
 
 	if (ctdb == NULL) {
 		printf("failed to connect to ctdb daemon.\n");
@@ -218,7 +218,8 @@ int main(int argc, const char *argv[])
 				 &cluster_ready);
 
 	/* attach to a specific database */
-	ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
+	ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0), "test.tdb",
+			      false, 0);
 	if (!ctdb_db) {
 		printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
 		exit(1);
diff --git a/tests/src/ctdb_fetch_one.c b/tests/src/ctdb_fetch_one.c
index 7348aa6..042e605 100644
--- a/tests/src/ctdb_fetch_one.c
+++ b/tests/src/ctdb_fetch_one.c
@@ -114,7 +114,7 @@ int main(int argc, const char *argv[])
 
 	ev = event_context_init(NULL);
 
-	ctdb = ctdb_cmdline_client(ev);
+	ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
 
 	if (ctdb == NULL) {
 		printf("failed to connect to ctdb deamon.\n");
@@ -122,7 +122,8 @@ int main(int argc, const char *argv[])
 	}
 
 	/* attach to a specific database */
-	ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
+	ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0), "test.tdb",
+			      false, 0);
 	if (!ctdb_db) {
 		printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
 		exit(1);
diff --git a/tests/src/ctdb_persistent.c b/tests/src/ctdb_persistent.c
index 6074b6a..98c100f 100644
--- a/tests/src/ctdb_persistent.c
+++ b/tests/src/ctdb_persistent.c
@@ -220,7 +220,7 @@ int main(int argc, const char *argv[])
 
 	ev = event_context_init(NULL);
 
-	ctdb = ctdb_cmdline_client(ev);
+	ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
 	if (ctdb == NULL) {
 		printf("Could not attach to daemon\n");
 		return 1;
@@ -228,9 +228,11 @@ int main(int argc, const char *argv[])
 
 	/* attach to a specific database */
 	if (unsafe_writes == 1) {
-		ctdb_db = ctdb_attach(ctdb, "persistent.tdb", true, TDB_NOSYNC);
+		ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0),
+				      "persistent.tdb", true, TDB_NOSYNC);
 	} else {
-		ctdb_db = ctdb_attach(ctdb, "persistent.tdb", true, 0);
+		ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0),
+				      "persistent.tdb", true, 0);
 	}
 
 	if (!ctdb_db) {
diff --git a/tests/src/ctdb_randrec.c b/tests/src/ctdb_randrec.c
index 5b7eef8..dbaa4ba 100644
--- a/tests/src/ctdb_randrec.c
+++ b/tests/src/ctdb_randrec.c
@@ -181,7 +181,7 @@ int main(int argc, const char *argv[])
 
 	ev = event_context_init(NULL);
 
-	ctdb = ctdb_cmdline_client(ev);
+	ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
 
 	if (ctdb == NULL) {
 		printf("failed to connect to daemon\n");
@@ -189,7 +189,8 @@ int main(int argc, const char *argv[])
 	}
 
 	/* attach to a specific database */
-	ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
+	ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0), "test.tdb",
+			      false, 0);
 	if (!ctdb_db) {
 		printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
 		exit(1);
diff --git a/tests/src/ctdb_store.c b/tests/src/ctdb_store.c
index 82669b7..c657f78 100644
--- a/tests/src/ctdb_store.c
+++ b/tests/src/ctdb_store.c
@@ -136,7 +136,7 @@ int main(int argc, const char *argv[])
 
 	ev = event_context_init(NULL);
 
-	ctdb = ctdb_cmdline_client(ev);
+	ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
 
 	if (ctdb == NULL) {
 		printf("failed to connect to ctdb daemon.\n");
@@ -144,7 +144,7 @@ int main(int argc, const char *argv[])
 	}
 
 	/* attach to a specific database */
-	ctdb_db = ctdb_attach(ctdb, "test.tdb", false, 0);
+	ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0), "test.tdb", false, 0);
 	if (!ctdb_db) {
 		printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
 		exit(1);
diff --git a/tests/src/ctdb_transaction.c b/tests/src/ctdb_transaction.c
index 39e40dd..6508874 100644
--- a/tests/src/ctdb_transaction.c
+++ b/tests/src/ctdb_transaction.c
@@ -252,7 +252,7 @@ int main(int argc, const char *argv[])
 
 	ev = event_context_init(NULL);
 
-	ctdb = ctdb_cmdline_client(ev);
+	ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
 	if (ctdb == NULL) {
 		DEBUG(DEBUG_ERR, ("Could not attach to daemon\n"));
 		return 1;
@@ -260,9 +260,11 @@ int main(int argc, const char *argv[])
 
 	/* attach to a specific database */
 	if (unsafe_writes == 1) {
-		ctdb_db = ctdb_attach(ctdb, "transaction.tdb", true, TDB_NOSYNC);
+		ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0),
+				      "transaction.tdb", true, TDB_NOSYNC);
 	} else {
-		ctdb_db = ctdb_attach(ctdb, "transaction.tdb", true, 0);
+		ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0),
+				      "transaction.tdb", true, 0);
 	}
 
 	if (!ctdb_db) {
diff --git a/tests/src/ctdb_traverse.c b/tests/src/ctdb_traverse.c
index c4510e4..218e7f7 100644
--- a/tests/src/ctdb_traverse.c
+++ b/tests/src/ctdb_traverse.c
@@ -89,10 +89,10 @@ int main(int argc, const char *argv[])
 
 	ev = event_context_init(NULL);
 
-	ctdb = ctdb_cmdline_client(ev);
+	ctdb = ctdb_cmdline_client(ev, timeval_current_ofs(3, 0));
 
 	/* attach to a specific database */
-	ctdb_db = ctdb_attach(ctdb, dbname, false, 0);
+	ctdb_db = ctdb_attach(ctdb, timeval_current_ofs(2, 0), dbname, false, 0);
 	if (!ctdb_db) {
 		printf("ctdb_attach failed - %s\n", ctdb_errstr(ctdb));
 		exit(1);
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 8528de7..a8474cf 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -624,9 +624,10 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
 		return ret;
 	}
 
-	if(options.machinereadable){
-		printf(":Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped:Inactive:PartiallyOnline:\n");
-		for(i=0;i<nodemap->num;i++){
+	if (options.machinereadable) {
+		printf(":Node:IP:Disconnected:Banned:Disabled:Unhealthy:Stopped"
+		       ":Inactive:PartiallyOnline:ThisNode:\n");
+		for (i=0;i<nodemap->num;i++) {
 			int partially_online = 0;
 			int j;
 
@@ -650,7 +651,7 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
 					talloc_free(ifaces);
 				}
 			}
-			printf(":%d:%s:%d:%d:%d:%d:%d:%d:%d:\n", nodemap->nodes[i].pnn,
+			printf(":%d:%s:%d:%d:%d:%d:%d:%d:%d:%d:\n", nodemap->nodes[i].pnn,
 				ctdb_addr_to_str(&nodemap->nodes[i].addr),
 			       !!(nodemap->nodes[i].flags&NODE_FLAGS_DISCONNECTED),
 			       !!(nodemap->nodes[i].flags&NODE_FLAGS_BANNED),
@@ -658,7 +659,8 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
 			       !!(nodemap->nodes[i].flags&NODE_FLAGS_UNHEALTHY),
 			       !!(nodemap->nodes[i].flags&NODE_FLAGS_STOPPED),
 			       !!(nodemap->nodes[i].flags&NODE_FLAGS_INACTIVE),
-			       partially_online);
+			       partially_online,
+			       (nodemap->nodes[i].pnn == mypnn));
 		}
 		return 0;
 	}
@@ -2983,7 +2985,7 @@ static int control_catdb(struct ctdb_context *ctdb, int argc, const char **argv)
 		return -1;
 	}
 
-	ctdb_db = ctdb_attach(ctdb, db_name, persistent, 0);
+	ctdb_db = ctdb_attach(ctdb, TIMELIMIT(), db_name, persistent, 0);
 
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
@@ -3029,7 +3031,7 @@ static int control_readkey(struct ctdb_context *ctdb, int argc, const char **arg
 		return -1;
 	}
 
-	ctdb_db = ctdb_attach(ctdb, db_name, persistent, 0);
+	ctdb_db = ctdb_attach(ctdb, TIMELIMIT(), db_name, persistent, 0);
 
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
@@ -3078,7 +3080,7 @@ static int control_writekey(struct ctdb_context *ctdb, int argc, const char **ar
 		return -1;
 	}
 
-	ctdb_db = ctdb_attach(ctdb, db_name, persistent, 0);
+	ctdb_db = ctdb_attach(ctdb, TIMELIMIT(), db_name, persistent, 0);
 
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
@@ -3142,7 +3144,7 @@ static int control_pfetch(struct ctdb_context *ctdb, int argc, const char **argv
 		return -1;
 	}
 
-	ctdb_db = ctdb_attach(ctdb, db_name, persistent, 0);
+	ctdb_db = ctdb_attach(ctdb, TIMELIMIT(), db_name, persistent, 0);
 
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
@@ -3305,8 +3307,7 @@ static int control_pstore(struct ctdb_context *ctdb, int argc, const char **argv
 
 	db_name = argv[0];
 
-	ctdb_db = ctdb_attach(ctdb, db_name, true, 0);
-
+	ctdb_db = ctdb_attach(ctdb, TIMELIMIT(), db_name, true, 0);
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
 		talloc_free(tmp_ctx);
@@ -3950,7 +3951,7 @@ static int control_attach(struct ctdb_context *ctdb, int argc, const char **argv
 		persistent = true;
 	}
 
-	ctdb_db = ctdb_attach(ctdb, db_name, persistent, 0);
+	ctdb_db = ctdb_attach(ctdb, TIMELIMIT(), db_name, persistent, 0);
 	if (ctdb_db == NULL) {
 		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
 		return -1;
@@ -4158,7 +4159,7 @@ static int control_backupdb(struct ctdb_context *ctdb, int argc, const char **ar
 				     allow_unhealthy));
 	}
 
-	ctdb_db = ctdb_attach(ctdb, argv[0], dbmap->dbs[i].persistent, 0);
+	ctdb_db = ctdb_attach(ctdb, TIMELIMIT(), argv[0], dbmap->dbs[i].persistent, 0);


-- 
CTDB repository


More information about the samba-cvs mailing list