divijvaidya opened a new pull request, #12590:
URL: https://github.com/apache/kafka/pull/12590

   ## Problem
   When consumer is closed, fetch sessions associated with the consumer should 
notify the server about it's intention to close using a Fetch call with epoch = 
-1 (identified by `FINAL_EPOCH` in `FetchMetadata.java`). However, we are not 
sending this final fetch request in the current flow which leads to unnecessary 
fetch sessions on the server which are closed only after timeout.
   
   ## Changes
   
   1. Change `close()` in `Fetcher` to add a logic to send the final Fetch 
request notifying close to the server.
   2. Change `close()` in `Consumer` to respect the timeout duration passed to 
it. Prior to this change, the timeout parameter was being ignored.
   3. Change tests to close with `Duration.zero` to reduce the execution time 
of the tests. Otherwise the tests will wait for default timeout to exit 
(close() in the tests is expected to be unsuccessful because there is no server 
to send the request to).
   4. Distinguish between the case of "close existing session and create new 
session" and "close existing session" by renaming the `nextCloseExisting` 
function to `nextCloseExistingAttemptNew`.
   
   ## Testing
   Added unit test which validates that the correct close request is sent to 
the server.
   
   
   Note that this change has been attempted in 
https://github.com/apache/kafka/pull/5407 but the PR was abandoned.
   
   
   


-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to