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

[improve][broker] Make timer execute immediately after load index #20126

Merged
merged 1 commit into from
Apr 19, 2023
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 @@ -541,7 +541,7 @@ public long getBufferMemoryUsage() {

@Override
public synchronized NavigableSet<PositionImpl> getScheduledMessages(int maxMessages) {
if (!checkPendingOpDone()) {
if (!checkPendingLoadDone()) {
if (log.isDebugEnabled()) {
log.debug("[{}] Skip getScheduledMessages to wait for bucket snapshot load finish.",
dispatcher.getName());
Expand Down Expand Up @@ -628,11 +628,11 @@ public synchronized NavigableSet<PositionImpl> getScheduledMessages(int maxMessa
if (timeout != null) {
timeout.cancel();
}
timeout = timer.newTimeout(this, tickTimeMillis, TimeUnit.MILLISECONDS);
timeout = timer.newTimeout(this, 0, TimeUnit.MILLISECONDS);
}
});

if (!checkPendingOpDone() || loadFuture.isCompletedExceptionally()) {
if (!checkPendingLoadDone() || loadFuture.isCompletedExceptionally()) {
break;
}
}
Expand All @@ -651,7 +651,7 @@ public synchronized NavigableSet<PositionImpl> getScheduledMessages(int maxMessa
return positions;
}

private synchronized boolean checkPendingOpDone() {
private synchronized boolean checkPendingLoadDone() {
if (pendingLoad == null || pendingLoad.isDone()) {
pendingLoad = null;
return true;
Expand Down