summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-06-21 15:49:30 +0200
committerMichael Adam <obnox@samba.org>2011-11-26 23:47:00 +0100
commitb02b55bd12baea6f12008e528ac4be7e9f5a80c3 (patch)
tree0fd9b2cd1f4ab7380ad2b0d5344e3ea8c0f4741b
parent7a962685d3a774c8bcddfa02f7bb8f614c1a9014 (diff)
downloadsamba-b02b55bd12baea6f12008e528ac4be7e9f5a80c3.tar.gz
samba-b02b55bd12baea6f12008e528ac4be7e9f5a80c3.tar.xz
samba-b02b55bd12baea6f12008e528ac4be7e9f5a80c3.zip
recoverd: try to become the recovery master if we have the capability, but the current master doesn't
metze (This used to be ctdb commit a97d417aba85e901540147a4dff4794249442939)
-rw-r--r--ctdb/server/ctdb_recoverd.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index fa4b6ba882..36abfd4d21 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -3010,6 +3010,13 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
}
nodemap = rec->nodemap;
+ /* update the capabilities for all nodes */
+ ret = update_capabilities(ctdb, nodemap);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR, (__location__ " Unable to update node capabilities.\n"));
+ goto again;
+ }
+
/* check which node is the recovery master */
ret = ctdb_ctrl_getrecmaster(ctdb, mem_ctx, CONTROL_TIMEOUT(), pnn, &rec->recmaster);
if (ret != 0) {
@@ -3032,7 +3039,6 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
return;
}
-
/* if the local daemon is STOPPED, we verify that the databases are
also frozen and thet the recmode is set to active
*/
@@ -3067,6 +3073,21 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
return;
}
+ /*
+ * if the current recmaster do not have CTDB_CAP_RECMASTER,
+ * but we have force an election and try to become the new
+ * recmaster
+ */
+ if ((rec->ctdb->nodes[rec->recmaster]->capabilities & CTDB_CAP_RECMASTER) == 0 &&
+ (rec->ctdb->capabilities & CTDB_CAP_RECMASTER) &&
+ !(nodemap->nodes[pnn].flags & NODE_FLAGS_INACTIVE)) {
+ DEBUG(DEBUG_ERR, (__location__ " Current recmaster node %u does not have CAP_RECMASTER,"
+ " but we (node %u) have - force an election\n",
+ rec->recmaster, pnn));
+ force_election(rec, pnn, nodemap);
+ goto again;
+ }
+
/* check that we (recovery daemon) and the local ctdb daemon
agrees on whether we are banned or not
*/