phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject phoenix git commit: PHOENIX-3018 Write local updates to region than HTable in master branch(Rajeshbabu)
Date Wed, 29 Jun 2016 03:49:11 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-1.1 96fc55500 -> 5451a6c39


PHOENIX-3018 Write local updates to region than HTable in master branch(Rajeshbabu)


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

Branch: refs/heads/4.x-HBase-1.1
Commit: 5451a6c39e84907051005c293c7b6929b180b200
Parents: 96fc555
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Wed Jun 29 09:25:31 2016 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Wed Jun 29 09:25:31 2016 +0530

----------------------------------------------------------------------
 .../index/write/ParallelWriterIndexCommitter.java     |  6 +-----
 .../TrackingParallelWriterIndexCommitter.java         |  6 +-----
 .../main/java/org/apache/phoenix/util/IndexUtil.java  | 14 ++++++++++++++
 3 files changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5451a6c3/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
index ae8adc2..0e6db58 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/ParallelWriterIndexCommitter.java
@@ -153,13 +153,9 @@ public class ParallelWriterIndexCommitter implements IndexCommitter {
                     }
                     try {
 						if (allowLocalUpdates && env!=null) {
-							for (Mutation m : mutations) {
-								m.setDurability(Durability.SKIP_WAL);
-							}
 	                        try {
 	                            throwFailureIfDone();
-	                            env.getRegion().batchMutate(mutations.toArray(new Mutation[mutations.size()]),
-	                                HConstants.NO_NONCE, HConstants.NO_NONCE);
+	                            IndexUtil.writeLocalUpdates(env.getRegion(), mutations, true);
 	                            return null;
 	                        } catch (IOException ignord) {
 	                            // when it's failed we fall back to the standard & slow
way

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5451a6c3/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
index 217e38e..fc27f76 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/write/recovery/TrackingParallelWriterIndexCommitter.java
@@ -153,13 +153,9 @@ public class TrackingParallelWriterIndexCommitter implements IndexCommitter
{
                         throwFailureIfDone();
                         if (allowLocalUpdates && env!=null && tableReference.getTableName().equals(
                             env.getRegion().getTableDesc().getNameAsString())) {
-                            for (Mutation m : mutations) {
-                                m.setDurability(Durability.SKIP_WAL);
-                            }
                             try {
                                 throwFailureIfDone();
-                                env.getRegion().batchMutate(mutations.toArray(new Mutation[mutations.size()]),
-                                    HConstants.NO_NONCE, HConstants.NO_NONCE);
+                                IndexUtil.writeLocalUpdates(env.getRegion(), mutations, true);
                                 return Boolean.TRUE;
                             } catch (IOException ignord) {
                                 // when it's failed we fall back to the standard & slow
way

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5451a6c3/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
index 86fa8ca..b0abe36 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
@@ -30,10 +30,12 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HTableInterface;
 import org.apache.hadoop.hbase.client.Mutation;
@@ -659,4 +661,16 @@ public class IndexUtil {
         return viewConstants.isEmpty() ? null : viewConstants
                 .toArray(new byte[viewConstants.size()][]);
     }
+
+    public static void writeLocalUpdates(Region region, final List<Mutation> mutations,
boolean skipWAL) throws IOException {
+        if(skipWAL) {
+            for (Mutation m : mutations) {
+                m.setDurability(Durability.SKIP_WAL);
+            }
+        }
+        region.batchMutate(
+            mutations.toArray(new Mutation[mutations.size()]),
+            HConstants.NO_NONCE, HConstants.NO_NONCE);
+    }
+
 }


Mime
View raw message