Page MenuHomePhabricator

Restore compatibility for older Elastica extension in Translate
Closed, ResolvedPublic

Description

Basically https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Translate/+/488577/7 should be redone in a way that keeps the old code available but calls the new methods if they are present.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 12 2019, 2:00 PM
Nikerabbit triaged this task as Normal priority.Mar 12 2019, 2:01 PM
abi_ claimed this task.Mar 14 2019, 8:23 AM
abi_ moved this task from Backlog to In Progress on the User-abi_ board.

Change 497023 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Add backward compatibility for older version of Elastica extension

https://gerrit.wikimedia.org/r/497023

abi_ moved this task from In Progress to Under Review on the User-abi_ board.EditedMar 16 2019, 3:16 AM

What was done?


1. Setup ElasticSearch on my vagrant machine.

For this I had to,

  1. Increase the RAM for the machine - vagrant config vagrant_ram 3072; vagrant reload

When running ttmserver-export.php --reindex got the following errors,

  1. MySQL Server has gone away error - Modified MySQL configuration file - wait_timeout = 28800 & max_allowed_packet = 1024M
  2. Even after increasing the packet size, continued to have issues with MySQL server has gone away error. Finally had to set threading in ttmserver-export.php to 0. The --threads parameter did not seem to work very well. Will verify further.

Also got the following notice when running ttmserver-export.php,

  • Deprecated: Use of Maintenance::error( $err, $die ) was deprecated in MediaWiki 1.31. [Called from TTMServerBootstrap::execute in /vagrant/mediawiki/extensions/Translate/scripts/ttmserver-export.php at line 89] in /vagrant/mediawiki/includes/debug/MWDebug.php on line 309

2. Setup the Elastica Extension with ElasticSearch

Followed this guide - https://www.mediawiki.org/wiki/Help:Extension:Translate/Translation_memories to setup Elasticsearch (v6.6.2) and the Elastica extension.

3. Updated code

I then updated the code in the ElasticSearchTTMServer to be backward compatible with older version of the Elastica extension using method_exists to check for newer methods.


Testing

Used the following two versions of the Elastica extension with ElasticSearch v6.6.2

  1. REL 1.31 - Gerrit - Download
  2. Latest master - Gerrit - Download

Note that the test cases were run with both versions of the Elastica extension. Please find the test cases below,

TC #1 - Ran ttmserver-export.php --reindex

  1. Run the script ttmserver-export.php
  2. Added echo statements in code to identify the branch of code that was being executed.

Expected Behavior - The script should complete without throwing any warnings or errors. In addition based on the version of Elastica extension used, the branch of code executed should vary.

TC #2 - Search translation page

  1. Go to Special:SearchTranslations page.
  2. Search for a message string.

Expected Behavior - Search output should be displayed, showing message with that string in it.

You probably encountered T193008: MediaWiki\MediaWikiServices::resetChildProcessServices doesn't reset database connection state. There doesn't seem a task to fix the deprecation warning (If I remember correctly, I had used that method first, but then core also added a method with same name, creating a conflict). There is also T156035: Error when running TTMServer export with the database backend which is in the related code, but not directly related as it is a different backend.

Change 497023 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Add backward compatibility for older version of Elastica extension

https://gerrit.wikimedia.org/r/497023

Change 497023 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Add backward compatibility for older version of Elastica extension

https://gerrit.wikimedia.org/r/497023

abi_ moved this task from Under Review to QA on the User-abi_ board.Mar 20 2019, 1:22 PM
abi_ removed a project: Patch-For-Review.

Moved to QA.

abi_ closed this task as Resolved.Tue, Jul 16, 6:18 AM
abi_ moved this task from QA to Done on the User-abi_ board.

This has been out for sometime (close to 4 months), and there have not been any issues raised, marking this as resolved. These changes were also present in the last MLEB release.