You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2012/09/11 19:41:59 UTC

[1/2] git commit: Rename NodeId to CounterId

Updated Branches:
  refs/heads/trunk 203b3ad04 -> 3b13457dd


Rename NodeId to CounterId

patch by slebresne; reviewed by jbellis for CASSANDRA-4647


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/3b13457d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/3b13457d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/3b13457d

Branch: refs/heads/trunk
Commit: 3b13457ddbcd859d4216029d4cb7613d7bba1a06
Parents: 203b3ad
Author: Sylvain Lebresne <sy...@datastax.com>
Authored: Tue Sep 11 19:14:46 2012 +0200
Committer: Sylvain Lebresne <sy...@datastax.com>
Committed: Tue Sep 11 19:41:54 2012 +0200

----------------------------------------------------------------------
 .../org/apache/cassandra/config/CFMetaData.java    |   10 +-
 .../org/apache/cassandra/config/KSMetaData.java    |    2 +-
 .../org/apache/cassandra/db/ColumnFamilyStore.java |    2 +-
 .../org/apache/cassandra/db/CounterColumn.java     |   10 +-
 src/java/org/apache/cassandra/db/SystemTable.java  |   40 +-
 .../db/compaction/CompactionController.java        |    2 +-
 .../cassandra/db/compaction/CompactionManager.java |    5 +-
 .../cassandra/db/context/CounterContext.java       |  105 +++---
 .../cassandra/hadoop/ColumnFamilyRecordReader.java |    2 +-
 .../io/sstable/AbstractSSTableSimpleWriter.java    |    6 +-
 .../apache/cassandra/service/StorageService.java   |    8 +-
 src/java/org/apache/cassandra/utils/CounterId.java |  256 ++++++++++++++
 src/java/org/apache/cassandra/utils/NodeId.java    |  256 --------------
 test/unit/org/apache/cassandra/Util.java           |    6 +-
 test/unit/org/apache/cassandra/db/CleanupTest.java |    6 +-
 .../org/apache/cassandra/db/CounterColumnTest.java |   77 ++---
 .../apache/cassandra/db/CounterMutationTest.java   |   43 ++--
 .../org/apache/cassandra/db/SuperColumnTest.java   |   40 +-
 .../cassandra/db/context/CounterContextTest.java   |  274 +++++++-------
 .../cassandra/streaming/StreamingTransferTest.java |   10 +-
 20 files changed, 575 insertions(+), 585 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/config/CFMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/CFMetaData.java b/src/java/org/apache/cassandra/config/CFMetaData.java
index 687b5f3..cb8951c 100644
--- a/src/java/org/apache/cassandra/config/CFMetaData.java
+++ b/src/java/org/apache/cassandra/config/CFMetaData.java
@@ -93,11 +93,11 @@ public final class CFMetaData
                                                         + "PRIMARY KEY (table_name, index_name)"
                                                         + ") WITH COMPACT STORAGE AND COMMENT='indexes that have been completed'");
 
-    public static final CFMetaData NodeIdCf = compile(6, "CREATE TABLE \"" + SystemTable.NODE_ID_CF + "\" ("
-                                                         + "key text,"
-                                                         + "id timeuuid,"
-                                                         + "PRIMARY KEY (key, id)"
-                                                         + ") WITH COMPACT STORAGE AND COMMENT='counter node IDs'");
+    public static final CFMetaData CounterIdCf = compile(6, "CREATE TABLE \"" + SystemTable.COUNTER_ID_CF + "\" ("
+                                                            + "key text,"
+                                                            + "id timeuuid,"
+                                                            + "PRIMARY KEY (key, id)"
+                                                            + ") WITH COMPACT STORAGE AND COMMENT='counter node IDs'");
 
     // new-style schema
     public static final CFMetaData SchemaKeyspacesCf = compile(8, "CREATE TABLE " + SystemTable.SCHEMA_KEYSPACES_CF + "("

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/config/KSMetaData.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/config/KSMetaData.java b/src/java/org/apache/cassandra/config/KSMetaData.java
index e700444..9feb0d3 100644
--- a/src/java/org/apache/cassandra/config/KSMetaData.java
+++ b/src/java/org/apache/cassandra/config/KSMetaData.java
@@ -83,7 +83,7 @@ public final class KSMetaData
                                                 CFMetaData.PeersCf,
                                                 CFMetaData.HintsCf,
                                                 CFMetaData.IndexCf,
-                                                CFMetaData.NodeIdCf,
+                                                CFMetaData.CounterIdCf,
                                                 CFMetaData.SchemaKeyspacesCf,
                                                 CFMetaData.SchemaColumnFamiliesCf,
                                                 CFMetaData.SchemaColumnsCf,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index dd70fc7..d292a63 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -942,7 +942,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
         return maxFile;
     }
 
-    public void forceCleanup(NodeId.OneShotRenewer renewer) throws ExecutionException, InterruptedException
+    public void forceCleanup(CounterId.OneShotRenewer renewer) throws ExecutionException, InterruptedException
     {
         CompactionManager.instance.performCleanup(ColumnFamilyStore.this, renewer);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/db/CounterColumn.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CounterColumn.java b/src/java/org/apache/cassandra/db/CounterColumn.java
index a4cb20c..c501bf1 100644
--- a/src/java/org/apache/cassandra/db/CounterColumn.java
+++ b/src/java/org/apache/cassandra/db/CounterColumn.java
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.net.InetAddress;
 import java.security.MessageDigest;
-import java.util.concurrent.TimeoutException;
 import java.util.Collection;
 
 import org.slf4j.Logger;
@@ -40,7 +39,6 @@ import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.utils.Allocator;
 import org.apache.cassandra.service.IWriteResponseHandler;
 import org.apache.cassandra.service.StorageProxy;
-import org.apache.cassandra.db.ConsistencyLevel;
 import org.apache.cassandra.utils.*;
 
 /**
@@ -243,16 +241,16 @@ public class CounterColumn extends Column
     }
 
     /**
-     * Check if a given nodeId is found in this CounterColumn context.
+     * Check if a given counterId is found in this CounterColumn context.
      */
-    public boolean hasNodeId(NodeId id)
+    public boolean hasCounterId(CounterId id)
     {
-        return contextManager.hasNodeId(value(), id);
+        return contextManager.hasCounterId(value(), id);
     }
 
     private CounterColumn computeOldShardMerger(int mergeBefore)
     {
-        ByteBuffer bb = contextManager.computeOldShardMerger(value(), NodeId.getOldLocalNodeIds(), mergeBefore);
+        ByteBuffer bb = contextManager.computeOldShardMerger(value(), CounterId.getOldLocalCounterIds(), mergeBefore);
         if (bb == null)
             return null;
         else

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/db/SystemTable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/SystemTable.java b/src/java/org/apache/cassandra/db/SystemTable.java
index 8ff2b8d..1dfd3ea 100644
--- a/src/java/org/apache/cassandra/db/SystemTable.java
+++ b/src/java/org/apache/cassandra/db/SystemTable.java
@@ -43,8 +43,8 @@ import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.thrift.Constants;
 import org.apache.cassandra.utils.ByteBufferUtil;
+import org.apache.cassandra.utils.CounterId;
 import org.apache.cassandra.utils.FBUtilities;
-import org.apache.cassandra.utils.NodeId;
 
 import static org.apache.cassandra.cql3.QueryProcessor.processInternal;
 
@@ -56,7 +56,7 @@ public class SystemTable
     public static final String PEERS_CF = "peers";
     public static final String LOCAL_CF = "local";
     public static final String INDEX_CF = "IndexInfo";
-    public static final String NODE_ID_CF = "NodeIdInfo";
+    public static final String COUNTER_ID_CF = "NodeIdInfo";
     public static final String HINTS_CF = "hints";
     public static final String BATCHLOG_CF = "batchlog";
     // see layout description in the DefsTable class header
@@ -446,21 +446,21 @@ public class SystemTable
      * Read the current local node id from the system table or null if no
      * such node id is recorded.
      */
-    public static NodeId getCurrentLocalNodeId()
+    public static CounterId getCurrentLocalCounterId()
     {
         ByteBuffer id = null;
         Table table = Table.open(Table.SYSTEM_KS);
 
-        // Get the last NodeId (since NodeId are timeuuid is thus ordered from the older to the newer one)
+        // Get the last CounterId (since CounterId are timeuuid is thus ordered from the older to the newer one)
         QueryFilter filter = QueryFilter.getSliceFilter(decorate(ALL_LOCAL_NODE_ID_KEY),
-                                                        new QueryPath(NODE_ID_CF),
+                                                        new QueryPath(COUNTER_ID_CF),
                                                         ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                         ByteBufferUtil.EMPTY_BYTE_BUFFER,
                                                         true,
                                                         1);
-        ColumnFamily cf = table.getColumnFamilyStore(NODE_ID_CF).getColumnFamily(filter);
+        ColumnFamily cf = table.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
         if (cf != null && cf.getColumnCount() != 0)
-            return NodeId.wrap(cf.iterator().next().name());
+            return CounterId.wrap(cf.iterator().next().name());
         else
             return null;
     }
@@ -468,41 +468,41 @@ public class SystemTable
     /**
      * Write a new current local node id to the system table.
      *
-     * @param oldNodeId the previous local node id (that {@code newNodeId}
+     * @param oldCounterId the previous local node id (that {@code newCounterId}
      * replace) or null if no such node id exists (new node or removed system
      * table)
-     * @param newNodeId the new current local node id to record
+     * @param newCounterId the new current local node id to record
      * @param now microsecond time stamp.
      */
-    public static void writeCurrentLocalNodeId(NodeId oldNodeId, NodeId newNodeId, long now)
+    public static void writeCurrentLocalCounterId(CounterId oldCounterId, CounterId newCounterId, long now)
     {
         ByteBuffer ip = ByteBuffer.wrap(FBUtilities.getBroadcastAddress().getAddress());
 
-        ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_KS, NODE_ID_CF);
-        cf.addColumn(new Column(newNodeId.bytes(), ip, now));
+        ColumnFamily cf = ColumnFamily.create(Table.SYSTEM_KS, COUNTER_ID_CF);
+        cf.addColumn(new Column(newCounterId.bytes(), ip, now));
         RowMutation rm = new RowMutation(Table.SYSTEM_KS, ALL_LOCAL_NODE_ID_KEY);
         rm.add(cf);
         rm.apply();
-        forceBlockingFlush(NODE_ID_CF);
+        forceBlockingFlush(COUNTER_ID_CF);
     }
 
-    public static List<NodeId.NodeIdRecord> getOldLocalNodeIds()
+    public static List<CounterId.CounterIdRecord> getOldLocalCounterIds()
     {
-        List<NodeId.NodeIdRecord> l = new ArrayList<NodeId.NodeIdRecord>();
+        List<CounterId.CounterIdRecord> l = new ArrayList<CounterId.CounterIdRecord>();
 
         Table table = Table.open(Table.SYSTEM_KS);
-        QueryFilter filter = QueryFilter.getIdentityFilter(decorate(ALL_LOCAL_NODE_ID_KEY), new QueryPath(NODE_ID_CF));
-        ColumnFamily cf = table.getColumnFamilyStore(NODE_ID_CF).getColumnFamily(filter);
+        QueryFilter filter = QueryFilter.getIdentityFilter(decorate(ALL_LOCAL_NODE_ID_KEY), new QueryPath(COUNTER_ID_CF));
+        ColumnFamily cf = table.getColumnFamilyStore(COUNTER_ID_CF).getColumnFamily(filter);
 
-        NodeId previous = null;
+        CounterId previous = null;
         for (IColumn c : cf)
         {
             if (previous != null)
-                l.add(new NodeId.NodeIdRecord(previous, c.timestamp()));
+                l.add(new CounterId.CounterIdRecord(previous, c.timestamp()));
 
             // this will ignore the last column on purpose since it is the
             // current local node id
-            previous = NodeId.wrap(c.name());
+            previous = CounterId.wrap(c.name());
         }
         return l;
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/db/compaction/CompactionController.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionController.java b/src/java/org/apache/cassandra/db/compaction/CompactionController.java
index 90fe68d..f6afe48 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionController.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionController.java
@@ -76,7 +76,7 @@ public class CompactionController
         assert cfs != null;
         this.cfs = cfs;
         this.gcBefore = gcBefore;
-        // If we merge an old NodeId id, we must make sure that no further increment for that id are in an active memtable.
+        // If we merge an old CounterId id, we must make sure that no further increment for that id are in an active memtable.
         // For that, we must make sure that this id was renewed before the creation of the oldest unflushed memtable. We
         // add 5 minutes to be sure we're on the safe side in terms of thread safety (though we should be fine in our
         // current 'stop all write during memtable switch' situation).

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
index 7474191..ed56ac2 100644
--- a/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
+++ b/src/java/org/apache/cassandra/db/compaction/CompactionManager.java
@@ -20,7 +20,6 @@ package org.apache.cassandra.db.compaction;
 import java.io.File;
 import java.io.IOException;
 import java.lang.management.ManagementFactory;
-import java.nio.ByteBuffer;
 import java.util.*;
 import java.util.concurrent.*;
 import java.util.concurrent.locks.Lock;
@@ -246,7 +245,7 @@ public class CompactionManager implements CompactionManagerMBean
         });
     }
 
-    public void performCleanup(ColumnFamilyStore cfStore, final NodeId.OneShotRenewer renewer) throws InterruptedException, ExecutionException
+    public void performCleanup(ColumnFamilyStore cfStore, final CounterId.OneShotRenewer renewer) throws InterruptedException, ExecutionException
     {
         performAllSSTableOperation(cfStore, new AllSSTablesOperation()
         {
@@ -516,7 +515,7 @@ public class CompactionManager implements CompactionManagerMBean
      *
      * @throws IOException
      */
-    private void doCleanupCompaction(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, NodeId.OneShotRenewer renewer) throws IOException
+    private void doCleanupCompaction(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, CounterId.OneShotRenewer renewer) throws IOException
     {
         assert !cfs.isIndex();
         Table table = cfs.table;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/db/context/CounterContext.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/context/CounterContext.java b/src/java/org/apache/cassandra/db/context/CounterContext.java
index 42b5960..f142034 100644
--- a/src/java/org/apache/cassandra/db/context/CounterContext.java
+++ b/src/java/org/apache/cassandra/db/context/CounterContext.java
@@ -28,21 +28,18 @@ import org.slf4j.LoggerFactory;
 
 import org.apache.cassandra.db.TypeSizes;
 import org.apache.cassandra.db.marshal.MarshalException;
-import org.apache.cassandra.utils.Allocator;
-import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.HeapAllocator;
-import org.apache.cassandra.utils.NodeId;
+import org.apache.cassandra.utils.*;
 
 /**
  * An implementation of a partitioned counter context.
  *
- * A context is primarily a list of tuples (node id, clock, count) -- called
+ * A context is primarily a list of tuples (counter id, clock, count) -- called
  * shard in the following. But with some shard are flagged as delta (with
  * special resolution rules in merge()).
  *
  * The data structure has two parts:
  *   a) a header containing the lists of "delta" (a list of references to the second parts)
- *   b) a list of shard -- (node id, logical clock, count) tuples -- (the so-called 'body' below)
+ *   b) a list of shard -- (counter id, logical clock, count) tuples -- (the so-called 'body' below)
  *
  * The exact layout is:
  *            | header  |   body   |
@@ -57,9 +54,9 @@ import org.apache.cassandra.utils.NodeId;
  *             ^    ^    ^     ^   ^    ^
  *             |    |  count_1 |   |   count_2
  *             |  clock_1      |  clock_2
- *         nodeid_1          nodeid_2
+ *       counterid_1         counterid_2
  *
- * The rules when merging two shard with the same nodeid are:
+ * The rules when merging two shard with the same counterid are:
  *   - delta + delta = sum counts (and logical clock)
  *   - delta + other = keep the delta one
  *   - other + other = keep the shard with highest logical clock
@@ -74,7 +71,7 @@ public class CounterContext implements IContext
     private static final int HEADER_ELT_LENGTH = TypeSizes.NATIVE.sizeof(Short.MAX_VALUE);
     private static final int CLOCK_LENGTH = TypeSizes.NATIVE.sizeof(Long.MAX_VALUE);
     private static final int COUNT_LENGTH = TypeSizes.NATIVE.sizeof(Long.MAX_VALUE);
-    private static final int STEP_LENGTH = NodeId.LENGTH + CLOCK_LENGTH + COUNT_LENGTH;
+    private static final int STEP_LENGTH = CounterId.LENGTH + CLOCK_LENGTH + COUNT_LENGTH;
 
     private static final Logger logger = LoggerFactory.getLogger(CounterContext.class);
 
@@ -104,12 +101,12 @@ public class CounterContext implements IContext
         // The first (and only) elt is a delta
         context.putShort(context.position(), (short)1);
         context.putShort(context.position() + HEADER_SIZE_LENGTH, (short)0);
-        writeElementAtOffset(context, context.position() + HEADER_SIZE_LENGTH + HEADER_ELT_LENGTH, NodeId.getLocalId(), 1L, value);
+        writeElementAtOffset(context, context.position() + HEADER_SIZE_LENGTH + HEADER_ELT_LENGTH, CounterId.getLocalId(), 1L, value);
         return context;
     }
 
     // Provided for use by unit tests
-    public ByteBuffer create(NodeId id, long clock, long value, boolean isDelta)
+    public ByteBuffer create(CounterId id, long clock, long value, boolean isDelta)
     {
         ByteBuffer context = ByteBuffer.allocate(HEADER_SIZE_LENGTH + (isDelta ? HEADER_ELT_LENGTH : 0) + STEP_LENGTH);
         context.putShort(context.position(), (short)(isDelta ? 1 : 0));
@@ -121,8 +118,8 @@ public class CounterContext implements IContext
         return context;
     }
 
-    // write a tuple (node id, clock, count) at an absolute (bytebuffer-wise) offset
-    private static void writeElementAtOffset(ByteBuffer context, int offset, NodeId id, long clock, long count)
+    // write a tuple (counter id, clock, count) at an absolute (bytebuffer-wise) offset
+    private static void writeElementAtOffset(ByteBuffer context, int offset, CounterId id, long clock, long count)
     {
         context = context.duplicate();
         context.position(offset);
@@ -138,7 +135,7 @@ public class CounterContext implements IContext
 
     private static int compareId(ByteBuffer bb1, int pos1, ByteBuffer bb2, int pos2)
     {
-        return ByteBufferUtil.compareSubArrays(bb1, pos1, bb2, pos2, NodeId.LENGTH);
+        return ByteBufferUtil.compareSubArrays(bb1, pos1, bb2, pos2, CounterId.LENGTH);
     }
 
     /**
@@ -292,7 +289,7 @@ public class CounterContext implements IContext
     }
 
     /**
-     * Return a context w/ an aggregated count for each node id.
+     * Return a context w/ an aggregated count for each counter id.
      *
      * @param left counter context.
      * @param right counter context.
@@ -355,7 +352,7 @@ public class CounterContext implements IContext
                         // both delta, sum
                         long clock = leftState.getClock() + rightState.getClock();
                         long count = leftState.getCount() + rightState.getCount();
-                        mergedState.writeElement(leftState.getNodeId(), clock, count, true);
+                        mergedState.writeElement(leftState.getCounterId(), clock, count, true);
                     }
                     else
                     {
@@ -381,8 +378,8 @@ public class CounterContext implements IContext
                             logger.error("invalid counter shard detected; ({}, {}, {}) and ({}, {}, {}) differ only in "
                                     + "count; will pick highest to self-heal; this indicates a bug or corruption generated a bad counter shard",
                                     new Object[] {
-                                            leftState.getNodeId(), leftClock, leftCount,
-                                            rightState.getNodeId(), rightClock, rightCount,
+                                            leftState.getCounterId(), leftClock, leftCount,
+                                            rightState.getCounterId(), rightClock, rightCount,
                                      });
                         }
 
@@ -451,7 +448,7 @@ public class CounterContext implements IContext
                 sb.append(",");
             }
             sb.append("{");
-            sb.append(state.getNodeId().toString()).append(", ");
+            sb.append(state.getCounterId().toString()).append(", ");
             sb.append(state.getClock()).append(", ");;
             sb.append(state.getCount());
             sb.append("}");
@@ -467,7 +464,7 @@ public class CounterContext implements IContext
     }
 
     /**
-     * Returns the aggregated count across all node ids.
+     * Returns the aggregated count across all counter ids.
      *
      * @param context a counter context
      * @return the aggregated count represented by {@code context}
@@ -479,7 +476,7 @@ public class CounterContext implements IContext
         // we could use a ContextState but it is easy enough that we avoid the object creation
         for (int offset = context.position() + headerLength(context); offset < context.limit(); offset += STEP_LENGTH)
         {
-            long count = context.getLong(offset + NodeId.LENGTH + CLOCK_LENGTH);
+            long count = context.getLong(offset + CounterId.LENGTH + CLOCK_LENGTH);
             total += count;
         }
 
@@ -555,18 +552,18 @@ public class CounterContext implements IContext
 
     /**
      * Checks whether the provided context has a count for the provided
-     * NodeId.
+     * CounterId.
      *
      * TODO: since the context is sorted, we could implement a binary search.
      * This is however not called in any critical path and contexts will be
      * fairly small so it doesn't matter much.
      */
-    public boolean hasNodeId(ByteBuffer context, NodeId id)
+    public boolean hasCounterId(ByteBuffer context, CounterId id)
     {
         // we could use a ContextState but it is easy enough that we avoid the object creation
         for (int offset = context.position() + headerLength(context); offset < context.limit(); offset += STEP_LENGTH)
         {
-            if (id.equals(NodeId.wrap(context, offset)))
+            if (id.equals(CounterId.wrap(context, offset)))
             {
                 return true;
             }
@@ -576,28 +573,28 @@ public class CounterContext implements IContext
 
     /**
      * Compute a new context such that if applied to context yields the same
-     * total but with old local node ids nulified and there content merged to
-     * the current localNodeId.
+     * total but with old local counter ids nulified and there content merged to
+     * the current localCounterId.
      */
-    public ByteBuffer computeOldShardMerger(ByteBuffer context, List<NodeId.NodeIdRecord> oldIds, long mergeBefore)
+    public ByteBuffer computeOldShardMerger(ByteBuffer context, List<CounterId.CounterIdRecord> oldIds, long mergeBefore)
     {
         long now = System.currentTimeMillis();
         int hlength = headerLength(context);
-        NodeId localId = NodeId.getLocalId();
+        CounterId localId = CounterId.getLocalId();
 
-        Iterator<NodeId.NodeIdRecord> recordIterator = oldIds.iterator();
-        NodeId.NodeIdRecord currRecord = recordIterator.hasNext() ? recordIterator.next() : null;
+        Iterator<CounterId.CounterIdRecord> recordIterator = oldIds.iterator();
+        CounterId.CounterIdRecord currRecord = recordIterator.hasNext() ? recordIterator.next() : null;
 
         ContextState state = new ContextState(context, hlength);
 
-        List<NodeId> toMerge = new ArrayList<NodeId>();
+        List<CounterId> toMerge = new ArrayList<CounterId>();
         long mergeTotal = 0;
         while (state.hasRemaining() && currRecord != null)
         {
             assert !currRecord.id.equals(localId);
 
-            NodeId nodeId = state.getNodeId();
-            int c = nodeId.compareTo(currRecord.id);
+            CounterId counterId = state.getCounterId();
+            int c = counterId.compareTo(currRecord.id);
 
             if (c > 0)
             {
@@ -611,15 +608,15 @@ public class CounterContext implements IContext
                 {
                     // Already merged shard, waiting to be collected
 
-                    if (nodeId.equals(localId))
+                    if (counterId.equals(localId))
                         // we should not get there, but we have been creating problematic context prior to #2968
-                        throw new RuntimeException("Current nodeId with a negative clock (likely due to #2968). You need to restart this node with -Dcassandra.renew_counter_id=true to fix.");
+                        throw new RuntimeException("Current counterId with a negative clock (likely due to #2968). You need to restart this node with -Dcassandra.renew_counter_id=true to fix.");
 
                     if (state.getCount() != 0)
                     {
                         // This should not happen, but previous bugs have generated this (#2968 in particular) so fixing it.
-                        logger.error(String.format("Invalid counter context (clock is %d and count is %d for NodeId %s), will fix", state.getCount(), state.getCount(), nodeId.toString()));
-                        toMerge.add(nodeId);
+                        logger.error(String.format("Invalid counter context (clock is %d and count is %d for CounterId %s), will fix", state.getCount(), state.getCount(), counterId.toString()));
+                        toMerge.add(counterId);
                         mergeTotal += state.getCount();
                     }
                 }
@@ -629,7 +626,7 @@ public class CounterContext implements IContext
                     // we check that it has been renewed before mergeBefore.
                     if (currRecord.timestamp < mergeBefore)
                     {
-                        toMerge.add(nodeId);
+                        toMerge.add(counterId);
                         mergeTotal += state.getCount();
                     }
                 }
@@ -643,18 +640,18 @@ public class CounterContext implements IContext
         // Continuing the iteration so that we can repair invalid shards
         while (state.hasRemaining())
         {
-            NodeId nodeId = state.getNodeId();
+            CounterId counterId = state.getCounterId();
             if (state.isDelta() && state.getClock() < 0)
             {
-                if (nodeId.equals(localId))
+                if (counterId.equals(localId))
                     // we should not get there, but we have been creating problematic context prior to #2968
-                    throw new RuntimeException("Current nodeId with a negative clock (likely due to #2968). You need to restart this node with -Dcassandra.renew_counter_id=true to fix.");
+                    throw new RuntimeException("Current counterId with a negative clock (likely due to #2968). You need to restart this node with -Dcassandra.renew_counter_id=true to fix.");
 
                 if (state.getCount() != 0)
                 {
                     // This should not happen, but previous bugs have generated this (#2968 in particular) so fixing it.
-                    logger.error(String.format("Invalid counter context (clock is %d and count is %d for NodeId %s), will fix", state.getClock(), state.getCount(), nodeId.toString()));
-                    toMerge.add(nodeId);
+                    logger.error(String.format("Invalid counter context (clock is %d and count is %d for CounterId %s), will fix", state.getClock(), state.getCount(), counterId.toString()));
+                    toMerge.add(counterId);
                     mergeTotal += state.getCount();
                 }
             }
@@ -671,17 +668,17 @@ public class CounterContext implements IContext
         boolean localWritten = false;
         while (state.hasRemaining())
         {
-            NodeId nodeId = state.getNodeId();
-            if (nodeId.compareTo(localId) > 0)
+            CounterId counterId = state.getCounterId();
+            if (counterId.compareTo(localId) > 0)
             {
                 merger.writeElement(localId, 1L, mergeTotal, true);
                 localWritten = true;
             }
-            else if (i < toMerge.size() && nodeId.compareTo(toMerge.get(i)) == 0)
+            else if (i < toMerge.size() && counterId.compareTo(toMerge.get(i)) == 0)
             {
                 long count = state.getCount();
                 removedTotal += count;
-                merger.writeElement(nodeId, -now - state.getClock(), -count, true);
+                merger.writeElement(counterId, -now - state.getClock(), -count, true);
                 ++i;
             }
             state.moveToNext();
@@ -769,7 +766,7 @@ public class CounterContext implements IContext
 
     /**
      * Helper class to work on contexts (works by iterating over them).
-     * A context being abstractly a list of tuple (nodeid, clock, count), a
+     * A context being abstractly a list of tuple (counterid, clock, count), a
      * ContextState encapsulate a context and a position to one of the tuple.
      * It also allow to create new context iteratively.
      *
@@ -864,23 +861,23 @@ public class CounterContext implements IContext
             updateIsDelta();
         }
 
-        public NodeId getNodeId()
+        public CounterId getCounterId()
         {
-            return NodeId.wrap(context, context.position() + bodyOffset);
+            return CounterId.wrap(context, context.position() + bodyOffset);
         }
 
         public long getClock()
         {
-            return context.getLong(context.position() + bodyOffset + NodeId.LENGTH);
+            return context.getLong(context.position() + bodyOffset + CounterId.LENGTH);
         }
 
         public long getCount()
         {
-            return context.getLong(context.position() + bodyOffset + NodeId.LENGTH + CLOCK_LENGTH);
+            return context.getLong(context.position() + bodyOffset + CounterId.LENGTH + CLOCK_LENGTH);
         }
 
         // Advance this to the next position
-        public void writeElement(NodeId id, long clock, long count, boolean isDelta)
+        public void writeElement(CounterId id, long clock, long count, boolean isDelta)
         {
             writeElementAtOffset(context, context.position() + bodyOffset, id, clock, count);
             if (isDelta)
@@ -891,7 +888,7 @@ public class CounterContext implements IContext
             moveToNext();
         }
 
-        public void writeElement(NodeId id, long clock, long count)
+        public void writeElement(CounterId id, long clock, long count)
         {
             writeElement(id, clock, count, false);
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
index 3385b35..b41ca47 100644
--- a/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
+++ b/src/java/org/apache/cassandra/hadoop/ColumnFamilyRecordReader.java
@@ -303,7 +303,7 @@ public class ColumnFamilyRecordReader extends RecordReader<ByteBuffer, SortedMap
 
         private IColumn unthriftifyCounter(CounterColumn column)
         {
-            //CounterColumns read the nodeID from the System table, so need the StorageService running and access
+            //CounterColumns read the counterID from the System table, so need the StorageService running and access
             //to cassandra.yaml. To avoid a Hadoop needing access to yaml return a regular Column.
             return new org.apache.cassandra.db.Column(column.name, ByteBufferUtil.bytes(column.value), 0);
         }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java b/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
index d1727f7..f3d097f 100644
--- a/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
@@ -29,7 +29,7 @@ import org.apache.cassandra.config.DatabaseDescriptor;
 import org.apache.cassandra.db.*;
 import org.apache.cassandra.db.context.CounterContext;
 import org.apache.cassandra.dht.IPartitioner;
-import org.apache.cassandra.utils.NodeId;
+import org.apache.cassandra.utils.CounterId;
 import org.apache.cassandra.utils.Pair;
 
 public abstract class AbstractSSTableSimpleWriter
@@ -39,7 +39,7 @@ public abstract class AbstractSSTableSimpleWriter
     protected DecoratedKey currentKey;
     protected ColumnFamily columnFamily;
     protected SuperColumn currentSuperColumn;
-    protected final NodeId nodeid = NodeId.generate();
+    protected final CounterId counterid = CounterId.generate();
 
     public AbstractSSTableSimpleWriter(File directory, CFMetaData metadata, IPartitioner partitioner)
     {
@@ -151,7 +151,7 @@ public abstract class AbstractSSTableSimpleWriter
      */
     public void addCounterColumn(ByteBuffer name, long value)
     {
-        addColumn(new CounterColumn(name, CounterContext.instance().create(nodeid, 1L, value, false), System.currentTimeMillis()));
+        addColumn(new CounterColumn(name, CounterContext.instance().create(counterid, 1L, value, false), System.currentTimeMillis()));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index b347aa6..b8fbd0b 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -425,7 +425,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
         if (Boolean.parseBoolean(System.getProperty("cassandra.renew_counter_id", "false")))
         {
             logger.info("Renewing local node id (as requested)");
-            NodeId.renewLocalId();
+            CounterId.renewLocalId();
         }
 
         // daemon threads, like our executors', continue to run while shutdown hooks are invoked
@@ -495,7 +495,7 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
 
         // have to start the gossip service before we can see any info on other nodes.  this is necessary
         // for bootstrap to get the load info it needs.
-        // (we won't be part of the storage ring though until we add a nodeId to our state, below.)
+        // (we won't be part of the storage ring though until we add a counterId to our state, below.)
         Gossiper.instance.register(this);
         Gossiper.instance.register(migrationManager);
         Gossiper.instance.start(SystemTable.incrementAndGetGeneration()); // needed for node-ring gathering.
@@ -1895,10 +1895,10 @@ public class StorageService implements IEndpointStateChangeSubscriber, StorageSe
         if (tableName.equals(Table.SYSTEM_KS))
             throw new RuntimeException("Cleanup of the system table is neither necessary nor wise");
 
-        NodeId.OneShotRenewer nodeIdRenewer = new NodeId.OneShotRenewer();
+        CounterId.OneShotRenewer counterIdRenewer = new CounterId.OneShotRenewer();
         for (ColumnFamilyStore cfStore : getValidColumnFamilies(tableName, columnFamilies))
         {
-            cfStore.forceCleanup(nodeIdRenewer);
+            cfStore.forceCleanup(counterIdRenewer);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/utils/CounterId.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/CounterId.java b/src/java/org/apache/cassandra/utils/CounterId.java
new file mode 100644
index 0000000..2520d9f
--- /dev/null
+++ b/src/java/org/apache/cassandra/utils/CounterId.java
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cassandra.utils;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.google.common.base.Objects;
+
+import org.apache.cassandra.db.CounterColumn;
+import org.apache.cassandra.db.SystemTable;
+
+public class CounterId implements Comparable<CounterId>
+{
+    private static final Logger logger = LoggerFactory.getLogger(CounterId.class);
+
+    public static final int LENGTH = 16; // we assume a fixed length size for all CounterIds
+
+    // Lazy holder because this opens the system table and we want to avoid
+    // having this triggered during class initialization
+    private static class LocalIds
+    {
+        static final LocalCounterIdHistory instance = new LocalCounterIdHistory();
+    }
+
+    private final ByteBuffer id;
+
+    private static LocalCounterIdHistory localIds()
+    {
+        return LocalIds.instance;
+    }
+
+    public static CounterId getLocalId()
+    {
+        return localIds().current.get();
+    }
+
+    /**
+     * Renew the local counter id.
+     * To use only when this strictly necessary, as using this will make all
+     * counter context grow with time.
+     */
+    public static void renewLocalId()
+    {
+        renewLocalId(FBUtilities.timestampMicros());
+    }
+
+    public static synchronized void renewLocalId(long now)
+    {
+        localIds().renewCurrent(now);
+    }
+
+    /**
+     * Return the list of old local counter id of this node.
+     * It is guaranteed that the returned list is sorted by growing counter id
+     * (and hence the first item will be the oldest counter id for this host)
+     */
+    public static List<CounterIdRecord> getOldLocalCounterIds()
+    {
+        return localIds().olds;
+    }
+
+    /**
+     * Function for test purposes, do not use otherwise.
+     * Pack an int in a valid CounterId so that the resulting ids respects the
+     * numerical ordering. Used for creating handcrafted but easy to
+     * understand contexts in unit tests (see CounterContextTest).
+     */
+    public static CounterId fromInt(int n)
+    {
+        long lowBits = 0xC000000000000000L | n;
+        return new CounterId(ByteBuffer.allocate(16).putLong(0, 0).putLong(8, lowBits));
+    }
+
+    /*
+     * For performance reasons, this function interns the provided ByteBuffer.
+     */
+    public static CounterId wrap(ByteBuffer id)
+    {
+        return new CounterId(id);
+    }
+
+    public static CounterId wrap(ByteBuffer bb, int offset)
+    {
+        ByteBuffer dup = bb.duplicate();
+        dup.position(offset);
+        dup.limit(dup.position() + LENGTH);
+        return wrap(dup);
+    }
+
+    private CounterId(ByteBuffer id)
+    {
+        if (id.remaining() != LENGTH)
+            throw new IllegalArgumentException("A CounterId representation is exactly " + LENGTH + " bytes");
+
+        this.id = id;
+    }
+
+    public static CounterId generate()
+    {
+        return new CounterId(ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUIDFromHost(FBUtilities.getBroadcastAddress()))));
+    }
+
+    /*
+     * For performance reasons, this function returns a reference to the internal ByteBuffer. Clients not modify the
+     * result of this function.
+     */
+    public ByteBuffer bytes()
+    {
+        return id;
+    }
+
+    public boolean isLocalId()
+    {
+        return equals(getLocalId());
+    }
+
+    public int compareTo(CounterId o)
+    {
+        return ByteBufferUtil.compareSubArrays(id, id.position(), o.id, o.id.position(), CounterId.LENGTH);
+    }
+
+    @Override
+    public String toString()
+    {
+        return UUIDGen.getUUID(id).toString();
+    }
+
+    @Override
+    public boolean equals(Object o)
+    {
+        if (this == o)
+            return true;
+        if (o == null || getClass() != o.getClass())
+            return false;
+
+        CounterId otherId = (CounterId)o;
+        return id.equals(otherId.id);
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return id.hashCode();
+    }
+
+    public static class OneShotRenewer
+    {
+        private boolean renewed;
+        private final CounterId initialId;
+
+        public OneShotRenewer()
+        {
+            renewed = false;
+            initialId = getLocalId();
+        }
+
+        public void maybeRenew(CounterColumn column)
+        {
+            if (!renewed && column.hasCounterId(initialId))
+            {
+                renewLocalId();
+                renewed = true;
+            }
+        }
+    }
+
+    private static class LocalCounterIdHistory
+    {
+        private final AtomicReference<CounterId> current;
+        private final List<CounterIdRecord> olds;
+
+        LocalCounterIdHistory()
+        {
+            CounterId id = SystemTable.getCurrentLocalCounterId();
+            if (id == null)
+            {
+                // no recorded local counter id, generating a new one and saving it
+                id = generate();
+                logger.info("No saved local counter id, using newly generated: {}", id);
+                SystemTable.writeCurrentLocalCounterId(null, id, FBUtilities.timestampMicros());
+                current = new AtomicReference<CounterId>(id);
+                olds = new CopyOnWriteArrayList<CounterIdRecord>();
+            }
+            else
+            {
+                logger.info("Saved local counter id: {}", id);
+                current = new AtomicReference<CounterId>(id);
+                olds = new CopyOnWriteArrayList<CounterIdRecord>(SystemTable.getOldLocalCounterIds());
+            }
+        }
+
+        synchronized void renewCurrent(long now)
+        {
+            CounterId newCounterId = generate();
+            CounterId old = current.get();
+            SystemTable.writeCurrentLocalCounterId(old, newCounterId, now);
+            current.set(newCounterId);
+            olds.add(new CounterIdRecord(old, now));
+        }
+    }
+
+    public static class CounterIdRecord
+    {
+        public final CounterId id;
+        public final long timestamp;
+
+        public CounterIdRecord(CounterId id, long timestamp)
+        {
+            this.id = id;
+            this.timestamp = timestamp;
+        }
+
+        @Override
+        public boolean equals(Object o)
+        {
+            if (this == o)
+                return true;
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            CounterIdRecord otherRecord = (CounterIdRecord)o;
+            return id.equals(otherRecord.id) && timestamp == otherRecord.timestamp;
+        }
+
+        @Override
+        public int hashCode()
+        {
+            return Objects.hashCode(id, timestamp);
+        }
+
+        public String toString()
+        {
+            return String.format("(%s, %d)", id.toString(), timestamp);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/src/java/org/apache/cassandra/utils/NodeId.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/NodeId.java b/src/java/org/apache/cassandra/utils/NodeId.java
deleted file mode 100644
index 56fde68..0000000
--- a/src/java/org/apache/cassandra/utils/NodeId.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.cassandra.utils;
-
-import java.nio.ByteBuffer;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import com.google.common.base.Objects;
-
-import org.apache.cassandra.db.CounterColumn;
-import org.apache.cassandra.db.SystemTable;
-
-public class NodeId implements Comparable<NodeId>
-{
-    private static final Logger logger = LoggerFactory.getLogger(NodeId.class);
-
-    public static final int LENGTH = 16; // we assume a fixed length size for all NodeIds
-
-    // Lazy holder because this opens the system table and we want to avoid
-    // having this triggered during class initialization
-    private static class LocalIds
-    {
-        static final LocalNodeIdHistory instance = new LocalNodeIdHistory();
-    }
-
-    private final ByteBuffer id;
-
-    private static LocalNodeIdHistory localIds()
-    {
-        return LocalIds.instance;
-    }
-
-    public static NodeId getLocalId()
-    {
-        return localIds().current.get();
-    }
-
-    /**
-     * Renew the local node id.
-     * To use only when this strictly necessary, as using this will make all
-     * counter context grow with time.
-     */
-    public static void renewLocalId()
-    {
-        renewLocalId(FBUtilities.timestampMicros());
-    }
-
-    public static synchronized void renewLocalId(long now)
-    {
-        localIds().renewCurrent(now);
-    }
-
-    /**
-     * Return the list of old local node id of this node.
-     * It is guaranteed that the returned list is sorted by growing node id
-     * (and hence the first item will be the oldest node id for this host)
-     */
-    public static List<NodeIdRecord> getOldLocalNodeIds()
-    {
-        return localIds().olds;
-    }
-
-    /**
-     * Function for test purposes, do not use otherwise.
-     * Pack an int in a valid NodeId so that the resulting ids respects the
-     * numerical ordering. Used for creating handcrafted but easy to
-     * understand contexts in unit tests (see CounterContextTest).
-     */
-    public static NodeId fromInt(int n)
-    {
-        long lowBits = 0xC000000000000000L | n;
-        return new NodeId(ByteBuffer.allocate(16).putLong(0, 0).putLong(8, lowBits));
-    }
-
-    /*
-     * For performance reasons, this function interns the provided ByteBuffer.
-     */
-    public static NodeId wrap(ByteBuffer id)
-    {
-        return new NodeId(id);
-    }
-
-    public static NodeId wrap(ByteBuffer bb, int offset)
-    {
-        ByteBuffer dup = bb.duplicate();
-        dup.position(offset);
-        dup.limit(dup.position() + LENGTH);
-        return wrap(dup);
-    }
-
-    private NodeId(ByteBuffer id)
-    {
-        if (id.remaining() != LENGTH)
-            throw new IllegalArgumentException("A NodeId representation is exactly " + LENGTH + " bytes");
-
-        this.id = id;
-    }
-
-    public static NodeId generate()
-    {
-        return new NodeId(ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.makeType1UUIDFromHost(FBUtilities.getBroadcastAddress()))));
-    }
-
-    /*
-     * For performance reasons, this function returns a reference to the internal ByteBuffer. Clients not modify the
-     * result of this function.
-     */
-    public ByteBuffer bytes()
-    {
-        return id;
-    }
-
-    public boolean isLocalId()
-    {
-        return equals(getLocalId());
-    }
-
-    public int compareTo(NodeId o)
-    {
-        return ByteBufferUtil.compareSubArrays(id, id.position(), o.id, o.id.position(), NodeId.LENGTH);
-    }
-
-    @Override
-    public String toString()
-    {
-        return UUIDGen.getUUID(id).toString();
-    }
-
-    @Override
-    public boolean equals(Object o)
-    {
-        if (this == o)
-            return true;
-        if (o == null || getClass() != o.getClass())
-            return false;
-
-        NodeId otherId = (NodeId)o;
-        return id.equals(otherId.id);
-    }
-
-    @Override
-    public int hashCode()
-    {
-        return id.hashCode();
-    }
-
-    public static class OneShotRenewer
-    {
-        private boolean renewed;
-        private final NodeId initialId;
-
-        public OneShotRenewer()
-        {
-            renewed = false;
-            initialId = getLocalId();
-        }
-
-        public void maybeRenew(CounterColumn column)
-        {
-            if (!renewed && column.hasNodeId(initialId))
-            {
-                renewLocalId();
-                renewed = true;
-            }
-        }
-    }
-
-    private static class LocalNodeIdHistory
-    {
-        private final AtomicReference<NodeId> current;
-        private final List<NodeIdRecord> olds;
-
-        LocalNodeIdHistory()
-        {
-            NodeId id = SystemTable.getCurrentLocalNodeId();
-            if (id == null)
-            {
-                // no recorded local node id, generating a new one and saving it
-                id = generate();
-                logger.info("No saved local node id, using newly generated: {}", id);
-                SystemTable.writeCurrentLocalNodeId(null, id, FBUtilities.timestampMicros());
-                current = new AtomicReference<NodeId>(id);
-                olds = new CopyOnWriteArrayList<NodeIdRecord>();
-            }
-            else
-            {
-                logger.info("Saved local node id: {}", id);
-                current = new AtomicReference<NodeId>(id);
-                olds = new CopyOnWriteArrayList<NodeIdRecord>(SystemTable.getOldLocalNodeIds());
-            }
-        }
-
-        synchronized void renewCurrent(long now)
-        {
-            NodeId newNodeId = generate();
-            NodeId old = current.get();
-            SystemTable.writeCurrentLocalNodeId(old, newNodeId, now);
-            current.set(newNodeId);
-            olds.add(new NodeIdRecord(old, now));
-        }
-    }
-
-    public static class NodeIdRecord
-    {
-        public final NodeId id;
-        public final long timestamp;
-
-        public NodeIdRecord(NodeId id, long timestamp)
-        {
-            this.id = id;
-            this.timestamp = timestamp;
-        }
-
-        @Override
-        public boolean equals(Object o)
-        {
-            if (this == o)
-                return true;
-            if (o == null || getClass() != o.getClass())
-                return false;
-
-            NodeIdRecord otherRecord = (NodeIdRecord)o;
-            return id.equals(otherRecord.id) && timestamp == otherRecord.timestamp;
-        }
-
-        @Override
-        public int hashCode()
-        {
-            return Objects.hashCode(id, timestamp);
-        }
-
-        public String toString()
-        {
-            return String.format("(%s, %d)", id.toString(), timestamp);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/test/unit/org/apache/cassandra/Util.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/Util.java b/test/unit/org/apache/cassandra/Util.java
index 7a04f38..e0755a5 100644
--- a/test/unit/org/apache/cassandra/Util.java
+++ b/test/unit/org/apache/cassandra/Util.java
@@ -47,7 +47,7 @@ import org.apache.cassandra.io.sstable.Descriptor;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.NodeId;
+import org.apache.cassandra.utils.CounterId;
 
 import static org.junit.Assert.assertTrue;
 
@@ -199,9 +199,9 @@ public class Util
         return result;
     }
 
-    public static boolean equalsNodeId(NodeId n, ByteBuffer context, int offset)
+    public static boolean equalsCounterId(CounterId n, ByteBuffer context, int offset)
     {
-        return NodeId.wrap(context, context.position() + offset).equals(n);
+        return CounterId.wrap(context, context.position() + offset).equals(n);
     }
 
     public static ColumnFamily cloneAndRemoveDeleted(ColumnFamily cf, int gcBefore)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/test/unit/org/apache/cassandra/db/CleanupTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CleanupTest.java b/test/unit/org/apache/cassandra/db/CleanupTest.java
index 85eb70b..ef598bb 100644
--- a/test/unit/org/apache/cassandra/db/CleanupTest.java
+++ b/test/unit/org/apache/cassandra/db/CleanupTest.java
@@ -44,7 +44,7 @@ import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.thrift.IndexExpression;
 import org.apache.cassandra.thrift.IndexOperator;
 import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.NodeId;
+import org.apache.cassandra.utils.CounterId;
 import org.junit.Test;
 
 public class CleanupTest extends SchemaLoader
@@ -81,7 +81,7 @@ public class CleanupTest extends SchemaLoader
         assertEquals(LOOPS, rows.size());
 
         // with one token in the ring, owned by the local node, cleanup should be a no-op
-        CompactionManager.instance.performCleanup(cfs, new NodeId.OneShotRenewer());
+        CompactionManager.instance.performCleanup(cfs, new CounterId.OneShotRenewer());
 
         // ensure max timestamp of the sstables are retained post-cleanup
         assert expectedMaxTimestamps.equals(getMaxTimestampList(cfs));
@@ -127,7 +127,7 @@ public class CleanupTest extends SchemaLoader
         tmd.updateNormalToken(new BytesToken(tk1), InetAddress.getByName("127.0.0.1"));
         tmd.updateNormalToken(new BytesToken(tk2), InetAddress.getByName("127.0.0.2"));
 
-        CompactionManager.instance.performCleanup(cfs, new NodeId.OneShotRenewer());
+        CompactionManager.instance.performCleanup(cfs, new CounterId.OneShotRenewer());
 
         // row data should be gone
         rows = Util.getRangeSlice(cfs);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/test/unit/org/apache/cassandra/db/CounterColumnTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CounterColumnTest.java b/test/unit/org/apache/cassandra/db/CounterColumnTest.java
index 85a2325..d627139 100644
--- a/test/unit/org/apache/cassandra/db/CounterColumnTest.java
+++ b/test/unit/org/apache/cassandra/db/CounterColumnTest.java
@@ -35,10 +35,7 @@ import org.apache.cassandra.db.context.CounterContext;
 import static org.apache.cassandra.db.context.CounterContext.ContextState;
 import org.apache.cassandra.io.IColumnSerializer;
 import org.apache.cassandra.io.util.DataOutputBuffer;
-import org.apache.cassandra.utils.Allocator;
-import org.apache.cassandra.utils.HeapAllocator;
-import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.NodeId;
+import org.apache.cassandra.utils.*;
 
 public class CounterColumnTest extends SchemaLoader
 {
@@ -52,7 +49,7 @@ public class CounterColumnTest extends SchemaLoader
 
     static
     {
-        idLength      = NodeId.LENGTH;
+        idLength      = CounterId.LENGTH;
         clockLength   = 8; // size of long
         countLength   = 8; // size of long
 
@@ -69,7 +66,7 @@ public class CounterColumnTest extends SchemaLoader
         assert delta == column.total();
         assert 1 == column.value().getShort(0);
         assert 0 == column.value().getShort(2);
-        assert NodeId.wrap(column.value(), 4).isLocalId();
+        assert CounterId.wrap(column.value(), 4).isLocalId();
         assert 1L == column.value().getLong(4 + 0*stepLength + idLength);
         assert delta == column.value().getLong(4 + 0*stepLength + idLength + clockLength);
     }
@@ -147,20 +144,20 @@ public class CounterColumnTest extends SchemaLoader
         assert ((CounterColumn)reconciled).timestampOfLastDelete() == right.getMarkedForDeleteAt();
 
         // live < live last delete
-        left  = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(NodeId.fromInt(1), 2L, 3L, false), 1L, Long.MIN_VALUE);
-        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(NodeId.fromInt(1), 1L, 1L, false), 4L, 3L);
+        left  = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(CounterId.fromInt(1), 2L, 3L, false), 1L, Long.MIN_VALUE);
+        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(CounterId.fromInt(1), 1L, 1L, false), 4L, 3L);
 
         assert left.reconcile(right) == right;
 
         // live last delete > live
-        left  = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(NodeId.fromInt(1), 2L, 3L, false), 6L, 5L);
-        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(NodeId.fromInt(1), 1L, 1L, false), 4L, 3L);
+        left  = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(CounterId.fromInt(1), 2L, 3L, false), 6L, 5L);
+        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(CounterId.fromInt(1), 1L, 1L, false), 4L, 3L);
 
         assert left.reconcile(right) == left;
 
         // live + live
-        left = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(NodeId.fromInt(1), 1L, 1L, false), 4L, Long.MIN_VALUE);
-        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(NodeId.fromInt(1), 2L, 3L, false), 1L, Long.MIN_VALUE);
+        left = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(CounterId.fromInt(1), 1L, 1L, false), 4L, Long.MIN_VALUE);
+        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(CounterId.fromInt(1), 2L, 3L, false), 1L, Long.MIN_VALUE);
 
         reconciled = left.reconcile(right);
         assert reconciled.name().equals(left.name());
@@ -168,7 +165,7 @@ public class CounterColumnTest extends SchemaLoader
         assert reconciled.timestamp() == 4L;
 
         left = reconciled;
-        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(NodeId.fromInt(2), 1L, 5L, false), 2L, Long.MIN_VALUE);
+        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(CounterId.fromInt(2), 1L, 5L, false), 2L, Long.MIN_VALUE);
 
         reconciled = left.reconcile(right);
         assert reconciled.name().equals(left.name());
