cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alek...@apache.org
Subject [2/2] git commit: Clean up OnDiskAtom and implementations
Date Mon, 24 Mar 2014 13:57:02 GMT
Clean up OnDiskAtom and implementations

patch by Aleksey Yeschenko; reviewed by Sylvain Lebresne for
CASSANDRA-6506


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

Branch: refs/heads/cassandra-2.1
Commit: 8a2a0c3d4ba674e345f9b2f8c8b2dec8f5782254
Parents: 69bfca0
Author: Aleksey Yeschenko <aleksey@apache.org>
Authored: Mon Mar 24 16:55:32 2014 +0300
Committer: Aleksey Yeschenko <aleksey@apache.org>
Committed: Mon Mar 24 16:55:32 2014 +0300

----------------------------------------------------------------------
 .../apache/cassandra/db/AtomicBTreeColumns.java |  14 +-
 src/java/org/apache/cassandra/db/Cell.java      |  23 +---
 .../org/apache/cassandra/db/ColumnFamily.java   |   6 +-
 .../org/apache/cassandra/db/CounterCell.java    |   9 +-
 .../apache/cassandra/db/CounterMutation.java    |   4 +-
 .../apache/cassandra/db/CounterUpdateCell.java  |   4 +-
 .../org/apache/cassandra/db/DeletedCell.java    |   8 +-
 .../org/apache/cassandra/db/DeletionTime.java   |   2 +-
 .../org/apache/cassandra/db/ExpiringCell.java   |   2 +-
 .../cassandra/db/HintedHandOffManager.java      |   8 +-
 src/java/org/apache/cassandra/db/Memtable.java  |   4 +-
 .../org/apache/cassandra/db/OnDiskAtom.java     |   3 +-
 .../org/apache/cassandra/db/RangeTombstone.java |   9 +-
 .../db/compaction/LazilyCompactedRow.java       |   6 +-
 .../cassandra/db/context/CounterContext.java    |  22 ++-
 .../apache/cassandra/db/filter/QueryFilter.java |   3 +-
 .../io/sstable/AbstractSSTableSimpleWriter.java |   3 +-
 .../cassandra/io/sstable/SSTableWriter.java     |   4 +-
 .../utils/memory/ContextAllocator.java          |  11 +-
 .../cassandra/utils/memory/PoolAllocator.java   |  11 +-
 .../apache/cassandra/db/CounterCellTest.java    |  39 +++---
 .../db/context/CounterContextTest.java          | 138 +++++++------------
 .../streaming/StreamingTransferTest.java        |   3 +-
 23 files changed, 124 insertions(+), 212 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/AtomicBTreeColumns.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/AtomicBTreeColumns.java b/src/java/org/apache/cassandra/db/AtomicBTreeColumns.java
index 80e2995..a99057f 100644
--- a/src/java/org/apache/cassandra/db/AtomicBTreeColumns.java
+++ b/src/java/org/apache/cassandra/db/AtomicBTreeColumns.java
@@ -32,7 +32,6 @@ import com.google.common.collect.*;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.composites.CellName;
-import org.apache.cassandra.db.composites.CellNameType;
 import org.apache.cassandra.db.composites.Composite;
 import org.apache.cassandra.db.index.SecondaryIndexManager;
 import org.apache.cassandra.db.filter.ColumnSlice;
@@ -40,7 +39,6 @@ import org.apache.cassandra.utils.ObjectSizes;
 import org.apache.cassandra.utils.btree.BTree;
 import org.apache.cassandra.utils.btree.BTreeSet;
 import org.apache.cassandra.utils.btree.UpdateFunction;
-import org.apache.cassandra.utils.memory.AbstractAllocator;
 
 import static org.apache.cassandra.db.index.SecondaryIndexManager.Updater;
 
