Merge lp:~jelmer/launchpad/later-upload-move into lp:launchpad

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: no longer in the source branch.
Merged at revision: 11991
Proposed branch: lp:~jelmer/launchpad/later-upload-move
Merge into: lp:launchpad
Diff against target: 34 lines (+3/-3)
2 files modified
lib/lp/archiveuploader/tests/test_uploadprocessor.py (+1/-1)
lib/lp/archiveuploader/uploadprocessor.py (+2/-2)
To merge this branch: bzr merge lp:~jelmer/launchpad/later-upload-move
Reviewer Review Type Date Requested Status
Julian Edwards (community) Needs Information
Jelmer Vernooij (community) Approve
Review via email: mp+41749@code.launchpad.net

Commit message

[r=jelmer][ui=none][bug=681508] Commit build status changes to database before moving the upload directory.

Description of the change

We've had two bugs with builds that failed to upload. They would be moved out of the queue but before their build status was updated (to FULLYBUILT or FAILEDTOUPLOAD).

This changes the move to be right after the database commit. This means the window for inconsistency is very small.

To post a comment you must log in.
Revision history for this message
Jelmer Vernooij (jelmer) :
review: Approve
Revision history for this message
Jelmer Vernooij (jelmer) wrote :

(I had a pre-implementation discussion about this with Julian, but he hasn't done an actual code review).

Revision history for this message
Julian Edwards (julian-edwards) wrote :

Post-landing review:

I think this needs a better explanation (via a comment) of what happens if process-upload fails between committing and moving the upload directory away.

From the pre-imp you said that it would notice the next time that it ran that the build was already processed and deal with it appropriately. Is that action tested?

Also, I don't think you need to assert that there's no debug output in the test.

review: Needs Information

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-10-21 04:19:36 +0000
+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-11-26 16:30:45 +0000
@@ -1924,7 +1924,7 @@
1924 log_contents = build.upload_log.read()1924 log_contents = build.upload_log.read()
1925 self.assertTrue('ERROR: Exception while processing upload '1925 self.assertTrue('ERROR: Exception while processing upload '
1926 in log_contents)1926 in log_contents)
1927 self.assertTrue('DEBUG: Moving upload directory '1927 self.assertFalse('DEBUG: Moving upload directory '
1928 in log_contents)1928 in log_contents)
19291929
1930 def testBinaryPackageBuilds(self):1930 def testBinaryPackageBuilds(self):
19311931
=== modified file 'lib/lp/archiveuploader/uploadprocessor.py'
--- lib/lp/archiveuploader/uploadprocessor.py 2010-11-22 16:35:22 +0000
+++ lib/lp/archiveuploader/uploadprocessor.py 2010-11-26 16:30:45 +0000
@@ -250,7 +250,6 @@
250 UploadStatusEnum.FAILED: "failed",250 UploadStatusEnum.FAILED: "failed",
251 UploadStatusEnum.REJECTED: "rejected",251 UploadStatusEnum.REJECTED: "rejected",
252 UploadStatusEnum.ACCEPTED: "accepted"}[result]252 UploadStatusEnum.ACCEPTED: "accepted"}[result]
253 self.moveProcessedUpload(upload_path, destination, logger)
254 build.date_finished = datetime.datetime.now(pytz.UTC)253 build.date_finished = datetime.datetime.now(pytz.UTC)
255 if not (result == UploadStatusEnum.ACCEPTED and254 if not (result == UploadStatusEnum.ACCEPTED and
256 build.verifySuccessfulUpload() and255 build.verifySuccessfulUpload() and
@@ -258,7 +257,8 @@
258 build.status = BuildStatus.FAILEDTOUPLOAD257 build.status = BuildStatus.FAILEDTOUPLOAD
259 build.notify(extra_info="Uploading build %s failed." % upload)258 build.notify(extra_info="Uploading build %s failed." % upload)
260 build.storeUploadLog(logger.buffer.getvalue())259 build.storeUploadLog(logger.buffer.getvalue())
261 self.ztm.commit()260 self.ztm.commit()
261 self.moveProcessedUpload(upload_path, destination, logger)
262262
263 def processUpload(self, fsroot, upload):263 def processUpload(self, fsroot, upload):
264 """Process an upload's changes files, and move it to a new directory.264 """Process an upload's changes files, and move it to a new directory.