launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25955
[Merge] ~cjwatson/launchpad:fix-miscompiled-pofile-query into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:fix-miscompiled-pofile-query into launchpad:master.
Commit message:
Fix miscompiled query in POFileMixin._getTranslationSearchQuery
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #736005 in Launchpad itself: "POFile:+translate timeouts"
https://bugs.launchpad.net/launchpad/+bug/736005
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/395934
Converting POFile queries to Storm (https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394702) introduced a serious performance regression. It turns out that using Reference objects via ClassAlias doesn't work as expected. The following:
tm_ids = ClassAlias(TranslationMessage, "tm_ids")
tm_ids.language == pofile.language
... is compiled to "TranslationMessage.language = $ID" rather than "tm_ids.language = $ID". Using the Reference's Int partner instead works around this.
I haven't worked out how to test this automatically (or even whether it results in a different set of rows rather than merely a much slower query), but I've manually tested on staging that the modified query performs reasonably again.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-miscompiled-pofile-query into launchpad:master.
diff --git a/lib/lp/translations/model/pofile.py b/lib/lp/translations/model/pofile.py
index b6af3e7..799eb18 100644
--- a/lib/lp/translations/model/pofile.py
+++ b/lib/lp/translations/model/pofile.py
@@ -189,13 +189,13 @@ class POFileMixIn(RosettaStats):
tm_ids,
Join(
TranslationTemplateItem,
- tm_ids.potmsgset ==
+ tm_ids.potmsgsetID ==
TranslationTemplateItem.potmsgsetID)),
where=And(
TranslationTemplateItem.potemplate ==
pofile.potemplate,
TranslationTemplateItem.sequence > 0,
- tm_ids.language == pofile.language),
+ tm_ids.languageID == pofile.languageID),
distinct=True)),
Like(
POTranslation.translation,