From 523d73f6740073a4b4dddf687008add92aba59fb Mon Sep 17 00:00:00 2001 From: Silvan Date: Fri, 9 Aug 2024 11:24:28 +0200 Subject: [PATCH] fix(fields): use read commit isolation level in trigger (#8410) # Which Problems Are Solved If the processing time of serializable transactions in the fields handler take too long, the next iteration can fail. # How the Problems Are Solved Changed the isolation level of the current states query to Read Commited --- internal/eventstore/handler/v2/field_handler.go | 2 +- internal/eventstore/v3/field.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/eventstore/handler/v2/field_handler.go b/internal/eventstore/handler/v2/field_handler.go index 40e4496e42..8b71f32519 100644 --- a/internal/eventstore/handler/v2/field_handler.go +++ b/internal/eventstore/handler/v2/field_handler.go @@ -97,7 +97,7 @@ func (h *FieldHandler) processEvents(ctx context.Context, config *triggerConfig) defer cancel() } - tx, err := h.client.BeginTx(txCtx, nil) + tx, err := h.client.BeginTx(txCtx, &sql.TxOptions{Isolation: sql.LevelReadCommitted}) if err != nil { return false, err } diff --git a/internal/eventstore/v3/field.go b/internal/eventstore/v3/field.go index 1298e59e42..17037f8bcc 100644 --- a/internal/eventstore/v3/field.go +++ b/internal/eventstore/v3/field.go @@ -28,7 +28,7 @@ func (es *Eventstore) FillFields(ctx context.Context, events ...eventstore.FillF ctx, span := tracing.NewSpan(ctx) defer span.End() - tx, err := es.client.BeginTx(ctx, nil) + tx, err := es.client.BeginTx(ctx, &sql.TxOptions{Isolation: sql.LevelReadCommitted}) if err != nil { return err }