jenkins-bot has submitted this change and it was merged.

Change subject: In Special:AllPages, limit the size of hierarchical lists
......................................................................


In Special:AllPages, limit the size of hierarchical lists

Traversal of the entire page list by spidering the top levels is thought
to require O(N^3) DB CPU time where N is the number of pages on the
wiki. So introduce a limit for the size of such lists, as measured by
the pre-existing estimateRowCount().

Bug: 56840
Change-Id: I189ba71de869496a36f49283ec6dce7bbdfccd73
---
M includes/specials/SpecialAllpages.php
1 file changed, 18 insertions(+), 0 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialAllpages.php 
b/includes/specials/SpecialAllpages.php
index a082049..388705d 100644
--- a/includes/specials/SpecialAllpages.php
+++ b/includes/specials/SpecialAllpages.php
@@ -50,6 +50,16 @@
        protected $maxPageLength = 70;
 
        /**
+        * Maximum number of pages in a hierarchical ("top level") list.
+        *
+        * Traversal of the entire page list by spidering the top levels is 
thought
+        * to require O(N^3) DB CPU time where N is the number of pages on the 
wiki.
+        * See bug 56840. If this limit is exceeded, the behaviour becomes like 
a
+        * simple alphabetic pager.
+        */
+       protected $maxTopLevelPages = 50000;
+
+       /**
         * Determines, which message describes the input field 'nsfrom'.
         *
         * @var string $nsfromMsg
@@ -201,6 +211,14 @@
                $lines = $wgMemc->get( $key );
 
                $count = $dbr->estimateRowCount( 'page', '*', $where, 
__METHOD__ );
+
+               // Don't show a hierarchical list if the number of pages is 
very large,
+               // since generating it will cause a lot of scanning
+               if ( $count > $this->maxTopLevelPages ) {
+                       $this->showChunk( $namespace, $from, $to, 
$hideredirects );
+                       return;
+               }
+
                $maxPerSubpage = intval( $count / $this->maxLineCount );
                $maxPerSubpage = max( $maxPerSubpage, $this->maxPerPage );
 

-- 
To view, visit https://gerrit.wikimedia.org/r/94690
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I189ba71de869496a36f49283ec6dce7bbdfccd73
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to