Repository navigation
[2.1] Fixes #39764: make relationship types from a 2.0 upgrade valid in 2.1 (#39765) - #39882
Conversation
…#39765) * Create a relationship type for a free-text inverse during the 2.1 upgrade In 2.0 a glossary term relation type's inverse was free text, and a link saved from the inverse end was stored under that text. The 2.1.0 data migration requires every inverse to name a configured type and throws otherwise, which halts the upgrade. Before mapping, the migration now points each unmatched inverse at the type it names in another case or by display name, or adds a type for it, and renames the term links stored under the old text (dropping a row that already exists under the new name). Links are renamed before the settings are written, so an interrupted run repeats the repair. * Repair relationship types the 2.1 upgrade stored without 2.1 validation - The 2.1.0 conversion runs only when relationship_type_entity is empty and only inserts, so a re-run keeps what 2.1 changed since. - A symmetric type's free-text inverse resolves to the type itself. - A name with a space gets an encoded default predicate; a dotted name is stored under its quoted FQN and hash, and lookups by name quote it. - New 2.1.2 step RelationshipTypeRepair for clusters already upgraded: every type can be saved again, each holds its own predicate (seed predicates stay free for their seeds), term links stored under no type point at one, and links get the type id and json 2.1 reads. * Keep one relation type per name and quote names in type lookups - The 2.1.0 conversion keeps one definition per name from the 2.0 settings (the system-defined one, else the first) instead of failing the insert on the second copy. - The settings synchronizer and PUT /relationshipTypes look a type up under its quoted FQN, so a name holding a dot updates the stored type instead of colliding with it. - Decision records note the search and RDF reindex after the repair and the deprecated settings endpoints as a known gap. * Match relation types by name only when resolving upgraded inverses and link texts 2.0 resolved an inverse and a stored link type by name, ignoring case, never by display name. Matching a display name pointed a type at another type's inverse and left a one-way pair, so links saved from the higher term id read back as the partner's inverse. Text equal only to another type's display name now gets its own type; texts naming the same missing type still share one. * Pair a relationship type left without its inverse in the 2.1.2 repair A stock 2.1.0 upgrade kept the last definition of a name 2.0 defined twice, so a type can have no inverse while its partner names it, and a link authored from the higher term reads as the partner's inverse on both terms. The repair now gives such a type the one live type naming it, unless a link stored under it was authored on 2.1 from the higher term: a pair would read that link the other way round, so the type is left and logged. * Revert "Pair a relationship type left without its inverse in the 2.1.2 repair" This reverts commit 6874b99. From the stored types alone, a type a duplicate name left without its inverse looks the same as a 2.0 type that never had one, and pairing the latter reverses links 2.0 stored from the higher term. The cosmetic gap it closed is recorded in the decision record instead. (cherry picked from commit 80ea0f2)
❌ 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 |
Code Review ✅ Approved 🔴 High riskThe 2.1.0/2.1.2 migrations rewrite relationship-type definitions and glossary-term links, so incorrect repairs could misrepresent or disrupt stored relationships. Backport to 2.1 that converts free-text relationship inverses into relationship types during the 2.1.0 migration and adds a 2.1.2 step to repair relationship types already stored by 2.1.0 on upgraded clusters. No issues found. 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 |
Describe your changes
Backport of #39765 to 2.1.
Fixes #39764
2.0 accepted relation types that 2.1 rejects, and the 2.1.0 data migration stored them without the checks a 2.1 write runs. A free-text inverse stopped the upgrade; other shapes got through and then left types that cannot be saved and glossary term pages that fail to load. The corrected 2.1.0 migration converts free-text inverses into relationship types. A new 2.1.2 step repairs the types and links 2.1 rejects; it runs on every upgrade, and is the only fix for clusters already on 2.1.0 or 2.1.1. Scenarios with examples: #39765 (comment)
Differences from main
ScratchDatabaseandScratchDatabasePerTestfrom main unchanged, and narrowsTestSuiteBootstrap.getDatabaseContainer()toJdbcDatabaseContainer<?>, as on main (the field already had that type).OntologyInverseRepairMigrationITunderopenmetadata-service/src/test; it is moved toopenmetadata-integration-tests/.../it/tests/migration/v210/, its path on main..github/java-tests/impact-map.jsonmapsorg/openmetadata/it/tests/migration/**tomigrations-seed-data, as on main, so the new helper has an owner.Decision records:
ADR:2026-12-04-upgrade-turns-free-text-relation-inverses-into-relationship-types,ADR:2026-12-04-upgrade-repairs-relationship-types-2-1-rejects.Type of change:
Tests:
UNIT_RESULTS
IT_RESULTS
E2E_RESULTS
Checklist:
Fixes <issue-number>: <short explanation>