[SCM] CTDB repository - branch 1.2 updated - ctdb-1.0.114-334-g700f1c3

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


The branch, 1.2 has been updated
       via  700f1c37c446463bc523761a2e4c6cfc49843d30 (commit)
       via  55f940c786b2fb6e4fa76525cfacfae779d1b166 (commit)
       via  bdc502ef5c50c6de919ba24543963bb1b6f81c1b (commit)
      from  c8a985d4a01aa146f25472d7d2937d73cafcfb0b (commit)

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


- Log -----------------------------------------------------------------
commit 700f1c37c446463bc523761a2e4c6cfc49843d30
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 55f940c786b2fb6e4fa76525cfacfae779d1b166
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 bdc502ef5c50c6de919ba24543963bb1b6f81c1b
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 acf5a5e..f76c313 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1336,4 +1336,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 437e4cb..161d9d6 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -1674,9 +1674,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