docs(api2): interleaved SQLite commits may violate single-round-trip consistency
#7734
+12
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As previously discussed with @legoktm: v2 Journalist API event-handlers reuse utility functions that are are inconsistent in when they
session.commit()and/orsession.refresh(). The event-handlers themselves inherit these inconsistent transaction boundaries.On the one hand, this is too bad. We'd like event-handlers to be (approximately) pure functions on the received event data and the current server state, but in practice they're as fuzzy as our transaction isolation. We could eliminate these intra-event races by constructing a session for each event-handler invocation, returning only values read within that session, and committing its changes explicitly.
On the other hand, I don't actually think this is worth fixing. Either way—with or without strict per-event isolation—a server that receives events from multiple clients close enough together will wind up signalling those clients to sync again in order to catch up to one another's writes. Eventual convergence is good enough in both cases, so let's just document explicitly that this is an expected exception to single-round-trip consistency.