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


##########
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 think we should "wrap around" the negative value and make it become 
positive.
   
   The point is that such value could be positive, but it wouldn't match a 
meaningful value.



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