Skip to content

Fixes #36440: Report the RDF graph as not ready after the server ran with RDF off (backport 2.1 #37703) - #37876

Merged
fmcardoso merged 4 commits into
2.1from
fmcardoso/backport-2.1-37703
Nov 16, 2026
Merged

fmcardoso merged 4 commits into
2.1from
fmcardoso/backport-2.1-37703

Conversation

@fmcardoso

@fmcardoso fmcardoso commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #36440

Backports #37703 to 2.1. #37703 fixed the issue on main; this carries the fix to the release branch.

Why 2.1 needs it. #37155 is already on 2.1: an RdfIndexApp run on a server with RDF off is stored as a success with nothing indexed. Without #37703 that record reads as READY, so turning RDF on for the first time on an existing install reports a ready graph that was never built, and the agent SPARQL path answers from it (0 tables with HTTP 200 in the reproduction). #37703 has to ship in the same release as #37155.

What #37703 does. A server with RDF off raises failureVersion in rdf_projection_health when it starts, when its stop begins and at the end of its stop, and an RdfIndexApp run that finds RDF off is flagged projectionUnchanged so the state resolver skips it. After RDF was off, /v1/rdf/status reports DEGRADED (or REBUILDING when the graph was never built) and the agent path refuses until a full RdfIndexApp Recreate completes. It queues no rebuild and adds no migration; the design, known gaps and live verification are in #37703.

What is in this PR.

Type of change:

  • Bug fix

Tests:

Run locally on this branch (14f408d5995, base origin/2.1):

  • Before the two test-only commits, a unit run of the RDF, application and migration-guard classes: 775 run, 1 failed (the test above). With them, the focused plan below passes.
  • RdfLiveProjectionIT in the parallel lane (suite server with RDF off, MySQL + Elasticsearch): 3 run, 0 failed.

Local Java test run: PASSED

  • Commit: 14f408d59958 (base origin/2.1)
  • Finished: 2026-11-16 10:00 UTC · 10.2 min
  • Scope: focused; merge readiness is not established. Broader steps deferred: 8 (run --scope full).
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (4 classes) 4 79 0 0 1.4 passed
integration mysql-elasticsearch · isolated 1 1 0 0 3.7 passed
integration mysql-elasticsearch · rdf 3 43 0 0 5.1 passed
  • Impacted, not run locally: 5 classes (listed in the details)

Not run on this branch: the live Docker cases (they ran on the main build and are recorded in #37703), the full test scope, coverage.

Manual testing performed

None on the 2.1 build. See #37703 for the live runs on main.

UI screen recording:

Not applicable — backend-only bug fix, no UI change.

Checklist:

🤖 Generated with Claude Code

https://claude.ai/code/session_01M4KprRYxz12aRpRZeqousD

RetriggerView in GreptileConfidence Score: 4/5

The existing test requirement must be satisfied before merging.

Findings

  1. P2 Tests miss the stored result ▶

Summary

Backports RDF readiness safeguards to 2.1. Servers that run with RDF off leave the graph needing a full rebuild before agent queries resume.

  • Servers that run with RDF off mark the graph unready until it is rebuilt.
  • RDF-off index runs no longer make the graph look built.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Server runs with RDF off] --> B[Start and stop raise failureVersion]
    B --> C[Graph needs repair]
    D[Index run finds RDF off] --> E[Resolver skips the run]
    C --> F[Agent queries refused]
    E --> F
    G[Full Recreate after the last mark] --> H[Rebuild completes]
    H --> I[Graph can become READY]
Loading

Reviews (5) · Last reviewed commit: "Merge branch '2.1' into fmcardoso/backpo..." · Reviewed by Greptile

