Repository navigation
fix(persistence): bound the paged _has hop by its references, not its sources - #3334
Open
angela-helios wants to merge 2 commits into
Open
angela-helios wants to merge 2 commits into
angela-helios wants to merge 2 commits into
Conversation
The chain resolver searches a hop's references 250 at a time, once per candidate parent type, so a hop at the 300,000-id ceiling ran 1,200 searches per type. Each chained parameter now has a budget of 400 such searches across all its hops and parent types; a hop that does not fit is refused with 422 before any of its searches runs. The liveness check of a forward chain ending in _has spends from the same budget. Closes #3203
… sources The paged `_has` path of the chain resolver collected every matching source resource before reading one reference from each, and refused the search past 100,000 of them. It now extracts the references page by page, drops each page, and applies the hop's id ceiling to the distinct references kept, as the reference-index read does. MAX_HOP_RESOURCES is removed. Closes #3201
This branch has not been deployed
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.
Closes #3201
Stacked on #3321 (#3203): both change the chain resolver. This branch contains that PR's commit; review the last commit here, or merge #3321 first.
Behaviour change to review
_hasby paging through the source resources (PostgreSQL outside its native shape, S3), a_hassearch is no longer refused with422once more than 100,000 source resources match. It is refused when those sources refer to more than 300,000 distinct resources, the ceiling SQLite, Elasticsearch and MongoDB already apply.422of a too-wide paged hop reports the number of distinct references, not of source resources.Summary
The paged
_haspath of the chain resolver collected every matching source resource, bodies included, and only then read one reference parameter from each. #2949 capped that at 100,000 resources, which refused ordinary searches (Patient?_has:Observation:subject:status=finalon a tenant with more than 100,000 final Observations) and still allowed a large allocation per request.search_all_pagesis replaced byHopPages, which hands over one page at a time with the same paging rules (cursor first, offset fallback, errors on an empty page with more results and on a repeated cursor).resolve_reverse_chain_referencesextracts the references of each page and drops the page before reading the next, so it holds at most one page (1,000 resources) of bodies.MAX_HOP_IDS, 300,000) to them, counting whatsearch_reference_valueswould return, so the paged path is refused at the same point and with the same count as the indexed one.MAX_HOP_RESOURCESis removed.Not in this change:
search_reference_valuesfor PostgreSQL from its reference index, which the issue suggests as the better fix for that backend.Tests
Results:
cargo test -p helios-persistence --lib search::: 657 passed, including the four new_hastests and the fan-out tests of fix(persistence): bound the searches one chained search may issue #3321.cargo test -p helios-rest --test search_integration: RESULT.These ran on this branch, which is stacked on #3321.