Hoo man has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349424 )

Change subject: Use smaller batches in TermSqlIndex::getTermsOfEntities
......................................................................

Use smaller batches in TermSqlIndex::getTermsOfEntities

The batch size was suggested by the DBA.

Bug: T163544
Change-Id: I983f2a51d79e913308f1730a3b4b2cb014cf0461
---
M lib/includes/Store/Sql/TermSqlIndex.php
1 file changed, 12 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/24/349424/1

diff --git a/lib/includes/Store/Sql/TermSqlIndex.php 
b/lib/includes/Store/Sql/TermSqlIndex.php
index 32e8f6a..f32b95f 100644
--- a/lib/includes/Store/Sql/TermSqlIndex.php
+++ b/lib/includes/Store/Sql/TermSqlIndex.php
@@ -462,7 +462,18 @@
                        $this->assertEntityIdFromRightRepository( $id );
                }
 
-               return $this->fetchTerms( $entityIds, $termTypes, 
$languageCodes );
+               // Fetch up to 9 (as suggested by the DBA) terms each time: 
T163544
+               $entityIdBatches = array_chunk( $entityIds, 9 );
+               $terms = [];
+
+               foreach ( $entityIdBatches as $entityIdBatch ) {
+                       $terms = array_merge(
+                               $terms,
+                               $this->fetchTerms( $entityIdBatch, $termTypes, 
$languageCodes )
+                       );
+               }
+
+               return $terms;
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I983f2a51d79e913308f1730a3b4b2cb014cf0461
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <h...@online.de>

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

Reply via email to