Skip to content

Commit

Permalink
fix bug: ignoring flow control message since cursor reset in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
HQebupt committed Jul 12, 2022
1 parent 3752a11 commit 5cc8392
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3283,4 +3283,12 @@ public void setState(State state) {
public ManagedLedgerConfig getConfig() {
return config;
}

/**
* check cursor reset status
* @return true if the cursor reset in progress
*/
public boolean resetCursorInProgress() {
return RESET_CURSOR_IN_PROGRESS_UPDATER.get(this) == TRUE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.apache.bookkeeper.mledger.ManagedLedgerException;
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 @@ -278,6 +279,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).resetCursorInProgress()) {
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

0 comments on commit 5cc8392

Please sign in to comment.