Closed lesscodetxm closed 5 years ago
Hi @lesscodetxm, could you provide example so I could reproduce this issue? The example should have same order of persistence operation but actual event types and data it holds are not necessary. It just need to fail with same error.
BTW, akka persistence sequence number has always higher number than eventstore event number by 1, tho original sequence number is kept in event metadata.
I will try to reproduce it in a sample project when I get a chance. I just saw the error again while testing our service -- it seems to happen infrequently and usually after startup when the actors have recovered and start processing new commands. It doesn't seem to be affecting our app, however -- all events seem to be stored correctly as expected. Is this "rejection" an internal message, or is there some kind of built-in retry mechanism after we see this message?
Can you describe what the "expected version" mechanism is about, or point me to some documentation?
Maybe yor supervisor starts two actors for same aggregate. It is just a hunch. Eventstore expects frop app to say hat version it expects to write forward on. This is to ensure there is no two ore more concurrent writes from app to same event stream. More about append to stream can be found here
After analyzing recent changes to our code it turns out we introduced a subtle bug that causes two instances of the same actor to get created. After fixing that we no longer see the error. Thanks for your help. Closing.
I just switched persistence from MongoDB to EventStore, and I'm seeing occasional failures to persist of the form:
2019-06-12 14:56:23.094 -05:00 [ERR] Rejected to persist event type [...] with sequence number [5] for persistenceId [...] due to [Append failed due to WrongExpectedVersion. Stream: ..., Expected version: 3, Current version: 4]. EventStore.ClientAPI.Exceptions.WrongExpectedVersionException: Append failed due to WrongExpectedVersion. Stream: ..., Expected version: 3, Current version: 4 at Akka.Persistence.EventStore.Journal.EventStoreJournal.WriteMessagesAsync(IEnumerable``1 atomicWrites)
How do I further diagnose what might be causing this?