Merge lp:~sinzui/launchpad/product-release-traversal into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 13060
Proposed branch: lp:~sinzui/launchpad/product-release-traversal
Merge into: lp:launchpad
Diff against target: 0 lines
To merge this branch: bzr merge lp:~sinzui/launchpad/product-release-traversal
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Review via email: mp+61168@code.launchpad.net

Description of the change

Traversal to a product release must be a single query.

    Launchpad bug: https://bugs.launchpad.net/bugs/736011
    Pre-implementation: lifeless

ProductRelease:+rdf timeout is caused by the unneeded loading of hundreds
of milestones during traversal to locate the match release version. This
issue is broader than +rdf, +index will also timeout if the release is deep
into a list of hundreds or milestones.

ProductSeriesNavigation.traverse() calls ProductSeries.getRelease(), which
iterates over all releases (and their parent milestone) to locate the
matching version.

--------------------------------------------------------------------

RULES

    * ProductSeriesNavigation.traverse() could call
      ProductReleaseSet.getBySeriesAndVersion() to get the release in a
      single query.
    * ProductReleaseSet.getBySeriesAndVersion() has been broken for 2 years;
      update the query to return the release for the matching milestone.name.

QA

    * View https://launchpad.net/libpng/main/0.89c
    * Verify it does not timeout.
    * View https://launchpad.net/libpng/main/1.4.0beta35-no-config
    * Verify it does not timeout.

LINT

    lib/lp/registry/model/productrelease.py
    lib/lp/registry/model/productseries.py
    lib/lp/registry/tests/test_productrelease.py
    lib/lp/registry/tests/test_productseries.py
^ There is lint in model/productseries.py that I can address after the review.

TEST

    ./bin/test -vv \
        -m lp.registry.tests.test_productrelease \
        -t -t registry.*ProductSeries.*TestCase

IMPLEMENTATION

Updated ProductReleaseSet.getBySeriesAndVersion to query the release by
milestone name.
    lib/lp/registry/model/productrelease.py
    lib/lp/registry/tests/test_productrelease.py

Updated ProductSeries.getRelease() to use ProductReleaseSet's
getBySeriesAndVersion instead of iterating over all the releases. Updated
the releases property to cache the milestone most uses of a release require
access to its milestone.
    lib/lp/registry/model/productseries.py
    lib/lp/registry/tests/test_productseries.py

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

This branch looks good. I learned about assertStatementCount.

review: Approve (code)

Preview Diff

Empty