hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1128905 - /hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Put.java
Date Sun, 29 May 2011 17:02:11 GMT
Author: apurtell
Date: Sun May 29 17:02:11 2011
New Revision: 1128905

URL: http://svn.apache.org/viewvc?rev=1128905&view=rev
Log:
HBASE-3921 Allow adding arbitrary blobs to Put; fix TestHeapSize

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Put.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Put.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Put.java?rev=1128905&r1=1128904&r2=1128905&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Put.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Put.java Sun May 29 17:02:11
2011
@@ -62,7 +62,7 @@ public class Put implements HeapSize, Wr
   private Map<String, byte[]> attributes;
 
   private static final long OVERHEAD = ClassSize.align(
-      ClassSize.OBJECT + ClassSize.REFERENCE +
+      ClassSize.OBJECT + 2 * ClassSize.REFERENCE +
       2 * Bytes.SIZEOF_LONG + Bytes.SIZEOF_BOOLEAN +
       ClassSize.REFERENCE + ClassSize.TREEMAP);
 
@@ -527,6 +527,13 @@ public class Put implements HeapSize, Wr
         heapsize += kv.heapSize();
       }
     }
+    if (attributes != null) {
+      heapsize += ClassSize.align(this.attributes.size() * ClassSize.MAP_ENTRY);
+      for(Map.Entry<byte [], List<KeyValue>> entry : this.familyMap.entrySet())
{
+        heapsize += ClassSize.align(ClassSize.STRING + entry.getKey().length);
+        heapsize += ClassSize.align(ClassSize.ARRAY + entry.getValue().size());
+      }
+    }
     return ClassSize.align((int)heapsize);
   }
 



Mime
View raw message