Skip to content

Fixes #36671: Live RDF entity writes send only the changed triples (backport 2.0 #37069) - #37177

Merged
fmcardoso merged 4 commits into
2.0from
fix/36671-live-rdf-diff-writes-2.0
Nov 6, 2026
Merged

fmcardoso merged 4 commits into
2.0from
fix/36671-live-rdf-diff-writes-2.0

Conversation

@fmcardoso

@fmcardoso fmcardoso commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #36671

Backport of #37069 to the 2.0 release branch. #37069 explains the problem and the design: live entity writes read what Fuseki holds for the entity and send one DELETE DATA / INSERT DATA request with only the difference, or nothing; after sending a difference they read the projection back and replace it whole if a write queued ahead of it interfered. It builds on the storage maintenance work 2.0 already has (#36660, #36661).

Adapted to 2.0

  • No inference or asserted-graph decorators. InferenceInvalidatingRdfStorage and AssertedGraphTrackingRdfStorage exist only on main (from feat(rdf): SPARQL playground, MCP knowledge-graph tools, insights endpoints #28042 and Fixes 35200: Reject negated EXISTS rules and keep inferred triples out of inferenceLevel=none #35201), so their changes and tests are left out. 2.0 has no live inference invalidation to skip for unchanged writes.
  • No column projection. 2.0 does not project a table's columns as resources (main does), so RdfPropertyMapper takes only the named list cells. The column part of the entity scope matches nothing on 2.0, which is harmless. Two unit tests and one IT that relied on column triples use custom properties or the 2.0 counts instead.
  • Test APIs. The new tests use 2.0's JsonLdTranslator(mapper, baseUri) constructor and JenaFusekiStorage.isTimeoutError, now package-private for EntityWriteCircuitBreakerTest. FusekiTestImage, the IT helper RdfEntityDiffWriteIT starts its Fuseki with, comes over from main unchanged.
  • Docs. The decision record and the production setup guide drop the inference statements that do not apply on 2.0.

2.0 ships Fuseki 6.2.0, so the read-back's reliance on TDB2's arrival-order writer admission holds here too.

Type of change:

  • Bug fix

High-level design:

Same as #37069; see its description and docs/decisions/2026-11-03-live-rdf-entity-writes-send-only-the-changed-triples.md. Bulk reindex, relationship writes and the rebuild journal are unchanged; journal replay passes REPLACE explicitly.

Tests:

Use cases covered

Those of #37069, except the inference and asserted-graph cases that have no counterpart on 2.0.

Unit tests

  • Ported RdfEntityWritePlannerTest, RdfOwnedResourcesTest, EntityWriteCircuitBreakerTest, RdfMutationReplayTest.
  • Ran locally at f5333c1fedd: every test under org.openmetadata.service.rdf, plus SearchIndexHandlerTest, DataContractFieldSupportTest, EntityRepository*Test, McpServerResourceTest, McpServiceResourceTest, SearchRepositoryBehaviorTest: 747 run, 0 failed.

Backend integration tests

  • Ported RdfEntityDiffWriteIT (its own Fuseki container): 5/5 pass.
  • RDF lane, run locally with mvn verify -pl :openmetadata-integration-tests -Pmysql-elasticsearch -DintegrationTests.lane=parallel -DenableRdf=true -Dit.test='Rdf*IT,GlossaryRdfImportIT' (2.0's CI does not run the RDF ITs): 181 run, 10 failed, 2 skipped.
    • 1 was RdfEntityDiffWriteIT's column-tag test, adapted in f5333c1fedd (above).
    • The other 9 fail identically on plain 2.0 (fb2dd3787fb, this branch's base) with the same command: RdfResourceIT (4), RdfRelationExclusionsIT (2), RdfGraphExploreIT (1), RdfTagsTierCertificationIT (2). They are pre-existing on 2.0, not caused by this backport.
    • Passing classes include RdfBlueGreenRebuildIT (26), RdfLiveWriteRecoveryIT (22), RdfStorageMaintenanceIT (14), RdfReindexFailuresIT (13), RdfStorageReadinessIT, RdfMaintenanceRecoveryIT, RdfGlossaryGraphIT, RdfFusekiAuthorizationIT, RdfLiveProjectionIT.
    • 2.0's postgres-rdf-tests profile pins secoresearch/fuseki:5.5.0, which rejects updates with 405, so it was not used.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

Disk-growth benchmark, measured on 2.0 (separate from #37069's main numbers, which used 300-column tables 2.0 does not project).

  • Code: production code at f5333c1fedd (unchanged in 1f2fd8d6e48, which only adapts the harness, the script and the decision record).
  • Image: openmetadata/fuseki:6.2.0-c75b095 (sha256:a763a77a393a63e13609fb1185d28edfc2b334319a38dd0b3db5332c6f9ed42b), one throwaway container on port 3032 with two datasets: REPLACE into openmetadata_a, DIFFERENCE into openmetadata. Removed afterwards.
  • Workload: scripts/rdf-live-update-benchmark.sh with PROPERTIES=300: 200 tables of 300 custom properties each, 5 rounds, so 1,000 writes per scenario. The dataset is compacted before each scenario, and disk is the dataset directory's growth (du -sk).
Scenario Replace: disk / write Difference: disk / write Update requests Payload
Unchanged 10.9 MB 0 1000 → 0 227 MB → 0
One custom property changed 10.9 MB 235 KB 1000 → 1000 227 MB → 0.5 MB
New description 11.1 MB 188 KB 1000 → 1000 227 MB → 0.4 MB
  • Outcomes: REPLACE 3,000 replaced; DIFFERENCE 1,000 unchanged and 2,000 changed_triples, none corrected.
  • Dataset size at the end: 11.2 GB for REPLACE and 287 MB for DIFFERENCE.
  • Graph equivalence: both datasets' knowledge graphs, exported as N-Triples, hold the same 243,207 triples (no blank nodes; sorted SHA-256 51542fd3…fb10f6 for both).

UI screen recording:

Not applicable — backend-only change with no UI.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: I updated the migration scripts or explained why it is not needed. Not applicable: no schema change.
  • For a UI feature or feature task: Not applicable: backend only.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • Self-review: the code is Fixes #36671: Live RDF entity writes send only the changed triples #37069's, reviewed there. For this port I reviewed the conflict resolutions and 2.0 adaptations above against origin/2.0; no 🔴.
  • Decision check: carries docs/decisions/2026-11-03-live-rdf-entity-writes-send-only-the-changed-triples.md, with a 2.0 note.
  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

…ackport 2.0 #37069)

Backport of #37069, adapted to 2.0:

- 2.0 has no InferenceInvalidatingRdfStorage or AssertedGraphTrackingRdfStorage (main-only,
  from #28042 and #35201), so their changes and tests are left out.
- 2.0 does not project table columns as resources, so RdfPropertyMapper keeps only the named
  list cells, and the two tests that relied on column triples use extension properties or
  the 2.0 counts instead.
- The new tests use 2.0's JsonLdTranslator constructor and JenaFusekiStorage.isTimeoutError,
  now package-private for the circuit-breaker test.
- The ADR and the production setup guide drop the inference statements that do not apply.

(cherry picked from commit d811bd7)
…ustom properties

2.0 has no FusekiTestImage and does not project a table's columns, so the
wide-table test changes a table tag on a table with 200 custom properties.
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@fmcardoso fmcardoso added the safe to test Add this label to run secure Github workflows on PRs label Nov 5, 2026
@fmcardoso
fmcardoso marked this pull request as ready for review November 5, 2026 15:36
@fmcardoso
fmcardoso requested a review from a team as a code owner November 5, 2026 15:36
@fmcardoso
fmcardoso requested review from yan-3005 and removed request for a team November 5, 2026 15:36
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

2.0 does not project a table's columns, so the disk-growth harness builds tables
with 300 custom properties and changes one per write instead of moving a column
tag. The decision record gains the 2.0 measurement.
@gitar-bot

gitar-bot Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🔴 High risk · Switching live RDF writes to difference updates with read-back repair could leave stored entity projections inconsistent if an interference case is missed.

Backports the live RDF entity write fix to 2.0 so writes send only the changed triples (or nothing when unchanged), with a read-back replacement when a queued write interferes. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@fmcardoso
fmcardoso merged commit 6f96719 into 2.0 Nov 6, 2026
80 of 92 checks passed
@fmcardoso
fmcardoso deleted the fix/36671-live-rdf-diff-writes-2.0 branch November 6, 2026 09:39

This branch was successfully deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce Fuseki disk growth by writing only changed RDF triples

2 participants