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-1536 Make use of SplitTransaction to split local index region from 0.98.9 onwards(Rajeshbabu)
Date Fri, 26 Dec 2014 04:16:30 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.0 624160c0b -> 4f6a76dc7


PHOENIX-1536 Make use of SplitTransaction to split local index region from 0.98.9 onwards(Rajeshbabu)


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

Branch: refs/heads/4.0
Commit: 4f6a76dc7b7d4c636aae2f5793f5c6cc29e2253c
Parents: 624160c
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Fri Dec 26 09:46:20 2014 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Fri Dec 26 09:46:20 2014 +0530

----------------------------------------------------------------------
 .../regionserver/IndexSplitTransaction.java     |  6 +++---
 .../hbase/regionserver/LocalIndexSplitter.java  | 20 ++++++++++++++++----
 .../hbase/index/IndexRegionSplitPolicy.java     |  4 ++++
 pom.xml                                         |  2 +-
 4 files changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4f6a76dc/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexSplitTransaction.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexSplitTransaction.java
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexSplitTransaction.java
index 18f1b0b..c18521e 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexSplitTransaction.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/IndexSplitTransaction.java
@@ -89,7 +89,7 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
  * one thread only.
  */
 @InterfaceAudience.Private
-public class IndexSplitTransaction {
+public class IndexSplitTransaction extends SplitTransaction {
   private static final Log LOG = LogFactory.getLog(IndexSplitTransaction.class);
 
   /*
@@ -155,6 +155,7 @@ public class IndexSplitTransaction {
    * @param splitrow Row to split around
    */
   public IndexSplitTransaction(final HRegion r, final byte [] splitrow) {
+    super(r , splitrow);
     this.parent = r;
     this.splitrow = splitrow;
   }
@@ -783,8 +784,7 @@ public class IndexSplitTransaction {
             boolean top, HRegionFileSystem fs) throws IOException {
         f.closeReader(true);
         Path splitDir =
-                new Path(new Path(new Path(fs.getRegionDir(), HRegionFileSystem.REGION_SPLITS_DIR),
-                        hri.getEncodedName()), familyName);
+                new Path(fs.getSplitsDir(hri), familyName);
         // A reference to the bottom half of the hsf store file.
         Reference r =
                 top ? Reference.createTopReference(splitRow) : Reference

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4f6a76dc/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/LocalIndexSplitter.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/LocalIndexSplitter.java
b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/LocalIndexSplitter.java
index 713fa59..15e5ec8 100644
--- a/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/LocalIndexSplitter.java
+++ b/phoenix-core/src/main/java/org/apache/hadoop/hbase/regionserver/LocalIndexSplitter.java
@@ -32,6 +32,7 @@ import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
 import org.apache.hadoop.hbase.coprocessor.ObserverContext;
 import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
 import org.apache.hadoop.hbase.util.PairOfSameType;
+import org.apache.phoenix.hbase.index.util.VersionUtil;
 import org.apache.phoenix.jdbc.PhoenixConnection;
 import org.apache.phoenix.parse.AlterIndexStatement;
 import org.apache.phoenix.parse.ParseNodeFactory;
@@ -51,9 +52,11 @@ public class LocalIndexSplitter extends BaseRegionObserver {
 
     private static final Log LOG = LogFactory.getLog(LocalIndexSplitter.class);
 
-    private IndexSplitTransaction st = null;
+    private SplitTransaction st = null;
     private PairOfSameType<HRegion> daughterRegions = null;
     private static final ParseNodeFactory FACTORY = new ParseNodeFactory();
+    private static final int SPLIT_TXN_MINIMUM_SUPPORTED_VERSION = VersionUtil
+            .encodeVersion("0.98.9");
 
     @Override
     public void preSplitBeforePONR(ObserverContext<RegionCoprocessorEnvironment> ctx,
@@ -71,7 +74,16 @@ public class LocalIndexSplitter extends BaseRegionObserver {
             HRegion indexRegion = IndexUtil.getIndexRegion(environment);
             if (indexRegion == null) return;
             try {
-                st = new IndexSplitTransaction(indexRegion, splitKey);
+                int encodedVersion = VersionUtil.encodeVersion(environment.getHBaseVersion());
+                if(encodedVersion >= SPLIT_TXN_MINIMUM_SUPPORTED_VERSION) {
+                    st = new SplitTransaction(indexRegion, splitKey);
+                    st.useZKForAssignment =
+                            environment.getConfiguration().getBoolean("hbase.assignment.usezk",
+                                true);
+                } else {
+                    st = new IndexSplitTransaction(indexRegion, splitKey);
+                }
+
                 if (!st.prepare()) {
                     LOG.error("Prepare for the table " + indexRegion.getTableDesc().getNameAsString()
                         + " failed. So returning null. ");
@@ -98,6 +110,7 @@ public class LocalIndexSplitter extends BaseRegionObserver {
                 metaEntries.add(putB);
             } catch (Exception e) {
                 ctx.bypass();
+                LOG.warn("index region splitting failed with the exception ", e);
                 if (st != null){
                     st.rollback(rss, rss);
                     st = null;
@@ -157,8 +170,7 @@ public class LocalIndexSplitter extends BaseRegionObserver {
             }
         } catch (Exception e) {
             if (st != null) {
-                LOG.error("Error while rolling back the split failure for index region "
-                    + st.getParent(), e);
+                LOG.error("Error while rolling back the split failure for index region",
e);
             }
             rs.abort("Abort; we got an error during rollback of index");
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4f6a76dc/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionSplitPolicy.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionSplitPolicy.java
b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionSplitPolicy.java
index 0ee27e2..8604784 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionSplitPolicy.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/hbase/index/IndexRegionSplitPolicy.java
@@ -29,4 +29,8 @@ public class IndexRegionSplitPolicy extends RegionSplitPolicy {
         return false;
     }
 
+    protected boolean skipStoreFileRangeCheck() {
+        return true;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/4f6a76dc/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3c7a720..242a73d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,7 @@
     <test.output.tofile>true</test.output.tofile>
 
     <!-- Hadoop Versions -->
-    <hbase.version>0.98.4-hadoop2</hbase.version>
+    <hbase.version>0.98.9-hadoop2</hbase.version>
     <hadoop-two.version>2.2.0</hadoop-two.version>
 
     <!-- Dependency versions -->


Mime
View raw message