hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1476024 - in /hbase/branches/0.95: hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
Date Fri, 26 Apr 2013 02:02:45 GMT
Author: tedyu
Date: Fri Apr 26 02:02:44 2013
New Revision: 1476024

URL: http://svn.apache.org/r1476024
Log:
HBASE-8393 Testcase TestHeapSize#testMutations is wrong (Jeffrey)


Modified:
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java?rev=1476024&r1=1476023&r2=1476024&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
(original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Mutation.java
Fri Apr 26 02:02:44 2013
@@ -43,11 +43,10 @@ import java.util.UUID;
 @InterfaceStability.Evolving
 public abstract class Mutation extends OperationWithAttributes implements Row, CellScannable,
     HeapSize {
-  static final long MUTATION_OVERHEAD = ClassSize.align(
+  public static final long MUTATION_OVERHEAD = ClassSize.align(
       // This
       ClassSize.OBJECT +
-      // OperationWithAttributes map reference?  I don't know what the other reference is
and if I
-      // remove it it breaks TestHeapSize so just leaving it.
+      // row + OperationWithAttributes.attributes
       2 * ClassSize.REFERENCE +
       // Timestamp
       1 * Bytes.SIZEOF_LONG +

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java?rev=1476024&r1=1476023&r2=1476024&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/io/TestHeapSize.java
Fri Apr 26 02:02:44 2013
@@ -353,32 +353,22 @@ public class TestHeapSize  {
       assertEquals(expected, actual);
     }
 
+    byte[] row = new byte[] { 0 };
     cl = Put.class;
-    actual = new Put(new byte[]{0}).heapSize();
+    actual = new Put(row).MUTATION_OVERHEAD + ClassSize.align(ClassSize.ARRAY);
     expected = ClassSize.estimateBase(cl, false);
     //The actual TreeMap is not included in the above calculation
-    expected += ClassSize.align(ClassSize.TREEMAP + ClassSize.REFERENCE);
+    expected += ClassSize.align(ClassSize.TREEMAP);
     if (expected != actual) {
       ClassSize.estimateBase(cl, true);
       assertEquals(expected, actual);
     }
 
-
     cl = Delete.class;
-    actual = new Delete(new byte[]{0}).heapSize();
+    actual = new Delete(row).MUTATION_OVERHEAD + ClassSize.align(ClassSize.ARRAY);
     expected  = ClassSize.estimateBase(cl, false);
     //The actual TreeMap is not included in the above calculation
-    expected += ClassSize.align(ClassSize.TREEMAP + ClassSize.REFERENCE);
-    if (expected != actual) {
-      ClassSize.estimateBase(cl, true);
-      assertEquals(expected, actual);
-    }
-
-    cl = Increment.class;
-    actual = new Increment(new byte[]{0}).heapSize();
-    expected  = ClassSize.estimateBase(cl, false);
-    //The actual TreeMap and TimeRange are not included in the above calculation
-    expected += ClassSize.align(ClassSize.TREEMAP + ClassSize.REFERENCE + ClassSize.TIMERANGE);
+    expected += ClassSize.align(ClassSize.TREEMAP);
     if (expected != actual) {
       ClassSize.estimateBase(cl, true);
       assertEquals(expected, actual);



Mime
View raw message