From b1626887d5eabbc7ac31a5503c752e3f6f5579f6 Mon Sep 17 00:00:00 2001 From: Marco Slot Date: Tue, 24 Jan 2017 12:48:52 +0100 Subject: [PATCH] Don't mark placements inactive in COPY after successful connection --- src/backend/distributed/commands/multi_copy.c | 15 +++------------ .../regress/expected/multi_modifying_xacts.out | 4 ++-- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/backend/distributed/commands/multi_copy.c b/src/backend/distributed/commands/multi_copy.c index c2419ba6b..48de9ee86 100644 --- a/src/backend/distributed/commands/multi_copy.c +++ b/src/backend/distributed/commands/multi_copy.c @@ -888,14 +888,11 @@ OpenCopyConnections(CopyStmt *copyStatement, ShardConnections *shardConnections, } /* - * If errors are supposed to cause immediate aborts (i.e. we don't + * Errors are supposed to cause immediate aborts (i.e. we don't * want to/can't invalidate placements), mark the connection as * critical so later errors cause failures. */ - if (stopOnFailure) - { - MarkRemoteTransactionCritical(connection); - } + MarkRemoteTransactionCritical(connection); ClaimConnectionExclusively(connection); RemoteTransactionBeginIfNecessary(connection); copyCommand = ConstructCopyStatement(copyStatement, shardConnections->shardId, @@ -904,13 +901,7 @@ OpenCopyConnections(CopyStmt *copyStatement, ShardConnections *shardConnections, if (PQresultStatus(result) != PGRES_COPY_IN) { - ReportConnectionError(connection, WARNING); - MarkRemoteTransactionFailed(connection, true); - - PQclear(result); - - failedPlacementCount++; - continue; + ReportResultError(connection, result, ERROR); } PQclear(result); diff --git a/src/test/regress/expected/multi_modifying_xacts.out b/src/test/regress/expected/multi_modifying_xacts.out index 03c443049..d421c0a5e 100644 --- a/src/test/regress/expected/multi_modifying_xacts.out +++ b/src/test/regress/expected/multi_modifying_xacts.out @@ -337,9 +337,9 @@ DELETE FROM researchers WHERE lab_id = 6; \copy researchers FROM STDIN delimiter ',' COMMIT; WARNING: illegal value -WARNING: failed to commit transaction on localhost:57638 +WARNING: failed to commit critical transaction on localhost:57638, metadata is likely out of sync WARNING: illegal value -WARNING: failed to commit transaction on localhost:57637 +WARNING: failed to commit critical transaction on localhost:57637, metadata is likely out of sync WARNING: could not commit transaction for shard 1200001 on any active node ERROR: could not commit transaction on any active node \unset VERBOSITY