Skip to main content

Crate waratah_compute

Crate waratah_compute 

Source
Expand description

Stateless compute coordinator for the five-process MVP cluster.

Write path (Phase 5): encode a quad once, register hashed strings on the string-registry process, and fan InsertQuads out in parallel to the S, P, and O hexastore partitions.

Read path (Phase 6–9c): parse SPARQL SELECT / ASK / CONSTRUCT / DESCRIBE with spargebra, rewrite via sparopt, lower to a Waratah plan tree (scans / joins / FILTER / OPTIONAL / UNION / VALUES / BIND / GROUP BY / aggregates / property paths / LIMIT / OFFSET / nested SELECT as an opaque SubSelect boundary), route each scan to one hexastore axis, execute broadcast / shuffle / hash joins via waratah_exec, and resolve raw strings from the registry for projected columns or result-graph terms. DESCRIBE uses a DescribeMode configured on the compute node (star default). Each compute also serves gRPC Health/Describe and can assemble a ClusterSnapshot for GET /waratah/cluster from the static waratah_router::ClusterConfig membership list (no gossip).

Forward hooks: Raft (Phase 8) wraps the same hexastore apply path and supplies SnapshotId from a cluster TSO; multi-registry process sharding uses waratah_router::ClusterConfig::registry_for_hash. This crate does not co-locate registry with partitions, and implements no consensus, gossip, or cloud tiering.

Re-exports§

pub use plugin::PluginHost;

Modules§

core_width
Process-wide core width for executor parallelism decisions.
plugin
Generic plugin seams: writes, plan, and execution.
strict_sparql
strict-sparql compatibility mode: a process-wide toggle that gates Waratah’s documented SPARQL deviations behind strict 1.1 adherence.

Macros§

query_trace
Emit a TraceEvent only when tracing is enabled.

Structs§

AppliedGraph
The four-field graph scope a lowered scan carries: which graphs the pattern may read at its plan position. Public so plugins that mint scans outside the SPARQL lowering (the text plugin’s subject-mode candidates) can copy a sibling scan’s scope and keep visibility identical to the surrounding BGP.
BroadcastFilter
Allow-list of encoded terms for one unbound pattern slot (Phase 9b broadcast).
ClassSummary
One class in the summary.
ClusterKnobs
Knobs copied onto self / Compute Describe.
ClusterSnapshot
JSON body of GET /waratah/cluster.
ComputeAdminService
Identity advertised on the compute gRPC Describe RPC.
ComputeNode
Connected compute coordinator.
ComputeView
One compute coordinator as seen by this request.
CustomFunction
A registered custom function: IRI, arity bounds, and its callables.
CustomFunctions
IRI-keyed map of custom functions.
CustomOp
One plugin-defined custom operator.
CustomOpCost
Explicit execution-cost model for one plugin op (CustomOp::cost).
EncodedSolutions
Variable-keyed columnar solutions of interned TermIds.
ExistsClause
One EXISTS { P } or NOT EXISTS { P } FILTER conjunct.
ExplainOptions
Dataset knobs for LogicalPlan::explain_with.
GraphFilter
Allow-list or block-list of encoded graph names for a scan RPC.
GrpcHexastoreClients
Tonic clients for all three hexastore axes.
GrpcRegistryClients
Tonic client(s) for the string-registry endpoint(s).
HexastoreDescribe
Decoded hexastore Describe payload for the cluster snapshot.
InsertResult
Outcome of a successful fan-out insert.
JoinEdge
Flat join record for BGP pipeline building and plan inspection.
JoinMeta
Planner annotations on an inner join (costing / execution hints).
LogSink
Always-compiled operational logger for the SPARQL executor.
LogicalPlan
A SELECT reduced to a plan tree and a projection list.
LsmMetricsView
Optional LSM counters (absent on memory backends).
NotebooksCapability
Notebook service capability block on a compute entry.
OutputVars
Output variable boundness for a plan subtree.
PathOp
One property-path leaf after lowering.
PhaseTimers
Cumulative wall-time counters for one query execute: hexastore scan RPCs and string-registry resolve RPCs.
PlannerSummary
Cheap planner-cache summary (no CMS/HLL).
ProjectedSolutions
SELECT rows still encoded, plus interned strings from a registry resolve.
PropertySummary
One property in the summary.
QueryContext
Per-query policy, identity, and sinks for SPARQL plan + execute.
QueryDataset
Resolved SPARQL dataset for one query (planner + executor).
QueryEngine
SPARQL coordinator over the hexastore and registry endpoints.
RdfParseOptions
Parser options shared by CLI import and HTTP ingest.
RdfParsePipeline
Parser thread plus the chunk channel it fills.
RegistryDescribe
Decoded registry Describe payload.
RepoInfo
One RDF repository this HTTP server exposes.
ResolveCache
Process-lifetime LRU of StrHash → resolved string, shared by all queries on a compute node.
RetryPolicy
How many times to retry a transient RPC before giving up.
RoutingView
Routing table dump for one compute.
ScanOp
One triple pattern resolved to an encoded scan plus its variable slots.
SchemaSummary
The computed summary.
SchemaSummaryLimits
Resolved limits the API layer reports and clamps against.
SchemaSummaryParams
Caller request for a summary; limits must already be clamped to the server maxima by the route layer.
SecurityContext
Permissions for the user running this query.
SlotMark
Liveness plus bag mark stamped on every scan slot after [crate::liveness::annotate_liveness].
SortKey
One SPARQL ORDER BY key.
StatsProfile
Mergeable statistical profile for one shard or the whole cluster.
StorageView
Hexastore partition or string-registry process.
SubSelectOp
Lowered nested SELECT (SubSelect) boundary.
TermDict
Re-exported so a plugin that stands in for the subject resolve (a test double, or a plugin-provided window) can intern its rows into the same query dictionary the engine uses, without a direct waratah_exec dependency. Bidirectional intern table for one SPARQL query.
TextSubjectWindow
One resolved (subject, graph) window, interned into the query dict.
TextSubjectWindowBuilder
Intern one window’s rows as the partition pages arrive.
TraceSink
High-volume execution-order / RPC / timing sink.
ValuesOp
SPARQL VALUES table after encoding (UNDEF cells are None).
WriteFanout
Coordinator that fans one logical insert out to registry + S/P/O.

