[SCM] CTDB repository - branch master updated - ctdb-1.0.108-57-g401f421

Ronnie Sahlberg sahlberg at samba.org
Sun Dec 13 21:50:48 MST 2009


The branch, master has been updated
       via  401f421fa003d9515df15e759b50b56e0c67d69c (commit)
       via  1b4e7bb548976b99f122142b040494b6f9911962 (commit)
       via  0ea0e27d93398df997d3df9d8bf112358af3a4a5 (commit)
      from  68a8ee99b128a5ec883600735626bdb3bbc9c503 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 401f421fa003d9515df15e759b50b56e0c67d69c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon Dec 14 15:48:47 2009 +1100

    cleanup:   remove a tunable we no longer use in the eventscripts any more :
    EventScriptUnhealthyOnTimeout

commit 1b4e7bb548976b99f122142b040494b6f9911962
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Dec 10 20:35:54 2009 +1030

    ctdb: don't print OUTPUT: for DISABLED scripts
    
    In other news, did you know ctime() returns a \n-terminated string?
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

commit 0ea0e27d93398df997d3df9d8bf112358af3a4a5
Author: Rusty Russell <rusty at rustcorp.com.au>
Date:   Thu Dec 10 20:25:33 2009 +1030

    eventscript: fix monitoring when killed by another script command
    
    Commit c1ba1392fe "eventscript: get rid of ctdb_control_event_script_finished
    altogether" was wrong: there is one case where we want to free the script
    without transferring their status to last_status.  This happens because we
    always kill an running monitor command when we run any other command.
    
    This still isn't quite right (and never was): the callback will be called
    with status value 0, which might flip us to HEALTHY if we were unhealthy.
    This is conveniently fixed in my next set of patches :)
    
    Signed-off-by: Rusty Russell <rusty at rustcorp.com.au>

-----------------------------------------------------------------------

Summary of changes:
 include/ctdb_private.h |    1 -
 server/ctdb_tunables.c |    1 -
 server/eventscript.c   |   21 ++++++++++++++-------
 tools/ctdb.c           |   10 ++++++----
 4 files changed, 20 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 0118dab..a5a931f 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -104,7 +104,6 @@ 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;
diff --git a/server/ctdb_tunables.c b/server/ctdb_tunables.c
index 6eb1b43..e737e20 100644
--- a/server/ctdb_tunables.c
+++ b/server/ctdb_tunables.c
@@ -39,7 +39,6 @@ static const struct {
 	{ "TickleUpdateInterval",20,  offsetof(struct ctdb_tunable, tickle_update_interval) },
 	{ "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) },
 	{ "RecoveryBanPeriod",  300,  offsetof(struct ctdb_tunable, recovery_ban_period) },
 	{ "DatabaseHashSize", 10000,  offsetof(struct ctdb_tunable, database_hash_size) },
diff --git a/server/eventscript.c b/server/eventscript.c
index 1e74446..5bec0e0 100644
--- a/server/eventscript.c
+++ b/server/eventscript.c
@@ -514,11 +514,13 @@ static int event_script_destructor(struct ctdb_event_script_state *state)
 		state->ctdb->current_monitor = NULL;
 	}
 
-	/* Save our status as the last executed status. */
-	talloc_free(state->ctdb->last_status[state->call]);
-	state->ctdb->last_status[state->call] = state->scripts;
-	if (state->current < state->ctdb->last_status[state->call]->num_scripts) {
-		state->ctdb->last_status[state->call]->num_scripts = state->current+1;
+	/* Save our scripts as the last executed status, if we have them. */
+	if (state->scripts) {
+		talloc_free(state->ctdb->last_status[state->call]);
+		state->ctdb->last_status[state->call] = state->scripts;
+		if (state->current < state->ctdb->last_status[state->call]->num_scripts) {
+			state->ctdb->last_status[state->call]->num_scripts = state->current+1;
+		}
 	}
 
 	/* This is allowed to free us; talloc will prevent double free anyway,
@@ -622,8 +624,13 @@ static int ctdb_event_script_callback_v(struct ctdb_context *ctdb,
 	}
 
 	/* Kill off any running monitor events to run this event. */
-	talloc_free(ctdb->current_monitor);
-	ctdb->current_monitor = NULL;
+	if (ctdb->current_monitor) {
+		/* Discard script status so we don't save to last_status */
+		talloc_free(ctdb->current_monitor->scripts);
+		ctdb->current_monitor->scripts = NULL;
+		talloc_free(ctdb->current_monitor);
+		ctdb->current_monitor = NULL;
+	}
 
 	if (!from_user && (call == CTDB_EVENT_MONITOR || call == CTDB_EVENT_STATUS)) {
 		ctdb->current_monitor = state;
diff --git a/tools/ctdb.c b/tools/ctdb.c
index c210a20..204db14 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -801,10 +801,12 @@ static int control_one_scriptstatus(struct ctdb_context *ctdb,
 		if (script_status->scripts[i].status != -ENOEXEC) {
 			printf("%s",
 			       ctime(&script_status->scripts[i].start.tv_sec));
-		}
-		if (script_status->scripts[i].status != 0) {
-			printf("   OUTPUT:%s\n",
-				script_status->scripts[i].output);
+			if (script_status->scripts[i].status != 0) {
+				printf("   OUTPUT:%s\n",
+				       script_status->scripts[i].output);
+			}
+		} else {
+			printf("\n");
 		}
 	}
 	return 0;


-- 
CTDB repository


More information about the samba-cvs mailing list