kamalcph commented on code in PR #15820:
URL: https://github.com/apache/kafka/pull/15820#discussion_r1625290704


##########
core/src/main/java/kafka/log/remote/RemoteLogManager.java:
##########
@@ -750,6 +762,23 @@ public void copyLogSegmentsToRemote(UnifiedLog log) throws 
InterruptedException
                                         isCancelled(), isLeader());
                                 return;
                             }
+
+                            copyQuotaManagerLock.lock();
+                            try {
+                                while (rlmCopyQuotaManager.isQuotaExceeded()) {
+                                    logger.debug("Quota exceeded for copying 
log segments, waiting for the quota to be available.");
+                                    // If the thread gets interrupted while 
waiting, the InterruptedException is thrown
+                                    // back to the caller. It's important to 
note that the task being executed is already
+                                    // cancelled before the executing thread 
is interrupted. The caller is responsible
+                                    // for handling the exception gracefully 
by checking if the task is already cancelled.

Review Comment:
   Could you cover shutdown when the quota gets breached as unit test?



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