Enums§

BagMark
Per-variable bag mark after the liveness walk.
ComputeError
Failure on the compute write or SELECT path.
CustomEval
Outcome of a custom function invocation.
DefaultGraphWindow
How a bare BGP / path (SPARQL default graph) binds G.
DescribeMode
How QueryEngine builds a DESCRIBE result graph.
DomainScanKind
Slot roles shared by the distinct domain scan and the domain count scan.
ExistsKind
How a lowered ExistsClause will run.
ExplainFormat
EXPLAIN output kind (format= query param / CLI --format).
ExprCapability
How far an expression can be evaluated without the string registry.
HeadScanKind
Which bare axis-head-scan rewrite a ScanOp uses.
InstanceCounts
Whether instance counts are computed.
JoinStrategy
Physical join hint chosen at plan time (Phase 9b executes broadcast/shuffle).
Liveness
Whether a scan slot column is projected downstream.
LogLevel
Operational log severity. Higher values are more verbose.
Mints
Mint provenance of an expression’s encoded-path term construction: what it takes to resolve the bytes of a term the evaluator mints from this expression, and therefore what seeding the constant positions of the expression owe the query-local cache.
NamedGraphWindow
How GRAPH patterns bind G.
NodeStatus
Probe outcome.
PlanNode
Physical plan tree after sparopt + Waratah lowering.
PropertyKind
Property kind derived from its rdf:type declarations.
PropertyPath
Compiled SPARQL 1.1 property path over interned EncodedTerm predicates.
QueryOutput
Query result after execute (and, for SELECT, registry resolve).
QueryResults
Materialized query results: SELECT bindings, an ASK boolean, or a graph.
TraceEvent
Structured execution-trace event (scan / join / path / RPC timing).

Constants§

AUTO_INSTANCE_COUNT_MAX_TRIPLES
instanceCounts=auto computes counts only up to this triple count.
CLUSTER_PROBE_TIMEOUT
Per-peer / per-partition probe budget so one down node cannot stall HTTP.
CONCURRENT_STAR_OVER_FETCH_PERCENT
Extra probe rows a concurrent star may read, per 100 rows the plain-join plan would have returned from that probe. 15 means at most 1.15×.
DEFAULT_JOIN_CHUNK_CAP
Cap one eager join chunk at this many rows when the budget would allow more (matches crate::SCAN_BATCH so a chunk is not the whole query).
DEFAULT_QUERY_MEMORY_BUDGET_BYTES
Default per-query RAM budget used to size eager join chunks (Phase 2).
DEFAULT_RESOLVE_CACHE_BYTE_BUDGET
Summed string-length budget for cached entries (bytes).
DEFAULT_RESOLVE_CACHE_ENTRIES
Default entry capacity (WARATAH_RESOLVE_CACHE_ENTRIES overrides; 0 disables the cache). At ~100–150 bytes per typical IRI entry this bounds the cache at roughly 30–60 MiB of payload plus map overhead.
FETCH_ONCE_MARGIN_MILLI
How many times over its whole-read price per-page mode may cost before the fetch-once trigger fires, in milli (1400 = 1.4×). The build price is one sequential drain of the arm’s UNCLAMPED estimate (whole_read_rows); the probe price is pages × (seeks × SEEK_EQUIV + matched × MATCHED_ROW_EQUIV).
FETCH_ONCE_MATCHED_BOUND_EQUIV_MILLI
Cost of one row in the fetch-once trigger’s per-page price when the matched count is the unknown-domain fallback rather than an estimate, in milli-rows.
FETCH_ONCE_MATCHED_ROW_EQUIV_MILLI
Cost of one MATCHED row in the fetch-once trigger’s per-page price, in milli-rows: one row an allow-list fetch returns costs this many sequentially-streamed rows. Matched rows are not free even though the seek-union transport fetches them in one pass: each returned row pays the wire fetch (≈ 1.0) plus decode, intern and batch-table assembly (≈ 0.23) on the compute side.
FETCH_ONCE_SEEK_EQUIV_MILLI
Seek-vs-scan exchange rate for the fetch-once trigger predicate, in milli-rows: one index seek costs this many sequentially-streamed rows.
GROUP_FOLD_BATCH
Rows per fold batch in the GROUP BY executor’s pipelined loop.
INSERT_QUAD_CHUNK
Maximum quads sent in one InsertQuads RPC.
MAX_CLASSES
Server maximum for returned classes (contract: "caps".classes).
MAX_PROPERTIES
Server maximum for returned properties (contract: "caps".properties).
MAX_UNARY_SCAN_QUADS
Ceiling for “provably small” unlimited scans that may take the unary ScanPattern RPC (one round trip) instead of the storage-driven ScanPatternStream endpoint. Derived, not chosen: the worst-case serialized row is waratah_proto::WORST_CASE_QUAD_WIRE (143 bytes — four max-width encoded terms plus proto framing, pinned by a test against the real encoder), so one waratah_proto::GRPC_MAX_MESSAGE_SIZE message holds at most this many rows no matter what data the encoder produces. The value sits at the exact floor of that division by design — worst-case means the message may be full to the last varint.
OPEN_STAR_PAIR_BUDGET
Default distinct-pair circuit breaker for * / + with no LIMIT.
PARALLEL_PROBE_PAGES_DEFAULT
The default batch-fill page ceiling. Kept as a named constant so reset_parallel_probe_pages and the static’s initializer share one number.
PARALLEL_PUSHDOWN_WAVE_MAX
Wave ceiling on chunk fetches dispatched concurrently for one over-threshold broadcast pushdown (the parallel pushdown transport in [crate::query::parallel_pushdown]). An over-threshold term list is sliced into waratah_stats::PUSHDOWN_TERMS_LIMIT-term chunks; at most this many chunk fetches are outstanding at once, the rest queue and dispatch as the pool frees. The EFFECTIVE ceiling is the query’s free-permit count: the arm-permit pool — sized from QUERY_FETCH_CONCURRENCY in context.rs as the engine fetch concurrency plus one permit for the query root’s own whole-execution hold — funds what actually dispatches, so at the default fetch concurrency (3, a 4-permit pool) this knob rarely binds, and a pool with nothing free degrades the transport to degrade_to_chunked_serial: one sequential RPC per remaining chunk, never a concatenated multi-chunk request and never the unfiltered whole read the producing verdict rejected.
PATH_PAIR_BUDGET
Default distinct-pair circuit breaker for bound / one-end walks (8e6).
PROBE_SEEK_CONCURRENCY_CURVE
Measured realized-seek-concurrency curve for the parallel probe road: (funded fetch concurrency in milli → realized wall-clock speedup in milli). Funding w permits of concurrent chunk fetches buys realized(w) speedup — sublinear, because the fetch path is part CPU work (decode, dedup, table assembly), and saturating near the box’s physical core count. Lookup interpolates linearly between points; a funded fetch concurrency above the last point clamps to it, and below the first point returns 1000 (one outstanding fetch at a time realizes exactly itself). The table must be STRICTLY INCREASING in its funded value — the lookup debug-asserts it, and a duplicate funded value (which would make the interpolation span zero) resolves to the higher point’s realized value instead of dividing by zero.
PUSHDOWN_MIN_POLLUTION_MILLI
Minimum milli-scale vocabulary pollution for an over-threshold Broadcast term list to stay on the parallel pushdown transport, instead of dropping the key to the unfiltered whole read. Pollution is the fraction of the probed arm’s rows that no pushed term can match: at or below this threshold the whole read fetches mostly useful rows and is the cheaper road (no seeks at all); above it the majority of a whole read would be dead rows and the seek-union transport wins. An unresolvable estimate (probe key domain unknown) reads as maximally polluted, so the gate can only ever keep the transport — it never introduces a whole read the pre-gate code would not have taken.
PUT_BLOBS_BATCH_BYTES
Byte budget for one batched PutBlobs RPC (headroom under waratah_proto::GRPC_MAX_MESSAGE_SIZE).
RESOLVE_STRING_CHUNK
Maximum hashes in one ResolveStrings RPC (same bound as insert / broadcast).
SCAN_BATCH
Default encoded rows pulled per scan RPC when filling a Slice — a pacing policy, not a wire bound, and deliberately not tied to any other constant. It must stay AT MOST both of its two ceilings (compile-time asserts in join_chunks.rs enforce <=; the value sits strictly below both so the legality properties are margins, not boundary coincidences):

