Hi Jeroen, This was not a trivial one but your cover letter did a very good job at explaining what you did. Thanks for taking the time to write it. I have a few comments/suggestions below, but r=me review approve On Fri, 2010-03-05 at 17:37 +0000, Jeroen T. Vermeulen wrote: > Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/bug-286237 into lp:launchpad/devel. > === modified file 'lib/lp/translations/browser/tests/test_baseexportview.py' > --- lib/lp/translations/browser/tests/test_baseexportview.py 2010-02-19 17:06:01 +0000 > +++ lib/lp/translations/browser/tests/test_baseexportview.py 2010-03-05 17:38:34 +0000 > @@ -7,6 +7,7 @@ > import transaction > import unittest > > +from canonical.launchpad.interfaces.lpstorm import IMasterStore > from canonical.launchpad.webapp.servers import LaunchpadTestRequest > from canonical.testing import ZopelessDatabaseLayer > from lp.translations.browser.sourcepackage import ( > @@ -15,13 +16,14 @@ > ProductSeriesTranslationsExportView) > from lp.translations.interfaces.translationfileformat import ( > TranslationFileFormat) > +from lp.translations.model.poexportrequest import POExportRequest > from lp.testing import TestCaseWithFactory > > > def wipe_queue(queue): > """Erase all export queue entries.""" > - while queue.entry_count > 0: > - queue.popRequest() > + queue_ids = IMasterStore(POExportRequest).execute( You don't need to store the queue ids here, do you? > + "DELETE FROM POExportRequest") > > > class BaseExportViewMixin(TestCaseWithFactory): > > === modified file 'lib/lp/translations/doc/poexport-queue.txt' > --- lib/lp/translations/doc/poexport-queue.txt 2010-02-19 16:02:16 +0000 > +++ lib/lp/translations/doc/poexport-queue.txt 2010-03-05 17:38:34 +0000 > @@ -275,7 +275,8 @@ > > Once the queue is processed, the queue is empty again. > > - >>> process_queue(fake_transaction, logging.getLogger()) > + >>> transaction.commit() > + >>> process_queue(transaction, logging.getLogger()) > INFO:...Stored file at http://.../po_evolution-2.2.pot > > >>> export_request_set.entry_count > @@ -333,10 +334,10 @@ > > >>> export_request_set.addRequest( > ... carlos, pofiles=[pofile], format=TranslationFileFormat.PO) > - >>> process_queue(fake_transaction, logging.getLogger()) > + >>> transaction.commit() > + >>> process_queue(transaction, logging.getLogger()) > INFO:root:Stored file at http://...eo.po > > - >>> transaction.commit() > >>> print get_newest_librarian_file().read() > # Esperanto translation for ... > ... > @@ -354,10 +355,10 @@ > > >>> export_request_set.addRequest( > ... carlos, pofiles=[pofile], format=TranslationFileFormat.POCHANGED) > - >>> process_queue(fake_transaction, logging.getLogger()) > + >>> transaction.commit() > + >>> process_queue(transaction, logging.getLogger()) > INFO:root:Stored file at http://...eo.po > > - >>> transaction.commit() > >>> print get_newest_librarian_file().read() > # IMPORTANT: This file does NOT contain a complete PO file structure. > # DO NOT attempt to import this file back into Launchpad. > > === modified file 'lib/lp/translations/doc/poexport-request-productseries.txt' > --- lib/lp/translations/doc/poexport-request-productseries.txt 2010-02-19 16:54:42 +0000 > +++ lib/lp/translations/doc/poexport-request-productseries.txt 2010-03-05 17:38:34 +0000 > @@ -35,11 +35,12 @@ > Now we request that the queue be processed. > > >>> import logging > - >>> from lp.testing.faketransaction import FakeTransaction > + >>> import transaction > >>> from lp.translations.scripts.po_export_queue import process_queue > >>> logger = MockLogger() > >>> logger.setLevel(logging.DEBUG) > - >>> process_queue(FakeTransaction(), logger) > + >>> transaction.commit() > + >>> process_queue(transaction, logger) > log> Exporting objects for ..., related to template evolution-2.2 in > Evolution trunk > log> Exporting objects for ..., related to template evolution-2.2-test in > > === modified file 'lib/lp/translations/doc/poexport-request.txt' > --- lib/lp/translations/doc/poexport-request.txt 2010-02-19 16:54:42 +0000 > +++ lib/lp/translations/doc/poexport-request.txt 2010-03-05 17:38:34 +0000 > @@ -53,9 +53,10 @@ > > Now we request that the queue be processed. > > - >>> from lp.testing.faketransaction import FakeTransaction > + >>> import transaction > >>> from lp.translations.scripts.po_export_queue import process_queue > - >>> process_queue(FakeTransaction(), MockLogger()) > + >>> transaction.commit() > + >>> process_queue(transaction, MockLogger()) > log> Exporting objects for Happy Downloader, related to template pmount > in Ubuntu Hoary package "pmount" > log> Stored file at http://.../launchpad-export.tar.gz > @@ -185,7 +186,8 @@ > >>> from lp.translations.interfaces.translationfileformat import ( > ... TranslationFileFormat) > >>> request_set.addRequest(person, None, [cs], TranslationFileFormat.MO) > - >>> process_queue(FakeTransaction(), MockLogger()) > + >>> transaction.commit() Do you think it'd be worth adding comments explaining why we need all these commits? > + >>> process_queue(transaction, MockLogger()) > log> Exporting objects for Happy Downloader, related to template pmount > in Ubuntu Hoary package "pmount" > log> Stored file at http://.../cs_LC_MESSAGES_pmount.mo > > === added file 'lib/lp/translations/doc/poexportqueue-replication-lag.txt' > --- lib/lp/translations/doc/poexportqueue-replication-lag.txt 1970-01-01 00:00:00 +0000 > +++ lib/lp/translations/doc/poexportqueue-replication-lag.txt 2010-03-05 17:38:34 +0000 > @@ -0,0 +1,89 @@ > += Replication Lag and the Export Queue = > + > +Due to replication lag it's possible for the export queue to see a > +request on the slave store that it actually just removed from the master > +store. > + > +We start our story with an empty export queue. > + > + >>> from datetime import timedelta > + >>> import transaction > + >>> from zope.component import getUtility > + >>> from canonical.launchpad.interfaces.lpstorm import IMasterStore > + >>> from lp.translations.interfaces.poexportrequest import ( > + ... IPOExportRequestSet) > + >>> from lp.translations.interfaces.pofile import IPOFile > + >>> from lp.translations.model.poexportrequest import POExportRequest > + >>> query = IMasterStore(POExportRequest).execute( > + ... "DELETE FROM POExportRequest") > + > + >>> queue = getUtility(IPOExportRequestSet) > + > +We have somebody making an export request. > + > + >>> requester = factory.makePersonNoCommit( > + ...