uint32_t destnode,
struct ctdb_tunable *tunables);
+void ctdb_start_freeze(struct ctdb_context *ctdb);
+
#endif
(ctdb->nodes[c->vnn]->flags&NODE_FLAGS_DISCONNECTED)
| (c->flags & ~NODE_FLAGS_DISCONNECTED);
DEBUG(2,("Node flags for node %u are now 0x%x\n", c->vnn, ctdb->nodes[c->vnn]->flags));
+
+ /* make sure we don't hold any IPs when we shouldn't */
+ if (c->vnn == ctdb->vnn &&
+ (ctdb->nodes[c->vnn]->flags & (NODE_FLAGS_INACTIVE|NODE_FLAGS_BANNED))) {
+ ctdb_release_all_ips(ctdb);
+ }
}
/* called when the "startup" event script has finished */
}
/*
- freeze the databases
+ start the freeze process
*/
-int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *c, bool *async_reply)
+void ctdb_start_freeze(struct ctdb_context *ctdb)
{
- struct ctdb_freeze_waiter *w;
-
if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
/* we're already frozen */
- return 0;
+ return;
}
/* if there isn't a freeze lock child then create one */
if (!ctdb->freeze_handle) {
ctdb->freeze_handle = ctdb_freeze_lock(ctdb);
- CTDB_NO_MEMORY(ctdb, ctdb->freeze_handle);
+ CTDB_NO_MEMORY_VOID(ctdb, ctdb->freeze_handle);
ctdb->freeze_mode = CTDB_FREEZE_PENDING;
}
+}
+
+/*
+ freeze the databases
+ */
+int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *c, bool *async_reply)
+{
+ struct ctdb_freeze_waiter *w;
+
+ if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
+ /* we're already frozen */
+ return 0;
+ }
+
+ ctdb_start_freeze(ctdb);
/* add ourselves to list of waiters */
w = talloc(ctdb->freeze_handle, struct ctdb_freeze_waiter);
*/
bool ctdb_blocking_freeze(struct ctdb_context *ctdb)
{
- if (ctdb->freeze_mode == CTDB_FREEZE_FROZEN) {
- /* we're already frozen */
- return true;
- }
-
- /* if there isn't a freeze lock child then create one */
- if (!ctdb->freeze_handle) {
- ctdb->freeze_handle = ctdb_freeze_lock(ctdb);
- CTDB_NO_MEMORY(ctdb, ctdb->freeze_handle);
- ctdb->freeze_mode = CTDB_FREEZE_PENDING;
- }
+ ctdb_start_freeze(ctdb);
/* block until frozen */
while (ctdb->freeze_mode == CTDB_FREEZE_PENDING) {
if ((node->flags & NODE_FLAGS_BANNED) && !(old_flags & NODE_FLAGS_BANNED)) {
/* make sure we are frozen */
DEBUG(0,("This node has been banned - forcing freeze and recovery\n"));
- if (!ctdb_blocking_freeze(ctdb)) {
- ctdb_fatal(ctdb, "Unable to freeze when banned");
- }
+ ctdb_start_freeze(ctdb);
+ ctdb_release_all_ips(ctdb);
ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
}
data.dptr = (uint8_t *)&t;
data.dsize = sizeof(t);
- ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0,
+ ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_CONNECTED, 0,
CTDB_CONTROL_TCP_ADD,
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
}
/* at this point ctdb->nodes[i]->takeover_vnn is the vnn which will own each IP */
-
/* now tell all nodes to delete any alias that they should not
have. This will be a NOOP on nodes that don't currently
hold the given alias */
data.dsize = sizeof(t);
/* tell all nodes about this tcp connection */
- ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0,
+ ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_CONNECTED, 0,
CTDB_CONTROL_TCP_ADD,
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
if (ret != 0) {
p.dest = tcp->daddr;
data.dptr = (uint8_t *)&p;
data.dsize = sizeof(p);
- ctdb_daemon_send_control(client->ctdb, CTDB_BROADCAST_VNNMAP, 0,
+ ctdb_daemon_send_control(client->ctdb, CTDB_BROADCAST_CONNECTED, 0,
CTDB_CONTROL_TCP_REMOVE,
0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL);
talloc_free(tcp);