diff options
author | Tomas Vondra | 2017-11-07 17:34:55 +0000 |
---|---|---|
committer | Tomas Vondra | 2017-11-07 17:34:55 +0000 |
commit | 3d19f5b035714899820e4cfffca3944bfadc20af (patch) | |
tree | fab27fbc7297c4283194597d198f9aebe78f8877 | |
parent | a59901be0f488c2071aea53e3f6d3f2eb9a86f03 (diff) |
Fix bug in release_connection() introduced by d9f45c9018
d9f45c9018ec3ec1fc11e4be2be7f9728a1799b1 attempted to refactor
release_connection() to make it more readable, but unfortunately
inverted the force_destroy check, causing regression failures.
In hindsight, the refactoring was rather arbitrary and not really
helping with the readability, so just revert to the original code
(but keep the comments, explaining what's happening).
-rw-r--r-- | src/backend/pgxc/pool/poolmgr.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/backend/pgxc/pool/poolmgr.c b/src/backend/pgxc/pool/poolmgr.c index 768ed80d7e..6aa2922813 100644 --- a/src/backend/pgxc/pool/poolmgr.c +++ b/src/backend/pgxc/pool/poolmgr.c @@ -2935,33 +2935,30 @@ release_connection(DatabasePool *dbPool, PGXCNodePoolSlot *slot, return; } - /* - * The node pool exists, but we've been asked to forcefully close - * the connection, so do as asked. - */ + /* return or discard */ if (!force_destroy) { - elog(DEBUG1, "Cleaning up connection from pool %s (node %d), closing", - nodePool->connstr, node); - + /* + * Everything peachy, so just insert the connection (slot) into the + * array and increase the number of free connections in the pool. + * Also note the timestamp when the connection was released. + */ + nodePool->slot[(nodePool->freeSize)++] = slot; + slot->released = time(NULL); + } + else + { + /* + * The node pool exists, but we've been asked to forcefully close + * the connection, so do as asked. + */ + elog(DEBUG1, "Cleaning up connection from pool %s, closing", nodePool->connstr); destroy_slot(slot); - /* Decrement pool size */ (nodePool->size)--; - /* Ensure we are not below minimum size */ grow_pool(dbPool, node); - - return; } - - /* - * Everything peachy, so just insert the connection (slot) into the - * array and increase the number of free connections in the pool. - * Also note the timestamp when the connection was released. - */ - nodePool->slot[(nodePool->freeSize)++] = slot; - slot->released = time(NULL); } |