You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SQLAlchemy optimistic locking is not scoped to the current tenant #117
The SQLAlchemy optimistic-lock update filters by stream ID and version, but not by tenant ID.
Two tenants can own streams with the same StreamId and the same current version. An append with expected_version from one tenant then updates both stream rows. Since two rows are affected, the backend raises ConcurrentStreamWriteError, but it has already advanced the version of the other tenant’s stream.
Reproduction
Create the same StreamId for tenants first and second.
Append one versioned event to each tenant’s stream. Both are now at version 1.
Append an event to tenant first with expected_version=1.
Observe:
the call raises ConcurrentStreamWriteError because the update affects two rows;
tenant second’s stream version was changed despite not being written to.
This reproduces in both SQLAlchemyBackend and AsyncSQLAlchemyBackend.
Activity