Traits§

BlobStoreClient
Content-addressed blob client against the registry process.
HexastoreAdmin
Health + Describe for cluster HTTP (hexastore axes).
HexastoreAxisHeadStats
Max commit_ts among the versioned keys whose slot-0 head term falls under head_prefixes (every version counts; liveness is not evaluated, so the result only ever overestimates — safe for its one consumer, the geo upgrade’s stage-1 swap-timestamp bound).
HexastoreCatalog
S-axis named-graph catalog (empty graphs included; never the RDF default graph).
HexastoreCompact
Full-range compact on one hexastore axis.
HexastoreFlush
Flush MemTables to SST on one hexastore axis.
HexastoreGeo
O-axis geometry-index client (GeoSPARQL plugin path).
HexastoreInsert
Insert versioned quads onto one hexastore axis.
HexastoreScan
Scan a pattern on one hexastore axis, as of a snapshot.
HexastoreStats
Fetch a shard statistical profile (Phase 7).
PreparedLiteralCache
Query-local source data and prepared values available to a cache-aware encoded custom function.
RegistryAdmin
Health + Describe for the string-registry process this compute dials.
StringRegister
Register hashed strings on the string-registry process(es).
StringRegistryCompact
Full-range compact on the string-registry process (no-op on memory).
StringRegistryFlush
Flush MemTables on the string-registry process (no-op on memory).
StringResolve
Resolve hashed strings for final output bindings (late materialization).

Functions§

