Skip to content

Deleting facts with overflow-namespace IRI objects corrupts the index: retractions survive and the object's IRI stops resolving #2138

Closed

Description

@bplatz

Summary

Once a ledger's 16-bit namespace table is full, new IRIs are stored whole under the overflow code. Deleting facts whose object is such an IRI goes wrong when the delete is indexed, by incremental build and full rebuild alike:

  1. The retractions do not take effect. Those facts are still there after indexing.
  2. With a WHERE-driven delete, the object's IRI no longer resolves to its subject. That subject's own facts, and every other fact pointing at it, become unreachable by IRI. The data is still in the index and reachable through stored references, but queries by IRI return nothing.

Before indexing: a query with the subject's IRI bound still sees the deleted facts. That is the existing #1842 (bound-IRI lookups miss overflow subjects in novelty).

The result is silent wrong answers whose content changes when indexing runs. The bug reproduces on main (57bf7a9) and on next (b68f71c).

Reproduction

Test on a local branch: fluree-db-api/tests/it_overflow_iri_delete_index.rs, run in grp_transact.

Steps (file storage, background indexing off):

  1. Insert 65,534 subjects with distinct prefixes (http://ns{i}.example/s) to fill the table, together with:

    • a vendor V (label, country);
    • two offers O1 and O2, each with vendor → V, page → <O/> and price → 1.

    All of these IRIs land in the overflow namespace.

  2. Full index.

  3. Delete O1, using one of two forms:

    • DELETE WHERE { <O1> ?p ?o }
    • DELETE DATA { <O1> vendor <V> . <O1> page <O1/> . <O1> price 1 }
  4. Query before and after indexing the delete (incremental, and full rebuild).

Results (rows):

check expected pending (both forms) indexed, DELETE WHERE indexed, DELETE DATA
<O1> ?p ?o 0 3 2 2
?o vendor <V> 1 2 0 2
<V> ?p ?x 2 2 0 2
  • In both indexed cases, the two survivors are the facts with IRI objects (vendor, page). The literal-valued price is retracted.
  • Incremental and full rebuild give the same results, so the bug comes from what the delete commit encodes, not from the incremental path.

Seen at scale: BSBM 100M

  • Every import fills the namespace table, leaving 95.6% of subjects in overflow (Measure namespace overflow costs near the 16-bit limit before choosing wider ids or better overflow handling #2135).
  • In one 64-update window, 37 of 38 offers deleted by the Update mix kept their vendor, dc:publisher and offerWebpage facts after indexing, and their vendors became unreachable by IRI.
    • ?o bsbm:vendor <Vendor1034> returned 0 offers.
    • The same join through the stored reference returned 830.
  • The one clean case was a vendor whose prefix had a code.
  • Explore Q10 then dropped a correct row (2 → 1), and a product-page query went from 24 to 16 rows.
  • fluree show lists the correct 10 retractions in that commit.

Mechanism (not established)

Who is affected

Ledgers whose namespace table fills, meaning more than 65,521 distinct prefixes under the default split, and that delete facts pointing at overflow IRIs. That is rare for typical data, and certain for data shaped like BSBM's.

Related: #1842, #1891, #2134, #2135.

Activity

  1. added
    bug
    P1
    area:storage
    on Oct 19, 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

    P1area:storagebug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions