Skip to content

Commit

Permalink
https://github.com/mstump/cassandra_range_repair/issues/2
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Gallew committed May 12, 2014
1 parent 149790d commit da02ba5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions range_repair.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,18 @@ def get_sub_range_generator(start, stop, steps=100):
:param start: beginning token in the range
:param stop: ending token in the range
:param step: number of sub-ranges to create
There is special-case handling for when there are more steps than there
are keys in the range: just return the start and stop values.
"""
step_increment = abs(stop - start) / steps
for i in lrange(start + step_increment, stop + 1, step_increment):
yield start, i
start = i
if start < stop:
if start+steps+1 < stop:
step_increment = abs(stop - start) / steps
for i in lrange(start + step_increment, stop + 1, step_increment):
yield start, i
start = i
if start < stop:
yield start, stop
else:
yield start, stop

def repair_range(keyspace, start, end):
Expand Down

0 comments on commit da02ba5

Please sign in to comment.