diff options
| author | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2008-05-06 13:56:56 +1000 |
|---|---|---|
| committer | Ronnie Sahlberg <ronniesahlberg@gmail.com> | 2008-05-06 13:56:56 +1000 |
| commit | 2c23959616ef1db2ae07172eba72ef313ccba0ed (patch) | |
| tree | 3b42f4382047d3adc8dfaec16658976c85361985 /ctdb | |
| parent | 6863c8f5736f0910d69578ff139dd580ac8c69a1 (diff) | |
make sure we lose all elections for recmaster role if we do not have the recmaster capability.
(unless there are no other node at all available with this capability)
(This used to be ctdb commit 8556e9dc897c6b9b9be0b52f391effb1f72fbd80)
Diffstat (limited to 'ctdb')
| -rwxr-xr-x | ctdb/config/ctdb.init | 4 | ||||
| -rw-r--r-- | ctdb/server/ctdb_recoverd.c | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init index c83c091a73..922a53d57f 100755 --- a/ctdb/config/ctdb.init +++ b/ctdb/config/ctdb.init @@ -66,10 +66,10 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK" [ -z "$CTDB_START_AS_DISABLED" ] || [ "$CTDB_START_AS_DISABLED" != "yes" ] || { CTDB_OPTIONS="$CTDB_OPTIONS --start-as-disabled" } -[ -z "$CTDB_CAPABILITY_RECMASTER" ] || [ "$CTDB_CAPABILITY_RECMASTER" != "yes" ] || { +[ -z "$CTDB_CAPABILITY_RECMASTER" ] || [ "$CTDB_CAPABILITY_RECMASTER" != "no" ] || { CTDB_OPTIONS="$CTDB_OPTIONS --no-recmaster" } -[ -z "$CTDB_CAPABILITY_LMASTER" ] || [ "$CTDB_CAPABILITY_LMASTER" != "yes" ] || { +[ -z "$CTDB_CAPABILITY_LMASTER" ] || [ "$CTDB_CAPABILITY_LMASTER" != "no" ] || { CTDB_OPTIONS="$CTDB_OPTIONS --no-lmaster" } diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 3617efd4e2..26993f4f17 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -1481,6 +1481,13 @@ static void ctdb_election_data(struct ctdb_recoverd *rec, struct election_messag em->num_connected++; } } + + /* we shouldnt try to win this election if we cant be a recmaster */ + if ((ctdb->capabilities & CTDB_CAP_RECMASTER) == 0) { + em->num_connected = 0; + em->priority_time = timeval_current(); + } + talloc_free(nodemap); } @@ -1494,6 +1501,11 @@ static bool ctdb_election_win(struct ctdb_recoverd *rec, struct election_message ctdb_election_data(rec, &myem); + /* we cant win if we dont have the recmaster capability */ + if ((rec->ctdb->capabilities & CTDB_CAP_RECMASTER) == 0) { + return false; + } + /* we cant win if we are banned */ if (rec->node_flags & NODE_FLAGS_BANNED) { return false; |
