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
=== modified file 'swift/stats/log_processor.py'
--- swift/stats/log_processor.py 2011-02-25 21:54:59 +0000
+++ swift/stats/log_processor.py 2011-02-25 21:54:59 +0000
@@ -32,7 +32,8 @@
3232
3333
34class BadFileDownload(Exception):34class BadFileDownload(Exception):
35 pass35 def __init__(self, status_code=None):
36 self.status_code = status_code
3637
3738
38class LogProcessor(object):39class LogProcessor(object):
@@ -162,7 +163,7 @@
162 code, o = self.internal_proxy.get_object(swift_account, container_name,163 code, o = self.internal_proxy.get_object(swift_account, container_name,
163 object_name)164 object_name)
164 if code < 200 or code >= 300:165 if code < 200 or code >= 300:
165 raise BadFileDownload()166 raise BadFileDownload(code)
166 last_part = ''167 last_part = ''
167 last_compressed_part = ''168 last_compressed_part = ''
168 # magic in the following zlib.decompressobj argument is courtesy of169 # magic in the following zlib.decompressobj argument is courtesy of
@@ -272,8 +273,13 @@
272 already_processed_files = cPickle.loads(buf)273 already_processed_files = cPickle.loads(buf)
273 else:274 else:
274 already_processed_files = set()275 already_processed_files = set()
275 except BadFileDownload:276 except BadFileDownload, err:
276 already_processed_files = set()277 if err.status_code == 404:
278 already_processed_files = set()
279 else:
280 self.logger.error(_('Log processing unable to load list of '
281 'already processed log files'))
282 return
277 self.logger.debug(_('found %d processed files') % \283 self.logger.debug(_('found %d processed files') % \
278 len(already_processed_files))284 len(already_processed_files))
279 logs_to_process = self.log_processor.get_data_list(lookback_start,285 logs_to_process = self.log_processor.get_data_list(lookback_start,