allthingssecurity commented on PR #26769:
URL: https://github.com/apache/camel/pull/26769#issuecomment-5794463775

   @oscerd thanks, good catch: with a stale `lastGoodIndex` (for example after 
processors were removed from a running load balancer) the `index == start` 
sentinel could never match, and with `maximumFailoverAttempts` -1 the failover 
kept wrapping around.
   
   Fixed in 3b3a632c with the count-based approach you suggested. `State` now 
counts the endpoints tried for the exchange. Sticky mode without round robin 
wraps to the first endpoint only while `tried < processors.length`, and stops 
once all of them have been tried. `start` is gone, so there's no dependence on 
it being in range.
   
   New test `testFailoverStickyWhenLastGoodEndpointWasRemoved`:
   - `c` becomes the last good endpoint (index 2), then its processor is 
removed with `removeProcessor`.
   - With `a` and `b` down, the exchange must fail within 5 s after trying each 
of them once.
   - With `b` up, it must succeed on `b`.
   
   With the previous sentinel version, the test fails with `TimeoutException` 
(the loop). With this change, all 4 tests in `FailoverStickyWrapAroundTest` and 
all 23 `Failover*Test` / `FailOver*Test` tests pass.
   
   Agreed on CI: it still needs a maintainer to approve the workflow runs for 
this fork PR.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to