Manybubbles has uploaded a new change for review.
https://gerrit.wikimedia.org/r/92665
Change subject: Better handle PoolErrors.
......................................................................
Better handle PoolErrors.
This should stop those sometimes crashes during rebuilds.
Bug: 56060
Change-Id: I6f293c6cf3470e8c85339f30b99776cbe5d31021
---
M includes/CirrusSearchSearcher.php
M includes/CirrusSearchUpdater.php
2 files changed, 25 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/65/92665/1
diff --git a/includes/CirrusSearchSearcher.php
b/includes/CirrusSearchSearcher.php
index 3fceed2..dfe7111 100644
--- a/includes/CirrusSearchSearcher.php
+++ b/includes/CirrusSearchSearcher.php
@@ -283,10 +283,13 @@
return Status::newGood( null );
} catch (
\Elastica\Exception\ExceptionInterface $e ) {
wfLogWarning( "Search backend error
during get for $id. Error message is: " . $e->getMessage() );
- $status = new Status();
- $status->warning(
'cirrussearch-backend-error' );
- return $status;
+ return Status::newFatal(
'cirrussearch-backend-error' );
}
+ },
+ 'error' => function( $status ) {
+ $status = $status->getErrorsArray();
+ wfLogWarning( 'Pool error performing a get
against Elasticsearch: ' . $status[ 0 ][ 0 ] );
+ return $status;
}
) );
$result = $getWork->execute();
@@ -362,6 +365,11 @@
wfLogWarning( "Search backend error
during $description. Error message is: " . $e->getMessage() );
return false;
}
+ },
+ 'error' => function( $status ) {
+ $status = $status->getErrorsArray();
+ wfLogWarning( 'Pool error searching
Elasticsearch: ' . $status[ 0 ][ 0 ] );
+ return false;
}
) );
$result = $work->execute();
diff --git a/includes/CirrusSearchUpdater.php b/includes/CirrusSearchUpdater.php
index cca0db8..c78fcd5 100644
--- a/includes/CirrusSearchUpdater.php
+++ b/includes/CirrusSearchUpdater.php
@@ -180,14 +180,19 @@
return;
}
wfDebugLog( 'CirrusSearch', "Sending $documentCount documents
to the $indexType index." );
- $work = new PoolCounterWorkViaCallback( 'CirrusSearch-Update',
"_elasticsearch",
- array( 'doWork' => function() use ( $indexType,
$documents ) {
+ $work = new PoolCounterWorkViaCallback( 'CirrusSearch-Update',
"_elasticsearch", array(
+ 'doWork' => function() use ( $indexType, $documents ) {
try {
$result =
CirrusSearchConnection::getPageType( $indexType )->addDocuments( $documents );
wfDebugLog( 'CirrusSearch', 'Update
completed in ' . $result->getEngineTime() . ' (engine) millis' );
} catch (
\Elastica\Exception\ExceptionInterface $e ) {
error_log( "CirrusSearch update failed
caused by: " . $e->getMessage() );
}
+ },
+ 'error' => function( $status ) {
+ $status = $status->getErrorsArray();
+ wfLogWarning( 'Pool error sending documents to
Elasticsearch: ' . $status[ 0 ][ 0 ] );
+ return false;
}
) );
$work->execute();
@@ -403,14 +408,19 @@
return;
}
wfDebugLog( 'CirrusSearch', "Sending $idCount deletes to the
$indexType index." );
- $work = new PoolCounterWorkViaCallback( 'CirrusSearch-Update',
"_elasticsearch",
- array( 'doWork' => function() use ( $indexType, $ids ) {
+ $work = new PoolCounterWorkViaCallback( 'CirrusSearch-Update',
"_elasticsearch", array(
+ 'doWork' => function() use ( $indexType, $ids ) {
try {
$result =
CirrusSearchConnection::getPageType( $indexType )->deleteIds( $ids );
wfDebugLog( 'CirrusSearch', 'Delete
completed in ' . $result->getEngineTime() . ' (engine) millis' );
} catch (
\Elastica\Exception\ExceptionInterface $e ) {
error_log( "CirrusSearch delete failed
caused by: " . $e->getMessage() );
}
+ },
+ 'error' => function( $status ) {
+ $status = $status->getErrorsArray();
+ wfLogWarning( 'Pool error sending deletes to
Elasticsearch: ' . $status[ 0 ][ 0 ] );
+ return false;
}
) );
$work->execute();
--
To view, visit https://gerrit.wikimedia.org/r/92665
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f293c6cf3470e8c85339f30b99776cbe5d31021
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