jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/335824 )

Change subject: Enable Translation memories multi-DC support
......................................................................


Enable Translation memories multi-DC support

This patch enables the new mirroring support added in
I4df596ac2444f1f988feb0fe9f0814d1413a6865. The strategy is to define
mirror between clusters so that when eqiad is master it replicates to
codfw and vice versa.

In normal operation TTM default service will be set to $wmfDatacenter.
One can force to 'eqiad' or 'codfw' if some maintenance needs to be
done on a particular elastic cluster.

Removed the dependency between cirrus and ttm, I found it non obvious
to have such dependencies between these two configs. The server
definition is now rebuilt from the 'search' service instead of
$wgCirrusSearchClusters.

Bug: T132076
Depends-On: I4df596ac2444f1f988feb0fe9f0814d1413a6865
Change-Id: I27707d1232ccaa82b12ba92e0a9e471b5e25dcd7
---
M wmf-config/CommonSettings.php
M wmf-config/InitialiseSettings.php
2 files changed, 39 insertions(+), 24 deletions(-)

Approvals:
  EBernhardson: Looks good to me, but someone else must approve
  Addshore: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wmf-config/CommonSettings.php b/wmf-config/CommonSettings.php
index 0b083d3..c278e7e 100644
--- a/wmf-config/CommonSettings.php
+++ b/wmf-config/CommonSettings.php
@@ -2408,33 +2408,45 @@
 
        $wgPageLanguageUseDB = true; // T153209
 
-       // TODO: proper integration with new CirrusSearch config
-       $wgTranslateExtensionDefaultCluster = 'eqiad';
        $wgTranslateTranslationServices = [];
        if ( $wmgUseTranslationMemory ) {
-               $servers = array_map(
-                       function ( $v ) {
-                               if ( is_array( $v ) ) {
-                                       return [ 'host' => $v['host'] ];
-                               } else {
-                                       return [ 'host' => $v ];
-                               }
-                       },
-                       
$wgCirrusSearchClusters[$wgTranslateExtensionDefaultCluster]
-               );
-               // Read only until renamed to 'TTMServer'
-               $wgTranslateTranslationServices['TTMServer'] = [
-                       'type' => 'ttmserver',
-                       'class' => 'ElasticSearchTTMServer',
-                       'shards' => 1,
-                       'replicas' => 1,
-                       'index' => $wmgTranslateESIndex,
-                       'cutoff' => 0.65,
-                       'use_wikimedia_extra' => true,
-                       'config' => [
-                               'servers' => $servers,
-                       ],
+               // Switch to 'eqiad' or 'codfw' if you plan to bring down
+               // the elastic cluster equals to $wmfDatacenter
+               $wgTranslateTranslationDefaultService = $wmfDatacenter;
+
+               // If the downtime is long (> 10mins) consider disabling
+               // mirroring in this var to avoid logspam about ttm updates
+               // then plan to refresh this index via ttmserver-export when
+               // it's back up.
+               $wgTranslateClustersAndMirrors = [
+                       'eqiad' => [ 'codfw' ],
+                       'codfw' => [ 'eqiad' ],
                ];
+               foreach( $wgTranslateClustersAndMirrors as $cluster => $mirrors 
) {
+                       if ( !isset( $wmfAllServices[$cluster]['search'] ) ) {
+                               continue;
+                       }
+                       $wgTranslateTranslationServices[$cluster] = [
+                               'type' => 'ttmserver',
+                               'class' => 'ElasticSearchTTMServer',
+                               'shards' => 1,
+                               'replicas' => 1,
+                               'index' => $wmgTranslateESIndex,
+                               'cutoff' => 0.65,
+                               'use_wikimedia_extra' => true,
+                               'config' => [
+                                       'servers' => array_map( function( $host 
) {
+                                               return [
+                                                       'host' => $host,
+                                                       'port' => 9243,
+                                                       'transport' => 'Https',
+                                               ];
+                                       }, $wmfAllServices[$cluster]['search'] 
),
+                               ],
+                               'mirrors' => $mirrors,
+                       ];
+               }
+               unset( $wgTranslateClustersAndMirrors );
        }
 
        $wgTranslateWorkflowStates = $wmgTranslateWorkflowStates;
diff --git a/wmf-config/InitialiseSettings.php 
b/wmf-config/InitialiseSettings.php
index 981e317..cee6d7e 100644
--- a/wmf-config/InitialiseSettings.php
+++ b/wmf-config/InitialiseSettings.php
@@ -17009,6 +17009,9 @@
        'wikitech' => false,
 ],
 
+// NOTE: don't forget to update TTM default cluster via
+// $wgTranslateTranslationDefaultService in CommonSettings.php if you plan to
+// bring down a specific cluster.
 'wmgCirrusSearchDefaultCluster' => [
        'default' => 'local',
 ],

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I27707d1232ccaa82b12ba92e0a9e471b5e25dcd7
Gerrit-PatchSet: 9
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: DCausse <dcau...@wikimedia.org>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: DCausse <dcau...@wikimedia.org>
Gerrit-Reviewer: EBernhardson <ebernhard...@wikimedia.org>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Gehel <guillaume.leder...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Nikerabbit <niklas.laxst...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to