Skip to content

Fixes #36437: Refuse RDF writes before Fuseki's volume fills and compact early when it runs low (backport 2.0 #36472) - #36661

Merged
manerow merged 44 commits into
2.0from
fix/36437-rdf-storage-guard-2.0
Nov 1, 2026
Merged

manerow merged 44 commits into
2.0from
fix/36437-rdf-storage-guard-2.0

Conversation

@manerow

@manerow manerow commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #36437

Backport of PR #36472 to the 2.0 release branch, on top of PR #36660, the 2.0 backport of PR #36471. The commits apply as on 2.1. PR #36472 explains the problem.

What this PR changes

In the Fuseki image (docker/rdf-store; open-metadata/jena gets the same code for production):

  • A write guard. Once the data volume has less free space than OPENMETADATA_STORAGE_MIN_FREE (10% by default), every write gets HTTP 507 Insufficient Storage and nothing is applied. Reads and compaction keep working.
  • A storage report. GET /$/openmetadata/storage (admin only) returns the volume's size, free space and reserve, and whether writes are refused.
  • No core dumps. The JVM no longer writes a heap-sized core dump when it crashes, even when a deployment sets its own JVM_ARGS.

In the server:

  • Refused writes wait instead of failing. A 507 is a maintenance hold-back: queued writes wait without using a delivery attempt or tripping the circuit breaker. The queue's lag still marks the projection degraded, because a full volume needs attention.
  • Urgent compaction. When a maintenance check (every 15 minutes) finds free space below RDF_URGENT_COMPACTION_FREE_PERCENT (50) or the guard refusing writes, it compacts without waiting for the daily slot. Compaction copies the live data, so 50% leaves room for the copy. If compacting cannot get back above the threshold, data compaction cannot remove fills the volume: the server logs at ERROR that it needs expanding, and urgent compactions stop for one interval while the daily one still runs.
  • A recreate reindex recovers a full volume. Its storage check accepts a refused probe write, and when the guard refuses its clear it compacts to make room and clears once more.
  • A store without the report, such as today's production image or stock Fuseki, keeps the daily schedule only.

The image-server contract is recorded in ADR:2026-10-28-the-fuseki-image-refuses-writes-below-a-free-space-reserve-and-reports-its-volume.

How it was tested on 2.0

  • The commits are PR Fixes #36437: Refuse RDF writes before Fuseki's volume fills and compact early when it runs low #36472's, cherry-picked.
  • 2.0 passes the RDF unit tests, including the storage report contract tests, and the targeted RDF integration tests on PostgreSQL with RDF enabled, which build their Fuseki image from this branch's docker/rdf-store. 2.0's CI has no RDF lane, so they were run locally (-DenableRdf=true).
  • Roll out the new Fuseki image with or after the OpenMetadata release that has this PR: an older server dead-letters the writes the guard refuses.

Type of change:

  • Bug fix

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: no migration is needed; the new setting has a default.
  • I have added tests (unit / integration) and listed them above.
  • Decision check: docs/decisions/2026-10-28-the-fuseki-image-refuses-writes-below-a-free-space-reserve-and-reports-its-volume.md.

Release-stack refresh fb5f52a6151: merged the refreshed #36660 and regenerated the disk-guard configuration types, including urgentFreeSpacePercent. Full schema generation completed with 898 TypeScript outputs. The backend package build and StorageGuardRefusalTest, StorageFactsTest, RdfStorageMaintenanceServiceTest, RdfLiveWriteTest, and RdfUpdaterTest passed (47 tests, 0 failures). Merge #36660 first, then retarget this PR to 2.0 and rerun compatibility checks.

Refreshed maintenance base

Includes the recovery fixes from #36660: the shared serving pause survives a compaction budget overrun and malformed/unavailable task responses; the versioned consumer fence protects pipelineExecution during rolling upgrades; health reporting continues while compaction waits. Merge conflicts preserved both the disk-reporting/507 guard and the pause-preserving compaction API.

Validation at 67f2bd6fa19: 111 focused unit tests plus 10 recovery integration cases passed, using real MySQL and PostgreSQL with an HTTP Fuseki boundary. Coverage includes disk facts, HTTP 507 retry classification, urgent compaction, pause retention, legacy-consumer exclusion and migration handoff, and compaction-health reporting. Spotless and independent review passed; no unanswered important findings.

