mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
When we reload the nodes file
instead of shutting down/restarting the entire tcp layer just bounce all outgoing connections and reconnect (This used to be ctdb commit e701a531868149f16561011e65794a4a46ee6596)
This commit is contained in:
parent
bad2949b65
commit
1778280d50
@ -179,27 +179,18 @@ ctdb_reload_nodes_event(struct event_context *ev, struct timed_event *te,
|
||||
struct timeval t, void *private_data)
|
||||
{
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
|
||||
int ctdb_tcp_init(struct ctdb_context *);
|
||||
|
||||
/* shut down the transport */
|
||||
if (ctdb->methods != NULL) {
|
||||
ctdb->methods->shutdown(ctdb);
|
||||
}
|
||||
|
||||
/* start the transport again */
|
||||
ctdb_load_nodes_file(ctdb);
|
||||
ret = ctdb_tcp_init(ctdb);
|
||||
if (ret != 0) {
|
||||
DEBUG(DEBUG_CRIT, (__location__ " Failed to init TCP\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (ctdb->methods == NULL) {
|
||||
DEBUG(DEBUG_ALERT,(__location__ " Can not restart transport. ctdb->methods==NULL\n"));
|
||||
ctdb_fatal(ctdb, "can not reinitialize transport.");
|
||||
for (i=0; i<ctdb->num_nodes; i++) {
|
||||
if (ctdb->methods->add_node(ctdb->nodes[i]) != 0) {
|
||||
DEBUG(DEBUG_CRIT, (__location__ " methods->add_node failed at %d\n", i));
|
||||
ctdb_fatal(ctdb, "failed to add node. shutting down\n");
|
||||
}
|
||||
}
|
||||
ctdb->methods->initialise(ctdb);
|
||||
ctdb->methods->start(ctdb);
|
||||
|
||||
return;
|
||||
|
@ -31,16 +31,14 @@
|
||||
*/
|
||||
static int ctdb_tcp_add_node(struct ctdb_node *node)
|
||||
{
|
||||
struct ctdb_tcp *ctcp = talloc_get_type(node->ctdb->private_data,
|
||||
struct ctdb_tcp);
|
||||
struct ctdb_tcp_node *tnode;
|
||||
tnode = talloc_zero(ctcp, struct ctdb_tcp_node);
|
||||
tnode = talloc_zero(node, struct ctdb_tcp_node);
|
||||
CTDB_NO_MEMORY(node->ctdb, tnode);
|
||||
|
||||
tnode->fd = -1;
|
||||
node->private_data = tnode;
|
||||
|
||||
tnode->out_queue = ctdb_queue_setup(node->ctdb, ctcp, tnode->fd, CTDB_TCP_ALIGNMENT,
|
||||
tnode->out_queue = ctdb_queue_setup(node->ctdb, node, tnode->fd, CTDB_TCP_ALIGNMENT,
|
||||
ctdb_tcp_tnode_cb, node);
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user