Search in sources :

Example 16 with CacheEntry

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

the class NameNodeRpcServer method setXAttr.

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

Example 17 with CacheEntry

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

the class NameNodeRpcServer method delete.

// ClientProtocol
@Override
public boolean delete(String src, boolean recursive) throws IOException {
    checkNNStartup();
    if (stateChangeLog.isDebugEnabled()) {
        stateChangeLog.debug("*DIR* Namenode.delete: src=" + src + ", recursive=" + recursive);
    }
    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.delete(src, recursive, cacheEntry != null);
    } finally {
        RetryCache.setState(cacheEntry, ret);
    }
    if (ret)
        metrics.incrDeleteFileOps();
    return ret;
}
Also used : CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 18 with CacheEntry

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

the class NameNodeRpcServer method removeCacheDirective.

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

Example 19 with CacheEntry

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

the class NameNodeRpcServer method saveNamespace.

// ClientProtocol
@Override
public boolean saveNamespace(long timeWindow, long txGap) throws IOException {
    checkNNStartup();
    CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
    if (cacheEntry != null && cacheEntry.isSuccess()) {
        // Return previous response
        return true;
    }
    boolean success = false;
    try {
        namesystem.saveNamespace(timeWindow, txGap);
        success = true;
    } finally {
        RetryCache.setState(cacheEntry, success);
    }
    return true;
}
Also used : CacheEntry(org.apache.hadoop.ipc.RetryCache.CacheEntry)

Example 20 with CacheEntry

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

the class NameNodeRpcServer method addCachePool.

//ClientProtocol
@Override
public void addCachePool(CachePoolInfo info) 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.addCachePool(info, 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