AndrewJSchofield commented on code in PR #24169:
URL: https://github.com/apache/kafka/pull/24169#discussion_r4708393848


##########
server/src/main/java/org/apache/kafka/server/share/session/ShareSessionCache.java:
##########


Review Comment:
   If the `connectionId` was also passed to the notification method here, it 
would be possible to tighten up the connection disconnect path too.



##########
server/src/main/java/org/apache/kafka/server/share/session/ShareSessionCache.java:
##########


Review Comment:
   These sessions should probably all be marked as stale. It's a very minor 
point though because this method is only called if the `share.version` feature 
is toggled off.



##########
core/src/main/java/kafka/server/share/SharePartitionManager.java:
##########


Review Comment:
   It would be sensible to check the connection ID here. If a connection is 
actively using a share session, we don't want another connection taking it 
over. There is the possibility of a reconnect trying to do this before the 
broker sees a disconnect, but that will be a short-lived situation.



##########
core/src/main/java/kafka/server/share/SharePartitionManager.java:
##########
@@ -560,7 +597,7 @@ public ShareFetchContext newContext(
             synchronized (cache) {
                 ShareSessionKey key = shareSessionKey(groupId, memberId);
                 ShareSession shareSession = cache.get(key);
-                if (shareSession == null) {
+                if (shareSession == null || 
!shareSession.connectionId().equals(clientConnectionId)) {
                     log.error("Share session error for {}: no such share 
session found", key);

Review Comment:
   Let's put the connection IDs in the log messages when there's a mismatch.



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