From bb6accc60dfcc1ea1a7bb8a408bfcd4c384dea07 Mon Sep 17 00:00:00 2001 From: Livio Spring Date: Mon, 15 Sep 2025 18:32:28 +0200 Subject: [PATCH] fix(projections): handle reduce error by updating failed events (#10726) # Which Problems Are Solved I noticed that a failure in the projections handlers `reduce` function (e.g. creating the statement or checking preconditions for the statement) would not update the `failed_events2` table. This was due to a wrong error handling, where as long as the `maxFailureCount` was not reached, the error was returned after updating the `failed_events2` table, which causes the transaction to be rolled back and thus losing the update. # How the Problems Are Solved Wrap the error into an `executionError`, so the transaction is not rolled back. # Additional Changes none # Additional Context - noticed internally - requires backport to v3.x and v4.x (cherry picked from commit ee92560f32173ad0e8064027ce5727464c28b759) --- internal/eventstore/handler/v2/statement.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/eventstore/handler/v2/statement.go b/internal/eventstore/handler/v2/statement.go index e5841602872..6f29a79f2e9 100644 --- a/internal/eventstore/handler/v2/statement.go +++ b/internal/eventstore/handler/v2/statement.go @@ -51,7 +51,7 @@ func (h *Handler) eventsToStatements(tx *sql.Tx, events []eventstore.Event, curr if shouldContinue := h.handleFailedStmt(tx, failureFromEvent(event, err)); shouldContinue { continue } - return statements, err + return statements, &executionError{err} } offset++ if !previousPosition.Equal(event.Position()) {