SQL persistence honors concurrency semantics in the following ways.
The persister uses unique key constraints that will result in an exception being thrown if two saga instances with the same correlation value are created at the same time.
To ensure correctness, when creating new sagas, the persister applies optimistic concurrency using an incrementing counter. The persister uses an explicit version column combined with the
ReadComitted isolation level.
However, to avoid excessive conflicts for highly congested sagas, starting in version 4.1 the persister uses pessimistic concurrency for querying and updating saga information. The pessimistic concurrency is implemented using a
SELECT . construct or its dialect-specific equivalent.