phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajeshb...@apache.org
Subject phoenix git commit: PHOENIC-1734 Local index improvements(Rajeshbabu)-addendum2
Date Thu, 26 May 2016 19:13:13 GMT
Repository: phoenix
Updated Branches:
  refs/heads/master aedf48fab -> c2bb3c38e


PHOENIC-1734 Local index improvements(Rajeshbabu)-addendum2


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

Branch: refs/heads/master
Commit: c2bb3c38e73a34f2097e6dd07eff388a22149bbc
Parents: aedf48f
Author: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Authored: Fri May 27 00:48:15 2016 +0530
Committer: Rajeshbabu Chintaguntla <rajeshbabu@apache.org>
Committed: Fri May 27 00:48:15 2016 +0530

----------------------------------------------------------------------
 .../hbase/index/IndexRegionSplitPolicy.java     | 41 +++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c2bb3c38/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 62c13a5..13a3047 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
@@ -17,11 +17,16 @@
  */
 package org.apache.phoenix.hbase.index;
 
+import java.util.List;
+
 import org.apache.hadoop.hbase.regionserver.IncreasingToUpperBoundRegionSplitPolicy;
+import org.apache.hadoop.hbase.regionserver.Store;
+import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.phoenix.query.QueryConstants;
 
 /**
- * Split policy for index regions to avoid split from external requests.
+ * Split policy for local indexed tables to select split key from non local index column
families
+ * always.
  */
 public class IndexRegionSplitPolicy extends IncreasingToUpperBoundRegionSplitPolicy {
 
@@ -32,4 +37,38 @@ public class IndexRegionSplitPolicy extends IncreasingToUpperBoundRegionSplitPol
         }
         return false;
     }
+
+    @Override
+    protected byte[] getSplitPoint() {
+        byte[] oldSplitPoint = super.getSplitPoint();
+        if (oldSplitPoint == null) return null;
+        List<Store> stores = region.getStores();
+        byte[] splitPointFromLargestStore = null;
+        long largestStoreSize = 0;
+        boolean isLocalIndexKey = false;
+        for (Store s : stores) {
+            if (s.getFamily().getNameAsString()
+                    .startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) {
+                byte[] splitPoint = s.getSplitPoint();
+                if (oldSplitPoint != null && splitPoint != null
+                        && Bytes.compareTo(oldSplitPoint, splitPoint) == 0) {
+                    isLocalIndexKey = true;
+                }
+            }
+        }
+        if (!isLocalIndexKey) return oldSplitPoint;
+
+        for (Store s : stores) {
+            if (!s.getFamily().getNameAsString()
+                    .startsWith(QueryConstants.LOCAL_INDEX_COLUMN_FAMILY_PREFIX)) {
+                byte[] splitPoint = s.getSplitPoint();
+                long storeSize = s.getSize();
+                if (splitPoint != null && largestStoreSize < storeSize) {
+                    splitPointFromLargestStore = splitPoint;
+                    largestStoreSize = storeSize;
+                }
+            }
+        }
+        return splitPointFromLargestStore;
+    }
 }


Mime
View raw message