-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documents in journal and realtime collection have different _id #219
Comments
Hi @yahor-filipchyk - I've read and re-read this a few times. It seems like there's many different things going on - can you resummarize? Just trying to narrow this down to something actionable. I think we can start with:
|
Hi @scullxbones, Sorry for shoveling all this into one issue. I think I can identify 3 distinct issues here:
I've been writing this issue up with 3) in mind primarily because I think it's causing some problems (or can potentially). To elaborate on 3) a little bit, when an atom gets serialized to BSON, |
Ah ok yep I get it now, thanks for summarizing. Now I totally understand why the Bullet 2 will probably be a stretch, so i'd think 1 & 3 should take priority. I'm good with this ticket covering both. I'll pull bullet 2 into a separate ticket. |
* Generate IDs before sending to mongo, reuse serialized documents * Log error if realtime write fails * Clean up some deprecation warnings and other code warnings
Issue #219 - IDs should match between journal & realtime
Fixed by #222 ... will update with a release version |
Released with |
* Generate IDs before sending to mongo, reuse serialized documents * Log error if realtime write fails * Clean up some deprecation warnings and other code warnings
My understanding is that
_id
gets assigned to the document when aninsert
gets executed by the mongodb client. The fact that the write to realtime collection is happening asynchronously makes me think that it is possible that some ids may end up being out of order between the batches. Besides,_id
is used as an offset on the query side and wheneventsByTag
is used the saved offset (retrieved from the realtime collection) won't in fact exist in the journal which at least makes it weird as the ordering of ids may still make sense. I think setting_id
field explicitly when serializing events makes sense as id generation is happening on the client side anyway so we get the same uniqueness and sequencing guarantees but it ensures the same documents in the two collections have the same ids.Also wanted to point out how the write to the realtime collection is happening asynchronously with no error handling:
I think at least some error logging would be useful, but it could also be a good idea if the user of the library could choose if an error to write to realtime collection should be propagated. I think failing all realtime subscriptions can be useful. Then the stream can restart and pick up missed events from the journal and continue listening to realtime events
The text was updated successfully, but these errors were encountered: