1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Correct the interaction between overheating and offset-based paging

Summary:
Ref T13386. If you issue `differential.query` with a large offset (like 3000), it can overheat regardless of policy filtering and fail with a nonsensical error message.

This is because the overheating limit is based only on the query limit, not on the offset.

For example, querying for "limit = 100" will never examine more than 1,100 rows, so a query with "limit = 100, offset = 3000" will always fail (provided there are at least that many revisions).

Not all numbers work like you might expect them to becuase there's also a 1024-row fetch window, but basically small limits plus big offsets always fail.

Test Plan: Artificially reduced the internal window size from 1024 to 5, then ran `differential.query` with `offset=50` and `limit=3`. Before: overheated with weird error message. After: clean result.

Maniphest Tasks: T13386

Differential Revision: https://secure.phabricator.com/D20728
This commit is contained in:
epriestley 2019-08-21 19:54:24 -07:00
parent 5741514aeb
commit f1b054a20f

View file

@ -233,7 +233,10 @@ abstract class PhabricatorPolicyAwareQuery extends PhabricatorOffsetPagedQuery {
// number of records when the viewer can see few or none of them. See // number of records when the viewer can see few or none of them. See
// T11773 for some discussion. // T11773 for some discussion.
$this->isOverheated = false; $this->isOverheated = false;
$overheat_limit = $limit * 10;
// See T13386. If we on an old offset-based paging workflow, we need
// to base the overheating limit on both the offset and limit.
$overheat_limit = $need * 10;
$total_seen = 0; $total_seen = 0;
do { do {