/srv/irclogs.ubuntu.com/2015/09/16/#launchpad-dev.txt

=== StevenK_ is now known as StevenK
=== daker_ is now known as daker
=== infinity1 is now known as infinity
=== G_ is now known as G
=== jtv1 is now known as jtv
wgrantPerhaps it is time to bite the bullet and have a generic artifact cross-reference table without strong foreign keys.08:16
wgrantReferential integrity doesn't really buy us much for BugBranch, SpecificationBranch, SpecificationBug08:23
jtvwgrant: I wrote a weakly-linked table once...  TranslatableTemplate or something.  Probably gone now, but it was really useful at the time.08:23
jtvSometimes with relational databases, painful as it may be, you just have to admit that it's... relational.08:23
jtvAnd hi.  :)08:24
wgrantjtv: Hi!08:29
wgrantThere's SuggestivePOTemplate, but I don't recall TranslatableTemplate.08:29
jtv(Ahem.  Obviously I didn't write a weakly-linked table "once" — I mean I had one in Launchpad once.))08:30
wgrantHeh08:31
jtvDammit, internets, you can deliver my messages within the hour, can't you?08:31
jtvwgrant: yes, that's the one!08:44
jtvIt eliminated a subquery of a few dozen ms that was repeated in many queries per translation page, but maintaining referential integrity would have defeated the purpose.08:45
jtv(Actually I've had this long-standing suspicion that those big PO template headers that were only used in one place were unnecessarily slowing down the POTemplate table, but that's another story)08:47
wgrantYeah, we had that problem with SourcePackageRelease.copyright08:47
wgrantI hacked it to only load when that specific field is requested on the the one page that uses it, saving megabytes of database transfers on hot pages.08:47
jtvNot to mention decoding...08:49
jtvI used to want a Django lazy-loading field type for this.  But then I got greedier: if we could remove these long strings from the tables altogether, it would increase data density.08:50
jtvCould matter to lots and lots of joins.08:50
wgrantIndeed, though I suspect most of these would be TOASTed so not affect density much.08:50
jtv(Even when you're using an index, postgres still needs to look at the actual table to check tuple liveness.)08:51
jtvTrue, if they're out in separate storage, that'll help.08:51
jtvI don't know how the TOASTing works in terms of table representation; POTemplate is so hot for joins that even just dropping a 4-byte field may help.08:52
wgrantcjwatson: Do you think https://bugs.launchpad.net/launchpad/+bug/1170301 is still a problem? Now that everything actually gets closed by copies, Launchpad-Bugs-Fixed may not actually be used in any normal case any more.08:53
mupBug #1170301: It would be nice to have bugs-autoclosing working for intermediate revisions non accepted to the archive but included in a new upload <bugs> <packages> <soyuz-core> <soyuz-upload> <Launchpad itself:Triaged> <https://launchpad.net/bugs/1170301>08:53
wgrantjtv: Large values are stored as references to tuples in a separate TOAST relation in a separate file on disk.08:54
wgrantThis doesn't help LP as much as it could, as we almost always get all fields.08:54
wgrantBut it does mean we're not inflating large dead rows just to check whether they're dead.08:54
cjwatsonwgrant: Seb filed that bug six months after we switched to proposed-migration and everything being closed by copies ...08:58
cjwatsonSo not sure I'm convinced by that argument08:58
wgrantHm, indeed.08:59
wgrantPerhaps the ancestry calculation is just dodgy.08:59
cjwatsonYeah, I've had my suspicions about that before08:59
jtvwgrant: I just looked it up...  the default TOAST threshold seems to be 2KB, and I suspect most PO headers would hit the "sour spot" just below that.09:00
jtvIn which case, massive potential for moving them out-of-line.  :)09:00
jtvSet only on import, read only on export.09:03
cjwatsonwgrant: Thanks for reviewing https://code.launchpad.net/~cjwatson/launchpad/livefsbuild-version/+merge/271193, but did you notice that it relies on https://code.launchpad.net/~cjwatson/launchpad/db-livefsbuild-version/+merge/271171 ?09:12
wgrantcjwatson: I reviewed that one, but I guess my request on livefsbuild-version only made it through because closing db-livefsbuild-version got me down to four tabs...09:43
wgrantfixing09:43
wgrantcjwatson: Any thoughts on the cross-artifact link table proliferation?09:54
cjwatsonwgrant: Limited to only two non-null reference columns?  That would make it easier to decide what to do on deletion (e.g. no bug/specification/branch all linked together and then you have to decide what to do if the branch is deleted)10:03
cjwatsondb-livefsbuild-version> thanks10:04
wgrantcjwatson: Or ditch the dozens-of-columns approach and not bother with FKs.10:05
cjwatsonwhat would the table contain then?10:05
wgrantJust store a type and an ID for each end.10:05
cjwatsonhm, yeah, I guess there's no reason to believe that would have perf problems10:06
cjwatsonseems reasonable ...10:06
wgrantNone whatsoever.10:06
cjwatsonbetter density too10:06
wgrantI guess it'd also have a JSON metadata column too, where we'd store eg. the git repo hint.10:07
cjwatsonin that case it would be a commit sha-1 rather than an id10:08
cjwatsonno obvious id for the link-to-commit case (unless you use the repo hint as the id, but that complicates what to do on deletion)10:09
wgrant(plus this makes the way toward splitting clearer)10:11
wgrantRight.10:11
wgrantSome kind of identifier10:11
wgrantNot a specifically integral ID.10:12
wgrantJust needs to be some bijective mapping.10:13
cjwatsonmaybe having an id column at least available would be quicker for searching in the cases where we have one10:15
cjwatsonid integer, identifier json, check (null_count(id, identifier) == 1) or some such10:15
wgrantMaybe.10:16
wgrantA string is only slightly longer, and conversion isn't too verbose or slow.10:17
wgrantI considered using URLs, but that raises issues with staging that I can't be bothered working out this week.10:17
wgrant(this could then be generalised to other services, which could even maybe register callbacks to describe the status of the referenced external artifact to be displayed on the internal artifact's LP page)10:20
wgrantBut using simple internal identifiers is a good first step.10:21
cjwatsonYeah, ids could have service names attached for splitting10:21
cjwatsonI like this plan10:22
wgrantThat was easier than I expected.10:22
cjwatsonAre there any cases where inhibiting deletion is more than an inconvenience?10:22
wgrantNot in the tables I'm considering right now.10:23
wgrantI think that this solution should be restricted to those where it shouldn't be inhibited.10:23
cjwatsonDeleting active MPs, but presumably you aren't looking at that10:23
cjwatsonYeah10:23
wgrantRight, no.10:23
wgrantRecipes are a murky case.10:23
cjwatsonEspecially if you're thinking of it being a cross-service thing10:23
wgrantThere's a good argument that recipes should be text, and use cross-references for backlinks from branches.10:24
wgrantDue to the fact they can be created by anyone and block deletion of any referenced branch.10:24
wgrantBut certainly not an immediate target :)10:24
cjwatsonRight, I think the path for recipes is to make it possible to detach branches from them after which they become unbuildable but still exist.10:24
cjwatsonIf I get a few solid days to make progress on git recipes then that might be a sensible thing to attempt as part of it.10:25
wgrantIndeed.10:25
cjwatson<cjwatson@niejwein ~/src/canonical/git-build-recipe/git-build-recipe (master)>$ git diff --cached --shortstat10:26
cjwatson 10 files changed, 4050 insertions(+)10:26
cjwatsonone of these days10:26
wgrantImpressive.10:27
cjwatsonI had an otherwise unused train trip10:29
=== Peng_ is now known as Peng
blrmorning20:27
rpadovanicjwatson, hey :-) I'm a bit confused about the relation between template files and python files. I'm trying to fix #185328, so I understood that +publishinghistory of a package is in soyuz, I found distributionsourcepackage-publishinghistory.pt, and the table I'm lookin for is generated by21:50
rpadovani<tal:block repeat="publishing publications/currentBatch"21:50
rpadovani                    replace="structure publishing/@@+listing-summary">21:50
mupBug #185328: Publishing history has only distribution series codenames, not version numbers <lp-soyuz> <trivial> <ui> <Launchpad itself:Triaged> <https://launchpad.net/bugs/185328>21:50
rpadovaniI tried to grep a bit these things, but I really don't understand where I'm supposed to look21:50
rpadovaniearly in the file there is tal:define="publications view/batchnav, so I suppose I have to find this view21:54
rpadovanibut what is it?21:54
cjwatsonrpadovani: I'm not sure what I think about that bug in general, would probably take some playing around.  But as to your specific question, template files are evaluated according to http://pythonic.zoomquiet.io/data/20050615194557/index.html; in general the "context" is model code (i.e. corresponding roughly to a database object) and the "view" is browser code (i.e. the part of the presentation layer that isn't just HTML templating).  ...23:24
cjwatson... To find which view is associated with a given template, look for the template in lib/lp/*/browser/configure.zcml - in this case it's in soyuz, and it turns out that the same template may be applied to either lp.soyuz.browser.distributionsourcepackagerelease.DistributionSourcePackageReleasePublishingHistoryView or lp.registry.browser.distributionsourcepackage.DistributionSourcePackagePublishingHistoryView23:24
cjwatsonrpadovani: the +listing-summary page is also defined in lib/lp/soyuz/browser/configure.zcml, and in this case it's going to be for a SourcePackagePublishingHistory, so that will end up in sourcepackagepublishinghistory-listing-summary.pt23:26
cjwatsonrpadovani: and then that goes off into @@publishinghistory-macros and you get to repeat the process again :)23:26

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