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

change nondurable cursor to active #6769

Merged
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 @@ -858,6 +858,7 @@ public ManagedCursor newNonDurableCursor(Position startCursorPosition, String cu

NonDurableCursorImpl cursor = new NonDurableCursorImpl(bookKeeper, config, this, cursorName,
(PositionImpl) startCursorPosition);
cursor.setActive();

log.info("[{}] Opened new cursor: {}", name, cursor);
synchronized (this) {
Expand Down Expand Up @@ -2894,7 +2895,7 @@ public void deactivateCursor(ManagedCursor cursor) {
}

public boolean isCursorActive(ManagedCursor cursor) {
return cursor.isDurable() && activeCursors.get(cursor.getName()) != null;
return activeCursors.get(cursor.getName()) != null;
}

private boolean currentLedgerIsFull() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,21 +92,6 @@ protected void internalAsyncMarkDelete(final PositionImpl newPosition, Map<Strin
callback.markDeleteComplete(ctx);
}

@Override
public void setActive() {
/// No-Op
}

@Override
public boolean isActive() {
return false;
}

@Override
public void setInactive() {
/// No-Op
}

@Override
public void asyncClose(CloseCallback callback, Object ctx) {
// No-Op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3000,6 +3000,17 @@ void testAlwaysInactive() throws Exception {
assertFalse(cursor.isActive());
}

@Test
void testNonDurableCursorActive() throws Exception {
ManagedLedger ml = factory.open("testInactive");
ManagedCursor cursor = ml.newNonDurableCursor(PositionImpl.latest, "c1");

assertTrue(cursor.isActive());

cursor.setInactive();
assertFalse(cursor.isActive());
}

@Test
public void deleteMessagesCheckhMarkDelete() throws Exception {
ManagedLedger ledger = factory.open("my_test_ledger");
Expand Down