Jump to content

WMDE/Cognate

From Wikitech

The Cognate DB runs on the extension1 cluster. Currently the only Cognate db is called cognate_wiktionary.

Use sql to get to the cognate tables

From a deployment host, connect to the extension1 cluster:

sql metawiki --cluster=extension1

Switch to the cognate DB:

use cognate_wiktionary;

Full example:

addshore@deploy1001:~$ sql metawiki --cluster=extension1
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 821580245
Server version: 10.1.36-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [metawiki]> use cognate_wiktionary;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [cognate_wiktionary]> show tables;
+------------------------------+
| Tables_in_cognate_wiktionary |
+------------------------------+
| cognate_pages                |
| cognate_sites                |
| cognate_titles               |
+------------------------------+
3 rows in set (0.00 sec)

Check if a site has been added to Cognate system

Example where a site has not been added:

MariaDB [cognate_wiktionary]> select * from cognate_sites where cgsi_dbname = 'xxxwiktionary';
Empty set (0.01 sec)

Example of an existing site:

MariaDB [cognate_wiktionary]> select * from cognate_sites where cgsi_dbname = 'zawiktionary';
+---------------------+--------------+----------------+
| cgsi_key            | cgsi_dbname  | cgsi_interwiki |
+---------------------+--------------+----------------+
| 9214146034733842265 | zawiktionary | za             |
+---------------------+--------------+----------------+
1 row in set (0.00 sec)

Adding a site to the Cognate system manually

The site should automatically be added when created as the script should be run as part of the addWiki.php process in WikimediaMaintenance https://github.com/wikimedia/mediawiki-extensions-WikimediaMaintenance/blob/master/addWiki.php#L277-L285

If it was not for some reason you can follow the below steps...

Run the maint script to add all sites for the group to the table from the maintenance server

addshore@mwmaint1002:~$ mwscript extensions/Cognate/maintenance/populateCognateSites.php --wiki yuewiktionary --site-group wiktionary

You can then check that the site exists in the cognate sites table (using instructions above)

If the site already has page creations (usually the case when you are doing this manually) you also need to populate the pages table for the site:

mwscript extensions/Cognate/maintenance/populateCognatePages.php --wiki yuewiktionary

Catching up cognate after a period of x1 read only time (when writes were still happening on wiki)

Loop through all wiktionaries and populate the table (adding rows that don't exist but should.)

addshore@mwmaint1002:~$ foreachwikiindblist wiktionary extensions/Cognate/maintenance/populateCognatePages.php --batch-size 1000