Skip to content

Mounted ledgers cannot install a refreshed index on a cached handle #1960

Open

Description

@bplatz

A remote-mounted ledger loads correctly, but once its handle is cached, a refresh that installs a newer index root fails the wrong-ledger check.

Mechanism

  • Index roots embed the ledger id they were built under. A root built by the origin carries the origin's id (inventory:main).
  • On a mount, the same ledger is known locally as acme/inventory:main.
  • Initial load (LedgerState::load) re-stamps the snapshot's id from the nameservice record, so the first load works.
  • The incremental refresh path (LedgerManager::notify → apply_index_v2 → apply_loaded_db, fluree-db-api/src/ledger_manager.rs ~722) builds the snapshot from the root's own id and compares it strictly against the cached snapshot. inventory:main != acme/inventory:main → LedgerIdMismatch, so the newer index is never installed until the handle is evicted and fully reloaded.

This is reachable through an explicit Fluree::refresh (or any notify) on a mounted ledger. The staleness path that evicts and reloads is unaffected.

Direction

Blindly re-stamping every root would remove a useful wrong-ledger check. The fix needs a trusted origin→local id mapping (the mount knows its prefix): accept a root whose id equals the local id or the mount's origin id for it, and keep rejecting anything else.

Follow-up: #1958

Activity

  1. added
    P2
    area:storage
    on Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:storage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions