@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; // Return previous response } boolean success = false; try { namesystem.deleteSnapshot(snapshotRoot, snapshotName, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol 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); } }
@Override // ClientProtocol public boolean saveNamespace(long timeWindow, long txGap) throws IOException { checkNNStartup(); CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return true; // Return previous response } boolean success = false; try { namesystem.saveNamespace(timeWindow, txGap); success = true; } finally { RetryCache.setState(cacheEntry, success); } return true; }
@Override public void removeErasureCodingPolicy(String ecPolicyName) throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); final CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; } boolean success = false; try { namesystem.removeErasureCodingPolicy(ecPolicyName, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol public void enableErasureCodingPolicy(String ecPolicyName) throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); final CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; } boolean success = false; try { success = namesystem.enableErasureCodingPolicy(ecPolicyName, cacheEntry != null); } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol 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); } }
@Override // ClientProtocol 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); } }
@Override // ClientProtocol public void modifyCachePool(CachePoolInfo info) throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.WRITE); CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; // Return previous response } boolean success = false; try { namesystem.modifyCachePool(info, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol 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; // Return previous response } boolean success = false; try { namesystem.removeXAttr(src, xAttr, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol 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; // Return previous response } boolean success = false; try { namesystem.concat(trg, src, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override //ClientProtocol public void addCachePool(CachePoolInfo info) throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.WRITE); CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; // Return previous response } boolean success = false; try { namesystem.addCachePool(info, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // NamenodeProtocol public void endCheckpoint(NamenodeRegistration registration, CheckpointSignature sig) throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; // Return previous response } boolean success = false; try { namesystem.endCheckpoint(registration, sig); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol public void modifyCacheDirective( CacheDirectiveInfo directive, EnumSet<CacheFlag> flags) throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.WRITE); CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; } boolean success = false; try { namesystem.modifyCacheDirective(directive, flags, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol public void satisfyStoragePolicy(String src) throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.WRITE); CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; // Return previous response } boolean success = false; try { namesystem.satisfyStoragePolicy(src, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol 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; // Return previous response } boolean success = false; try { namesystem.setXAttr(src, xAttr, flag, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol public void createEncryptionZone(String src, String keyName) throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.WRITE); final CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; } boolean success = false; try { namesystem.createEncryptionZone(src, keyName, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol public void reencryptEncryptionZone(final String zone, final ReencryptAction action) throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.WRITE); final CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; } boolean success = false; try { namesystem.reencryptEncryptionZone(zone, action, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol public void disableErasureCodingPolicy(String ecPolicyName) throws IOException { checkNNStartup(); namesystem.checkSuperuserPrivilege(); final CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache); if (cacheEntry != null && cacheEntry.isSuccess()) { return; } boolean success = false; try { success = namesystem.disableErasureCodingPolicy(ecPolicyName, cacheEntry != null); } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol 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; // Return previous response } boolean success = false; try { namesystem.updatePipeline(clientName, oldBlock, newBlock, newNodes, newStorageIDs, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success); } }
@Override // ClientProtocol public long addCacheDirective( CacheDirectiveInfo path, EnumSet<CacheFlag> flags) throws IOException { checkNNStartup(); namesystem.checkOperation(OperationCategory.WRITE); CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion (retryCache, null); if (cacheEntry != null && cacheEntry.isSuccess()) { return (Long) cacheEntry.getPayload(); } boolean success = false; long ret = 0; try { ret = namesystem.addCacheDirective(path, flags, cacheEntry != null); success = true; } finally { RetryCache.setState(cacheEntry, success, ret); } return ret; }