mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
- don't try to send controls to dead nodes
- use only connected nodes in a traverse (This used to be ctdb commit 9a676dd5d331022d946a56c52c42fc6985b93dbc)
This commit is contained in:
parent
0b11bd99dd
commit
49fe66713f
@ -217,6 +217,21 @@ uint32_t ctdb_get_num_nodes(struct ctdb_context *ctdb)
|
||||
return ctdb->num_nodes;
|
||||
}
|
||||
|
||||
/*
|
||||
return the number of connected nodes
|
||||
*/
|
||||
uint32_t ctdb_get_num_connected_nodes(struct ctdb_context *ctdb)
|
||||
{
|
||||
int i;
|
||||
uint32_t count=0;
|
||||
for (i=0;i<ctdb->vnn_map->size;i++) {
|
||||
if (ctdb->nodes[i]->flags & NODE_FLAGS_CONNECTED) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
called by the transport layer when a packet comes in
|
||||
|
@ -395,6 +395,15 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (destnode != CTDB_BROADCAST_VNNMAP && destnode != CTDB_BROADCAST_VNNMAP &&
|
||||
(!ctdb_validate_vnn(ctdb, destnode) ||
|
||||
!(ctdb->nodes[destnode]->flags & NODE_FLAGS_CONNECTED))) {
|
||||
if (!(flags & CTDB_CTRL_FLAG_NOREPLY)) {
|
||||
callback(ctdb, -1, tdb_null, "ctdb_control to disconnected node", private_data);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* the state is made a child of private_data if possible. This means any reply
|
||||
will be discarded if the private_data goes away */
|
||||
state = talloc(private_data?private_data:ctdb, struct ctdb_control_state);
|
||||
|
@ -447,6 +447,8 @@ static int do_recovery(struct ctdb_context *ctdb,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
|
||||
DEBUG(0, (__location__ " Recovery complete\n"));
|
||||
return 0;
|
||||
@ -465,7 +467,6 @@ static int send_election_request(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx,
|
||||
uint64_t srvid;
|
||||
|
||||
srvid = CTDB_SRVTYPE_RECOVERY;
|
||||
srvid <<= 32;
|
||||
|
||||
emsg.vnn = vnn;
|
||||
|
||||
@ -857,7 +858,6 @@ int ctdb_start_recoverd(struct ctdb_context *ctdb)
|
||||
|
||||
/* register a message port for recovery elections */
|
||||
srvid = CTDB_SRVTYPE_RECOVERY;
|
||||
srvid <<= 32;
|
||||
ctdb_set_message_handler(ctdb, srvid, election_handler, NULL);
|
||||
|
||||
monitor_cluster(ctdb);
|
||||
|
@ -365,7 +365,7 @@ int32_t ctdb_control_traverse_data(struct ctdb_context *ctdb, TDB_DATA data, TDB
|
||||
|
||||
if (key.dsize == 0 && data.dsize == 0) {
|
||||
state->null_count++;
|
||||
if (state->null_count != ctdb_get_num_nodes(ctdb)) {
|
||||
if (state->null_count != ctdb_get_num_connected_nodes(ctdb)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -56,10 +56,16 @@ struct ctdb_call_info {
|
||||
a message handler ID meaning "give me all messages"
|
||||
*/
|
||||
#define CTDB_SRVID_ALL (~(uint64_t)0)
|
||||
|
||||
/*
|
||||
srvid type : RECOVERY
|
||||
*/
|
||||
#define CTDB_SRVTYPE_RECOVERY 0x64766372
|
||||
#define CTDB_SRVTYPE_RECOVERY 0xF100000000000000LL
|
||||
|
||||
/*
|
||||
a message handler ID meaning that the cluster has been reconfigured
|
||||
*/
|
||||
#define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
|
||||
|
||||
struct event_context;
|
||||
|
||||
|
@ -802,4 +802,6 @@ int32_t ctdb_control_thaw(struct ctdb_context *ctdb);
|
||||
|
||||
int ctdb_start_recoverd(struct ctdb_context *ctdb);
|
||||
|
||||
uint32_t ctdb_get_num_connected_nodes(struct ctdb_context *ctdb);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user