Search in sources :

Example 1 with UfsBlockAccessTokenUnavailableException

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

the class RetryHandlingBlockWorkerClient method lockUfsBlock.

@Override
public LockBlockResource lockUfsBlock(final long blockId, final LockBlockOptions options) throws IOException, AlluxioException {
    int retryInterval = Constants.SECOND_MS;
    RetryPolicy retryPolicy = new TimeoutRetry(Configuration.getLong(PropertyKey.USER_UFS_BLOCK_OPEN_TIMEOUT_MS), retryInterval);
    do {
        LockBlockResource resource = lockBlock(blockId, options);
        if (resource.getResult().getLockBlockStatus().ufsTokenNotAcquired()) {
            LOG.debug("Failed to acquire a UFS read token because of contention for block {} with " + "LockBlockOptions {}", blockId, options);
        } else {
            return resource;
        }
    } while (retryPolicy.attemptRetry());
    throw new UfsBlockAccessTokenUnavailableException(ExceptionMessage.UFS_BLOCK_ACCESS_TOKEN_UNAVAILABLE, blockId, options.getUfsPath());
}
Also used : UfsBlockAccessTokenUnavailableException(alluxio.exception.UfsBlockAccessTokenUnavailableException) LockBlockResource(alluxio.client.resource.LockBlockResource) TimeoutRetry(alluxio.retry.TimeoutRetry) RetryPolicy(alluxio.retry.RetryPolicy)

Aggregations

LockBlockResource (alluxio.client.resource.LockBlockResource)1 UfsBlockAccessTokenUnavailableException (alluxio.exception.UfsBlockAccessTokenUnavailableException)1 RetryPolicy (alluxio.retry.RetryPolicy)1 TimeoutRetry (alluxio.retry.TimeoutRetry)1