This broadcast is misnamed. Both places where this type of broadcast
is used expect the broadcast to go to all active nodes.
Make the corresponding change to the semantics in the daemon by
sending to all active nodes.
There is a mismatch between the ideas of VNN map and active nodes. A
node that is not in the VNN map but is active can still host database
records. These were the same until the LMASTER capability was
introduced and then the logic was not updated.
The only place where the VNN map is relevant is when finding the
location master of a record in the migration code.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13499
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit
36938bfdd075a174daecb466085702adfe6a6c09)
/* send a broadcast to all nodes in the cluster, active or not */
#define CTDB_BROADCAST_ALL 0xF0000002
/* send a broadcast to all nodes in the current vnn map */
-#define CTDB_BROADCAST_VNNMAP 0xF0000003
+#define CTDB_BROADCAST_ACTIVE 0xF0000003
/* send a broadcast to all connected nodes */
#define CTDB_BROADCAST_CONNECTED 0xF0000004
/* send a broadcast to selected connected nodes */
fprintf(fp, "CURRENT");
} else if (pnn == CTDB_BROADCAST_ALL) {
fprintf(fp, "ALL");
- } else if (pnn == CTDB_BROADCAST_VNNMAP) {
- fprintf(fp, "VNNMAP");
+ } else if (pnn == CTDB_BROADCAST_ACTIVE) {
+ fprintf(fp, "ACTIVE");
} else if (pnn == CTDB_BROADCAST_CONNECTED) {
fprintf(fp, "CONNECTED");
} else if (pnn == CTDB_MULTICAST) {
return -1;
}
- if (((destnode == CTDB_BROADCAST_VNNMAP) ||
+ if (((destnode == CTDB_BROADCAST_ACTIVE) ||
(destnode == CTDB_BROADCAST_ALL) ||
(destnode == CTDB_BROADCAST_CONNECTED)) &&
!(flags & CTDB_CTRL_FLAG_NOREPLY)) {
return -1;
}
- if (destnode != CTDB_BROADCAST_VNNMAP &&
+ if (destnode != CTDB_BROADCAST_ACTIVE &&
destnode != CTDB_BROADCAST_ALL &&
destnode != CTDB_BROADCAST_CONNECTED &&
(!ctdb_validate_pnn(ctdb, destnode) ||
TDB_DATA data;
data.dptr = (uint8_t *)&ctdb_db->db_id;
data.dsize = sizeof(uint32_t);
- ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0,
- CTDB_CONTROL_UPDATE_SEQNUM, 0, CTDB_CTRL_FLAG_NOREPLY,
- data, NULL, NULL);
+ ctdb_daemon_send_control(ctdb,
+ CTDB_BROADCAST_ACTIVE,
+ 0,
+ CTDB_CONTROL_UPDATE_SEQNUM,
+ 0,
+ CTDB_CTRL_FLAG_NOREPLY,
+ data,
+ NULL,
+ NULL);
}
ctdb_db->seqnum = new_seqnum;
}
/*
- broadcast a packet to all nodes in the current vnnmap
+ broadcast a packet to all active nodes
*/
-static void ctdb_broadcast_packet_vnnmap(struct ctdb_context *ctdb,
+static void ctdb_broadcast_packet_active(struct ctdb_context *ctdb,
struct ctdb_req_header *hdr)
{
int i;
- for (i=0;i<ctdb->vnn_map->size;i++) {
- hdr->destnode = ctdb->vnn_map->map[i];
+ for (i = 0; i < ctdb->num_nodes; i++) {
+ if (ctdb->nodes[i]->flags & NODE_FLAGS_INACTIVE) {
+ continue;
+ }
+
+ hdr->destnode = ctdb->nodes[i]->pnn;
ctdb_queue_packet(ctdb, hdr);
}
}
case CTDB_BROADCAST_ALL:
ctdb_broadcast_packet_all(ctdb, hdr);
return;
- case CTDB_BROADCAST_VNNMAP:
- ctdb_broadcast_packet_vnnmap(ctdb, hdr);
+ case CTDB_BROADCAST_ACTIVE:
+ ctdb_broadcast_packet_active(ctdb, hdr);
return;
case CTDB_BROADCAST_CONNECTED:
ctdb_broadcast_packet_connected(ctdb, hdr);
}
if (ctdb_db_volatile(ctdb_db)) {
- /* normal database, traverse all nodes */
- destination = CTDB_BROADCAST_VNNMAP;
+ /* volatile database, traverse all active nodes */
+ destination = CTDB_BROADCAST_ACTIVE;
} else {
int i;
/* persistent database, traverse one node, preferably