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 2020/11/03 14:15:31 UTC

[GitHub] [accumulo] Manno15 commented on a change in pull request #1759: Wrap undo in try block

Manno15 commented on a change in pull request #1759:
URL: https://github.com/apache/accumulo/pull/1759#discussion_r516623981



##########
File path: server/manager/src/main/java/org/apache/accumulo/master/tableOps/create/ChooseDir.java
##########
@@ -60,9 +63,16 @@ public long isReady(long tid, Master environment) {
 
   @Override
   public void undo(long tid, Master master) throws Exception {
-    Path p = tableInfo.getSplitDirsPath();
-    FileSystem fs = p.getFileSystem(master.getContext().getHadoopConf());
-    fs.delete(p, true);
+    // Clean up split files if ChooseDir operation fails
+    try {
+      if (tableInfo.getInitialSplitSize() > 0) {
+        Path p = tableInfo.getSplitDirsPath();
+        FileSystem fs = p.getFileSystem(master.getContext().getHadoopConf());
+        fs.delete(p, true);
+      }
+    } catch (NullPointerException | IOException e) {
+      log.error("Failed to undo ChooseDir operation", e);

Review comment:
       I made the requested error changes or each of the catch blocks. Let me know if there is anything else I need to tweak.




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