Matthias Mullie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/182824
Change subject: Less duplicated code for maxShardsPerNode
......................................................................
Less duplicated code for maxShardsPerNode
Change-Id: I6612c25b0b5a5de00b52fb6d17b6e0bcf6b6f57f
---
M includes/Maintenance/Validators/MaxShardsPerNodeValidator.php
M maintenance/updateOneSearchIndexConfig.php
2 files changed, 6 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch
refs/changes/24/182824/1
diff --git a/includes/Maintenance/Validators/MaxShardsPerNodeValidator.php
b/includes/Maintenance/Validators/MaxShardsPerNodeValidator.php
index 0ae51d4..1654bd7 100644
--- a/includes/Maintenance/Validators/MaxShardsPerNodeValidator.php
+++ b/includes/Maintenance/Validators/MaxShardsPerNodeValidator.php
@@ -18,17 +18,17 @@
private $indexType;
/**
- * @var array
+ * @var int|string
*/
private $maxShardsPerNode;
/**
* @param Index $index
* @param string $indexType
- * @param array $maxShardsPerNode
+ * @param int|string $maxShardsPerNode
* @param Maintenance $out
*/
- public function __construct( Index $index, $indexType, array
$maxShardsPerNode, Maintenance $out = null ) {
+ public function __construct( Index $index, $indexType,
$maxShardsPerNode, Maintenance $out = null ) {
parent::__construct( $out );
$this->index = $index;
@@ -47,8 +47,7 @@
$actualMaxShardsPerNode = isset( $settings[ 'routing' ][
'allocation' ][ 'total_shards_per_node' ] ) ?
$settings[ 'routing' ][ 'allocation' ][
'total_shards_per_node' ] : 'unlimited';
$actualMaxShardsPerNode = $actualMaxShardsPerNode < 0 ?
'unlimited' : $actualMaxShardsPerNode;
- $expectedMaxShardsPerNode = isset( $this->maxShardsPerNode[
$this->indexType ] ) ?
- $this->maxShardsPerNode[ $this->indexType ] :
'unlimited';
+ $expectedMaxShardsPerNode = $this->maxShardsPerNode;
if ( $actualMaxShardsPerNode == $expectedMaxShardsPerNode ) {
$this->output( "ok\n" );
} else {
diff --git a/maintenance/updateOneSearchIndexConfig.php
b/maintenance/updateOneSearchIndexConfig.php
index 0614855..6d57aeb 100644
--- a/maintenance/updateOneSearchIndexConfig.php
+++ b/maintenance/updateOneSearchIndexConfig.php
@@ -195,7 +195,7 @@
$this->phraseSuggestUseText =
$wgCirrusSearchPhraseSuggestUseText;
$this->bannedPlugins = $wgCirrusSearchBannedPlugins;
$this->optimizeIndexForExperimentalHighlighter =
$wgCirrusSearchOptimizeIndexForExperimentalHighlighter;
- $this->maxShardsPerNode = $wgCirrusSearchMaxShardsPerNode;
+ $this->maxShardsPerNode = isset(
$wgCirrusSearchMaxShardsPerNode[ $this->indexType ] ) ?
$wgCirrusSearchMaxShardsPerNode[ $this->indexType ] : 'unlimited';
$this->refreshInterval = $wgCirrusSearchRefreshInterval;
try{
@@ -264,7 +264,7 @@
$validator = new
\CirrusSearch\Maintenance\Validators\IndexValidator(
$this->getIndex(),
$this->startOver,
- isset( $this->maxShardsPerNode[ $this->indexType ] ) ?
$this->maxShardsPerNode[ $this->indexType ] : 'unlimited',
+ $this->maxShardsPerNode,
$this->getShardCount(),
$this->getReplicaCount(),
$this->refreshInterval,
--
To view, visit https://gerrit.wikimedia.org/r/182824
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6612c25b0b5a5de00b52fb6d17b6e0bcf6b6f57f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits