Repository navigation
Fixes #36437: Compact the RDF store on a schedule and pause writes during maintenance (backport 2.0 #36471) - #36660
Conversation
…ring maintenance
…lure, metrics in OntologyMetrics
… pause, compactions are tracked to the end, pipeline runs go through the queue
… crashing it again
…ause holder each write through their own handle
…rites back, using a server registry
… dataset keeps a full copy
…etadata extension on, as production does
…d not finish, not only one it lost
…ers that do not pause just wait it out
…ded RDF projection, whatever stopped it
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
| // A compaction this server did not pause for (a lost pause lease, an operator, an older | ||
| // server) blocks the write until it ends: retry it without counting a failure. | ||
| if (RdfWriteRetry.isUncertain(exception)) { | ||
| throw new RdfWriteOutcomeUnknownException(description, exception); | ||
| throw isCompacting() | ||
| ? new RdfStorageMaintenanceException( | ||
| "compaction (" + description + " waited)", COMPACTION_RETRY_AFTER) | ||
| : new RdfWriteOutcomeUnknownException(description, exception); | ||
| } | ||
| throw exception; | ||
| } | ||
| } | ||
|
|
||
| private boolean isCompacting() { | ||
| final DatasetEndpoint info = parseDatasetEndpoint(endpoint); | ||
| return info != null |
There was a problem hiding this comment.
⚠️ Bug: Server-wide isCompacting turns uncertain writes into 'nothing applied'
When a write times out, runWriteWithTimeout calls isCompacting(). That method goes through FusekiCompaction.anyRunningCompaction, which checks /$/tasks for a running Compact task on any dataset on the Fuseki server, not just the dataset this handle writes to. A true answer replaces RdfWriteOutcomeUnknownException with RdfStorageMaintenanceException.
This drops the uncertain-outcome handling that callers depend on:
RdfRebuildStore.withBuildLockonly quarantines a build dataset (UNCERTAIN_WRITE) whenRdfWriteOutcomeUnknownException.isPresent.writeProbeonly removes its probe triple on that exception type.RdfBatchProcessorclassifies on it too.RdfLiveWriteStore.deferForMaintenanceassumes "nothing reached the store".
Here is a reachable case. A maintenance compaction or prepareBuildDataset compaction returns TIMED_OUT but keeps running on Fuseki. A reindex then writes to openmetadata_b, and one of those writes times out for an unrelated reason. That write is reported as held by maintenance and is not quarantined, so Fuseki can apply it late after the dataset has been reused. A write held up by a compaction can also still be applied once the compaction ends, so its outcome really is unknown.
Fix: limit the check to compactions of this handle's dataset (Fuseki task bodies identify the dataset). Also keep the uncertainty, for example by making the maintenance exception carry or extend the outcome-unknown signal, so build quarantine and probe cleanup still happen.
Only treat the timeout as maintenance when the compaction targets this dataset, and keep the outcome-unknown cause so build quarantine still triggers.:
if (RdfWriteRetry.isUncertain(exception)) {
final RdfWriteOutcomeUnknownException uncertain =
new RdfWriteOutcomeUnknownException(description, exception);
if (isCompacting(datasetName)) {
// keep uncertain as the cause so RdfWriteOutcomeUnknownException.isPresent() stays true
throw new RdfStorageMaintenanceException("compaction (" + description + " waited)", COMPACTION_RETRY_AFTER, uncertain);
}
throw uncertain;
}
Was this helpful? React with 👍 / 👎
Resolve the pinned quicktype CLI without root node_modules so the lightweight PR workflow can regenerate the release schemas. Regenerate the committed TypeScript models, including RDF storage maintenance.
Keep the serving pause while Fuseki tasks outlive their budget or return unreadable responses. Transfer the queue consumer fence to upgraded servers before emitting pipeline execution payloads. Refs #36437
Start the compaction health clock before contacting Fuseki and keep scheduled health reporting independent of the compaction worker. Keep consumer migration statements in the RDF schema section.
Code Review
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
|
|



Describe your changes:
Fixes #36437
Backport of PR #36471 to the 2.0 release branch, adapted to 2.0: it has no inference runs to keep maintenance away from, the reindex lock DAO lives in
CollectionDAO, and the migration goes in the 2.0.8 folder. PR #36471 explains the problem and why it happened.What this PR changes
RDF_COMPACTION_INTERVAL_HOURS), never during a reindex. One Fuseki could not start is retried after 15 minutes; one it started and that did not succeed waits for the next interval, so a copy the volume cannot hold is not retried.RDF_REQUEST_TIMEOUT_MS, then get 503 withRetry-After. Pipeline run statuses now use the queue.rdf_projection_health.lastCompactedAt. Once none has succeeded for two intervals, whatever the reason, every check logs an error and/v1/rdf/statusreportsDEGRADEDuntil one does.RDF_MAINTENANCE_MAX_DURATION_MINUTES, 240). Compaction always follows; a failed clear then fails the run.success: true; a task it forgets is unknown. Compactions are timed inontology.rdf.compaction, with a last-success gauge.Leases use
rdf_reindex_lock; the only migration adds thelastCompactedAtcolumn in the 2.0.8 folder; 2.1.0 adds it too, guarded, for servers that skip 2.0.8. Decision record:ADR:2026-10-28-rdf-storage-maintenance-pauses-serving-writes-and-compacts-on-a-schedule.How it was tested on 2.0
RdfStorageMaintenanceIT,RdfBlueGreenRebuildITandRdfLiveProjectionIT. 2.0's CI has no RDF lane, so they were run locally (-DenableRdf=true).Type of change:
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.lastCompactedAtcomes with its 2.0.8 migration.docs/decisions/2026-10-28-rdf-storage-maintenance-pauses-serving-writes-and-compacts-on-a-schedule.md.Release refresh
2aa97215dfe: merged the current2.0branch. Both schema-generation entrypoints now resolve the same pinned quicktype CLI as upstream (20.0.27), so the lightweight workflow no longer depends on root node_modules.bash -npassed for both scripts; full generation completed with 898 nonempty TypeScript files, including the previously missing RDF storage-maintenance types. No generated outputs were lost; ten other generated diffs only rewrap comments. Independent review found no important issues. The combined 2.0 guard stack also packages the backend and passes 47 targeted RDF unit tests.Review follow-up: compaction recovery and rolling upgrades
drainconsumer fence before enablingdrain-v2, waiting for an old delivery in progress. Old servers can still enqueue their supported payloads; upgraded consumers deliverpipelineExecution. RDF startup rejects a database missing the new fence.Validation at
650f8861445: 106 focused unit tests and 10 recovery integration cases passed. The recovery cases use real MySQL/PostgreSQL plus an HTTP Fuseki boundary, and cover pause retention, malformed start/poll replies, resumption without dead letters, legacy consumer exclusion, an in-flight consumer during migration, and health degradation during a pause. Spotless passed. Independent review has no unanswered important findings.Run the release migrations before deploying upgraded RDF servers. After the consumer-fence transfer, keep an upgraded RDF server available; an old-only rollback leaves queued writes pending. Never enable both consumer fences together.