You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/12/30 05:55:23 UTC

[GitHub] [phoenix] virajjasani commented on a change in pull request #1038: PHOENIX-6104 SplitSystemCatalogIT tests very unstable with Hbase 2.3

virajjasani commented on a change in pull request #1038:
URL: https://github.com/apache/phoenix/pull/1038#discussion_r549943833



##########
File path: phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
##########
@@ -1824,20 +1825,35 @@ private  static void verifySequence(String tenantID, String sequenceName, String
         }
         phxConn.close();
     }
-    
 
     /**
      *  Synchronously split table at the given split point
      */
-    protected static void splitRegion(TableName fullTableName, byte[] splitPoint) throws SQLException, IOException, InterruptedException {
-        Admin admin =
-                driver.getConnectionQueryServices(getUrl(), TestUtil.TEST_PROPERTIES).getAdmin();
-        admin.split(fullTableName, splitPoint);
-        // make sure the split finishes (there's no synchronous splitting before HBase 2.x)
-        admin.disableTable(fullTableName);
-        admin.enableTable(fullTableName);
+    protected static void splitTableSync(Admin admin, TableName hbaseTableName, byte[] splitPoint,
+            int expectedRegions) throws IOException, InterruptedException {
+        admin.split(hbaseTableName, splitPoint);
+        for (int i = 0; i < 30; i++) {
+            List<HRegion> regions = getUtility().getHBaseCluster().getRegions(hbaseTableName);
+            if (regions.size() >= expectedRegions) {
+                boolean splitSuccessful = true;
+                for (HRegion region : regions) {
+                    if (!region.isSplittable()) {
+                        splitSuccessful = false;
+                    }
+                }
+                if(splitSuccessful) {
+                    return;
+                }
+            }
+            LOGGER.info(
+                "Sleeping for 1000 ms while waiting for {} to split and all regions to come online",
+                hbaseTableName.getNameAsString());
+            Thread.sleep(1000);
+        }
+        throw new IOException("Split did not succeed for table: " + hbaseTableName.getNameAsString()

Review comment:
       This is better since we are anyways going to return from `if(splitSuccessful)`




----------------------------------------------------------------
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:
users@infra.apache.org