Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15403715
D20294.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D20294.diff
View Options
diff --git a/src/applications/search/controller/PhabricatorApplicationSearchController.php b/src/applications/search/controller/PhabricatorApplicationSearchController.php
--- a/src/applications/search/controller/PhabricatorApplicationSearchController.php
+++ b/src/applications/search/controller/PhabricatorApplicationSearchController.php
@@ -249,6 +249,8 @@
$pager = $engine->newPagerForSavedQuery($saved_query);
$pager->readFromRequest($request);
+ $query->setReturnPartialResultsOnOverheat(true);
+
$objects = $engine->executeQuery($query, $pager);
$force_nux = $request->getBool('nux');
@@ -798,6 +800,7 @@
$object = $query
->setViewer(PhabricatorUser::getOmnipotentUser())
->setLimit(1)
+ ->setReturnPartialResultsOnOverheat(true)
->execute();
if ($object) {
return null;
diff --git a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
--- a/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
+++ b/src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
@@ -45,6 +45,8 @@
*/
private $raisePolicyExceptions;
private $isOverheated;
+ private $returnPartialResultsOnOverheat;
+ private $disableOverheating;
/* -( Query Configuration )------------------------------------------------ */
@@ -130,6 +132,16 @@
return $this;
}
+ final public function setReturnPartialResultsOnOverheat($bool) {
+ $this->returnPartialResultsOnOverheat = $bool;
+ return $this;
+ }
+
+ final public function setDisableOverheating($disable_overheating) {
+ $this->disableOverheating = $disable_overheating;
+ return $this;
+ }
+
/* -( Query Execution )---------------------------------------------------- */
@@ -319,9 +331,22 @@
break;
}
- if ($overheat_limit && ($total_seen >= $overheat_limit)) {
- $this->isOverheated = true;
- break;
+ if (!$this->disableOverheating) {
+ if ($overheat_limit && ($total_seen >= $overheat_limit)) {
+ $this->isOverheated = true;
+
+ if (!$this->returnPartialResultsOnOverheat) {
+ throw new Exception(
+ pht(
+ 'Query (of class "%s") overheated: examined more than %s '.
+ 'raw rows without finding %s visible objects.',
+ get_class($this),
+ new PhutilNumber($overheat_limit),
+ new PhutilNumber($need)));
+ }
+
+ break;
+ }
}
} while (true);
diff --git a/src/infrastructure/storage/lisk/PhabricatorQueryIterator.php b/src/infrastructure/storage/lisk/PhabricatorQueryIterator.php
--- a/src/infrastructure/storage/lisk/PhabricatorQueryIterator.php
+++ b/src/infrastructure/storage/lisk/PhabricatorQueryIterator.php
@@ -25,6 +25,8 @@
$pager = clone $this->pager;
$query = clone $this->query;
+ $query->setDisableOverheating(true);
+
$results = $query->executeWithCursorPager($pager);
// If we got less than a full page of results, this was the last set of
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 4:37 AM (1 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7497572
Default Alt Text
D20294.diff (3 KB)
Attached To
Mode
D20294: When queries overheat, raise an exception
Attached
Detach File
Event Timeline
Log In to Comment