cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject [2/2] git commit: Merge branch 'cassandra-1.2' into trunk
Date Wed, 17 Apr 2013 01:43:02 GMT
Merge branch 'cassandra-1.2' into trunk

Conflicts:
	src/java/org/apache/cassandra/db/ColumnFamily.java
	src/java/org/apache/cassandra/db/RowIndexEntry.java


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

Branch: refs/heads/trunk
Commit: 7a6fbc1b22a099abe368b786e9933fb5d980c329
Parents: 67f5d6f da93a1c
Author: Vijay Parthasarathy <vijay2win@gmail.com>
Authored: Tue Apr 16 18:42:53 2013 -0700
Committer: Vijay Parthasarathy <vijay2win@gmail.com>
Committed: Tue Apr 16 18:42:53 2013 -0700

----------------------------------------------------------------------
 src/java/org/apache/cassandra/cache/CacheKey.java  |    2 +-
 .../cassandra/cache/ConcurrentLinkedHashCache.java |   11 +-
 .../apache/cassandra/cache/IMeasurableMemory.java  |    6 +
 .../org/apache/cassandra/cache/IRowCacheEntry.java |    2 +-
 .../org/apache/cassandra/cache/KeyCacheKey.java    |    7 +
 .../org/apache/cassandra/cache/RowCacheKey.java    |    7 +
 .../apache/cassandra/cache/RowCacheSentinel.java   |    8 +
 src/java/org/apache/cassandra/db/ColumnFamily.java |    5 +
 src/java/org/apache/cassandra/db/DeletionInfo.java |    9 +
 src/java/org/apache/cassandra/db/DeletionTime.java |    7 +
 .../org/apache/cassandra/db/RowIndexEntry.java     |   19 ++-
 .../apache/cassandra/io/sstable/IndexHelper.java   |    6 +
 .../org/apache/cassandra/utils/ObjectSizes.java    |  204 +++++++++++++++
 test/data/serialization/2.0/db.RowMutation.bin     |  Bin 3599 -> 3599 bytes
 .../apache/cassandra/cache/CacheProviderTest.java  |   33 ++-
 .../org/apache/cassandra/cache/ObjectSizeTest.java |   83 ++++++
 16 files changed, 390 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6fbc1b/src/java/org/apache/cassandra/db/ColumnFamily.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/ColumnFamily.java
index e50e396,6164900..fffdfe4
--- a/src/java/org/apache/cassandra/db/ColumnFamily.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamily.java
@@@ -286,6 -266,22 +286,11 @@@ public abstract class ColumnFamily impl
          return null;
      }
  
 -    /** the size of user-provided data, not including internal overhead */
 -    int dataSize()
 -    {
 -        int size = deletionInfo().dataSize();
 -        for (IColumn column : columns)
 -        {
 -            size += column.dataSize();
 -        }
 -        return size;
 -    }
 -
+     public long memorySize()
+     {
+         return ObjectSizes.measureDeep(this);
+     }
+ 
      public long maxTimestamp()
      {
          long maxTimestamp = deletionInfo().maxTimestamp();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6fbc1b/src/java/org/apache/cassandra/db/DeletionInfo.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6fbc1b/src/java/org/apache/cassandra/db/DeletionTime.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6fbc1b/src/java/org/apache/cassandra/db/RowIndexEntry.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/db/RowIndexEntry.java
index 2a8dcfe,a831498..aeaec44
--- a/src/java/org/apache/cassandra/db/RowIndexEntry.java
+++ b/src/java/org/apache/cassandra/db/RowIndexEntry.java
@@@ -27,8 -28,11 +28,9 @@@ import org.apache.cassandra.cache.IMeas
  import org.apache.cassandra.io.sstable.Descriptor;
  import org.apache.cassandra.io.sstable.IndexHelper;
  import org.apache.cassandra.io.util.FileUtils;
 -import org.apache.cassandra.utils.IFilter;
 -import org.apache.cassandra.utils.FilterFactory;
+ import org.apache.cassandra.utils.ObjectSizes;
  
- public class RowIndexEntry
+ public class RowIndexEntry implements IMeasurableMemory
  {
      public static final Serializer serializer = new Serializer();
  
@@@ -64,21 -68,33 +66,27 @@@
  
      public List<IndexHelper.IndexInfo> columnsIndex()
      {
 -        return Collections.<IndexHelper.IndexInfo>emptyList();
 -    }
 -
 -    public IFilter bloomFilter()
 -    {
 -        throw new UnsupportedOperationException();
 +        return Collections.emptyList();
      }
  
+     public long memorySize()
+     {
+         long fields = TypeSizes.NATIVE.sizeof(position) + ObjectSizes.getReferenceSize();

+         return ObjectSizes.getFieldSize(fields);
+     }
+ 
      public static class Serializer
      {
 -        public void serialize(RowIndexEntry rie, DataOutput dos) throws IOException
 +        public void serialize(RowIndexEntry rie, DataOutput out) throws IOException
          {
 -            dos.writeLong(rie.position);
 +            out.writeLong(rie.position);
              if (rie.isIndexed())
              {
 -                dos.writeInt(((IndexedEntry)rie).serializedSize());
 -                DeletionInfo.serializer().serializeForSSTable(rie.deletionInfo(), dos);
 -                dos.writeInt(rie.columnsIndex().size());
 +                out.writeInt(rie.serializedSize());
 +                DeletionInfo.serializer().serializeForSSTable(rie.deletionInfo(), out);
 +                out.writeInt(rie.columnsIndex().size());
                  for (IndexHelper.IndexInfo info : rie.columnsIndex())
 -                    info.serialize(dos);
 -                FilterFactory.serialize(rie.bloomFilter(), dos);
 +                    info.serialize(out);
              }
              else
              {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6fbc1b/src/java/org/apache/cassandra/io/sstable/IndexHelper.java
----------------------------------------------------------------------
diff --cc src/java/org/apache/cassandra/io/sstable/IndexHelper.java
index 468fdc2,444ec0b..4779e0b
--- a/src/java/org/apache/cassandra/io/sstable/IndexHelper.java
+++ b/src/java/org/apache/cassandra/io/sstable/IndexHelper.java
@@@ -215,9 -242,15 +215,15 @@@ public class IndexHelpe
                     typeSizes.sizeof(offset) + typeSizes.sizeof(width);
          }
  
 -        public static IndexInfo deserialize(DataInput dis) throws IOException
 +        public static IndexInfo deserialize(DataInput in) throws IOException
          {
 -            return new IndexInfo(ByteBufferUtil.readWithShortLength(dis), ByteBufferUtil.readWithShortLength(dis),
dis.readLong(), dis.readLong());
 +            return new IndexInfo(ByteBufferUtil.readWithShortLength(in), ByteBufferUtil.readWithShortLength(in),
in.readLong(), in.readLong());
          }
+ 
+         public long memorySize()
+         {
+             long fields = ObjectSizes.getSize(firstName) + ObjectSizes.getSize(lastName)
+ 8 + 8; 
+             return ObjectSizes.getFieldSize(fields);
+         }
      }
  }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6fbc1b/test/data/serialization/2.0/db.RowMutation.bin
----------------------------------------------------------------------
diff --cc test/data/serialization/2.0/db.RowMutation.bin
index 94bb810,0000000..f9e634f
mode 100644,000000..100644
Binary files differ

http://git-wip-us.apache.org/repos/asf/cassandra/blob/7a6fbc1b/test/unit/org/apache/cassandra/cache/CacheProviderTest.java
----------------------------------------------------------------------


Mime
View raw message