Outcome
We've added a new configuration parameter to define services that are writable. Eg:
<?php $wgTranslateTranslationServices['TTMServer'] = [ 'type' => 'ttmserver', 'class' => 'ElasticSearchTTMServer', 'cutoff' => 0.75, 'use_wikimedia_extra' => true, 'public' => false, 'writable' => true // New configuration ];
The following rules are enforced:
- If writable is specified, services marked as writable are considered write only and others are considered read only.
- If no service is specified as writable then services are considered both readable and writable.
- The default service must always be readable.
If a service is marked as writable, the mirrors configuration will not be allowed.
Possible example configurations can be found here: https://phabricator.wikimedia.org/T322284#8729298
Documentation has been updated: https://www.mediawiki.org/w/index.php?title=Help%3AExtension%3ATranslate%2FTranslation_memories&diff=5938992&oldid=5931722
As a maintainer of the WMF search infrastructure I want the translate extension to be able to configure readable and writable ttm backends separately so that I can rapidly switch the read traffic to a particular elasticsearch cluster using etcd and dns discovery without shipping a patch to the mediawiki-config (c.f. T143553).
Currently the translate extension does allow writing to multiple datacenter using the mirrors config on the ttm service definition, sadly this assumes that the mirrored service is writable.
A solution could be to introduce a new config var named $wgTranslateTranslationWritableServices holding an array of services to update and if set $wgTranslateTranslationDefaultService would just act as the default service for read operations. If $wgTranslateTranslationWritableServices is null then translate should behave the same way as before.
Open question: what to do if $wgTranslateTranslationWritableServices is an empty array?
AC:
- Translate is updated to support a new $wgTranslateTranslationWritableServices config entry.
- The mediawiki config is updated to have 3 elastic ttm servers: default (read-only), eqiad and codfw as write only with $wgTranslateTranslationWritableServices = [ 'eqiad', 'codfw' ];