"Trying to insert an Event for an aggregate with a sequence number that is already present in the Event Store".

476 views
Skip to first unread message

Joseph Sintim-Amoah

unread,
Feb 27, 2015, 11:08:36 AM2/27/15
to axonfr...@googlegroups.com
We are beginning to see to these errors in our logs:

     "Trying to insert an Event for an aggregate with a sequence
number that is already present in the Event Store".

@Allard
             If Allard or anyone else have come across these error before, let me know what did you do to resolve it. Anyone?
             Thanks.
    

Allard Buijze

unread,
Mar 2, 2015, 3:18:36 AM3/2/15
to Axon Framework Users
Hi Joseph,

this is quite common of you have a multi-node setup, where commands are divided between the nodes randomly (or at least inconsistently). I have also seen this error pop up in cases where only a single node runs the application. It had to do with the database's transaction isolation settings. Setting it to read-committed (or read-uncomitted, if you prefer) resolved that issue.

Some background:
Axon uses locking. Imagine Thread 1 and Thread 2 sending a command that routes to the same aggregate instance. The command bus starts a transaction for both (usually this means a connection is also acquired). Thread 1 loads the aggregate, while Thread 2 blocks at the lock. Thread 1 finishes processing and publishes the results. Thread 2 is released and loads the aggregate. Because the transaction was started before Thread 1 committed, it is possible that the database doesn't show Thread 1's results because of the isolation level.

If you use Spring, I also recommend using the LazyConnectionDataSourceProxy, as it will postpone getting the actual connection until it's really used.

Cheers,

Allard

--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Joseph Sintim-Amoah

unread,
Mar 2, 2015, 12:41:31 PM3/2/15
to axonfr...@googlegroups.com
Thanks Allard. My team and I try the pointers provided.
Have a great day,

Joseph

--
You received this message because you are subscribed to a topic in the Google Groups "Axon Framework Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/axonframework/4g6YX2czjpk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to axonframewor...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Joseph Sintim-Amoah
Senior Software Engineer, Consumer Platforms
One LifeWay Plaza
Nashville, TN 37234


Reply all
Reply to author
Forward
0 new messages