Repository navigation
fix(rdf): reclaim Fuseki disk via compaction + upgrade Jena 4.10 → 5.6.0 - #28242
Conversation
PR #28117's SPARQL cleanup converged the logical RDF state but never freed disk: TDB2 deletes only mark blocks free and the journal grows monotonically until /$/compact runs. RdfIndexApp.clearRdfData() now calls a new RdfStorageInterface.compactStorage() between clearAll() and reloadOntologies() so each recreate run reclaims to a fresh dataset directory. JenaFusekiStorage posts to /$/compact/{dataset}?deleteOld=true and polls /$/tasks/{id} until finished, with failures logged and swallowed (disk hygiene, not correctness). Also unifies the Jena classpath: openmetadata-service was on 4.10.0 and openmetadata-integration-tests on 5.0.0. Both now pin to 5.6.0 via a single root pom property, dropping the apache-jena-libs BOM in favour of explicit jena-core/arq/rdfconnection deps (we're a remote-Fuseki client and never embed TDB; pulling jena-tdb1/2 triggers a Jena 5/6 static-init regression). Picks up CVE-2025-49656 and CVE-2025-50151 (admin-side fixes shipped in Jena 5.5.0). Jena 6.x parked: both 6.0.0 and 6.1.0 hit a recursive clinit bug where TypeMapper.reset reads RDF.dtLangString before RDF.<clinit> completes. Fuseki server bumped 4.10/5.0 → 5.6.0 across all in-repo Dockerfiles; the unmaintained stain/jena-fuseki:* image references in dev compose files switched to building from docker/rdf-store/Dockerfile, and Testcontainers moved to secoresearch/fuseki:5.5.0 (maintained, CVE-fixed; the dataset is created by JenaFusekiStorage.ensureDatasetExists() so the stain-only FUSEKI_DATASET_1 env var is no longer needed). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Follow-up to #28117 that fixes the unbounded Fuseki PVC growth observed across weekly re-index runs and unifies the Apache Jena classpath. RDF re-index now invokes Fuseki's /$/compact?deleteOld=true admin endpoint between clearAll() and reloadOntologies(), and the project standardizes on Jena 5.6.0 (server-side Fuseki images and client-side libs), replacing the unmaintained stain/jena-fuseki image with the in-repo Dockerfile build and secoresearch/fuseki:5.5.0 for tests.
Changes:
- Adds
compactStorage()to the storage interface, implements it for Fuseki with bounded polling on/$/tasks/{id}, and wires it intoRdfIndexApp.clearRdfData()(only onrecreateIndex=true). - Upgrades Apache Jena from 4.10.0 / 5.0.0 → 5.6.0 (single root pom property), switching
openmetadata-serviceto explicitjena-core+jena-arq+jena-rdfconnectiondeps to avoid TDB1/2 static-init failures. - Bumps all in-repo Fuseki Dockerfiles to 5.6.0 and migrates dev/quickstart compose files plus Testcontainers off
stain/jena-fuseki(using local build for compose,secoresearch/fuseki:5.5.0for integration tests).
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Adds project-wide jena.version=5.6.0 property. |
| openmetadata-service/pom.xml | Drops apache-jena-libs BOM in favor of explicit Jena 5.6.0 client deps. |
| openmetadata-integration-tests/pom.xml | Aligns Jena to ${jena.version}; switches test container image to secoresearch/fuseki:5.5.0. |
| openmetadata-service/.../RdfStorageInterface.java | Adds default no-op compactStorage() with Javadoc. |
| openmetadata-service/.../JenaFusekiStorage.java | Implements compaction via /$/compact admin POST + /$/tasks/{id} polling; extracts parseDatasetEndpoint and addBasicAuth helpers. |
| openmetadata-service/.../RdfRepository.java | Thin compactStorage() wrapper gated on isEnabled(). |
| openmetadata-service/.../RdfIndexApp.java | Runs compaction between clearAll and reloadOntologies on recreate. |
| openmetadata-service/.../RdfIndexAppTest.java | Updated test for new ordering + new test that compaction is skipped on incremental runs. |
| openmetadata-integration-tests/.../RdfGlossaryGraphIT.java, GlossaryOntologyExportIT.java, TestSuiteBootstrap.java | Switch Testcontainers Fuseki image; drop FUSEKI_DATASET_1 env. |
| docker/rdf-store/Dockerfile, docker/docker-compose-quickstart/Dockerfile.fuseki-* | Bump FUSEKI_VERSION to 5.6.0. |
| docker/docker-compose-quickstart/docker-compose-{rdf,fuseki-standalone,fuseki-rosetta}.yml, docker/development/docker-compose-fuseki.yml, docker-compose-postgres-fuseki.yml | Switch from stain/jena-fuseki image to in-repo Dockerfile build; rename env var; update mount path to /fuseki-data. |
| docker/docker-compose-quickstart/start-rdf-services.sh | Comment update reflecting new build context. |
Comments suppressed due to low confidence (2)
openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/JenaFusekiStorage.java:1090
- The poll loop sleeps before each request, which means even a compaction that finished by the time we issued the POST will still incur a 2-second wait before being detected. Consider polling once immediately after starting the task and then sleeping between subsequent polls, so fast/no-op compactions complete quickly.
while (System.currentTimeMillis() < deadline) {
Thread.sleep(COMPACT_POLL_INTERVAL_MS);
openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/JenaFusekiStorage.java:1080
extractTaskIdandisTaskFinishedallocate a freshHttpClientperstartCompaction/waitForCompactionTaskcall and otherwise look upJsonUtils.readTreefrom the response body, but they catchException(a very broad net) instead ofIOException/JsonProcessingException. Narrowing the catch would avoid masking unrelated runtime bugs (e.g., NPEs from a refactor inJsonUtils). Minor maintainability nit.
} catch (Exception e) {
LOG.debug("Could not parse taskId from Fuseki compaction response: {}", responseBody, e);
return null;
}
- Dockerfile sets FUSEKI_BASE=/fuseki so the bundled shiro.ini is actually loaded. Without it, Fuseki falls back to its default base and admin endpoints (including the new /$/compact and /$/datasets) are reachable without authentication — FUSEKI_ADMIN_PASSWORD was being silently ignored. - Rename the named volume `fuseki-data` -> `fuseki-tdb2-data` and the host bind paths in the rosetta/standalone compose variants. The new layout stores TDB2 at /fuseki-data and is structurally different from stain's old /fuseki layout; reusing the old volume name silently mounted stale state at a path Fuseki no longer reads from, looking like an empty database. A fresh volume name forces operators to consciously migrate (or accept a re-index). - JenaFusekiStorage.addBasicAuth now encodes via StandardCharsets.UTF_8 per RFC 7617 (was relying on the JVM default charset). - compactStorage handles InterruptedException explicitly and re-asserts Thread.currentThread().interrupt() so a Quartz shutdown signal isn't silently swallowed by the surrounding catch block. - Narrow the broad `catch (Exception)` in extractTaskId/isTaskFinished to JsonParsingException (the actual unchecked type JsonUtils.readTree throws); polling I/O failures catch java.io.IOException specifically. - Compaction poll loop restructured to check immediately on the first iteration and sleep only between subsequent polls. For the common recreateIndex=true case (compacting a logically empty dataset) the task finishes near-instantly and we no longer waste the first 2s. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Last review pass flagged the new compaction catch blocks using java.io.IOException and org.openmetadata.schema.exception.JsonParsingException as fully-qualified names — inconsistent with the rest of the file (which imports ConnectException, ClosedChannelException, etc.) and against CLAUDE.md's "do not use Fully Qualified Names in code — import the class instead". Adds explicit imports and replaces the FQN usages. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Probing the affected customer instance (Novartis pov) surfaced three custom glossary relation types — `definedby`, `enabledby`, `enrollsin` — with `rdfPredicate=null` in GlossaryTermRelationSettings. The writer (getGlossaryTermRelationPredicate) handles this by falling back to `https://open-metadata.org/ontology/<typeName>`, but the previous reader fix only included configured types where `rdfPredicate != null`, so those three predicates kept getting filtered out of /rdf/glossary/graph even after the prior commit. Symptom: only edges with `relatedTo` (default type, in the hardcoded list) appeared on the Relations Graph tab; everything custom-named stayed invisible — exactly what image-v9 confirms. Mirror the writer's fallback in buildGlossaryTermGraphQuery: if rdfPredicate is null but the type has a non-blank name, add `<https://open-metadata.org/ontology/<name>>` to the FILTER list. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Companion to the existing customRdfPredicateRelationSurfacesInGraphEndpoint test. That one exercises configured types with an explicit rdfPredicate URI; this one exercises the case the affected customer instance actually had — custom relation types registered in GlossaryTermRelationSettings WITHOUT a populated rdfPredicate (Novartis pov had `definedby`, `enabledby`, `enrollsin` all stored as rdfPredicate=null). Reproduced the exact failure end-to-end against a freshly-built local stack populated from the remote (5 glossaries, 79 terms, the 3 custom relation types with null rdfPredicate plus their relations). Pre-fix the reader filter dropped `om:enrollsin` and `om:definedby` triples — graph endpoint returned 0 edges between Audience and its related terms even though Fuseki had 4 triples and the DB had the relations. Post-fix the same query returns the 2 expected edges (one per directed pair; the endpoint deduplicates inverses). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Six fixes from the most recent review pass: 1. extractPredicateName round-trips configured type name. Previously the reader took the URI's last path segment as the relation type, so a configured `enrolledIn` mapped to `https://acme.com/ns#enrolls` surfaced as `enrolls` on the graph endpoint — losing the user's chosen type name. Failing IT (regressionCustomRel + custom path /customRel) exposed this. Now extractPredicateName checks GlossaryTermRelationSettings for a matching rdfPredicate before falling back to the URI local name, so the type name round-trips correctly. 2. compactStorage honors the circuit breaker. Added a throwIfCircuitOpen-equivalent check at the top of compactStorage. When Fuseki is unreachable the breaker is already open; running compact would burn its two-call budget hitting timeouts on the same dead server. Skipping is the right behavior, mirroring the other methods that throwIfCircuitOpen. 3. Mask userInfo in log statements. parseDatasetEndpoint now preserves embedded credentials so admin calls reach the server with the right auth. The flip side is the resulting URL must NOT hit logs verbatim — added a maskUserInfo helper that replaces `user:pass@` with `***@` and used it everywhere endpoint / serverBaseUrl is logged. 4. Typed RdfStorageCircuitOpenException replaces string-matching. isCircuitBreakerOpen in RdfBatchProcessor used to grep the exception message for "RDF circuit breaker is open" — that coupled callers to a specific log phrasing. Replaced with a public exception type that throwIfCircuitOpen throws; the fallback path now instanceof-checks it. 5. bulkCreateOrUpdate semantics doc clarified. The previous "all-or-nothing" wording was true from the caller's perspective (one thrown exception = retry whole batch) but glossed over the two-phase implementation (combined DELETE + combined GSP POST, non-atomic if the second call fails after the first commits). Documented the gap and that the per-entity fall-back is the self-healing mechanism. 6. Stop-signal coverage in the bulk path documented. The bulk path is one SPARQL UPDATE + one GSP POST per batch, so a mid-batch stop check doesn't apply (no checkpoint to break at). The pre-batch and per-iteration-of-fallback checks together preserve the prior loop's behavior; documented inline. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…okups Gitar review caught two new `catch (Exception)` blocks the prior commit added in RdfRepository — one in buildGlossaryTermGraphQuery's settings-aware predicate-list assembly, one in extractPredicateName's predicate-name round-trip. SettingsCache.getSetting surfaces every failure (cache miss / cast / I/O) as EntityNotFoundException — a RuntimeException — so RuntimeException is the precise type to catch. Narrowing avoids accidentally swallowing programmer-error throwables (NPE, ClassCast) that signal a real bug rather than a transient cache miss, matching the project's "no `catch (Exception e)`" coding standard. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
… etc.
Seven fixes from the latest Copilot review pass:
1. Mark job COMPLETED *before* compactStorage, not after.
compactStorage blocks up to COMPACT_MAX_WAIT_MS (10 min) polling
/$/tasks/{id}. Doing it before the status update delayed the websocket
"done" notification by however long compaction took, and a misbehaving
Fuseki could leave the run looking RUNNING for up to 10 minutes after
the reindex actually finished. Order now: COMPLETED → compactStorage,
so completion surfaces immediately and the hygiene step runs as the
very last thing.
2. compactStorage's outer catch broadened to RuntimeException.
The Javadoc promises "Failures are logged and swallowed — degraded disk
reclamation must not fail the re-index", but the previous outer try
only caught InterruptedException + IOException. Any
IllegalArgumentException, RdfStorageCircuitOpenException (state flip
mid-call), CompletableFuture-wrapped RuntimeException, etc. would
propagate up and demote a successful indexer run to FAILED. Added a
catch (RuntimeException) so the documented best-effort semantics hold.
3. Hoist URL userInfo into Authorization header instead of leaving it
embedded in the request URI.
parseDatasetEndpoint previously returned a serverBaseUrl containing
`user:pass@host:port` so embedded auth would reach the admin endpoints.
That left credentials in the URL passed to HttpClient — which can leak
via JDK HttpClient debug logging or downstream proxies. Now
parseDatasetEndpoint splits userInfo OUT into a separate field on
DatasetEndpoint; serverBaseUrl is credential-free; the admin HTTP path
uses a new 3-arg addBasicAuth overload that prefers explicit
username/password and falls back to userInfo from the URL, encoding
either into the Authorization header.
4. URL-encode datasetName + taskId before interpolating into request URIs.
startCompaction built `/$/compact/<datasetName>` and waitForCompactionTask
built `/$/tasks/<taskId>` via raw concatenation. A dataset name (or
future task id from a server that uses non-trivial identifiers) with
any URL-reserved character would corrupt the URL. New encodePathSegment
helper handles this with the same UTF-8 + space-as-%20 convention.
5. Compose files use ${FUSEKI_ADMIN_PASSWORD:-admin} indirection.
Four dev/quickstart compose files (docker-compose-fuseki.yml,
docker-compose-postgres-fuseki.yml, docker-compose-fuseki-rosetta.yml,
docker-compose-fuseki-standalone.yml) previously had the literal
`FUSEKI_ADMIN_PASSWORD=admin` baked in. Operators couldn't override
without editing the compose file. Now they pass through the env var
if set, with `admin` only as the local-dev default. Same for
FUSEKI_OPENMETADATA_PASSWORD. A leading comment block warns that
production deployments MUST override.
6. Entrypoint honors FUSEKI_RENDER_SHIRO=false escape hatch.
The previous entrypoint unconditionally overwrote /fuseki/shiro.ini
from the template, clobbering a bind-mounted custom shiro.ini.
Operators who need a fully custom Shiro config can now either:
- bind-mount onto /fuseki/shiro.ini AND set FUSEKI_RENDER_SHIRO=false
(skip the render), OR
- bind-mount onto /fuseki/shiro.ini.template (render their template
with the standard FUSEKI_ADMIN_PASSWORD envsubst)
Default behavior unchanged for everyone else.
7. Test ordering still verified.
RdfIndexAppTest's InOrder assertion was unchanged by point #1 — it
asserts compactStorage WAS called twice on a recreate run, regardless
of where in the sequence the COMPLETED status update lands. All 203
RDF unit tests still pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java:1295
- The settings-aware predicate expansion is only added in the
elsebranch (when norelationTypesfilter is supplied). When a caller does pass arelationTypesfilter — including with a custom type name like?relationTypes=enrolledIn— execution goes through theifbranch which callsgetRelationPredicate(trimmed). That helper has no awareness ofGlossaryTermRelationSettings, lowercases the input (relType.trim().toLowerCase()at line 1292), and falls back to"om:" + relationTypewith the lowercased name. So a filter by a custom type configured withrdfPredicate=nullwill produceom:enrolledin(lowercase) while the writer stored the triple athttps://open-metadata.org/ontology/enrolledIn(original case) — the predicates won't match and the edge is still filtered out. Custom types configured with an explicitrdfPredicatealso aren't honored on this filtered path at all. Consider also consulting settings ingetRelationPredicate/buildGlossaryTermGraphQuery's filtered branch to fully fix the writer/reader symmetry.
List<String> relationPredicates = new ArrayList<>();
if (relationTypes != null && !relationTypes.isEmpty()) {
for (String relType : relationTypes.split(",")) {
String trimmed = relType.trim().toLowerCase();
relationPredicates.add(getRelationPredicate(trimmed));
}
} else {
…ame cache
Five fixes from review 4314989032:
1. Atomic bulk entity writes (single SPARQL UPDATE transaction).
Previously bulkStoreEntities issued (a) a SPARQL UPDATE with the
combined DELETE statements, then (b) a GSP POST to load the unioned
model. Atomic at the per-call level but NOT atomic across the pair: a
failed (b) after a committed (a) left the dataset in a half-applied
state — every entity's prior translator-managed predicates gone but
the new triples never landed. Now both halves run inside ONE multi-
statement SPARQL UPDATE: `DELETE ...; INSERT DATA { GRAPH <...> {
N-Triples body } }`. Fuseki executes multi-statement UPDATEs in a
single transaction so the batch commits atomically or rolls back
entirely. Also collapses the prior 2 HTTP calls per batch to 1.
2. FUSEKI_OPENMETADATA_PASSWORD pass-through in docker-compose-rdf.yml.
The other four migrated compose files (fuseki.yml, postgres-fuseki.yml,
fuseki-standalone.yml, fuseki-rosetta.yml) all expose both
FUSEKI_ADMIN_PASSWORD and FUSEKI_OPENMETADATA_PASSWORD; this one only
had ADMIN. Operators using the quickstart compose had no way to
override the service-account password from the env. Symmetrized.
3. Document the predicate-shape failure caveat in the bulk fallback.
The per-entity fallback isolates bad-ROW failures (one entity emits a
model the writer can't serialise) but NOT bad-PREDICATE failures (a
configured custom predicate URI contains a SPARQL-unsafe character so
every entity in the batch hits the same parse failure). The Javadoc
previously over-promised on isolation; added an inline caveat.
4. Cycle-safe isCircuitBreakerOpen.
The cause-chain walk only guarded against single-hop self-cycles
(next == cause). Multi-hop cycles (A→B→A) would loop forever. Now
uses an IdentityHashMap-backed visited set so any cycle is detected.
5. Per-request predicate-name cache.
extractPredicateName was called per-edge and walked the full
relationTypes list with a regex+concat (expandPredicateCurie) per
iteration on every call. parseGlossaryTermGraphResults now builds the
URI→name map ONCE per request via buildPredicateUriToNameMap and
stashes it on a ThreadLocal that extractPredicateName reads. Cleared
in finally so it can't leak across requests. Turns the inner-loop
work from O(edges × relationTypes) to O(edges).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Adds 27 unit tests covering the package-private helpers on JenaFusekiStorage that all the admin HTTP paths depend on: parseDatasetEndpoint, maskUserInfo, encodePathSegment, extractTaskId, isTaskFinished. These methods do credential handling and URL parsing on config-supplied input, so getting them wrong corrupts every admin call — and the class itself has too many heavy dependencies (Jena, Fuseki HTTP) to spin up in a unit test. Made the five helpers (and the DatasetEndpoint record) package-private so the test class in the same package can reach them without reflection. Coverage: - parseDatasetEndpoint: plain shape, service-path strip, no-port, embedded user:pass@ hoist (CRITICAL: serverBaseUrl must not carry credentials so JDK HttpClient debug / proxies don't leak them), URL-encoded userInfo round-trip, malformed URL, missing path, null. - maskUserInfo: strips user:pass@ to ***@, passes plain URLs unchanged, HTTPS+no-port, null, non-URL fallback path. - encodePathSegment: plain, space→%20 (not +), reserved-char escaping. - extractTaskId: typical response, string IDs, missing key, JSON null, blank body, malformed JSON. - isTaskFinished: completed (finished timestamp), still running, null/blank, malformed JSON. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ebug
Two from review 4315040144:
1. bulkCreateOrUpdate Javadoc now matches the implementation. The previous
wording described a two-call non-atomic path (combined DELETE +
separate GSP POST) and warned about INCONSISTENT state if the second
call failed — but the storage layer has since been rewritten to run
the whole batch as ONE SPARQL UPDATE (DELETE statements + INSERT DATA
in a single Fuseki transaction). The stale doc would have misled
future maintainers about the failure semantics.
2. The "RDF Edge: ... predicateUri=... extractedType=... label=..." log
inside parseGlossaryTermGraphResults fired once per edge in the SPARQL
result set — hundreds of INFO lines per request on a typical graph
response. Downgraded to DEBUG to match the per-batch DEBUG choice in
JenaFusekiStorage.bulkStoreEntities; the per-request summary log
("RDF query returned {} nodes and {} edges") still emits at INFO for
ops visibility.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Pins the three branches of processEntities that prior reviews flagged as the highest-complexity uncovered logic on the bulk-write fast path: bulk success, bulk failure -> per-entity recovery, and bulk failure + tripped circuit breaker -> fallback SKIPPED. Also covers the cause-chain walk in isCircuitBreakerOpen so a breaker exception wrapped by RdfRepository.bulkCreateOrUpdate's RuntimeException re-throw is still detected, plus stop-signal short-circuits before and during fallback. The per-entity fallback test uses lenient() on the doThrow for the bad entity because MockitoExtension's strict stubbing would otherwise throw PotentialStubbingProblem on createOrUpdate calls for the *good* entities (arg doesn't match the stubbed value), which the fallback's catch (Exception) would treat as entity failures and silently skew the success/failure counts the test asserts on. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Four small follow-ups for the still-open review comments: * RdfIndexApp.compactStorage() call wrapped in its own try/catch so a future storage backend that does NOT honor the swallow-failures contract (or an NPE racing the isEnabled() check) cannot demote a job that's already been marked COMPLETED to FAILED via the outer handleJobFailure() path. * RdfRepository: extracted resolveConfiguredTypeUri(rdfPredicate, name) helper and used it at both call sites in buildGlossaryTermGraphQuery and buildPredicateUriToNameMap. Single source of truth for the settings-driven URI shape — the duplicated `expandPredicateCurie(...) else "https://open-metadata.org/ontology/" + name` branches were identical but reviewers (rightly) flagged the drift risk. * JenaFusekiStorage.waitForCompactionTask: added a deadline re-check AFTER each HTTP send. With COMPACT_HTTP_TIMEOUT=30s, a server that hangs every poll could overrun COMPACT_MAX_WAIT_MS by ~30s before the next loop-top check fired; the post-send guard breaks promptly. * Renamed docker/rdf-store/shiro.ini -> shiro.ini.template (source side was misleading — file is unusable without envsubst and someone mounting just `shiro.ini` would silently end up with the literal string `${FUSEKI_ADMIN_PASSWORD}` as the admin password). Updated Dockerfile COPY and added a prominent TEMPLATE FILE header inside the file itself. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Code Review ✅ Approved 5 resolved / 5 findingsImplements Fuseki disk compaction, bulk entity processing, and Jena 5.6.0 upgrades to resolve disk growth and graph visibility issues. Resolved findings include updating charset handling, cleaning up exception imports, and adjusting logging levels. ✅ 5 resolved✅ Quality: addBasicAuth uses platform-default charset for Base64 encoding
✅ Quality: Fully-qualified exception names used instead of imports
✅ Performance: LOG.info in bulkStoreEntities will be very noisy during reindex
✅ Quality: Generic Exception catch violates project coding standards
✅ Quality: Null-endpoint test asserts nothing definitive
OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|
🟡 Playwright Results — all passed (16 flaky)✅ 4136 passed · ❌ 0 failed · 🟡 16 flaky · ⏭️ 86 skipped
🟡 16 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |



Describe your changes:
Follow-up to #28117. That PR converged the logical RDF state on every re-index (CLEAR ALL, per-source DELETE WHERE, glossary-term cleanup), but on Apache Jena TDB2 those operations only mark blocks free and the write-ahead journal grows monotonically — disk usage never shrinks. After deploy, customer (Novartis pov) reported the Fuseki PVC still climbing (~50 GB on ~2 k entities) and the Relations Graph tab showing source nodes alone, no edges, even though the Overview tab listed the related terms correctly.
End-to-end repro against the customer's data: 5 glossaries, 101 terms, 13 relation types in
GlossaryTermRelationSettings— three of which (definedby,enabledby,enrollsin) hadrdfPredicate=null. This PR fixes the disk-reclamation issue, drags the Jena client + server forward, and resolves the custom-predicate read-side bug that made the customer's Relations Graph empty.Type of change:
High-level design:
Compaction wiring (disk reclamation)
RdfStorageInterface.compactStorage(), default no-op (QLever stub).JenaFusekiStorage.compactStorage()POSTs to{server}/$/compact/{dataset}?deleteOld=true, extracts the task id, polls/$/tasks/{taskId}untilfinished(10 min budget). Honors the circuit breaker, masksuserInfoin logs, swallows failures (degraded disk hygiene, not correctness).RdfRepository.compactStorage()thin wrapper, gated onisEnabled().RdfIndexApp.execute()now compacts at two points: inclearRdfData()betweenclearAll()andreloadOntologies()(so the next reingest writes into an empty dataset directory), and at the end of every successful run (recreate or incremental) so the journal/free-list never accumulate across weeks.Bulk entity writes (indexer speedup)
RdfStorageInterface.bulkStoreEntities(List<EntityWriteRequest>)with default per-entity-loop implementation for backward compatibility.JenaFusekiStorage.bulkStoreEntitiescollapses N entities into 2 HTTP calls (combined SPARQL UPDATE for the predicate-scoped DELETEs, then GSP POST for the unioned RDF model).RdfRepository.bulkCreateOrUpdate(List<EntityInterface>)translates the batch and forwards to the storage layer.RdfBatchProcessor.processEntitiestries bulk first; on exception falls back to per-entity for stats granularity, withRdfStorageCircuitOpenExceptionshort-circuiting the fallback when the breaker is tripped (avoids N noisy failures on a dead server).Custom-predicate Relations Graph fix
buildGlossaryTermGraphQuerywas hardcoded to the built-in CURIE list (om:relatedTo,skos:broader, …) and silently dropped every custom-typed edge. Now readsGlossaryTermRelationSettings, expands each configuredrdfPredicateto a full IRI and appends to the FILTER list. WhenrdfPredicate=null(the actual customer config fordefinedby/enabledby/enrollsin), mirrors the writer'som:<name>fallback so those triples are surfaced too.extractPredicateNamenow round-trips the user's configured type name: instead of taking the URI's last path segment (which would turnhttps://acme.com/ns#enrollsintoenrollswhen the type is namedenrolledIn), it looks up the matching type in settings and returns the configured name.Apache Jena 4.10.0 → 5.6.0
<jena.version>5.6.0</jena.version>, single source of truth for bothopenmetadata-serviceandopenmetadata-integration-tests. Drops theapache-jena-libsBOM in favour of explicitjena-core+jena-arq+jena-rdfconnection— pulling injena-tdb1/2would trigger a Jena 5.x static-init failure and we never embed TDB. Verified viamvn dependency:treethat all needed transitive modules (jena-base, jena-iri3986, jena-iri, jena-langtag) still resolve.TypeMapper.resetreadsRDF.dtLangStringmid-clinit).Fuseki server 4.10/5.0 → 5.6.0
openjdk:17-jdk-slimtoeclipse-temurin:17-jre-jammy.image: stain/jena-fuseki:*tobuild: { context: ../rdf-store }withimage: openmetadata-fuseki:5.6.0tag.stain/jena-fusekiis unmaintained and missing the 2025 CVE fixes.docker/rdf-store/DockerfilesetsFUSEKI_BASE=/fusekiso shiro.ini is actually loaded (previously the env wasn't set and the bundled shiro.ini was silently ignored → admin endpoints reachable without auth).envsubstsFUSEKI_ADMIN_PASSWORDandFUSEKI_OPENMETADATA_PASSWORDinto shiro.ini at container start (Apache Shiro's INI realm doesn't interpolate${VAR}natively), restoring env-var-driven password overrides while keepingadmin/openmetadata-secretdefaults.fuseki-data→fuseki-tdb2-data(with host bind paths) so the layout migration is explicit, not silent.Integration tests
stain/jena-fuseki:latest(5.1.0, missing CVE fixes) tosecoresearch/fuseki:5.5.0.RdfGlossaryGraphIT.customRdfPredicateRelationSurfacesInGraphEndpointtest: registers a custom relation type via the settings API, points two terms at each other through it, asserts the graph endpoint returns the edge with the configured type name. Locks down the writer/reader symmetry the previous bug broke.RdfGlossaryGraphIT.customRelationWithNullRdfPredicateSurfacesInGraphEndpoint: same scenario but withrdfPredicate=null(the customer's exact config).RdfIndexAppTestupdated to assert compactStorage fires twice on a recreate run (pre-reindex + end-of-run) and once on incrementals.Alternatives considered
apache-jena-libsBOM at 5.6.0 — pulls injena-tdb1whose subsystem init triggers the same family of static-init NPE on the first touch ofRDF.Alt. Explicit deps avoid it and trim the wire surface.tdb2.tdbcompactCLI — requires Fuseki shutdown; impractical in production. The/$/compactREST endpoint works online and is supported by every Fuseki version we deploy.Backward-compatibility
compactStorage(),bulkStoreEntities(),bulkCreateOrUpdate()are additive interfaces with default fallbacks where applicable.docker volume rm fuseki-dataafter confirming the new stack is healthy. Documented inline.Tests:
Use cases covered
RdfIndexAppre-index withrecreateIndex=true: clears + compacts + reloads ontology + reindexes + compacts again — in that exact order.RdfIndexAppre-index withrecreateIndex=false: skipsclearAll/reloadOntologies, still fires end-of-run compactStorage.JenaFusekiStorage.compactStorage()swallows failures so a missing/failing compact endpoint never fails the indexer.bulkStoreEntitieswrites ~1655 entities in 9s vs the prior per-entity path's ~5 min./rdf/glossary/graphreturns edges for both built-in and custom-rdfPredicate relation types, including the customer'srdfPredicate=nullcase.Unit tests
RdfIndexAppTest.testExecuteClearsRdfDataWhenRecreateIndexEnabled— InOrder assertion enforces clearAll → compactStorage → reloadOntologies → compactStorage.RdfIndexAppTest.testCompactStorageStillFiresOnIncrementalIndex— incremental runs still compact at the end.openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexAppTest.java.mvn -pl openmetadata-service test -Dtest='Rdf*').Backend integration tests
RdfGlossaryGraphIT.customRdfPredicateRelationSurfacesInGraphEndpoint— locks down the explicit-rdfPredicate path.RdfGlossaryGraphIT.customRelationWithNullRdfPredicateSurfacesInGraphEndpoint— locks down therdfPredicate=null→om:<name>writer-fallback path (the customer's actual config).openmetadata-integration-tests/src/test/java/org/openmetadata/it/tests/RdfGlossaryGraphIT.java.Manual testing performed
enrolledInandenrollsfor theAudience/Channelpair afterRdfIndexApp recreate.-e FUSEKI_ADMIN_PASSWORD='Pass-WITH-$@#!'against the rebuilt Fuseki image: custom password authenticates, defaultadmin/adminreturns 401.UI screen recording / screenshots:
Not applicable — the changes are backend-side. The customer's image-v6 (broken Relations Graph showing source node alone) now renders all edges including the custom-typed
enrolledIn/enrollsin/definedby/enabledbyones.Checklist:
🤖 Generated with Claude Code
Summary by Gitar
RdfBatchProcessorTestto validate bulk-write error handling, per-entity fallback isolation, and circuit-breaker short-circuiting logic.isCircuitBreakerOpencorrectly identifies wrapped exceptions in the cause chain to prevent redundant per-entity retries during outages.This will update automatically on new commits.