EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/247927

Change subject: Final tweaks for cross-cluster index copy script
......................................................................

Final tweaks for cross-cluster index copy script

* php 5.3 compat: $self not $this in closure
* added 'processes' option to fork multiple times

Change-Id: Ifc4ce43fda41fc77ebb0cc6aecb8263e470ed568
---
M includes/Maintenance/Reindexer.php
M maintenance/copySearchIndex.php
2 files changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/27/247927/1

diff --git a/includes/Maintenance/Reindexer.php 
b/includes/Maintenance/Reindexer.php
index 124dcb5..cb7d1c7 100644
--- a/includes/Maintenance/Reindexer.php
+++ b/includes/Maintenance/Reindexer.php
@@ -311,7 +311,7 @@
                                                } );
                                        $completed += sizeof( $results );
                                        $rate = round( $completed / ( 
microtime( true ) - $operationStartTime ) );
-                                       $this->outputIndented( $messagePrefix .
+                                       $self->outputIndented( $messagePrefix .
                                                "Reindexed 
$completed/$totalDocsToReindex documents at $rate/second\n");
                                }, 0, $retryAttempts,
                                function( $e, $errors ) use ( $self, 
$messagePrefix ) {
@@ -458,9 +458,11 @@
        }
 
        /**
+        * Public for 5.3 compatibility with closures
+        *
         * @param string $message
         */
-       protected function outputIndented( $message ) {
+       public function outputIndented( $message ) {
                if ( $this->out ) {
                        $this->out->outputIndented( $message );
                }
diff --git a/maintenance/copySearchIndex.php b/maintenance/copySearchIndex.php
index 8f118c2..ccb17c4 100644
--- a/maintenance/copySearchIndex.php
+++ b/maintenance/copySearchIndex.php
@@ -59,6 +59,7 @@
                        'per failure.  Note that failures are not common but if 
Elasticsearch is in the process ' .
                        'of moving a shard this can time out.  This will retry 
the attempt after some backoff ' .
                        'rather than failing the whole reindex process.  
Defaults to 5.', false, true );
+               $this->addOption( 'processes', 'Number of processes to copy 
with. Defaults to 1', false, true );
        }
 
        public function execute() {
@@ -70,6 +71,7 @@
                $reindexChunkSize = $this->getOption( 'reindexChunkSize', 100 );
                $reindexRetryAttempts = $this->getOption( 
'reindexRetryAttempts', 5 );
                $targetCluster = $this->getOption( 'targetCluster' );
+               $processes = $this->getOption( 'processes', 1 );
 
                $sourceConnection = $this->getConnection();
                $targetConnection = $this->getConnection( $targetCluster );
@@ -101,7 +103,7 @@
                                $this->getMappingConfig(),
                                $this
                );
-               $reindexer->reindex( 1, 1, $reindexRetryAttempts, 
$reindexChunkSize);
+               $reindexer->reindex( $processes, 1, $reindexRetryAttempts, 
$reindexChunkSize);
                $reindexer->optimize();
                $reindexer->waitForShards();
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc4ce43fda41fc77ebb0cc6aecb8263e470ed568
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: wmf/1.27.0-wmf.2
Gerrit-Owner: EBernhardson <[email protected]>

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

Reply via email to