fmcardoso and others added 3 commits November 16, 2026 10:46
…with RDF off (#37703)

* Fixes #36440: Rebuild the RDF graph after the server ran with RDF off

With RDF off nothing reaches the graph and nothing is recorded, so after
RDF is turned on (again, or for the first time on an existing install)
the projection reported READY from an old or empty run and the agent
SPARQL path served stale or missing data.

- RdfIndexApp flags a run that finds RDF off as projectionUnchanged, so
  it no longer counts as a build of the graph.
- A server that starts with RDF off records the time in
  rdf_projection_health.rdfDisabledAt (new column, MySQL and Postgres).
- The projection is DEGRADED while the newest indexing run predates that
  mark, and server start queues one RdfIndexApp run when nothing has
  indexed since.

* Degrade the projection on an RDF-off start instead of comparing times

Review of the first commit found that deciding the state by comparing
rdfDisabledAt with the newest run's start time let any successful run
after the mark, a partial or non-recreate one included, read as READY
over a graph that still missed the changes.

The RDF-off start now also raises failureVersion in the same statement,
so the existing health check reports DEGRADED and only a completed
rebuild of the entire projection that started afterwards repairs it.
rdfDisabledAt stays as the key that decides whether start-up queues a
run. Status reads no longer run an extra query for the mark.

RdfFirstIndexRunIT covers the wiring end to end on the suite server.

* Cover the full-rebuild guard and repair the tests the RDF-off bump reaches

Second review pass on the branch:

- RdfLiveProjectionIT runs on a suite server that starts with RDF off,
  which now degrades the projection; its fabricated completed rebuild
  repairs the health row as a real one would.
- RdfIndexAppTest pins that a recreate of some entity types and an
  incremental run leave the projection degraded, and the RDF-off run's
  record now starts after the mark so only the flag can discount it.
- RdfFirstIndexRunIT loads the app as AppResource does (with its bot) and
  adds the incremental-run case end to end.

* Keep the original Deciders line on the 2026-11-06 RDF decision record

* Say to run a full Recreate after turning RDF on with a rolling restart

* Record the RDF-off mark again when the server stops

A server with RDF off drops its writes for as long as it runs. During a rolling restart that turns RDF on, the new server's start-up rebuild began after the old server's start mark, so on completion it repaired the projection and reported READY over a graph that could miss the old server's last writes. The stop mark raises failureVersion after that rebuild read it, so the state stays DEGRADED until another full rebuild.

Also write the start mark after migration validation, since it uses a column a pending migration adds, and assert in the RDF-off test lane that a server start records the mark.

* Narrow the recorded upgrade gap to databases already at 2.1.0

The 2.1.0 migration deletes earlier RdfIndexApp run records, so an upgrade from 2.0.x that turns RDF on in the same deploy takes the first-install path and queues the start-up run. Seen live from 2.0.8.

* Test the RDF-off marks on a real server start and stop

RdfDisabledMarkLifecycleIT starts a second server process with RDF off on the suite database, stops it, and checks that both the start and the stop moved the mark, so removing either call fails a test. ForkedServerNode gains a stop that reports whether the process exited by itself.

The setup guide and the decision record said the state stays DEGRADED after a rolling enablement. It reads READY while the old server is still up after the rebuild completed; both now say so, and comments that described a start only cover the stop too.

* Record the RDF-off mark when the stop begins as well

The stop mark was written near the end of shutdown. Jetty waits up to 30 s for open requests first and Kubernetes kills a pod after 30 s by default, so a slow shutdown could be killed before the mark was written. A Jetty lifecycle listener now writes it when the stop begins; the later hook stays, to follow the writes made while the server drained.

* Bound the RDF-off write at the start of a stop to five seconds

Nothing has stopped yet when the stop begins, so a database that does not answer would hold the shutdown for its whole connection timeout and the platform would kill the server before any hook ran. The write now gives up after 5 s; the one at the end of the stop is unchanged. The lifecycle test closes its server in a finally, and the decision record lists the case of a server killed while it drains.

* Keep ALTER DATABASE the last statement of the 2.1.0 MySQL migration

FlowableCharsetMigrationTest requires it to be last, because Flowable's own schema upgrade runs after this file and inherits the database default. The rdfDisabledAt statements were appended after it; they now sit above it, unchanged.

* Drop the start-up rebuild after RDF was off; keep the not-ready mark

A server with RDF off still marks the projection as not ready when it
starts, when its stop begins and at the end of its stop, and an
RdfIndexApp run that finds RDF off is stored as a success flagged
projectionUnchanged, which the state resolver skips. After RDF was off
the agent SPARQL path refuses until a rebuild of the entire projection
completes.

The start-up rebuild queued when nothing had indexed since RDF was last
off is removed: the rebuild after enabling RDF is an explicit step, like
search reindexing. The start-up rule on main stays as it is (one run
when no RdfIndexApp run record exists). The rdfDisabledAt column only fed
that queue, so it and its migration statements are removed and the pull
request makes no schema change.

* Do not name reindex-rdf as the rebuild step after enabling RDF

The ops CLI command never initializes the app scheduler, so it stops before it queues a run. The setup guide and the decision record now name the application page and the API only, and say why the CLI cannot do it today.

(cherry picked from commit 13bdcdc)
* test(rdf): simulate failure after a skipped run

* test(rdf): map the unit-only fixture precisely

(cherry picked from commit d4de630)
@fmcardoso
fmcardoso requested review from a team as code owners November 16, 2026 10:04
@fmcardoso
fmcardoso requested review from karanh37 and manerow and removed request for a team November 16, 2026 10:04
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

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 skip-pr-checks label.

@fmcardoso

Copy link
Copy Markdown
Member Author

Local Java test run: PASSED — details

  • Commit: 14f408d59958 (base origin/2.1)
  • The summary is in the PR description.

Tests run locally

  • unit · openmetadata-service (4 classes): OpenMetadataApplicationTest (1 passed), RdfDisabledMarkTest (12 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$RdfNotInitializedTests (1 passed), RdfIndexAppTest$RunLockTests (6 passed), RdfIndexAppTest$RunRecordUpdateTests (12 passed), RdfIndexAppTest$StopFunctionalityTests (2 passed), RdfIndexAppTest$ValidationTests (1 passed), RdfProjectionStateResolverTest (21 passed)
  • integration · mysql-elasticsearch · isolated: RdfDisabledMarkLifecycleIT (1 passed)
  • integration · mysql-elasticsearch · rdf: RdfFirstIndexRunIT (4 passed), RdfLiveProjectionIT (3 passed), RdfLiveWriteRecoveryIT (36 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,AlertingArchitectureTest,MigrationWorkflowReprocessingTest,OntologyActiveGraphStorageTest,OntologyPublicationStatusResolverTest,OpenMetadataApplicationAuthReloadTest,OpenMetadataApplicationPushFeedUpgradeTest,OpenMetadataApplicationTest,RdfColumnLineageTraversalTest,RdfDisabledMarkTest,RdfIndexAppTest,RdfInitialIndexRunTest,RdfLiveWriterTest,RdfProjectionHealthTest,RdfProjectionStateResolverTest,RdfScheduleMigrationTest,RdfSparqlServiceTest,RdfStorageMaintenanceServiceTest,RdfToolDescriptionVocabularyTest,RdfUpdaterTest,SearchSettingsMergeUtilRepositoryResolutionTest,SparqlQueryToolAgentProfileTest -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<496 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=<37 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=rdf '-Dit.test=<37 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=AlertStateIT,BundleWarmupCertificationIT,ContainerCacheCorrectnessIT,EntityCacheWriteOrderIT,OneTransactionFlushAtomicityIT,RelationshipCacheInvalidationIT,TagRenameCacheIT,UncachedReadIT -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=global-state -Dit.test=CredentialRedisDownIT,CredentialRedisNoRoundTripIT,SessionRedisMultiNodeIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=parallel -Dit.test=FlattenedChildrenHighlightSearchIT,InheritedFieldPropagationRecoveryIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
  • mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=global-state -Dit.test=PatchTableEmbeddingIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
Impacted, not run locally (5)
  • RdfCatalogScaleIT → only with -DrdfCatalogScale=true, which no CI lane sets
  • OntologyScaleIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
  • ReindexBenchmarkIT → nightly: openmetadata-nightly k8s-java-it (scale-it)
  • EntityLoaderSmokeUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
  • SearchAvailableAllKindsDuringReindexUIIT → nightly: openmetadata-nightly k8s-java-it (ui-it + embedded JavaUIIT)
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=OpenMetadataApplicationTest,RdfDisabledMarkTest,RdfIndexAppTest,RdfProjectionStateResolverTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=RdfDisabledMarkLifecycleIT -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=RdfFirstIndexRunIT,RdfLiveProjectionIT,RdfLiveWriteRecoveryIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

@fmcardoso fmcardoso added 2.1 backend area:rdf The RDF store, SPARQL, linked data. labels Nov 16, 2026
@gitar-bot

gitar-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Recording RDF-disabled lifecycles and skipping no-op indexing changes readiness; failed health writes could leave stale graphs available through agent SPARQL.

Backports the RDF projection health fix to 2.1 so a server running with RDF off reports the graph as DEGRADED or REBUILDING instead of READY, and the agent SPARQL path refuses to answer from an unbuilt graph. Includes two test-only commits that correct a failing test on 2.1. 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 e7ceeff into 2.1 Nov 16, 2026
49 of 50 checks passed
@fmcardoso
fmcardoso deleted the fmcardoso/backport-2.1-37703 branch November 16, 2026 10:50
void recordsWhenThereIsNoRdfConfiguration() {
RdfDisabledMark.recordIfDisabled(null, store);

verify(store).recordRdfDisabled();

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.

P2 Tests miss the stored result

Several new tests in RdfDisabledMarkTest only check verify(store).recordRdfDisabled(). The repository guide requires tests to assert observable results, not internal verify() calls. Check the stored failureVersion instead, so these tests prove that the graph was marked as needing a rebuild. This repository requirement must be satisfied before merging.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

Labels

2.1 area:rdf The RDF store, SPARQL, linked data. backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants