You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Streaming predicate walk for profile_ledger (core range API that yields flakes) #1795
Originated in the review of #1789 (fluree-db-stats kernel and on-demand column profiling). Both reviews named this as separate scope.
Problem
Fluree::profile_ledger (fluree-db-api/src/profile.rs, property_flakes) ranges every current flake of a property into one Vec<Flake> through range_with_overlay and folds the profile from that vector. Peak memory is therefore proportional to the largest property profiled, not to the sketches, which are a few kilobytes. The lake face (profile_table) does not have this problem: it streams scan batches and is bounded by one batch.
#1789 added ProfileRequest::max_values, which ranges one flake past the cap and refuses the property. That turns an out-of-memory into an error; it does not let a large property be profiled.
What is needed
A core range API that yields flakes to a visitor or as a stream instead of collecting them: the same (index, test, match, opts) shape as range_with_overlay, with novelty merged, so the caller sees the same net current-state flakes it sees today but one at a time. The provider path in fluree-db-query/src/binary_range.rs already walks batches through a cursor and pushes into a Vec; the overlay-only path in fluree-db-core/src/range.rs collects and truncates. Both need a push or pull form.
With it, property_flakes folds each flake as it arrives, max_values becomes a soft limit (stop and report how far the profile got) rather than a refusal, and the group-key maps stay the only per-subject allocation.
Notes
The SHACL validator and ledger_info use the same collecting range for the same reason; a streaming form would serve them too.
range_with_overlay_tracked threads a Tracker for fuel; the streaming form should keep that.
Activity