TakaHiR07 commented on code in PR #4638:
URL: https://github.com/apache/bookkeeper/pull/4638#discussion_r2299956183


##########
bookkeeper-server/src/main/java/org/apache/bookkeeper/client/LedgerFragmentReplicator.java:
##########
@@ -455,9 +455,10 @@ void batchRecoverLedgerFragmentEntry(final long 
startEntryId,
         int entriesToReplicateCnt = (int) (endEntryId - startEntryId + 1);
         int maxBytesToReplicate = conf.getReplicationRateByBytes();
         if (replicationThrottle != null) {
-            if (maxBytesToReplicate != -1 && maxBytesToReplicate > 
averageEntrySize.get() * entriesToReplicateCnt) {
-                maxBytesToReplicate = averageEntrySize.get() * 
entriesToReplicateCnt;
-            }
+            int bytesToReplicateCnt = averageEntrySize.get() * 
entriesToReplicateCnt;
+            bytesToReplicateCnt = bytesToReplicateCnt >= 0 ? 
bytesToReplicateCnt : Integer.MAX_VALUE;
+            maxBytesToReplicate = Math.min(maxBytesToReplicate, 
bytesToReplicateCnt);

Review Comment:
   I get your point. you are right. 4294967297 is a corner case for int value. 
   
   Make it to long value would be better.



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