diff --git a/src/backend/distributed/executor/intermediate_results.c b/src/backend/distributed/executor/intermediate_results.c index bb5d02ba1..ca213e01e 100644 --- a/src/backend/distributed/executor/intermediate_results.c +++ b/src/backend/distributed/executor/intermediate_results.c @@ -688,7 +688,7 @@ RemoveIntermediateResultsDirectory(void) { if (CreatedResultsDirectory) { - CitusRemoveDirectory(IntermediateResultsDirectory()); + PathNameDeleteTemporaryDir(IntermediateResultsDirectory()); CreatedResultsDirectory = false; } diff --git a/src/backend/distributed/transaction/transaction_management.c b/src/backend/distributed/transaction/transaction_management.c index 418ecfce2..67fa8f30d 100644 --- a/src/backend/distributed/transaction/transaction_management.c +++ b/src/backend/distributed/transaction/transaction_management.c @@ -112,7 +112,6 @@ static void ResetShardPlacementTransactionState(void); static void AdjustMaxPreparedTransactions(void); static void PushSubXact(SubTransactionId subId); static void PopSubXact(SubTransactionId subId); -static void SwallowErrors(void (*func)()); static bool MaybeExecutingUDF(void); static void ResetGlobalVariables(void); @@ -297,7 +296,7 @@ CoordinatedTransactionCallback(XactEvent event, void *arg) * RemoveIntermediateResultsDirectory. */ AtEOXact_Files(false); - SwallowErrors(RemoveIntermediateResultsDirectory); + RemoveIntermediateResultsDirectory(); } ResetShardPlacementTransactionState(); @@ -669,51 +668,6 @@ ActiveSubXactContexts(void) } -/* - * If an ERROR is thrown while processing a transaction the ABORT handler is called. - * ERRORS thrown during ABORT are not treated any differently, the ABORT handler is also - * called during processing of those. If an ERROR was raised the first time through it's - * unlikely that the second try will succeed; more likely that an ERROR will be thrown - * again. This loop continues until Postgres notices and PANICs, complaining about a stack - * overflow. - * - * Instead of looping and crashing, SwallowErrors lets us attempt to continue running the - * ABORT logic. This wouldn't be safe in most other parts of the codebase, in - * approximately none of the places where we emit ERROR do we first clean up after - * ourselves! It's fine inside the ABORT handler though; Postgres is going to clean - * everything up before control passes back to us. - */ -static void -SwallowErrors(void (*func)()) -{ - MemoryContext savedContext = CurrentMemoryContext; - - PG_TRY(); - { - func(); - } - PG_CATCH(); - { - ErrorData *edata = CopyErrorData(); - - /* don't try to intercept PANIC or FATAL, let those breeze past us */ - if (edata->elevel != ERROR) - { - PG_RE_THROW(); - } - - /* turn the ERROR into a WARNING and emit it */ - edata->elevel = WARNING; - ThrowErrorData(edata); - - /* leave the error handling system */ - FlushErrorState(); - MemoryContextSwitchTo(savedContext); - } - PG_END_TRY(); -} - - /* * IsMultiStatementTransaction determines whether the current statement is * part of a bigger multi-statement transaction. This is the case when the