Search in sources :

Example 1 with CacheEntry

use of org.apache.hadoop.ipc.RetryCache.CacheEntry in project hadoop by apache.

the class NameNodeRpcServer method unsetErasureCodingPolicy.

// ClientProtocol
@Override
public void unsetErasureCodingPolicy(String src) throws IOException {
    checkNNStartup();
    final CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        return;
    }
    boolean success = false;
    try {
        namesystem.unsetErasureCodingPolicy(src, cacheEntry != null);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
}
Also used : CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 2 with CacheEntry

use of org.apache.hadoop.ipc.RetryCache.CacheEntry in project hadoop by apache.

the class NameNodeRpcServer method concat.

// ClientProtocol
@Override
public void concat(String trg, String[] src) throws IOException {
    checkNNStartup();
    namesystem.checkOperation(OperationCategory.WRITE);
    CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        // Return previous response
        return;
    }
    boolean success = false;
    try {
        namesystem.concat(trg, src, cacheEntry != null);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
}
Also used : CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 3 with CacheEntry

use of org.apache.hadoop.ipc.RetryCache.CacheEntry in project hadoop by apache.

the class NameNodeRpcServer method createSymlink.

// ClientProtocol
@Override
public void createSymlink(String target, String link, FsPermission dirPerms, boolean createParent) throws IOException {
    checkNNStartup();
    namesystem.checkOperation(OperationCategory.WRITE);
    CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        // Return previous response
        return;
    }
    /* We enforce the MAX_PATH_LENGTH limit even though a symlink target
     * URI may refer to a non-HDFS file system. 
     */
    if (!checkPathLength(link)) {
        throw new IOException("Symlink path exceeds " + MAX_PATH_LENGTH + " character limit");
    }
    final UserGroupInformation ugi = getRemoteUser();
    boolean success = false;
    try {
        PermissionStatus perm = new PermissionStatus(ugi.getShortUserName(), null, dirPerms);
        namesystem.createSymlink(target, link, perm, createParent, cacheEntry != null);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
}
Also used : IOException(java.io.IOException) CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry) UserGroupInformation(org.apache.hadoop.security.UserGroupInformation) PermissionStatus(org.apache.hadoop.fs.permission.PermissionStatus)

Example 4 with CacheEntry

use of org.apache.hadoop.ipc.RetryCache.CacheEntry in project hadoop by apache.

the class NameNodeRpcServer method deleteSnapshot.

@Override
public void deleteSnapshot(String snapshotRoot, String snapshotName) throws IOException {
    checkNNStartup();
    if (snapshotName == null || snapshotName.isEmpty()) {
        throw new IOException("The snapshot name is null or empty.");
    }
    namesystem.checkOperation(OperationCategory.WRITE);
    metrics.incrDeleteSnapshotOps();
    CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        // Return previous response
        return;
    }
    boolean success = false;
    try {
        namesystem.deleteSnapshot(snapshotRoot, snapshotName, cacheEntry != null);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
}
Also used : IOException(java.io.IOException) CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 5 with CacheEntry

use of org.apache.hadoop.ipc.RetryCache.CacheEntry in project hadoop by apache.

the class NameNodeRpcServer method setErasureCodingPolicy.

// ClientProtocol
@Override
public void setErasureCodingPolicy(String src, String ecPolicyName) throws IOException {
    checkNNStartup();
    final CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        return;
    }
    boolean success = false;
    try {
        namesystem.setErasureCodingPolicy(src, ecPolicyName, cacheEntry != null);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
}
Also used : CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Aggregations

CacheEntry (org.apache.hadoop.ipc.RetryCache.CacheEntry)22 IOException (java.io.IOException)5 HashMap (java.util.HashMap)2 LightWeightCache (org.apache.hadoop.util.LightWeightCache)2 Test (org.junit.Test)2 PermissionStatus (org.apache.hadoop.fs.permission.PermissionStatus)1 FSNamesystem (org.apache.hadoop.hdfs.server.namenode.FSNamesystem)1 UserGroupInformation (org.apache.hadoop.security.UserGroupInformation)1