Apply code review feedback

preventConflictingFlags
Onder Kalaci 2020-04-08 18:11:42 +02:00
parent af587edea1
commit f3394b2283
2 changed files with 6 additions and 3 deletions

View File

@ -328,6 +328,9 @@ StartNodeUserDatabaseConnection(uint32 flags, const char *hostname, int32 port,
sizeof(MultiConnection)); sizeof(MultiConnection));
dlist_push_tail(entry->connections, &connection->connectionNode); 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) if (flags & WAIT_FOR_CONNECTION)
{ {
WaitLoopForSharedConnection(hostname, port); WaitLoopForSharedConnection(hostname, port);

View File

@ -288,9 +288,9 @@ WaitLoopForSharedConnection(const char *hostname, int port)
* connection counter for the given nodeId and the current database in * connection counter for the given nodeId and the current database in
* SharedConnStatsHash. * SharedConnStatsHash.
* *
* The function first checks whether the number of connections is less than * If the function returns true, the caller is allowed (and expected)
* citus.max_shared_pool_size. If so, the function increments the counter * to establish a new connection to the given node. Else, the caller
* by one and returns true. Else, the function returns false. * is not allowed to establish a new connection.
*/ */
bool bool
TryToIncrementSharedConnectionCounter(const char *hostname, int port) TryToIncrementSharedConnectionCounter(const char *hostname, int port)