Auto create connections when add backends

This commit is contained in:
wangbin579 2018-06-01 16:27:43 +08:00
parent cac785e2e7
commit 89f721bdf7
2 changed files with 9 additions and 0 deletions

View File

@ -237,6 +237,7 @@ network_backends_add(network_backends_t *bs, const gchar *address,
}
set_backend_config(new_backend, srv);
network_connection_pool_create_conns(srv);
network_backends_into_group(bs, new_backend);
g_message("added %s backend: %s, state: %s", backend_type_t_str[type], address, backend_state_t_str[state]);

View File

@ -4835,6 +4835,14 @@ network_connection_pool_create_conns(chassis *srv)
for (i = 0; i < network_backends_count(g->backends); i++) {
network_backend_t *backend = network_backends_get(g->backends, i);
if (backend != NULL) {
if (backend->state != BACKEND_STATE_UP && backend->state != BACKEND_STATE_UNKNOWN) {
continue;
}
int total = backend->pool->cur_idle_connections + backend->connected_clients;
if (total > 0) {
continue;
}
for (j = 0; j < backend->config->mid_conn_pool; j++) {
server_connection_state_t *scs = network_mysqld_self_con_init(srv);
if (srv->disable_dns_cache)