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

Change subject: Lowered incrTableUpdate() batch size to $wgUpdateRowsPerQuery
......................................................................


Lowered incrTableUpdate() batch size to $wgUpdateRowsPerQuery

Change-Id: I05787b6e9ace26e7a20c228fbc3502983dfed777
---
M includes/deferred/LinksUpdate.php
1 file changed, 5 insertions(+), 5 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  Addshore: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/deferred/LinksUpdate.php 
b/includes/deferred/LinksUpdate.php
index 1f7f3b0..bd4238c 100644
--- a/includes/deferred/LinksUpdate.php
+++ b/includes/deferred/LinksUpdate.php
@@ -84,8 +84,6 @@
         */
        private $user;
 
-       const BATCH_SIZE = 500; // try to keep typical updates in a single 
transaction
-
        /**
         * Constructor
         *
@@ -338,6 +336,8 @@
         * @param array $insertions Rows to insert
         */
        private function incrTableUpdate( $table, $prefix, $deletions, 
$insertions ) {
+               $bSize = RequestContext::getMain()->getConfig()->get( 
'UpdateRowsPerQuery' );
+
                if ( $table === 'page_props' ) {
                        $fromField = 'pp_page';
                } else {
@@ -354,7 +354,7 @@
                        foreach ( $deletions as $ns => $dbKeys ) {
                                foreach ( $dbKeys as $dbKey => $unused ) {
                                        $curDeletionBatch[$ns][$dbKey] = 1;
-                                       if ( ++$curBatchSize >= 
self::BATCH_SIZE ) {
+                                       if ( ++$curBatchSize >= $bSize ) {
                                                $deletionBatches[] = 
$curDeletionBatch;
                                                $curDeletionBatch = [];
                                                $curBatchSize = 0;
@@ -380,7 +380,7 @@
                                $toField = $prefix . '_to';
                        }
 
-                       $deletionBatches = array_chunk( array_keys( $deletions 
), self::BATCH_SIZE );
+                       $deletionBatches = array_chunk( array_keys( $deletions 
), $bSize );
                        foreach ( $deletionBatches as $deletionBatch ) {
                                $deleteWheres[] = [ $fromField => $this->mId, 
$toField => $deletionBatch ];
                        }
@@ -392,7 +392,7 @@
                        wfGetLBFactory()->waitForReplication( [ 'wiki' => 
$this->mDb->getWikiID() ] );
                }
 
-               $insertBatches = array_chunk( $insertions, self::BATCH_SIZE );
+               $insertBatches = array_chunk( $insertions, $bSize );
                foreach ( $insertBatches as $insertBatch ) {
                        $this->mDb->insert( $table, $insertBatch, __METHOD__, 
'IGNORE' );
                        $this->mDb->commit( __METHOD__, 'flush' );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I05787b6e9ace26e7a20c228fbc3502983dfed777
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to