Repository navigation
[fix][ml] Confirm retried cursor metadata writes in ZooKeeper - #27652
Merged
poorbarcode merged 4 commits intoNov 19, 2026
Merged
Conversation
Assisted-by: OpenAI Codex
Assisted-by: OpenAI Codex
lhotari
reviewed
Nov 17, 2026
lhotari
reviewed
Nov 17, 2026
codelipenghui
approved these changes
Nov 17, 2026
Assisted-by: OpenAI Codex
codelipenghui
approved these changes
Nov 18, 2026
lhotari
requested changes
Nov 18, 2026
lhotari
left a comment
Member
There was a problem hiding this comment.
Please address the comment about removing the HasPublicationId.
Assisted-by: OpenAI Codex
codelipenghui
approved these changes
Nov 18, 2026
lhotari
approved these changes
Nov 19, 2026
lhotari
left a comment
Member
There was a problem hiding this comment.
LGTM. Thanks for the quick follow-up: both requested simplifications are in. HasPublicationId and the LightProto doLast step are gone, and the VerifyPublication Javadoc now carries the contract.
poorbarcode
added a commit
that referenced
this pull request
Nov 19, 2026
(cherry picked from commit 893259f)
This was referenced Nov 19, 2026
codelipenghui
added a commit
to codelipenghui/incubator-pulsar
that referenced
this pull request
Nov 24, 2026
Resolve the conflicts in ManagedCursorImpl and adapt the publication path to the cursor changes on master: - apache#27703 rebuilds the cursor properties in updateCursorLedgerStat, so drop adoptStoredCursorInfo and keep only the deletion of retained ledgers there. Sample the version and the properties as one pair in publishCursorLedger as well as in persistPositionMetaStore, and pass them to buildManagedCursorInfo. - apache#27652 assigns a publication ID in MetaStoreImpl during the write. Assign it in publishCursorLedger before taking the attempted bytes, so that reconciliation still recognizes a committed publication. - apache#27671 makes a closing cursor wait for an in-flight ledger switch, so allow that switch to publish while the cursor is Closing. - apache#26817 closes the read-only cursor ledger in asyncDeleteCursorLedger; keep that next to the deletion of retained ledgers. MetaStoreImpl now calls the put overload with options, so the fault-injection stubs in ManagedCursorTest target that overload. Assisted-by: Claude Code (Claude Opus 5.5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Following a ZooKeeper connectivity interruption, a broker repeatedly failed to open a durable subscription with
BadVersion. The cursor znode already existed. Unloading the topic let the broker reload the persisted cursor, and the subscription recovered.Motivation
ZooKeeper can commit a cursor write before the client loses the response. Replaying a create then returns
NODEEXISTS, which Pulsar maps toBadVersion. Replaying an update with the original expected version also returnsBadVersion. The broker needs to recognize its own committed write while continuing to report conflicts when another writer wins.Modifications
ManagedCursorInfo. Assign a UUID on the first attempt and preserve it across retries of the same write. A new cursor property update clears the ID inherited from the previous record.putAPI withOption.VerifyPublication. Its documentation requires a unique publication ID in the serialized value and preservation of the ID, serialized bytes, and expected version across retries of the same write. Other metadata record types can use the same verification path.getDataso verification also works for valid records larger than the server’smultiReadresponse limit. Return the observedStat, including its session ownership information.Local verification passed the repository-wide
sanityCheckand all 47 tests inZKMetadataStoreTest,MetaStoreImplTest,ManagedCursorInfoMetadataTest, andManagedCursorPropertiesTest.Does this pull request potentially affect one of the following parts:
The metadata-store API gains the optional
VerifyPublicationwrite option. The persisted managed cursor protobuf gains an optional string field. Brokers can still read older cursor records that omit it.