Query affected 1553 row(s): query-m: REPLACE INTO `translate_groupstats` (tgs_group,tgs_lang,tgs_total,tgs_translated,tgs_fuzzy,tgs_proofread) VALUES ('X') [TRX#90add3] #0 /srv/mediawiki/php-1.33.0-wmf.4/includes/libs/rdbms/database/Database.php(1296): Wikimedia\Rdbms\TransactionProfiler->recordQueryCompletion() #1 /srv/mediawiki/php-1.33.0-wmf.4/includes/libs/rdbms/database/Database.php(1193): Wikimedia\Rdbms\Database->doProfiledQuery() #2 /srv/mediawiki/php-1.33.0-wmf.4/includes/libs/rdbms/database/Database.php(2852): Wikimedia\Rdbms\Database->query() #3 /srv/mediawiki/php-1.33.0-wmf.4/includes/libs/rdbms/database/DatabaseMysqlBase.php(498): Wikimedia\Rdbms\Database->nativeReplace() #4 /srv/mediawiki/php-1.33.0-wmf.4/includes/libs/rdbms/database/DBConnRef.php(49): Wikimedia\Rdbms\DatabaseMysqlBase->replace() #5 /srv/mediawiki/php-1.33.0-wmf.4/includes/libs/rdbms/database/DBConnRef.php(412): Wikimedia\Rdbms\DBConnRef->__call() #6 /srv/mediawiki/php-1.33.0-wmf.4/extensions/Translate/utils/MessageGroupStats.php(537): Wikimedia\Rdbms\DBConnRef->replace() #7 /srv/mediawiki/php-1.33.0-wmf.4/extensions/Translate/utils/MessageGroupStats.php(558): Closure$MessageGroupStats::queueUpdates() #8 /srv/mediawiki/php-1.33.0-wmf.4/includes/deferred/MWCallableUpdate.php(34): Closure$MessageGroupStats::withLock() #9 /srv/mediawiki/php-1.33.0-wmf.4/includes/deferred/DeferredUpdates.php(270): MWCallableUpdate->doUpdate() #10 /srv/mediawiki/php-1.33.0-wmf.4/includes/deferred/DeferredUpdates.php(216): DeferredUpdates::runUpdate() #11 /srv/mediawiki/php-1.33.0-wmf.4/includes/deferred/DeferredUpdates.php(140): DeferredUpdates::execute() #12 /srv/mediawiki/php-1.33.0-wmf.4/includes/MediaWiki.php(905): DeferredUpdates::doUpdates() #13 /srv/mediawiki/php-1.33.0-wmf.4/includes/MediaWiki.php(728): MediaWiki->restInPeace() #14 (): Closure$MediaWiki::doPostOutputShutdown() #15 {main}
Impact
This is a production issue, which alerts about inefficient database updates which may cause lag and other operational issues.
Dashboard
Status
Code was improved in multiple iterations, and those changes have eliminated these warnings completely (and gone even further). Remaining cases are limited to the case when a page is marked for translation for the first time, and they are coming from the <languages> tag when the page is parsed.
Outcome
The reported production warning about large database writes to translation statistics table is no longer happening.
In more detail, there is mechanism to do writes in smaller batches, offloaded to the job queue, instead of doing them during web requests. This is working well, except for the case when page is marked for translation for the first time. It was deemed not necessary to fix this case. For these cases, we write as many rows as there are supported languages, around 400 (varies by the wiki), which is still less than 1000.