Repository navigation
Conversation
…ssary relations against SQL - Add primary-key-backed exists and bidirectional findBetween lookups to CoreRelationshipDAOs.EntityRelationshipDAO. - Wire RelationshipExists and GlossaryTermRelationRows loaders into RdfProjectionLoaders with canonical UUID-ordered / inverse / legacy JSON glossary term relation matching. - Reconcile RdfRepository.refreshRelationship and refreshGlossaryTermRelation against current SQL state on replay, removing stale triples instead of resurrecting deleted edges while preserving live opposite-direction asymmetric glossary relations. - Add unit tests in RdfLiveWriteTest and RdfGlossaryTermRelationTest and an integration test in RdfLiveProjectionIT.
❌ 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 |
|
@iamkiayun thanks for this. The glossary-relation reconciliation looks correct. One blocker on the generic path:
Please accept the reversed row only for the bidirectional case (same-type Tests: the generic |
yan-3005
left a comment
There was a problem hiding this comment.
Blocking on the bidirectional RELATED_TO case: the one-direction exists check drops A om:relatedTo B whenever A.id > B.id. Details and suggested fix in #38482 (comment)
…_TO on RDF replay
|
@yan-3005 Thanks for pointing out how the canonical SQL row is stored. I reran the RDF unit suite (1,819 passed) and |
|
@iamkiayun thanks, ddf9ca6 resolves my blocker. Limiting the reverse lookup to metric→metric One more thing: please merge the latest |
…x-replay-reconcile
Code Review ✅ Approved 🟡 Medium risk 2 closed / 2 findingsReplay reconciliation removes stale RDF relationship triples against SQL and live endpoints, which could change projected catalog relations after delayed outbox events. Reconciles replayed RDF non-lineage and glossary relations against SQL so delayed outbox retries and blue-green replays no longer resurrect deleted edges. Replay now accepts reversed canonical UUID-ordered rows for bidirectional relations and stops matching directed knowledge-page rows as same-type RELATED_TO. No open issues remain. ✅ 2 closed✅ Bug: Replay removes live bidirectional edges stored in canonical UUID order
✅ Edge Case: Same-type RELATED_TO heuristic also matches directed knowledge-page rows
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 |
yan-3005
left a comment
There was a problem hiding this comment.
Verified at 7bd9f99 (MySQL + Elasticsearch, rdf lane with Fuseki): RdfLiveProjectionIT 5/5 with 0 skipped, including replayedRelationshipAndGlossaryRelationAdditionsDoNotResurrectDeletedEdges and bidirectionalMetricRelatedToProjectsBothDirectionsAndReconcilesOnReplay; RDF unit tests 152/0. Bidirectional blocker resolved. Thanks @iamkiayun.
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Not backported to
|
|
🤖 Backport to |
…lations against SQL (#38482) (#38581) Before projecting a replayed RDF relationship add (generic relationships and glossary-term relations), check the SQL row still exists; if it does not, remove the triple instead of resurrecting it. The reverse-row lookup applies only to metric -> metric RELATED_TO. Adapted for 2.1 (main's #38419 is not on this branch): - RdfProjectionLoaders: keep 2.1's 6-component record (no BoundAssets or table-key loaders); add RelationshipExists and GlossaryTermRelationRows. - RdfLiveWriteTest, RdfGlossaryTermRelationTest, RdfEntityDeleteLineageTest: construct the 6-arg loaders; keep 2.1's existing tests and add #38482's cases. - RdfQualityEvidenceTest: dropped, the file does not exist on 2.1. (cherry picked from commit 0c6f3b0) Co-authored-by: Kia Yun <[email protected]>
Describe your changes:
Fixes #36026
Brings replayed non-
UPSTREAMrelationships (RdfRepository.refreshRelationship) and typed glossary term relations (RdfRepository.refreshGlossaryTermRelation) onto the same replay-time SQL reconciliation contract asrefreshLineage, so delayed outbox retries or blue-green rebuild replays never resurrect relationship edges that were deleted in SQL (for example via bulk updates or CSV imports that bypass RDF remove hooks).Type of change:
High-level design:
Approach & why
CoreRelationshipDAOs.EntityRelationshipDAO):exists(fromId, fromEntity, toId, toEntity, relation)(SELECT EXISTS (SELECT 1 FROM entity_relationship ... AND deleted = FALSE)) backed by the(fromId, toId, relation, relationType)primary key for O(1) non-lineage relationship verification on both MySQL and PostgreSQL.findBetween(fromId, toId, entityType, relation)(UNION ALLof forward and non-self reverse primary-key lookups withdeleted = FALSE) to fetch live glossaryRELATED_TOrows between two terms in either direction.RdfProjectionLoaders.java):RelationshipExistsandGlossaryTermRelationRowsloader interfaces toRdfProjectionLoaders, plus purehasGlossaryTermRelation/storedRelationTypematching helpers.fromId < toIdwith inverserelationTypewhen authored from the larger UUID), symmetric/no-inverse types, legacy rows with blankrelationTypecolumn (JSON fallback and"relatedTo"default), case-insensitive UUID and type matching, and self-relations.RdfRepository.java):refreshRelationship: checks both SQL edge existence and endpoint liveness (!relationshipExists || !hasLiveEnds); if missing or soft-deleted, callsremoveRelationship(relationship)instead ofaddRelationship(relationship).refreshGlossaryTermRelation: resolves the relationship type (active ignore-case first, falling back toInclude.ALLso a soft-deleted type whose last edge was deleted still cleans up cleanly without dead-lettering), checks type liveness, endpoint liveness, and SQL row match; if missing or non-live, removes only the directed semantic triple pair (<from> <pred> <to>and<to> <inversePred> <from>) viaremoveDirectedGlossaryTermRelationso a stale replay after flipping an asymmetric relation's direction (A broader B->B broader A) never erases the live reversed edge.Alternatives considered
refreshLineage).removeGlossaryTermRelation(all 4 direction/predicate combinations) on stale glossary ADD: Rejected because it would wipe a live opposite-direction edge if the user flippedA broader BtoB broader Abefore the old ADD replayed.Tests:
Use cases covered
RelationshipChange(CONTAINS) after the SQL edge was deleted removes any stale triple and never resurrects it; replaying after an endpoint soft-delete removes the edge.GlossaryRelationChange(broader, etc.) after SQL deletion removes any stale triple and never resurrects it; replaying after a term soft-delete removes the edge.fromId > toIdstored as(toId, fromId, inverseType)) projects both perspectives for every seeded and customRelationshipType.A broader B->B broader A) and replaying the staleADD(A, B, broader)removes staleA broader B/B narrower Awhile preserving liveB broader A.broader) preserves other live types between the same pair (seeAlso).relationTyperows (JSON fallback / default"relatedTo") and soft-deletedRelationshipTypecleanup work without errors.Unit tests
#36026failure scenarios).openmetadata-service/src/test/java/org/openmetadata/service/rdf/RdfLiveWriteTest.javaopenmetadata-service/src/test/java/org/openmetadata/service/rdf/RdfGlossaryTermRelationTest.javaopenmetadata-service/src/test/java/org/openmetadata/service/rdf/RdfEntityDeleteLineageTest.javaopenmetadata-service/src/test/java/org/openmetadata/service/rdf/RdfQualityEvidenceTest.javaorg.openmetadata.service.rdf.*unit suite: 1,816 run, 0 failures, 0 errors, 0 skippedmvn -B spotless:check,scripts/harness/check_decision_records.py,.github/scripts/plan_local_java_tests.py --base upstream/main --check-branch: all cleanBackend integration tests
openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfLiveProjectionIT.java(replayedRelationshipAndGlossaryRelationAdditionsDoNotResurrectDeletedEdges) exercising real SQLexists/findBetweenqueries, canonical reversed glossary storage, SQL deletion, stale replay, and direction-flip preservation against Fuseki.mvn -B test-compile -pl openmetadata-integration-tests; live-container execution is pending (Docker daemon unavailable locally; ready for CIsafe to test/ merge queue).Ingestion integration tests
Playwright (UI) tests
Manual testing performed
UI screen recording:
Not applicable — backend RDF live-write replay reconciliation only (no UI changes).
Checklist:
Fixes 36026: Reconcile replayed RDF non-lineage and glossary relations against SQLFixes #36026above.#36026bug.REVIEW.md; added null-payload guards inrefreshRelationship/refreshGlossaryTermRelation, case-insensitive UUID matching inhasGlossaryTermRelation, and direction-flip + guarded cleanup inRdfLiveProjectionIT.refreshLineageandADR:2026-10-26-the-rdf-graph-projects-the-live-catalog-only); no new cross-component contract or policy introduced.Fix reverse matching for directed table relations before merging.
Findings
Summary
The PR reconciles replayed RDF relationships against current SQL rows and live endpoints.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Replay relationship addition] --> B{Forward SQL row exists?} B -- Yes --> E{Both endpoints live?} B -- No --> C{Reverse matching allowed?} C -- No --> D[Remove RDF edge] C -- Yes --> F{Reverse SQL row exists?} F -- No --> D F -- Yes --> E E -- No --> D E -- Yes --> G[Add RDF edge]Reviews (2) · Last reviewed commit: "Accept reversed canonical SQL row for bi..." · Reviewed by Greptile