hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject hbase git commit: HBASE-17488 WALEdit should be lazily instantiated (ChiaPing Tsai)
Date Fri, 20 Jan 2017 17:37:55 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 2ee3c73f7 -> 2285c57a3


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/master
Commit: 2285c57a352aa4607636205a8b99ecb8ea1ff51e
Parents: 2ee3c73
Author: Michael Stack <stack@apache.org>
Authored: Fri Jan 20 09:37:48 2017 -0800
Committer: Michael Stack <stack@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


Mime
View raw message