Use UpdateShardPlacementState where appropriate

pull/857/head
Marco Slot 2016-10-07 03:14:42 +02:00 committed by Andres Freund
parent 982ad66753
commit 33b7723530
3 changed files with 3 additions and 18 deletions

View File

@ -1026,13 +1026,8 @@ OpenCopyTransactions(CopyStmt *copyStatement, ShardConnections *shardConnections
foreach(failedPlacementCell, failedPlacementList) foreach(failedPlacementCell, failedPlacementList)
{ {
ShardPlacement *failedPlacement = (ShardPlacement *) lfirst(failedPlacementCell); ShardPlacement *failedPlacement = (ShardPlacement *) lfirst(failedPlacementCell);
uint64 shardLength = 0;
DeleteShardPlacementRow(failedPlacement->shardId, failedPlacement->nodeName, UpdateShardPlacementState(failedPlacement->placementId, FILE_INACTIVE);
failedPlacement->nodePort);
InsertShardPlacementRow(failedPlacement->shardId, failedPlacement->placementId,
FILE_INACTIVE, shardLength,
failedPlacement->nodeName, failedPlacement->nodePort);
} }
shardConnections->connectionList = connectionList; shardConnections->connectionList = connectionList;

View File

@ -605,14 +605,8 @@ ExecuteTaskAndStoreResults(QueryDesc *queryDesc, Task *task,
{ {
ShardPlacement *failedPlacement = ShardPlacement *failedPlacement =
(ShardPlacement *) lfirst(failedPlacementCell); (ShardPlacement *) lfirst(failedPlacementCell);
uint64 shardLength = 0;
DeleteShardPlacementRow(failedPlacement->shardId, failedPlacement->nodeName, UpdateShardPlacementState(failedPlacement->placementId, FILE_INACTIVE);
failedPlacement->nodePort);
InsertShardPlacementRow(failedPlacement->shardId,
failedPlacement->placementId,
FILE_INACTIVE, shardLength,
failedPlacement->nodeName, failedPlacement->nodePort);
} }
executorState->es_processed = affectedTupleCount; executorState->es_processed = affectedTupleCount;

View File

@ -295,12 +295,8 @@ master_append_table_to_shard(PG_FUNCTION_ARGS)
uint64 placementId = placement->placementId; uint64 placementId = placement->placementId;
char *workerName = placement->nodeName; char *workerName = placement->nodeName;
uint32 workerPort = placement->nodePort; uint32 workerPort = placement->nodePort;
uint64 oldShardLength = placement->shardLength;
DeleteShardPlacementRow(shardId, workerName, workerPort); UpdateShardPlacementState(placementId, FILE_INACTIVE);
InsertShardPlacementRow(shardId, placementId,
FILE_INACTIVE, oldShardLength,
workerName, workerPort);
ereport(WARNING, (errmsg("could not append table to shard \"%s\" on node " ereport(WARNING, (errmsg("could not append table to shard \"%s\" on node "
"\"%s:%u\"", shardQualifiedName, workerName, "\"%s:%u\"", shardQualifiedName, workerName,