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

[fix][broker]stage 1: check the cursor status when handling flowPermits #16546

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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 @@ -3290,4 +3290,13 @@ public boolean isCacheReadEntry() {
public ManagedLedgerConfig getConfig() {
return config;
}

/**
* check cursor reset status.
*
* @return true if the cursor reset in progress
*/
public boolean isResetCursorInProgress() {
return RESET_CURSOR_IN_PROGRESS_UPDATER.get(this) == TRUE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.apache.bookkeeper.mledger.ManagedLedgerException.ConcurrentWaitCallbackException;
import org.apache.bookkeeper.mledger.ManagedLedgerException.NoMoreEntriesToReadException;
import org.apache.bookkeeper.mledger.ManagedLedgerException.TooManyRequestsException;
import org.apache.bookkeeper.mledger.impl.ManagedCursorImpl;
import org.apache.bookkeeper.mledger.impl.PositionImpl;
import org.apache.bookkeeper.mledger.util.SafeRun;
import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -279,6 +280,11 @@ private synchronized void internalConsumerFlow(Consumer consumer) {
log.debug("[{}-{}] Ignoring flow control message since consumer is waiting for cursor to be rewinded",
name, consumer);
}
} else if (((ManagedCursorImpl) cursor).isResetCursorInProgress()) {
if (log.isDebugEnabled()) {
log.debug("[{}-{}] Ignoring flow control message since cursor reset in progress - cursor {}",
name, consumer, cursor.getName());
}
} else {
if (log.isDebugEnabled()) {
log.debug("[{}-{}] Trigger new read after receiving flow control message", name, consumer);
Expand Down