Repository navigation
[2.1] Fixes 38939: Resolve stored parent references on read for every entity - #39624
Merged
Merged
Conversation
#38950) * Fixes 38939: Resolve stored parent references on read for tables and schemas Tables keep databaseSchema and database refs, and schemas keep their database ref, in their stored JSON. Reads trusted those copies whenever they had an id, so after a parent's displayName changed, GET, list and a full search reindex (which reads through setFieldsInBulk) kept returning the old name. Re-read the refs by id on read: a cached lookup on the single-entity path, one batched reference query per page on the bulk path. Fixes #38939 * Keep a stored parent reference when the parent is gone currentReference threw EntityNotFoundException for a missing parent, so a table or schema whose parent row was gone could no longer be read. Fall back to the stored copy, as the bulk path already does, and record the read-time resolution rule as a decision. * Refresh every stored parent reference on read Tables and schemas were not the only entities returning a renamed parent's old displayName. File (directory, service on list and reindex), Query (service), DataContract (entity, testSuite), ontology definitions and OntologyChangeSet (ontology) and AIFrameworkControl (framework) all keep a copy of their parent reference in stored JSON and returned it as stored. Each repository now declares those references in getStoredParentReferences(). EntityRepository refreshes them after setFields on the single-entity path (entity cache) and at the start of the default setFieldsInBulk (one reference-only query per parent type per page). Table and DatabaseSchema move onto the same declaration. refreshStoredReferences groups ids by the type each reference names, so a field that points at several entity types costs one query per type. StoredParentReferenceIT renames each parent and checks GET and list for every declared entity; it fails on the code before this PR. * Leave the test suite rename out of the shared-server data contract test Renaming a contract's test suite writes a string into the embedded testSuites change description of its test cases, which the shared data insights index maps as boolean (#38799), so DataInsightAiAssetCoverageIT rejected the record. The test keeps checking the contract's entity. * Compare a data contract's test suite by identity Reads now return the suite's current reference, while prepare() rebuilds updated.testSuite from its id, FQN and type, so the full-object comparison recorded a testSuite change on an unchanged PUT and bumped the version. Compare it with entityReferenceMatch, as qualityExpectations already is. StoredParentReferenceIT gains a no-op PUT test (0.1 -> 0.2 before this change) and now cleans up its drive and database services, ontologies and AI framework fixtures. * Read large parents by reference row and drop redundant list queries - A data contract's entity (usually a table) is read with the reference-only query on the single-entity path: rebuilding the reference from the entity cache deserialized the whole table JSON on every GET. - A contract's testSuite is no longer declared: the contract owns its suite. This also restores the plain testSuite comparison in the updater. - The schema list no longer runs a second database query: every stored row already goes through batchFetchDatabases. - The table list takes databaseSchema from the schemas fetchAndSetDefaultFields already loaded, so only the database reference needs a query. - StoredParentReferenceCoverageTest fails when a repository with stored parent references overrides setFieldsInBulk without being listed with its test. - The decision record lists the covered entities and the stored references not declared yet. * Require every stored reference to be declared or listed with a reason - StoredReferenceDeclarationTest finds, for every repository, the single EntityReference fields its entity keeps in stored JSON and fails unless each is declared in getStoredParentReferences() or listed with its reason. The 64 listed today are grouped: re-read by their own repository, actors, configuration links, deprecated single domains, owned or point-in-time references, and two parents not declared yet. - A stored reference whose type has no repository keeps its stored copy instead of failing the read. - StoredParentReferenceIT covers the reindexed search doc of a table under renamed parents, an unchanged update after a parent rename and a soft-deleted parent; the no-op contract PUT test no longer guarded this change and is dropped. - The decision record lists the side effects: deleted on references under a soft-deleted parent, refreshed labels in version history, orphan lookups, and the reads that still return the stored copy. --------- Co-authored-by: Ram Narayan Balaji <[email protected]> Co-authored-by: Ram Narayan Balaji <[email protected]> (cherry picked from commit c76ee35)
gh-bot-collate
Bot
requested review from
manerow
and removed request for
a team
December 3, 2026 06:36
Author
|
🤖 This backport will not merge itself: |
12 of 15 tasks
pmbrull
added a commit
that referenced
this pull request
Dec 3, 2026
…ompile (#39703) #39624 backported StoredParentReferenceIT, which calls SearchDocs.awaitDocAsserted. That helper came in on main with #36256 and was never backported, so openmetadata-integration-tests fails to test-compile on 2.1. Bring over just the helper. Co-authored-by: Claude Opus 5.5 <[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.
Automated backport of #38950 to
2.1.c76ee35f1d61334dc75c4f0433449e16cd007672main.Opened from openmetadata-collate, which holds the credentials needed to open a PR here. It merges itself once this branch's required checks pass — no review needed. If a check fails it stays open and the author of #38950 is asked to look.
resolver run