This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit d089b687a6fcbb3fb983d0eb4134f6497215f18b Merge: 0a2c87bef7 a11faa3db8 Author: Dave Marion <[email protected]> AuthorDate: Fri Sep 25 14:12:50 2026 +0000 Merge branch '2.1' .../accumulo/manager/FateServiceHandler.java | 47 +++++++++++++++------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --cc server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java index 28c681f474,949f2a79cf..e6db2aebb5 --- a/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java +++ b/server/manager/src/main/java/org/apache/accumulo/manager/FateServiceHandler.java @@@ -210,28 -188,19 +210,15 @@@ class FateServiceHandler implements Fat TimeType timeType = TimeType.valueOf(ByteBufferUtil.toString(arguments.get(1))); InitialTableState initialTableState = InitialTableState.valueOf(ByteBufferUtil.toString(arguments.get(2))); - int splitCount = Integer.parseInt(ByteBufferUtil.toString(arguments.get(3))); + TabletAvailability initialTabletAvailability = + TabletAvailability.valueOf(ByteBufferUtil.toString(arguments.get(3))); + int splitCount = Integer.parseInt(ByteBufferUtil.toString(arguments.get(4))); 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 { - namespaceId = Namespaces.getNamespaceId(manager.getContext(), - TableNameUtil.qualify(tableName).getFirst()); - } catch (NamespaceNotFoundException e) { - throw new ThriftTableOperationException(null, tableName, tableOp, - TableOperationExceptionType.NAMESPACE_NOTFOUND, ""); - } + NamespaceId namespaceId = ClientServiceHandler.checkNamespaceId(manager.getContext(), + TableNameUtil.qualify(tableName).namespaceName(), tableOp); - if (!manager.security.canCreateTable(c, tableName, namespaceId)) { + if (!security.canCreateTable(c, tableName, namespaceId)) { throw new ThriftSecurityException(c.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED); } @@@ -248,14 -212,29 +235,31 @@@ 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."; + + " splits and initial tabletAvailability of " + initialTabletAvailability; - manager.fate().seedTransaction(op.toString(), opid, + manager.fateClient(type).seedTransaction(op, fateId, new TraceRepo<>(new CreateTable(c.getPrincipal(), tableName, timeType, options, - splitsPath, splitCount, splitsDirsPath, initialTableState, namespaceId)), + splitsPath, splitCount, splitsDirsPath, initialTableState, + // Set the default tablet to be auto-mergeable with other tablets if it is split + initialTabletAvailability, namespaceId, TabletMergeability.always())), autoCleanup, goalMessage); break; @@@ -974,12 -878,26 +978,27 @@@ 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) + public boolean cancelFateOperation(TInfo tinfo, TCredentials credentials, TFateId opid) throws ThriftSecurityException, ThriftNotActiveServiceException { + FateId fateId = FateId.fromThrift(opid); - if (!manager.security.canPerformSystemActions(credentials)) { + if (!security.canPerformSystemActions(credentials)) { throw new ThriftSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED); }
