/srv/irclogs.ubuntu.com/2013/05/09/#launchpad-dev.txt

mwhudsonwgrant, StevenK: do you guys keep track of how many lines of source code you've killed from lp over the last little while?00:08
cjwatsonI have a graph I update every now and again00:11
cjwatsonhttp://people.canonical.com/~cjwatson/tmp/loc-cum.png00:13
cjwatsonData per revision in http://people.canonical.com/~cjwatson/tmp/loc00:13
mwhudsonit started around 500k loc ?00:14
mwhudsonso down about 15%00:14
cjwatsonAbout a million, I think00:14
mwhudsonah00:14
mwhudsonstill a nice big number00:14
wgrantDepends on how you count, but by most metrics is 700KLOC-1MLOC00:15
StevenKmwhudson: I've killed close to 40k00:31
StevenKThat last big drop on http://people.canonical.com/~cjwatson/tmp/loc-cum.png was me killing YUI 2.00:32
lifelesswoo00:46
lifelesskilling the source code gently00:46
wgrantStevenK: In https://code.launchpad.net/~stevenk/launchpad/index-previewdiff-merge_proposal/+merge/162915 do you also want to make date_created NOT NULL?00:52
wgrantAnd you need to rename the column in the ALTER TABLE to branch_merge_proposal00:53
wgrantYou should do both NOT NULLs in the same statement to get them done in a single table scan.00:53
StevenKwgrant: Do I need DESC in the index too?00:56
wgrantStevenK: It only makes a very marginal difference in this case, so I wouldn't bother.00:56
wgrantIt's important for the bug indices where we have a compound sort in opposing directions.00:56
wgrantStevenK: https://code.launchpad.net/~stevenk/launchpad/switch-bmp-to-previewdiff-merge_proposal/+merge/162916 still pulls out all of the preview diffs just to get the last one00:59
wgrantI'd do00:59
wgrant@cachedproperty00:59
wgrantdef preview_diff(self):00:59
wgrant    return self._preview_diffs.first()00:59
StevenKwgrant: Ah, but isn't first the earliest diff?01:00
wgrantI can think of an easy solution to that.01:00
StevenKAsc(date_created) ?01:01
wgrant(use .last(), or reverse the sort)01:01
StevenKAh, so .last() does exist01:01
=== tasdomas_afk is now known as tasdomas
StevenKwgrant: Index fixed01:03
wgrantStevenK: You also probably need to alter the preloading to populate preview_diff rather than preview_diffs01:03
wgrantAnything that wants multiple BMPs isn't going to care about their historical diffs, just their current ones.01:03
StevenKwgrant: Except that I'm pulling all previewdiffs01:04
wgrantThat there is precisely the problem.01:04
wgrantIt's unnecessarily pulling an unbounded volume of data.01:04
wgrantIt's potentially a large set, particularly before we have pruning implemented.01:05
StevenKwgrant: I agree, but at the time I couldn't think of a way to make certain we only return the latest diff01:07
wgrantStevenK: DISTINCT ON01:13
wgrantSELECT DISTINCT ON (branch_merge_proposal) * FROM previewdiff WHERE branch_merge_proposal IN (1, 2, 3, 4) ORDER BY date_created;01:14
wgrantish01:14
wgrantThat'll return the oldest for each MP, but you get the idea01:14
wgrantI believe I added the .config(distinct=PreviewDiff.branch_merge_proposal) syntax to storm a while ago, so that should be easy.01:15
StevenKwgrant: Both index and switch-bmp have been pushed, and the diff has regenerated.01:41
wgrantStevenK: ITYM Desc01:44
wgrantIn the previewdiff preloading01:44
wgrantAsc is the default01:44
wgrantI believe that what you have there will grab the oldest, not the newest01:44
wgrantWhich perhaps suggests that your preloading test is incomplete.01:44
StevenKPreloading test? :-)01:44
StevenKThere's a preloading test?01:45
wgrantHopefully :)01:45
wgrantIf not then it's not difficult to add.01:45
StevenKwgrant: You tell funny jokes. I'll add one.01:45
=== tasdomas is now known as tasdomas_afk
wgrantStevenK, lifeless: Do you recall why ~canonical-launchpad exists?03:50
lifelessNo03:51
lifelessis it private?03:51
wgrantNo03:51
wgrantAFAICT it was only used to own production-auditor, which I've fixed.03:51
lifelessit says '03:51
lifelessCanonical employees working directly on Launchpad.03:51
lifeless'03:51
wgrantWhich is roughly the definition of ~launchpad03:51
lifelessyeah03:51
lifelessthere are specific branch owning teams already03:51
lifelesswhich the new project policy page references03:52
wgrantExactly03:52
wgrantAnd this isn't a member of any teams, and only had privileges in one project03:52
wgrantSo I'm not sure why it exists03:52
wgrantDoesn't own any branches, not subscribed to any bugs...03:52
=== tasdomas_afk is now known as tasdomas
StevenKwgrant: switch-bmp is ready for you again.04:56
wgrantStevenK: Oh, that preloading sort should probably actually be on (bmp, date_created)05:03
wgrantIt'll work as it is now, but potentially slowly and it doesn't really make sense05:03
StevenKwgrant: .order_by(PreviewDiff.branch_merge_proposal, Desc(PreviewDiff.date_created) ?05:24
wgrantStevenK: Right05:24
StevenKwgrant: Is that your only remaining concern?05:37
wgrantStevenK: I thiiiiiink so, apart from the pruning thing05:37
wgrantWhich we at least need a plan for before this lands05:37
StevenKwgrant: Given your idea that we want only one previewdiff per MP in the short term, I'm happy to put a pipe at the end that adds it05:38
wgrantStevenK: Sounds good05:41
wgrantI'll go over the MPs again for a final check in a sec05:41
=== tasdomas is now known as tasdomas_afk
=== tasdomas_afk is now known as tasdomas
StevenKwgrant: I want GROUP BY for this query to only show old previewdiffs?06:01
wgrantStevenK: DISTINCT ON and GROUP BY are usually mutually exclusive06:02
wgrantThey perform a similar role, except that GROUP BY gives you aggregates.06:02
StevenKI don't want DISTINCT branch_merge_proposals, though06:04
wgrantStevenK: DISTINCT ON branch_merge_proposal06:05
wgrantNot DISTINCT branch_merge_proposal06:06
StevenKTo handle the case that we have 2 old previewdiffs to be pruned.06:06
wgrantOh06:06
wgrantTo show old ones06:06
StevenKYes06:06
wgrantYou want neither06:06
wgrantYou'll need window functions or a subquery06:06
StevenKI can see how a window function can help, how does a subquery?06:07
wgrantYou can use a subquery to select the latest previewdiff for the MP and then use NOT IN06:07
wgrantOr !=06:07
StevenKBah06:16
StevenKERROR: window function requires an OVER clause06:16
StevenKAnd so I add one:06:16
StevenKERORR: window functions not allowed in WHERE clause06:17
wgrantSure, you usually have to use a subquery06:18
wgrantSo you return the window function result in the select list of a subquery, and filter on that in the outer query06:18
StevenKwgrant: http://paste.ubuntu.com/5646915/06:24
wgrantStevenK: Right06:25
StevenKIt even works06:25
StevenKwgrant: .config(distinct=PreviewDiff.branch_merge_proposal) is not making use of DISTINCT ON06:49
wgrantStevenK: Hm, it possibly needs to be a tuple06:51
wgrantI forget06:51
wgrantI only wrote it06:51
wgrant39+ if isinstance(select.distinct, (tuple, list)):06:52
wgrant40+ tokens.append(06:52
wgrant41+ "ON (%s) " % compile(select.distinct, state, raw=True))06:52
StevenKExcellent06:53
=== tasdomas is now known as tasdomas_afk
cjwatsonStevenK: YUI 2> Yeah, I went and looked at that commit :)08:12
StevenKcjwatson: Haha, as a "What the hell just happened?" sort of check?08:13
cjwatsonNot really, I just tend to look at big negative commits out of interest08:16
=== tasdomas_afk is now known as tasdomas
=== tasdomas is now known as tasdomas_afk
=== tasdomas_afk is now known as tasdomas
=== wedgwood_away is now known as wedgwood
=== tasdomas is now known as tasdomas_afk
=== wedgwood is now known as wedgwood_away
=== wedgwood_away is now known as wedgwood
=== wedgwood is now known as wedgwood_away
=== tasdomas_afk is now known as tasdomas
=== wedgwood_away is now known as wedgwood
=== wedgwood is now known as wedgwood_away
=== wedgwood_away is now known as wedgwood
=== wedgwood is now known as wedgwood_away
=== tasdomas is now known as tasdomas_afk
=== tasdomas_afk is now known as tasdomas
=== tasdomas is now known as tasdomas_afk
=== tasdomas_afk is now known as tasdomas
=== tasdomas is now known as tasdomas_afk

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!