-
Notifications
You must be signed in to change notification settings - Fork 16
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
Mongo tracking token becomes too large during replay #9
Comments
The following is stated in the Javadoc of the
Thus, although I understand it increases the size of the If we could move the So, at this stage @martijnvanderwoud, I am uncertain how to resolve this for you, other than stating: why not change the If you have a solution how to omit the |
Hi Steven, thanks for your reply! Perhaps I did not describe the problem clearly enough: ALL events encountered during a replay are added to the I agree that we can not reasonably avoid having the
If my debugging observations are correct, it seems that The practical outcome is that replaying any non-trivial number of events is now impossible for tracking event processors consuming from the Mongo event store |
Looking further at
I suspect that this statement is problematic: Maybe this statement could be changed as follows? |
Thanks for further clarification on the matter @martijnvanderwoud; always very helpful is a contributor dives into the matter as well :-) Sounds like you are on to something here...have you by any chance tried this out with a local snapshot build of the Mongo Extension? If all seems well, I feel such a fix justifies a bug release ASAP; just so you know. |
@smcvb sorry for the late reply. For the particular project where I was facing this issue I decided to switch to a JPA-based event store I think an ASAP bug release might be a bit much, because the problem only occurs when the I stumbled upon this after migrating events from a hand-rolled CQRS solution into the Axon event store. The event processors were initialised with HEAD tokens because the read models were already populated. When I tested replaying one of these processors I ran into this issue. I could have worked around this by initialising that particular read model with a tail token instead of triggering a replay. |
ASAP might be putting it harsh, true, as the occurrences of the issue are likely. Still, it seems pretty breaking to me, hence my request whether you've resolved this with a local snapshot. However, as you've pointed out, you've decided against Mongo as the event storage solution. |
Yes you are correct, sorry. I was hesitant to go down the path of making this kind of change without having more insight in the workings of the various tracking token methods |
Is there any chance that this issue gets fixed? |
Fair question, @re-easy. As we don't intend to make any breaking changes between minor version (e.g., between 4.8.0 and 4.9.0), I am afraid we can't do a lot right now. However, one thing that made me think, is @martijnvanderwoud his response on May the 6th, 2020:
His argument is valid here. Typically, the To be able to deduce whether that's the case for you, @re-easy, could you share with us the version of Axon Framework and the Mongo Extension you're using? Finally, just to be clear, there might be something we can do right away to battle this recent change in Axon Framework. Lastly, I do want to remind you that we don't feel Mongo is the best storage solution for events. Regardless, keep us posted on the version you're using, @re-easy! |
@smcvb We are using Axon framework and the Mongo extension of version 4.9.0. At the moment we rebuild our projections (replay) by roughly deleting the tracking token entries for the event processor and then restart the service. I guess this method does not benefit from what you described about the Thanks for sharing! |
Another way is to set the default token to a normal tail token instead of a replying token. You do need to specify this for each event processor individually. |
@gklijs Thanks for this neat trick. I set the token of each segment of the event processor to the first domain event and restarted the service. The replay worked without any performance issues. Does it work the same way when I have multiple instances of the service running? |
@re-easy Sorry I missed your message. The initial token is only created once. So, that should also work with multiple instances. |
We've had an incident which I think is related to this. We introduced a new projection, and of course it would create a new tracking token and start replaying. However, our mongo cluster has one primary and a secondary instance running. But the tracking token became rather big, the oplog got filled with every update on the document and since its stored as a base64 all changes would be tracked over and over again. (So every new write to the trackingToken would result in a oplog entry tracking a 7mb document update) |
Thanks for sharing your scenario with us, @patrickdronk! |
During replay of an event processor, a
MongoTrackingToken
is wrapped inside aReplayToken
as thetokenAtReset
attribute. I presume that this is necessary to detect when the processor is back at the initial tracking position and the replay is thus finished. However, I see that all processed events during replay are appended to thetrackedEvents
collection of the wrapped token. Of course, this will cause the wrapped token to grow very quickly. For me, this eventually results in a failure when attempting to store the token: "Packet for query is too large (4.242.184 > 4.194.304). You can change this value on the server by setting the 'max_allowed_packet' variable." (JPA token store)The text was updated successfully, but these errors were encountered: