Manybubbles has uploaded a new change for review.
https://gerrit.wikimedia.org/r/78241
Change subject: Imporve reindex logging.
......................................................................
Imporve reindex logging.
The logging when performaning an elasticsearch only reindex wasn't very
good. Now it is better.
Change-Id: I493415592110a230f80c48411fe27f6a56c6549b
---
M updateOneSearchIndexConfig.php
M updateSearchIndexConfig.php
2 files changed, 14 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/41/78241/1
diff --git a/updateOneSearchIndexConfig.php b/updateOneSearchIndexConfig.php
index 7edf897..56718fc 100644
--- a/updateOneSearchIndexConfig.php
+++ b/updateOneSearchIndexConfig.php
@@ -256,7 +256,11 @@
if ( $this->reindexAndRemoveOk ) {
$this->output( "is taken...\n" );
$this->output( $this->indent . "\tReindexing...\n");
+ // Muck with $this->indent because reindex is used to
running at the top level.
+ $saveIndent = $this->indent;
+ $this->indent = $this->indent . "\t\t";
$this->reindex();
+ $this->indent = $saveIndent;
$this->output( $this->indent . "\tSwapping alias...");
$this->getIndex()->addAlias(
CirrusSearch::getIndexName( $this->indexType ), true );
$this->output( "done\n" );
@@ -306,7 +310,10 @@
) );
$totalDocsToReindex = $result->getResponse()->getData();
$totalDocsToReindex = $totalDocsToReindex['hits']['total'];
- $this->output( $this->indent . "\t\tAbout to reindex
$totalDocsToReindex documents\n" );
+ $this->output( $this->indent . "About to reindex
$totalDocsToReindex documents\n" );
+ $operationStartTime = microtime( true );
+ $completed = 0;
+ $rate = 0;
while ( true ) {
wfProfileIn( __method__ . '::receiveDocs' );
@@ -316,10 +323,9 @@
) );
wfProfileOut( __method__ . '::receiveDocs' );
if ( !$result->count() ) {
- $this->output( "\t\tAll done\n" );
+ $this->output( $this->indent . "All done\n" );
break;
}
- $this->output( $this->indent . "\t\tSending " .
$result->count() . " documents to be reindexed\n" );
wfProfileIn( __method__ . '::packageDocs' );
$documents = array();
while ( $result->current() ) {
@@ -331,6 +337,9 @@
$updateResult = $this->getPageType()->addDocuments(
$documents );
wfDebugLog( 'CirrusSearch', 'Update completed in ' .
$updateResult->getEngineTime() . ' (engine) millis' );
wfProfileOut( __method__ . '::sendDocs' );
+ $completed += $result->count();
+ $rate = round( $completed / ( microtime( true ) -
$operationStartTime ) );
+ $this->output( $this->indent . "Reindexed
$completed/$totalDocsToReindex documents at $rate/second\n");
}
}
diff --git a/updateSearchIndexConfig.php b/updateSearchIndexConfig.php
index 5c5d6dc..dfb6ffb 100644
--- a/updateSearchIndexConfig.php
+++ b/updateSearchIndexConfig.php
@@ -39,13 +39,13 @@
}
public function execute() {
- $this->output( 'Validating the ' .
CirrusSearch::CONTENT_INDEX_TYPE . " index...\n");
+ $this->output( CirrusSearch::CONTENT_INDEX_TYPE . "
index...\n");
$child = $this->runChild( 'UpdateOneSearchIndexConfig' );
$child->mOptions[ 'indexType' ] =
CirrusSearch::CONTENT_INDEX_TYPE;
$child->mOptions[ 'indent' ] = "\t";
$child->execute();
- $this->output( 'Validating the ' .
CirrusSearch::GENERAL_INDEX_TYPE . " index...\n");
+ $this->output( CirrusSearch::GENERAL_INDEX_TYPE . "
index...\n");
$child = $this->runChild( 'UpdateOneSearchIndexConfig' );
$child->mOptions[ 'indexType' ] =
CirrusSearch::GENERAL_INDEX_TYPE;
$child->mOptions[ 'indent' ] = "\t";
--
To view, visit https://gerrit.wikimedia.org/r/78241
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I493415592110a230f80c48411fe27f6a56c6549b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Manybubbles <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits