Repository navigation
Description
Problem
Fast lanes resolve a bound predicate to an index p_id with BinaryIndexStore::sid_to_p_id or find_predicate_id. What a miss means depends on the gate the lane holds. "No rows" is right only where the index answers alone: no novelty, and to_t == max_t. Anywhere else, the predicate may have rows in novelty. The lookup can't see the gate, so each call site decides for itself, and they don't decide the same way. The review of #2449 counted five answers to a miss today:
- Empty, under the metadata gate (
fast_path_store): the callers ofref_to_p_id. - Empty unless the overlay has rows for the predicate, re-checked separately in each lane.
- Decline to the generic pipeline.
- Refuse when the probe would merge novelty for the predicate:
p_id_or_none(5281a06). fix(query): answer an unknown predicate with no rows on three fast paths #2449 adds the same refusal toref_to_p_id. - Wrong: Fast paths error on a predicate the index has never seen instead of returning empty #2448 (an internal error on three lanes), plus two related cases fixed in fix(query): answer an unknown predicate with no rows on three fast paths #2449.
SUM(STRLEN(GROUP_CONCAT))returned an unbound sum instead of0. Cyphertype()andstartNode()hit an internal error once the ledger was indexed.
fluree-db-query has about 100 direct sid_to_p_id / find_predicate_id calls across about 30 files, not all of them in fast lanes. #2449 is the second time, after 5281a06, that this has been settled one call site at a time.
Proposal
One resolver:
enum PredicateId { Indexed(u32), Absent, Undecided }Absent can only be built from proof that the index answers alone. For example, fast_path_store (and its policy-cleared variant) could hand back a token with the store, instead of a bare &Arc<BinaryIndexStore>. A lane that holds the token gets Absent and can answer empty. A lane without it gets Undecided, and must decline or merge. The wrong answers above then become type errors.
Scope
- List the lookup sites and classify each one by the gate it holds.
- Add the token and the resolver, and move the fast lanes onto them. Merging probes keep
p_id_or_none's behavior:Undecidedwith ops to merge is refused. - No behavior change at sites that are already correct. The goal is that a new lane can't get this wrong.
Raised in the review of #2449.
Activity