ctdb-server: Rename CTDB_BROADCAST_VNNMAP -> CTDB_BROADCAST_ACTIVE
authorMartin Schwenke <martin@meltin.net>
Thu, 14 Jun 2018 20:01:52 +0000 (06:01 +1000)
committerMartin Schwenke <martins@samba.org>
Mon, 2 Jul 2018 06:51:22 +0000 (08:51 +0200)
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>
ctdb/client/client_tunnel.c
ctdb/protocol/protocol.h
ctdb/protocol/protocol_debug.c
ctdb/server/ctdb_control.c
ctdb/server/ctdb_ltdb_server.c
ctdb/server/ctdb_server.c
ctdb/server/ctdb_traverse.c

index e30fe7650056851214da648af96c9d1531514044..a783afe47c86fa88067df1de5b51d4e676c22adb 100644 (file)
@@ -431,7 +431,7 @@ struct tevent_req *ctdb_tunnel_request_send(TALLOC_CTX *mem_ctx,
        };
 
        if (destnode == CTDB_BROADCAST_ALL ||
-           destnode == CTDB_BROADCAST_VNNMAP ||
+           destnode == CTDB_BROADCAST_ACTIVE ||
            destnode == CTDB_BROADCAST_CONNECTED) {
                state->wait_for_reply = false;
        }
index cb807e3b939a9946c96198a1fa6f7289006ae99f..7189fab43f0720c927c8132f3573ab0085b0c7cf 100644 (file)
@@ -44,7 +44,7 @@ enum ctdb_operation {
 /* 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 */
index 4e1566391186b66feacbb8ac3252e7c69c015366..a34f5a86947edf06ed412abd589cda0f5cd1101a 100644 (file)
@@ -264,8 +264,8 @@ static void ctdb_pnn_print(uint32_t pnn, FILE *fp)
                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) {
index b537cd1aefa05d67afdfe9afa3aa3cd4d3a63918..b812980ddf9de27a207b0c4bde7df5970d756c6d 100644 (file)
@@ -860,7 +860,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
                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)) {
@@ -868,7 +868,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
                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) || 
index d94d942a9fae3fb41a09a913958af67bfea5728f..e5148c81d881e73d00adb4ca5a326108e7d8c97b 100644 (file)
@@ -1535,9 +1535,15 @@ static void ctdb_ltdb_seqnum_check(struct tevent_context *ev,
                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;
 
index 8e31038cc9567d8ceb02799ff87adc58238b3098..c991b85d99b2ff68293fefb47f627f64c9a3e9b4 100644 (file)
@@ -394,14 +394,18 @@ static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb,
 }
 
 /*
-  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);
        }
 }
@@ -435,8 +439,8 @@ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *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);
index 04a41138a72bc8bdaacfcaf9626ecc43fc7fccd4..5ea197095996276fc870b00e8db158f3f4a9a226 100644 (file)
@@ -387,8 +387,8 @@ static struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_
        }
 
        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