fix(consolidation): cursor-paginate fact reads to remove the 10k results ceiling (RES-946) - #333
Open
jhkchan wants to merge 1 commit into
Open
fix(consolidation): cursor-paginate fact reads to remove the 10k results ceiling (RES-946)#333jhkchan wants to merge 1 commit into
jhkchan wants to merge 1 commit into
Conversation
…Y_MAXIMUM_RESULTS ceiling (RES-946) `iter_all_fact_ids` and `iter_unclustered_facts` used offset pagination (`fetch_objects(filters=..., offset=...)`), which Weaviate caps at `QUERY_MAXIMUM_RESULTS` (default 10000). On channels with >10k atomic facts, `full_reconsolidate` failed with `query maximum results exceeded` and the Space wiki could never consolidate (observed live at 12,169 facts: `created=0 updated=0 facts=0 errors=1`). Switch both to Weaviate v4 cursor pagination via `collection.iterator()` with client-side channel/tier/cluster predicates — the same idiom already used by `iter_atomic_fact_ids_and_text` and `snapshot_all_facts_for_reembed`. Cursor iteration walks by UUID with no offset ceiling and no 10MB-per-page risk. Public signatures and yield shapes are unchanged, so the two consolidation.py callers and existing mocked tests are untouched. Scaling caveat (documented in-code): `iterator()` cannot filter server-side, so this scans the whole MemoryFact collection per channel — fine at Atlas's documented scale (~5k-50k facts). Channel-scoped keyset pagination would need an indexed unique monotonic property (a schema migration), deliberately out of scope. Adds tests/stores/test_weaviate_consolidation_cursor.py: >10k rows across multiple channels/tiers flow through, only matching rows are yielded (with vectors for unclustered), and offset `fetch_objects` is never called. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PMMM6KQXmzAEA42UxpyMUm
Member
Author
|
Independent adversarial review — APPROVE (nits only). No P0/P1 code defect. Verified: filter parity is exact ( Should-fix (follow-up, not blocking):
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem (RES-946)
Space consolidation could not run on channels above ~10k facts.
iter_all_fact_idsanditer_unclustered_factsused offset pagination (fetch_objects(filters=…, offset=…)), which Weaviate caps atQUERY_MAXIMUM_RESULTS(default 10000). Past that,full_reconsolidatefailed withquery maximum results exceededand the Space wiki never built.Live evidence (RLP POC): channel
rlp-ingestat 12,169 facts →Full reconsolidation error … query maximum results exceeded→created=0 updated=0 facts=0 errors=1.Fix
Switch both reads to Weaviate v4 cursor pagination via
collection.iterator()with client-sidechannel_id/tier/cluster_idpredicates — the same idiom already used byiter_atomic_fact_ids_and_textandsnapshot_all_facts_for_reembedin this file. Cursor iteration walks by UUID: no offset ceiling, no 10MB-per-page risk (the client batches internally).consolidation.pycallers and existing mocked tests are untouched.Scaling caveat (documented in-code)
iterator()can't filter server-side, so this scans the wholeMemoryFactcollection per channel — fine at Atlas's documented scale (~5k–50k facts). A very large multi-channel install wants channel-scoped keyset pagination, which needs an indexed unique monotonic property (a schema migration) — deliberately out of scope here.Tests
tests/stores/test_weaviate_consolidation_cursor.py: >10k rows across multiple channels/tiers flow through; only matching rows are yielded (with vectors for unclustered);fetch_objects(offset) is never called.tests/services/test_consolidation_streaming.pystill passes (interface preserved).5 passedlocally.Part of epic RES-943 (RLP full-corpus scale + no-cloud gaps).
🤖 Generated with Claude Code
https://claude.ai/code/session_01PMMM6KQXmzAEA42UxpyMUm