Hi,
With the 4.1.1 mongo extension, split/merge works from the AxonDashboard UI
Well, scratch that, merge still doesn’t work, as it seems.
Test case is simple (everything is 4.1.1: axon, axonserver, axon mongo extension):
I start up a query service, 1 processor, 4 threads/segments.
I want another node of this, so I call split on AxonDashboard on the processor, 4 times to acquire another 4 segments for the new node,
call it one by one, it succeeds. I start up the new node, it claims the 4 new segments, looks fine,
2 nodes with 2 processors, 4 threads/segments each. Then I want to scale down, before shutting down one
of the instances I need to call merge on AxonDashboard, 4 times. However, it does not always succeed.
Sometimes it does, sometimes I get:
Processing merge instruction for segments [3] and [7] in processor [TestProjection]
Failed to merge segment [3] for processor [TestProjection]
Caused by: org.axonframework.eventhandling.tokenstore.UnableToClaimTokenException: Unable to claim token ‘TestProjection[7]’. It has not been initialized yet
at org.axonframework.extensions.mongo.eventsourcing.tokenstore.MongoTokenStore.loadToken(MongoTokenStore.java:182)
Same when calling the REST API, merge fails with this one, very often. But sometimes it succeeds … ?
Another thing, I want to automate this, like make it work with Kubernetes autoscaling, so I need to call the axonserver REST API
(probably from the PostStart/PreStop hooks) before starting/shutting down another node.
It means, for each processor (or at least for those ones that are eligible for scaling up, maybe not all processors of a certain query
service needs scaling, but that is beside the point), I want another n segments for a new node, where n is the thread count of
the tracking processor. It means I need to make a lot of http calls … it would be nice to somehow batch it, and make only one call,
or at least make one call per processor, and have the ability to tell how many new segments I want, or event better, somehow set that
the number of new segments should match the thread count of the processor.
Also what I noticed, this won’t even work with a naive approach, e.g. calling it from a simple loop, because I get this:
o.a.e.TrackingEventProcessor : Processing split instruction for segment [0] in processor [TestProjection]
o.a.a.c.p.EventProcessorController : Successfully split segment [0] of processor [TestProjection]
o.a.a.c.u.FlowControllingStreamObserver : Observer stopped
o.a.e.TrackingEventProcessor : No Worker Launcher active. Using current thread to assign segments.
o.a.a.c.p.EventProcessorController : Was not able to split segment [0] for processor [TestProjection]
o.a.a.c.p.EventProcessorController : Was not able to split segment [0] for processor [TestProjection]
o.a.a.c.p.EventProcessorController : Was not able to split segment [0] for processor [TestProjection]
It looks like it wants to split the same segments 4 times, I need to wait between the calls
to let each split happen first I guess, but I’m not sure how I can tell I can call split again, because it is safe,
the previous split already took place? For the sake of the test, I put a Thread.sleep between the calls, and it is
indeed a matter of timing.
Any suggestions how I could automate and implement this?
Thanks