Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: Throw explicit transaction has been marked for rollback only exception #4971

Merged
merged 3 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
4 changes: 1 addition & 3 deletions Neos.ContentRepository.Core/Classes/Projection/CatchUp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down