You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by el...@apache.org on 2017/01/23 23:02:00 UTC

[27/50] [abbrv] hbase git commit: HBASE-17488 WALEdit should be lazily instantiated (ChiaPing Tsai)

HBASE-17488 WALEdit should be lazily instantiated (ChiaPing Tsai)


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

Branch: refs/heads/HBASE-16961
Commit: 2285c57a352aa4607636205a8b99ecb8ea1ff51e
Parents: 2ee3c73
Author: Michael Stack <st...@apache.org>
Authored: Fri Jan 20 09:37:48 2017 -0800
Committer: Michael Stack <st...@apache.org>
Committed: Fri Jan 20 09:37:48 2017 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegion.java       | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/2285c57a/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 0b93cb1..5fc53d8 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
@@ -3234,11 +3234,12 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
         if (fromCP != null) {
           cellCount += fromCP.size();
         }
-        for (List<Cell> cells : familyMaps[i].values()) {
-          cellCount += cells.size();
+        if (getEffectiveDurability(mutation.getDurability()) != Durability.SKIP_WAL) {
+          for (List<Cell> cells : familyMaps[i].values()) {
+            cellCount += cells.size();
+          }
         }
       }
-      walEdit = new WALEdit(cellCount, replay);
       lock(this.updatesLock.readLock(), numReadyToWrite);
       locked = true;
 
@@ -3260,6 +3261,8 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
             if (cpMutations == null) {
               continue;
             }
+            Mutation mutation = batchOp.getMutation(i);
+            boolean skipWal = getEffectiveDurability(mutation.getDurability()) == Durability.SKIP_WAL;
             // Else Coprocessor added more Mutations corresponding to the Mutation at this index.
             for (int j = 0; j < cpMutations.length; j++) {
               Mutation cpMutation = cpMutations[j];
@@ -3272,12 +3275,22 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
               // Returned mutations from coprocessor correspond to the Mutation at index i. We can
               // directly add the cells from those mutations to the familyMaps of this mutation.
               mergeFamilyMaps(familyMaps[i], cpFamilyMap); // will get added to the memstore later
+
+              // The durability of returned mutation is replaced by the corresponding mutation.
+              // If the corresponding mutation contains the SKIP_WAL, we shouldn't count the
+              // cells of returned mutation.
+              if (!skipWal) {
+                for (List<Cell> cells : cpFamilyMap.values()) {
+                  cellCount += cells.size();
+                }
+              }
             }
           }
         }
       }
 
       // STEP 3. Build WAL edit
+      walEdit = new WALEdit(cellCount, replay);
       Durability durability = Durability.USE_DEFAULT;
       for (int i = firstIndex; i < lastIndexExclusive; i++) {
         // Skip puts that were determined to be invalid during preprocessing