hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject hbase git commit: HBASE-15204 Try to estimate the cell count for adding into WALEdit (Ram)
Date Thu, 11 Feb 2016 03:58:01 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 bc1d83673 -> cd2b4dfa1


HBASE-15204 Try to estimate the cell count for adding into WALEdit (Ram)


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

Branch: refs/heads/branch-1
Commit: cd2b4dfa1242a5febfc1be517c5d84cc75fb1723
Parents: bc1d836
Author: ramkrishna <ramkrishna.s.vasudevan@gmail.com>
Authored: Thu Feb 11 09:27:19 2016 +0530
Committer: ramkrishna <ramkrishna.s.vasudevan@gmail.com>
Committed: Thu Feb 11 09:27:19 2016 +0530

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegion.java      | 21 +++++++++++++++-----
 .../hadoop/hbase/regionserver/wal/WALEdit.java  | 11 +++++++++-
 2 files changed, 26 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2b4dfa/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 7605fd0..f0be75d 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -3012,12 +3012,12 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
     Set<byte[]> deletesCfSet = null;
 
     long currentNonceGroup = HConstants.NO_NONCE, currentNonce = HConstants.NO_NONCE;
-    WALEdit walEdit = new WALEdit(isInReplay);
+    WALEdit walEdit = null;
     MultiVersionConcurrencyControl.WriteEntry writeEntry = null;
     long txid = 0;
     boolean doRollBackMemstore = false;
     boolean locked = false;
-
+    int cellCount = 0;
     /** Keep track of the locks we hold so we can release them in finally clause */
     List<RowLock> acquiredRowLocks = Lists.newArrayListWithCapacity(batchOp.operations.length);
     // reference family maps directly so coprocessors can mutate them if desired
@@ -3102,7 +3102,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
 
         lastIndexExclusive++;
         numReadyToWrite++;
-
+        if (isInReplay) {
+          for (List<Cell> cells : mutation.getFamilyCellMap().values()) {
+            cellCount += cells.size();
+          }
+        }
         if (isPutMutation) {
           // If Column Families stay consistent through out all of the
           // individual puts then metrics can be reported as a mutliput across
@@ -3150,8 +3154,15 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
           noOfDeletes++;
         }
         rewriteCellTags(familyMaps[i], mutation);
+        WALEdit fromCP = batchOp.walEditsFromCoprocessors[i];
+        if (fromCP != null) {
+          cellCount += fromCP.size();
+        }
+        for (List<Cell> cells : familyMaps[i].values()) {
+          cellCount += cells.size();
+        }
       }
-
+      walEdit = new WALEdit(cellCount, isInReplay);
       lock(this.updatesLock.readLock(), numReadyToWrite);
       locked = true;
 
@@ -3200,7 +3211,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver,
Regi
               currentNonceGroup, currentNonce, mvcc);
             txid = this.wal.append(this.htableDescriptor,  this.getRegionInfo(),  walKey,
               walEdit, true);
-            walEdit = new WALEdit(isInReplay);
+            walEdit = new WALEdit(cellCount, isInReplay);
             walKey = null;
           }
           currentNonceGroup = nonceGroup;

http://git-wip-us.apache.org/repos/asf/hbase/blob/cd2b4dfa/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
index c47ce13..d82fcd4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/WALEdit.java
@@ -99,7 +99,7 @@ public class WALEdit implements Writable, HeapSize {
   private final int VERSION_2 = -1;
   private final boolean isReplay;
 
-  private ArrayList<Cell> cells = new ArrayList<Cell>(1);
+  private ArrayList<Cell> cells = null;
 
   public static final WALEdit EMPTY_WALEDIT = new WALEdit();
 
@@ -117,7 +117,16 @@ public class WALEdit implements Writable, HeapSize {
   }
 
   public WALEdit(boolean isReplay) {
+    this(1, isReplay);
+  }
+
+  public WALEdit(int cellCount) {
+    this(cellCount, false);
+  }
+
+  public WALEdit(int cellCount, boolean isReplay) {
     this.isReplay = isReplay;
+    cells = new ArrayList<Cell>(cellCount);
   }
 
   /**


Mime
View raw message