jenkins-bot has submitted this change and it was merged.
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(-)
Approvals:
EBernhardson: Looks good to me, approved
jenkins-bot: Verified
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/247912
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ifc4ce43fda41fc77ebb0cc6aecb8263e470ed568
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Cindy-the-browser-test-bot <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits