In group coordinator, there is a logic to neglect join group request from existing follower consumers:
While looking at the AbstractCoordinator, I found that the generation was hard-coded as
NO_GENERATION on restart, which means we will send UNKNOWN_MEMBER_ID in the first join group request. This means we will treat the restarted consumer as a new member, so the rebalance will be triggered until session timeout.
I'm trying to clarify the following things before we extend the discussion:
- Whether my understanding of the above logic is right (Hope Matthias J. Sax could help me double check)
- Whether it makes sense to persist last round of memberId for consumers? We currently only need this feature in stream application, but will do no harm if we also use it for consumer in general. This would be a nice-to-have feature on consumer restart when we configured the loading-previous-memberId to true. If we failed, simply use the UNKNOWN_MEMBER_ID
- The behavior could also be changed on the broker side, but I suspect it is very risky. So far client side change should be the least effort. The end goal is to avoid excessive rebalance from the same consumer restart, so if you feel server side change could also help, we could further discuss.