Skip to content

Query: one predicate-id resolver whose 'absent' requires proof the index answers alone #2479

Open

Description

@bplatz

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:

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: Undecided with 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

  1. added
    enhancement
    P3
    area:query
    on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area:queryenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions