Skip to content

reindex fails on any branch: it reads commits through the flat store and misses the ones before the fork #1984

Closed

Description

@bplatz

Summary

Fluree::reindex fails on a branch whose history reaches back before the fork, which is every branch with a parent. It reads commits through the branch's own flat content store, so it can't find the commits that live in the source's namespace.

Indexer(Core(Storage("Failed to read commit envelope bagaybqab…: Not found: fluree:memory://mydb/dev/commit/….fcv2")))

Cause

reindex (fluree-db-api/src/admin.rs:2261) passes self.content_store(&ledger_id) to rebuild_index_from_commits_with_tracker. For a branch, that store covers the branch's namespace only. Every other path that walks a branch's commit chain uses a branch-aware store, which falls through to the parent's namespace:

  • the background indexer (orchestrator.rs, branched_content_store_for_record);
  • the ledger loader;
  • merge;
  • rebase.

Background indexing of a branch is therefore unaffected. An explicit reindex is the path that breaks.

This reaches POST /reindex (routes/ledger.rs:534) and fluree reindex.

Reproduction

  1. Create mydb and insert one fact.
  2. create_branch("mydb", "dev", None, None).
  3. Insert on mydb:dev.
  4. fluree.reindex("mydb:dev", Default::default()) fails as shown above.

Reproduced on memory storage. The store is chosen the same way on every backend.

Suggested fix

Build from self.branched_content_store(&ledger_id).await?, as the orchestrator does.

The test helper support::rebuild_and_publish_index in fluree-db-api/tests/support/mod.rs has the same flat store, so it fails on a branch too.

Add a test that reindexes a branch with commits on both sides of the fork, then checks that a reload reads both.

Found while checking a claim in #1969.

Activity

  1. added
    bug
    P2
    area:storage
    on Sep 29, 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:storagebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions