gjacoby126 commented on a change in pull request #597: PHOENIX-5522 If index is 
disabled, IndexUpgradeTool should not fail d…
URL: https://github.com/apache/phoenix/pull/597#discussion_r334201968
 
 

 ##########
 File path: 
phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
 ##########
 @@ -491,6 +491,15 @@ private int rebuildIndexes(String dataTable, IndexTool 
indexingTool) {
             try {
                 LOGGER.info("Rebuilding index: " + String.join(",", args));
                 if (!dryRun) {
+                    // If the index is in DISABLED state, indexTool will fail. 
First to ALTER REBUILD ASYNC
+                    String stmt = String.format("ALTER INDEX %s ON %s REBUILD 
ASYNC", indexName,
+                            SchemaUtil.getTableName(schema, baseTable));
+                    try {
+                        conn.createStatement().execute(stmt);
+                    } catch (SQLException ex) {
+                        LOGGER.warning("Something went wrong while running 
ALTER REBUILD ASYNC the index "
 
 Review comment:
   nit: "ASYNC on the index " 

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