Search in sources :

Example 6 with CacheEntry

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

the class NameNodeRpcServer method rename2.

// ClientProtocol
@Override
public void rename2(String src, String dst, Options.Rename... options) throws IOException {
    checkNNStartup();
    if (stateChangeLog.isDebugEnabled()) {
        stateChangeLog.debug("*DIR* NameNode.rename: " + src + " to " + dst);
    }
    if (!checkPathLength(dst)) {
        throw new IOException("rename: Pathname too long.  Limit " + MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
    }
    namesystem.checkOperation(OperationCategory.WRITE);
    CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        // Return previous response
        return;
    }
    boolean success = false;
    try {
        namesystem.renameTo(src, dst, cacheEntry != null, options);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
    metrics.incrFilesRenamed();
}
Also used : IOException(java.io.IOException) CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 7 with CacheEntry

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

the class NameNodeRpcServer method rename.

@Deprecated
// ClientProtocol
@Override
public boolean rename(String src, String dst) throws IOException {
    checkNNStartup();
    if (stateChangeLog.isDebugEnabled()) {
        stateChangeLog.debug("*DIR* NameNode.rename: " + src + " to " + dst);
    }
    if (!checkPathLength(dst)) {
        throw new IOException("rename: Pathname too long.  Limit " + MAX_PATH_LENGTH + " characters, " + MAX_PATH_DEPTH + " levels.");
    }
    namesystem.checkOperation(OperationCategory.WRITE);
    CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        // Return previous response
        return true;
    }
    boolean ret = false;
    try {
        ret = namesystem.renameTo(src, dst, cacheEntry != null);
    } finally {
        RetryCache.setState(cacheEntry, ret);
    }
    if (ret) {
        metrics.incrFilesRenamed();
    }
    return ret;
}
Also used : IOException(java.io.IOException) CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 8 with CacheEntry

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

the class NameNodeRpcServer method updatePipeline.

// ClientProtocol
@Override
public void updatePipeline(String clientName, ExtendedBlock oldBlock, ExtendedBlock newBlock, DatanodeID[] newNodes, String[] newStorageIDs) 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.updatePipeline(clientName, oldBlock, newBlock, newNodes, newStorageIDs, cacheEntry != null);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
}
Also used : CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 9 with CacheEntry

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

the class NameNodeRpcServer method removeXAttr.

// ClientProtocol
@Override
public void removeXAttr(String src, XAttr xAttr) 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.removeXAttr(src, xAttr, cacheEntry != null);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
}
Also used : CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 10 with CacheEntry

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

the class NameNodeRpcServer method removeCachePool.

// ClientProtocol
@Override
public void removeCachePool(String cachePoolName) throws IOException {
    checkNNStartup();
    namesystem.checkOperation(OperationCategory.WRITE);
    CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        return;
    }
    boolean success = false;
    try {
        namesystem.removeCachePool(cachePoolName, 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