Events with same timestamp being projected/exported in wrong order #1948
Labels
bug
Issues related to defects and incorrect/unexpected feature behavior
severity: moderate
Issues with medium impact on the product, e.g., new features, non-critical defects, etc.
Hi I have a case where I'm importing a bunch of events with the same timestamps, many also acting on the same aggregateId.
This works fine when importing, and looking at the threadCounter they're also saved correctly, but when I do an export or reset my read model they're in the wrong order. Maybe there's some weird sorting error?
Any way to force an order when events have the same timestamp?
Edit:
I'm using the sqlite adapter for development and after some reading through code I found that get-latest-event of mysql has a secondary sort for
aggregateVersion
which is missing in the sqlite version could it be that other sql queries are also missing this?More info, I'm calling
eventStore.incrementalImport
with an array of events, many which have the same timestamp. The original order they're saved to the DB seems to be fine when I look at it with a client, but whenever the events are read from the database (eg for projection or export) they go out of order.Also for some reason the last event has a lower
threadCounter
value than the other events, which could explain the weird sorting?Edit edit 😅 :
Just found that
load-events-by-timestamp
does sort by threadCounterORDER BY "timestamp" ASC, "threadCounter" ASC, "threadId" ASC
also realized that in my database the threadCounter counts down instead of up, with some numbers missing here and there. Is this expected or could it be fixed somehow?
Correct:
How it's being projected/exported:
The text was updated successfully, but these errors were encountered: