Add delay in swift-bench

With enable write affinity, it's necessary to wait until
replication has moved things to their proper homes before
running delete request. With write affinity turned on, only
nodes in local region will get the object right after PUT request.

Fix bug #1198926

Change-Id: I3aa8933d45c47a010ae05561e12176479e7c9bcc
This commit is contained in:
Ksenia Demina 2013-07-19 14:32:55 +04:00 committed by Gerrit Code Review
parent 8cb5241614
commit 600e9c8672
2 changed files with 9 additions and 0 deletions

View File

@ -50,6 +50,7 @@ CONF_DEFAULTS = {
'devices': 'sdb1', # space-sep list 'devices': 'sdb1', # space-sep list
'log_level': 'INFO', 'log_level': 'INFO',
'timeout': '10', 'timeout': '10',
'delay': '0',
'bench_clients': [], 'bench_clients': [],
} }
@ -117,6 +118,8 @@ if __name__ == '__main__':
help='If set, will not delete the objects created') help='If set, will not delete the objects created')
parser.add_option('-V', '--auth_version', dest='auth_version', parser.add_option('-V', '--auth_version', dest='auth_version',
help='Authentication version') help='Authentication version')
parser.add_option('-d', '--delay', dest='delay',
help='Delay before delete requests in seconds')
if len(sys.argv) == 1: if len(sys.argv) == 1:
parser.print_help() parser.print_help()

View File

@ -352,6 +352,7 @@ class BenchController(object):
self.delete = config_true_value(conf.delete) self.delete = config_true_value(conf.delete)
self.gets = int(conf.num_gets) self.gets = int(conf.num_gets)
self.aborted = False self.aborted = False
self.delay = int(self.conf.delay)
def sigint1(self, signum, frame): def sigint1(self, signum, frame):
if self.delete: if self.delete:
@ -378,6 +379,11 @@ class BenchController(object):
self.running = gets self.running = gets
gets.run() gets.run()
if self.delete: if self.delete:
if self.delay != 0:
self.logger.info('Delay before '
'DELETE request %s sec'
% self.delay)
time.sleep(self.delay)
dels = BenchDELETE(self.logger, self.conf, self.names) dels = BenchDELETE(self.logger, self.conf, self.names)
self.running = dels self.running = dels
dels.run() dels.run()