and_fold
Rebuild && from conjuncts (None when parts is empty).
applied_default_graph
The applied scope for a plain pattern at dataset scope (no GRAPH block): the query’s default window mapped exactly as the lowering maps it (RdfDefault → Some(DefaultGraph), AllGraphs → None, FROM windows → their ground / allow shapes, plus the merge-default fixup).
assemble_cluster_snapshot
Assemble a snapshot: self without RPC, peers via Compute gRPC, storage via Describe.
bind_compute_admin
Bind the compute gRPC listener. Failure is returned to the caller so process startup can abort before HTTP is served.
classify
Classify expression for planning (early vs residual).
cors_proxy_base
Console proxy base advertised on every compute in a cluster snapshot.
extension_for_format
File extension (no dot, no .gz) to append when a snippet path has none.
flatten_and
Flatten top-level && into conjuncts (cloned).
ground_unique_probe_term
Plugin-rewrite surface of the private broadcast grounding: the one ground term a plan binds to variable, if the driver binds it uniquely. A plugin probe arm (e.g. the geo scan) pins this term into its op the same way [ground_and_recost_broadcasted_arm] grounds a Scan’s pattern slot.
http_origin
Scheme and authority of an advertised HTTP URL (http://host:port).
insert_rdf_file
Parse path and call insert once per chunk.
install_process_registry
Install the process-lifetime custom-function registry (first install wins).
join_rdf_parser
Wait for the parser thread. A panic becomes ComputeError::ParserThreadPanicked.
main_repository_info
Default repository list for Describe when the HTTP catalog is main only.
mint_provenance
Mint-provenance classification — see Mints. Composition is max over children, the same discipline as classify.
mint_scope_token
Fresh 16-character random token (~95 bits) for scope-internal names.
note_wire_stream_item
Count one delivered stream item of rows rows at the transport boundary.
now_commit_ts
Unix milliseconds, or 1 if the clock is before the epoch.
pretty_sparql
Indent compact SPARQL-syntax explain output (optimised-sparql / planned-sparql) for human reading: one triple pattern or group element per line, two-space indent per {, ; property lists continue on their own indented lines, and [...] blank-node property lists nest.
pretty_sse
Indent compact Jena SSE for human reading.
process_registry
The process registry, initializing it to the builtins on first use so unit tests and early callers (before any engine exists) still see the 7 XSD casts.
rdf_format_from_name
Map a snippet/API format name (turtle, ntriples, …) to [RdfFormat].
rdf_format_from_path
Guess RDF syntax from path, including a trailing .gz.
rdf_syntax_name
Stable JSON label for a parsed RDF format ("turtle", "ntriples", …).
reset_fetch_once_margin_milli
Restore the default fetch-once trigger margin.
reset_fetch_once_matched_bound_equiv_milli
Restore the default degenerate-matched-bound cost.
reset_fetch_once_matched_row_equiv_milli
Restore the default matched-row cost.
reset_fetch_once_seek_equiv_milli
Restore the default fetch-once seek exchange rate.
reset_geo_drain_memo_entry_terms
Restore the default geo drain memo per-entry limit.
reset_geo_drain_memo_total_terms
Restore the default geo drain memo total budget.
reset_group_fold_batch
Restore the default fold batch size.
reset_max_unary_scan_quads
Restore the default unary-scan ceiling.
reset_memo_spill_cells
Restore the default memo spill threshold.
reset_parallel_probe_pages
Restore the default batch-fill page ceiling.
reset_parallel_pushdown_wave_max
Restore the default concurrent chunk-fetch wave ceiling.
reset_pushdown_min_pollution_milli
Restore the default minimum over-threshold pollution.
reset_query_fetch_concurrency
Restore the environment-derived parallel-probe engine fetch concurrency: the next [query_fetch_concurrency] read resolves WARATAH_QUERY_FETCH_CONCURRENCY (or the default) again. The same ordering rule as set_query_fetch_concurrency applies: only before context construction, or after every live context is dropped.
reset_residual_resolve_window
Restore default residual resolve window.
reset_scan_batch
Restore the default scan batch size.
scan_page_as_wire_frames
Re-frame one unary scan page as the frame sequence the ScanPatternStream protocol speaks, so a unary-backed transport (the trait’s default HexastoreScan::scan_pattern_stream, and test doubles built on it) is indistinguishable from the partition’s walk: a COMPLETED walk’s terminal verdict never rides a data frame — the rows go out as one verdict-less frame and the verdict follows as one EMPTY terminal frame — while a limit stop (Limited) and an unpurchased verdict (None) stay on the single frame, exactly as the partition’s limit-stop flush does. Emitting the empty terminal frame here is deliberate: the consumer branches written for that shape (the driver funnel’s terminal-frame break, bounded drains’ last-frame-wins) must hold for every transport, not only the gRPC one.
schema_summary_limits
The two server maxima, for the route layer (caps wire field + limit clamping).
serve_compute_admin
Bind addr and serve Compute Health/Describe until the future is dropped.
serve_compute_admin_incoming
Serve Compute Health/Describe on an already-bound listener.
set_fetch_once_margin_milli
Override the fetch-once trigger margin, milli (1400 = 1.4×) (tests / tuning).
set_fetch_once_matched_bound_equiv_milli
Override the degenerate-matched-bound cost, milli-rows per bound row (tests / tuning). See FETCH_ONCE_MATCHED_BOUND_EQUIV_MILLI.
set_fetch_once_matched_row_equiv_milli
Override the matched-row cost, milli-rows per matched row (tests / tuning). See FETCH_ONCE_MATCHED_ROW_EQUIV_MILLI.
set_fetch_once_seek_equiv_milli
Override the fetch-once seek exchange rate, milli-rows per seek (tests / tuning). See FETCH_ONCE_SEEK_EQUIV_MILLI for placement.
set_geo_drain_memo_entry_terms
Override the geo drain memo per-entry limit (tests / tuning).
set_geo_drain_memo_total_terms
Override the geo drain memo total budget (tests / tuning).
set_group_fold_batch
Override the GROUP BY executor’s fold batch size (tests / tuning).
set_max_unary_scan_quads
Override the proven-bound ceiling under which an unlimited scan still uses the unary ScanPattern RPC (tests / tuning). 0 forces every unlimited scan onto the streaming endpoint — unlike set_scan_batch, zero is meaningful here, not degenerate.
set_memo_spill_cells
Override the memo spill threshold in term cells (tests / tuning).
set_parallel_probe_pages
Override the batch-fill page ceiling (tests / tuning). At 1 every batch holds exactly one driver page and each page takes the per-page allow-list road’s own filtered fetch.
set_parallel_pushdown_wave_max
Override the concurrent chunk-fetch wave ceiling (tests / tuning).
set_pushdown_min_pollution_milli
Override the minimum over-threshold pollution for the parallel pushdown transport (tests / tuning).
set_query_fetch_concurrency
Override the configured parallel-probe engine fetch concurrency (tests / tuning). Values above [MAX_QUERY_FETCH_CONCURRENCY] clamp to it. The value persists for the rest of the process unless reset.
set_residual_resolve_window
Override residual resolve window (tests / tuning).
set_scan_batch
Override scan batch size used while filling LIMIT / OFFSET (tests / tuning).
spawn_rdf_parser
Spawn a thread that parses path and sends quad batches.
split_filter
Split a FILTER into early (encoded / maybe) and residual (always-resolve) parts.
subtree_hostable_variables
Collect every variable node can consume as a pushed allow-list key: the hosted-variable set behind [probe_scan_has_key] — the same push-transparent topology (Join / Union / LeftJoin / Filter / Extend / Slice / Distinct / Sort / Group / JoinGraphVar crossed; SubSelect, plugin children, Values, and the count nodes opaque) — gathered instead of probed, so the runtime push gate (PushGate::Hostable) consults one plan-time stamp instead of re-walking the subtree per driver page. A scan contributes its live slot variables (S/P/O and the graph slot), a custom op its declared outputs (the keyed regime consumes pushed values directly). See the Join variant’s rhs_hostable_keys field for the stamp’s contract.
take_wire_stream_totals
Read-and-reset the wire counters: (items, rows) observed since the previous call.
text_probe_memo_entry_terms
Per-entry admission limit (in terms) of the text CANDIDATE drain memo — the point where a literal-mode probe’s drain window can be paid once instead of per page. The text planner stamps it into CustomOpCost::probe_memo_entry_rows.
text_subject_memo_entry_rows
Rows the text SUBJECT memo admits in one entry for the given row shape: one interned id per subject, a second per graph term. The subject rewrite stamps it into CustomOpCost::probe_memo_entry_rows, so the cost model prices the drain once exactly when the runtime memo can hold the window.

Type Aliases§

QuadPageStream
Storage-driven drain of one scan: pages of encoded quads until the partition exhausts the prefix (or the request limit rows have been emitted); an Err item terminates the stream.
SubjectRowStream
Streaming page of resolved (subject, graph) rows.
TermPageStream
Streaming page of distinct candidate terms.