phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [phoenix] gjacoby126 commented on a change in pull request #499: Phoenix-5272 ALTER INDEX REBUILD ALL
Date Tue, 28 May 2019 21:59:20 GMT
gjacoby126 commented on a change in pull request #499: Phoenix-5272 ALTER INDEX REBUILD ALL

URL: https://github.com/apache/phoenix/pull/499#discussion_r288319699
 
 

 ##########
 File path: phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
 ##########
 @@ -934,7 +934,30 @@ public IndexStateCheck(PIndexState indexState, Long indexDisableTimestamp,
Boole
     		this.success = success;
     	}
     }
-    
+
+    public static void waitForIndexState(Connection conn, String fullIndexName, PIndexState
expectedIndexState) throws InterruptedException, SQLException {
+        int maxTries = 60, nTries = 0;
+        do {
+            String schema = SchemaUtil.getSchemaNameFromFullName(fullIndexName);
+            String index = SchemaUtil.getTableNameFromFullName(fullIndexName);
+            Thread.sleep(1000); // sleep 1 sec
+            String query = "SELECT " + PhoenixDatabaseMetaData.INDEX_STATE + " FROM " +
+                    PhoenixDatabaseMetaData.SYSTEM_CATALOG_NAME + " WHERE (" + PhoenixDatabaseMetaData.TABLE_SCHEM
+ "," + PhoenixDatabaseMetaData.TABLE_NAME
+                    + ") = (" + "'" + schema + "','" + index + "') "
+                    + "AND " + PhoenixDatabaseMetaData.COLUMN_FAMILY + " IS NULL AND " +
PhoenixDatabaseMetaData.COLUMN_NAME + " IS NULL";
+            ResultSet rs = conn.createStatement().executeQuery(query);
+            PIndexState actualIndexState = null;
+            if (rs.next()) {
+                actualIndexState = PIndexState.fromSerializedValue(rs.getString(1));
+                boolean matchesExpected = (actualIndexState == expectedIndexState);
+                if (matchesExpected) {
+                    return;
+                }
+            }
+        } while (++nTries < maxTries);
 
 Review comment:
   @swaroopak - as we talked about offline, RetryCounter has InterfaceAudience.Private, which
is HBase's way of telling us that external projects shouldn't depend on it because it's an
internal implementation detail that can go away or change interface at any time. 
   
   Would be nice to have something similar in Phoenix though, so perhaps we should fork it
(as part of a different JIRA). 

----------------------------------------------------------------
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


With regards,
Apache Git Services

Mime
View raw message