[06:21] lifeless: distro.all_distro_archive_ids issues a db query. Did you consider inlining that? [06:23] what do you mean by inlining it ? [06:23] Doing it as part of the query ? [06:23] 'if not len(series_clauses)' seems an odd way of spelling 'if not series_clauses' [06:24] lifeless: Yes. Embedding that logic in the SQL [06:24] stub: I was assuming that other things will hit that cachedproperty [06:24] It would depend if that cached_property is being evaluated elsewhere in the pages that use this I guess [06:24] so that inlining it would be of little benefit, and perhaps a (tiny) pessimism [06:24] but I have no data [06:25] happy to revisit when we have the next round of scaling data [06:28] lifeless: WHERE (single_item = 'foo') is valid, so you can simplify the OR generation for combined_clause [06:28] ok, cool [06:28] lifeless: The helpers we have are what Storm gives us, but I think it would be worse to mix and match Storm & raw SQL here. [06:29] yeah [06:29] I thought about that and cried [06:29] This could all be Storm code, but I personally don't believe that it would be more readable or maintainable that way. [06:30] esp. since you would be jumping to undocumented apis like 'group by' [06:30] agreed [06:40] lifeless: So you have a GROUP BY calculating the MAX(spph.id) for each spr.id, but you don't use it. [06:40] yeah we do [06:40] oh hmmm [06:40] let me review [06:41] I don't think that query does what you think that query does [06:44] perhaps [06:46] I think the max is redundant [06:46] wgrant: what do you think, I think you touched the query shape right before me ? [06:52] stub: so the query is transplanted; I'm pretty sure the multi-series change is good; if the query was already faulty, thats perhaps a separate problem ? [06:53] SELECT DISTINCT ON (spr.id) spr.* [06:53] FROM [06:53] SourcePackageRelease AS spr, [06:53] SourcePackagePublishingHistory AS spph, [06:53] DistroSeries [06:53] WHERE [06:53] spph.sourcepackagerelease = spr.id [06:53] AND spph.distroseries = DistroSeries.id [06:53] AND spph.status IN (1,2,3) [06:53] AND ( [06:53] (spr.sourcepackagename IN (1,2,3 ) [06:53] AND spph.archive IN (1,2,3) [06:53] AND DistroSeries.distribution = 1 [06:53] ) [06:53] ) [06:53] Bah [06:53] Forgot the order by [06:55] SELECT DISTINCT ON (spph.sourcepackagerelease) spr.* [06:55] FROM [06:55] SourcePackageRelease AS spr, [06:55] SourcePackagePublishingHistory AS spph, [06:55] DistroSeries [06:55] WHERE [06:55] spph.sourcepackagerelease = spr.id [06:55] AND spph.distroseries = DistroSeries.id [06:55] AND spph.status IN (1,2,3) [06:55] AND ( [06:55] (spr.sourcepackagename IN (1,2,3 ) [06:55] AND spph.archive IN (1,2,3) [06:55] AND DistroSeries.distribution = 1 [06:55] ) [06:55] ) [06:55] ORDER BY spph.sourcepackagerelease DESC, spph.id DESC; [06:56] AIUI we can only get one spph back anyway because of the status check [06:56] So it is working by accident? [06:56] Only one published with that status in that distroseries... guess not accident. [06:57] stub: I'd be delighted to file a bug to review this query to make it more efficient [06:57] you'll note the two implementations were different (because one had been tuned more recently) - it was that one that I extended [06:59] If you file a bug, you need an XXX: in there stating the query is obviously broken [06:59] I want to consult the soyuz folk first [06:59] But I'd rather it got fixed now given we have diagnosed it. [06:59] I'll land a trivial with an XXX if there is an issue [06:59] stub: so you're proposing what you pasted? [06:59] The query is broken, we know that. [07:00] If you are correct about the status, my query is unnecessarily complicated. [07:00] stub: line 132 in the diff in the mp has the old 2 generations ago query [07:01] Right. So either the 'latest spph' is unnecessary due to the status field, or someone broke it. [07:02] ok [07:06] This becomes fairly neat Storm code too... [07:07] lifeless: I don't think I've touched that code recently/ever. [07:07] stub: There will be more than one Published occasionally. [07:07] In the middle of a publisher run. [07:10] lifeless: So it seems you transplanted the getCurrentSourcePackages query for a distroseries into your new getCurrentSourcePackages for a distribution [07:11] stub: I did [07:11] stub: and adjusted it [07:12] wgrant: so the distroseries code I started with was in fact bong; the max(id) is needed in there as well as the status constraints ? [07:12] But that breakage we identified may not matter for a distroseries, but could matter a great deal for a distro. [07:12] stub: distros are already broken [07:13] stub: because they return the most recent for the distro, not the most recent for the distro development focus - so backports can show up [07:13] So we are making broken code break faster :) [07:13] in a manner of speaking [07:13] I'd like to delete distro{,Set}.getCurrentSourceReleases [07:13] but thats a different task [07:14] its not my intent to break the semantics of the functions with this patch [07:14] and I'm glad you noticed [07:17] But we are breaking semantics. DistroSet.getCurrentSourceReleases used to return the 'current' source release across all distroseries, including backports (which you say is a bug). The new implementation returns a random sourcepackagerelease with a particular status across all distroseries [07:18] So you could get hardy's most recent spr when you asked for Ubuntu's most recent spr. [07:18] 1,2 is pending and published [07:19] right, agreed [07:19] so as you say, its broken [07:33] Suckiest thing is this indicates the tests are not sufficient ;) [07:34] well [07:34] I hadn't run all the tests [07:35] reduce(lambda _, series:milestones.extend(series.milestones), self.series_list, []) [07:35] You missed your calling as a Perl programmer? [07:35] Or maybe lisp? [07:56] lifeless: approved with minor comments - https://code.launchpad.net/~lifeless/launchpad/bug-717394/+merge/50541 [08:05] stub: huh, I think that goes in the next branch [08:11] stub: sorry about the diff in the -2 branch [08:11] I forgot to give it a prereq [08:11] lifeless: Can you resub easily? [08:12] let me see [08:12] Or did the other review get everything and this one is redundant? [08:12] it used to end badly doing htat [08:13] https://code.launchpad.net/~lifeless/launchpad/bug-717394-2/+merge/50557 [08:16] stub: ^ [08:20] stub: diff is there [08:20] and reviewed [08:24] stub: that leaves just https://code.launchpad.net/~lifeless/launchpad/bug-717394-4/+merge/50548 [08:25] stub: did you have a fixed query for bug 636158 ? [08:25] <_mup_> Bug #636158: BugTask:+index times out with many bug tasks/nominations (eg. Bug #1) < https://launchpad.net/bugs/636158 > [08:43] lifeless: What query needs fixing in that bug? [08:44] stub: thats the getcurrentsourcereleases one [08:44] that you were fiddling with [08:44] which I broke [08:44] I thought you had a working one I could slot in [08:44] The ones I pasted before? [08:44] ah [08:44] I was'nt sure that that was complete [08:44] SELECT DISTINCT ON (spph.sourcepackagerelease) spr.* [08:44] FROM [08:44] SourcePackageRelease AS spr, [08:44] SourcePackagePublishingHistory AS spph, [08:44] DistroSeries [08:44] WHERE [08:44] spph.sourcepackagerelease = spr.id [08:44] AND spph.distroseries = DistroSeries.id [08:44] AND spph.status IN (1,2,3) [08:44] AND ( [08:44] it seemed to have different spph.status ;) [08:44] (spr.sourcepackagename IN (1,2,3 ) [08:44] AND spph.archive IN (1,2,3) [08:45] AND DistroSeries.distribution = 1 [08:45] ) [08:45] ) [08:45] ORDER BY spph.sourcepackagerelease DESC, spph.id DESC; [08:45] cool, I'll slot that in [08:45] and similar for DistoSeries I presume ? [08:45] Yes, you need to replace my placeholders :) [08:45] thank you [08:45] Yes, although we might be able to use a simpler query if the status is sufficient for getting 'current package' [08:46] Although from what wgrant said earlier, that might very occasionally return two 'current packages' [08:46] yes [08:46] belts and bracers for now [08:48] wgrant: That looks sane to you? ^^ [08:50] Looking. [08:50] If it does return two packages, I wouldn't worry too much. [08:50] The callsites are just informational. [08:50] Just pick one. [08:51] lifeless: https://code.launchpad.net/~lifeless/launchpad/bug-717394-4/+merge/50548 reviewed [09:37] stub: hi [09:37] yo [09:37] stub: I don't see how that query actually helps [09:38] spph.sourcepackagerelease isn't going to be distinct if there are two candidates [09:38] and the point is to get sprs for different names at the same time [09:40] spph.sourcepackagerelease isn't distinct, which is why the DISTINCT ON is there. [09:40] hardy and lucid have different spr's for their most recent spph [09:40] we want only one of those two sprs [09:41] a window function can do what we need [09:41] So we get all (spph, spr) records matching, ordered by (spph.sourcepackagerelease DESC, spph.id DESC) and disgard all but the first matching one [09:41] where do we discard ? [09:41] DISTINCT ON [09:42] Not DISTINCT [09:42] I get that [09:42] but I think spph.sourcepackagerelease is different than you think it is [09:43] distinct on spr.sourcepackagename might do it [09:43] will the order by take the first item reliably ? [09:43] oic. we are getting the latest out of all spns.... [09:44] you get an error if the order by doesn't match what is needed by the ORDER BY [09:44] right, we want multiple sprs, one spr per spn [09:47] I think I have it, trying now [09:47] SELECT DISTINCT ON (spr.sourcepackagename) spr.* [09:47] FROM [09:47] SourcePackageRelease AS spr, [09:47] SourcePackagePublishingHistory AS spph, [09:47] DistroSeries [09:47] WHERE [09:47] spph.sourcepackagerelease = spr.id [09:47] AND spph.distroseries = DistroSeries.id [09:47] AND spph.status IN (1,2,3) [09:47] AND ( [09:47] (spr.sourcepackagename IN (1,2,3 ) [09:47] AND spph.archive IN (1,2,3) [09:47] AND DistroSeries.distribution = 1 [09:47] ) [09:48] yes, thats what I have though stormisified [09:48] You got DISTINCT ON in Storm syntax? [09:48] theres a hack [09:48] grep for DISTINCT ON in lib [10:19] stub: so, thats wrong [10:19] its (spr.sourcepackagename, distroseries.distribution) in the distinct [10:19] *that* gets use unique tuples matching the input parameter === henninge_ is now known as henninge === mrevell is now known as mrevell-lunch === mrevell-lunch is now known as mrevell