mirror of https://github.com/citusdata/citus.git
likely unnecessary hardening of COPY
parent
e06e9842c0
commit
73e1d81bb3
|
@ -323,6 +323,7 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
|||
uint64 processedRowCount = 0;
|
||||
|
||||
ErrorContextCallback errorCallback;
|
||||
volatile MemoryContext oldContext;
|
||||
|
||||
/* allocate column values and nulls arrays */
|
||||
distributedRelation = heap_open(tableId, RowExclusiveLock);
|
||||
|
@ -405,6 +406,9 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
|||
copiedDistributedRelationTuple->relkind = RELKIND_RELATION;
|
||||
}
|
||||
|
||||
PG_TRY();
|
||||
{
|
||||
|
||||
/* initialize copy state to read from COPY data source */
|
||||
#if (PG_VERSION_NUM >= 100000)
|
||||
copyState = BeginCopyFrom(NULL,
|
||||
|
@ -431,7 +435,6 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
|||
while (true)
|
||||
{
|
||||
bool nextRowFound = false;
|
||||
MemoryContext oldContext = NULL;
|
||||
|
||||
ResetPerTupleExprContext(executorState);
|
||||
|
||||
|
@ -455,6 +458,17 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
|||
|
||||
processedRowCount += 1;
|
||||
}
|
||||
}
|
||||
PG_CATCH();
|
||||
{
|
||||
if (oldContext != NULL)
|
||||
{
|
||||
MemoryContextSwitchTo(oldContext);
|
||||
}
|
||||
AtEOXact_Files();
|
||||
PG_RE_THROW();
|
||||
}
|
||||
PG_END_TRY();
|
||||
|
||||
EndCopyFrom(copyState);
|
||||
|
||||
|
|
Loading…
Reference in New Issue