[SCM] CTDB repository - branch master updated - ctdb-1.13-202-g8307c70

Ronnie Sahlberg sahlberg at samba.org
Wed Jun 13 21:17:17 MDT 2012


The branch, master has been updated
       via  8307c70ed98996b430c470e9641a09fdeeb81bd8 (commit)
       via  98e1b46adba11b9549b5c5976e1f561fe732fa6e (commit)
       via  0dc204988eadff214dd149a756d756ab6e96e410 (commit)
       via  7ebc00dc6a89043a971a720e7c21baf5f2a0233d (commit)
       via  cb2bbe93628c1ab932c2e1ad6e2ec199a98f74c6 (commit)
       via  88040778aace229d724de1ba7556aded12e22f86 (commit)
       via  e0c9200c05b1f7a04e002f505ebb5ba9340c0ca1 (commit)
       via  6559106b8b853920f325f2dba532f4008e931fa3 (commit)
      from  1a6a011c772f7d302d114d7c8a151fa7820ec85f (commit)

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


- Log -----------------------------------------------------------------
commit 8307c70ed98996b430c470e9641a09fdeeb81bd8
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Jun 13 16:17:18 2012 +1000

    STATISTICS: Add tracking of the 10 hottest keys per database measured in hopcount
    
    and add mechanisms to dump it using the ctdb dbstatistics command

commit 98e1b46adba11b9549b5c5976e1f561fe732fa6e
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jun 7 15:08:15 2012 +1000

    Reimplement logging of long running events
    
    Reimplement 5aba53e6adcfcd7edbdac9e30aa5fcba176aca00 using tevent
    trace points.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>

commit 0dc204988eadff214dd149a756d756ab6e96e410
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Jun 8 12:50:21 2012 +0200

    tevent: change version to 0.9.16
    
    This adds tevent_*_trace_*() and tevent_context_init_ops()
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Fri Jun  8 20:47:41 CEST 2012 on sn-devel-104

commit 7ebc00dc6a89043a971a720e7c21baf5f2a0233d
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri May 11 15:19:55 2012 +0200

    tevent: expose tevent_context_init_ops
    
    This can be used to implement wrapper backends,
    while passing a private pointer to the backens init function
    via ev->additional_data.
    
    metze

commit cb2bbe93628c1ab932c2e1ad6e2ec199a98f74c6
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Jun 5 16:00:07 2012 +1000

    lib/tevent: Add trace point callback
    
    Set/get a single callback function to be invoked at various trace
    points.  Define "before wait" and "after wait" trace points - more
    trace points can be added later if required.
    
    CTDB wants this to log long waits and events.
    
    Pair-programmed-with: Amitay Isaacs <amitay at gmail.com>
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 88040778aace229d724de1ba7556aded12e22f86
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jun 7 14:20:13 2012 +1000

    Revert "TEVENT: Add back tracking of long runnig  events to the local copy of tevent library"
    
    This reverts commit 5aba53e6adcfcd7edbdac9e30aa5fcba176aca00.
    
    Do this using new tevent trace point callback.

commit e0c9200c05b1f7a04e002f505ebb5ba9340c0ca1
Author: Martin Schwenke <martin at meltin.net>
Date:   Thu Jun 7 12:26:02 2012 +1000

    lib/tevent: In poll_event_context, add a pointer back to the tevent_context
    
    This makes it consistent with the other backends.
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 6559106b8b853920f325f2dba532f4008e931fa3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon May 14 11:48:00 2012 +0200

    lib/tevent/testsuite: no longer use 'compat' symbols
    
    metze

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

Summary of changes:
 include/ctdb_protocol.h                            |   14 +++++
 .../ABI/{tevent-0.9.15.sigs => tevent-0.9.16.sigs} |    4 ++
 lib/tevent/testsuite.c                             |   24 ++++----
 lib/tevent/tevent.c                                |    8 ++-
 lib/tevent/tevent.h                                |   57 ++++++++++++++++++++
 lib/tevent/tevent_debug.c                          |   24 ++++++++
 lib/tevent/tevent_epoll.c                          |    6 +--
 lib/tevent/tevent_internal.h                       |   10 +++-
 lib/tevent/tevent_poll.c                           |    6 ++
 lib/tevent/tevent_select.c                         |    6 +--
 lib/tevent/tevent_standard.c                       |    6 +--
 lib/tevent/tevent_util.c                           |   52 ------------------
 libctdb/control.c                                  |   40 ++++++++++++--
 server/ctdb_call.c                                 |   50 +++++++++++++++++-
 server/ctdb_daemon.c                               |   46 ++++++++++++++++
 server/ctdb_ltdb_server.c                          |   38 ++++++++++++-
 tools/ctdb.c                                       |    9 +++
 17 files changed, 312 insertions(+), 88 deletions(-)
 copy lib/tevent/ABI/{tevent-0.9.15.sigs => tevent-0.9.16.sigs} (94%)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 5c787ff..33187c7 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
