Repository navigation
fix(migration): move Context Center file tags on upgrades where later tables do not exist yet - #37960
Conversation
… tables do not exist yet
…oking up FQN holders
|
Local Java test run: PASSED — details
Tests run locally
Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts. Broader coverage not executed by this focused run
Commandsmvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=EntityFqnHoldersIT,FolderIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Local Java test run: PASSED — details
Tests run locally
Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts. Broader coverage not executed by this focused run
Commandsmvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=EntityFqnHoldersIT,FolderIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
Code Review ✅ Approved 🔴 High risk 1 closed / 1 findingsChanging the Context Center migration’s FQN-holder check lets tag rows move past absent tables; a mistaken absence could misassign stored tags. Moves Context Center file tag repair to a per-run ✅ 1 closed✅ Quality: Missing-table-holds-nothing migration rule is not recorded in docs/decisions
VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
| } catch (Exception e) { | ||
| return missingTable(e) ? notCreatedYet(table) : notLookedUp(table, e); |
There was a problem hiding this comment.
holdingIn() catches Exception, which violates the Java guide's instruction to catch specific exception types. Catch the database query exception instead, while keeping the distinction between missing tables and other lookup failures. This repository requirement must be satisfied before merging.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Describe your changes:
No linked issue yet: this is a follow-up to PR #37796, which had none either.
PR #37796 added the 2.1.0 data step
repairContextFileFqns. It gives Context Center files that an edit stored under their bare name their folder path back, and moves the file's tags to that path. Before moving them, it checks every registered entity table for another entity with the bare name. If any of those lookups fails, it assumes another entity owns the name and leaves the tags where they are.An upgrade runs each version's data step before later versions create their tables, while every entity type of the new build is already registered. On a server that registers types a later migration creates (Collate does, in its
2.1.0-collatefolder, which runs after2.1.0), those lookups always fail. So every repaired file kept its tags under the old name: the file showed no tags, the step recorded itself as done, and only a WARN line said so.This PR:
EntityFqnHolders, built once per run.42S02on MySQL,42P01on Postgres). It then logs that once and does not query that table again. Any other failure still counts as "another entity may own this name", so the tags stay. That is the same safe behaviour as before.FolderITguard that a PATCH on a nested folder keeps its full name. I first suspected folders had the same bug as files. They don't: the baserestorePatchAttributesrestores the stored FQN, andContextFileRepositorywas the one override that skipped it. The test keeps it that way.The step name is unchanged. 2.1.0 has not shipped with this step, so only test databases can have run the broken version.
Type of change:
High-level design:
N/A, small change.
Tests:
Use cases covered
Unit tests
EntityFqnHoldersonly talks to the database, so it is tested against real MySQL and Postgres inEntityFqnHoldersITinstead of with mocks.Backend integration tests
EntityFqnHoldersIT(4 tests) andFolderIT#testPatchingANestedFolderKeepsItsFullyQualifiedName.ContextFileFqnRepairMigrationITas the regression for the repair step, together withEntityFqnHoldersITandFolderIT, on both MySQL/Elasticsearch and Postgres/OpenSearch at579e6b9a: all passed.ContextFileFqnRepairMigrationITcannot reproduce the Collate case itself, because OpenMetadata alone has every table. The upgrade run below covers it.Local Java test run: PASSED
2c2acf326228(baseorigin/main)--scope full).Ingestion integration tests
Playwright (UI) tests
Visual regression baselines
Manual testing performed
I ran a real Collate upgrade from 2.0.8, on Postgres and on MySQL, with and without this fix:
Reports, a nested folderReports.Q3, a file in each, and one at the root, all tagged.openmetadata-ops.sh migratewith a 2.1 Collate build that includes PR fix(security): access control hardening #37796:governance_automation_entityandmetadata_standard_entitywere "not looked up".GET /v1/contextCenter/drive/files/name/{fqn}?fields=tagsreturned every tag.UI screen recording:
Not applicable: backend migration fix.
Checklist:
Fixes <issue-number>: <short explanation>(no issue, see above)Fixes #<issue-number>above. (no issue, see above)REVIEW.md(thepr-checklistskill runs it) and fixed every 🔴 finding, or answered it on the line below.579e6b9a, with no 🔴 left. Fixed on the way:aTableFoundMissingIsNotLookedUpAgain, which fails with the cache removedrepairAllhas no test with a missing table. Adding one needs a production overload just for tests, so the Collate upgrade run covers it instead.FolderITtest is a guard, not a reproduction (see above).2c2acf32: the decision record,List.copyOfreturns andfinallocals. No behaviour change; the focused run above is on that commit.docs/decisions/2026-11-17-a-migration-entity-lookup-treats-only-a-missing-table-as-empty.md, cited fromEntityFqnHolders. The rule depends on the order in which migrations run, which no single file shows.The Java guide's requirement to catch specific exceptions remains unmet and must be addressed before merging.
Findings
Summary
The PR lets the file-name repair move tags when later migrations have not created every registered entity table.
Reviews (7) · Last reviewed commit: "docs(migration): record that a migration..." · Reviewed by Greptile