Skip to content

Root-cause the backend's non-durable shard writes (source of #139) instead of relying on reconciliation #142

Description

@tkuhn

The shard-consistency sweep (#140, #141) is a safety net, not a fix: the underlying defect is that the RDF4J/LMDB backend sometimes acknowledges a per-repo write transaction (2xx on commit) that never becomes durable/visible — or answers a repo-status query with a false "already loaded" row. Either way the loader is told the shard is fine when it isn't. This issue tracks fixing that at the source.

Evidence so far

#139 (2026-07-27, query.knowledgepixels.com): nanopub RAHokSK… present in text/full/pubkey/type_ListView/meta (all six stamps within ~150 ms of a clean first load attempt; meta committed, which requires every shard task to have reported success), yet zero durable trace in type_ec6722… (ResourceView) — no stamp, no content, count/checksum internally consistent without it. Ruled out client-side: repo recreation, thread-unsafe hash → wrong repo name, type computation, LMDB tail loss, transaction-atomicity break, coordination logic.

Recurrence 2026-07-29, ~09:20 and ~09:28 UTC: two freshly published ResourceView nanopubs dropped from the same type repo, now across instances — RA9WoVD9… missing on knowledgepixels and petapico (both ingested it within ~3 s of each other), RAZzhA4a… missing on knowledgepixels and nanodash.net. Same nanopub dropped on two instances at the same wall-clock moment ⇒ the trigger is load-correlated at ingest time (all instances replay the same registry stream on the same schedule), and it keeps hitting the hottest type repo — the same type_ec6722… that has the documented repo-wedge/outage history (see the TripleStore pinning rationale and deferred-shutdown comments around the MMapIndexInput – Already closed failure mode).

Related: the 2026-06-29 meta-behind-full divergence (4,763 nanopubs in full/pubkey/type but absent from meta after a resync) has the same "shard reported success without a durable write" signature.

What would discriminate the mechanism

  1. RDF4J server logs at incident time — the key missing evidence. The reconciler now gives precise detection (registry_reconciler_shards_repaired_total > 0, WARN log with nanopub + repo + timestamp), so on the next occurrence, capture the server-side log around the original load window before rotation. Known windows: 2026-07-27T06:48:05Z (kpxl), 2026-07-29T09:20:08–11Z (kpxl + petapico), 2026-07-29T09:28:52Z (kpxl + nanodash.net), all on type_ec6722efa3….
  2. Client-side skip logs — since feat(loader): periodic shard-consistency sweep to detect and repair missing shard writes #140, the "Skipping already-loaded nanopub" line is INFO. If a drop coincides with such a line for the affected repo, the mechanism is a false read (store answered "already loaded" for a nanopub it doesn't hold); if there's no skip line, the commit ack itself was non-durable.

Candidate directions once discriminated

  • LMDB store durability settings (e.g. lmdb:forceSync, currently at RDF4J defaults in the repo-creation config in TripleStore).
  • The known store-wedge mode on hot repos (shutdown-during-use / env lifecycle) — possibly an upstream RDF4J LmdbStore bug worth reporting with the captured evidence; we already run 5.3.1 with a patched-workbench history.
  • Load-correlation: incidents cluster at ingest bursts on the most-queried type repo, suggesting write-under-concurrent-read-pressure; a reproducer hammering an LmdbStore with concurrent federation reads + serializable writes might trigger it in isolation.

Until this is fixed, the reconciler keeps the damage bounded (detection ≤ ~5 min for completed loads), but every non-zero shards_repaired_total is a reminder that the store is acking writes it doesn't keep.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions