Browse files

added the other fix for adding offset

  • Loading branch information...
1 parent 14dece4 commit 4a65a7c27a0a6d8f7f3c0d7392df459753154992 @ceocoder committed May 2, 2011
Showing with 14 additions and 13 deletions.
  1. +14 −13 src/lucandra/cluster/CassandraIndexManager.java
View
27 src/lucandra/cluster/CassandraIndexManager.java
@@ -816,7 +816,7 @@ private NodeInfo addNewShard(String indexName) throws IOException
RowMutation rm = updateNodeOffset(indexName, getToken(), nodes.shard, randomSeq[0]); // offset
// 0
- // RowMutation rm2 = updateNodeOffset(indexName + "~" + nodes.shard, getToken(), nodes.shard, randomSeq[0]); // offset
+ RowMutation rm2 = updateNodeOffset(indexName + "~" + nodes.shard, getToken(), nodes.shard, randomSeq[0]); // offset
// 0
CassandraUtils.robustInsert(ConsistencyLevel.QUORUM, rm);
@@ -842,20 +842,21 @@ private RowMutation updateNodeOffset(String indexName, String myToken, Integer s
AtomicInteger o = null;
NodeInfo n = si.shards.get(shard);
-
- if(n != null)
- o = n.nodes.get(myToken);
- else
- throw new RuntimeException("missing node info");
-
- if (o == null)
- n.nodes.put(myToken, new AtomicInteger(offset));
- else
- o.set(offset);
+ if(!indexName.contains("~"))
+ {
+ if (n != null)
+ o = n.nodes.get(myToken);
+ else
+ throw new RuntimeException("missing node info");
- if (logger.isDebugEnabled())
- logger.debug("updated node offset for " + indexName + "(" + shard + ")(" + myToken + ") to " + offset);
+ if (o == null)
+ n.nodes.put(myToken, new AtomicInteger(offset));
+ else
+ o.set(offset);
+ if (logger.isDebugEnabled())
+ logger.debug("updated node offset for " + indexName + "(" + shard + ")(" + myToken + ") to " + offset);
+ }
return rm;
}

0 comments on commit 4a65a7c

Please sign in to comment.