kpatelatwork commented on a change in pull request #10822: URL: https://github.com/apache/kafka/pull/10822#discussion_r655755572
########## File path: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/distributed/DistributedHerder.java ########## @@ -1592,6 +1731,28 @@ public void onSessionKeyUpdate(SessionKey sessionKey) { } } } + + @Override + public void onRestartRequest(RestartRequest request) { + log.info("Received and enqueuing {}", request); + + synchronized (DistributedHerder.this) { + String connectorName = request.connectorName(); + //preserve the highest impact request + if (pendingRestartRequests.containsKey(connectorName)) { + RestartRequest existingRequest = pendingRestartRequests.get(connectorName); + if (request.compareTo(existingRequest) > 0) { + log.debug("Overwriting existing {} and enqueuing the higher impact {}", existingRequest, request); + pendingRestartRequests.put(connectorName, request); + } else { + log.debug("Preserving existing higher impact {} and ignoring incoming {}", existingRequest, request); + } + } else { + pendingRestartRequests.put(connectorName, request); + } Review comment: turns out a normal hashmap also has compute so I just used it. -- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org