summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKsenia Demina <kdemina@mirantis.com>2013-07-19 14:32:55 +0400
committerKsenia Demina <kdemina@mirantis.com>2013-07-19 14:32:55 +0400
commitf67af4c5290522b81872b327f7eef6931ac129dd (patch)
treef625cc5eff157c649a1c5819f0ddf529888b1b1c
parentad99f296550362dc6d96f42465d553dc02d08f8e (diff)
downloadswift-bench-f67af4c5290522b81872b327f7eef6931ac129dd.tar.gz
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
-rwxr-xr-xbin/swift-bench3
-rw-r--r--swift/common/bench.py6
2 files changed, 9 insertions, 0 deletions
diff --git a/bin/swift-bench b/bin/swift-bench
index b24345c..04a0428 100755
--- a/bin/swift-bench
+++ b/bin/swift-bench
@@ -50,6 +50,7 @@ CONF_DEFAULTS = {
'devices': 'sdb1', # space-sep list
'log_level': 'INFO',
'timeout': '10',
+ 'delay': '0',
'bench_clients': [],
}
@@ -117,6 +118,8 @@ if __name__ == '__main__':
help='If set, will not delete the objects created')
parser.add_option('-V', '--auth_version', dest='auth_version',
help='Authentication version')
+ parser.add_option('-d', '--delay', dest='delay',
+ help='Delay before delete requests in seconds')
if len(sys.argv) == 1:
parser.print_help()
diff --git a/swift/common/bench.py b/swift/common/bench.py
index bc45d80..0a46be2 100644
--- a/swift/common/bench.py
+++ b/swift/common/bench.py
@@ -352,6 +352,7 @@ class BenchController(object):
self.delete = config_true_value(conf.delete)
self.gets = int(conf.num_gets)
self.aborted = False
+ self.delay = int(self.conf.delay)
def sigint1(self, signum, frame):
if self.delete:
@@ -378,6 +379,11 @@ class BenchController(object):
self.running = gets
gets.run()
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)
self.running = dels
dels.run()