poorbarcode commented on code in PR #19873:
URL: https://github.com/apache/pulsar/pull/19873#discussion_r1145613781
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/BucketDelayedDeliveryTracker.java:
##########
@@ -341,18 +339,24 @@ public synchronized boolean addMessage(long ledgerId,
long entryId, long deliver
private synchronized CompletableFuture<Void> asyncMergeBucketSnapshot() {
List<ImmutableBucket> values =
immutableBuckets.asMapOfRanges().values().stream().toList();
long minNumberMessages = Long.MAX_VALUE;
+ long minScheduleTimestampSum = Long.MAX_VALUE;
int minIndex = -1;
for (int i = 0; i + 1 < values.size(); i++) {
ImmutableBucket bucketL = values.get(i);
ImmutableBucket bucketR = values.get(i + 1);
- long numberMessages = bucketL.numberBucketDelayedMessages +
bucketR.numberBucketDelayedMessages;
- if (numberMessages < minNumberMessages) {
- minNumberMessages = (int) numberMessages;
- if (bucketL.lastSegmentEntryId >
bucketL.getCurrentSegmentEntryId()
- && bucketR.lastSegmentEntryId >
bucketR.getCurrentSegmentEntryId()
- &&
bucketL.getSnapshotCreateFuture().orElse(NULL_LONG_PROMISE).isDone()
- &&
bucketR.getSnapshotCreateFuture().orElse(NULL_LONG_PROMISE).isDone()) {
- minIndex = i;
+ if (bucketL.lastSegmentEntryId > bucketL.getCurrentSegmentEntryId()
Review Comment:
Can we add a java-comment to illustrate `bucketL.lastSegmentEntryId >
bucketL.getCurrentSegmentEntryId()`? This helps to increase readability
--
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]