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;
|
uint64 processedRowCount = 0;
|
||||||
|
|
||||||
ErrorContextCallback errorCallback;
|
ErrorContextCallback errorCallback;
|
||||||
|
volatile MemoryContext oldContext;
|
||||||
|
|
||||||
/* allocate column values and nulls arrays */
|
/* allocate column values and nulls arrays */
|
||||||
distributedRelation = heap_open(tableId, RowExclusiveLock);
|
distributedRelation = heap_open(tableId, RowExclusiveLock);
|
||||||
|
@ -405,6 +406,9 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
||||||
copiedDistributedRelationTuple->relkind = RELKIND_RELATION;
|
copiedDistributedRelationTuple->relkind = RELKIND_RELATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PG_TRY();
|
||||||
|
{
|
||||||
|
|
||||||
/* initialize copy state to read from COPY data source */
|
/* initialize copy state to read from COPY data source */
|
||||||
#if (PG_VERSION_NUM >= 100000)
|
#if (PG_VERSION_NUM >= 100000)
|
||||||
copyState = BeginCopyFrom(NULL,
|
copyState = BeginCopyFrom(NULL,
|
||||||
|
@ -431,7 +435,6 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
bool nextRowFound = false;
|
bool nextRowFound = false;
|
||||||
MemoryContext oldContext = NULL;
|
|
||||||
|
|
||||||
ResetPerTupleExprContext(executorState);
|
ResetPerTupleExprContext(executorState);
|
||||||
|
|
||||||
|
@ -455,6 +458,17 @@ CopyToExistingShards(CopyStmt *copyStatement, char *completionTag)
|
||||||
|
|
||||||
processedRowCount += 1;
|
processedRowCount += 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
PG_CATCH();
|
||||||
|
{
|
||||||
|
if (oldContext != NULL)
|
||||||
|
{
|
||||||
|
MemoryContextSwitchTo(oldContext);
|
||||||
|
}
|
||||||
|
AtEOXact_Files();
|
||||||
|
PG_RE_THROW();
|
||||||
|
}
|
||||||
|
PG_END_TRY();
|
||||||
|
|
||||||
EndCopyFrom(copyState);
|
EndCopyFrom(copyState);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue