lhotari commented on code in PR #17273:
URL: https://github.com/apache/pulsar/pull/17273#discussion_r955340920
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java:
##########
@@ -3513,31 +3495,22 @@ public void activateCursor(ManagedCursor cursor) {
if (activeCursors.get(cursor.getName()) == null) {
activeCursors.add(cursor);
}
- if (!cursor.isDurable() &&
nonDurableActiveCursors.get(cursor.getName()) == null) {
- nonDurableActiveCursors.add(cursor);
- }
}
public void deactivateCursor(ManagedCursor cursor) {
+ deactivateCursorByName(cursor.getName());
+ }
+
+ private void deactivateCursorByName(String cursorName) {
synchronized (activeCursors) {
- if (activeCursors.get(cursor.getName()) != null) {
- activeCursors.removeCursor(cursor.getName());
- if (!activeCursors.hasDurableCursors()) {
- // cleanup cache if there is no active subscription
- entryCache.clear();
- } else {
- // if removed subscription was the slowest subscription :
update cursor and let it clear cache:
- // till new slowest-cursor's read-position
- discardEntriesFromCache((ManagedCursorImpl)
activeCursors.getSlowestReader(),
- getPreviousPosition((PositionImpl)
activeCursors.getSlowestReader().getReadPosition()));
Review Comment:
@michaeljmarshall @cdbartholomew These are the lines that I think that were
completely invalid previously and could lead to the cache being evicted
unintentionally.
--
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]