test of a change to make ctdbd use "status" event instead of the "monitor" event.
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 13 Nov 2009 01:37:55 +0000 (12:37 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 13 Nov 2009 01:37:55 +0000 (12:37 +1100)
This allows running the actual monitoring asynchronously from ctdbd
and only using "status" to pick up the actual results.

include/ctdb_private.h
server/ctdb_tunables.c
server/eventscript.c

index ebb6d4ae0a1de29c1c78d7c6f2c9632bde008a6f..ba6a6752e6d6d36ae09d6afe9c68c3ca3d9a5ce7 100644 (file)
@@ -129,6 +129,7 @@ struct ctdb_tunable {
        uint32_t vacuum_min_interval;
        uint32_t vacuum_max_interval;
        uint32_t max_queue_depth_drop_msg;
+       uint32_t use_status_events_for_monitoring;
 };
 
 /*
index 0bf87b93fc22c0c31e039b8407bea61d4cb95be0..6f657e61dae6b949edbcd17889374e024fe64949 100644 (file)
@@ -63,7 +63,8 @@ static const struct {
        { "VacuumLimit",       5000,  offsetof(struct ctdb_tunable, vacuum_limit) },
        { "VacuumMinInterval",   60,  offsetof(struct ctdb_tunable, vacuum_min_interval) },
        { "VacuumMaxInterval",  600,  offsetof(struct ctdb_tunable, vacuum_max_interval) },
-       { "MaxQueueDropMsg",  1000,  offsetof(struct ctdb_tunable, max_queue_depth_drop_msg) }
+       { "MaxQueueDropMsg",  1000,  offsetof(struct ctdb_tunable, max_queue_depth_drop_msg) },
+       { "UseStatusEvents",     0,  offsetof(struct ctdb_tunable, use_status_events_for_monitoring) }
 };
 
 /*
index 7ad66c6c6d00f2cb7032a4d6751233b1d1a400d9..4c193c8f2edfbfa589255f81c01d6807550a90e0 100644 (file)
@@ -541,10 +541,21 @@ static int ctdb_event_script_v(struct ctdb_context *ctdb, const char *options)
           them
         */
        for (current=scripts; current; current=current->next) {
-               /* we dont run disabled scripts, we just report they are disabled */
-               cmdstr = talloc_asprintf(tmp_ctx, "%s/%s %s", 
-                               ctdb->event_script_dir,
-                               current->name, options);
+               /* Allow a setting where we run the actual monitor event
+                  from an external source and replace it with
+                  a "status" event that just picks up the actual
+                  status of the event asynchronously.
+               */
+               if ((ctdb->tunable.use_status_events_for_monitoring != 0) 
+               && (!strcmp(options, "status"))) {
+                       cmdstr = talloc_asprintf(tmp_ctx, "%s/%s %s", 
+                                       ctdb->event_script_dir,
+                                       current->name, "status");
+               } else {
+                       cmdstr = talloc_asprintf(tmp_ctx, "%s/%s %s", 
+                                       ctdb->event_script_dir,
+                                       current->name, options);
+               }
                CTDB_NO_MEMORY(ctdb, cmdstr);
 
                DEBUG(DEBUG_INFO,("Executing event script %s\n",cmdstr));