[SCM] CTDB repository - branch master updated - ctdb-1.0.114-319-gb4c00b4

Ronnie Sahlberg sahlberg at samba.org
Mon Sep 27 16:59:59 MDT 2010


The branch, master has been updated
       via  b4c00b4ac30ec215629f44f802ce9660abcd7a48 (commit)
       via  8b4d1df3abcae03cf7a339d8390c816682a43019 (commit)
       via  fdb4c02f595fa207310a9a48da3fefd653fa9e4b (commit)
      from  21cc57883e6c02b0e037211b26d1d866d5d7f03d (commit)

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


- Log -----------------------------------------------------------------
commit b4c00b4ac30ec215629f44f802ce9660abcd7a48
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Sep 28 08:58:03 2010 +1000

    Add back monitoring for time skips, forward as well as backward.
    This serviceability tool was lost during the migration from the old eventsystem to the tevent system.

commit 8b4d1df3abcae03cf7a339d8390c816682a43019
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Sep 28 08:46:12 2010 +1000

    update/improve the log message related to rerecovery timeouts

commit fdb4c02f595fa207310a9a48da3fefd653fa9e4b
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Wed Sep 22 10:59:01 2010 +1000

    set up a handler to catch and log debug messages from the tevent layer

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

Summary of changes:
 include/ctdb_private.h |    2 ++
 lib/tevent/tevent.c    |   22 ++++++++++++++++++++++
 server/ctdb_daemon.c   |    5 +++++
 server/ctdb_logging.c  |   40 ++++++++++++++++++++++++++++++++++++++++
 server/ctdb_recoverd.c |    4 ++--
 server/ctdbd.c         |    1 +
 6 files changed, 72 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 8ceae20..cd6aeec 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1337,4 +1337,6 @@ int verify_remote_ip_allocation(struct ctdb_context *ctdb,
 int update_ip_assignment_tree(struct ctdb_context *ctdb,
 				struct ctdb_public_ip *ip);
 
+int ctdb_init_tevent_logging(struct ctdb_context *ctdb);
+
 #endif
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index 8cc9ce5..2f6e591 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -64,6 +64,9 @@
 #include "tevent_internal.h"
 #include "tevent_util.h"
 
+/* needed for the special ctdbd "track if time jumps unexpectedly */
+#include <time.h>
+
 struct tevent_ops_list {
 	struct tevent_ops_list *next, *prev;
 	const char *name;
@@ -578,12 +581,18 @@ done:
 	return ret;
 }
 
+
+extern pid_t ctdbd_pid;
+
 /*
   return on failure or (with 0) if all fd events are removed
 */
 int tevent_common_loop_wait(struct tevent_context *ev,
 			    const char *location)
 {
+	static time_t t=0;
+	time_t new_t;
+
 	/*
 	 * loop as long as we have events pending
 	 */
@@ -599,6 +608,19 @@ int tevent_common_loop_wait(struct tevent_context *ev,
 				     ret, strerror(errno));
 			return ret;
 		}
+		if (getpid() == ctdbd_pid) {
+			new_t=time(NULL);
+			if (t != 0) {
+				if (t > new_t) {
+					tevent_debug(ev, TEVENT_DEBUG_FATAL, __location__ " ERROR Time skipped backward by %d seconds\n", (int)(t-new_t));
+				}
+				/* We assume here that we get at least one event every 3 seconds */
+				if (new_t > (t+3)) {
+					tevent_debug(ev, TEVENT_DEBUG_FATAL, __location__ " ERROR Time jumped forward by %d seconds\n", (int)(new_t-t));
+				}
+			}
+			t=new_t;
+		}
 	}
 
 	tevent_debug(ev, TEVENT_DEBUG_WARNING,
diff --git a/server/ctdb_daemon.c b/server/ctdb_daemon.c
index 5d73b0d..418d91e 100644
--- a/server/ctdb_daemon.c
+++ b/server/ctdb_daemon.c
@@ -774,6 +774,11 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog)
 
 	ctdb->ev = event_context_init(NULL);
 	tevent_loop_allow_nesting(ctdb->ev);
+	ret = ctdb_init_tevent_logging(ctdb);
+	if (ret != 0) {
+		DEBUG(DEBUG_ALERT,("Failed to initialize TEVENT logging\n"));
+		exit(1);
+	}
 
 	ctdb_set_child_logging(ctdb);
 
diff --git a/server/ctdb_logging.c b/server/ctdb_logging.c
index 2cc0559..7e5367e 100644
--- a/server/ctdb_logging.c
+++ b/server/ctdb_logging.c
@@ -547,6 +547,46 @@ int ctdb_set_child_logging(struct ctdb_context *ctdb)
 }
 
 
+/*
+ * set up a log handler to catch logging from TEVENT
+ */
+static void ctdb_tevent_logging(void *private_data,
+				enum tevent_debug_level level,
+				const char *fmt,
+				va_list ap)
+{
+	enum debug_level lvl = DEBUG_EMERG;
+
+	switch (level) {
+	case TEVENT_DEBUG_FATAL:
+		lvl = DEBUG_EMERG;
+		break;
+	case TEVENT_DEBUG_ERROR:
+		lvl = DEBUG_ERR;
+		break;
+	case TEVENT_DEBUG_WARNING:
+		lvl = DEBUG_WARNING;
+		break;
+	case TEVENT_DEBUG_TRACE:
+		lvl = DEBUG_DEBUG;
+		break;
+	}
+
+	if (lvl <= LogLevel) {
+		this_log_level = lvl;
+		do_debug_v(fmt, ap);
+	}
+}
+
+int ctdb_init_tevent_logging(struct ctdb_context *ctdb)
+{
+	int ret;
+
+	ret = tevent_set_debug(ctdb->ev,
+			ctdb_tevent_logging,
+		     	ctdb);
+	return ret;
+}
 
 
 	
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 30c34b3..541eb29 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -1676,9 +1676,9 @@ static int do_recovery(struct ctdb_recoverd *rec,
 	   We now wait for rerecovery_timeout before we allow 
 	   another recovery to take place.
 	*/
-	DEBUG(DEBUG_NOTICE, (__location__ " New recoveries supressed for the rerecovery timeout\n"));
+	DEBUG(DEBUG_NOTICE, ("Just finished a recovery. New recoveries will now be supressed for the rerecovery timeout (%d seconds)\n", ctdb->tunable.rerecovery_timeout));
 	ctdb_wait_timeout(ctdb, ctdb->tunable.rerecovery_timeout);
-	DEBUG(DEBUG_NOTICE, (__location__ " Rerecovery timeout elapsed. Recovery reactivated.\n"));
+	DEBUG(DEBUG_NOTICE, ("The rerecovery timeout has elapsed. We now allow recoveries to trigger again.\n"));
 
 	return 0;
 }
diff --git a/server/ctdbd.c b/server/ctdbd.c
index 89b9af1..674ebab 100644
--- a/server/ctdbd.c
+++ b/server/ctdbd.c
@@ -195,6 +195,7 @@ int main(int argc, const char *argv[])
 	}
 
 	DEBUG(DEBUG_NOTICE,("Starting CTDB daemon\n"));
+
 	gettimeofday(&ctdb->ctdbd_start_time, NULL);
 	gettimeofday(&ctdb->last_recovery_started, NULL);
 	gettimeofday(&ctdb->last_recovery_finished, NULL);


-- 
CTDB repository


More information about the samba-cvs mailing list