jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/326909 )
Change subject: Use CirrusSearchClientSideSearchTimeout for connection timeout
......................................................................
Use CirrusSearchClientSideSearchTimeout for connection timeout
Bug: T152895
Change-Id: Ie9298f78804d98330298c2df2136118a7d5454d5
(cherry picked from commit 3d10ad8a19ae6cbb26b67f4df993d4465fe8a705)
---
M includes/Searcher.php
1 file changed, 19 insertions(+), 3 deletions(-)
Approvals:
Hashar: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Searcher.php b/includes/Searcher.php
index ec9ebe6..c47631b 100644
--- a/includes/Searcher.php
+++ b/includes/Searcher.php
@@ -398,7 +398,7 @@
'docIds' => $docIds,
] );
// Shard timeout not supported on get
requests so we just use the client side timeout
- $this->connection->setTimeout(
$this->getTimeout() );
+ $this->connection->setTimeout(
$this->getClientTimeout() );
// We use a search query instead of
_get/_mget, these methods are
// theorically well suited for this
kind of job but they are not
// supported on aliases with multiple
indices (content/general)
@@ -442,7 +442,7 @@
'timeout' =>
$this->getTimeout(),
];
- $this->connection->setTimeout(
$queryOptions['timeout'] );
+ $this->connection->setTimeout(
$this->getClientTimeout() );
$pageType =
$this->connection->getNamespaceType( $this->indexBaseName );
$match = new \Elastica\Query\Match();
$match->setField( 'name', $name );
@@ -647,7 +647,7 @@
$search = new MultiSearch( $this->connection->getClient() );
$search->addSearches( $searches );
- $this->connection->setTimeout( $this->getTimeout() );
+ $this->connection->setTimeout( $this->getClientTimeout() );
if ( $this->config->get( 'CirrusSearchMoreAccurateScoringMode'
) ) {
$search->setSearchType(
\Elastica\Search::OPTION_SEARCH_TYPE_DFS_QUERY_THEN_FETCH );
@@ -908,6 +908,9 @@
return 'CirrusSearch-Search';
}
+ /**
+ * @return string search retrieval timeout
+ */
private function getTimeout() {
if ( $this->searchContext->getSearchType() === 'regex' ) {
$type = 'regex';
@@ -919,6 +922,19 @@
}
/**
+ * @return int the client side timeout
+ */
+ private function getClientTimeout() {
+ if ( $this->searchContext->getSearchType() === 'regex' ) {
+ $type = 'regex';
+ } else {
+ $type = 'default';
+ }
+
+ return $this->config->getElement(
'CirrusSearchClientSideSearchTimeout', $type );
+ }
+
+ /**
* Some queries, like more like this, are quite expensive and can cause
* latency spikes. This allows redirecting queries using particular
* features to specific clusters.
--
To view, visit https://gerrit.wikimedia.org/r/326909
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie9298f78804d98330298c2df2136118a7d5454d5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: wmf/1.29.0-wmf.5
Gerrit-Owner: DCausse <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits