Search in sources :

Example 71 with InvalidPathException

use of alluxio.exception.InvalidPathException in project alluxio by Alluxio.

the class DefaultFileSystemMaster method updateMount.

@Override
public void updateMount(AlluxioURI alluxioPath, MountContext context) throws FileAlreadyExistsException, FileDoesNotExistException, InvalidPathException, IOException, AccessControlException {
    LockingScheme lockingScheme = createLockingScheme(alluxioPath, context.getOptions().getCommonOptions(), LockPattern.WRITE_EDGE);
    try (RpcContext rpcContext = createRpcContext(context);
        LockedInodePath inodePath = mInodeTree.lockInodePath(lockingScheme.getPath(), lockingScheme.getPattern());
        FileSystemMasterAuditContext auditContext = createAuditContext("updateMount", alluxioPath, null, inodePath.getParentInodeOrNull())) {
        try {
            mPermissionChecker.checkParentPermission(Mode.Bits.WRITE, inodePath);
        } catch (AccessControlException e) {
            auditContext.setAllowed(false);
            throw e;
        }
        MountInfo mountInfo = mMountTable.getMountTable().get(alluxioPath.getPath());
        if (mountInfo == null) {
            throw new InvalidPathException("Failed to update mount properties for " + inodePath.getUri() + ". Please ensure the path is an existing mount point.");
        }
        updateMountInternal(rpcContext, inodePath, mountInfo.getUfsUri(), mountInfo, context);
        auditContext.setSucceeded(true);
    }
}
Also used : LockedInodePath(alluxio.master.file.meta.LockedInodePath) LockingScheme(alluxio.master.file.meta.LockingScheme) AccessControlException(alluxio.exception.AccessControlException) MountInfo(alluxio.master.file.meta.options.MountInfo) InvalidPathException(alluxio.exception.InvalidPathException)

Example 72 with InvalidPathException

use of alluxio.exception.InvalidPathException in project alluxio by Alluxio.

the class DefaultFileSystemMaster method getFileInfoInternal.

/**
 * @param inodePath the {@link LockedInodePath} to get the {@link FileInfo} for
 * @return the {@link FileInfo} for the given inode
 */
private FileInfo getFileInfoInternal(LockedInodePath inodePath, Counter counter) throws FileDoesNotExistException, UnavailableException {
    Inode inode = inodePath.getInode();
    AlluxioURI uri = inodePath.getUri();
    FileInfo fileInfo = inode.generateClientFileInfo(uri.toString());
    if (fileInfo.isFolder()) {
        fileInfo.setLength(inode.asDirectory().getChildCount());
    }
    fileInfo.setInMemoryPercentage(getInMemoryPercentage(inode));
    fileInfo.setInAlluxioPercentage(getInAlluxioPercentage(inode));
    if (inode.isFile()) {
        try {
            fileInfo.setFileBlockInfos(getFileBlockInfoListInternal(inodePath));
        } catch (InvalidPathException e) {
            throw new FileDoesNotExistException(e.getMessage(), e);
        }
    }
    // Rehydrate missing block-infos for persisted files.
    if (fileInfo.isCompleted() && fileInfo.getBlockIds().size() > fileInfo.getFileBlockInfos().size() && inode.isPersisted()) {
        List<Long> missingBlockIds = fileInfo.getBlockIds().stream().filter((bId) -> fileInfo.getFileBlockInfo(bId) != null).collect(Collectors.toList());
        LOG.warn("BlockInfo missing for file: {}. BlockIdsWithMissingInfos: {}", inodePath.getUri(), missingBlockIds.stream().map(Object::toString).collect(Collectors.joining(",")));
        // Remove old block metadata from block-master before re-committing.
        mBlockMaster.removeBlocks(fileInfo.getBlockIds(), true);
        // Commit all the file blocks (without locations) so the metadata for the block exists.
        commitBlockInfosForFile(fileInfo.getBlockIds(), fileInfo.getLength(), fileInfo.getBlockSizeBytes());
        // Reset file-block-info list with the new list.
        try {
            fileInfo.setFileBlockInfos(getFileBlockInfoListInternal(inodePath));
        } catch (InvalidPathException e) {
            throw new FileDoesNotExistException(String.format("Hydration failed for file: %s", inodePath.getUri()), e);
        }
    }
    fileInfo.setXAttr(inode.getXAttr());
    MountTable.Resolution resolution;
    try {
        resolution = mMountTable.resolve(uri);
    } catch (InvalidPathException e) {
        throw new FileDoesNotExistException(e.getMessage(), e);
    }
    AlluxioURI resolvedUri = resolution.getUri();
    fileInfo.setUfsPath(resolvedUri.toString());
    fileInfo.setMountId(resolution.getMountId());
    if (counter == null) {
        Metrics.getUfsOpsSavedCounter(resolution.getUfsMountPointUri(), Metrics.UFSOps.GET_FILE_INFO).inc();
    } else {
        counter.inc();
    }
    Metrics.FILE_INFOS_GOT.inc();
    return fileInfo;
}
Also used : SystemClock(alluxio.clock.SystemClock) OK(alluxio.master.file.InodeSyncStream.SyncStatus.OK) Server(alluxio.Server) PropertyKey(alluxio.conf.PropertyKey) StringUtils(org.apache.commons.lang3.StringUtils) CloseableResource(alluxio.resource.CloseableResource) Map(java.util.Map) LockedInodePathList(alluxio.master.file.meta.LockedInodePathList) WorkerHeartbeatContext(alluxio.master.file.contexts.WorkerHeartbeatContext) InodeDirectory(alluxio.master.file.meta.InodeDirectory) ClientContext(alluxio.ClientContext) ReadOnlyInodeStore(alluxio.master.metastore.ReadOnlyInodeStore) UfsSyncPathCache(alluxio.master.file.meta.UfsSyncPathCache) ConnectionFailedException(alluxio.exception.ConnectionFailedException) ProtobufUtils(alluxio.master.ProtobufUtils) UpdateInodeFileEntry(alluxio.proto.journal.File.UpdateInodeFileEntry) Stream(java.util.stream.Stream) InodeTree(alluxio.master.file.meta.InodeTree) OperationContext(alluxio.master.file.contexts.OperationContext) SetAclAction(alluxio.grpc.SetAclAction) GetStatusPOptions(alluxio.grpc.GetStatusPOptions) InternalOperationContext(alluxio.master.file.contexts.InternalOperationContext) InodeFile(alluxio.master.file.meta.InodeFile) PersistConfig(alluxio.job.plan.persist.PersistConfig) AuthType(alluxio.security.authentication.AuthType) Supplier(java.util.function.Supplier) UnderFileSystemUtils(alluxio.util.UnderFileSystemUtils) LockedInodePath(alluxio.master.file.meta.LockedInodePath) GrpcUtils(alluxio.grpc.GrpcUtils) MountInfo(alluxio.master.file.meta.options.MountInfo) AlluxioURI(alluxio.AlluxioURI) MountPOptions(alluxio.grpc.MountPOptions) MetricsSystem(alluxio.metrics.MetricsSystem) UpdateInodeEntry(alluxio.proto.journal.File.UpdateInodeEntry) RetryPolicy(alluxio.retry.RetryPolicy) PersistFile(alluxio.wire.PersistFile) IdUtils(alluxio.util.IdUtils) PersistenceState(alluxio.master.file.meta.PersistenceState) IOException(java.io.IOException) UfsAbsentPathCache(alluxio.master.file.meta.UfsAbsentPathCache) TreeMap(java.util.TreeMap) UfsStatus(alluxio.underfs.UfsStatus) UfsFileStatus(alluxio.underfs.UfsFileStatus) Preconditions(com.google.common.base.Preconditions) FreeContext(alluxio.master.file.contexts.FreeContext) AclEntry(alluxio.security.authorization.AclEntry) Reconfigurable(alluxio.conf.Reconfigurable) MountTable(alluxio.master.file.meta.MountTable) CommonUtils(alluxio.util.CommonUtils) InodeLockManager(alluxio.master.file.meta.InodeLockManager) InodePathPair(alluxio.master.file.meta.InodePathPair) FailedPreconditionException(alluxio.exception.status.FailedPreconditionException) Fingerprint(alluxio.underfs.Fingerprint) AclEntryType(alluxio.security.authorization.AclEntryType) DeleteContext(alluxio.master.file.contexts.DeleteContext) LoadMetadataContext(alluxio.master.file.contexts.LoadMetadataContext) RenameEntry(alluxio.proto.journal.File.RenameEntry) HeartbeatThread(alluxio.heartbeat.HeartbeatThread) InvalidPathException(alluxio.exception.InvalidPathException) ListStatusContext(alluxio.master.file.contexts.ListStatusContext) MetricKey(alluxio.metrics.MetricKey) SyncPointInfo(alluxio.wire.SyncPointInfo) FileSystemMasterCommonPOptions(alluxio.grpc.FileSystemMasterCommonPOptions) Journaled(alluxio.master.journal.Journaled) ImmutableSet(com.google.common.collect.ImmutableSet) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) CheckpointName(alluxio.master.journal.checkpoint.CheckpointName) Collectors(java.util.stream.Collectors) MkdirsOptions(alluxio.underfs.options.MkdirsOptions) InodeStore(alluxio.master.metastore.InodeStore) SecurityUtils(alluxio.util.SecurityUtils) CoreMasterContext(alluxio.master.CoreMasterContext) CommandType(alluxio.wire.CommandType) SetAttributeContext(alluxio.master.file.contexts.SetAttributeContext) FileAlreadyCompletedException(alluxio.exception.FileAlreadyCompletedException) Function(java.util.function.Function) Stack(java.util.Stack) MetricInfo(alluxio.metrics.MetricInfo) ExistsContext(alluxio.master.file.contexts.ExistsContext) HashSet(java.util.HashSet) Constants(alluxio.Constants) FileSystemMasterView(alluxio.master.file.meta.FileSystemMasterView) NOT_NEEDED(alluxio.master.file.InodeSyncStream.SyncStatus.NOT_NEEDED) ExecutorService(java.util.concurrent.ExecutorService) AuthenticatedClientUser(alluxio.security.authentication.AuthenticatedClientUser) SetAclEntry(alluxio.proto.journal.File.SetAclEntry) Logger(org.slf4j.Logger) Pair(alluxio.collections.Pair) AsyncUserAccessAuditLogWriter(alluxio.master.audit.AsyncUserAccessAuditLogWriter) NotFoundException(alluxio.exception.status.NotFoundException) LockResource(alluxio.resource.LockResource) UnexpectedAlluxioException(alluxio.exception.UnexpectedAlluxioException) CallTracker(alluxio.master.file.contexts.CallTracker) UfsBlockLocationCache(alluxio.master.file.meta.UfsBlockLocationCache) CreateDirectoryContext(alluxio.master.file.contexts.CreateDirectoryContext) CreateFileContext(alluxio.master.file.contexts.CreateFileContext) Arrays(java.util.Arrays) BlockInfo(alluxio.wire.BlockInfo) PersistCommandOptions(alluxio.wire.PersistCommandOptions) GrpcService(alluxio.grpc.GrpcService) TimeSeries(alluxio.metrics.TimeSeries) WorkerInfo(alluxio.wire.WorkerInfo) DelegatingJournaled(alluxio.master.journal.DelegatingJournaled) PreconditionMessage(alluxio.exception.PreconditionMessage) AuditContext(alluxio.master.audit.AuditContext) DescendantType(alluxio.file.options.DescendantType) ActiveSyncManager(alluxio.master.file.activesync.ActiveSyncManager) Set(java.util.Set) AlluxioException(alluxio.exception.AlluxioException) GetStatusContext(alluxio.master.file.contexts.GetStatusContext) UnderFileSystem(alluxio.underfs.UnderFileSystem) JobInfo(alluxio.job.wire.JobInfo) ServiceType(alluxio.grpc.ServiceType) Iterables(com.google.common.collect.Iterables) CountingRetry(alluxio.retry.CountingRetry) UnderFileSystemConfiguration(alluxio.underfs.UnderFileSystemConfiguration) Callable(java.util.concurrent.Callable) InodeDirectoryView(alluxio.master.file.meta.InodeDirectoryView) Mode(alluxio.security.authorization.Mode) Metric(alluxio.metrics.Metric) ArrayList(java.util.ArrayList) ReconfigurableRegistry(alluxio.conf.ReconfigurableRegistry) BlockInfoException(alluxio.exception.BlockInfoException) InodeDirectoryIdGenerator(alluxio.master.file.meta.InodeDirectoryIdGenerator) Builder(alluxio.proto.journal.File.UpdateInodeFileEntry.Builder) Nullable(javax.annotation.Nullable) LoadDescendantPType(alluxio.grpc.LoadDescendantPType) MountContext(alluxio.master.file.contexts.MountContext) MetricRegistry(com.codahale.metrics.MetricRegistry) FileAlreadyExistsException(alluxio.exception.FileAlreadyExistsException) RenameContext(alluxio.master.file.contexts.RenameContext) FileSystemCommandOptions(alluxio.wire.FileSystemCommandOptions) JobMasterClientPool(alluxio.client.job.JobMasterClientPool) FileSystemCommand(alluxio.wire.FileSystemCommand) ExecutorServiceFactory(alluxio.util.executor.ExecutorServiceFactory) UfsInfo(alluxio.wire.UfsInfo) JournaledGroup(alluxio.master.journal.JournaledGroup) ExecutorServiceFactories(alluxio.util.executor.ExecutorServiceFactories) NotThreadSafe(javax.annotation.concurrent.NotThreadSafe) ServerInterceptors(io.grpc.ServerInterceptors) MasterUfsManager(alluxio.underfs.MasterUfsManager) ScheduleAsyncPersistenceContext(alluxio.master.file.contexts.ScheduleAsyncPersistenceContext) LoggerFactory(org.slf4j.LoggerFactory) FileBlockInfo(alluxio.wire.FileBlockInfo) NewBlockEntry(alluxio.proto.journal.File.NewBlockEntry) LogUtils(alluxio.util.LogUtils) ResourceExhaustedException(alluxio.exception.status.ResourceExhaustedException) Counter(com.codahale.metrics.Counter) JobMasterClient(alluxio.client.job.JobMasterClient) CheckConsistencyContext(alluxio.master.file.contexts.CheckConsistencyContext) InvalidArgumentException(alluxio.exception.status.InvalidArgumentException) LockPattern(alluxio.master.file.meta.InodeTree.LockPattern) TtlAction(alluxio.grpc.TtlAction) ServerConfiguration(alluxio.conf.ServerConfiguration) ImmutableMap(com.google.common.collect.ImmutableMap) CompleteFileContext(alluxio.master.file.contexts.CompleteFileContext) TimeSeriesStore(alluxio.master.metrics.TimeSeriesStore) PermissionDeniedException(alluxio.exception.status.PermissionDeniedException) LoadMetadataPOptions(alluxio.grpc.LoadMetadataPOptions) Streams(com.google.common.collect.Streams) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) Sets(com.google.common.collect.Sets) FileNotFoundException(java.io.FileNotFoundException) DelegatingReadOnlyInodeStore(alluxio.master.metastore.DelegatingReadOnlyInodeStore) AccessControlException(alluxio.exception.AccessControlException) File(alluxio.proto.journal.File) List(java.util.List) InvalidFileSizeException(alluxio.exception.InvalidFileSizeException) FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) LoadMetadataPType(alluxio.grpc.LoadMetadataPType) ModeUtils(alluxio.util.ModeUtils) Gauge(com.codahale.metrics.Gauge) UFS_OP_SAVED_PREFIX(alluxio.metrics.MetricInfo.UFS_OP_SAVED_PREFIX) UfsManager(alluxio.underfs.UfsManager) JournalContext(alluxio.master.journal.JournalContext) SortedMap(java.util.SortedMap) UnavailableException(alluxio.exception.status.UnavailableException) MountPointInfo(alluxio.wire.MountPointInfo) JobMasterClientContext(alluxio.worker.job.JobMasterClientContext) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) HashMap(java.util.HashMap) SetAttributePOptions(alluxio.grpc.SetAttributePOptions) BlockId(alluxio.master.block.BlockId) BlockMaster(alluxio.master.block.BlockMaster) CheckAccessContext(alluxio.master.file.contexts.CheckAccessContext) JournalEntry(alluxio.proto.journal.Journal.JournalEntry) DeletePOptions(alluxio.grpc.DeletePOptions) PathUtils(alluxio.util.io.PathUtils) DirectoryNotEmptyException(alluxio.exception.DirectoryNotEmptyException) ClientIpAddressInjector(alluxio.security.authentication.ClientIpAddressInjector) PrefixList(alluxio.collections.PrefixList) SetAclContext(alluxio.master.file.contexts.SetAclContext) CoreMaster(alluxio.master.CoreMaster) HeartbeatContext(alluxio.heartbeat.HeartbeatContext) Iterator(java.util.Iterator) ExceptionMessage(alluxio.exception.ExceptionMessage) ThreadFactoryUtils(alluxio.util.ThreadFactoryUtils) ProtoUtils(alluxio.util.proto.ProtoUtils) TimeUnit(java.util.concurrent.TimeUnit) BlockLocation(alluxio.wire.BlockLocation) FAILED(alluxio.master.file.InodeSyncStream.SyncStatus.FAILED) LockingScheme(alluxio.master.file.meta.LockingScheme) FileInfo(alluxio.wire.FileInfo) VisibleForTesting(com.google.common.annotations.VisibleForTesting) UfsMode(alluxio.underfs.UfsMode) Collections(java.util.Collections) Inode(alluxio.master.file.meta.Inode) FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) Inode(alluxio.master.file.meta.Inode) FileInfo(alluxio.wire.FileInfo) MountTable(alluxio.master.file.meta.MountTable) InvalidPathException(alluxio.exception.InvalidPathException) AlluxioURI(alluxio.AlluxioURI)

