swaroopak commented on a change in pull request #648: Phoenix 5591 Fail 
indextool if split-merge happens during job run
URL: https://github.com/apache/phoenix/pull/648#discussion_r354048957
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java
 ##########
 @@ -978,4 +981,16 @@ public static void 
setScanAttributesForIndexReadRepair(Scan scan, PTable table,
         }
         addEmptyColumnToScan(scan, emptyCF, emptyCQ);
     }
+
+    public static int getNumOfRegions(Configuration configuration, String 
tableName)
+            throws IOException {
+        int numRegions;
+        try (org.apache.hadoop.hbase.client.Connection tempHConn =
+                ConnectionFactory.createConnection(configuration);
+                RegionLocator regionLocator =
+                        
tempHConn.getRegionLocator(TableName.valueOf(tableName))) {
+            numRegions = regionLocator.getStartKeys().length;
 
 Review comment:
   Is there any possibility of getStartKeys returning null? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to