Skip to content

Commit

Permalink
Close backend connections for logical/phys replication on detach
Browse files Browse the repository at this point in the history
reshke committed Jan 31, 2024
1 parent 806aebd commit 31abc26
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions sources/router.c
Original file line number Diff line number Diff line change
@@ -695,8 +695,20 @@ void od_router_detach(od_router_t *router, od_client_t *client)
client->server = NULL;
server->client = NULL;
if (od_likely(!server->offline)) {
od_pg_server_pool_set(&route->server_pool, server,
OD_SERVER_IDLE);
od_instance_t *instance = server->global->instance;
if (route->id.physical_rep || route->id.logical_rep) {
od_debug(&instance->logger, "expire-replication", NULL, server,
"closing replication connection");
server->route = NULL;
od_backend_close_connection(server);
od_pg_server_pool_set(&route->server_pool, server,
OD_SERVER_UNDEF);
od_backend_close(server);
} else {

od_pg_server_pool_set(&route->server_pool, server,
OD_SERVER_IDLE);
}
} else {
od_instance_t *instance = server->global->instance;
od_debug(&instance->logger, "expire", NULL, server,

0 comments on commit 31abc26

Please sign in to comment.