@@ -176,7 +173,7 @@ public class CounterColumnTest extends SchemaLoader
         assert reconciled.timestamp() == 4L;
 
         left = reconciled;
-        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(NodeId.fromInt(2), 2L, 2L, false), 6L, Long.MIN_VALUE);
+        right = new CounterColumn(ByteBufferUtil.bytes("x"), cc.create(CounterId.fromInt(2), 2L, 2L, false), 6L, Long.MIN_VALUE);
 
         reconciled = left.reconcile(right);
         assert reconciled.name().equals(left.name());
@@ -187,11 +184,11 @@ public class CounterColumnTest extends SchemaLoader
         int hd = 2; // header
         assert hd + 2 * stepLength == context.remaining();
 
-        assert Util.equalsNodeId(NodeId.fromInt(1), context, hd + 0*stepLength);
+        assert Util.equalsCounterId(CounterId.fromInt(1), context, hd + 0 * stepLength);
         assert 2L == context.getLong(hd + 0*stepLength + idLength);
         assert 3L == context.getLong(hd + 0*stepLength + idLength + clockLength);
 
-        assert Util.equalsNodeId(NodeId.fromInt(2), context, hd + 1*stepLength);
+        assert Util.equalsCounterId(CounterId.fromInt(2), context, hd + 1 * stepLength);
         assert 2L == context.getLong(hd + 1*stepLength + idLength);
         assert 2L == context.getLong(hd + 1*stepLength + idLength + clockLength);
 
@@ -224,9 +221,9 @@ public class CounterColumnTest extends SchemaLoader
 
         // equality: equal nodes, all counts same
         left = ContextState.allocate(3, 0, allocator);
-        left.writeElement(NodeId.fromInt(3), 3L, 0L);
-        left.writeElement(NodeId.fromInt(6), 2L, 0L);
-        left.writeElement(NodeId.fromInt(9), 1L, 0L);
+        left.writeElement(CounterId.fromInt(3), 3L, 0L);
+        left.writeElement(CounterId.fromInt(6), 2L, 0L);
+        left.writeElement(CounterId.fromInt(9), 1L, 0L);
         right = new ContextState(ByteBufferUtil.clone(left.context), 2);
 
         leftCol  = new CounterColumn(ByteBufferUtil.bytes("x"), left.context,  1L);
@@ -235,15 +232,15 @@ public class CounterColumnTest extends SchemaLoader
 
         // greater than: left has superset of nodes (counts equal)
         left = ContextState.allocate(4, 0, allocator);
-        left.writeElement(NodeId.fromInt(3), 3L, 0L);
-        left.writeElement(NodeId.fromInt(6), 2L, 0L);
-        left.writeElement(NodeId.fromInt(9), 1L, 0L);
-        left.writeElement(NodeId.fromInt(12), 0L, 0L);
+        left.writeElement(CounterId.fromInt(3), 3L, 0L);
+        left.writeElement(CounterId.fromInt(6), 2L, 0L);
+        left.writeElement(CounterId.fromInt(9), 1L, 0L);
+        left.writeElement(CounterId.fromInt(12), 0L, 0L);
 
         right = ContextState.allocate(3, 0, allocator);
-        right.writeElement(NodeId.fromInt(3), 3L, 0L);
-        right.writeElement(NodeId.fromInt(6), 2L, 0L);
-        right.writeElement(NodeId.fromInt(9), 1L, 0L);
+        right.writeElement(CounterId.fromInt(3), 3L, 0L);
+        right.writeElement(CounterId.fromInt(6), 2L, 0L);
+        right.writeElement(CounterId.fromInt(9), 1L, 0L);
 
         leftCol  = new CounterColumn(ByteBufferUtil.bytes("x"), left.context,  1L);
         rightCol = new CounterColumn(ByteBufferUtil.bytes("x"), right.context, 1L);
@@ -254,14 +251,14 @@ public class CounterColumnTest extends SchemaLoader
 
         // disjoint: right and left have disjoint node sets
         left = ContextState.allocate(3, 0, allocator);
-        left.writeElement(NodeId.fromInt(3), 1L, 0L);
-        left.writeElement(NodeId.fromInt(4), 1L, 0L);
-        left.writeElement(NodeId.fromInt(9), 1L, 0L);
+        left.writeElement(CounterId.fromInt(3), 1L, 0L);
+        left.writeElement(CounterId.fromInt(4), 1L, 0L);
+        left.writeElement(CounterId.fromInt(9), 1L, 0L);
 
         right = ContextState.allocate(3, 0, allocator);
-        right.writeElement(NodeId.fromInt(3), 1L, 0L);
-        right.writeElement(NodeId.fromInt(6), 1L, 0L);
-        right.writeElement(NodeId.fromInt(9), 1L, 0L);
+        right.writeElement(CounterId.fromInt(3), 1L, 0L);
+        right.writeElement(CounterId.fromInt(6), 1L, 0L);
+        right.writeElement(CounterId.fromInt(9), 1L, 0L);
 
         leftCol  = new CounterColumn(ByteBufferUtil.bytes("x"), left.context,  1L);
         rightCol = new CounterColumn(ByteBufferUtil.bytes("x"), right.context, 1L);
@@ -274,10 +271,10 @@ public class CounterColumnTest extends SchemaLoader
     {
         Allocator allocator = HeapAllocator.instance;
         CounterContext.ContextState state = CounterContext.ContextState.allocate(4, 2, allocator);
-        state.writeElement(NodeId.fromInt(1), 4L, 4L);
-        state.writeElement(NodeId.fromInt(2), 4L, 4L, true);
-        state.writeElement(NodeId.fromInt(3), 4L, 4L);
-        state.writeElement(NodeId.fromInt(4), 4L, 4L, true);
+        state.writeElement(CounterId.fromInt(1), 4L, 4L);
+        state.writeElement(CounterId.fromInt(2), 4L, 4L, true);
+        state.writeElement(CounterId.fromInt(3), 4L, 4L);
+        state.writeElement(CounterId.fromInt(4), 4L, 4L, true);
 
         CounterColumn original = new CounterColumn(ByteBufferUtil.bytes("x"), state.context, 1L);
         DataOutputBuffer bufOut = new DataOutputBuffer();
@@ -305,10 +302,10 @@ public class CounterColumnTest extends SchemaLoader
         MessageDigest digest2 = MessageDigest.getInstance("md5");
 
         CounterContext.ContextState state = CounterContext.ContextState.allocate(4, 2, allocator);
-        state.writeElement(NodeId.fromInt(1), 4L, 4L);
-        state.writeElement(NodeId.fromInt(2), 4L, 4L, true);
-        state.writeElement(NodeId.fromInt(3), 4L, 4L);
-        state.writeElement(NodeId.fromInt(4), 4L, 4L, true);
+        state.writeElement(CounterId.fromInt(1), 4L, 4L);
+        state.writeElement(CounterId.fromInt(2), 4L, 4L, true);
+        state.writeElement(CounterId.fromInt(3), 4L, 4L);
+        state.writeElement(CounterId.fromInt(4), 4L, 4L, true);
 
         CounterColumn original = new CounterColumn(ByteBufferUtil.bytes("x"), state.context, 1L);
         CounterColumn cleared = new CounterColumn(ByteBufferUtil.bytes("x"), cc.clearAllDelta(state.context), 1L);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/test/unit/org/apache/cassandra/db/CounterMutationTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CounterMutationTest.java b/test/unit/org/apache/cassandra/db/CounterMutationTest.java
index 12b5559..10fafa5 100644
--- a/test/unit/org/apache/cassandra/db/CounterMutationTest.java
+++ b/test/unit/org/apache/cassandra/db/CounterMutationTest.java
@@ -28,7 +28,6 @@ import static org.junit.Assert.fail;
 import org.apache.cassandra.db.context.CounterContext;
 import org.apache.cassandra.db.filter.*;
 import org.apache.cassandra.SchemaLoader;
-import org.apache.cassandra.thrift.*;
 import org.apache.cassandra.utils.*;
 import org.apache.cassandra.Util;
 import static org.apache.cassandra.db.context.CounterContext.ContextState;
@@ -42,23 +41,23 @@ public class CounterMutationTest extends SchemaLoader
         RowMutation rm;
         CounterMutation cm;
 
-        NodeId id1 = NodeId.getLocalId();
+        CounterId id1 = CounterId.getLocalId();
 
         rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
         rm.addCounter(new QueryPath("Counter1", null, ByteBufferUtil.bytes("Column1")), 3);
         cm = new CounterMutation(rm, ConsistencyLevel.ONE);
         cm.apply();
 
-        NodeId.renewLocalId(2L); // faking time of renewal for test
-        NodeId id2 = NodeId.getLocalId();
+        CounterId.renewLocalId(2L); // faking time of renewal for test
+        CounterId id2 = CounterId.getLocalId();
 
         rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
         rm.addCounter(new QueryPath("Counter1", null, ByteBufferUtil.bytes("Column1")), 4);
         cm = new CounterMutation(rm, ConsistencyLevel.ONE);
         cm.apply();
 
-        NodeId.renewLocalId(4L); // faking time of renewal for test
-        NodeId id3 = NodeId.getLocalId();
+        CounterId.renewLocalId(4L); // faking time of renewal for test
+        CounterId id3 = CounterId.getLocalId();
 
         rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("key1"));
         rm.addCounter(new QueryPath("Counter1", null, ByteBufferUtil.bytes("Column1")), 5);
@@ -77,17 +76,17 @@ public class CounterMutationTest extends SchemaLoader
         assert c instanceof CounterColumn;
         assert ((CounterColumn)c).total() == 12L;
         ContextState s = new ContextState(c.value());
-        assert s.getNodeId().equals(id1);
+        assert s.getCounterId().equals(id1);
         assert s.getCount() == 0L;
         assert -s.getClock() > now - 1000 : " >";
         assert -s.getClock() <= now;
         s.moveToNext();
-        assert s.getNodeId().equals(id2);
+        assert s.getCounterId().equals(id2);
         assert s.getCount() == 0L;
         assert -s.getClock() > now - 1000;
         assert -s.getClock() <= now;
         s.moveToNext();
-        assert s.getNodeId().equals(id3);
+        assert s.getCounterId().equals(id3);
         assert s.getCount() == 12L;
 
         // Then collect old shards
@@ -97,7 +96,7 @@ public class CounterMutationTest extends SchemaLoader
         assert c instanceof CounterColumn;
         assert ((CounterColumn)c).total() == 12L;
         s = new ContextState(c.value());
-        assert s.getNodeId().equals(id3);
+        assert s.getCounterId().equals(id3);
         assert s.getCount() == 12L;
     }
 
@@ -140,12 +139,12 @@ public class CounterMutationTest extends SchemaLoader
     {
         // Renewing a bunch of times and checking we get the same thing from
         // the system table that what is in memory
-        NodeId.renewLocalId();
-        NodeId.renewLocalId();
-        NodeId.renewLocalId();
+        CounterId.renewLocalId();
+        CounterId.renewLocalId();
+        CounterId.renewLocalId();
 
-        List<NodeId.NodeIdRecord> inMem = NodeId.getOldLocalNodeIds();
-        List<NodeId.NodeIdRecord> onDisk = SystemTable.getOldLocalNodeIds();
+        List<CounterId.CounterIdRecord> inMem = CounterId.getOldLocalCounterIds();
+        List<CounterId.CounterIdRecord> onDisk = SystemTable.getOldLocalCounterIds();
 
         assert inMem.equals(onDisk);
     }
@@ -157,12 +156,12 @@ public class CounterMutationTest extends SchemaLoader
         int now = (int) (System.currentTimeMillis() / 1000);
 
         // Check that corrupted context created prior to #2968 are fixed by removeOldShards
-        NodeId id1 = NodeId.getLocalId();
-        NodeId.renewLocalId();
-        NodeId id2 = NodeId.getLocalId();
+        CounterId id1 = CounterId.getLocalId();
+        CounterId.renewLocalId();
+        CounterId id2 = CounterId.getLocalId();
 
         ContextState state = ContextState.allocate(3, 2);
-        state.writeElement(NodeId.fromInt(1), 1, 4, false);
+        state.writeElement(CounterId.fromInt(1), 1, 4, false);
         state.writeElement(id1, 3, 2, true);
         state.writeElement(id2, -100, 5, true); // corrupted!
 
@@ -170,14 +169,14 @@ public class CounterMutationTest extends SchemaLoader
 
         try
         {
-            ByteBuffer merger = ctx.computeOldShardMerger(state.context, Collections.<NodeId.NodeIdRecord>emptyList(), 0);
+            ByteBuffer merger = ctx.computeOldShardMerger(state.context, Collections.<CounterId.CounterIdRecord>emptyList(), 0);
             ctx.removeOldShards(ctx.merge(state.context, merger, HeapAllocator.instance), now);
             fail("RemoveOldShards should throw an exception if the current id is non-sensical");
         }
         catch (RuntimeException e) {}
 
-        NodeId.renewLocalId();
-        ByteBuffer merger = ctx.computeOldShardMerger(state.context, Collections.<NodeId.NodeIdRecord>emptyList(), 0);
+        CounterId.renewLocalId();
+        ByteBuffer merger = ctx.computeOldShardMerger(state.context, Collections.<CounterId.CounterIdRecord>emptyList(), 0);
         ByteBuffer cleaned = ctx.removeOldShards(ctx.merge(state.context, merger, HeapAllocator.instance), now);
         assert ctx.total(cleaned) == 11;
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/3b13457d/test/unit/org/apache/cassandra/db/SuperColumnTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/SuperColumnTest.java b/test/unit/org/apache/cassandra/db/SuperColumnTest.java
index 6537b26..6c07d2d 100644
--- a/test/unit/org/apache/cassandra/db/SuperColumnTest.java
+++ b/test/unit/org/apache/cassandra/db/SuperColumnTest.java
@@ -26,7 +26,7 @@ import org.apache.cassandra.db.context.CounterContext;
 import static org.apache.cassandra.db.context.CounterContext.ContextState;
 import org.apache.cassandra.db.marshal.LongType;
 import org.apache.cassandra.utils.ByteBufferUtil;
-import org.apache.cassandra.utils.NodeId;
+import org.apache.cassandra.utils.CounterId;
 
 public class SuperColumnTest
 {
@@ -48,23 +48,23 @@ public class SuperColumnTest
     	SuperColumn sc = new SuperColumn(ByteBufferUtil.bytes("sc1"), LongType.instance);
 
         state = ContextState.allocate(4, 1);
-        state.writeElement(NodeId.fromInt(1), 7L, 0L);
-        state.writeElement(NodeId.fromInt(2), 5L, 7L);
-        state.writeElement(NodeId.fromInt(4), 2L, 9L);
-        state.writeElement(NodeId.getLocalId(), 3L, 3L, true);
+        state.writeElement(CounterId.fromInt(1), 7L, 0L);
+        state.writeElement(CounterId.fromInt(2), 5L, 7L);
+        state.writeElement(CounterId.fromInt(4), 2L, 9L);
+        state.writeElement(CounterId.getLocalId(), 3L, 3L, true);
         sc.addColumn(new CounterColumn(getBytes(1), state.context, 3L, 0L));
 
         state = ContextState.allocate(4, 1);
-        state.writeElement(NodeId.fromInt(2), 3L, 4L);
-        state.writeElement(NodeId.fromInt(4), 4L, 1L);
-        state.writeElement(NodeId.fromInt(8), 9L, 0L);
-        state.writeElement(NodeId.getLocalId(), 9L, 5L, true);
+        state.writeElement(CounterId.fromInt(2), 3L, 4L);
+        state.writeElement(CounterId.fromInt(4), 4L, 1L);
+        state.writeElement(CounterId.fromInt(8), 9L, 0L);
+        state.writeElement(CounterId.getLocalId(), 9L, 5L, true);
         sc.addColumn(new CounterColumn(getBytes(1), state.context, 10L, 0L));
 
         state = ContextState.allocate(3, 0);
-        state.writeElement(NodeId.fromInt(2), 1L, 0L);
-        state.writeElement(NodeId.fromInt(3), 6L, 0L);
-        state.writeElement(NodeId.fromInt(7), 3L, 0L);
+        state.writeElement(CounterId.fromInt(2), 1L, 0L);
+        state.writeElement(CounterId.fromInt(3), 6L, 0L);
+        state.writeElement(CounterId.fromInt(7), 3L, 0L);
         sc.addColumn(new CounterColumn(getBytes(2), state.context, 9L, 0L));
 
     	assertNotNull(sc.getSubColumn(getBytes(1)));
@@ -72,11 +72,11 @@ public class SuperColumnTest
 
         // column: 1
         ContextState c1 = ContextState.allocate(5, 1);
-        c1.writeElement(NodeId.fromInt(1), 7L, 0L);
-        c1.writeElement(NodeId.fromInt(2), 5L, 7L);
-        c1.writeElement(NodeId.fromInt(4), 4L, 1L);
-        c1.writeElement(NodeId.fromInt(8), 9L, 0L);
-        c1.writeElement(NodeId.getLocalId(), 12L, 8L, true);
+        c1.writeElement(CounterId.fromInt(1), 7L, 0L);
+        c1.writeElement(CounterId.fromInt(2), 5L, 7L);
+        c1.writeElement(CounterId.fromInt(4), 4L, 1L);
+        c1.writeElement(CounterId.fromInt(8), 9L, 0L);
+        c1.writeElement(CounterId.getLocalId(), 12L, 8L, true);
         assert 0 == ByteBufferUtil.compareSubArrays(
             ((CounterColumn)sc.getSubColumn(getBytes(1))).value(),
             0,
@@ -86,9 +86,9 @@ public class SuperColumnTest
 
         // column: 2
         ContextState c2 = ContextState.allocate(3, 0);
-        c2.writeElement(NodeId.fromInt(2), 1L, 0L);
-        c2.writeElement(NodeId.fromInt(3), 6L, 0L);
-        c2.writeElement(NodeId.fromInt(7), 3L, 0L);
+        c2.writeElement(CounterId.fromInt(2), 1L, 0L);
+        c2.writeElement(CounterId.fromInt(3), 6L, 0L);
+        c2.writeElement(CounterId.fromInt(7), 3L, 0L);
         assert 0 == ByteBufferUtil.compareSubArrays(
             ((CounterColumn)sc.getSubColumn(getBytes(2))).value(),
             0,