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/05/27 23:20:44 UTC

[GitHub] [phoenix] gjacoby126 opened a new pull request #790: PHOENIX-5922 - IndexUpgradeTool should always re-enable tables on fai…

gjacoby126 opened a new pull request #790:
URL: https://github.com/apache/phoenix/pull/790


   …lure


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



[GitHub] [phoenix] gjacoby126 commented on a change in pull request #790: PHOENIX-5922 - IndexUpgradeTool should always re-enable tables on fai…

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on a change in pull request #790:
URL: https://github.com/apache/phoenix/pull/790#discussion_r431531187



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
##########
@@ -398,28 +414,34 @@ private int executeTool(Connection conn,
         executeToolForMutableTables(conn, queryServices, conf, mutableList);
         enableImmutableTables(queryServices, immutableList, startWaitTime);
         rebuildIndexes(conn, conf, immutableList);
-        return 0;
+        if (hasFailure) {
+            return -1;
+        } else {
+            return 0;
+        }
     }
 
     private long executeToolForImmutableTables(ConnectionQueryServices queryServices,
-            ArrayList<String> immutableList) {
+            List<String> immutableList) {
         if (immutableList.isEmpty()) {
             return 0;
         }
         LOGGER.info("Started " + operation + " for immutable tables");
+        List<String> failedTables = new ArrayList<String>();
         for (String dataTableFullName : immutableList) {
             try (Admin admin = queryServices.getAdmin()) {
                 HashSet<String> indexes = tablesAndIndexes.get(dataTableFullName);
                 LOGGER.info("Executing " + operation + " of " + dataTableFullName
                         + " (immutable)");
                 disableTable(admin, dataTableFullName, indexes);
                 modifyTable(admin, dataTableFullName, indexes);
-            } catch (IOException | SQLException e) {
+            } catch (IOException | SQLException | RuntimeException e) {

Review comment:
       Done

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
##########
@@ -463,14 +489,20 @@ private void handleFailure(ConnectionQueryServices queryServices,
             upgrade = !upgrade;
 
             tablesAndIndexes.remove(dataTableFullName); //removing from the map
-            tableList.remove(dataTableFullName); //removing from the list
+            failedTables.add(dataTableFullName); //removing from the list

Review comment:
       Fixed




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



[GitHub] [phoenix] gjacoby126 merged pull request #790: PHOENIX-5922 - IndexUpgradeTool should always re-enable tables on fai…

Posted by GitBox <gi...@apache.org>.
gjacoby126 merged pull request #790:
URL: https://github.com/apache/phoenix/pull/790


   


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



[GitHub] [phoenix] gjacoby126 commented on pull request #790: PHOENIX-5922 - IndexUpgradeTool should always re-enable tables on fai…

Posted by GitBox <gi...@apache.org>.
gjacoby126 commented on pull request #790:
URL: https://github.com/apache/phoenix/pull/790#issuecomment-634995267


   btw, also found and fixed a bug with the rollback logic after a failed upgrade/downgrade where it was modifying a list being iterated over, which was causing failures. 


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



[GitHub] [phoenix] abhishek-chouhan commented on a change in pull request #790: PHOENIX-5922 - IndexUpgradeTool should always re-enable tables on fai…

Posted by GitBox <gi...@apache.org>.
abhishek-chouhan commented on a change in pull request #790:
URL: https://github.com/apache/phoenix/pull/790#discussion_r431503214



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
##########
@@ -463,14 +489,20 @@ private void handleFailure(ConnectionQueryServices queryServices,
             upgrade = !upgrade;
 
             tablesAndIndexes.remove(dataTableFullName); //removing from the map
-            tableList.remove(dataTableFullName); //removing from the list
+            failedTables.add(dataTableFullName); //removing from the list

Review comment:
       Nit: comment

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexUpgradeTool.java
##########
@@ -398,28 +414,34 @@ private int executeTool(Connection conn,
         executeToolForMutableTables(conn, queryServices, conf, mutableList);
         enableImmutableTables(queryServices, immutableList, startWaitTime);
         rebuildIndexes(conn, conf, immutableList);
-        return 0;
+        if (hasFailure) {
+            return -1;
+        } else {
+            return 0;
+        }
     }
 
     private long executeToolForImmutableTables(ConnectionQueryServices queryServices,
-            ArrayList<String> immutableList) {
+            List<String> immutableList) {
         if (immutableList.isEmpty()) {
             return 0;
         }
         LOGGER.info("Started " + operation + " for immutable tables");
+        List<String> failedTables = new ArrayList<String>();
         for (String dataTableFullName : immutableList) {
             try (Admin admin = queryServices.getAdmin()) {
                 HashSet<String> indexes = tablesAndIndexes.get(dataTableFullName);
                 LOGGER.info("Executing " + operation + " of " + dataTableFullName
                         + " (immutable)");
                 disableTable(admin, dataTableFullName, indexes);
                 modifyTable(admin, dataTableFullName, indexes);
-            } catch (IOException | SQLException e) {
+            } catch (IOException | SQLException | RuntimeException e) {

Review comment:
       Should we just catch throwable here(and in the mutable case), so that we cover errors too? in all cases i guess we want the tables to be enabled back.




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