From f4458ec5ae2b70d9ff6678dba74a866e75e8737b Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Wed, 11 Jun 2014 17:10:20 +0400 Subject: [PATCH] Fix dump utility and improve its logging Change-Id: I04b795743290c1d7554334e18dd35efa1d7d9887 --- stackalytics/processor/dump.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stackalytics/processor/dump.py b/stackalytics/processor/dump.py index 9d00f4301..957161ad4 100644 --- a/stackalytics/processor/dump.py +++ b/stackalytics/processor/dump.py @@ -35,7 +35,7 @@ OPTS = [ help='Restore data into memcached'), cfg.StrOpt('file', short='f', - help='File name where to store data'), + help='The name of file to store data'), cfg.StrOpt('min-compress-len', default=0, short='m', help='The threshold length to kick in auto-compression'), @@ -60,6 +60,7 @@ def read_records_from_fd(fd): def store_bucket(memcached_inst, bucket): + LOG.debug('Store bucket of records into memcached') res = memcached_inst.set_multi(bucket, min_compress_len=cfg.CONF.min_compress_len) if res: @@ -71,11 +72,11 @@ def import_data(memcached_inst, fd): LOG.info('Importing data into memcached') bucket = {} for key, value in read_records_from_fd(fd): - if len(bucket) < BULK_READ_SIZE: - bucket[key] = value - else: + LOG.debug('Reading record key %s, value %s', key, value) + if len(bucket) == BULK_READ_SIZE: store_bucket(memcached_inst, bucket) bucket = {} + bucket[key] = value if bucket: store_bucket(memcached_inst, bucket)