Skip to content

fix(rdf): properly index Dashboard/DashboardDataModel/Table/StoredProcedure in the knowledge graph (#29211) - #29326

Merged
harshach merged 3 commits into
mainfrom
harshach/rdf-reindex-reader-failures-29211
Jun 23, 2026
Merged

harshach merged 3 commits into
mainfrom
harshach/rdf-reindex-reader-failures-29211

Conversation

@harshach

@harshach harshach commented Jun 22, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #29211 — RDF reindex reports high "failed records" for Dashboard / DashboardDataModel / Table / StoredProcedure (up to ~94%) with no diagnostic, and these entities end up missing/under-represented in the knowledge graph.

Investigation (what was ruled out)

  • Not the field set. DashboardDataModel and StoredProcedure request the exact same reindex fields as DatabaseSchema (the COMMON set: owners, domains, reviewers, followers, votes, extension, tags, certification, dataProducts) — yet fail ~94% / ~15% while DatabaseSchema is 0%. So a requested field isn't the cause; the divergence is per-entity-type code/data.
  • Not serialization. Verified Jena's model.write(N-TRIPLES) + UpdateFactory.create is robust to spaces / <> / quotes / unicode / control chars in IRIs and literals — they're escaped and parse fine. The "bad-IRI breaks SPARQL" theory is false.
  • Not the write path. RdfPropertyMapper.mapEntityToRdf swallows exceptions and Fuseki returns 200/204; per-entity write failures log the UUID (which the reporter's RDF-only log grep missed).

The failures are reader-side: an entity that fails to fully hydrate during reindex was turned into an EntityError and dropped from RDF entirely — a single unresolvable relationship in the field-set takes the whole entity out of the graph.

Fixes

  1. Surface reader failures (RdfPartitionWorker): log each with entity id/FQN + reason (previously only a DEBUG line under EntityRepository, invisible to an RDF-scoped log filter).
  2. Resilience / the indexing gap: re-index entities that deserialized but failed field resolution using their core stored data (edges are still rebuilt from the DB) instead of dropping them. Only rows that can't be deserialized at all remain hard failures. This is what makes these entities show up in the graph.
  3. Context mapping: getContextName mapped dashboardDataModel and storedProcedure (+ searchIndex / apiEndpoint / apiCollection) to the minimal base JSON-LD context instead of dataAsset-complete — so they were translated with the wrong mapping. Route all data-asset types to dataAsset-complete.

Scope / risk

RDF-only; additive (only changes the handling of rows that were already failing); no change to the shared PaginatedEntitiesSource or the search-index path. RdfPartitionWorkerTest +5 cases, all 7 pass.

Honest note

The exact per-entity trip (a data-dependent strict resolve / edge case in one of these four repositories' bulk paths) couldn't be pinpointed statically — every individual resolver reads as lenient — and the reporter's logs weren't available. Fix #2 closes the gap regardless of the specific field by indexing core data; fix #1 surfaces the exact reason for any remaining hard failure.

🤖 Generated with Claude Code

Greptile Summary

This PR fixes high failure rates (~94%) for Dashboard, DashboardDataModel, Table, and StoredProcedure during RDF reindexing, and extends the same protection to SearchIndex, ApiEndpoint, and ApiCollection. Two root causes are addressed: (1) partially-hydrated entities were silently dropped from the graph with no diagnostic; (2) those entity types were mapped to the minimal base JSON-LD context instead of dataAsset-complete, causing them to be translated with the wrong schema.

  • RdfPartitionWorker: Reader failures are now split into "recoverable" (deserialized but field-resolution failed) and "unrecoverable" (couldn't deserialize). Recoverable entities are re-indexed with their core stored data rather than dropped; each failure is now logged at WARN/ERROR with entity id + FQN.
  • RdfPropertyMapper.getContextName: Five entity types that previously fell through to base are now routed to dataAsset-complete, ensuring correct JSON-LD mapping.
  • RdfPartitionWorkerTest: Five new test cases cover logReaderFailures priority logic, describeFailedEntity edge cases, and recoverableEntities filtering.

Confidence Score: 5/5

Safe to merge — changes are additive, scoped entirely to the RDF indexing path, and do not touch PaginatedEntitiesSource or the search-index pipeline.

The recovery logic correctly splits reader failures into recoverable/unrecoverable buckets, re-indexes core data for recoverable entities, and accumulates all counters accurately across both processing passes. The logReaderFailures representative-message selection (first dropped wins, first non-null fallback) is validated by dedicated tests. The context-mapping fix in getContextName is a straightforward case addition with no side effects on other entity types.

No files require special attention.

Important Files Changed

Filename Overview
openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/distributed/RdfPartitionWorker.java Core fix: adds recoverable-entity retry logic, per-failure logging with id/FQN, and correct lastError representative message selection. Counting arithmetic across both processing passes is correct.
openmetadata-service/src/main/java/org/openmetadata/service/rdf/translator/RdfPropertyMapper.java Context mapping fix: routes storedprocedure, dashboarddatamodel, searchindex, apiendpoint, and apicollection to dataAsset-complete instead of base.
openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/rdf/distributed/RdfPartitionWorkerTest.java Five new test cases cover logReaderFailures priority logic, describeFailedEntity edge cases, and recoverableEntities filtering.

Reviews (3): Last reviewed commit: "fix(rdf): pick the representative reader..." | Re-trigger Greptile

…29211)

The distributed RDF reindex counts entities the source cannot hydrate
(field-resolution / deserialization errors) as failed records, but
RdfPartitionWorker never logged them. The only trace was a DEBUG line in
EntityRepository.listAfterKeyset — or nothing at all for messages caught
by isEntityNotFoundError but not isStaleReferenceError (e.g. "Entity type
X not found"), which are logged at DEBUG yet still counted as failures.
Operators saw the failed-record count rise with no way to identify the
offending entities, and a log filter scoped to RDF class names found
nothing.

Mirror the search-index PartitionWorker.recordReaderFailures behaviour:
log each reader failure at ERROR with the entity id/FQN and reason, and
carry a representative message into the partition lastError so the job
error summary is non-empty when only reader errors occurred.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@github-actions

github-actions Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

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

…map data-asset types to dataAsset context (#29211)

Two indexing gaps that left Dashboard/DashboardDataModel/Table/StoredProcedure
under-represented in the knowledge graph:

1. Resilience: when the reindex source cannot fully hydrate an entity (one of the
   reindex field-set relationships fails to resolve), the row was turned into an
   EntityError and dropped from RDF entirely. Now, an entity that DESERIALIZED but
   failed field resolution is re-indexed with its core stored data (and its edges
   are still rebuilt from the DB by processBatchRelationships), so a single
   unresolvable field no longer leaves the whole entity missing from the graph.
   Only rows that cannot be deserialized at all remain hard failures.

2. Context mapping: getContextName mapped dashboardDataModel and storedProcedure
   (and searchIndex / apiEndpoint / apiCollection) to the minimal "base" JSON-LD
   context instead of "dataAsset-complete", so these data assets were translated
   with the wrong/empty mapping. Route every data-asset type to dataAsset-complete.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@harshach harshach changed the title fix(rdf): surface per-entity reader failures in distributed reindex (#29211) fix(rdf): properly index Dashboard/DashboardDataModel/Table/StoredProcedure in the knowledge graph (#29211) Jun 23, 2026
…data log wording

Address code review on the reader-failure surfacing:

- logReaderFailures returned the LAST EntityError's message, so a null final
  message blanked out the partition lastError (defeating the goal of a non-empty
  error summary), and a recoverable WARN could mask a genuine drop. Now prefer the
  first DROPPED (unrecoverable) failure's message, falling back to the first
  non-null message — lastError always describes a real drop when one occurred and
  is never null when any failure carried a message. Also surface recovered.lastError()
  in the lastError precedence so a failed recovery write isn't hidden.
- The recoverable WARN said "indexing core data only" before the recovery re-index
  actually runs; reworded to "attempting to index core data only" so it doesn't
  assert success the recovery write might not achieve.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

🟡 Playwright Results — all passed (13 flaky)

✅ 4017 passed · ❌ 0 failed · 🟡 13 flaky · ⏭️ 84 skipped

Shard Passed Failed Flaky Skipped
✅ Shard 1 0 0 0 0
✅ Shard 2 815 0 0 9
🟡 Shard 3 816 0 2 8
🟡 Shard 4 865 0 4 12
🟡 Shard 5 732 0 1 47
🟡 Shard 6 789 0 6 8
🟡 13 flaky test(s) (passed on retry)
  • Features/KnowledgeCenterList.spec.ts › Knowledge Center List - Verify Recently Viewed widget (shard 3, 1 retry)
  • Flow/FrequentlyJoined.spec.ts › should display frequently joined columns (shard 3, 1 retry)
  • Flow/PersonaFlow.spec.ts › Set default persona for team should work properly (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Timestamp (shard 4, 1 retry)
  • Pages/CustomProperties.spec.ts › Enum (shard 4, 2 retries)
  • Pages/CustomProperties.spec.ts › Set enum custom property on column and verify in UI (shard 4, 2 retries)
  • Pages/ExplorePageRightPanel_KnowledgeCenter.spec.ts › Should remove user owner for knowledgeCenter (shard 5, 1 retry)
  • Pages/Glossary.spec.ts › Add, Update and Verify Data Glossary Term (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage service type filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageFilters.spec.ts › Verify lineage schema filter selection (shard 6, 1 retry)
  • Pages/Lineage/LineageRightPanel.spec.ts › Verify custom properties tab IS visible for supported type: searchIndex (shard 6, 1 retry)
  • Pages/Lineage/PlatformLineage.spec.ts › Verify domain platform view (shard 6, 1 retry)
  • Pages/UserDetails.spec.ts › Create team with domain and verify visibility of inherited domain in user profile after team removal (shard 6, 1 retry)

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

@harshach
harshach merged commit 24c607f into main Jun 23, 2026
55 of 60 checks passed
@harshach
harshach deleted the harshach/rdf-reindex-reader-failures-29211 branch June 23, 2026 03:57
@gitar-bot

gitar-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 resolved / 2 findings

Improves RDF reindex robustness by implementing a recovery pass for partially-resolved entities and adding missing entity types to the data-asset context. Addresses high failure rates for specific entities by surfacing diagnostic logs and enabling core-data indexing as a fallback.

✅ 2 resolved
✅ Edge Case: Representative reader error captures last entry, may be null/non-severe

📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/distributed/RdfPartitionWorker.java:176-190 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/distributed/RdfPartitionWorker.java:112-113 📄 openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/rdf/distributed/RdfPartitionWorkerTest.java:94-108
In logReaderFailures the local representativeError is reassigned unconditionally on every loop iteration (representativeError = failure.getMessage();), so the returned value is always the last EntityError's message rather than the first informative or most-severe one.

Two consequences:

  1. If the final EntityError in the batch has a null message, the method returns null. Because processPartition populates lastError from readerError only via the else if (readerError != null) guard (RdfPartitionWorker.java:112-113), an entire batch of informative reader failures can leave lastError empty — defeating the stated goal of this PR (making the job error summary non-empty when only reader errors occurred).

  2. The returned message can be a recoverable (WARN, re-indexed core data) failure rather than an unrecoverable (ERROR, dropped from graph) one, so the surfaced lastError may describe a non-fatal event while a genuine drop goes unrepresented.

Suggested fix: keep the first non-null message, and/or prefer an unrecoverable failure's message. The existing test logReaderFailuresReturnsRepresentativeMessageForNonEmptyBatch asserts the last-wins behaviour and would need to be updated to reflect the corrected semantics.

✅ Quality: WARN log claims core-data indexing before recovery is attempted/succeeds

📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/distributed/RdfPartitionWorker.java:181-185 📄 openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/distributed/RdfPartitionWorker.java:92-106
The WARN line at RdfPartitionWorker.java:181-185 states "indexing core data only" for every recoverable failure, but this logging happens in logReaderFailures before the recovery re-index (batchProcessor.processEntities(entityType, recoverable, ...)) runs at line 92-95. If that recovery write fails (counted into recovered.failedCount() at line 106), the log will have already asserted the entity was being indexed when it was actually dropped. This can mislead operators diagnosing the failure counts this PR is meant to make trustworthy. Consider softening the wording (e.g. "attempting to index core data only") or moving/adjusting the message based on the recovery outcome.

Options

Display: compact → Showing less information.

Comment with these commands to change:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

This branch was previously deployed

1 inactive deployment
test — 3f6c3f95 Deployed Jun 23, 2026 by harshach via playwright-ci-postgresql (6, 6) #52470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

1 participant