1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-26 18:50:30 +03:00

Enhance the logging fromeventscripts.

When a single script is finished, also log the name of the script, the duration it took and the return status.

In the loop where we signal back to the main daemon that the script finished, do this once every 100ms instead of once every 1 second

(This used to be ctdb commit 6a1f7a7b1b3a0b8f89998db8fdad83bbb4e9b5a5)
This commit is contained in:
Ronnie Sahlberg 2009-10-28 09:07:43 +11:00
parent 0588b5f9c5
commit 3526bc830d
2 changed files with 5 additions and 4 deletions

View File

@ -37,7 +37,7 @@ static const struct {
{ "TakeoverTimeout", 5, offsetof(struct ctdb_tunable, takeover_timeout) },
{ "MonitorInterval", 15, offsetof(struct ctdb_tunable, monitor_interval) },
{ "TickleUpdateInterval",20, offsetof(struct ctdb_tunable, tickle_update_interval) },
{ "EventScriptTimeout", 20, offsetof(struct ctdb_tunable, script_timeout) },
{ "EventScriptTimeout", 30, offsetof(struct ctdb_tunable, script_timeout) },
{ "EventScriptBanCount", 10, 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) },

View File

@ -183,8 +183,6 @@ int32_t ctdb_control_event_script_stop(struct ctdb_context *ctdb, TDB_DATA indat
struct ctdb_monitoring_status);
struct ctdb_monitor_script_status *script;
DEBUG(DEBUG_INFO, ("event script stop called : %d\n", (int)res));
if (monitoring_status == NULL) {
DEBUG(DEBUG_ERR,(__location__ " script_status is NULL when script finished.\n"));
return -1;
@ -199,6 +197,8 @@ int32_t ctdb_control_event_script_stop(struct ctdb_context *ctdb, TDB_DATA indat
script->finished = timeval_current();
script->status = res;
DEBUG(DEBUG_INFO, ("event script stop called for script:%s duration:%.1f status:%d\n", script->name, timeval_elapsed(&script->start), (int)res));
return 0;
}
@ -796,7 +796,8 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
rt = ctdb_event_script_v(ctdb, state->options);
while ((ret = write(state->fd[1], &rt, sizeof(rt))) != sizeof(rt)) {
sleep(1);
write(state->fd[1], &rt, sizeof(rt));
usleep(100000);
}
_exit(rt);
}