diff --git a/swift/proxy/server.py b/swift/proxy/server.py index b7bea00e43..892c4f4769 100644 --- a/swift/proxy/server.py +++ b/swift/proxy/server.py @@ -1200,7 +1200,7 @@ class BaseApplication(object): :param start_response: WSGI callable """ try: - if self.mamcache is None: + if self.memcache is None: self.memcache = cache_from_env(env) req = self.update_request(Request(env)) if 'eventlet.posthooks' in env: diff --git a/swift/stats/log_processor.py b/swift/stats/log_processor.py index 375f20416d..be9aa8155c 100644 --- a/swift/stats/log_processor.py +++ b/swift/stats/log_processor.py @@ -243,7 +243,10 @@ class LogProcessorDaemon(Daemon): 'processed_files.pickle.gz', compressed=True) buf = ''.join(x for x in processed_files_stream) - already_processed_files = cPickle.loads(buf) + if buf: + already_processed_files = cPickle.loads(buf) + else: + already_processed_files = set() except: already_processed_files = set() self.logger.debug('found %d processed files' % len(already_processed_files)) @@ -313,9 +316,6 @@ class LogProcessorDaemon(Daemon): # cleanup s = cPickle.dumps(processed_files, cPickle.HIGHEST_PROTOCOL) f = cStringIO.StringIO(s) - self.log_processor.internal_proxy.create_container( - self.log_processor_account, - self.log_processor_container) self.log_processor.internal_proxy.upload_file(f, self.log_processor_account, self.log_processor_container, diff --git a/test/unit/stats/test_log_processor.py b/test/unit/stats/test_log_processor.py index cf7049bb3a..ea80399659 100644 --- a/test/unit/stats/test_log_processor.py +++ b/test/unit/stats/test_log_processor.py @@ -33,7 +33,7 @@ class DumbInternalProxy(object): def data(): yield 'obj\n' yield 'data' - return code, data + return code, data() class TestLogProcessor(unittest.TestCase): @@ -42,7 +42,7 @@ class TestLogProcessor(unittest.TestCase): '/v1/acct/foo/bar?format=json&foo HTTP/1.0 200 - '\ 'curl tk4e350daf-9338-4cc6-aabb-090e49babfbd '\ '6 95 - txfa431231-7f07-42fd-8fc7-7da9d8cc1f90 - 0.0262' - stats_test_line = 'account,1,2,3,1283378584.881391' + stats_test_line = 'account,1,2,3' proxy_config = {'log-processor': { } @@ -152,11 +152,10 @@ class TestLogProcessor(unittest.TestCase): def get_object_data(*a,**kw): return [self.stats_test_line] p.get_object_data = get_object_data - result = p.process_one_file('stats', 'a', 'c', 'o') + result = p.process_one_file('stats', 'a', 'c', 'y/m/d/h/o') expected = {'account': {'count': 1, 'object_count': 2, 'container_count': 1, - 'bytes_used': 3, - 'created_at': '1283378584.881391'}} + 'bytes_used': 3}} self.assertEquals(result, expected) \ No newline at end of file