Merge #36660 first, then retarget this PR to its release branch and rerun the Collate build. The current feature-branch base does not exist in the Collate repository. Deploy upgraded servers before publishing/rolling out the guarded Fuseki image.

…df-storage-guard-2.0

# Conflicts:
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/JenaFusekiStorage.java
…, and wait for the next scheduled compaction after a futile urgent one
… pause, compactions are tracked to the end, pipeline runs go through the queue
…ing generation's size would refuse the compactions a full volume needs
…df-storage-guard-2.0

# Conflicts:
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/maintenance/RdfStorageMaintenanceService.java
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/JenaFusekiStorage.java
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/RdfStorageMaintenanceException.java
…ause holder each write through their own handle
…df-storage-guard-2.0

# Conflicts:
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/maintenance/RdfStorageMaintenanceService.java
#	openmetadata-service/src/test/java/org/openmetadata/service/rdf/maintenance/RdfStorageMaintenanceServiceTest.java
…df-storage-guard-2.0

# Conflicts:
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/maintenance/RdfStorageMaintenanceService.java
#	openmetadata-service/src/test/java/org/openmetadata/service/rdf/maintenance/RdfStorageMaintenanceServiceTest.java
…s stop for an interval, the scheduled one still runs
Base automatically changed from fix/36437-rdf-storage-maintenance-2.0 to 2.0 November 1, 2026 18:33
…guard-2.0

# Conflicts:
#	conf/openmetadata.yaml
#	docs/rdf-production-setup.md
#	openmetadata-service/src/main/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexApp.java
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/RdfRepository.java
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/maintenance/RdfStorageMaintenanceService.java
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/ForwardingRdfStorage.java
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/JenaFusekiStorage.java
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/RdfStorageInterface.java
#	openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/RdfStorageMaintenanceException.java
#	openmetadata-service/src/test/java/org/openmetadata/service/apps/bundles/rdf/RdfIndexAppTest.java
#	openmetadata-service/src/test/java/org/openmetadata/service/rdf/maintenance/RdfStorageMaintenanceServiceTest.java
#	openmetadata-spec/src/main/resources/json/schema/api/configuration/rdfConfiguration.json
#	openmetadata-ui/src/main/resources/ui/src/generated/api/configuration/rdfConfiguration.ts
@gitar-bot

gitar-bot Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🔴 High risk · Changing RDF write refusal, retries, and reindex/compaction handling could interrupt persistence or leave metadata projections stale during low-disk recovery.

Adds a Fuseki write guard that refuses RDF writes with HTTP 507 once free space drops below the configured reserve, plus a storage report endpoint and urgent compaction when the volume runs low. Refused writes now wait in the queue rather than consuming delivery attempts. The bulk reconcile path's handling of 507 refusals was addressed, so it no longer logs them as ERROR failures. No open issues found.

✅ 1 closed
✅ Quality: Bulk reconcile path logs and wraps 507 refusals as ERROR failures

📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/JenaFusekiStorage.java:1229-1232 📄 openmetadata-service/src/main/java/org/openmetadata/service/rdf/storage/JenaFusekiStorage.java:956-966
This PR adds rethrowIfHeldBack(e) to every write catch block except executeReconcileUpdate, the RECONCILE path behind bulkStoreEntities. When the disk guard returns 507 there, the code logs Failed to bulk-store N entities in Fuseki at ERROR with a stack trace and wraps the exception in a RuntimeException. RdfLiveWriteStore finds the cause with find(), so the write is still held back, but each retry (every 30s for as long as the volume stays low) logs another ERROR. That goes against the contract in the new Javadoc, which says refusals pass through "unwrapped and unlogged". The fix is to call rethrowIfHeldBack(e) at the top of this catch block, the same as the other write paths.

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

@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@manerow
manerow merged commit 535de93 into 2.0 Nov 1, 2026
72 of 76 checks passed
@manerow
manerow deleted the fix/36437-rdf-storage-guard-2.0 branch November 1, 2026 19:29

This branch was previously deployed

1 inactive deployment
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

Development

Successfully merging this pull request may close these issues.

Fuseki disk grows until full because the RDF store is only compacted by the reindex app

2 participants