Create a tunable for how often to collect rolling statistics and initialize it to...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 30 Sep 2010 04:39:54 +0000 (14:39 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Thu, 30 Sep 2010 05:00:57 +0000 (15:00 +1000)
include/ctdb_private.h
server/ctdb_statistics.c
server/ctdb_tunables.c

index 2394b4486aa5c03a621484d4105886004adca167..f018554dd71e74c932bd408c94e326f48c2bdcaa 100644 (file)
@@ -117,6 +117,7 @@ struct ctdb_tunable {
        uint32_t max_queue_depth_drop_msg;
        uint32_t use_status_events_for_monitoring;
        uint32_t allow_unhealthy_db_read;
        uint32_t max_queue_depth_drop_msg;
        uint32_t use_status_events_for_monitoring;
        uint32_t allow_unhealthy_db_read;
+       uint32_t stat_history_interval;
 };
 
 /*
 };
 
 /*
index 243a4f2789be6eaf7b56a73c6cfacd47e913506e..aec17ad38d91dd0a08781e2679f1374397937fdb 100644 (file)
@@ -35,7 +35,8 @@ static void ctdb_statistics_update(struct event_context *ev, struct timed_event
        bzero(&ctdb->statistics_current, sizeof(struct ctdb_statistics));
        ctdb->statistics_current.statistics_start_time = timeval_current();
 
        bzero(&ctdb->statistics_current, sizeof(struct ctdb_statistics));
        ctdb->statistics_current.statistics_start_time = timeval_current();
 
-       event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(10, 0), ctdb_statistics_update, ctdb);
+       
+       event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(ctdb->tunable.stat_history_interval, 0), ctdb_statistics_update, ctdb);
 }
 
 int ctdb_statistics_init(struct ctdb_context *ctdb)
 }
 
 int ctdb_statistics_init(struct ctdb_context *ctdb)
@@ -47,7 +48,7 @@ int ctdb_statistics_init(struct ctdb_context *ctdb)
 
        bzero(ctdb->statistics_history, sizeof(ctdb->statistics_history));
 
 
        bzero(ctdb->statistics_history, sizeof(ctdb->statistics_history));
 
-       event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(10, 0), ctdb_statistics_update, ctdb);
+       event_add_timed(ctdb->ev, ctdb, timeval_current_ofs(ctdb->tunable.stat_history_interval, 0), ctdb_statistics_update, ctdb);
        return 0;
 }
 
        return 0;
 }
 
index cca270b95c484970c2d76a0f5e52a851afab3383..02e76ae30822d3462cedeb81d59d4b7cc6dcc9fe 100644 (file)
@@ -64,7 +64,8 @@ static const struct {
        { "VacuumMaxInterval",  600,  offsetof(struct ctdb_tunable, vacuum_max_interval) },
        { "MaxQueueDropMsg",  1000000, offsetof(struct ctdb_tunable, max_queue_depth_drop_msg) },
        { "UseStatusEvents",     0,  offsetof(struct ctdb_tunable, use_status_events_for_monitoring) },
        { "VacuumMaxInterval",  600,  offsetof(struct ctdb_tunable, vacuum_max_interval) },
        { "MaxQueueDropMsg",  1000000, offsetof(struct ctdb_tunable, max_queue_depth_drop_msg) },
        { "UseStatusEvents",     0,  offsetof(struct ctdb_tunable, use_status_events_for_monitoring) },
-       { "AllowUnhealthyDBRead", 0,  offsetof(struct ctdb_tunable, allow_unhealthy_db_read) }
+       { "AllowUnhealthyDBRead", 0,  offsetof(struct ctdb_tunable, allow_unhealthy_db_read) },
+       { "StatHistoryInterval",  1,  offsetof(struct ctdb_tunable, stat_history_interval) }
 };
 
 /*
 };
 
 /*