* Workers synchronize transaction state at the beginning of each parallel
* operation, so we can't account for new XIDs at this point.
*/
- if (IsInParallelMode())
+ if (IsInParallelMode() || IsParallelWorker())
elog(ERROR, "cannot assign XIDs during a parallel operation");
/*
* parallel operation, so we can't account for new commands after that
* point.
*/
- if (IsInParallelMode())
+ if (IsInParallelMode() || IsParallelWorker())
elog(ERROR, "cannot start commands during a parallel operation");
currentCommandId += 1;
is_parallel_worker = (s->blockState == TBLOCK_PARALLEL_INPROGRESS);
+ /* Enforce parallel mode restrictions during parallel worker commit. */
+ if (is_parallel_worker)
+ EnterParallelMode();
+
ShowTransactionState("CommitTransaction");
/*
/* If we might have parallel workers, clean them up now. */
if (IsInParallelMode())
- {
AtEOXact_Parallel(true);
- s->parallelModeLevel = 0;
- }
/* Shut down the deferred-trigger manager */
AfterTriggerEndXact(true);
* commit processing
*/
s->state = TRANS_COMMIT;
+ s->parallelModeLevel = 0;
if (!is_parallel_worker)
{