Example 73 with InvalidPathException

use of alluxio.exception.InvalidPathException in project alluxio by Alluxio.

the class DefaultFileSystemMaster method listStatus.

@Override
public void listStatus(AlluxioURI path, ListStatusContext context, ResultStream<FileInfo> resultStream) throws AccessControlException, FileDoesNotExistException, InvalidPathException, IOException {
    Metrics.GET_FILE_INFO_OPS.inc();
    LockingScheme lockingScheme = new LockingScheme(path, LockPattern.READ, false);
    boolean ufsAccessed = false;
    try (RpcContext rpcContext = createRpcContext(context);
        FileSystemMasterAuditContext auditContext = createAuditContext("listStatus", path, null, null)) {
        DescendantType descendantType = context.getOptions().getRecursive() ? DescendantType.ALL : DescendantType.ONE;
        if (!syncMetadata(rpcContext, path, context.getOptions().getCommonOptions(), descendantType, auditContext, LockedInodePath::getInodeOrNull, (inodePath, permChecker) -> permChecker.checkPermission(Mode.Bits.READ, inodePath), false).equals(NOT_NEEDED)) {
            // If synced, do not load metadata.
            context.getOptions().setLoadMetadataType(LoadMetadataPType.NEVER);
            ufsAccessed = true;
        }
        /*
      See the comments in #getFileIdInternal for an explanation on why the loop here is required.
       */
        DescendantType loadDescendantType;
        if (context.getOptions().getLoadMetadataType() == LoadMetadataPType.NEVER) {
            loadDescendantType = DescendantType.NONE;
        } else if (context.getOptions().getRecursive()) {
            loadDescendantType = DescendantType.ALL;
        } else {
            loadDescendantType = DescendantType.ONE;
        }
        // load metadata for 1 level of descendants, or all descendants if recursive
        LoadMetadataContext loadMetadataContext = LoadMetadataContext.mergeFrom(LoadMetadataPOptions.newBuilder().setCreateAncestors(true).setLoadType(context.getOptions().getLoadMetadataType()).setLoadDescendantType(GrpcUtils.toProto(loadDescendantType)).setCommonOptions(FileSystemMasterCommonPOptions.newBuilder().setTtl(context.getOptions().getCommonOptions().getTtl()).setTtlAction(context.getOptions().getCommonOptions().getTtlAction())));
        boolean loadMetadata = false;
        boolean run = true;
        while (run) {
            run = false;
            if (loadMetadata) {
                loadMetadataIfNotExist(rpcContext, path, loadMetadataContext, false);
                ufsAccessed = true;
            }
            // We just synced; the new lock pattern should not sync.
            try (LockedInodePath inodePath = mInodeTree.lockInodePath(lockingScheme)) {
                auditContext.setSrcInode(inodePath.getInodeOrNull());
                try {
                    mPermissionChecker.checkPermission(Mode.Bits.READ, inodePath);
                } catch (AccessControlException e) {
                    auditContext.setAllowed(false);
                    throw e;
                }
                if (!loadMetadata) {
                    Inode inode;
                    boolean isLoaded = true;
                    if (inodePath.fullPathExists()) {
                        inode = inodePath.getInode();
                        if (inode.isDirectory() && context.getOptions().getLoadMetadataType() != LoadMetadataPType.ALWAYS) {
                            InodeDirectory inodeDirectory = inode.asDirectory();
                            isLoaded = inodeDirectory.isDirectChildrenLoaded();
                            if (context.getOptions().getRecursive()) {
                                isLoaded = areDescendantsLoaded(inodeDirectory);
                            }
                            if (isLoaded) {
                                // no need to load again.
                                loadMetadataContext.getOptions().setLoadDescendantType(LoadDescendantPType.NONE);
                            }
                        }
                    } else {
                        checkLoadMetadataOptions(context.getOptions().getLoadMetadataType(), inodePath.getUri());
                    }
                    if (shouldLoadMetadataIfNotExists(inodePath, loadMetadataContext)) {
                        loadMetadata = true;
                        run = true;
                        continue;
                    }
                }
                ensureFullPathAndUpdateCache(inodePath);
                auditContext.setSrcInode(inodePath.getInode());
                MountTable.Resolution resolution;
                if (!context.getOptions().hasLoadMetadataOnly() || !context.getOptions().getLoadMetadataOnly()) {
                    DescendantType descendantTypeForListStatus = (context.getOptions().getRecursive()) ? DescendantType.ALL : DescendantType.ONE;
                    try {
                        resolution = mMountTable.resolve(path);
                    } catch (InvalidPathException e) {
                        throw new FileDoesNotExistException(e.getMessage(), e);
                    }
                    listStatusInternal(context, rpcContext, inodePath, auditContext, descendantTypeForListStatus, resultStream, 0, Metrics.getUfsOpsSavedCounter(resolution.getUfsMountPointUri(), Metrics.UFSOps.GET_FILE_INFO));
                    if (!ufsAccessed) {
                        Metrics.getUfsOpsSavedCounter(resolution.getUfsMountPointUri(), Metrics.UFSOps.LIST_STATUS).inc();
                    }
                }
                auditContext.setSucceeded(true);
                Metrics.FILE_INFOS_GOT.inc();
            }
        }
    }
}
Also used : FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) AccessControlException(alluxio.exception.AccessControlException) MountTable(alluxio.master.file.meta.MountTable) InvalidPathException(alluxio.exception.InvalidPathException) LockedInodePath(alluxio.master.file.meta.LockedInodePath) InodeDirectory(alluxio.master.file.meta.InodeDirectory) LoadMetadataContext(alluxio.master.file.contexts.LoadMetadataContext) Inode(alluxio.master.file.meta.Inode) LockingScheme(alluxio.master.file.meta.LockingScheme) DescendantType(alluxio.file.options.DescendantType)

Example 74 with InvalidPathException

use of alluxio.exception.InvalidPathException in project alluxio by Alluxio.

the class DefaultFileSystemMaster method mountInternal.

/**
 * Updates the mount table with the specified mount point. The mount options may be updated during
 * this method.
 *
 * @param journalContext the journal context
 * @param inodePath the Alluxio mount point
 * @param ufsPath the UFS endpoint to mount
 * @param mountId the mount id
 * @param context the mount context (may be updated)
 */
private void mountInternal(Supplier<JournalContext> journalContext, LockedInodePath inodePath, AlluxioURI ufsPath, long mountId, MountContext context) throws FileAlreadyExistsException, InvalidPathException, IOException {
    AlluxioURI alluxioPath = inodePath.getUri();
    // Adding the mount point will not create the UFS instance and thus not connect to UFS
    mUfsManager.addMount(mountId, new AlluxioURI(ufsPath.toString()), UnderFileSystemConfiguration.defaults(ServerConfiguration.global()).setReadOnly(context.getOptions().getReadOnly()).setShared(context.getOptions().getShared()).createMountSpecificConf(context.getOptions().getPropertiesMap()));
    try {
        prepareForMount(ufsPath, mountId, context);
        // Check that the alluxioPath we're creating doesn't shadow a path in the parent UFS
        MountTable.Resolution resolution = mMountTable.resolve(alluxioPath);
        try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) {
            String ufsResolvedPath = resolution.getUri().getPath();
            if (ufsResource.get().exists(ufsResolvedPath)) {
                throw new IOException(ExceptionMessage.MOUNT_PATH_SHADOWS_PARENT_UFS.getMessage(alluxioPath, ufsResolvedPath));
            }
        }
        // Add the mount point. This will only succeed if we are not mounting a prefix of an existing
        // mount.
        mMountTable.add(journalContext, alluxioPath, ufsPath, mountId, context.getOptions().build());
    } catch (Exception e) {
        mUfsManager.removeMount(mountId);
        throw e;
    }
}
Also used : IOException(java.io.IOException) MountTable(alluxio.master.file.meta.MountTable) UnderFileSystem(alluxio.underfs.UnderFileSystem) ConnectionFailedException(alluxio.exception.ConnectionFailedException) IOException(java.io.IOException) FailedPreconditionException(alluxio.exception.status.FailedPreconditionException) InvalidPathException(alluxio.exception.InvalidPathException) FileAlreadyCompletedException(alluxio.exception.FileAlreadyCompletedException) NotFoundException(alluxio.exception.status.NotFoundException) UnexpectedAlluxioException(alluxio.exception.UnexpectedAlluxioException) AlluxioException(alluxio.exception.AlluxioException) BlockInfoException(alluxio.exception.BlockInfoException) FileAlreadyExistsException(alluxio.exception.FileAlreadyExistsException) ResourceExhaustedException(alluxio.exception.status.ResourceExhaustedException) InvalidArgumentException(alluxio.exception.status.InvalidArgumentException) PermissionDeniedException(alluxio.exception.status.PermissionDeniedException) FileNotFoundException(java.io.FileNotFoundException) AccessControlException(alluxio.exception.AccessControlException) InvalidFileSizeException(alluxio.exception.InvalidFileSizeException) FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) UnavailableException(alluxio.exception.status.UnavailableException) DirectoryNotEmptyException(alluxio.exception.DirectoryNotEmptyException) AlluxioURI(alluxio.AlluxioURI)

Example 75 with InvalidPathException

use of alluxio.exception.InvalidPathException in project alluxio by Alluxio.

the class DefaultFileSystemMaster method recordActiveSyncTxid.

@Override
public boolean recordActiveSyncTxid(long txId, long mountId) {
    MountInfo mountInfo = mMountTable.getMountInfo(mountId);
    if (mountInfo == null) {
        return false;
    }
    AlluxioURI mountPath = mountInfo.getAlluxioUri();
    try (RpcContext rpcContext = createRpcContext();
        LockedInodePath inodePath = mInodeTree.lockFullInodePath(mountPath, LockPattern.READ)) {
        File.ActiveSyncTxIdEntry txIdEntry = File.ActiveSyncTxIdEntry.newBuilder().setTxId(txId).setMountId(mountId).build();
        rpcContext.journal(JournalEntry.newBuilder().setActiveSyncTxId(txIdEntry).build());
    } catch (UnavailableException | InvalidPathException | FileDoesNotExistException e) {
        LOG.warn("Exception when recording activesync txid, path {}, exception {}", mountPath, e);
        return false;
    }
    return true;
}
Also used : LockedInodePath(alluxio.master.file.meta.LockedInodePath) FileDoesNotExistException(alluxio.exception.FileDoesNotExistException) UnavailableException(alluxio.exception.status.UnavailableException) MountInfo(alluxio.master.file.meta.options.MountInfo) InodeFile(alluxio.master.file.meta.InodeFile) PersistFile(alluxio.wire.PersistFile) File(alluxio.proto.journal.File) InvalidPathException(alluxio.exception.InvalidPathException) AlluxioURI(alluxio.AlluxioURI)

Aggregations

InvalidPathException (alluxio.exception.InvalidPathException)82 AlluxioURI (alluxio.AlluxioURI)51 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)44 IOException (java.io.IOException)40 ArrayList (java.util.ArrayList)25 FileAlreadyExistsException (alluxio.exception.FileAlreadyExistsException)19 AccessControlException (alluxio.exception.AccessControlException)17 AlluxioException (alluxio.exception.AlluxioException)17 LockedInodePath (alluxio.master.file.meta.LockedInodePath)17 MountTable (alluxio.master.file.meta.MountTable)14 UnderFileSystem (alluxio.underfs.UnderFileSystem)14 Inode (alluxio.master.file.meta.Inode)12 MountInfo (alluxio.master.file.meta.options.MountInfo)11 BlockInfoException (alluxio.exception.BlockInfoException)10 UnavailableException (alluxio.exception.status.UnavailableException)9 LockResource (alluxio.resource.LockResource)9 DirectoryNotEmptyException (alluxio.exception.DirectoryNotEmptyException)8 InodeDirectory (alluxio.master.file.meta.InodeDirectory)8 Test (org.junit.Test)8 URIStatus (alluxio.client.file.URIStatus)7