Expand description
waratah geo rebuild-index: recompute O-axis S2 postings from blobs.
Same class as waratah catalog rebuild but a different algorithm: the
old covering must be wiped (Delete every posting of each term), not
merged — catalog rebuild only inserts missing Present rows and is the
wrong template for that part. Points are re-emitted at the same leaf
cell (no blob); geometries re-cover under the current process coverer
config. The O partition never runs the coverer and never opens blobs —
this command is compute/offline-side by construction.
§Rebuild contract
- Term collection is a
HashMapkeyed by the hash of the canonical term bytes (the same term identitywaratah_storage::geo_lexical_keyuses). Only the object slot is inspected: on the O axis, predicates are always IRIs and literals can never be subjects or graph names, so the other three slot checks can never match a geo term. - Per-quad liveness: inside each term’s entry the walk records the
newest version row per REFERENCING QUAD (versions of one logical quad
arrive contiguous in descending-
commit_tsorder in the scan, so the max-ts row is the quad’s latest version; keeping the max-ts entry is order-robust across permutations, which duplicaterdf:typequads at equal timestamps). A term is re-indexed when ANY quad referencing it has its own-latest version = aPut— deleting one quad that shares a literal with other live quads must not retract the term. The whole postings CF is wiped in ONE pass (wipe_geo_index) and only the live terms re-posted: the write path never mirrors deletes to the postings (waratah_compute/src/fanout.rssends none on delete batches — the index stays a conservative superset at every snapshot), so a fully-dead term can still carry stale Put postings and this rebuild IS the garbage collector over them — including postings whose term no longer appears in the hexastore at all, which the per-term wipe this replaced could never see. - Epoch stamping: every rebuilt posting is stamped with
commit_ts = epoch, whereepoch = max commit_ts over the geo-contributing version rows seen by the scan— equal, never +1. The epoch derives from the data being indexed, never from the existing index (which is absent on first rebuild and untrusted afterwards). Zero geo terms found → epoch 0: the index is empty and incrementally maintained from then on, valid for every snapshot. Postings stamped at the epoch become visible exactly when the planner starts trusting the index (waratah_geo/src/plan.rsrewrites thegeof:*FILTER only for snapshots ≥ the persisted epoch). - Persistence: the epoch is stored on the O partition
(
Storage::set_geo_index_epoch,geo_index_metaCF) together with its LIVENESS marker, and both reach compute through the hexastoreDescribepayload. This CLI stamps via the same setter the cluster rebuild’s finish uses, so the two cannot diverge.
Caveat: deriving the epoch from scanned data timestamps means a
future-pinned import --timestamp above the wall clock can stamp an
epoch above later online writes, so rebuilt postings sit below the
planner trust gate (residual custom-fn answers) until the data clock
catches up. The systemic fix (a
monotonic cluster ts watermark) is out of scope here and is a
pre-existing gap for all offline writes.
Remaining exposure: none from the wipe — this CLI wipes the whole
postings CF in ONE pass (wipe_geo_index, the same primitive the
cluster rebuild’s begin_geo_rebuild uses), and the LIVENESS marker
drops in that same atomic batch, so an interrupted run reads UNTRUSTED
instead of trusted-with-a-partial-index (the pre-2026-10-27 hole, when
the CLI wiped per term and the marker survived).
Structs§
- Level
Tally 🔒 - Per-level tallies of the
censuswalk. - Posting
Census 🔒 - Read-only census of one O-axis geo posting store, folded from decoded rows in walk (key) order. Answers the window-estimate decomposition questions at the source: which S2 levels the coverer actually produced, how much L9–L10 expansion mass the stats histogram carries, how large the envelope-bearing (AABB-skippable) population is, and the cells-per-term multiplicity the drain’s distinct seen-set collapses.
- Term
Versions 🔒 - Per-term aggregation for the rebuild walk: the canonical term plus the
newest version row seen for each referencing quad. The term is alive iff
ANY of those per-quad latest versions is a
Put. - Window
State 🔒 --windowmode state: the postings-derived histogram (exact — the collector’s ownobserve_postingclassification, no wire trims and no remainder) plus the drain-truth accounting against the window’s cell-id intervals.
Constants§
Functions§
- census
waratah geo census: read-only per-level census of the O-axis S2 posting store ({data_dir}/main/o). The diagnostic behind geo window estimate over-counting: the level distribution the coverer actually produced, the L9–L10 expansion mass (the only expanding levels since the 2026-10 floor move — L8 and below ride the count-once coarse map), the envelope-bearing population, and cells-per-term multiplicity — all from the postings themselves, not the rolled-up profile.- configure_
proj_ env - Point PROJ at the vendored data tree and disable the network.
- decode_
identity_ 🔒slot - Decode one encoded-term byte run from a quad identity triple. The default graph encodes to ZERO bytes (as in the storage keys).
- format_
orphan_ 🔒error - Format a rebuild failure with enough information to locate the offending quad without embedding an arbitrarily large literal in the error.
- geo_
datatype_ 🔒hashes - The two geo datatype hashes (the orphan-typed-literal discovery set — the same literals the write plugin would have encoded natively had it been enabled at ingest).
- is_
geo_ 🔒term - is_
orphan_ 🔒geo_ typed_ literal - proj_
data_ dir - Where the vendored
proj-datatree lives next to the binary / in-repo. - quad_
identity 🔒 - Quad identity inside one term’s aggregation: the encoded subject, predicate, and graph bytes (the object IS the aggregated term).
- rebuild
- Wipe and rebuild every geo posting under the current coverer config, upgrading orphaned typed literals (ingested while the plugin was disabled) to native terms across all three axis stores.
- reindex_
term 🔒 - Rebuild postings for one NATIVE term via the shared core; geometries read their canonical CRS84 EWKB from the blob store.
- resolve_
orphan_ 🔒lexical - Resolve an orphaned typed literal’s lexical form (inline for
SmallTypedLiteral, the string registry forBigTypedLiteral). - status 🔒