Commit dfac798
committed
docs(api2): interleaved SQLite commits may violate single-round-trip consistency
As previously discussed with @legoktm: v2 Journalist API event-handlers
reuse utility functions that are are inconsistent in when they
session.commit() and/or session.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.1 parent abee0e6 commit dfac798
1 file changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | | - | |
237 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
238 | 248 | | |
239 | 249 | | |
240 | 250 | | |
| |||
0 commit comments