@@ -614,6 +614,7 @@ struct ctdb_traverse_start_ext {
   ctdb statistics information
  */
 #define MAX_COUNT_BUCKETS 16
+#define MAX_HOT_KEYS      10
 
 struct ctdb_statistics {
 	uint32_t num_clients;
@@ -680,10 +681,23 @@ struct ctdb_statistics_wire {
 /*
  * db statistics
  */
+struct ctdb_db_hot_key {
+	uint32_t count;
+	TDB_DATA key;
+};
 struct ctdb_db_statistics {
 	uint32_t db_ro_delegations;
 	uint32_t db_ro_revokes;
 	uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
+	uint32_t num_hot_keys;
+	struct ctdb_db_hot_key hot_keys[MAX_HOT_KEYS];
+};
+struct ctdb_db_statistics_wire {
+	uint32_t db_ro_delegations;
+	uint32_t db_ro_revokes;
+	uint32_t hop_count_bucket[MAX_COUNT_BUCKETS];
+	uint32_t num_hot_keys;
+	char hot_keys[1];
 };
 
 /*
diff --git a/lib/tevent/ABI/tevent-0.9.15.sigs b/lib/tevent/ABI/tevent-0.9.16.sigs
similarity index 94%
copy from lib/tevent/ABI/tevent-0.9.15.sigs
copy to lib/tevent/ABI/tevent-0.9.16.sigs
index 13c461c..ea7f944 100644
--- a/lib/tevent/ABI/tevent-0.9.15.sigs
+++ b/lib/tevent/ABI/tevent-0.9.16.sigs
@@ -33,11 +33,13 @@ tevent_common_loop_wait: int (struct tevent_context *, const char *)
 tevent_common_schedule_immediate: void (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *)
 tevent_context_init: struct tevent_context *(TALLOC_CTX *)
 tevent_context_init_byname: struct tevent_context *(TALLOC_CTX *, const char *)
+tevent_context_init_ops: struct tevent_context *(TALLOC_CTX *, const struct tevent_ops *, void *)
 tevent_debug: void (struct tevent_context *, enum tevent_debug_level, const char *, ...)
 tevent_fd_get_flags: uint16_t (struct tevent_fd *)
 tevent_fd_set_auto_close: void (struct tevent_fd *)
 tevent_fd_set_close_fn: void (struct tevent_fd *, tevent_fd_close_fn_t)
 tevent_fd_set_flags: void (struct tevent_fd *, uint16_t)
+tevent_get_trace_callback: void (struct tevent_context *, tevent_trace_callback_t *, void *)
 tevent_loop_allow_nesting: void (struct tevent_context *)
 tevent_loop_set_nesting_hook: void (struct tevent_context *, tevent_nesting_hook, void *)
 tevent_queue_add: bool (struct tevent_queue *, struct tevent_context *, struct tevent_req *, tevent_queue_trigger_fn_t, void *)
@@ -65,6 +67,7 @@ tevent_set_abort_fn: void (void (*)(const char *))
 tevent_set_debug: int (struct tevent_context *, void (*)(void *, enum tevent_debug_level, const char *, va_list), void *)
 tevent_set_debug_stderr: int (struct tevent_context *)
 tevent_set_default_backend: void (const char *)
+tevent_set_trace_callback: void (struct tevent_context *, tevent_trace_callback_t, void *)
 tevent_signal_support: bool (struct tevent_context *)
 tevent_timeval_add: struct timeval (const struct timeval *, uint32_t, uint32_t)
 tevent_timeval_compare: int (const struct timeval *, const struct timeval *)
@@ -74,5 +77,6 @@ tevent_timeval_is_zero: bool (const struct timeval *)
 tevent_timeval_set: struct timeval (uint32_t, uint32_t)
 tevent_timeval_until: struct timeval (const struct timeval *, const struct timeval *)
 tevent_timeval_zero: struct timeval (void)
+tevent_trace_point_callback: void (struct tevent_context *, enum tevent_trace_point)
 tevent_wakeup_recv: bool (struct tevent_req *)
 tevent_wakeup_send: struct tevent_req *(TALLOC_CTX *, struct tevent_context *, struct timeval)
diff --git a/lib/tevent/testsuite.c b/lib/tevent/testsuite.c
index b674689..6f2851e 100644
--- a/lib/tevent/testsuite.c
+++ b/lib/tevent/testsuite.c
@@ -51,7 +51,7 @@ static void finished_handler(struct tevent_context *ev_ctx, struct tevent_timer
 	(*finished) = 1;
 }
 
-static void count_handler(struct tevent_context *ev_ctx, struct signal_event *te,
+static void count_handler(struct tevent_context *ev_ctx, struct tevent_signal *te,
 			  int signum, int count, void *info, void *private_data)
 {
 	int *countp = (int *)private_data;
@@ -77,7 +77,7 @@ static bool test_event_context(struct torture_context *test,
 	struct timeval t;
 	char c = 0;
 
-	ev_ctx = event_context_init_byname(test, backend);
+	ev_ctx = tevent_context_init_byname(test, backend);
 	if (ev_ctx == NULL) {
 		torture_comment(test, "event backend '%s' not supported\n", backend);
 		return true;
@@ -91,21 +91,21 @@ static bool test_event_context(struct torture_context *test,
 	/* create a pipe */
 	pipe(fd);
 
-	fde = event_add_fd(ev_ctx, ev_ctx, fd[0], EVENT_FD_READ,
-			   fde_handler, fd);
+	fde = tevent_add_fd(ev_ctx, ev_ctx, fd[0], TEVENT_FD_READ,
+			    fde_handler, fd);
 	tevent_fd_set_auto_close(fde);
 
-	event_add_timed(ev_ctx, ev_ctx, timeval_current_ofs(2,0),
-			finished_handler, &finished);
+	tevent_add_timer(ev_ctx, ev_ctx, timeval_current_ofs(2,0),
+			 finished_handler, &finished);
 
 #ifdef SA_RESTART
-	se1 = event_add_signal(ev_ctx, ev_ctx, SIGALRM, SA_RESTART, count_handler, &alarm_count);
+	se1 = tevent_add_signal(ev_ctx, ev_ctx, SIGALRM, SA_RESTART, count_handler, &alarm_count);
 #endif
 #ifdef SA_RESETHAND
-	se2 = event_add_signal(ev_ctx, ev_ctx, SIGALRM, SA_RESETHAND, count_handler, &alarm_count);
+	se2 = tevent_add_signal(ev_ctx, ev_ctx, SIGALRM, SA_RESETHAND, count_handler, &alarm_count);
 #endif
 #ifdef SA_SIGINFO
-	se3 = event_add_signal(ev_ctx, ev_ctx, SIGUSR1, SA_SIGINFO, count_handler, &info_count);
+	se3 = tevent_add_signal(ev_ctx, ev_ctx, SIGUSR1, SA_SIGINFO, count_handler, &info_count);
 #endif
 
 	write(fd[1], &c, 1);
@@ -113,7 +113,7 @@ static bool test_event_context(struct torture_context *test,
 	t = timeval_current();
 	while (!finished) {
 		errno = 0;
-		if (event_loop_once(ev_ctx) == -1) {
+		if (tevent_loop_once(ev_ctx) == -1) {
 			talloc_free(ev_ctx);
 			torture_fail(test, talloc_asprintf(test, "Failed event loop %s\n", strerror(errno)));
 		}
@@ -123,7 +123,7 @@ static bool test_event_context(struct torture_context *test,
 	close(fd[1]);
 
 	while (alarm_count < fde_count+1) {
-		if (event_loop_once(ev_ctx) == -1) {
+		if (tevent_loop_once(ev_ctx) == -1) {
 			break;
 		}
 	}
@@ -149,7 +149,7 @@ static bool test_event_context(struct torture_context *test,
 struct torture_suite *torture_local_event(TALLOC_CTX *mem_ctx)
 {
 	struct torture_suite *suite = torture_suite_create(mem_ctx, "event");
-	const char **list = event_backend_list(suite);
+	const char **list = tevent_backend_list(suite);
 	int i;
 
 	for (i=0;list && list[i];i++) {
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index d3421a2..6c6c6e7 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -210,8 +210,9 @@ int tevent_common_context_destructor(struct tevent_context *ev)
 
   NOTE: use tevent_context_init() inside of samba!
 */
-static struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
-						      const struct tevent_ops *ops)
+struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
+					       const struct tevent_ops *ops,
+					       void *additional_data)
 {
 	struct tevent_context *ev;
 	int ret;
@@ -222,6 +223,7 @@ static struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
 	talloc_set_destructor(ev, tevent_common_context_destructor);
 
 	ev->ops = ops;
+	ev->additional_data = additional_data;
 
 	ret = ev->ops->context_init(ev);
 	if (ret != 0) {
@@ -253,7 +255,7 @@ struct tevent_context *tevent_context_init_byname(TALLOC_CTX *mem_ctx,
 
 	for (e=tevent_backends;e;e=e->next) {
 		if (strcmp(name, e->name) == 0) {
-			return tevent_context_init_ops(mem_ctx, e->ops);
+			return tevent_context_init_ops(mem_ctx, e->ops, NULL);
 		}
 	}
 	return NULL;
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index b76e3a3..60bc92a 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -126,6 +126,20 @@ struct tevent_context *tevent_context_init(TALLOC_CTX *mem_ctx);
 struct tevent_context *tevent_context_init_byname(TALLOC_CTX *mem_ctx, const char *name);
 
 /**
+ * @brief Create a custom event context
+ *
+ * @param[in]  mem_ctx  The memory context to use.
+ * @param[in]  ops      The function pointer table of the backend.
+ * @param[in]  additional_data  The additional/private data to this instance
+ *
+ * @return              An allocated tevent context, NULL on error.
+ *
+ */
+struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx,
+					       const struct tevent_ops *ops,
+					       void *additional_data);
+
+/**
  * @brief List available backends.
  *
  * @param[in]  mem_ctx  The memory context to use.
@@ -501,6 +515,49 @@ int tevent_set_debug(struct tevent_context *ev,
  */
 int tevent_set_debug_stderr(struct tevent_context *ev);
 
+enum tevent_trace_point {
+	/**
+	 * Corresponds to a trace point just before waiting
+	 */
+	TEVENT_TRACE_BEFORE_WAIT,
+	/**
+	 * Corresponds to a trace point just after waiting
+	 */
+	TEVENT_TRACE_AFTER_WAIT,
+};
+
+typedef void (*tevent_trace_callback_t)(enum tevent_trace_point,
+					void *private_data);
+
+/**
+ * Register a callback to be called at certain trace points
+ *
+ * @param[in] ev             Event context
+ * @param[in] cb             Trace callback
+ * @param[in] private_data   Data to be passed to callback
+ *
+ * @note The callback will be called at trace points defined by
+ * tevent_trace_point.  Call with NULL to reset.
+ */
+void tevent_set_trace_callback(struct tevent_context *ev,
+			       tevent_trace_callback_t cb,
+			       void *private_data);
+
+/**
+ * Retrieve the current trace callback
+ *
+ * @param[in] ev             Event context
+ * @param[out] cb            Registered trace callback
+ * @param[out] private_data  Registered data to be passed to callback
+ *
+ * @note This can be used to allow one component that wants to
+ * register a callback to respect the callback that another component
+ * has already registered.
+ */
+void tevent_get_trace_callback(struct tevent_context *ev,
+			       tevent_trace_callback_t *cb,
+			       void *private_data);
+
 /**
  * @}
  */
diff --git a/lib/tevent/tevent_debug.c b/lib/tevent/tevent_debug.c
index 62dfc8d..31da7b9 100644
--- a/lib/tevent/tevent_debug.c
+++ b/lib/tevent/tevent_debug.c
@@ -93,3 +93,27 @@ void tevent_debug(struct tevent_context *ev, enum tevent_debug_level level,
 	ev->debug_ops.debug(ev->debug_ops.context, level, fmt, ap);
 	va_end(ap);
 }
+
+void tevent_set_trace_callback(struct tevent_context *ev,
+			       tevent_trace_callback_t cb,
+			       void *private_data)
+{
+	ev->tracing.callback = cb;
+	ev->tracing.private_data = private_data;
+}
+
+void tevent_get_trace_callback(struct tevent_context *ev,
+			       tevent_trace_callback_t *cb,
+			       void *private_data)
+{
+	*cb = ev->tracing.callback;
+	*(void**)private_data = ev->tracing.private_data;
+}
+
+void tevent_trace_point_callback(struct tevent_context *ev,
+				 enum tevent_trace_point tp)
+{
+	if (ev->tracing.callback != NULL) {
+		ev->tracing.callback(tp, ev->tracing.private_data);
+	}
+}
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index 7c09dd7..a7fb8b1 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -242,8 +242,6 @@ static void epoll_change_event(struct epoll_event_context *epoll_ev, struct teve
 	}
 }
 
-extern pid_t ctdbd_pid;
-
 /*
   event loop handling using epoll
 */
@@ -266,9 +264,9 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
 		return 0;
 	}
 
-	if (getpid() == ctdbd_pid) tevent_before_wait(epoll_ev->ev);
+	tevent_trace_point_callback(epoll_ev->ev, TEVENT_TRACE_BEFORE_WAIT);
 	ret = epoll_wait(epoll_ev->epoll_fd, events, MAXEVENTS, timeout);
-	if (getpid() == ctdbd_pid) tevent_after_wait(epoll_ev->ev);
+	tevent_trace_point_callback(epoll_ev->ev, TEVENT_TRACE_AFTER_WAIT);
 
 	if (ret == -1 && errno == EINTR && epoll_ev->ev->signal_events) {
 		if (tevent_common_check_signal(epoll_ev->ev)) {
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index 707bfab..21b5aea 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -258,6 +258,11 @@ struct tevent_context {
 		tevent_nesting_hook hook_fn;
 		void *hook_private;
 	} nesting;
+
+	struct {
+		tevent_trace_callback_t callback;
+		void *private_data;
+	} tracing;
 };
 
 
@@ -313,5 +318,6 @@ bool tevent_poll_init(void);
 #ifdef HAVE_EPOLL
 bool tevent_epoll_init(void);
 #endif
-void tevent_before_wait(struct tevent_context *ev);
-void tevent_after_wait(struct tevent_context *ev);
+
+void tevent_trace_point_callback(struct tevent_context *ev,
+				 enum tevent_trace_point);
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index d2e45c8..7ae3c42 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -30,6 +30,9 @@
 #include "tevent_internal.h"
 
 struct poll_event_context {
+	/* a pointer back to the generic event_context */
+	struct tevent_context *ev;
+
 	/*
 	 * These two arrays are maintained together.
 	 */
@@ -52,6 +55,7 @@ static int poll_event_context_init(struct tevent_context *ev)
 	if (poll_ev == NULL) {
 		return -1;
 	}
+	poll_ev->ev = ev;
 	ev->additional_data = poll_ev;
 	return 0;
 }
@@ -197,7 +201,9 @@ static int poll_event_loop_poll(struct tevent_context *ev,
 		timeout += (tvalp->tv_usec + 999) / 1000;
 	}
 
+	tevent_trace_point_callback(poll_ev->ev, TEVENT_TRACE_BEFORE_WAIT);
 	pollrtn = poll(poll_ev->fds, poll_ev->num_fds, timeout);
+	tevent_trace_point_callback(poll_ev->ev, TEVENT_TRACE_AFTER_WAIT);
 
 	if (pollrtn == -1 && errno == EINTR && ev->signal_events) {
 		tevent_common_check_signal(ev);
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index 6fa38ce..47ad13e 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -130,8 +130,6 @@ static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_C
 	return fde;
 }
 
-extern pid_t ctdbd_pid;
-
 /*
   event loop handling using select()
 */
@@ -169,9 +167,9 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
 		return 0;
 	}
 
-	if (getpid() == ctdbd_pid) tevent_before_wait(select_ev->ev);
+	tevent_trace_point_callback(select_ev->ev, TEVENT_TRACE_BEFORE_WAIT);
 	selrtn = select(select_ev->maxfd+1, &r_fds, &w_fds, NULL, tvalp);
-	if (getpid() == ctdbd_pid) tevent_after_wait(select_ev->ev);
+	tevent_trace_point_callback(select_ev->ev, TEVENT_TRACE_AFTER_WAIT);
 
 	if (selrtn == -1 && errno == EINTR &&
 	    select_ev->ev->signal_events) {
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c
index 4041b6a..6c34854 100644
--- a/lib/tevent/tevent_standard.c
+++ b/lib/tevent/tevent_standard.c
@@ -256,8 +256,6 @@ static void epoll_change_event(struct std_event_context *std_ev, struct tevent_f
 	}
 }
 
-extern pid_t ctdbd_pid;
-
 /*
   event loop handling using epoll
 */
@@ -280,9 +278,9 @@ static int epoll_event_loop(struct std_event_context *std_ev, struct timeval *tv
 		return 0;
 	}
 
-	if (getpid() == ctdbd_pid) tevent_before_wait(std_ev->ev);
+	tevent_trace_point_callback(std_ev->ev, TEVENT_TRACE_BEFORE_WAIT);
 	ret = epoll_wait(std_ev->epoll_fd, events, MAXEVENTS, timeout);
-	if (getpid() == ctdbd_pid) tevent_after_wait(std_ev->ev);
+	tevent_trace_point_callback(std_ev->ev, TEVENT_TRACE_AFTER_WAIT);
 
 	if (ret == -1 && errno == EINTR && std_ev->ev->signal_events) {
 		if (tevent_common_check_signal(std_ev->ev)) {
diff --git a/lib/tevent/tevent_util.c b/lib/tevent/tevent_util.c
index e3a1605..16af8f3 100644
--- a/lib/tevent/tevent_util.c
+++ b/lib/tevent/tevent_util.c
@@ -105,55 +105,3 @@ bool ev_set_close_on_exec(int fd)
 #endif
 	return false;
 }
-
-
-static struct timeval tevent_before_wait_ts;
-static struct timeval tevent_after_wait_ts;
-
-/*
- * measure the time difference between multiple arrivals
- * to the point where we wait for new events to come in
- *
- * allows to measure how long it takes to work on a 
- * event
- */
-void tevent_before_wait(struct tevent_context *ev) {
-
-	struct timeval diff;
-	struct timeval now = tevent_timeval_current();
-
-	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_ERROR,  __location__ 
-				     " Handling event took %d seconds!",
-				     (int) diff.tv_sec);
-		}
-	}
-
-	tevent_before_wait_ts = tevent_timeval_current();
-
-}
-
-/*
- * measure how long the select()/epoll() call took
- *
- * allows to measure how long we are waiting for new events
- */
-void tevent_after_wait(struct tevent_context *ev) {
-
-	struct timeval diff;
-	struct timeval now = tevent_timeval_current();
-
-	if (!tevent_timeval_is_zero(&tevent_before_wait_ts)) {
-		diff = tevent_timeval_until(&tevent_before_wait_ts, &now);
-		if (diff.tv_sec > 3) {
-			tevent_debug(ev, TEVENT_DEBUG_FATAL,  __location__
-				     " No event for %d seconds!",
-				     (int) diff.tv_sec);
-		}
-	}
-
-	tevent_after_wait_ts = tevent_timeval_current();
-
-}
diff --git a/libctdb/control.c b/libctdb/control.c
index b4c54cd..f927e08 100644
--- a/libctdb/control.c
+++ b/libctdb/control.c
@@ -120,6 +120,9 @@ bool ctdb_getdbstat_recv(struct ctdb_connection *ctdb,
 {
 	struct ctdb_reply_control *reply;
 	struct ctdb_db_statistics *s;
+	struct ctdb_db_statistics_wire *wire;
+	int i;
+	char *ptr;
 
 	reply = unpack_reply_control(req, CTDB_CONTROL_GET_DB_STATISTICS);
 	if (!reply) {
@@ -129,16 +132,36 @@ bool ctdb_getdbstat_recv(struct ctdb_connection *ctdb,
 		DEBUG(ctdb, LOG_ERR, "ctdb_getpnn_recv: status -1");
 		return false;
 	}


-- 
CTDB repository


More information about the samba-cvs mailing list