Cleanup of logging messages/spamming
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 3 May 2011 22:54:02 +0000 (08:54 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 4 May 2011 00:42:32 +0000 (10:42 +1000)
Reduce an infomational message about not performing ip reallocation
from NOTICE(the default) to INFO.
These messages are normal during startup or when stopped/banned when
we will be in recovery mode for a while.

Remove a messager in the loop waiting for initial startup to complete about
the generation being invalid. It is always invalid at this stage before we have
finished initial recovery.

Rate-limit the informational messages for CTDB_WAIT_UNTIL_RECOVERED
so that we only print them once per second for the first 60 seconds and after that only once per 10 minutes.
These messages are normal during startup, but we should not be logging them every second for cases where we will remain in recovery mode during startup for an extended period of time.
Such as if suspended or permabanned.

CQ S1023302

server/ctdb_monitor.c
server/ctdb_recoverd.c

index 547dcc01eed9364ba2d9c0baaa98e58d1a5f34eb..640ee932215497e9697218e517063f373aaf9c5f 100644 (file)
@@ -220,16 +220,20 @@ static void ctdb_wait_until_recovered(struct event_context *ev, struct timed_eve
 {
        struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
        int ret;
+       static int count = 0;
 
-       DEBUG(DEBUG_NOTICE,("CTDB_WAIT_UNTIL_RECOVERED\n"));
-       if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_STOPPED) {
-               DEBUG(DEBUG_NOTICE,("Node is STOPPED. Node will NOT recover.\n"));
+       count++;
+
+       if (count < 60 || count%600 == 0) { 
+               DEBUG(DEBUG_NOTICE,("CTDB_WAIT_UNTIL_RECOVERED\n"));
+               if (ctdb->nodes[ctdb->pnn]->flags & NODE_FLAGS_STOPPED) {
+                       DEBUG(DEBUG_NOTICE,("Node is STOPPED. Node will NOT recover.\n"));
+               }
        }
 
        if (ctdb->vnn_map->generation == INVALID_GENERATION) {
                ctdb->db_persistent_startup_generation = INVALID_GENERATION;
 
-               DEBUG(DEBUG_NOTICE,(__location__ " generation is INVALID. Wait one more second\n"));
                event_add_timed(ctdb->ev, ctdb->monitor->monitor_context,
                                     timeval_current_ofs(1, 0), 
                                     ctdb_wait_until_recovered, ctdb);
index 7b5814959f148fd5ca310633d92a3522eed4894e..ab14225891ecfde999d2a149d41c9b7eb045160a 100644 (file)
@@ -2578,7 +2578,7 @@ static int verify_local_ip_allocation(struct ctdb_context *ctdb, struct ctdb_rec
        /* skip the check if we have started but not finished recovery */
        if (timeval_compare(&uptime1->last_recovery_finished,
                            &uptime1->last_recovery_started) != 1) {
-               DEBUG(DEBUG_NOTICE, (__location__ " in the middle of recovery or ip reallocation. skipping public ip address check\n"));
+               DEBUG(DEBUG_INFO, (__location__ " in the middle of recovery or ip reallocation. skipping public ip address check\n"));
                talloc_free(mem_ctx);
 
                return 0;