[SCM] CTDB repository - branch master updated - ctdb-1.0.100-3-g47b6707
Ronnie Sahlberg
sahlberg at samba.org
Wed Oct 28 00:34:09 MDT 2009
The branch, master has been updated
via 47b67077bdfa64938bb0fa6d1ca8f56fbd5c960e (commit)
via 325de818f88f339a16dc4544e899a2d735933c44 (commit)
via 8d5cb2586a1d5a0255cc18295430927b914d4527 (commit)
from fa34e8a5d588026029dca949151697817fe7f127 (commit)
http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 47b67077bdfa64938bb0fa6d1ca8f56fbd5c960e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Oct 28 17:42:01 2009 +1100
version 1.0.101
commit 325de818f88f339a16dc4544e899a2d735933c44
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Oct 28 17:35:15 2009 +1100
create a separate context for non-monitor eventscripts so they dont collide
commit 8d5cb2586a1d5a0255cc18295430927b914d4527
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date: Wed Oct 28 16:40:31 2009 +1100
return 0 in the event script callback if it was aborted by a different script
-----------------------------------------------------------------------
Summary of changes:
include/ctdb_private.h | 1 +
packaging/RPM/ctdb.spec | 5 ++++-
server/eventscript.c | 33 ++++++++++++++++++++++-----------
3 files changed, 27 insertions(+), 12 deletions(-)
Changeset truncated at 500 lines:
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 7ee3db5..5791df0 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -452,6 +452,7 @@ struct ctdb_context {
TALLOC_CTX *release_ips_ctx; /* a context used to automatically drop all IPs if we fail to recover the node */
TALLOC_CTX *script_monitor_ctx; /* a context where we store results while running the monitor event */
TALLOC_CTX *last_monitor_ctx;
+ TALLOC_CTX *event_script_ctx; /* non-monitoring events */
TALLOC_CTX *banning_ctx;
};
diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index f5808e6..009f15d 100644
--- a/packaging/RPM/ctdb.spec
+++ b/packaging/RPM/ctdb.spec
@@ -4,7 +4,7 @@ Summary: Clustered TDB
Vendor: Samba Team
Packager: Samba Team <samba at samba.org>
Name: ctdb
-Version: 1.0.100
+Version: 1.0.101
Release: 1
Epoch: 0
License: GNU GPL version 3
@@ -127,6 +127,9 @@ exit 0
%{_libdir}/pkgconfig/ctdb.pc
%changelog
+* Wed Oct 28 2009 : Version 1.0.101
+ - create a separate context for non-monitoring events so they dont interfere with the monitor event
+ - make sure to return status 0 in teh callback when we abort an event
* Wed Oct 28 2009 : Version 1.0.100
- Change eventscript handling to allow EventScriptTimeout for each individual script instead of for all scripts as a whole.
- Enhanced logging from the eventscripts, log the name and the duration for each script as it finishes.
diff --git a/server/eventscript.c b/server/eventscript.c
index 0fea281..9711eba 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -736,7 +736,7 @@ static void ctdb_event_script_timeout(struct event_context *ev, struct timed_eve
}
}
- if (monitoring_status != NULL) {
+ if ((!strcmp(options, "monitor")) && (monitoring_status != NULL)) {
struct ctdb_monitor_script_status *script;
script = monitoring_status->scripts;
@@ -763,7 +763,7 @@ static int event_script_destructor(struct ctdb_event_script_state *state)
DEBUG(DEBUG_ERR,(__location__ " Sending SIGTERM to child pid:%d\n", state->child));
if (state->callback) {
- state->callback(state->ctdb, -1, state->private_data);
+ state->callback(state->ctdb, 0, state->private_data);
state->callback = NULL;
}
@@ -788,11 +788,19 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
struct ctdb_event_script_state *state;
int ret;
- if (ctdb->script_monitor_ctx != NULL) {
- talloc_free(ctdb->script_monitor_ctx);
- ctdb->script_monitor_ctx = NULL;
+ if (!strcmp(fmt, "monitor")) {
+ if (ctdb->script_monitor_ctx != NULL) {
+ talloc_free(ctdb->script_monitor_ctx);
+ ctdb->script_monitor_ctx = NULL;
+ }
+ monitoring_status = talloc_zero(ctdb, struct ctdb_monitor_status);
+ } else {
+ if (ctdb->event_script_ctx == NULL) {
+ ctdb->event_script_ctx = talloc_zero(ctdb, struct ctdb_monitor_status);
+ }
+ monitoring_status = ctdb->event_script_ctx;
}
- monitoring_status = talloc_zero(ctdb, struct ctdb_monitor_status);
+
if (monitoring_status == NULL) {
DEBUG(DEBUG_ERR, (__location__ " ERROR: Failed to talloc script_monitoring context\n"));
return -1;
@@ -801,7 +809,6 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
state = talloc(monitoring_status, struct ctdb_event_script_state);
if (state == NULL) {
DEBUG(DEBUG_ERR,(__location__ " could not allocate state\n"));
- talloc_free(monitoring_status);
return -1;
}
monitoring_status->state = state;
@@ -814,7 +821,7 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
state->te = NULL;
if (state->options == NULL) {
DEBUG(DEBUG_ERR, (__location__ " could not allocate state->options\n"));
- talloc_free(monitoring_status);
+ talloc_free(state);
return -1;
}
@@ -822,7 +829,7 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
ret = pipe(state->fd);
if (ret != 0) {
- talloc_free(monitoring_status);
+ talloc_free(state);
return -1;
}
@@ -831,7 +838,7 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
if (state->child == (pid_t)-1) {
close(state->fd[0]);
close(state->fd[1]);
- talloc_free(monitoring_status);
+ talloc_free(state);
return -1;
}
@@ -850,7 +857,11 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
}
talloc_set_destructor(state, event_script_destructor);
- ctdb->script_monitor_ctx = monitoring_status;
+ if (!strcmp(fmt, "monitor")) {
+ ctdb->script_monitor_ctx = monitoring_status;
+ } else {
+ ctdb->event_script_ctx = monitoring_status;
+ }
close(state->fd[1]);
set_close_on_exec(state->fd[0]);
--
CTDB repository
More information about the samba-cvs
mailing list