diff --git a/Neos.ContentRepository.Core/Classes/Infrastructure/DbalCheckpointStorage.php b/Neos.ContentRepository.Core/Classes/Infrastructure/DbalCheckpointStorage.php index d9d00aaccf7..dac81690564 100644 --- a/Neos.ContentRepository.Core/Classes/Infrastructure/DbalCheckpointStorage.php +++ b/Neos.ContentRepository.Core/Classes/Infrastructure/DbalCheckpointStorage.php @@ -115,6 +115,10 @@ public function updateAndReleaseLock(SequenceNumber $sequenceNumber): void if (!$this->connection->isTransactionActive()) { throw new \RuntimeException(sprintf('Failed to update and commit checkpoint for subscriber "%s" because no transaction is active', $this->subscriberId), 1652279314); } + if ($this->connection->isRollbackOnly()) { + // TODO as described in https://github.com/neos/neos-development-collection/issues/4970 we are in a bad state and cannot commit after a nested transaction was rolled back. + throw new \RuntimeException(sprintf('Failed to update and commit checkpoint for subscriber "%s" because the transaction has been marked for rollback only. See https://github.com/neos/neos-development-collection/issues/4970', $this->subscriberId), 1711964313); + } try { if (!$this->lockedSequenceNumber->equals($sequenceNumber)) { $this->connection->update($this->tableName, ['appliedsequencenumber' => $sequenceNumber->value], ['subscriberid' => $this->subscriberId]); diff --git a/Neos.ContentRepository.Core/Classes/Projection/CatchUp.php b/Neos.ContentRepository.Core/Classes/Projection/CatchUp.php index 962c8a1a46e..d3be3427a55 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/CatchUp.php +++ b/Neos.ContentRepository.Core/Classes/Projection/CatchUp.php @@ -121,11 +121,9 @@ public function run(EventStreamInterface $eventStream): SequenceNumber if ($this->onBeforeBatchCompletedHook) { ($this->onBeforeBatchCompletedHook)(); } - } catch (\Throwable $e) { + } finally { $this->checkpointStorage->updateAndReleaseLock($highestAppliedSequenceNumber); - throw $e; } - $this->checkpointStorage->updateAndReleaseLock($highestAppliedSequenceNumber); } return $highestAppliedSequenceNumber; }