diff options
| author | Ronnie Sahlberg <sahlberg@ronnie> | 2007-05-05 13:17:26 +1000 |
|---|---|---|
| committer | Ronnie Sahlberg <sahlberg@ronnie> | 2007-05-05 13:17:26 +1000 |
| commit | 5cb817f031dcbc05ca22fbe087fc0546bc6e2169 (patch) | |
| tree | 2b2827e7d6719b572d953357f524cb7a8ecc7843 | |
| parent | 86b78a5d04cd926396f824483fea9c32f9cc5ce5 (diff) | |
split the vnn broadcast address into two
one broadcast address for all nodes
and one broadcast address for all nodes in the current vnnmap
update all useage of the old flag to now only broadcast to the vnnmap
except for tools/ctdb_control where it makes more sense to broadcast to
all nodes
(This used to be ctdb commit dfb65b88cf67ad9d61268c4b47a6d8ae346f47df)
| -rw-r--r-- | ctdb/common/ctdb.c | 22 | ||||
| -rw-r--r-- | ctdb/common/ctdb_control.c | 2 | ||||
| -rw-r--r-- | ctdb/common/ctdb_ltdb.c | 4 | ||||
| -rw-r--r-- | ctdb/common/ctdb_traverse.c | 2 | ||||
| -rw-r--r-- | ctdb/include/ctdb_private.h | 8 | ||||
| -rw-r--r-- | ctdb/tools/ctdb_control.c | 2 |
6 files changed, 30 insertions, 10 deletions
diff --git a/ctdb/common/ctdb.c b/ctdb/common/ctdb.c index 7894fcc320..4699e8f2d7 100644 --- a/ctdb/common/ctdb.c +++ b/ctdb/common/ctdb.c @@ -469,7 +469,7 @@ static void ctdb_defer_packet(struct ctdb_context *ctdb, struct ctdb_req_header /* broadcast a packet to all nodes */ -static void ctdb_broadcast_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) +static void ctdb_broadcast_packet_all(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) { int i; for (i=0;i<ctdb_get_num_nodes(ctdb);i++) { @@ -479,14 +479,30 @@ static void ctdb_broadcast_packet(struct ctdb_context *ctdb, struct ctdb_req_hea } /* + broadcast a packet to all nodes in the current vnnmap +*/ +static void ctdb_broadcast_packet_vnnmap(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]; + ctdb_queue_packet(ctdb, hdr); + } +} + +/* queue a packet or die */ void ctdb_queue_packet(struct ctdb_context *ctdb, struct ctdb_req_header *hdr) { struct ctdb_node *node; - if (hdr->destnode == CTDB_BROADCAST_VNN) { - ctdb_broadcast_packet(ctdb, hdr); + switch (hdr->destnode) { + case CTDB_BROADCAST_ALL: + ctdb_broadcast_packet_all(ctdb, hdr); + return; + case CTDB_BROADCAST_VNNMAP: + ctdb_broadcast_packet_vnnmap(ctdb, hdr); return; } diff --git a/ctdb/common/ctdb_control.c b/ctdb/common/ctdb_control.c index 2422ff945f..51f1ca2c07 100644 --- a/ctdb/common/ctdb_control.c +++ b/ctdb/common/ctdb_control.c @@ -533,7 +533,7 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode, struct ctdb_control_state *state; size_t len; - if (destnode == CTDB_BROADCAST_VNN && !(flags & CTDB_CTRL_FLAG_NOREPLY)) { + if (((destnode == CTDB_BROADCAST_VNNMAP) || (destnode == CTDB_BROADCAST_VNNMAP)) && !(flags & CTDB_CTRL_FLAG_NOREPLY)) { DEBUG(0,("Attempt to broadcast control without NOREPLY\n")); return -1; } diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index 312d1b98c3..1dd3433cf7 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -388,7 +388,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, } /* tell all the other nodes about this database */ - ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNN, 0, + ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, CTDB_CONTROL_DB_ATTACH, 0, CTDB_CTRL_FLAG_NOREPLY, indata, NULL, NULL); @@ -434,7 +434,7 @@ static void ctdb_ltdb_seqnum_check(struct event_context *ev, struct timed_event TDB_DATA data; data.dptr = (uint8_t *)&ctdb_db->db_id; data.dsize = sizeof(uint32_t); - ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNN, 0, + ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, CTDB_CONTROL_UPDATE_SEQNUM, 0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL); } diff --git a/ctdb/common/ctdb_traverse.c b/ctdb/common/ctdb_traverse.c index c71457d717..a1d5e6b1d8 100644 --- a/ctdb/common/ctdb_traverse.c +++ b/ctdb/common/ctdb_traverse.c @@ -263,7 +263,7 @@ struct ctdb_traverse_all_handle *ctdb_daemon_traverse_all(struct ctdb_db_context data.dsize = sizeof(r); /* tell all the nodes in the cluster to start sending records to this node */ - ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNN, 0, CTDB_CONTROL_TRAVERSE_ALL, + ret = ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0, CTDB_CONTROL_TRAVERSE_ALL, 0, CTDB_CTRL_FLAG_NOREPLY, data, NULL, NULL); if (ret != 0) { talloc_free(state); diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index 81cf60f1cf..6eb915e57f 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -33,8 +33,12 @@ #define CTDB_NULL_FUNC 0xFF000001 #define CTDB_FETCH_FUNC 0xFF000002 -#define CTDB_CURRENT_NODE 0xF0000001 -#define CTDB_BROADCAST_VNN 0xF0000002 +/* used on the domain socket, send a pdu to the local daemon */ +#define CTDB_CURRENT_NODE 0xF0000001 +/* 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_MAX_REDIRECT_COUNT 3 #define CTDB_DEFAULT_SEQNUM_FREQUENCY 1 diff --git a/ctdb/tools/ctdb_control.c b/ctdb/tools/ctdb_control.c index 3f5d369b68..813e920b9b 100644 --- a/ctdb/tools/ctdb_control.c +++ b/ctdb/tools/ctdb_control.c @@ -945,7 +945,7 @@ static int control_dumpmemory(struct ctdb_context *ctdb, int argc, const char ** usage(); } if (strcmp(argv[0], "all") == 0) { - vnn = CTDB_BROADCAST_VNN; + vnn = CTDB_BROADCAST_ALL; } else { vnn = strtoul(argv[0], NULL, 0); } |
