lianetm commented on PR #15375:
URL: https://github.com/apache/kafka/pull/15375#issuecomment-1946314919

   Hey @lucasbru, agree that the callback invocation is missing, I had filed 
https://issues.apache.org/jira/browse/KAFKA-16258 to tackle that in a following 
PR if that's ok (mostly because I expect it should reuse some existing logic 
for callbacks, so I will refactor that code a bit to reuse it, and it will need 
specific testing for the poll timer callback, so thought we could solve the 
invalid transition here, and add the callbacks right after).
   
   Regarding your concern with the state, the key is that STALE state, even 
though it sends a leave group request, is more like the FENCED or FATAL 
regarding callbacks and heartbeat:
   - When member gets fenced/fatal/stale, it triggers the `onPartitionsLost` 
(not the revoked), and it also stops sending HB. This means that it's much 
simpler, we should not need any extra state like prepare_stale. The 
PREPARE_LEAVING is needed because while executing callbacks to leave, the 
member remains active, sending HB, so lots of things could happen from the 
broker side in the meantime, like fenced, fatal error, that we need to handle 
differently because we know the member is already preparing to leave.
   
   Also note that the member could remain STALE for a while after sending the 
HB to leave the group and executing onPartitionsLost, so we don't want to 
"rejoinAferLeave". We want to remain in that STALE state (meaning that it is 
not in the group, just like UNSUBSCRIBED, but with the difference that they 
require different actions to transition out). The member should transition out 
of STALE and rejoin only when the poll timer is reset with the app level poll 
event.
   
   Makes sense? I would expect that with KAFKA-16258 we end up integrating a 
call to onPartitionsLost after sending the HB to leave, to keep the same 
sequence as the legacy coordinator. I added the pointers to the legacy logic in 
the task description. 


-- 
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