@@ -162,16 +160,14 @@ public class AtomicBTreeColumns extends ColumnFamily
     {
         final AtomicBTreeColumns updating;
         final Holder ref;
-        final AbstractAllocator allocator;
         final Function<Cell, Cell> transform;
         final Updater indexer;
         final Delta delta;
 
-        private ColumnUpdater(AtomicBTreeColumns updating, Holder ref, AbstractAllocator allocator, Function<Cell, Cell> transform, Updater indexer, Delta delta)
+        private ColumnUpdater(AtomicBTreeColumns updating, Holder ref, Function<Cell, Cell> transform, Updater indexer, Delta delta)
         {
             this.updating = updating;
             this.ref = ref;
-            this.allocator = allocator;
             this.transform = transform;
             this.indexer = indexer;
             this.delta = delta;
@@ -186,7 +182,7 @@ public class AtomicBTreeColumns extends ColumnFamily
 
         public Cell apply(Cell existing, Cell update)
         {
-            Cell reconciled = update.reconcile(existing, allocator);
+            Cell reconciled = update.reconcile(existing);
             indexer.update(existing, reconciled);
             if (existing != reconciled)
                 delta.swap(existing, reconciled);
@@ -225,7 +221,7 @@ public class AtomicBTreeColumns extends ColumnFamily
      *
      * @return the difference in size seen after merging the given columns
      */
-    public Delta addAllWithSizeDelta(final ColumnFamily cm, AbstractAllocator allocator, Function<Cell, Cell> transformation, Updater indexer, Delta delta)
+    public Delta addAllWithSizeDelta(final ColumnFamily cm, Function<Cell, Cell> transformation, Updater indexer, Delta delta)
     {
         boolean transformed = false;
         Collection<Cell> insert = cm.getSortedColumns();
@@ -243,7 +239,7 @@ public class AtomicBTreeColumns extends ColumnFamily
                     for (Iterator<RangeTombstone> rangeIterator = cm.deletionInfo().rangeIterator(); rangeIterator.hasNext(); )
                     {
                         RangeTombstone rt = rangeIterator.next();
-                        long deleteAt = rt.maxTimestamp();
+                        long deleteAt = rt.timestamp();
                         for (Iterator<Cell> iter = current.cellRange(getComparator().columnComparator(), rt.min, rt.max); iter.hasNext(); )
                         {
                             Cell c = iter.next();
@@ -261,7 +257,7 @@ public class AtomicBTreeColumns extends ColumnFamily
                 deletionInfo = current.deletionInfo;
             }
 
-            ColumnUpdater updater = new ColumnUpdater(this, current, allocator, transformation, indexer, delta);
+            ColumnUpdater updater = new ColumnUpdater(this, current, transformation, indexer, delta);
             Object[] tree = BTree.update(current.tree, metadata.comparator.columnComparator(), insert, true, updater);
 
             if (tree != null && refUpdater.compareAndSet(this, current, new Holder(tree, deletionInfo)))

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/Cell.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Cell.java b/src/java/org/apache/cassandra/db/Cell.java
index 44656ea..e807a21 100644
--- a/src/java/org/apache/cassandra/db/Cell.java
+++ b/src/java/org/apache/cassandra/db/Cell.java
@@ -38,7 +38,6 @@ import org.apache.cassandra.utils.ObjectSizes;
 import org.apache.cassandra.utils.memory.AbstractAllocator;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
-import org.apache.cassandra.utils.memory.HeapAllocator;
 
 /**
  * Cell is immutable, which prevents all kinds of confusion in a multithreaded environment.
@@ -134,16 +133,6 @@ public class Cell implements OnDiskAtom
         return timestamp;
     }
 
-    public long minTimestamp()
-    {
-        return timestamp;
-    }
-
-    public long maxTimestamp()
-    {
-        return timestamp;
-    }
-
     public boolean isMarkedForDelete(long now)
     {
         return false;
@@ -223,11 +212,6 @@ public class Cell implements OnDiskAtom
 
     public Cell reconcile(Cell cell)
     {
-        return reconcile(cell, HeapAllocator.instance);
-    }
-
-    public Cell reconcile(Cell cell, AbstractAllocator allocator)
-    {
         // tombstones take precedence.  (if both are tombstones, then it doesn't matter which one we use.)
         if (isMarkedForDelete(System.currentTimeMillis()))
             return timestamp() < cell.timestamp() ? cell : this;
@@ -263,7 +247,7 @@ public class Cell implements OnDiskAtom
         return result;
     }
 
-    public Cell localCopy(ColumnFamilyStore cfs, AbstractAllocator allocator)
+    public Cell localCopy(AbstractAllocator allocator)
     {
         return new Cell(name.copy(allocator), allocator.clone(value), timestamp);
     }
@@ -291,11 +275,6 @@ public class Cell implements OnDiskAtom
             valueValidator.validate(value());
     }
 
-    public boolean hasIrrelevantData(int gcBefore)
-    {
-        return getLocalDeletionTime() < gcBefore;
-    }
-
     public static Cell create(CellName name, ByteBuffer value, long timestamp, int ttl, CFMetaData metadata)
     {
         if (ttl <= 0)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/ColumnFamily.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamily.java b/src/java/org/apache/cassandra/db/ColumnFamily.java
index 8762462..55315ee 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamily.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamily.java
@@ -325,7 +325,7 @@ public abstract class ColumnFamily implements Iterable<Cell>, IRowCacheEntry
     {
         long maxTimestamp = deletionInfo().maxTimestamp();
         for (Cell cell : this)
-            maxTimestamp = Math.max(maxTimestamp, cell.maxTimestamp());
+            maxTimestamp = Math.max(maxTimestamp, cell.timestamp());
         return maxTimestamp;
     }
 
@@ -407,8 +407,8 @@ public abstract class ColumnFamily implements Iterable<Cell>, IRowCacheEntry
                 RangeTombstone rangeTombstone = it.next();
                 tombstones.update(rangeTombstone.getLocalDeletionTime());
             }
-            minTimestampSeen = Math.min(minTimestampSeen, cell.minTimestamp());
-            maxTimestampSeen = Math.max(maxTimestampSeen, cell.maxTimestamp());
+            minTimestampSeen = Math.min(minTimestampSeen, cell.timestamp());
+            maxTimestampSeen = Math.max(maxTimestampSeen, cell.timestamp());
             maxLocalDeletionTime = Math.max(maxLocalDeletionTime, cell.getLocalDeletionTime());
             int deletionTime = cell.getLocalDeletionTime();
             if (deletionTime < Integer.MAX_VALUE)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/CounterCell.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CounterCell.java b/src/java/org/apache/cassandra/db/CounterCell.java
index e097914..cc26ef5 100644
--- a/src/java/org/apache/cassandra/db/CounterCell.java
+++ b/src/java/org/apache/cassandra/db/CounterCell.java
@@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
 import java.security.MessageDigest;
 import org.apache.cassandra.serializers.MarshalException;
 import org.apache.cassandra.utils.memory.AbstractAllocator;
-import org.apache.cassandra.utils.memory.HeapAllocator;
 
 import org.apache.cassandra.config.CFMetaData;
 import org.apache.cassandra.db.composites.CellName;
@@ -60,7 +59,7 @@ public class CounterCell extends Cell
     // For use by tests of compatibility with pre-2.1 counter only.
     public static CounterCell createLocal(CellName name, long value, long timestamp, long timestampOfLastDelete)
     {
-        return new CounterCell(name, contextManager.createLocal(value, HeapAllocator.instance), timestamp, timestampOfLastDelete);
+        return new CounterCell(name, contextManager.createLocal(value), timestamp, timestampOfLastDelete);
     }
 
     @Override
@@ -142,7 +141,7 @@ public class CounterCell extends Cell
     }
 
     @Override
-    public Cell reconcile(Cell cell, AbstractAllocator allocator)
+    public Cell reconcile(Cell cell)
     {
         // live + tombstone: track last tombstone
         if (cell.isMarkedForDelete(Long.MIN_VALUE)) // cannot be an expired cell, so the current time is irrelevant
@@ -171,7 +170,7 @@ public class CounterCell extends Cell
             return this;
         // live + live: merge clocks; update value
         return new CounterCell(name(),
-                               contextManager.merge(value(), cell.value(), allocator),
+                               contextManager.merge(value(), cell.value()),
                                Math.max(timestamp(), cell.timestamp()),
                                Math.max(timestampOfLastDelete(), ((CounterCell) cell).timestampOfLastDelete()));
     }
@@ -190,7 +189,7 @@ public class CounterCell extends Cell
     }
 
     @Override
-    public Cell localCopy(ColumnFamilyStore cfs, AbstractAllocator allocator)
+    public Cell localCopy(AbstractAllocator allocator)
     {
         return new CounterCell(name.copy(allocator), allocator.clone(value), timestamp, timestampOfLastDelete);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/CounterMutation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CounterMutation.java b/src/java/org/apache/cassandra/db/CounterMutation.java
index 031c001..dfc7a4a 100644
--- a/src/java/org/apache/cassandra/db/CounterMutation.java
+++ b/src/java/org/apache/cassandra/db/CounterMutation.java
@@ -154,7 +154,7 @@ public class CounterMutation implements IMutation
             if (cell instanceof CounterUpdateCell)
                 counterUpdateCells.add((CounterUpdateCell)cell);
             else
-                resultCF.addColumn(cell.localCopy(cfs, allocator));
+                resultCF.addColumn(cell.localCopy(allocator));
         }
 
         if (counterUpdateCells.isEmpty())
@@ -170,7 +170,7 @@ public class CounterMutation implements IMutation
             long count = currentValue.count + update.delta();
 
             resultCF.addColumn(new CounterCell(update.name().copy(allocator),
-                                               CounterContext.instance().createGlobal(CounterId.getLocalId(), clock, count, allocator),
+                                               CounterContext.instance().createGlobal(CounterId.getLocalId(), clock, count),
                                                update.timestamp()));
         }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/CounterUpdateCell.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/CounterUpdateCell.java b/src/java/org/apache/cassandra/db/CounterUpdateCell.java
index b7ca2cb..27d5270 100644
--- a/src/java/org/apache/cassandra/db/CounterUpdateCell.java
+++ b/src/java/org/apache/cassandra/db/CounterUpdateCell.java
@@ -56,7 +56,7 @@ public class CounterUpdateCell extends Cell
     }
 
     @Override
-    public Cell reconcile(Cell cell, AbstractAllocator allocator)
+    public Cell reconcile(Cell cell)
     {
         // The only time this could happen is if a batchAdd ships two
         // increment for the same cell. Hence we simply sums the delta.
@@ -78,7 +78,7 @@ public class CounterUpdateCell extends Cell
     }
 
     @Override
-    public Cell localCopy(ColumnFamilyStore cfs, AbstractAllocator allocator)
+    public Cell localCopy(AbstractAllocator allocator)
     {
         throw new UnsupportedOperationException();
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/DeletedCell.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DeletedCell.java b/src/java/org/apache/cassandra/db/DeletedCell.java
index 3701ab2..00788f8 100644
--- a/src/java/org/apache/cassandra/db/DeletedCell.java
+++ b/src/java/org/apache/cassandra/db/DeletedCell.java
@@ -89,15 +89,15 @@ public class DeletedCell extends Cell
     }
 
     @Override
-    public Cell reconcile(Cell cell, AbstractAllocator allocator)
+    public Cell reconcile(Cell cell)
     {
         if (cell instanceof DeletedCell)
-            return super.reconcile(cell, allocator);
-        return cell.reconcile(this, allocator);
+            return super.reconcile(cell);
+        return cell.reconcile(this);
     }
 
     @Override
-    public Cell localCopy(ColumnFamilyStore cfs, AbstractAllocator allocator)
+    public Cell localCopy(AbstractAllocator allocator)
     {
         return new DeletedCell(name.copy(allocator), allocator.clone(value), timestamp);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/DeletionTime.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/DeletionTime.java b/src/java/org/apache/cassandra/db/DeletionTime.java
index 2bfd0fd..e3e18f1 100644
--- a/src/java/org/apache/cassandra/db/DeletionTime.java
+++ b/src/java/org/apache/cassandra/db/DeletionTime.java
@@ -105,7 +105,7 @@ public class DeletionTime implements Comparable<DeletionTime>, IMeasurableMemory
 
     public boolean isDeleted(OnDiskAtom atom)
     {
-        return atom.maxTimestamp() <= markedForDeleteAt;
+        return atom.timestamp() <= markedForDeleteAt;
     }
 
     public long unsharedHeapSize()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/ExpiringCell.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ExpiringCell.java b/src/java/org/apache/cassandra/db/ExpiringCell.java
index 4e26c9e..57fac5b 100644
--- a/src/java/org/apache/cassandra/db/ExpiringCell.java
+++ b/src/java/org/apache/cassandra/db/ExpiringCell.java
@@ -132,7 +132,7 @@ public class ExpiringCell extends Cell
     }
 
     @Override
-    public Cell localCopy(ColumnFamilyStore cfs, AbstractAllocator allocator)
+    public Cell localCopy(AbstractAllocator allocator)
     {
         return new ExpiringCell(name.copy(allocator), allocator.clone(value), timestamp, timeToLive, localExpirationTime);
     }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/HintedHandOffManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/HintedHandOffManager.java b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
index a9a6fcf..12404da 100644
--- a/src/java/org/apache/cassandra/db/HintedHandOffManager.java
+++ b/src/java/org/apache/cassandra/db/HintedHandOffManager.java
@@ -419,7 +419,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
                 catch (UnknownColumnFamilyException e)
                 {
                     logger.debug("Skipping delivery of hint for deleted columnfamily", e);
-                    deleteHint(hostIdBytes, hint.name(), hint.maxTimestamp());
+                    deleteHint(hostIdBytes, hint.name(), hint.timestamp());
                     continue;
                 }
                 catch (IOException e)
@@ -438,7 +438,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
                         truncationTimesCache.put(cfId, truncatedAt);
                     }
 
-                    if (hint.maxTimestamp() < truncatedAt)
+                    if (hint.timestamp() < truncatedAt)
                     {
                         logger.debug("Skipping delivery of hint for truncated columnfamily {}", cfId);
                         mutation = mutation.without(cfId);
@@ -447,7 +447,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
 
                 if (mutation.isEmpty())
                 {
-                    deleteHint(hostIdBytes, hint.name(), hint.maxTimestamp());
+                    deleteHint(hostIdBytes, hint.name(), hint.timestamp());
                     continue;
                 }
 
@@ -458,7 +458,7 @@ public class HintedHandOffManager implements HintedHandOffManagerMBean
                     public void run()
                     {
                         rowsReplayed.incrementAndGet();
-                        deleteHint(hostIdBytes, hint.name(), hint.maxTimestamp());
+                        deleteHint(hostIdBytes, hint.name(), hint.timestamp());
                     }
                 };
                 WriteResponseHandler responseHandler = new WriteResponseHandler(endpoint, WriteType.UNLOGGED_BATCH, callback);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/Memtable.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Memtable.java b/src/java/org/apache/cassandra/db/Memtable.java
index 246639e..1308fe9 100644
--- a/src/java/org/apache/cassandra/db/Memtable.java
+++ b/src/java/org/apache/cassandra/db/Memtable.java
@@ -191,8 +191,8 @@ public class Memtable
             }
         }
 
-        ContextAllocator contextAllocator = allocator.wrap(opGroup, cfs);
-        AtomicBTreeColumns.Delta delta = previous.addAllWithSizeDelta(cf, contextAllocator, contextAllocator, indexer, new AtomicBTreeColumns.Delta());
+        ContextAllocator contextAllocator = allocator.wrap(opGroup);
+        AtomicBTreeColumns.Delta delta = previous.addAllWithSizeDelta(cf, contextAllocator, indexer, new AtomicBTreeColumns.Delta());
         liveDataSize.addAndGet(delta.dataSize());
         currentOperations.addAndGet(cf.getColumnCount() + (cf.isMarkedForDelete() ? 1 : 0) + cf.deletionInfo().rangeCount());
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/OnDiskAtom.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/OnDiskAtom.java b/src/java/org/apache/cassandra/db/OnDiskAtom.java
index d3c96fd..b53e43b 100644
--- a/src/java/org/apache/cassandra/db/OnDiskAtom.java
+++ b/src/java/org/apache/cassandra/db/OnDiskAtom.java
@@ -37,8 +37,7 @@ public interface OnDiskAtom
      * For a standard column, this is the same as timestamp().
      * For a super column, this is the min/max column timestamp of the sub columns.
      */
-    public long minTimestamp();
-    public long maxTimestamp();
+    public long timestamp();
     public int getLocalDeletionTime(); // for tombstone GC, so int is sufficient granularity
 
     public void validateFields(CFMetaData metadata) throws MarshalException;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/RangeTombstone.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/RangeTombstone.java b/src/java/org/apache/cassandra/db/RangeTombstone.java
index c865b06..ffae7ba 100644
--- a/src/java/org/apache/cassandra/db/RangeTombstone.java
+++ b/src/java/org/apache/cassandra/db/RangeTombstone.java
@@ -55,12 +55,7 @@ public class RangeTombstone extends Interval<Composite, DeletionTime> implements
         return data.localDeletionTime;
     }
 
-    public long minTimestamp()
-    {
-        return data.markedForDeleteAt;
-    }
-
-    public long maxTimestamp()
+    public long timestamp()
     {
         return data.markedForDeleteAt;
     }
@@ -233,7 +228,7 @@ public class RangeTombstone extends Interval<Composite, DeletionTime> implements
             {
                 if (comparator.compare(cell.name(), tombstone.min) >= 0
                     && comparator.compare(cell.name(), tombstone.max) <= 0
-                    && tombstone.maxTimestamp() >= cell.timestamp())
+                    && tombstone.timestamp() >= cell.timestamp())
                 {
                     return true;
                 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
index fbad212..12a9308 100644
--- a/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
+++ b/src/java/org/apache/cassandra/db/compaction/LazilyCompactedRow.java
@@ -211,7 +211,7 @@ public class LazilyCompactedRow extends AbstractCompactedRow
         {
             if (current instanceof RangeTombstone)
             {
-                if (tombstone == null || current.maxTimestamp() >= tombstone.maxTimestamp())
+                if (tombstone == null || current.timestamp() >= tombstone.timestamp())
                     tombstone = (RangeTombstone)current;
             }
             else
@@ -285,8 +285,8 @@ public class LazilyCompactedRow extends AbstractCompactedRow
                 }
 
                 columns++;
-                minTimestampSeen = Math.min(minTimestampSeen, reduced.minTimestamp());
-                maxTimestampSeen = Math.max(maxTimestampSeen, reduced.maxTimestamp());
+                minTimestampSeen = Math.min(minTimestampSeen, reduced.timestamp());
+                maxTimestampSeen = Math.max(maxTimestampSeen, reduced.timestamp());
                 maxLocalDeletionTimeSeen = Math.max(maxLocalDeletionTimeSeen, reduced.getLocalDeletionTime());
                 minColumnNameSeen = ColumnNameHelper.minComponents(minColumnNameSeen, reduced.name(), controller.cfs.metadata.comparator);
                 maxColumnNameSeen = ColumnNameHelper.maxComponents(maxColumnNameSeen, reduced.name(), controller.cfs.metadata.comparator);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/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 9da636c..1e830a6 100644
--- a/src/java/org/apache/cassandra/db/context/CounterContext.java
+++ b/src/java/org/apache/cassandra/db/context/CounterContext.java
@@ -23,7 +23,6 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.cassandra.serializers.MarshalException;
-import org.apache.cassandra.utils.memory.AbstractAllocator;
 import com.google.common.annotations.VisibleForTesting;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -103,9 +102,9 @@ public class CounterContext
     /**
      * Creates a counter context with a single global, 2.1+ shard (a result of increment).
      */
-    public ByteBuffer createGlobal(CounterId id, long clock, long count, AbstractAllocator allocator)
+    public ByteBuffer createGlobal(CounterId id, long clock, long count)
     {
-        ContextState state = ContextState.allocate(1, 0, 0, allocator);
+        ContextState state = ContextState.allocate(1, 0, 0);
         state.writeGlobal(id, clock, count);
         return state.context;
     }
@@ -114,9 +113,9 @@ public class CounterContext
      * Creates a counter context with a single local shard.
      * For use by tests of compatibility with pre-2.1 counters only.
      */
-    public ByteBuffer createLocal(long count, AbstractAllocator allocator)
+    public ByteBuffer createLocal(long count)
     {
-        ContextState state = ContextState.allocate(0, 1, 0, allocator);
+        ContextState state = ContextState.allocate(0, 1, 0);
         state.writeLocal(CounterId.getLocalId(), 1L, count);
         return state.context;
     }
@@ -125,9 +124,9 @@ public class CounterContext
      * Creates a counter context with a single remote shard.
      * For use by tests of compatibility with pre-2.1 counters only.
      */
-    public ByteBuffer createRemote(CounterId id, long clock, long count, AbstractAllocator allocator)
+    public ByteBuffer createRemote(CounterId id, long clock, long count)
     {
-        ContextState state = ContextState.allocate(0, 0, 1, allocator);
+        ContextState state = ContextState.allocate(0, 0, 1);
         state.writeRemote(id, clock, count);
         return state.context;
     }
@@ -254,9 +253,8 @@ public class CounterContext
      *
      * @param left counter context.
      * @param right counter context.
-     * @param allocator An allocator for the merged value.
      */
-    public ByteBuffer merge(ByteBuffer left, ByteBuffer right, AbstractAllocator allocator)
+    public ByteBuffer merge(ByteBuffer left, ByteBuffer right)
     {
         int globalCount = 0;
         int localCount = 0;
@@ -331,7 +329,7 @@ public class CounterContext
         leftState.reset();
         rightState.reset();
 
-        return merge(ContextState.allocate(globalCount, localCount, remoteCount, allocator), leftState, rightState);
+        return merge(ContextState.allocate(globalCount, localCount, remoteCount), leftState, rightState);
     }
 
     private ByteBuffer merge(ContextState mergedState, ContextState leftState, ContextState rightState)
@@ -700,12 +698,12 @@ public class CounterContext
          * Allocate a new context big enough for globalCount + localCount + remoteCount elements
          * and return the initial corresponding ContextState.
          */
-        public static ContextState allocate(int globalCount, int localCount, int remoteCount, AbstractAllocator allocator)
+        public static ContextState allocate(int globalCount, int localCount, int remoteCount)
         {
             int headerLength = HEADER_SIZE_LENGTH + (globalCount + localCount) * HEADER_ELT_LENGTH;
             int bodyLength = (globalCount + localCount + remoteCount) * STEP_LENGTH;
 
-            ByteBuffer buffer = allocator.allocate(headerLength + bodyLength);
+            ByteBuffer buffer = ByteBuffer.allocate(headerLength + bodyLength);
             buffer.putShort(buffer.position(), (short) (globalCount + localCount));
 
             return ContextState.wrap(buffer);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/db/filter/QueryFilter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/filter/QueryFilter.java b/src/java/org/apache/cassandra/db/filter/QueryFilter.java
index 9c3cc49..6435043 100644
--- a/src/java/org/apache/cassandra/db/filter/QueryFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/QueryFilter.java
@@ -26,7 +26,6 @@ import org.apache.cassandra.db.composites.CellName;
 import org.apache.cassandra.db.composites.Composite;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.io.util.FileDataInput;
-import org.apache.cassandra.utils.memory.HeapAllocator;
 import org.apache.cassandra.utils.MergeIterator;
 
 public class QueryFilter
@@ -107,7 +106,7 @@ public class QueryFilter
             public void reduce(Cell next)
             {
                 assert current == null || fcomp.compare(current, next) == 0;
-                current = current == null ? next : current.reconcile(next, HeapAllocator.instance);
+                current = current == null ? next : current.reconcile(next);
             }
 
             protected Cell getReduced()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/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 fc37915..5d20652 100644
--- a/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/AbstractSSTableSimpleWriter.java
@@ -33,7 +33,6 @@ import org.apache.cassandra.io.sstable.metadata.MetadataCollector;
 import org.apache.cassandra.service.ActiveRepairService;
 import org.apache.cassandra.utils.CounterId;
 import org.apache.cassandra.utils.Pair;
-import org.apache.cassandra.utils.memory.HeapAllocator;
 
 public abstract class AbstractSSTableSimpleWriter
 {
@@ -158,7 +157,7 @@ public abstract class AbstractSSTableSimpleWriter
     public void addCounterColumn(ByteBuffer name, long value)
     {
         addColumn(new CounterCell(metadata.comparator.cellFromByteBuffer(name),
-                                  CounterContext.instance().createGlobal(counterid, 1L, value, HeapAllocator.instance),
+                                  CounterContext.instance().createGlobal(counterid, 1L, value),
                                   System.currentTimeMillis()));
     }
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
index 1495304..173bba8 100644
--- a/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
+++ b/src/java/org/apache/cassandra/io/sstable/SSTableWriter.java
@@ -270,8 +270,8 @@ public class SSTableWriter extends SSTable
                 {
                     tombstones.update(deletionTime);
                 }
-                minTimestamp = Math.min(minTimestamp, atom.minTimestamp());
-                maxTimestamp = Math.max(maxTimestamp, atom.maxTimestamp());
+                minTimestamp = Math.min(minTimestamp, atom.timestamp());
+                maxTimestamp = Math.max(maxTimestamp, atom.timestamp());
                 minColumnNames = ColumnNameHelper.minComponents(minColumnNames, atom.name(), metadata.comparator);
                 maxColumnNames = ColumnNameHelper.maxComponents(maxColumnNames, atom.name(), metadata.comparator);
                 maxLocalDeletionTime = Math.max(maxLocalDeletionTime, atom.getLocalDeletionTime());

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/utils/memory/ContextAllocator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/memory/ContextAllocator.java b/src/java/org/apache/cassandra/utils/memory/ContextAllocator.java
index ba5da9a..a09fbe2 100644
--- a/src/java/org/apache/cassandra/utils/memory/ContextAllocator.java
+++ b/src/java/org/apache/cassandra/utils/memory/ContextAllocator.java
@@ -18,12 +18,11 @@
  */
 package org.apache.cassandra.utils.memory;
 
+import java.nio.ByteBuffer;
+
 import com.google.common.base.*;
 import org.apache.cassandra.db.Cell;
 import org.apache.cassandra.utils.concurrent.OpOrder;
-import org.apache.cassandra.db.ColumnFamilyStore;
-
-import java.nio.ByteBuffer;
 
 /**
  * Wraps calls to a PoolAllocator with the provided writeOp. Also doubles as a Function that clones Cells
@@ -33,13 +32,11 @@ public final class ContextAllocator extends AbstractAllocator implements Functio
 {
     private final OpOrder.Group opGroup;
     private final PoolAllocator allocator;
-    private final ColumnFamilyStore cfs;
 
-    public ContextAllocator(OpOrder.Group opGroup, PoolAllocator allocator, ColumnFamilyStore cfs)
+    public ContextAllocator(OpOrder.Group opGroup, PoolAllocator allocator)
     {
         this.opGroup = opGroup;
         this.allocator = allocator;
-        this.cfs = cfs;
     }
 
     @Override
@@ -55,7 +52,7 @@ public final class ContextAllocator extends AbstractAllocator implements Functio
 
     public Cell apply(Cell column)
     {
-        return column.localCopy(cfs, this);
+        return column.localCopy(this);
     }
 
     public long owns()

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/src/java/org/apache/cassandra/utils/memory/PoolAllocator.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/memory/PoolAllocator.java b/src/java/org/apache/cassandra/utils/memory/PoolAllocator.java
index b30c484..289d0ac 100644
--- a/src/java/org/apache/cassandra/utils/memory/PoolAllocator.java
+++ b/src/java/org/apache/cassandra/utils/memory/PoolAllocator.java
@@ -17,14 +17,13 @@
  */
 package org.apache.cassandra.utils.memory;
 
+import java.nio.ByteBuffer;
+import java.util.concurrent.atomic.AtomicLong;
+
 import org.apache.cassandra.utils.concurrent.OpOrder;
-import org.apache.cassandra.db.ColumnFamilyStore;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.concurrent.WaitQueue;
 
-import java.nio.ByteBuffer;
-import java.util.concurrent.atomic.AtomicLong;
-
 public abstract class PoolAllocator<P extends Pool> extends AbstractAllocator
 {
     public final P pool;
@@ -150,9 +149,9 @@ public abstract class PoolAllocator<P extends Pool> extends AbstractAllocator
         return cloned;
     }
 
-    public ContextAllocator wrap(OpOrder.Group opGroup, ColumnFamilyStore cfs)
+    public ContextAllocator wrap(OpOrder.Group opGroup)
     {
-        return new ContextAllocator(opGroup, this, cfs);
+        return new ContextAllocator(opGroup, this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/test/unit/org/apache/cassandra/db/CounterCellTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CounterCellTest.java b/test/unit/org/apache/cassandra/db/CounterCellTest.java
index 16b28d3..86b856c 100644
--- a/test/unit/org/apache/cassandra/db/CounterCellTest.java
+++ b/test/unit/org/apache/cassandra/db/CounterCellTest.java
@@ -26,8 +26,6 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
 
-import org.apache.cassandra.utils.memory.AbstractAllocator;
-import org.apache.cassandra.utils.memory.HeapAllocator;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -67,7 +65,7 @@ public class CounterCellTest extends SchemaLoader
     {
         long delta = 3L;
         CounterCell cell = new CounterCell(Util.cellname("x"),
-                                           CounterContext.instance().createLocal(delta, HeapAllocator.instance),
+                                           CounterContext.instance().createLocal(delta),
                                            1L,
                                            Long.MIN_VALUE);
 
@@ -88,8 +86,6 @@ public class CounterCellTest extends SchemaLoader
 
         ByteBuffer context;
 
-        AbstractAllocator allocator = HeapAllocator.instance;
-
         // tombstone + tombstone
         left  = new DeletedCell(cellname("x"), 1, 1L);
         right = new DeletedCell(cellname("x"), 2, 2L);
@@ -154,20 +150,20 @@ public class CounterCellTest extends SchemaLoader
         assert ((CounterCell)reconciled).timestampOfLastDelete() == right.getMarkedForDeleteAt();
 
         // live < live last delete
-        left  = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 2L, 3L, allocator), 1L, Long.MIN_VALUE);
-        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 1L, 1L, allocator), 4L, 3L);
+        left  = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 2L, 3L), 1L, Long.MIN_VALUE);
+        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 1L, 1L), 4L, 3L);
 
         assert left.reconcile(right) == right;
 
         // live last delete > live
-        left  = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 2L, 3L, allocator), 6L, 5L);
-        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 1L, 1L, allocator), 4L, 3L);
+        left  = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 2L, 3L), 6L, 5L);
+        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 1L, 1L), 4L, 3L);
 
         assert left.reconcile(right) == left;
 
         // live + live
-        left = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 1L, 1L, allocator), 4L, Long.MIN_VALUE);
-        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 2L, 3L, allocator), 1L, Long.MIN_VALUE);
+        left = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 1L, 1L), 4L, Long.MIN_VALUE);
+        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(1), 2L, 3L), 1L, Long.MIN_VALUE);
 
         reconciled = left.reconcile(right);
         assert reconciled.name().equals(left.name());
@@ -175,7 +171,7 @@ public class CounterCellTest extends SchemaLoader
         assert reconciled.timestamp() == 4L;
 
         left = reconciled;
-        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(2), 1L, 5L, allocator), 2L, Long.MIN_VALUE);
+        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(2), 1L, 5L), 2L, Long.MIN_VALUE);
 
         reconciled = left.reconcile(right);
         assert reconciled.name().equals(left.name());
@@ -183,7 +179,7 @@ public class CounterCellTest extends SchemaLoader
         assert reconciled.timestamp() == 4L;
 
         left = reconciled;
-        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(2), 2L, 2L, allocator), 6L, Long.MIN_VALUE);
+        right = new CounterCell(cellname("x"), cc.createRemote(CounterId.fromInt(2), 2L, 2L), 6L, Long.MIN_VALUE);
 
         reconciled = left.reconcile(right);
         assert reconciled.name().equals(left.name());
@@ -208,7 +204,6 @@ public class CounterCellTest extends SchemaLoader
     @Test
     public void testDiff()
     {
-        AbstractAllocator allocator = HeapAllocator.instance;
         ContextState left;
         ContextState right;
 
@@ -230,7 +225,7 @@ public class CounterCellTest extends SchemaLoader
         assert null      == rightCell.diff(leftCell);
 
         // equality: equal nodes, all counts same
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 3L, 0L);
         left.writeRemote(CounterId.fromInt(6), 2L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
@@ -241,13 +236,13 @@ public class CounterCellTest extends SchemaLoader
         assert leftCell.diff(rightCell) == null;
 
         // greater than: left has superset of nodes (counts equal)
-        left = ContextState.allocate(0, 0, 4, allocator);
+        left = ContextState.allocate(0, 0, 4);
         left.writeRemote(CounterId.fromInt(3), 3L, 0L);
         left.writeRemote(CounterId.fromInt(6), 2L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
         left.writeRemote(CounterId.fromInt(12), 0L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 3L, 0L);
         right.writeRemote(CounterId.fromInt(6), 2L, 0L);
         right.writeRemote(CounterId.fromInt(9), 1L, 0L);
@@ -260,12 +255,12 @@ public class CounterCellTest extends SchemaLoader
         assert leftCell == rightCell.diff(leftCell);
 
         // disjoint: right and left have disjoint node sets
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 1L, 0L);
         left.writeRemote(CounterId.fromInt(4), 1L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 1L, 0L);
         right.writeRemote(CounterId.fromInt(6), 1L, 0L);
         right.writeRemote(CounterId.fromInt(9), 1L, 0L);
@@ -279,8 +274,7 @@ public class CounterCellTest extends SchemaLoader
     @Test
     public void testSerializeDeserialize() throws IOException
     {
-        AbstractAllocator allocator = HeapAllocator.instance;
-        CounterContext.ContextState state = CounterContext.ContextState.allocate(0, 2, 2, allocator);
+        CounterContext.ContextState state = CounterContext.ContextState.allocate(0, 2, 2);
         state.writeRemote(CounterId.fromInt(1), 4L, 4L);
         state.writeLocal(CounterId.fromInt(2), 4L, 4L);
         state.writeRemote(CounterId.fromInt(3), 4L, 4L);
@@ -312,11 +306,10 @@ public class CounterCellTest extends SchemaLoader
     @Test
     public void testUpdateDigest() throws Exception
     {
-        AbstractAllocator allocator = HeapAllocator.instance;
         MessageDigest digest1 = MessageDigest.getInstance("md5");
         MessageDigest digest2 = MessageDigest.getInstance("md5");
 
-        CounterContext.ContextState state = CounterContext.ContextState.allocate(0, 2, 2, allocator);
+        CounterContext.ContextState state = CounterContext.ContextState.allocate(0, 2, 2);
         state.writeRemote(CounterId.fromInt(1), 4L, 4L);
         state.writeLocal(CounterId.fromInt(2), 4L, 4L);
         state.writeRemote(CounterId.fromInt(3), 4L, 4L);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/test/unit/org/apache/cassandra/db/context/CounterContextTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/context/CounterContextTest.java b/test/unit/org/apache/cassandra/db/context/CounterContextTest.java
index fd491d5..55d5b7c 100644
--- a/test/unit/org/apache/cassandra/db/context/CounterContextTest.java
+++ b/test/unit/org/apache/cassandra/db/context/CounterContextTest.java
@@ -30,11 +30,6 @@ import org.apache.cassandra.db.ClockAndCount;
 import org.apache.cassandra.db.context.CounterContext.Relationship;
 import org.apache.cassandra.Util;
 import org.apache.cassandra.utils.*;
-import org.apache.cassandra.utils.concurrent.OpOrder;
-import org.apache.cassandra.utils.memory.AbstractAllocator;
-import org.apache.cassandra.utils.memory.HeapAllocator;
-import org.apache.cassandra.utils.memory.HeapPool;
-import org.apache.cassandra.utils.memory.Pool;
 
 import static org.apache.cassandra.db.context.CounterContext.ContextState;
 
@@ -49,52 +44,30 @@ public class CounterContextTest
     private static final int countLength = 8;
     private static final int stepLength = idLength + clockLength + countLength;
 
-    private static final Pool POOL = new HeapPool(Integer.MAX_VALUE, 1f, null);
-
-    /** Allocates 1 byte from a new SlabAllocator and returns it. */
-    private AbstractAllocator bumpedSlab()
-    {
-        AbstractAllocator allocator = POOL.newAllocator(new OpOrder());
-        allocator.allocate(1);
-        return allocator;
-    }
-
     @Test
     public void testAllocate()
     {
-        runAllocate(HeapAllocator.instance);
-        runAllocate(bumpedSlab());
-    }
-
-    private void runAllocate(AbstractAllocator allocator)
-    {
-        ContextState allGlobal = ContextState.allocate(3, 0, 0, allocator);
+        ContextState allGlobal = ContextState.allocate(3, 0, 0);
         assertEquals(headerSizeLength + 3 * headerEltLength + 3 * stepLength, allGlobal.context.remaining());
 
-        ContextState allLocal = ContextState.allocate(0, 3, 0, allocator);
+        ContextState allLocal = ContextState.allocate(0, 3, 0);
         assertEquals(headerSizeLength + 3 * headerEltLength + 3 * stepLength, allLocal.context.remaining());
 
-        ContextState allRemote = ContextState.allocate(0, 0, 3, allocator);
+        ContextState allRemote = ContextState.allocate(0, 0, 3);
         assertEquals(headerSizeLength + 3 * stepLength, allRemote.context.remaining());
 
-        ContextState mixed = ContextState.allocate(1, 1, 1, allocator);
+        ContextState mixed = ContextState.allocate(1, 1, 1);
         assertEquals(headerSizeLength + 2 * headerEltLength + 3 * stepLength, mixed.context.remaining());
     }
 
     @Test
     public void testDiff()
     {
-        runDiff(HeapAllocator.instance);
-        runDiff(bumpedSlab());
-    }
-
-    private void runDiff(AbstractAllocator allocator)
-    {
         ContextState left;
         ContextState right;
 
         // equality: equal nodes, all counts same
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 3L, 0L);
         left.writeRemote(CounterId.fromInt(6), 2L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
@@ -103,13 +76,13 @@ public class CounterContextTest
         assertEquals(Relationship.EQUAL, cc.diff(left.context, right.context));
 
         // greater than: left has superset of nodes (counts equal)
-        left = ContextState.allocate(0, 0, 4, allocator);
+        left = ContextState.allocate(0, 0, 4);
         left.writeRemote(CounterId.fromInt(3),  3L, 0L);
         left.writeRemote(CounterId.fromInt(6),  2L, 0L);
         left.writeRemote(CounterId.fromInt(9),  1L, 0L);
         left.writeRemote(CounterId.fromInt(12), 0L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 3L, 0L);
         right.writeRemote(CounterId.fromInt(6), 2L, 0L);
         right.writeRemote(CounterId.fromInt(9), 1L, 0L);
@@ -117,12 +90,12 @@ public class CounterContextTest
         assertEquals(Relationship.GREATER_THAN, cc.diff(left.context, right.context));
 
         // less than: left has subset of nodes (counts equal)
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 3L, 0L);
         left.writeRemote(CounterId.fromInt(6), 2L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
 
-        right = ContextState.allocate(0, 0, 4, allocator);
+        right = ContextState.allocate(0, 0, 4);
         right.writeRemote(CounterId.fromInt(3),  3L, 0L);
         right.writeRemote(CounterId.fromInt(6),  2L, 0L);
         right.writeRemote(CounterId.fromInt(9),  1L, 0L);
@@ -131,12 +104,12 @@ public class CounterContextTest
         assertEquals(Relationship.LESS_THAN, cc.diff(left.context, right.context));
 
         // greater than: equal nodes, but left has higher counts
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 3L, 0L);
         left.writeRemote(CounterId.fromInt(6), 2L, 0L);
         left.writeRemote(CounterId.fromInt(9), 3L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 3L, 0L);
         right.writeRemote(CounterId.fromInt(6), 2L, 0L);
         right.writeRemote(CounterId.fromInt(9), 1L, 0L);
@@ -144,12 +117,12 @@ public class CounterContextTest
         assertEquals(Relationship.GREATER_THAN, cc.diff(left.context, right.context));
 
         // less than: equal nodes, but right has higher counts
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 3L, 0L);
         left.writeRemote(CounterId.fromInt(6), 2L, 0L);
         left.writeRemote(CounterId.fromInt(9), 3L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 3L, 0L);
         right.writeRemote(CounterId.fromInt(6), 9L, 0L);
         right.writeRemote(CounterId.fromInt(9), 3L, 0L);
@@ -157,24 +130,24 @@ public class CounterContextTest
         assertEquals(Relationship.LESS_THAN, cc.diff(left.context, right.context));
 
         // disjoint: right and left have disjoint node sets
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 1L, 0L);
         left.writeRemote(CounterId.fromInt(4), 1L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 1L, 0L);
         right.writeRemote(CounterId.fromInt(6), 1L, 0L);
         right.writeRemote(CounterId.fromInt(9), 1L, 0L);
 
         assertEquals(Relationship.DISJOINT, cc.diff(left.context, right.context));
 
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 1L, 0L);
         left.writeRemote(CounterId.fromInt(4), 1L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(2),  1L, 0L);
         right.writeRemote(CounterId.fromInt(6),  1L, 0L);
         right.writeRemote(CounterId.fromInt(12), 1L, 0L);
@@ -182,24 +155,24 @@ public class CounterContextTest
         assertEquals(Relationship.DISJOINT, cc.diff(left.context, right.context));
 
         // disjoint: equal nodes, but right and left have higher counts in differing nodes
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 1L, 0L);
         left.writeRemote(CounterId.fromInt(6), 3L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 1L, 0L);
         right.writeRemote(CounterId.fromInt(6), 1L, 0L);
         right.writeRemote(CounterId.fromInt(9), 5L, 0L);
 
         assertEquals(Relationship.DISJOINT, cc.diff(left.context, right.context));
 
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 2L, 0L);
         left.writeRemote(CounterId.fromInt(6), 3L, 0L);
         left.writeRemote(CounterId.fromInt(9), 1L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 1L, 0L);
         right.writeRemote(CounterId.fromInt(6), 9L, 0L);
         right.writeRemote(CounterId.fromInt(9), 5L, 0L);
@@ -207,13 +180,13 @@ public class CounterContextTest
         assertEquals(Relationship.DISJOINT, cc.diff(left.context, right.context));
 
         // disjoint: left has more nodes, but lower counts
-        left = ContextState.allocate(0, 0, 4, allocator);
+        left = ContextState.allocate(0, 0, 4);
         left.writeRemote(CounterId.fromInt(3),  2L, 0L);
         left.writeRemote(CounterId.fromInt(6),  3L, 0L);
         left.writeRemote(CounterId.fromInt(9),  1L, 0L);
         left.writeRemote(CounterId.fromInt(12), 1L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 4L, 0L);
         right.writeRemote(CounterId.fromInt(6), 9L, 0L);
         right.writeRemote(CounterId.fromInt(9), 5L, 0L);
@@ -221,12 +194,12 @@ public class CounterContextTest
         assertEquals(Relationship.DISJOINT, cc.diff(left.context, right.context));
 
         // disjoint: left has less nodes, but higher counts
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 5L, 0L);
         left.writeRemote(CounterId.fromInt(6), 3L, 0L);
         left.writeRemote(CounterId.fromInt(9), 2L, 0L);
 
-        right = ContextState.allocate(0, 0, 4, allocator);
+        right = ContextState.allocate(0, 0, 4);
         right.writeRemote(CounterId.fromInt(3),  4L, 0L);
         right.writeRemote(CounterId.fromInt(6),  3L, 0L);
         right.writeRemote(CounterId.fromInt(9),  2L, 0L);
@@ -235,12 +208,12 @@ public class CounterContextTest
         assertEquals(Relationship.DISJOINT, cc.diff(left.context, right.context));
 
         // disjoint: mixed nodes and counts
-        left = ContextState.allocate(0, 0, 3, allocator);
+        left = ContextState.allocate(0, 0, 3);
         left.writeRemote(CounterId.fromInt(3), 5L, 0L);
         left.writeRemote(CounterId.fromInt(6), 2L, 0L);
         left.writeRemote(CounterId.fromInt(9), 2L, 0L);
 
-        right = ContextState.allocate(0, 0, 4, allocator);
+        right = ContextState.allocate(0, 0, 4);
         right.writeRemote(CounterId.fromInt(3),  4L, 0L);
         right.writeRemote(CounterId.fromInt(6),  3L, 0L);
         right.writeRemote(CounterId.fromInt(9),  2L, 0L);
@@ -248,13 +221,13 @@ public class CounterContextTest
 
         assertEquals(Relationship.DISJOINT, cc.diff(left.context, right.context));
 
-        left = ContextState.allocate(0, 0, 4, allocator);
+        left = ContextState.allocate(0, 0, 4);
         left.writeRemote(CounterId.fromInt(3), 5L, 0L);
         left.writeRemote(CounterId.fromInt(6), 2L, 0L);
         left.writeRemote(CounterId.fromInt(7), 2L, 0L);
         left.writeRemote(CounterId.fromInt(9), 2L, 0L);
 
-        right = ContextState.allocate(0, 0, 3, allocator);
+        right = ContextState.allocate(0, 0, 3);
         right.writeRemote(CounterId.fromInt(3), 4L, 0L);
         right.writeRemote(CounterId.fromInt(6), 3L, 0L);
         right.writeRemote(CounterId.fromInt(9), 2L, 0L);
@@ -265,25 +238,19 @@ public class CounterContextTest
     @Test
     public void testMerge()
     {
-        runMerge(HeapAllocator.instance);
-        runMerge(bumpedSlab());
-    }
-
-    private void runMerge(AbstractAllocator allocator)
-    {
         // note: local counts aggregated; remote counts are reconciled (i.e. take max)
-        ContextState left = ContextState.allocate(0, 1, 3, allocator);
+        ContextState left = ContextState.allocate(0, 1, 3);
         left.writeRemote(CounterId.fromInt(1), 1L, 1L);
         left.writeRemote(CounterId.fromInt(2), 2L, 2L);
         left.writeRemote(CounterId.fromInt(4), 6L, 3L);
         left.writeLocal(CounterId.getLocalId(), 7L, 3L);
 
-        ContextState right = ContextState.allocate(0, 1, 2, allocator);
+        ContextState right = ContextState.allocate(0, 1, 2);
         right.writeRemote(CounterId.fromInt(4), 4L, 4L);
         right.writeRemote(CounterId.fromInt(5), 5L, 5L);
         right.writeLocal(CounterId.getLocalId(), 2L, 9L);
 
-        ByteBuffer merged = cc.merge(left.context, right.context, allocator);
+        ByteBuffer merged = cc.merge(left.context, right.context);
         int hd = 4;
 
         assertEquals(hd + 5 * stepLength, merged.remaining());
@@ -312,17 +279,17 @@ public class CounterContextTest
         //
         // Test merging two exclusively global contexts
         //
-        left = ContextState.allocate(3, 0, 0, allocator);
+        left = ContextState.allocate(3, 0, 0);
         left.writeGlobal(CounterId.fromInt(1), 1L, 1L);
         left.writeGlobal(CounterId.fromInt(2), 2L, 2L);
         left.writeGlobal(CounterId.fromInt(3), 3L, 3L);
 
-        right = ContextState.allocate(3, 0, 0, allocator);
+        right = ContextState.allocate(3, 0, 0);
         right.writeGlobal(CounterId.fromInt(3), 6L, 6L);
         right.writeGlobal(CounterId.fromInt(4), 4L, 4L);
         right.writeGlobal(CounterId.fromInt(5), 5L, 5L);
 
-        merged = cc.merge(left.context, right.context, allocator);
+        merged = cc.merge(left.context, right.context);
         assertEquals(headerSizeLength + 5 * headerEltLength + 5 * stepLength, merged.remaining());
         assertEquals(18L, cc.total(merged));
         assertEquals(5, merged.getShort(merged.position()));
@@ -348,13 +315,13 @@ public class CounterContextTest
         //
         // Test merging two global contexts w/ 'invalid shards'
         //
-        left = ContextState.allocate(1, 0, 0, allocator);
+        left = ContextState.allocate(1, 0, 0);
         left.writeGlobal(CounterId.fromInt(1), 10L, 20L);
 
-        right = ContextState.allocate(1, 0, 0, allocator);
+        right = ContextState.allocate(1, 0, 0);
         right.writeGlobal(CounterId.fromInt(1), 10L, 30L);
 
-        merged = cc.merge(left.context, right.context, allocator);
+        merged = cc.merge(left.context, right.context);
         headerLength = headerSizeLength + headerEltLength;
         assertEquals(headerLength + stepLength, merged.remaining());
         assertEquals(30L, cc.total(merged));
@@ -367,16 +334,16 @@ public class CounterContextTest
         //
         // Test merging global w/ mixed contexts
         //
-        left = ContextState.allocate(2, 0, 0, allocator);
+        left = ContextState.allocate(2, 0, 0);
         left.writeGlobal(CounterId.fromInt(1), 1L, 1L);
         left.writeGlobal(CounterId.fromInt(2), 1L, 1L);
 
-        right = ContextState.allocate(0, 1, 1, allocator);
+        right = ContextState.allocate(0, 1, 1);
         right.writeLocal(CounterId.fromInt(1), 100L, 100L);
         right.writeRemote(CounterId.fromInt(2), 100L, 100L);
 
         // global shards should dominate local/remote, even with lower clock and value
-        merged = cc.merge(left.context, right.context, allocator);
+        merged = cc.merge(left.context, right.context);
         headerLength = headerSizeLength + 2 * headerEltLength;
         assertEquals(headerLength + 2 * stepLength, merged.remaining());
         assertEquals(2L, cc.total(merged));
@@ -392,13 +359,7 @@ public class CounterContextTest
     @Test
     public void testTotal()
     {
-        runTotal(HeapAllocator.instance);
-        runTotal(bumpedSlab());
-    }
-
-    private void runTotal(AbstractAllocator allocator)
-    {
-        ContextState mixed = ContextState.allocate(0, 1, 4, allocator);
+        ContextState mixed = ContextState.allocate(0, 1, 4);
         mixed.writeRemote(CounterId.fromInt(1), 1L, 1L);
         mixed.writeRemote(CounterId.fromInt(2), 2L, 2L);
         mixed.writeRemote(CounterId.fromInt(4), 4L, 4L);
@@ -406,7 +367,7 @@ public class CounterContextTest
         mixed.writeLocal(CounterId.getLocalId(), 12L, 12L);
         assertEquals(24L, cc.total(mixed.context));
 
-        ContextState global = ContextState.allocate(3, 0, 0, allocator);
+        ContextState global = ContextState.allocate(3, 0, 0);
         global.writeGlobal(CounterId.fromInt(1), 1L, 1L);
         global.writeGlobal(CounterId.fromInt(2), 2L, 2L);
         global.writeGlobal(CounterId.fromInt(3), 3L, 3L);
@@ -419,10 +380,9 @@ public class CounterContextTest
         ContextState state;
         ByteBuffer marked;
         ByteBuffer cleared;
-        AbstractAllocator allocator = HeapAllocator.instance;
 
         // mark/clear for remote-only contexts is a no-op
-        state = ContextState.allocate(0, 0, 1, allocator);
+        state = ContextState.allocate(0, 0, 1);
         state.writeRemote(CounterId.fromInt(1), 1L, 1L);
 
         assertFalse(cc.shouldClearLocal(state.context));
@@ -434,7 +394,7 @@ public class CounterContextTest
         assertSame(cleared, marked); // shouldn't alter anything either
 
         // a single local shard
-        state = ContextState.allocate(0, 1, 0, allocator);
+        state = ContextState.allocate(0, 1, 0);
         state.writeLocal(CounterId.fromInt(1), 1L, 1L);
 
         assertFalse(cc.shouldClearLocal(state.context));
@@ -448,7 +408,7 @@ public class CounterContextTest
         assertEquals(0, cleared.getShort(cleared.position()));
 
         // 2 global + 1 local shard
-        state = ContextState.allocate(2, 1, 0, allocator);
+        state = ContextState.allocate(2, 1, 0);
         state.writeLocal(CounterId.fromInt(1), 1L, 1L);
         state.writeGlobal(CounterId.fromInt(2), 2L, 2L);
         state.writeGlobal(CounterId.fromInt(3), 3L, 3L);
@@ -496,7 +456,7 @@ public class CounterContextTest
         assertEquals(3L, cleared.getLong(cleared.position() + headerLength + 2 * stepLength + idLength + clockLength));
 
         // a single global shard - no-op
-        state = ContextState.allocate(1, 0, 0, allocator);
+        state = ContextState.allocate(1, 0, 0);
         state.writeGlobal(CounterId.fromInt(1), 1L, 1L);
 
         assertFalse(cc.shouldClearLocal(state.context));
@@ -511,7 +471,7 @@ public class CounterContextTest
     @Test
     public void testFindPositionOf()
     {
-        ContextState state = ContextState.allocate(3, 3, 3, HeapAllocator.instance);
+        ContextState state = ContextState.allocate(3, 3, 3);
 
         state.writeGlobal(CounterId.fromInt(1), 1L, 1L);
         state.writeRemote(CounterId.fromInt(2), 2L, 2L);
@@ -543,7 +503,7 @@ public class CounterContextTest
     @Test
     public void testGetGlockAndCountOf()
     {
-        ContextState state = ContextState.allocate(3, 3, 3, HeapAllocator.instance);
+        ContextState state = ContextState.allocate(3, 3, 3);
 
         state.writeGlobal(CounterId.fromInt(1), 1L, 1L);
         state.writeRemote(CounterId.fromInt(2), 2L, 2L);

http://git-wip-us.apache.org/repos/asf/cassandra/blob/8a2a0c3d/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
index f09b6a4..55b6f77 100644
--- a/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
+++ b/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
@@ -50,7 +50,6 @@ import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.CounterId;
 import org.apache.cassandra.utils.FBUtilities;
-import org.apache.cassandra.utils.memory.HeapAllocator;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
@@ -316,7 +315,7 @@ public class StreamingTransferTest extends SchemaLoader
                 Map<String, ColumnFamily> entries = new HashMap<>();
                 ColumnFamily cf = ArrayBackedSortedColumns.factory.create(cfs.metadata);
                 ColumnFamily cfCleaned = ArrayBackedSortedColumns.factory.create(cfs.metadata);
-                CounterContext.ContextState state = CounterContext.ContextState.allocate(0, 1, 3, HeapAllocator.instance);
+                CounterContext.ContextState state = CounterContext.ContextState.allocate(0, 1, 3);
                 state.writeLocal(CounterId.fromInt(2), 9L, 3L);
                 state.writeRemote(CounterId.fromInt(4), 4L, 2L);
                 state.writeRemote(CounterId.fromInt(6), 3L, 3L);


Mime
View raw message