apoorvmittal10 commented on code in PR #21062:
URL: https://github.com/apache/kafka/pull/21062#discussion_r2585367207
##########
server/src/main/java/org/apache/kafka/server/share/session/ShareSessionCache.java:
##########
@@ -172,6 +169,17 @@ public synchronized ShareSession remove(ShareSession
session) {
if (removeResult != null) {
numPartitions = numPartitions - session.cachedSize();
numMembersPerGroup.compute(session.key().groupId(), (k, v) -> v !=
null ? v - 1 : 0);
+ // Mark the session as stale in the connectionIdToSessionMap to
avoid removing
+ // the active session for the client. When client re-sends the
initial epoch where the
+ // broker removes the prior session and establishes new session,
then sometimes the connection
+ // id is changed. This leads to removal of the new session from
the cache, when old connection
+ // disconnect event is processed. Marking the old connection as
stale avoids this issue.
+ // If the connection id remains same for both old and new session,
then the subsequent call
+ // for session creation will overwrite the prior stale mapping in
the connectionIdToSessionMap.
Review Comment:
Is it still confusing, do I need to change something?
--
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]