Describe the bug
We have multiple endpoints that do things like that:
- efcore entity gets removed/updated/created and it also creates an event that it holds on to but doesn't publish yet.
dbContext.SaveChanbgesAsync is called
- EfCore interceptor
SavingChangesAsync collects the created event and calls dbContextOutbox.PublishAsync
- EfCore interceptor
SavedChangesAsync calls dbContextOutbox.FlushOutgoingMessagesAsync
Since everything is contained in a single SaveChangesAsync call, we don't put a transaction around it.
With wolverine 5.1 this worked.
With wolverine 5.2+ the endpoints return success and we don't get exceptions, but the DB operation didn't persist.
This happens on both SQL Server and PostgreSQL.
Expected behavior
The DB operations should persist like they did with wolverine 5.1
Additional context
Executed SQL Queries with wolverine 5.1 and PostgreSQL:
DELETE FROM apikey."ApiKey"
WHERE "Id" = @p0;
INSERT INTO wolverine.wolverine_outgoing_envelopes (id, body, deliver_by, destination, message_type, owner_id)
VALUES (@p1, @p2, @p3, @p4, @p5, @p6)
RETURNING attempts;
delete from wolverine.wolverine_outgoing_envelopes where id = @id
Executed SQL queries with wolverine 5.2+ and PostgreSQL:
SAVEPOINT "__EFSavePoint";
DELETE FROM apikey."ApiKey"
WHERE "Id" = @p0;
INSERT INTO wolverine.wolverine_outgoing_envelopes (id, body, deliver_by, destination, message_type, owner_id)
VALUES (@p1, @p2, @p3, @p4, @p5, @p6)
RETURNING attempts;
RELEASE SAVEPOINT "__EFSavePoint";
delete from wolverine.wolverine_outgoing_envelopes where id = @id
I think this PR might be the one that introduced this regression: #1831
And I guess the problem is, that wolverine executes SAVEPOINT without there being a transaction around it.
Describe the bug
We have multiple endpoints that do things like that:
dbContext.SaveChanbgesAsyncis calledSavingChangesAsynccollects the created event and callsdbContextOutbox.PublishAsyncSavedChangesAsynccallsdbContextOutbox.FlushOutgoingMessagesAsyncSince everything is contained in a single
SaveChangesAsynccall, we don't put a transaction around it.With wolverine 5.1 this worked.
With wolverine 5.2+ the endpoints return success and we don't get exceptions, but the DB operation didn't persist.
This happens on both SQL Server and PostgreSQL.
Expected behavior
The DB operations should persist like they did with wolverine 5.1
Additional context
Executed SQL Queries with wolverine 5.1 and PostgreSQL:
Executed SQL queries with wolverine 5.2+ and PostgreSQL:
I think this PR might be the one that introduced this regression: #1831
And I guess the problem is, that wolverine executes SAVEPOINT without there being a transaction around it.