lhotari commented on code in PR #4638:
URL: https://github.com/apache/bookkeeper/pull/4638#discussion_r2299808313
##########
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:
can `averageEntrySize.get()` be negative?
--
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]