Repository navigation
fix(base): resolve partial identities when removing metadata (#7790) - #7858
Merged
Merged
Conversation
Aias00
approved these changes
Oct 20, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
Clean fix for #7790. Deletion events can carry only half the identity (id without path, or path without id), and the previous remove(...) would throw or miss the derived path entry. Resolving the partial identity against the cached canonical record and keeping the removal idempotent is the right call.
Highlights:
findByPath(...)resolves the cached record so both the id map and the derived path index are invalidated, regardless of which half of the identity the event carries.- The four new tests (id-only, path-only, full record, idempotent partial) cover the cases well, including the no-op path on missing records.
pr_build is green. Approving.
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.
Fixes #7790.
Summary
Gateway metadata deletion events can carry only half of the identity:
AbstractNodeDataSyncService#unCacheMetaDatapublishes an id-only record, andAbstractPathDataSyncServicepublishes a path-only record.MetaDataCache#removeassumed both fields were present, so it either threw onclean(null)after removing the id entry (leaving stale positive path results behind and aborting the subsequentremoveListener), or threw onConcurrentHashMap.remove(null)before anything was evicted.Modifications
MetaDataCache#removenow resolves the partial identity against the cached canonical record before eviction: with an id it looks up the record for its path; with only a path it finds the record by path and removes it from the id map (otherwise the lazily rebuilt path index would resurrect the entry on the nextobtain).cleanruns with the resolved path (event path first, cached record's path as fallback); when neither can be resolved the removal is a no-op, keeping it idempotent.unSubscribestops throwing, the listener cleanup after it resumes unblocked.Verifying this change
shouldRemoveByIdOnlyRecordWithoutPath: id-only removal no longer throws andobtain(path)returns null. Fails on the previous code (NullPointerExceptionfromclean(null)).shouldRemoveByPathOnlyRecordWithoutId: path-only removal no longer throws andobtain(path)returns null. Fails on the previous code (NullPointerExceptionfromremove(null)).Full-record removal regression and idempotency (
shouldBeIdempotentForPartialRecords) —MetaDataCacheTest5/5 green.Checkstyle passes:
clean.
Notes
The by-path lookup scans the id map once and only runs on the path-only deletion variant — a low-frequency admin operation — so no performance claim is made. The wildcard clear (
cleanwith a*path) behavior is unchanged.