add --skip-keys option to stress.py. patch by jbellis; reviewed by brandonwilliams for CASSANDRA-1696

git-svn-id: https://svn.apache.org/repos/asf/cassandra/branches/cassandra-0.6@1030270 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2010-11-02 22:52:19 +00:00
parent 39689a573e
commit d656877345
2 changed files with 5 additions and 1 deletions

View File

@ -8,6 +8,7 @@ dev
* Avoid dropping messages off the client request path (CASSANDRA-1676)
* fix jna errno reporting (CASSANDRA-1694)
* add friendlier error for UnknownHostException on startup (CASSANDRA-1697)
* add --skip-keys option to stress.py (CASSANDRA-1696)
0.6.6

View File

@ -61,6 +61,8 @@ except ImportError:
parser = OptionParser()
parser.add_option('-n', '--num-keys', type="int", dest="numkeys",
help="Number of keys", default=1000**2)
parser.add_option('-N', '--skip-keys', type="float", dest="skipkeys",
help="Fraction of keys to skip initially", default=0)
parser.add_option('-t', '--threads', type="int", dest="threads",
help="Number of threads/procs to use", default=50)
parser.add_option('-c', '--columns', type="int", dest="columns",
@ -147,7 +149,8 @@ class Operation(Thread):
def __init__(self, i, counts, latencies):
Thread.__init__(self)
# generator of the keys to be used
self.range = xrange(keys_per_thread * i, keys_per_thread * (i + 1))
self.range = xrange(int(keys_per_thread * (i + options.skipkeys)),
keys_per_thread * (i + 1))
# we can't use a local counter, since that won't be visible to the parent
# under multiprocessing. instead, the parent passes a "counts" array
# and an index that is our assigned counter.