Glaisher has uploaded a new change for review.

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

Change subject: Make deletions of translation units more performant
......................................................................

Make deletions of translation units more performant

Currently, we are clearing the stats for all the languages for the
group and then recalculating them and inserting for all the languages.
That is hundreds of rows and requires doing the read query from
MessageCollection::loadInfo() a few hundred times. This is absolutely
insane while we are doing a deletion for just one single language.
So to increase the speed of this process, we clear the stats for only
the unit's language and the groups to which the unit belongs to. And then
recalculate the stats for only this language for the primary group.
Other groups can be calculated when someone views the stats and it
will get generated somewhere else.

Change-Id: I234de1d26bf3f705fe9c373302444a902094cd3a
---
M tag/PageTranslationHooks.php
1 file changed, 6 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/19/290719/1

diff --git a/tag/PageTranslationHooks.php b/tag/PageTranslationHooks.php
index b13c369..1c93456 100644
--- a/tag/PageTranslationHooks.php
+++ b/tag/PageTranslationHooks.php
@@ -981,16 +981,17 @@
                        return true;
                }
 
-               $page = TranslatablePage::newFromTitle( $group->getTitle() );
-               $id = $page->getMessageGroupId();
+               $langCode = $handle->getCode();
+               $id = $group->getId();
 
-               MessageGroupStats::clearGroup( $id );
-               MessageGroupStats::forGroup( $id );
+               MessageGroupStats::clear( $handle );
+               MessageGroupStats::forItem( $id, $langCode );
 
                if ( $handle->isDoc() ) {
                        return true;
                }
 
-               self::updateTranslationPage( $page, $handle->getCode(), $user, 
0, $reason );
+               $page = TranslatablePage::newFromTitle( $group->getTitle() );
+               self::updateTranslationPage( $page, $langCode, $user, 0, 
$reason );
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/290719
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I234de1d26bf3f705fe9c373302444a902094cd3a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to