This is an automated email from the ASF dual-hosted git repository.

dlmarion pushed a commit to branch 2.1
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/2.1 by this push:
     new a11faa3db8 Modified order of operations in Fate handler for table 
creation (#6555)
a11faa3db8 is described below

commit a11faa3db8b102cbd5ec376c42cadf1154d24474
Author: Dave Marion <[email protected]>
AuthorDate: Fri Sep 25 09:52:13 2026 -0400

    Modified order of operations in Fate handler for table creation (#6555)
---
 .../accumulo/manager/FateServiceHandler.java       | 46 +++++++++++++++-------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git 
a/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java
 
b/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java
index c15fc8c426..949f2a79cf 100644
--- 
a/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java
+++ 
b/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java
@@ -190,20 +190,6 @@ class FateServiceHandler implements FateService.Iface {
             
InitialTableState.valueOf(ByteBufferUtil.toString(arguments.get(2)));
         int splitCount = 
Integer.parseInt(ByteBufferUtil.toString(arguments.get(3)));
         validateArgumentCount(arguments, tableOp, SPLIT_OFFSET + splitCount);
-        Path splitsPath = null;
-        Path splitsDirsPath = null;
-        if (splitCount > 0) {
-          try {
-            Path tmpDir = mkTempDir(opid);
-            splitsPath = new Path(tmpDir, "splits");
-            splitsDirsPath = new Path(tmpDir, "splitsDirs");
-            writeSplitsToFile(splitsPath, arguments, splitCount, SPLIT_OFFSET);
-          } catch (IOException e) {
-            throw new ThriftTableOperationException(null, tableName, tableOp,
-                TableOperationExceptionType.OTHER,
-                "Exception thrown while writing splits to file system");
-          }
-        }
         NamespaceId namespaceId;
 
         try {
@@ -226,6 +212,23 @@ class FateServiceHandler implements FateService.Iface {
           validateTableProperty(entry.getKey(), entry.getValue(), tableName, 
tableOp);
         }
 
+        Path splitsPath = null;
+        Path splitsDirsPath = null;
+        if (splitCount > 0) {
+          Path tmpDir = null;
+          try {
+            tmpDir = mkTempDir(opid);
+            splitsPath = new Path(tmpDir, "splits");
+            splitsDirsPath = new Path(tmpDir, "splitsDirs");
+            writeSplitsToFile(splitsPath, arguments, splitCount, SPLIT_OFFSET);
+          } catch (IOException e) {
+            cleanupTempDir(tmpDir);
+            throw new ThriftTableOperationException(null, tableName, tableOp,
+                TableOperationExceptionType.OTHER,
+                "Exception thrown while writing splits to file system");
+          }
+        }
+
         goalMessage += "Create table " + tableName + " " + initialTableState + 
" with " + splitCount
             + " splits.";
 
@@ -875,6 +878,21 @@ class FateServiceHandler implements FateService.Iface {
     return p;
   }
 
+  /**
+   * Attempt to recursively delete the given temporary directory, logging any 
errors that occur.
+   *
+   * @param tmpDir the temporary directory to delete
+   */
+  private void cleanupTempDir(Path tmpDir) {
+    if (tmpDir != null) {
+      try {
+        manager.getVolumeManager().deleteRecursively(tmpDir);
+      } catch (IOException e) {
+        log.error("Failed to clean up temporary split files at {}", tmpDir, e);
+      }
+    }
+  }
+
   @Override
   public boolean cancelFateOperation(TInfo tinfo, TCredentials credentials, 
long opid)
       throws ThriftSecurityException, ThriftNotActiveServiceException {

Reply via email to