You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2021/05/06 19:34:34 UTC

[GitHub] [accumulo-examples] jmark99 commented on a change in pull request #74: Avoid checking Accumulo table exists before creation

jmark99 commented on a change in pull request #74:
URL: https://github.com/apache/accumulo-examples/pull/74#discussion_r627710963



##########
File path: spark/src/main/java/org/apache/accumulo/spark/CopyPlus5K.java
##########
@@ -76,8 +78,20 @@ private static void cleanupAndCreateTables(Properties props) throws Exception {
         client.tableOperations().delete(outputTable);
       }
       // Create tables
-      client.tableOperations().create(inputTable);
-      client.tableOperations().create(outputTable);
+      try {
+        client.tableOperations().create(inputTable);
+      } catch (TableExistsException e) {
+        low.error("Something went wrong. Table '{}' should have been deleted prior to creation "
+            + "attempt!", inputTable);
+        return;
+      }
+      try {
+        client.tableOperations().create(outputTable);
+      } catch (TableExistsException e) {
+        low.error("Something went wrong. Table '{}' should have been deleted prior to creation "

Review comment:
       Yes :) Thanks for the catch. It was not caught by compile since this class is not in the src path of the examples. 




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