Skip to content

feat(sql): make append_events atomic and improve concurrency handling - #3

Merged
nmummau merged 1 commit into
feature/my-changefrom
fix/issue-429-transaction
Oct 8, 2025
Merged

feat(sql): make append_events atomic and improve concurrency handling#3
nmummau merged 1 commit into
feature/my-changefrom
fix/issue-429-transaction

Conversation

@nmummau

@nmummau nmummau commented Oct 8, 2025

Copy link
Copy Markdown
Owner
  • Wrapped append_events logic in a single transaction with SET XACT_ABORT ON
  • Changed @stream_name parameter to NVARCHAR(850) for consistency
  • Added guard clause for empty @messages
  • Introduced @Inserted table to capture inserted GlobalPosition values atomically
  • Updated Streams.[Version] within the same transaction
  • Normalized optimistic concurrency errors (2627, 2601) to client-detectable messages
  • Thrown error messages still StartsWith 'WrongExpectedVersion' but now also includes the full SQL error text for client tracing
  • Removed redundant post-commit queries and error-parsing logic

Fixes issue Eventuous#429

- Wrapped append_events logic in a single transaction with SET XACT_ABORT ON
- Changed @stream_name parameter to NVARCHAR(850) for consistency
- Added guard clause for empty @messages
- Introduced @Inserted table to capture inserted GlobalPosition values atomically
- Updated Streams.[Version] within the same transaction
- Normalized optimistic concurrency errors (2627, 2601) to client-detectable messages
- Thrown error messages still StartsWith 'WrongExpectedVersion' but now also includes the full SQL error text for client tracing
- Removed redundant post-commit queries and error-parsing logic

Fixes issue Eventuous#429
@nmummau
nmummau merged commit b62ae92 into feature/my-change Oct 8, 2025
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants