Merge branch 'cassandra-2.1' into trunk

This commit is contained in:
Benedict Elliott Smith 2014-06-23 16:54:38 +01:00
commit 944c1716d6
18 changed files with 42 additions and 26 deletions

View File

@ -12,6 +12,8 @@
2.1.0-rc2
* Fix heap size calculation for CompoundSparseCellName and
CompoundSparseCellName.WithCollection (CASSANDRA-7421)
* Allow counter mutations in UNLOGGED batches (CASSANDRA-7351)
* Modify reconcile logic to always pick a tombstone over a counter cell
(CASSANDRA-7346)

View File

@ -89,7 +89,7 @@ public class ColumnIdentifier implements Selectable, IMeasurableMemory
+ ObjectSizes.sizeOf(text);
}
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return EMPTY_SIZE
+ ObjectSizes.sizeOnHeapExcludingData(bytes)

View File

@ -351,7 +351,7 @@ public class AtomicBTreeColumns extends ColumnFamily
indexer.insert(insert);
insert = insert.localCopy(metadata, allocator, writeOp);
this.dataSize += insert.cellDataSize();
this.heapSize += insert.excessHeapSizeExcludingData();
this.heapSize += insert.unsharedHeapSizeExcludingData();
if (inserted == null)
inserted = new ArrayList<>();
inserted.add(insert);
@ -366,7 +366,7 @@ public class AtomicBTreeColumns extends ColumnFamily
{
reconciled = reconciled.localCopy(metadata, allocator, writeOp);
dataSize += reconciled.cellDataSize() - existing.cellDataSize();
heapSize += reconciled.excessHeapSizeExcludingData() - existing.excessHeapSizeExcludingData();
heapSize += reconciled.unsharedHeapSizeExcludingData() - existing.unsharedHeapSizeExcludingData();
if (inserted == null)
inserted = new ArrayList<>();
inserted.add(reconciled);

View File

@ -84,9 +84,9 @@ public class BufferCell extends AbstractCell
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return EMPTY_SIZE + name.excessHeapSizeExcludingData() + ObjectSizes.sizeOnHeapExcludingData(value);
return EMPTY_SIZE + name.unsharedHeapSizeExcludingData() + ObjectSizes.sizeOnHeapExcludingData(value);
}
@Override

View File

@ -51,7 +51,7 @@ public interface Cell extends OnDiskAtom
// returns the size of the Cell and all references on the heap, excluding any costs associated with byte arrays
// that would be allocated by a localCopy, as these will be accounted for by the allocator
public long excessHeapSizeExcludingData();
public long unsharedHeapSizeExcludingData();
public int serializedSize(CellNameType type, TypeSizes typeSizes);

View File

@ -75,7 +75,7 @@ public class NativeCell extends AbstractNativeCell
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return SIZE;
}

View File

@ -167,7 +167,7 @@ public class NativeCounterCell extends NativeCell implements CounterCell
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return SIZE;
}

View File

@ -112,7 +112,7 @@ public class NativeDeletedCell extends NativeCell implements DeletedCell
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return SIZE;
}

View File

@ -160,7 +160,7 @@ public class NativeExpiringCell extends NativeCell implements ExpiringCell
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return SIZE;
}

View File

@ -207,7 +207,7 @@ public class RowIndexEntry implements IMeasurableMemory
{
long entrySize = 0;
for (IndexHelper.IndexInfo idx : columnsIndex)
entrySize += idx.excessHeapSize();
entrySize += idx.unsharedHeapSize();
return BASE_SIZE
+ entrySize

View File

@ -74,5 +74,5 @@ public interface CellName extends Composite
@Override
public CellName copy(CFMetaData cfm, AbstractAllocator allocator);
public long excessHeapSizeExcludingData();
public long unsharedHeapSizeExcludingData();
}

View File

@ -28,7 +28,7 @@ import org.apache.cassandra.utils.memory.AbstractAllocator;
*/
public class CompoundComposite extends AbstractComposite
{
private static final long EMPTY_SIZE = ObjectSizes.measure(new CompoundComposite(null, 0, false));
private static final long HEAP_SIZE = ObjectSizes.measure(new CompoundComposite(null, 0, false));
// We could use a List, but we'll create such object *a lot* and using a array+size is not
// all that harder, so we save the List object allocation.
@ -73,12 +73,12 @@ public class CompoundComposite extends AbstractComposite
public long unsharedHeapSize()
{
return EMPTY_SIZE + ObjectSizes.sizeOnHeapOf(elements);
return HEAP_SIZE + ObjectSizes.sizeOnHeapOf(elements);
}
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return EMPTY_SIZE + ObjectSizes.sizeOnHeapExcludingData(elements);
return HEAP_SIZE + ObjectSizes.sizeOnHeapExcludingData(elements);
}
public Composite copy(CFMetaData cfm, AbstractAllocator allocator)

View File

@ -73,7 +73,7 @@ public class CompoundDenseCellName extends CompoundComposite implements CellName
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return HEAP_SIZE + ObjectSizes.sizeOnHeapExcludingData(elements);
}

View File

@ -50,6 +50,18 @@ public class CompoundSparseCellName extends CompoundComposite implements CellNam
this.columnName = columnName;
}
@Override
public long unsharedHeapSize()
{
return HEAP_SIZE + ObjectSizes.sizeOnHeapOf(elements);
}
@Override
public long unsharedHeapSizeExcludingData()
{
return HEAP_SIZE + ObjectSizes.sizeOnHeapExcludingData(elements);
}
public int size()
{
return size + 1;
@ -156,13 +168,15 @@ public class CompoundSparseCellName extends CompoundComposite implements CellNam
@Override
public long unsharedHeapSize()
{
return super.unsharedHeapSize() + ObjectSizes.sizeOnHeapOf(collectionElement);
return HEAP_SIZE + ObjectSizes.sizeOnHeapOf(elements)
+ ObjectSizes.sizeOnHeapExcludingData(collectionElement);
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return super.excessHeapSizeExcludingData() + ObjectSizes.sizeOnHeapExcludingData(collectionElement);
return HEAP_SIZE + ObjectSizes.sizeOnHeapExcludingData(elements)
+ ObjectSizes.sizeOnHeapExcludingData(collectionElement);
}
}
}
}

View File

@ -67,7 +67,7 @@ public class SimpleDenseCellName extends SimpleComposite implements CellName
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return EMPTY_SIZE + ObjectSizes.sizeOnHeapExcludingData(element);
}

View File

@ -87,9 +87,9 @@ public class SimpleSparseCellName extends AbstractComposite implements CellName
return true;
}
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return EMPTY_SIZE + columnName.excessHeapSizeExcludingData();
return EMPTY_SIZE + columnName.unsharedHeapSizeExcludingData();
}
public long unsharedHeapSize()

View File

@ -31,7 +31,7 @@ public class SimpleSparseInternedCellName extends SimpleSparseCellName
}
@Override
public long excessHeapSizeExcludingData()
public long unsharedHeapSizeExcludingData()
{
return 0;
}

View File

@ -205,7 +205,7 @@ public class IndexHelper
}
}
public long excessHeapSize()
public long unsharedHeapSize()
{
return EMPTY_SIZE + firstName.unsharedHeapSize() + lastName.unsharedHeapSize();
}