You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "void-ptr974 (via GitHub)" <gi...@apache.org> on 2026/10/18 03:12:37 UTC
[PR] [fix][ml] Fix stale individual and batch ACK state being persisted during cursor reset [pulsar]
void-ptr974 opened a new pull request, #26973:
URL: https://github.com/apache/pulsar/pull/26973
### Motivation
Cursor reset persists the new mark-delete position before applying the reset ACK state in memory. The serializers currently read the live individual and batch ACK collections, so the reset record can combine the new position with stale acknowledgments. If that record is recovered before a later successful persistence or orderly close replaces it, entries made available for replay by the reset can be skipped. Resetting within a batch can also recover the previous bitmap instead of the requested bitmap.
### Modifications
- Carry a reset-specific ACK snapshot through the existing mark-delete operation: empty individual ACK ranges and, when present, the requested batch bitmap.
- Use the same snapshot for BookKeeper persistence and the Metadata Store fallback, while applying the live ACK changes only after persistence succeeds.
- Initialize replacement cursor ledgers from the live ACK state, so a failed reset's retained operation cannot clear valid ACKs during a later checkpoint.
- Preserve existing batch persistence limits, compaction properties, non-durable cursor dispatch, and serialized formats.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
This change adds deterministic regression tests:
- `ManagedCursorResetDurabilityTest`: nine cases covering individual ACK serialization formats, cleared and requested batch ACKs, Metadata Store fallback, failed persistence, rollover followed by ordinary ACKs, and batch persistence configuration limits.
- `ManagedCursorResetFailedRebuildTest`: verifies that a replacement cursor ledger preserves valid ACKs after a reset fails, including the checkpoint window before the queued flush is persisted.
Local validation passed with test retries disabled:
- 41 scoped TestNG invocations, including the new tests and existing reset, compaction, non-durable cursor, batch ACK, flush, out-of-order persistence, truncation, and serialization concurrency tests.
- `./gradlew quickCheck`.
The new regression tests can be run with:
```shell
./gradlew :managed-ledger:test \
--tests 'ManagedCursorResetDurabilityTest' \
--tests 'ManagedCursorResetFailedRebuildTest' \
-PtestRetryCount=0 -PtestFailFast=false
```
### Does this pull request potentially affect one of the following parts:
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] The metrics
- [ ] Anything that affects deployment
--
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org