Skip to content

[#2944] Scan durable pending-ack references once - #2946

Open
cshannon wants to merge 1 commit into
apache:mainfrom
cshannon:gh-2944-durable-ack
Open

cshannon wants to merge 1 commit into
apache:mainfrom
cshannon:gh-2944-durable-ack

Conversation

@cshannon

@cshannon cshannon commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Refs #2944.

MessageDatabase.isSequenceReferenced() now scans ackPositions once and stops when it finds an active durable subscriber that still needs the message. Previously, each subscriber lookup restarted the list scan. This reduces worst-case subscription lookup work from quadratic to linear without changing the on-disk format or the rule for deleting messages. This change is independent of #2945.

Durable subscribers Ack throughput First-ack p99 Final-ack p99
1 +2.3% — +1.1%
8 +1.9% −2.4% −1.8%
32 +8.4% +3.0% −9.5%
128 +77.3% +3.0% −47.9%

Median changes across four paired JVM runs calling KahaDB directly. At 32 subscribers, first-ack p99 rose in all four pairs (22.0 → 22.5 µs across run medians), while final-ack p99 fell in all four.

Validation: 33 tests passed across KahaDBStoreTest, KahaDBDurableMessageRecoveryTest, KahaDBRecoverExpiredTest, and MultiKahaDBTopicDeletionTest. The new regression verifies that acknowledgments and unsubscribe retain a message until its last durable reference is gone.

Walk pending-ack entries directly instead of restarting the list scan for each durable subscription. Preserve the active subscription check and stop at the first remaining reference.

Cover message retention and removal through both acknowledgment and unsubscribe.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant