Skip to content

fix(rdf): a reindex run skipped for the lock no longer marks the projection DEGRADED - #37245

Merged
chirag-madlani merged 3 commits into
mainfrom
chirag-madlani/rdf-skipped-run-not-degraded
Nov 12, 2026
Merged

chirag-madlani merged 3 commits into
mainfrom
chirag-madlani/rdf-skipped-run-not-degraded

Conversation

@chirag-madlani

Copy link
Copy Markdown
Collaborator

Describe your changes:

Fixes the intermittent ontology-rdf.setup.ts › assert RDF health and projection writes failure in the Playwright rdf lane (projectionState: "DEGRADED"), seen on the Nov 4 and Nov 6 nightly runs (latest). When it fails, the 40 Ontology specs behind it do not run.

Cause. RdfProjectionStateResolver derived /rdf/status from the newest RdfIndexApp run record and mapped STOPPED/FAILED to DEGRADED. A run that finds the reindex lock held ends STOPPED by design ("redundant rather than broken"), without touching the projection. In the failing runs, docker/run_local_docker_rdf.sh triggered RdfIndexApp while another run held the lock:

Skipped: another RDF reindex is running on server 'om-server-…' (run 675275e7…). Run it again once that one finishes.

That skip record became the newest one, so the projection read DEGRADED until the next run that indexed. The same happens in production: any redundant trigger takes agent SPARQL offline with a 503. The lock holder is the server's start-up index run (ADR:2026-11-02-server-start-queues-one-rdf-index-run-when-none-exists, since #36868) or a compaction (ADR:2026-10-28-rdf-storage-maintenance-pauses-serving-writes-and-compacts-on-a-schedule). The rdf lane passed when the script's trigger came after the holder had finished, and failed when it came before.

Fix.

  • RdfIndexApp sets failureContext.projectionUnchanged: true on the three paths that end before indexing: the lock is held, the lock cannot be taken, or the run is deferred behind a search reindex. The run's own status is unchanged, so run history and alerting still show it.
  • The resolver skips flagged records and derives the state from the newest record that is not flagged. A run stopped or failed mid-indexing still reads DEGRADED. If only flagged records exist, it reports REBUILDING.
  • The resolver pages ten records at a time and stops after 50 records, reporting REBUILDING past that, because it runs on every status read.
  • Decision record: docs/decisions/2026-11-06-an-rdf-index-run-that-ends-before-indexing-leaves-the-projection-state-alone.md.

Type of change:

  • Bug fix

High-level design:

N/A — small change (two classes, plus their tests and a decision record).

Tests:

Use cases covered

  • A run skipped for the lock, a run that cannot take the lock, and a deferred run leave the projection READY after an earlier completed run.
  • A run stopped or failed while indexing still reads DEGRADED.
  • Only skipped runs read REBUILDING. The resolver pages past a full page of skipped runs and stops at the cap.
  • A real failure after a skipped run on the same app instance still reads DEGRADED, so the flag is reset for each run.

Unit tests

  • I added unit tests for the new/changed logic.
  • RdfProjectionStateResolverTest: 5 new cases, plus STOPPED → DEGRADED in the status mapping.
  • RdfIndexAppTest: the held-lock and deferral tests now pass the record the app pushes through the real resolver. Two new cases: lock unavailable, and a real failure after a skip.
  • AgentSparqlServiceTest: the run-store stub no longer pins the page size.
  • Mutation-checked:
    • reverting the resolver fails the two bug-reproducing cases (READY/REBUILDING expected, got DEGRADED);
    • removing the three projectionUnchanged = true lines fails 3 app tests;
    • removing the per-run reset fails the real-failure-after-skip test.
  • Also ran locally: MigrationWorkflowReprocessingTest, RdfColumnLineageTraversalTest, RdfInitialIndexRunTest, RdfScheduleMigrationTest (with the above: 7 classes, 121 tests, 0 failed).
  • Coverage %: not measured.

Backend integration tests

  • Not applicable (no backend API changes). The resolver's contract with the app is covered end to end in unit tests by passing the pushed record through the real resolver.

Local Java test run: PASSED

  • Commit: bcf919da56f7 (base origin/main)
  • Finished: 2026-11-06 08:28 UTC · 1.6 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 5 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (3 classes) 3 83 0 0 1.6 passed
  • Impacted, not run locally: 2 classes (listed in the details)

Not run locally: the broader plan (--scope full: 120 IT classes, including the rdf lane) runs in the merge queue. openmetadata-mcp unit tests that only reference RdfIndexApp were not run.

Ingestion integration tests

  • Not applicable (no ingestion changes).

Playwright (UI) tests

  • Not applicable (no UI changes). The rdf lane's ontology-rdf.setup.ts is the end-to-end check, and it runs in the merge queue.

Manual testing performed

None beyond the CI log analysis above.

UI screen recording:

Not applicable — backend-only fix.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation> — test fix, no issue (skip-pr-checks).

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above — test fix, no issue.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: not applicable (no schema change; failureContext already accepts additional properties).

  • For a UI feature or feature task: not applicable.

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.

    • Reviewed bcf919da5; fixed: the app side of the flag had no test, paging had no cap, and a lock-unavailable run still degraded. No 🔴 open. Follow-up nit, already true on main: a skipped run still increments OntologyMetrics.recordGraphRebuildFailed.
  • Decision check: docs/decisions/2026-11-06-an-rdf-index-run-that-ends-before-indexing-leaves-the-projection-state-alone.md.

  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

@chirag-madlani
chirag-madlani requested a review from a team as a code owner November 6, 2026 08:28
@chirag-madlani chirag-madlani added the skip-pr-checks Bypass PR metadata validation check label Nov 6, 2026
@chirag-madlani
chirag-madlani requested review from pmbrull and a balanced review from Copilot November 6, 2026 08:28
@chirag-madlani

Copy link
Copy Markdown
Collaborator Author

Local Java test run: PASSED — details

  • Commit: bcf919da56f7 (base origin/main)
  • The summary is in the PR description.

Tests run locally

  • unit · openmetadata-service (3 classes): AgentSparqlServiceTest (23 passed), RdfIndexAppTest (0 passed), RdfIndexAppTest$AdmissionTests (3 passed), RdfIndexAppTest$BlueGreenLifecycleTests (6 passed), RdfIndexAppTest$EntityRelationshipConversionTests (3 passed), RdfIndexAppTest$EntitySelectionTests (5 passed), RdfIndexAppTest$InitializationTests (2 passed), RdfIndexAppTest$PromotionRatioGateTests (4 passed), RdfIndexAppTest$RunLockTests (6 passed), RdfIndexAppTest$RunRecordUpdateTests (10 passed), RdfIndexAppTest$StopFunctionalityTests (2 passed), RdfIndexAppTest$ValidationTests (1 passed), RdfProjectionStateResolverTest (18 passed)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts.

Broader coverage not executed by this focused run

  • mvn -B package -pl openmetadata-mcp,openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AgentSparqlServiceTest,AgentSparqlToolErrorsTest,MigrationWorkflowReprocessingTest,RdfColumnLineageTraversalTest,RdfIndexAppTest,RdfInitialIndexRunTest,RdfProjectionStateResolverTest,RdfScheduleMigrationTest,RdfToolDescriptionVocabularyTest,SparqlQueryToolAgentProfileTest -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<81 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=AppsResourceIT,DataContractValidationAppIT,GlossaryOntologyExportIT,OntologyConcurrentHardDeleteIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf '-Dit.test=<34 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=parallel -Dit.test=BundleWarmupCertificationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
Impacted, not run locally (2)
  • RdfCatalogScaleIT → only with -DrdfCatalogScale=true, which no CI lane sets
  • OntologyScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=AgentSparqlServiceTest,RdfIndexAppTest,RdfProjectionStateResolverTest -Dsurefire.failIfNoSpecifiedTests=false

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@github-actions github-actions Bot added safe to test Add this label to run secure Github workflows on PRs UI UI specific issues labels Nov 6, 2026
@gitar-bot

gitar-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Flagging pre-index exits and paging past them changes RDF health reporting; incorrectly skipping a meaningful run could leave stale projection data treated as available.

Stops a skipped RDF reindex run (lock held, lock unavailable, or deferred behind a search reindex) from marking the projection DEGRADED, by flagging those runs with projectionUnchanged and having RdfProjectionStateResolver derive state from the newest unflagged record. 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

@chirag-madlani
chirag-madlani merged commit 56b9959 into main Nov 12, 2026
103 checks passed
@chirag-madlani
chirag-madlani deleted the chirag-madlani/rdf-skipped-run-not-degraded branch November 12, 2026 09:14
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 skip-pr-checks Bypass PR metadata validation check UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants