Source:
public void delete(AlluxioURI path, DeleteContext context) throws IOException, FileDoesNotExistException, DirectoryNotEmptyException, InvalidPathException, AccessControlException { Metrics.DELETE_PATHS_OPS.inc(); try (RpcContext rpcContext = createRpcContext(); FileSystemMasterAuditContext auditContext = createAuditContext("delete", path, null, null)) { syncMetadata(rpcContext, path, context.getOptions().getCommonOptions(), context.getOptions().getRecursive() ? DescendantType.ALL : DescendantType.ONE, auditContext, LockedInodePath::getInodeOrNull, (inodePath, permChecker) -> permChecker.checkParentPermission(Mode.Bits.WRITE, inodePath) ); LockingScheme lockingScheme = createLockingScheme(path, context.getOptions().getCommonOptions(), LockPattern.WRITE_EDGE); try (LockedInodePath inodePath = mInodeTree .lockInodePath(lockingScheme)) { mPermissionChecker.checkParentPermission(Mode.Bits.WRITE, inodePath); if (context.getOptions().getRecursive()) { List<String> failedChildren = new ArrayList<>(); try (LockedInodePathList descendants = mInodeTree.getDescendants(inodePath)) { for (LockedInodePath childPath : descendants) { try { mPermissionChecker.checkPermission(Mode.Bits.WRITE, childPath); mMountTable.checkUnderWritableMountPoint(childPath.getUri()); } catch (AccessControlException e) { failedChildren.add(e.getMessage()); } } if (failedChildren.size() > 0) { throw new AccessControlException(ExceptionMessage.DELETE_FAILED_DIR_CHILDREN .getMessage(path, StringUtils.join(failedChildren, ","))); } } catch (AccessControlException e) { auditContext.setAllowed(false); throw e; } } mMountTable.checkUnderWritableMountPoint(path); if (!inodePath.fullPathExists()) { throw new FileDoesNotExistException(ExceptionMessage.PATH_DOES_NOT_EXIST .getMessage(path)); } deleteInternal(rpcContext, inodePath, context); auditContext.setSucceeded(true); } } }

Target:
public void delete(AlluxioURI path, DeleteContext context) throws IOException, FileDoesNotExistException, DirectoryNotEmptyException, InvalidPathException, AccessControlException { Metrics.DELETE_PATHS_OPS.inc(); try (RpcContext rpcContext = createRpcContext(); FileSystemMasterAuditContext auditContext = createAuditContext("delete", path, null, null)) { syncMetadata(rpcContext, path, context.getOptions().getCommonOptions(), context.getOptions().getRecursive() ? DescendantType.ALL : DescendantType.ONE, auditContext, LockedInodePath::getInodeOrNull, (inodePath, permChecker) -> permChecker.checkParentPermission(Mode.Bits.WRITE, inodePath) ); LockingScheme lockingScheme = createLockingScheme(path, context.getOptions().getCommonOptions(), LockPattern.WRITE_EDGE); try (LockedInodePath inodePath = mInodeTree .lockInodePath(lockingScheme)) { mPermissionChecker.checkParentPermission(Mode.Bits.WRITE, inodePath); if (context.getOptions().getRecursive()) { List<String> failedChildren = new ArrayList<>(); try (LockedInodePathList descendants = mInodeTree.getDescendants(inodePath)) { for (LockedInodePath childPath : descendants) { try { mPermissionChecker.checkPermission(Mode.Bits.WRITE, childPath); if (mMountTable.isMountPoint(childPath.getUri())) { mMountTable.checkUnderWritableMountPoint(childPath.getUri()); } } catch (AccessControlException e) { failedChildren.add(e.getMessage()); } } if (failedChildren.size() > 0) { throw new AccessControlException(ExceptionMessage.DELETE_FAILED_DIR_CHILDREN .getMessage(path, StringUtils.join(failedChildren, ","))); } } catch (AccessControlException e) { auditContext.setAllowed(false); throw e; } } mMountTable.checkUnderWritableMountPoint(path); if (!inodePath.fullPathExists()) { throw new FileDoesNotExistException(ExceptionMessage.PATH_DOES_NOT_EXIST .getMessage(path)); } deleteInternal(rpcContext, inodePath, context); auditContext.setSucceeded(true); } } }