Merge lp:~greglange/swift/lp725219 into lp:~hudson-openstack/swift/trunk

Proposed by Greg Lange
Status: Merged
Approved by: gholt
Approved revision: 214
Merged at revision: 243
Proposed branch: lp:~greglange/swift/lp725219
Merge into: lp:~hudson-openstack/swift/trunk
Prerequisite: lp:~notmyname/swift/lp707549
Diff against target: 38 lines (+10/-4)
1 file modified
swift/stats/log_processor.py (+10/-4)
To merge this branch: bzr merge lp:~greglange/swift/lp725219
Reviewer Review Type Date Requested Status
Swift Core security contacts Pending
Review via email: mp+51379@code.launchpad.net

This proposal supersedes a proposal from 2011-02-25.

Description of the change

Fixes problem with creating a new processed files list in log processing when the download of that file fails.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'swift/stats/log_processor.py'
2--- swift/stats/log_processor.py 2011-02-25 21:54:59 +0000
3+++ swift/stats/log_processor.py 2011-02-25 21:54:59 +0000
4@@ -32,7 +32,8 @@
5
6
7 class BadFileDownload(Exception):
8- pass
9+ def __init__(self, status_code=None):
10+ self.status_code = status_code
11
12
13 class LogProcessor(object):
14@@ -162,7 +163,7 @@
15 code, o = self.internal_proxy.get_object(swift_account, container_name,
16 object_name)
17 if code < 200 or code >= 300:
18- raise BadFileDownload()
19+ raise BadFileDownload(code)
20 last_part = ''
21 last_compressed_part = ''
22 # magic in the following zlib.decompressobj argument is courtesy of
23@@ -272,8 +273,13 @@
24 already_processed_files = cPickle.loads(buf)
25 else:
26 already_processed_files = set()
27- except BadFileDownload:
28- already_processed_files = set()
29+ except BadFileDownload, err:
30+ if err.status_code == 404:
31+ already_processed_files = set()
32+ else:
33+ self.logger.error(_('Log processing unable to load list of '
34+ 'already processed log files'))
35+ return
36 self.logger.debug(_('found %d processed files') % \
37 len(already_processed_files))
38 logs_to_process = self.log_processor.get_data_list(lookback_start,