1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

From wolfgang Mueller

Add a tuneable so that when scripts starts to hang/timeout, we can make the node unhealthy instead of banned

(This used to be ctdb commit 2e9fc6f0609833c6d8146196011ef780669d615d)
This commit is contained in:
Ronnie Sahlberg 2009-10-20 12:59:48 +11:00
parent 58780f4137
commit d788dd3627
3 changed files with 11 additions and 4 deletions

View File

@ -99,6 +99,7 @@ struct ctdb_tunable {
uint32_t tickle_update_interval;
uint32_t script_timeout;
uint32_t script_ban_count; /* ban after this many consec timeouts*/
uint32_t script_unhealthy_on_timeout; /* don't ban on timeout; set node unhealthy */
uint32_t recovery_grace_period;
uint32_t recovery_ban_period;
uint32_t database_hash_size;

View File

@ -39,6 +39,7 @@ static const struct {
{ "TickleUpdateInterval",20, offsetof(struct ctdb_tunable, tickle_update_interval) },
{ "EventScriptTimeout", 60, offsetof(struct ctdb_tunable, script_timeout) },
{ "EventScriptBanCount", 5, offsetof(struct ctdb_tunable, script_ban_count) },
{ "EventScriptUnhealthyOnTimeout", 0, offsetof(struct ctdb_tunable, script_unhealthy_on_timeout) },
{ "RecoveryGracePeriod", 120, offsetof(struct ctdb_tunable, recovery_grace_period) },
{ "RecoveryBanPeriod", 300, offsetof(struct ctdb_tunable, recovery_ban_period) },
{ "DatabaseHashSize", 10000, offsetof(struct ctdb_tunable, database_hash_size) },

View File

@ -705,10 +705,15 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
ctdb->event_script_timeouts++;
if (ctdb->event_script_timeouts > ctdb->tunable.script_ban_count) {
ctdb->event_script_timeouts = 0;
DEBUG(DEBUG_ERR, ("Maximum timeout count %u reached for eventscript. Banning self for %d seconds\n", ctdb->tunable.script_ban_count, ctdb->tunable.recovery_ban_period));
ctdb_ban_self(ctdb, ctdb->tunable.recovery_ban_period);
callback(ctdb, -1, private_data);
if (ctdb->tunable.script_unhealthy_on_timeout != 0) {
DEBUG(DEBUG_ERR, ("Maximum timeout count %u reached for eventscript. Making node unhealthy\n", ctdb->tunable.script_ban_count));
callback(ctdb, -ETIME, private_data);
} else {
ctdb->event_script_timeouts = 0;
DEBUG(DEBUG_ERR, ("Maximum timeout count %u reached for eventscript. Banning self for %d seconds\n", ctdb->tunable.script_ban_count, ctdb->tunable.recovery_ban_period));
ctdb_ban_self(ctdb, ctdb->tunable.recovery_ban_period);
callback(ctdb, -1, private_data);
}
} else {
callback(ctdb, 0, private_data);
}