Merge pull request #1116 from citusdata/fix_reference_copy

Copy on reference tables should never mark placements invalid
pull/1074/head
Önder Kalacı 2017-01-12 02:55:16 +02:00 committed by GitHub
commit eeee0a7898
1 changed files with 12 additions and 3 deletions

View File

@ -563,8 +563,15 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
&shardConnectionsFound);
if (!shardConnectionsFound)
{
bool stopOnFailure = false;
if (cacheEntry->partitionMethod == DISTRIBUTE_BY_NONE)
{
stopOnFailure = true;
}
/* open connections and initiate COPY on shard placements */
OpenCopyTransactions(copyStatement, shardConnections, false,
OpenCopyTransactions(copyStatement, shardConnections, stopOnFailure,
copyOutState->binary);
/* send copy binary headers to shard placements */
@ -598,7 +605,8 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
/* close the COPY input on all shard placements */
EndRemoteCopy(connectionList, true);
if (MultiShardCommitProtocol == COMMIT_PROTOCOL_2PC)
if (MultiShardCommitProtocol == COMMIT_PROTOCOL_2PC ||
cacheEntry->replicationModel == REPLICATION_MODEL_2PC)
{
PrepareRemoteTransactions(connectionList);
}
@ -1051,7 +1059,8 @@ OpenCopyTransactions(CopyStmt *copyStatement, ShardConnections *shardConnections
/*
* If stopOnFailure is true, we just error out and code execution should
* never reach to this point. This is the case for copy from worker nodes.
* never reach to this point. This is the case for reference tables and
* copy from worker nodes.
*/
Assert(!stopOnFailure || list_length(failedPlacementList) == 0);