Repository navigation
[fix][broker] Stop reporting a deliberate ownership release as an expired resource lock - #26533
Merged
merlimat merged 1 commit intoSep 10, 2026
Merged
Conversation
…ired resource lock
lhotari
approved these changes
Sep 10, 2026
lhotari
left a comment
Member
There was a problem hiding this comment.
LGTM. The conditional removal correctly keeps deliberate ownership releases quiet while retaining the expiry message for a lock that is still registered. The two regression tests cover both cases. No issues found.
dao-jun
approved these changes
Sep 10, 2026
merlimat
approved these changes
Sep 10, 2026
lhotari
pushed a commit
that referenced
this pull request
Sep 10, 2026
…ired resource lock (#26533) Co-authored-by: maxlisongsong <[email protected]> (cherry picked from commit 8482e16)
lhotari
pushed a commit
that referenced
this pull request
Sep 11, 2026
…ired resource lock (#26533) Co-authored-by: maxlisongsong <[email protected]> (cherry picked from commit 8482e16)
1 of 11 tasks
Radiancebobo
pushed a commit
to Radiancebobo/pulsar
that referenced
this pull request
Oct 8, 2026
…ired resource lock (apache#26533) Co-authored-by: maxlisongsong <[email protected]>
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.
Motivation
ResourceLockImpl.release()completes the lock's expiry future, soOwnershipCache's lock-expirylistener also runs at the tail of every deliberate release: every bundle unload, the split cleanup,
and shutdown. The listener logs
Resource lock has expiredat INFO unconditionally, so a routineunload emits a line that reads like a lost metadata session. Operators get one false hit per unload,
which buries the cases that line is meant to surface — a lost session or a failed revalidation.
Modifications
Both
removeOwnershipoverloads take the lock out oflocallyAcquiredLocksbefore callingrelease(), so the lock is still registered when the listener runs only if it died on its own. TheINFO line is now gated on the two-arg
locallyAcquiredLocks.removereturning true; a deliberaterelease, or a stale listener whose generation has already been replaced, logs at DEBUG instead.
Nothing outside logging changes.
Verifying this change
This change added tests and can be verified as follows:
OwnershipCacheTest.testReleasingOwnershipDoesNotReportTheLockAsExpired: a normalremoveOwnershipmust not produce an INFOResource lock has expired. Fails before the change.OwnershipCacheTest.testLockDyingOutsideOfReleaseIsReportedAsExpired: a lock that dieswithout going through
removeOwnershipis still reported at INFO, so the line cannot be droppedinstead of gated.
TestLogAppender.OwnershipCacheTest(20),NamespaceUnloadingTest,NamespaceOwnershipListenerTestand the unload / split cases ofNamespaceServiceTestpasslocally;
./gradlew quickCheckis clean.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes