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



##########
File path: 
server/manager/src/main/java/org/apache/accumulo/master/tableOps/create/FinishCreateTable.java
##########
@@ -62,17 +67,23 @@ public long isReady(long tid, Master environment) {
     env.getEventCoordinator().event("Created table %s ", 
tableInfo.getTableName());
 
     if (tableInfo.getInitialSplitSize() > 0) {
-      cleanupSplitFiles(env);
+      cleanupSplitFiles(tid, env);
     }
     return null;
   }
 
-  private void cleanupSplitFiles(Master env) throws IOException {
+  private void cleanupSplitFiles(long tid, Master env) throws IOException {
     // it is sufficient to delete from the parent, because both files are in 
the same directory, and
     // we want to delete the directory also
-    Path p = tableInfo.getSplitPath().getParent();
-    FileSystem fs = p.getFileSystem(env.getContext().getHadoopConf());
-    fs.delete(p, true);
+    try {
+      Path p = tableInfo.getSplitPath().getParent();
+      FileSystem fs = p.getFileSystem(env.getContext().getHadoopConf());
+      fs.delete(p, true);
+    } catch (NullPointerException | IOException e) {
+      var spdir = 
Optional.ofNullable(tableInfo).map(TableInfo::getSplitDirsPath).orElse(null);
+      log.error("{} Failed to cleanup splits file after table was created, 
split dir {} ",
+          FateTxId.formatTid(tid), spdir, e);
+    }

Review comment:
       > I don't think it's possible for tableInfo to be null here, given how 
this class is constructed. And, if the split size is >0, it's also not possible 
for the splits file locations to be null. 
   
   I agree. I wasn't quite sure so I kept the null exception handling in there. 
I will remove and look to make the other changes you suggested as well. 




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


Reply via email to