Related to T348501: Minimal prototype implementation for watching message groups.
Table information
Added in 986865: Add table to store user message group subscriptions | https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Translate/+/986865
Note that the patch has been reviewed by @Ladsgroup.
Why? To keep track of the message groups that the user is subscribed to.
We've enabled the group subscription feature on translatewiki.net where this table already exists
Table structure
CREATE TABLE /*_*/translate_message_group_subscriptions ( tmgs_subscription_id INT UNSIGNED AUTO_INCREMENT NOT NULL, tmgs_user_id INT UNSIGNED NOT NULL, tmgs_group VARBINARY(200) NOT NULL, INDEX translate_tmgs_user_id (tmgs_user_id), INDEX translate_tmgs_group (tmgs_group), PRIMARY KEY(tmgs_subscription_id) ) /*$wgDBTableOptions*/;
More information
Should this table be replicated to wiki replicas (does it not contain private data)?
It shouldn’t be replicated. It contains data similar to the watchlist table.
Will you be doing cross-joins with the wiki metadata?
Currently we're not doing any joins with wiki metadata, and I don't foresee doing so in the future either.
Size of the table (number of rows expected).
With the current usage of the table, there will be at most:
1 record per message group subscription for a user.
As per translatewiki.net stats for active translators from 2023, there are about 1,600 of them. Assuming that each of these translators subscribe to about 100 message groups, we will have around 160,000 records.
Expected growth per year (number of rows).
Assuming an increase of 200 active translators every year, and about 50 new message group subscriptions for all the users, I'd say about 100,000 records.
These are worst case estimates and the actuals will be much smaller.
For example on translatewiki.net, where the feature has been available for 3 months, we currently have around 450 records.
Expected amount of queries, both writes and reads (per minute, per hour...per day, any of those are ok)
Difficult to say. 1 query will be run every time the user access Special:Translate.
Examples of query
-- Insert a new group subscription for a user INSERT INTO translate_message_group_subscriptions (tmgs_group, tmgs_user_id) VALUES ('groupId', 'userId') ON DUPLICATE KEY UPDATE tmgs_group = 'groupId' AND tmgs_user_id = 'userId'; -- Fetch all users subscribed to a group SELECT tmgs_group, tmgs_user_id FROM translate_message_group_subscriptions WHERE tmgs_group IN ('group1', 'group2'); -- Fetch all subscriptions for a user SELECT tmgs_group, tmgs_user_id FROM translate_message_group_subscriptions WHERE tmgs_user_id = "userId"; -- Remove subscriptions DELETE FROM translate_message_group_subscriptions WHERE tmgs_group= 'groupId' AND tmgs_user_id = 'userId';
The release plan for the feature (are there specific wikis you'd like to test first etc).
Enable out on testwiki first, followed by mediawiki.org and then roll out on all wikis where Translate extension is enabled.
The table will be created first, and then $wgTranslateEnableMessageGroupSubscription = true will be set to enable the feature.
See https://wikitech.wikimedia.org/wiki/Creating_new_tables for more.