From f3394b2283612ac6cdb62d6ab4055678081b6720 Mon Sep 17 00:00:00 2001 From: Onder Kalaci Date: Wed, 8 Apr 2020 18:11:42 +0200 Subject: [PATCH] Apply code review feedback --- src/backend/distributed/connection/connection_management.c | 3 +++ .../distributed/connection/shared_connection_stats.c | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/distributed/connection/connection_management.c b/src/backend/distributed/connection/connection_management.c index e5080d6d7..5f5767f26 100644 --- a/src/backend/distributed/connection/connection_management.c +++ b/src/backend/distributed/connection/connection_management.c @@ -328,6 +328,9 @@ StartNodeUserDatabaseConnection(uint32 flags, const char *hostname, int32 port, sizeof(MultiConnection)); dlist_push_tail(entry->connections, &connection->connectionNode); + /* these two flags are by nature cannot happen at the same time */ + Assert((flags & OPTIONAL_CONNECTION) && (flags & WAIT_FOR_CONNECTION)); + if (flags & WAIT_FOR_CONNECTION) { WaitLoopForSharedConnection(hostname, port); diff --git a/src/backend/distributed/connection/shared_connection_stats.c b/src/backend/distributed/connection/shared_connection_stats.c index 341d53020..6939e020f 100644 --- a/src/backend/distributed/connection/shared_connection_stats.c +++ b/src/backend/distributed/connection/shared_connection_stats.c @@ -288,9 +288,9 @@ WaitLoopForSharedConnection(const char *hostname, int port) * connection counter for the given nodeId and the current database in * SharedConnStatsHash. * - * The function first checks whether the number of connections is less than - * citus.max_shared_pool_size. If so, the function increments the counter - * by one and returns true. Else, the function returns false. + * If the function returns true, the caller is allowed (and expected) + * to establish a new connection to the given node. Else, the caller + * is not allowed to establish a new connection. */ bool TryToIncrementSharedConnectionCounter(const char *hostname, int port)