mirror of https://github.com/citusdata/citus.git
Hack to fix another crash in intermediate results
parent
c271c2350e
commit
99191cd8e4
|
@ -165,6 +165,8 @@ ReadFileIntoTupleStore(char *fileName, char *copyFormat, TupleDesc tupleDescript
|
||||||
#endif
|
#endif
|
||||||
copyOptions = lappend(copyOptions, copyOption);
|
copyOptions = lappend(copyOptions, copyOption);
|
||||||
|
|
||||||
|
PG_TRY();
|
||||||
|
{
|
||||||
#if (PG_VERSION_NUM >= 100000)
|
#if (PG_VERSION_NUM >= 100000)
|
||||||
copyState = BeginCopyFrom(NULL, stubRelation, fileName, false, NULL,
|
copyState = BeginCopyFrom(NULL, stubRelation, fileName, false, NULL,
|
||||||
NULL, copyOptions);
|
NULL, copyOptions);
|
||||||
|
@ -173,8 +175,6 @@ ReadFileIntoTupleStore(char *fileName, char *copyFormat, TupleDesc tupleDescript
|
||||||
copyOptions);
|
copyOptions);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PG_TRY();
|
|
||||||
{
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
bool nextRowFound = false;
|
bool nextRowFound = false;
|
||||||
|
@ -196,17 +196,21 @@ ReadFileIntoTupleStore(char *fileName, char *copyFormat, TupleDesc tupleDescript
|
||||||
}
|
}
|
||||||
PG_CATCH();
|
PG_CATCH();
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* This is only necessary on windows, in the abort handler we might try to remove
|
|
||||||
* the file being COPY'd (if it was an intermediate result), but on Windows that's
|
|
||||||
* not possible unless we first close our handle to the file.
|
|
||||||
*/
|
|
||||||
if (oldContext != NULL)
|
if (oldContext != NULL)
|
||||||
{
|
{
|
||||||
MemoryContextSwitchTo(oldContext);
|
MemoryContextSwitchTo(oldContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndCopyFrom(copyState);
|
/*
|
||||||
|
* This is only necessary on windows, in the abort handler we might try to remove
|
||||||
|
* the file being COPY'd (if it was an intermediate result), but on Windows that's
|
||||||
|
* not possible unless we first close our handle to the file.
|
||||||
|
*
|
||||||
|
* This was already going to be called during abort, but it was going to be called
|
||||||
|
* after we try to delete the file, we need it to be called before.
|
||||||
|
*/
|
||||||
|
AtEOXact_Files();
|
||||||
|
|
||||||
PG_RE_THROW();
|
PG_RE_THROW();
|
||||||
}
|
}
|
||||||
PG_END_TRY();
|
PG_END_TRY();
|
||||||
|
|
Loading…
Reference in New Issue