Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #8592] Not notify long polling request when pop orderly consume blocked #8593

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -551,18 +551,24 @@ private CompletableFuture<Long> popMsgFromQueue(String topic, String attemptId,
future.whenComplete((result, throwable) -> queueLockManager.unLock(lockKey));
offset = getPopOffset(topic, requestHeader.getConsumerGroup(), queueId, requestHeader.getInitMode(),
true, lockKey, true);
if (isOrder && brokerController.getConsumerOrderInfoManager().checkBlock(attemptId, topic,
requestHeader.getConsumerGroup(), queueId, requestHeader.getInvisibleTime())) {
future.complete(this.brokerController.getMessageStore().getMaxOffsetInQueue(topic, queueId) - offset + restNum);
return future;
}

// Current requests would calculate the total number of messages
// waiting to be filtered for new message arrival notifications in
// the long-polling service, need disregarding the backlog in order
// consumption scenario. If rest message num including the blocked
// queue accumulation would lead to frequent unnecessary wake-ups
// of long-polling requests, resulting unnecessary CPU usage.
// When client ack message, long-polling request would be notifications
// by AckMessageProcessor.ackOrderly() and message will not be delayed.
if (isOrder) {
if (brokerController.getConsumerOrderInfoManager().checkBlock(
attemptId, topic, requestHeader.getConsumerGroup(), queueId, requestHeader.getInvisibleTime())) {
// should not add accumulation(max offset - consumer offset) here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,Means return the original restNum if lock failed.

future.complete(restNum);
return future;
}
this.brokerController.getPopInflightMessageCounter().clearInFlightMessageNum(
topic,
requestHeader.getConsumerGroup(),
queueId
);
topic, requestHeader.getConsumerGroup(), queueId);
}

if (getMessageResult.getMessageMapedList().size() >= requestHeader.getMaxMsgNums()) {
Expand Down
Loading