jenkins-bot has submitted this change and it was merged.

Change subject: Add functionality to force connections even if a single one 
fails
......................................................................


Add functionality to force connections even if a single one fails

Requires I80508624 from Elastica.

Change-Id: If7a5829cce180ff96166c608d5349abe58bcde2f
---
M CirrusSearch.php
M includes/CirrusSearchConnection.php
2 files changed, 18 insertions(+), 6 deletions(-)

Approvals:
  Manybubbles: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CirrusSearch.php b/CirrusSearch.php
index f7bf99c..54764e6 100644
--- a/CirrusSearch.php
+++ b/CirrusSearch.php
@@ -37,6 +37,11 @@
 // ElasticSearch servers
 $wgCirrusSearchServers = array( 'elasticsearch0', 'elasticsearch1', 
'elasticsearch2', 'elasticsearch3' );
 
+// How many times to attempt connecting to a given server
+// If you're behind LVS and everything looks like one server,
+// you may want to reattempt 2 or 3 times.
+$wgCirrusSearchConnectionAttempts = 1;
+
 // Number of shards for each index
 $wgCirrusSearchShardCount = array( 'content' => 4, 'general' => 4 );
 
diff --git a/includes/CirrusSearchConnection.php 
b/includes/CirrusSearchConnection.php
index e43c36c..7bc6849 100644
--- a/includes/CirrusSearchConnection.php
+++ b/includes/CirrusSearchConnection.php
@@ -38,12 +38,6 @@
        const PAGE_TYPE_NAME = 'page';
 
        /**
-        * Singleton instance of the client
-        * @var \Elastica\Client
-        */
-       private static $client = null;
-
-       /**
         * @return array(string)
         */
        public static function getServerList() {
@@ -51,11 +45,24 @@
                return $wgCirrusSearchServers;
        }
 
+       /**
+        * @return string
+        */
        public static function getIndexBaseName() {
                return wfWikiId();
        }
 
        /**
+        * How many times can we attempt to connect per host?
+        *
+        * @return int
+        */
+       public function getMaxConnectionAttempts() {
+               global $wgCirrusSearchConnectionAttempts;
+               return $wgCirrusSearchConnectionAttempts;
+       }
+
+       /**
         * Fetch the Elastica Type for pages.
         * @param mixed $type type of index (content or general or false to get 
all)
         * @return \Elastica\Type

-- 
To view, visit https://gerrit.wikimedia.org/r/86719
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If7a5829cce180ff96166c608d5349abe58bcde2f
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to