Skip to content
This repository has been archived by the owner on Nov 22, 2017. It is now read-only.

Commit

Permalink
don't exceed the shard size when refreshing reserves
Browse files Browse the repository at this point in the history
  • Loading branch information
tjake committed Jul 28, 2011
1 parent a10ea40 commit 35b972e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lucandra/cluster/CassandraIndexManager.java
Expand Up @@ -374,8 +374,8 @@ private synchronized ShardInfo getShardInfo(String indexName, boolean force) thr
nodes.nodes.put(token, offset);
shards.shards.put(shardNum, nodes);

// Load this reserve if there is more to go.
if (offset.get() < (maxDocsPerShard - 1))
// Load this reserve if there is at least 100 more to go.
if ((offset.get()+100) < (maxDocsPerShard - 1))
{
int seqOffset = getRandomSequenceOffset(offset.get() + 100);
int prevSeqOffset = getRandomSequenceOffset(offset.get() - 1);
Expand All @@ -388,7 +388,7 @@ private synchronized ShardInfo getShardInfo(String indexName, boolean force) thr
logger.info("Found reserved shard" + shardStr + "(" + token + "):"
+ (offset.get() + 100) + " TO "
+ (randomSeq[seqOffset] + reserveSlabSize));
allNodeRsvps.rsvpList.add(new RsvpInfo(offset.get() + 100, (randomSeq[seqOffset]
allNodeRsvps.rsvpList.add(new RsvpInfo(offset.get() + 100 , (randomSeq[seqOffset]
+ reserveSlabSize - 1), nodes.shard, token, nextTTL));
}
}
Expand Down

0 comments on commit 35b972e

Please sign in to comment.