phoenix-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [phoenix] gokceni commented on a change in pull request #495: PHOENIX-4703 Make indextool changes to drop before rebuild
Date Thu, 02 May 2019 18:26:00 GMT
gokceni commented on a change in pull request #495: PHOENIX-4703 Make indextool changes to
drop before rebuild
URL: https://github.com/apache/phoenix/pull/495#discussion_r280542430
 
 

 ##########
 File path: phoenix-core/src/main/java/org/apache/phoenix/mapreduce/index/IndexTool.java
 ##########
 @@ -743,6 +764,32 @@ public int run(String[] args) throws Exception {
         }
     }
 
+    private void deleteBeforeRebuild(Connection conn) throws SQLException, IOException {
+        if (MetaDataUtil.isViewIndex(pIndexTable.getPhysicalName().getString())) {
+            throw new IllegalArgumentException(String.format(
+                    " %s is a view index table. Delete all before rebuild is not supported
for view indexes",
+                    indexTable));
+        }
+
+        if (isLocalIndexBuild) {
+            throw new IllegalArgumentException(String.format(
+                    " %s is a local index.  Delete all before rebuild is not supported for
local indexes", indexTable));
+        } else {
+            Admin admin = null;
+            ConnectionQueryServices queryServices = conn.unwrap(PhoenixConnection.class).getQueryServices();
+            try {
+                admin = queryServices.getAdmin();
+                TableName tableName = TableName.valueOf(qIndexTable);
+                admin.disableTable(tableName);
+                admin.truncateTable(tableName, false);
+            } finally {
+                if (admin != null) {
+                    admin.close();
 
 Review comment:
   Sure, but code convention seems to be try/finally throughout this codebase.

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