timeval_current_ofs(ctdb->tunable.monitor_interval, 0),
ctdb_check_health, ctdb);
+ c.vnn = ctdb->vnn;
+ c.old_flags = node->flags;
+
if (status != 0 && !(node->flags & NODE_FLAGS_UNHEALTHY)) {
DEBUG(0,("monitor event failed - disabling node\n"));
node->flags |= NODE_FLAGS_UNHEALTHY;
return;
}
- c.vnn = ctdb->vnn;
- c.flags = node->flags;
+ c.new_flags = node->flags;
data.dptr = (uint8_t *)&c;
data.dsize = sizeof(c);
/* if we have been banned, go into recovery mode */
c.vnn = ctdb->vnn;
- c.flags = node->flags;
+ c.old_flags = old_flags;
+ c.new_flags = node->flags;
data.dptr = (uint8_t *)&c;
data.dsize = sizeof(c);
TDB_DATA data;
c.vnn = nodemap->nodes[i].vnn;
- c.flags = nodemap->nodes[i].flags;
+ c.old_flags = nodemap->nodes[i].flags;
+ c.new_flags = nodemap->nodes[i].flags;
data.dptr = (uint8_t *)&c;
data.dsize = sizeof(c);
/* send a message to all clients telling them that the cluster
has been reconfigured */
- ctdb_send_message(ctdb, CTDB_BROADCAST_ALL, CTDB_SRVID_RECONFIGURE, tdb_null);
+ ctdb_send_message(ctdb, CTDB_BROADCAST_CONNECTED, CTDB_SRVID_RECONFIGURE, tdb_null);
DEBUG(0, (__location__ " Recovery complete\n"));
struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
struct ctdb_node_map *nodemap=NULL;
TALLOC_CTX *tmp_ctx;
+ uint32_t changed_flags;
int i;
if (data.dsize != sizeof(*c)) {
return;
}
+ changed_flags = c->old_flags ^ c->new_flags;
+
/* Dont let messages from remote nodes change the DISCONNECTED flag.
This flag is handled locally based on whether the local node
can communicate with the node or not.
*/
- c->flags &= ~NODE_FLAGS_DISCONNECTED;
+ c->new_flags &= ~NODE_FLAGS_DISCONNECTED;
if (nodemap->nodes[i].flags&NODE_FLAGS_DISCONNECTED) {
- c->flags |= NODE_FLAGS_DISCONNECTED;
+ c->new_flags |= NODE_FLAGS_DISCONNECTED;
}
- if (nodemap->nodes[i].flags != c->flags) {
- DEBUG(0,("Node %u has changed flags - now 0x%x\n", c->vnn, c->flags));
+ if (nodemap->nodes[i].flags != c->new_flags) {
+ DEBUG(0,("Node %u has changed flags - now 0x%x was 0x%x\n", c->vnn, c->new_flags, c->old_flags));
}
- nodemap->nodes[i].flags = c->flags;
+ nodemap->nodes[i].flags = c->new_flags;
ret = ctdb_ctrl_getrecmaster(ctdb, CONTROL_TIMEOUT(),
CTDB_CURRENT_NODE, &ctdb->recovery_master);
ctdb->recovery_master == ctdb->vnn &&
ctdb->recovery_mode == CTDB_RECOVERY_NORMAL &&
ctdb->takeover.enabled) {
- ret = ctdb_takeover_run(ctdb, nodemap);
- if (ret != 0) {
- DEBUG(0, (__location__ " Unable to setup public takeover addresses\n"));
+ /* Only do the takeover run if the perm disabled or unhealthy
+ flags changed since these will cause an ip failover but not
+ a recovery.
+ If the node became disconnected or banned this will also
+ lead to an ip address failover but that is handled
+ during recovery
+ */
+ if (changed_flags & NODE_FLAGS_DISABLED) {
+ ret = ctdb_takeover_run(ctdb, nodemap);
+ if (ret != 0) {
+ DEBUG(0, (__location__ " Unable to setup public takeover addresses\n"));
+ }
+ /* send a message to all clients telling them that the
+ cluster has been reconfigured */
+ ctdb_send_message(ctdb, CTDB_BROADCAST_CONNECTED, CTDB_SRVID_RECONFIGURE, tdb_null);
}
}