Repository navigation
Description
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:
- The retractions do not take effect. Those facts are still there after indexing.
- 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):
-
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
O1andO2, each withvendor → V,page → <O/>andprice → 1.
All of these IRIs land in the overflow namespace.
- a vendor
-
Full index.
-
Delete
O1, using one of two forms:DELETE WHERE { <O1> ?p ?o }DELETE DATA { <O1> vendor <V> . <O1> page <O1/> . <O1> price 1 }
-
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-valuedpriceis 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:publisherandofferWebpagefacts 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 showlists the correct 10 retractions in that commit.
Mechanism (not established)
- Pending failure: matches Bound-IRI lookups miss overflow-namespace subjects in novelty #1842, where the query encodes the bound IRI with the
Sid(EMPTY, iri)fallback. - Indexed failures: the retraction's object probably resolves to a different subject key than the one the import stored,
EMPTYversusOVERFLOW. See alsobuild_reverse_graphkeys graph Sids withencode_iri, which cannot produce the OVERFLOW form the write path stores #1891 (encode_iricannot produce the overflow form). ForDELETE WHERE, the object comes from a WHERE binding rather than the update text, and that path also leaves the IRI pointing at a new, empty subject.
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.
Activity
fix(binary-index): decode an overflow subject to the Sid it is stored…