Skip to main content

Module import

Module import 

Source
Expand description

Bulk RDF import: online (RPC) or offline (in-process RocksDB).

  • default: spawn S/P/O + registry, stream chunks over gRPC, flush, optional compact
  • --connect: attach to a running cluster; do not spawn or kill children
  • --offline: in-process hexastore WriteBatch load with deferred registry SST runs (RegistryStaging); always flush + compact. The load open attaches the stats collectors, so the flush writes waratah.stats (including the temporal histogram on O). The end compact merges L0 and skips the bottommost rewrite. A chunk’s run is renamed into place only when its SST write and hexastore apply both succeed. A write error ingests the renamed runs and skips compaction; a killed import is recovered the next time the registry opens. An import into an empty O store stamps the geo and temporal index epochs to the import commit_ts.

A parser thread fills a sync_channel(1) of waratah_compute::INSERT_QUAD_CHUNK quads so the next parse overlaps the current write.

Online imports with the text plugin enabled establish trust BEFORE any batch: an untrusted index is pre-built against the running cluster (covering the store’s pre-existing rows), a fingerprint mismatch refuses, and the bracket’s finish stamps only when it began against a trusted index — an import’s documents cover only the imported rows, so stamping over an untrusted begin would declare trust over the pre-existing rows the index never saw.

Macros§

status 🔒
Print an importer status line prefixed with the current UTC timestamp.

Structs§

ImportOptions
Options for run.
IndexEpochPlan 🔒
Which index epochs a successful offline import may stamp.
LoadStats 🔒
OfflineStores 🔒
RegistryStaging 🔒
Staged registry SST run files awaiting bulk ingest at the end of an offline import.
TextImportBracket 🔒
One online import’s text-index bracket: the rebuild lease token plus the trust snapshot the stamp gate needs.

Constants§

PROGRESS_INTERVAL 🔒
How often to print insert progress during a long import.

Functions§

abort_offline_import 🔒
Flush finished chunks and ingest their renamed registry runs, then return write_err. Hexastore compaction and the epoch stamp are skipped: this import did not finish.
bracket_online_text_import 🔒
Take the online import’s text rebuild lease (waratah_text’s import config; fingerprint-checked against any existing index by the partition’s begin) so PutTextIndex frames have somewhere to land.
civil_from_unix_days 🔒
Gregorian date for days since 1970-01-01 (Howard Hinnant civil_from_days).
close_online_text_import 🔒
Release the bracket (bracket_online_text_import). Stamps the epoch only when the load succeeded AND the index read trusted at begin: a begin against an untrusted index plus this load’s documents is exactly a partial index, and stamping it would declare trust over the pre-existing rows the index never saw (the trusted-but-incomplete state). Untrusted → release without stamping; the next startup build owns the epoch. A FAILED import always releases without stamping — the index must not read trusted over an import that did not complete.
compact_offline_hexastore 🔒
compact_online 🔒
Compact S/P/O and the registry. The RPC returns when compaction has finished.
dedupe_registry_entries 🔒
describe_is_trusted 🔒
The trust rule the shells use: a stamped epoch AND the O partition’s fingerprint matching this config, strictly.
describe_text 🔒
Online import text bracket: create/open the O partition’s index with the The O partition’s Describe — where the text-index trust covariates live.
ensure_trusted_text_index 🔒
Ensure the running cluster’s text index reads TRUSTED before an online import loads any data.
index_epochs_to_stamp 🔒
Decide whether this import may stamp the geo and temporal epochs.
join_axis 🔒
join_compact 🔒
Join a scoped compaction/ingest thread; a panic becomes DevError::OfflineWritePanic.
lease_wait_until_trusted 🔒
Bounded wait for a concurrent rebuild’s lease to end and its stamp to land: poll the O Describe every 5 s for up to 60 s. Some(()) when the index reads trusted; None when the wait ran out.
load_offline 🔒
load_online 🔒
maybe_report_progress 🔒
now_commit_ts
Unix milliseconds, or 1 if the clock is before the epoch.
now_stamp 🔒
UTC YYYY-MM-DDTHH:MM:SS.mmmZ for status lines.
open_hexastore 🔒
report_spike_reductions 🔒
run
Spawn, connect, or load offline depending on ImportOptions.
run_connect 🔒
run_offline 🔒
run_spawn 🔒
screen_offline_text_docs 🔒
Fail-closed lexical screen for the offline import’s text documents (offline twin of the write-path guard in WriteFanout::insert_quads_rpc): the text plugin indexes every string literal, and the rebuild walk skips lexicals above the limit and refuses to stamp — an oversized document landing here would create a trusted index state the repair command can never reproduce. The whole import fails loudly instead. The offline route has no gRPC wire and no registry length check, so this screen is the only guard on it.
stamp_offline_index_epochs 🔒
Stamp the epochs selected by index_epochs_to_stamp to commit_ts.
write_offline_chunk 🔒