uint32_t no_ip_failback;
uint32_t verbose_memory_names;
uint32_t recd_ping_timeout;
+ uint32_t recd_ping_failcount;
};
/*
int start_as_disabled;
uint32_t event_script_timeouts; /* counting how many consecutive times an eventscript has timedout */
TALLOC_CTX *eventscripts_ctx; /* a context to hold data for the RUN_EVENTSCRIPTS control */
- TALLOC_CTX *recd_ping_ctx;
+ uint32_t *recd_ping_count;
};
struct ctdb_db_context {
static void ctdb_recd_ping_timeout(struct event_context *ev, struct timed_event *te, struct timeval t, void *p)
{
struct ctdb_context *ctdb = talloc_get_type(p, struct ctdb_context);
+ uint32_t *count = talloc_get_type(ctdb->recd_ping_count, uint32_t);
- DEBUG(DEBUG_ERR, (__location__ " Recovery daemon ping timeout. Shutting down ctdb daemon\n"));
+ DEBUG(DEBUG_ERR, (__location__ " Recovery daemon ping timeout. Count : %u\n", *count));
+
+ if (*count < ctdb->tunable.recd_ping_timeout) {
+ (*count)++;
+ event_add_timed(ctdb->ev, ctdb->recd_ping_count,
+ timeval_current_ofs(ctdb->tunable.recd_ping_timeout, 0),
+ ctdb_recd_ping_timeout, ctdb);
+ return;
+ }
+
+ DEBUG(DEBUG_ERR, (__location__ " Final timeout for recovery daemon ping. Shutting down ctdb daemon\n"));
ctdb_stop_recoverd(ctdb);
ctdb_stop_keepalive(ctdb);
*/
int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb)
{
- talloc_free(ctdb->recd_ping_ctx);
+ talloc_free(ctdb->recd_ping_count);
- ctdb->recd_ping_ctx = talloc_new(ctdb);
- CTDB_NO_MEMORY(ctdb, ctdb->recd_ping_ctx);
+ ctdb->recd_ping_count = talloc_zero(ctdb, uint32_t);
+ CTDB_NO_MEMORY(ctdb, ctdb->recd_ping_count);
if (ctdb->tunable.recd_ping_timeout != 0) {
- event_add_timed(ctdb->ev, ctdb->recd_ping_ctx,
+ event_add_timed(ctdb->ev, ctdb->recd_ping_count,
timeval_current_ofs(ctdb->tunable.recd_ping_timeout, 0),
ctdb_recd_ping_timeout, ctdb);
}
{ "ReclockPingPeriod", 60, offsetof(struct ctdb_tunable, reclock_ping_period) },
{ "NoIPFailback", 0, offsetof(struct ctdb_tunable, no_ip_failback) },
{ "VerboseMemoryNames", 0, offsetof(struct ctdb_tunable, verbose_memory_names) },
- { "RecdPingTimeout", 60, offsetof(struct ctdb_tunable, recd_ping_timeout) },
+ { "RecdPingTimeout", 20, offsetof(struct ctdb_tunable, recd_ping_timeout) },
+ { "RecdFailCount", 3, offsetof(struct ctdb_tunable, recd_ping_failcount) },
};
/*