|
@@ -53,8 +53,6 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
import javax.net.SocketFactory;
|
|
|
|
|
|
-import org.apache.commons.logging.Log;
|
|
|
-import org.apache.commons.logging.LogFactory;
|
|
|
import org.apache.hadoop.HadoopIllegalArgumentException;
|
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
@@ -76,6 +74,7 @@ import org.apache.hadoop.fs.FileEncryptionInfo;
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
|
import org.apache.hadoop.fs.FsServerDefaults;
|
|
|
import org.apache.hadoop.fs.FsStatus;
|
|
|
+import org.apache.hadoop.fs.FsTracer;
|
|
|
import org.apache.hadoop.fs.HdfsBlockLocation;
|
|
|
import org.apache.hadoop.fs.InvalidPathException;
|
|
|
import org.apache.hadoop.fs.MD5MD5CRC32CastagnoliFileChecksum;
|
|
@@ -94,6 +93,8 @@ import org.apache.hadoop.fs.permission.AclEntry;
|
|
|
import org.apache.hadoop.fs.permission.AclStatus;
|
|
|
import org.apache.hadoop.fs.permission.FsAction;
|
|
|
import org.apache.hadoop.fs.permission.FsPermission;
|
|
|
+import org.apache.hadoop.hdfs.NameNodeProxiesClient.ProxyAndInfo;
|
|
|
+import org.apache.hadoop.hdfs.client.HdfsClientConfigKeys;
|
|
|
import org.apache.hadoop.hdfs.client.HdfsDataInputStream;
|
|
|
import org.apache.hadoop.hdfs.client.HdfsDataOutputStream;
|
|
|
import org.apache.hadoop.hdfs.client.impl.DfsClientConf;
|
|
@@ -147,10 +148,10 @@ import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier;
|
|
|
import org.apache.hadoop.hdfs.security.token.block.DataEncryptionKey;
|
|
|
import org.apache.hadoop.hdfs.security.token.block.InvalidBlockTokenException;
|
|
|
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
|
|
-import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
|
|
|
import org.apache.hadoop.hdfs.server.datanode.CachingStrategy;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.SafeModeException;
|
|
|
import org.apache.hadoop.hdfs.server.protocol.DatanodeStorageReport;
|
|
|
+import org.apache.hadoop.hdfs.util.IOUtilsClient;
|
|
|
import org.apache.hadoop.io.DataOutputBuffer;
|
|
|
import org.apache.hadoop.io.EnumSetWritable;
|
|
|
import org.apache.hadoop.io.IOUtils;
|
|
@@ -167,24 +168,22 @@ import org.apache.hadoop.security.UserGroupInformation;
|
|
|
import org.apache.hadoop.security.token.SecretManager.InvalidToken;
|
|
|
import org.apache.hadoop.security.token.Token;
|
|
|
import org.apache.hadoop.security.token.TokenRenewer;
|
|
|
-import org.apache.hadoop.tracing.SpanReceiverHost;
|
|
|
-import org.apache.hadoop.tracing.TraceUtils;
|
|
|
import org.apache.hadoop.util.Daemon;
|
|
|
import org.apache.hadoop.util.DataChecksum;
|
|
|
import org.apache.hadoop.util.DataChecksum.Type;
|
|
|
import org.apache.hadoop.util.Progressable;
|
|
|
import org.apache.hadoop.util.Time;
|
|
|
-import org.apache.htrace.Sampler;
|
|
|
-import org.apache.htrace.SamplerBuilder;
|
|
|
-import org.apache.htrace.Span;
|
|
|
-import org.apache.htrace.Trace;
|
|
|
-import org.apache.htrace.TraceScope;
|
|
|
+import org.apache.htrace.core.TraceScope;
|
|
|
|
|
|
import com.google.common.annotations.VisibleForTesting;
|
|
|
import com.google.common.base.Joiner;
|
|
|
import com.google.common.base.Preconditions;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.net.InetAddresses;
|
|
|
+import org.apache.htrace.core.Tracer;
|
|
|
+
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
/********************************************************
|
|
|
* DFSClient can connect to a Hadoop Filesystem and
|
|
@@ -200,10 +199,11 @@ import com.google.common.net.InetAddresses;
|
|
|
@InterfaceAudience.Private
|
|
|
public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
DataEncryptionKeyFactory {
|
|
|
- public static final Log LOG = LogFactory.getLog(DFSClient.class);
|
|
|
+ public static final Logger LOG = LoggerFactory.getLogger(DFSClient.class);
|
|
|
public static final long SERVER_DEFAULTS_VALIDITY_PERIOD = 60 * 60 * 1000L; // 1 hour
|
|
|
|
|
|
private final Configuration conf;
|
|
|
+ private final Tracer tracer;
|
|
|
private final DfsClientConf dfsClientConf;
|
|
|
final ClientProtocol namenode;
|
|
|
/* The service used for delegation tokens */
|
|
@@ -231,7 +231,6 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
new DFSHedgedReadMetrics();
|
|
|
private static ThreadPoolExecutor HEDGED_READ_THREAD_POOL;
|
|
|
private static volatile ThreadPoolExecutor STRIPED_READ_THREAD_POOL;
|
|
|
- private final Sampler<?> traceSampler;
|
|
|
private final int smallBufferSize;
|
|
|
|
|
|
public DfsClientConf getConf() {
|
|
@@ -285,26 +284,24 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
/**
|
|
|
* Create a new DFSClient connected to the given nameNodeUri or rpcNamenode.
|
|
|
- * If HA is enabled and a positive value is set for
|
|
|
- * {@link DFSConfigKeys#DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_KEY} in the
|
|
|
- * configuration, the DFSClient will use {@link LossyRetryInvocationHandler}
|
|
|
- * as its RetryInvocationHandler. Otherwise one of nameNodeUri or rpcNamenode
|
|
|
- * must be null.
|
|
|
+ * If HA is enabled and a positive value is set for
|
|
|
+ * {@link HdfsClientConfigKeys#DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_KEY}
|
|
|
+ * in the configuration, the DFSClient will use
|
|
|
+ * {@link LossyRetryInvocationHandler} as its RetryInvocationHandler.
|
|
|
+ * Otherwise one of nameNodeUri or rpcNamenode must be null.
|
|
|
*/
|
|
|
@VisibleForTesting
|
|
|
public DFSClient(URI nameNodeUri, ClientProtocol rpcNamenode,
|
|
|
Configuration conf, FileSystem.Statistics stats)
|
|
|
throws IOException {
|
|
|
- SpanReceiverHost.get(conf, DFSConfigKeys.DFS_CLIENT_HTRACE_PREFIX);
|
|
|
- traceSampler = new SamplerBuilder(TraceUtils.
|
|
|
- wrapHadoopConf(DFSConfigKeys.DFS_CLIENT_HTRACE_PREFIX, conf)).build();
|
|
|
// Copy only the required DFSClient configuration
|
|
|
+ this.tracer = FsTracer.get(conf);
|
|
|
this.dfsClientConf = new DfsClientConf(conf);
|
|
|
this.conf = conf;
|
|
|
this.stats = stats;
|
|
|
this.socketFactory = NetUtils.getSocketFactory(conf, ClientProtocol.class);
|
|
|
this.dtpReplaceDatanodeOnFailure = ReplaceDatanodeOnFailure.get(conf);
|
|
|
- this.smallBufferSize = DFSUtil.getSmallBufferSize(conf);
|
|
|
+ this.smallBufferSize = DFSUtilClient.getSmallBufferSize(conf);
|
|
|
|
|
|
this.ugi = UserGroupInformation.getCurrentUser();
|
|
|
|
|
@@ -313,16 +310,17 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
ThreadLocalRandom.current().nextInt() + "_" +
|
|
|
Thread.currentThread().getId();
|
|
|
int numResponseToDrop = conf.getInt(
|
|
|
- DFSConfigKeys.DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_KEY,
|
|
|
- DFSConfigKeys.DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_DEFAULT);
|
|
|
- NameNodeProxies.ProxyAndInfo<ClientProtocol> proxyInfo = null;
|
|
|
+ HdfsClientConfigKeys.DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_KEY,
|
|
|
+ HdfsClientConfigKeys.DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_DEFAULT);
|
|
|
+ ProxyAndInfo<ClientProtocol> proxyInfo = null;
|
|
|
AtomicBoolean nnFallbackToSimpleAuth = new AtomicBoolean(false);
|
|
|
+
|
|
|
if (numResponseToDrop > 0) {
|
|
|
// This case is used for testing.
|
|
|
- LOG.warn(DFSConfigKeys.DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_KEY
|
|
|
+ LOG.warn(HdfsClientConfigKeys.DFS_CLIENT_TEST_DROP_NAMENODE_RESPONSE_NUM_KEY
|
|
|
+ " is set to " + numResponseToDrop
|
|
|
+ ", this hacked client will proactively drop responses");
|
|
|
- proxyInfo = NameNodeProxies.createProxyWithLossyRetryHandler(conf,
|
|
|
+ proxyInfo = NameNodeProxiesClient.createProxyWithLossyRetryHandler(conf,
|
|
|
nameNodeUri, ClientProtocol.class, numResponseToDrop,
|
|
|
nnFallbackToSimpleAuth);
|
|
|
}
|
|
@@ -338,14 +336,14 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
} else {
|
|
|
Preconditions.checkArgument(nameNodeUri != null,
|
|
|
"null URI");
|
|
|
- proxyInfo = NameNodeProxies.createProxy(conf, nameNodeUri,
|
|
|
- ClientProtocol.class, nnFallbackToSimpleAuth);
|
|
|
+ proxyInfo = NameNodeProxiesClient.createProxyWithClientProtocol(conf,
|
|
|
+ nameNodeUri, nnFallbackToSimpleAuth);
|
|
|
this.dtService = proxyInfo.getDelegationTokenService();
|
|
|
this.namenode = proxyInfo.getProxy();
|
|
|
}
|
|
|
|
|
|
String localInterfaces[] =
|
|
|
- conf.getTrimmedStrings(DFSConfigKeys.DFS_CLIENT_LOCAL_INTERFACES);
|
|
|
+ conf.getTrimmedStrings(HdfsClientConfigKeys.DFS_CLIENT_LOCAL_INTERFACES);
|
|
|
localInterfaceAddrs = getLocalInterfaceAddrs(localInterfaces);
|
|
|
if (LOG.isDebugEnabled() && 0 != localInterfaces.length) {
|
|
|
LOG.debug("Using local interfaces [" +
|
|
@@ -544,10 +542,10 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
} catch (IOException e) {
|
|
|
// Abort if the lease has already expired.
|
|
|
final long elapsed = Time.monotonicNow() - getLastLeaseRenewal();
|
|
|
- if (elapsed > HdfsServerConstants.LEASE_HARDLIMIT_PERIOD) {
|
|
|
+ if (elapsed > HdfsConstants.LEASE_HARDLIMIT_PERIOD) {
|
|
|
LOG.warn("Failed to renew lease for " + clientName + " for "
|
|
|
+ (elapsed/1000) + " seconds (>= hard-limit ="
|
|
|
- + (HdfsServerConstants.LEASE_HARDLIMIT_PERIOD/1000) + " seconds.) "
|
|
|
+ + (HdfsConstants.LEASE_HARDLIMIT_PERIOD / 1000) + " seconds.) "
|
|
|
+ "Closing all files being written ...", e);
|
|
|
closeAllFilesBeingWritten(true);
|
|
|
} else {
|
|
@@ -586,8 +584,8 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
out.close();
|
|
|
}
|
|
|
} catch(IOException ie) {
|
|
|
- LOG.error("Failed to " + (abort? "abort": "close") +
|
|
|
- " inode " + inodeId, ie);
|
|
|
+ LOG.error("Failed to " + (abort ? "abort" : "close") + " file: "
|
|
|
+ + out.getSrc() + " with inode: " + inodeId, ie);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -624,7 +622,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public long getBlockSize(String f) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getBlockSize", f);
|
|
|
+ TraceScope scope = newPathTraceScope("getBlockSize", f);
|
|
|
try {
|
|
|
return namenode.getPreferredBlockSize(f);
|
|
|
} catch (IOException ie) {
|
|
@@ -667,7 +665,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public Token<DelegationTokenIdentifier> getDelegationToken(Text renewer)
|
|
|
throws IOException {
|
|
|
assert dtService != null;
|
|
|
- TraceScope scope = Trace.startSpan("getDelegationToken", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("getDelegationToken");
|
|
|
try {
|
|
|
Token<DelegationTokenIdentifier> token =
|
|
|
namenode.getDelegationToken(renewer);
|
|
@@ -732,7 +730,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
static {
|
|
|
//Ensure that HDFS Configuration files are loaded before trying to use
|
|
|
// the renewer.
|
|
|
- HdfsConfiguration.init();
|
|
|
+ HdfsConfigurationLoader.init();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -786,8 +784,8 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
"a failover proxy provider configured.");
|
|
|
}
|
|
|
|
|
|
- NameNodeProxies.ProxyAndInfo<ClientProtocol> info =
|
|
|
- NameNodeProxies.createProxy(conf, uri, ClientProtocol.class);
|
|
|
+ ProxyAndInfo<ClientProtocol> info =
|
|
|
+ NameNodeProxiesClient.createProxyWithClientProtocol(conf, uri, null);
|
|
|
assert info.getDelegationTokenService().equals(token.getService()) :
|
|
|
"Returned service '" + info.getDelegationTokenService().toString() +
|
|
|
"' doesn't match expected service '" +
|
|
@@ -824,7 +822,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
@VisibleForTesting
|
|
|
public LocatedBlocks getLocatedBlocks(String src, long start, long length)
|
|
|
throws IOException {
|
|
|
- TraceScope scope = getPathTraceScope("getBlockLocations", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getBlockLocations", src);
|
|
|
try {
|
|
|
return callGetBlockLocations(namenode, src, start, length);
|
|
|
} finally {
|
|
@@ -856,7 +854,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
boolean recoverLease(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
|
|
|
- TraceScope scope = getPathTraceScope("recoverLease", src);
|
|
|
+ TraceScope scope = newPathTraceScope("recoverLease", src);
|
|
|
try {
|
|
|
return namenode.recoverLease(src, clientName);
|
|
|
} catch (RemoteException re) {
|
|
@@ -883,7 +881,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public BlockLocation[] getBlockLocations(String src, long start,
|
|
|
long length) throws IOException, UnresolvedLinkException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getBlockLocations", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getBlockLocations", src);
|
|
|
try {
|
|
|
LocatedBlocks blocks = getLocatedBlocks(src, start, length);
|
|
|
BlockLocation[] locations = DFSUtilClient.locatedBlocks2Locations(blocks);
|
|
@@ -902,7 +900,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
private KeyVersion decryptEncryptedDataEncryptionKey(FileEncryptionInfo
|
|
|
feInfo) throws IOException {
|
|
|
- TraceScope scope = Trace.startSpan("decryptEDEK", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("decryptEDEK");
|
|
|
try {
|
|
|
KeyProvider provider = getKeyProvider();
|
|
|
if (provider == null) {
|
|
@@ -1058,7 +1056,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
throws IOException, UnresolvedLinkException {
|
|
|
checkOpen();
|
|
|
// Get block info from namenode
|
|
|
- TraceScope scope = getPathTraceScope("newDFSInputStream", src);
|
|
|
+ TraceScope scope = newPathTraceScope("newDFSInputStream", src);
|
|
|
try {
|
|
|
LocatedBlocks locatedBlocks = getLocatedBlocks(src, 0);
|
|
|
if (locatedBlocks != null) {
|
|
@@ -1314,7 +1312,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void createSymlink(String target, String link, boolean createParent)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("createSymlink", target);
|
|
|
+ TraceScope scope = newPathTraceScope("createSymlink", target);
|
|
|
try {
|
|
|
final FsPermission dirPerm = applyUMask(null);
|
|
|
namenode.createSymlink(target, link, dirPerm, createParent);
|
|
@@ -1340,7 +1338,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public String getLinkTarget(String path) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getLinkTarget", path);
|
|
|
+ TraceScope scope = newPathTraceScope("getLinkTarget", path);
|
|
|
try {
|
|
|
return namenode.getLinkTarget(path);
|
|
|
} catch (RemoteException re) {
|
|
@@ -1437,7 +1435,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public boolean setReplication(String src, short replication)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("setReplication", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setReplication", src);
|
|
|
try {
|
|
|
return namenode.setReplication(src, replication);
|
|
|
} catch(RemoteException re) {
|
|
@@ -1461,7 +1459,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void setStoragePolicy(String src, String policyName)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("setStoragePolicy", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setStoragePolicy", src);
|
|
|
try {
|
|
|
namenode.setStoragePolicy(src, policyName);
|
|
|
} catch (RemoteException e) {
|
|
@@ -1482,7 +1480,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public BlockStoragePolicy getStoragePolicy(String path) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getStoragePolicy", path);
|
|
|
+ TraceScope scope = newPathTraceScope("getStoragePolicy", path);
|
|
|
try {
|
|
|
return namenode.getStoragePolicy(path);
|
|
|
} catch (RemoteException e) {
|
|
@@ -1500,7 +1498,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public BlockStoragePolicy[] getStoragePolicies() throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("getStoragePolicies", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("getStoragePolicies");
|
|
|
try {
|
|
|
return namenode.getStoragePolicies();
|
|
|
} finally {
|
|
@@ -1516,7 +1514,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
@Deprecated
|
|
|
public boolean rename(String src, String dst) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getSrcDstTraceScope("rename", src, dst);
|
|
|
+ TraceScope scope = newSrcDstTraceScope("rename", src, dst);
|
|
|
try {
|
|
|
return namenode.rename(src, dst);
|
|
|
} catch(RemoteException re) {
|
|
@@ -1537,7 +1535,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public void concat(String trg, String [] srcs) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("concat", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("concat");
|
|
|
try {
|
|
|
namenode.concat(trg, srcs);
|
|
|
} catch(RemoteException re) {
|
|
@@ -1555,7 +1553,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void rename(String src, String dst, Options.Rename... options)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getSrcDstTraceScope("rename2", src, dst);
|
|
|
+ TraceScope scope = newSrcDstTraceScope("rename2", src, dst);
|
|
|
try {
|
|
|
namenode.rename2(src, dst, options);
|
|
|
} catch(RemoteException re) {
|
|
@@ -1584,7 +1582,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
throw new HadoopIllegalArgumentException(
|
|
|
"Cannot truncate to a negative file size: " + newLength + ".");
|
|
|
}
|
|
|
- TraceScope scope = getPathTraceScope("truncate", src);
|
|
|
+ TraceScope scope = newPathTraceScope("truncate", src);
|
|
|
try {
|
|
|
return namenode.truncate(src, newLength, clientName);
|
|
|
} catch (RemoteException re) {
|
|
@@ -1614,7 +1612,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public boolean delete(String src, boolean recursive) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("delete", src);
|
|
|
+ TraceScope scope = newPathTraceScope("delete", src);
|
|
|
try {
|
|
|
return namenode.delete(src, recursive);
|
|
|
} catch(RemoteException re) {
|
|
@@ -1656,7 +1654,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public DirectoryListing listPaths(String src, byte[] startAfter,
|
|
|
boolean needLocation) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("listPaths", src);
|
|
|
+ TraceScope scope = newPathTraceScope("listPaths", src);
|
|
|
try {
|
|
|
return namenode.getListing(src, startAfter, needLocation);
|
|
|
} catch(RemoteException re) {
|
|
@@ -1678,7 +1676,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public HdfsFileStatus getFileInfo(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getFileInfo", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getFileInfo", src);
|
|
|
try {
|
|
|
return namenode.getFileInfo(src);
|
|
|
} catch(RemoteException re) {
|
|
@@ -1696,7 +1694,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public boolean isFileClosed(String src) throws IOException{
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("isFileClosed", src);
|
|
|
+ TraceScope scope = newPathTraceScope("isFileClosed", src);
|
|
|
try {
|
|
|
return namenode.isFileClosed(src);
|
|
|
} catch(RemoteException re) {
|
|
@@ -1718,7 +1716,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public HdfsFileStatus getFileLinkInfo(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getFileLinkInfo", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getFileLinkInfo", src);
|
|
|
try {
|
|
|
return namenode.getFileLinkInfo(src);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2007,7 +2005,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
return PBHelperClient.convert(reply.getReadOpChecksumInfo().getChecksum().getType());
|
|
|
} finally {
|
|
|
- IOUtils.cleanup(null, pair.in, pair.out);
|
|
|
+ IOUtilsClient.cleanup(null, pair.in, pair.out);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2021,7 +2019,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void setPermission(String src, FsPermission permission)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("setPermission", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setPermission", src);
|
|
|
try {
|
|
|
namenode.setPermission(src, permission);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2046,7 +2044,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void setOwner(String src, String username, String groupname)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("setOwner", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setOwner", src);
|
|
|
try {
|
|
|
namenode.setOwner(src, username, groupname);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2062,7 +2060,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
private long[] callGetStats() throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("getStats", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("getStats");
|
|
|
try {
|
|
|
return namenode.getStats();
|
|
|
} finally {
|
|
@@ -2121,7 +2119,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
String cookie)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("listCorruptFileBlocks", path);
|
|
|
+ TraceScope scope = newPathTraceScope("listCorruptFileBlocks", path);
|
|
|
try {
|
|
|
return namenode.listCorruptFileBlocks(path, cookie);
|
|
|
} finally {
|
|
@@ -2132,7 +2130,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public DatanodeInfo[] datanodeReport(DatanodeReportType type)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("datanodeReport", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("datanodeReport");
|
|
|
try {
|
|
|
return namenode.getDatanodeReport(type);
|
|
|
} finally {
|
|
@@ -2144,7 +2142,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
DatanodeReportType type) throws IOException {
|
|
|
checkOpen();
|
|
|
TraceScope scope =
|
|
|
- Trace.startSpan("datanodeStorageReport", traceSampler);
|
|
|
+ tracer.newScope("datanodeStorageReport");
|
|
|
try {
|
|
|
return namenode.getDatanodeStorageReport(type);
|
|
|
} finally {
|
|
@@ -2175,7 +2173,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public boolean setSafeMode(SafeModeAction action, boolean isChecked) throws IOException{
|
|
|
TraceScope scope =
|
|
|
- Trace.startSpan("setSafeMode", traceSampler);
|
|
|
+ tracer.newScope("setSafeMode");
|
|
|
try {
|
|
|
return namenode.setSafeMode(action, isChecked);
|
|
|
} finally {
|
|
@@ -2194,7 +2192,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public String createSnapshot(String snapshotRoot, String snapshotName)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("createSnapshot", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("createSnapshot");
|
|
|
try {
|
|
|
return namenode.createSnapshot(snapshotRoot, snapshotName);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2216,7 +2214,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void deleteSnapshot(String snapshotRoot, String snapshotName)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("deleteSnapshot", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("deleteSnapshot");
|
|
|
try {
|
|
|
namenode.deleteSnapshot(snapshotRoot, snapshotName);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2237,7 +2235,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void renameSnapshot(String snapshotDir, String snapshotOldName,
|
|
|
String snapshotNewName) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("renameSnapshot", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("renameSnapshot");
|
|
|
try {
|
|
|
namenode.renameSnapshot(snapshotDir, snapshotOldName, snapshotNewName);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2256,8 +2254,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public SnapshottableDirectoryStatus[] getSnapshottableDirListing()
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("getSnapshottableDirListing",
|
|
|
- traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("getSnapshottableDirListing");
|
|
|
try {
|
|
|
return namenode.getSnapshottableDirListing();
|
|
|
} catch(RemoteException re) {
|
|
@@ -2274,7 +2271,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public void allowSnapshot(String snapshotRoot) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("allowSnapshot", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("allowSnapshot");
|
|
|
try {
|
|
|
namenode.allowSnapshot(snapshotRoot);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2291,7 +2288,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public void disallowSnapshot(String snapshotRoot) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("disallowSnapshot", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("disallowSnapshot");
|
|
|
try {
|
|
|
namenode.disallowSnapshot(snapshotRoot);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2309,7 +2306,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public SnapshotDiffReport getSnapshotDiffReport(String snapshotDir,
|
|
|
String fromSnapshot, String toSnapshot) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("getSnapshotDiffReport", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("getSnapshotDiffReport");
|
|
|
try {
|
|
|
return namenode.getSnapshotDiffReport(snapshotDir,
|
|
|
fromSnapshot, toSnapshot);
|
|
@@ -2323,7 +2320,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public long addCacheDirective(
|
|
|
CacheDirectiveInfo info, EnumSet<CacheFlag> flags) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("addCacheDirective", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("addCacheDirective");
|
|
|
try {
|
|
|
return namenode.addCacheDirective(info, flags);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2336,7 +2333,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void modifyCacheDirective(
|
|
|
CacheDirectiveInfo info, EnumSet<CacheFlag> flags) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("modifyCacheDirective", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("modifyCacheDirective");
|
|
|
try {
|
|
|
namenode.modifyCacheDirective(info, flags);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2349,7 +2346,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void removeCacheDirective(long id)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("removeCacheDirective", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("removeCacheDirective");
|
|
|
try {
|
|
|
namenode.removeCacheDirective(id);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2362,12 +2359,12 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public RemoteIterator<CacheDirectiveEntry> listCacheDirectives(
|
|
|
CacheDirectiveInfo filter) throws IOException {
|
|
|
checkOpen();
|
|
|
- return new CacheDirectiveIterator(namenode, filter, traceSampler);
|
|
|
+ return new CacheDirectiveIterator(namenode, filter, tracer);
|
|
|
}
|
|
|
|
|
|
public void addCachePool(CachePoolInfo info) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("addCachePool", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("addCachePool");
|
|
|
try {
|
|
|
namenode.addCachePool(info);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2379,7 +2376,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public void modifyCachePool(CachePoolInfo info) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("modifyCachePool", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("modifyCachePool");
|
|
|
try {
|
|
|
namenode.modifyCachePool(info);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2391,7 +2388,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public void removeCachePool(String poolName) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("removeCachePool", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("removeCachePool");
|
|
|
try {
|
|
|
namenode.removeCachePool(poolName);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2403,7 +2400,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public RemoteIterator<CachePoolEntry> listCachePools() throws IOException {
|
|
|
checkOpen();
|
|
|
- return new CachePoolIterator(namenode, traceSampler);
|
|
|
+ return new CachePoolIterator(namenode, tracer);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2413,7 +2410,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
boolean saveNamespace(long timeWindow, long txGap) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("saveNamespace", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("saveNamespace");
|
|
|
try {
|
|
|
return namenode.saveNamespace(timeWindow, txGap);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2431,7 +2428,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
long rollEdits() throws AccessControlException, IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("rollEdits", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("rollEdits");
|
|
|
try {
|
|
|
return namenode.rollEdits();
|
|
|
} catch(RemoteException re) {
|
|
@@ -2454,7 +2451,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
boolean restoreFailedStorage(String arg)
|
|
|
throws AccessControlException, IOException{
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("restoreFailedStorage", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("restoreFailedStorage");
|
|
|
try {
|
|
|
return namenode.restoreFailedStorage(arg);
|
|
|
} finally {
|
|
@@ -2471,7 +2468,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public void refreshNodes() throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("refreshNodes", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("refreshNodes");
|
|
|
try {
|
|
|
namenode.refreshNodes();
|
|
|
} finally {
|
|
@@ -2486,7 +2483,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public void metaSave(String pathname) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("metaSave", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("metaSave");
|
|
|
try {
|
|
|
namenode.metaSave(pathname);
|
|
|
} finally {
|
|
@@ -2504,7 +2501,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public void setBalancerBandwidth(long bandwidth) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("setBalancerBandwidth", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("setBalancerBandwidth");
|
|
|
try {
|
|
|
namenode.setBalancerBandwidth(bandwidth);
|
|
|
} finally {
|
|
@@ -2517,7 +2514,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public void finalizeUpgrade() throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("finalizeUpgrade", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("finalizeUpgrade");
|
|
|
try {
|
|
|
namenode.finalizeUpgrade();
|
|
|
} finally {
|
|
@@ -2527,7 +2524,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
RollingUpgradeInfo rollingUpgrade(RollingUpgradeAction action) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("rollingUpgrade", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("rollingUpgrade");
|
|
|
try {
|
|
|
return namenode.rollingUpgrade(action);
|
|
|
} finally {
|
|
@@ -2585,7 +2582,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
if(LOG.isDebugEnabled()) {
|
|
|
LOG.debug(src + ": masked=" + absPermission);
|
|
|
}
|
|
|
- TraceScope scope = Trace.startSpan("mkdir", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("mkdir");
|
|
|
try {
|
|
|
return namenode.mkdirs(src, absPermission, createParent);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2613,7 +2610,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
ContentSummary getContentSummary(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getContentSummary", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getContentSummary", src);
|
|
|
try {
|
|
|
return namenode.getContentSummary(src);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2642,7 +2639,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
storagespaceQuota);
|
|
|
|
|
|
}
|
|
|
- TraceScope scope = getPathTraceScope("setQuota", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setQuota", src);
|
|
|
try {
|
|
|
// Pass null as storage type for traditional namespace/storagespace quota.
|
|
|
namenode.setQuota(src, namespaceQuota, storagespaceQuota, null);
|
|
@@ -2678,7 +2675,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
throw new IllegalArgumentException("Don't support Quota for storage type : "
|
|
|
+ type.toString());
|
|
|
}
|
|
|
- TraceScope scope = getPathTraceScope("setQuotaByStorageType", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setQuotaByStorageType", src);
|
|
|
try {
|
|
|
namenode.setQuota(src, HdfsConstants.QUOTA_DONT_SET, quota, type);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2698,7 +2695,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
*/
|
|
|
public void setTimes(String src, long mtime, long atime) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("setTimes", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setTimes", src);
|
|
|
try {
|
|
|
namenode.setTimes(src, mtime, atime);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2759,7 +2756,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void modifyAclEntries(String src, List<AclEntry> aclSpec)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("modifyAclEntries", src);
|
|
|
+ TraceScope scope = newPathTraceScope("modifyAclEntries", src);
|
|
|
try {
|
|
|
namenode.modifyAclEntries(src, aclSpec);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2778,7 +2775,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void removeAclEntries(String src, List<AclEntry> aclSpec)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("removeAclEntries", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("removeAclEntries");
|
|
|
try {
|
|
|
namenode.removeAclEntries(src, aclSpec);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2796,7 +2793,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public void removeDefaultAcl(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("removeDefaultAcl", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("removeDefaultAcl");
|
|
|
try {
|
|
|
namenode.removeDefaultAcl(src);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2814,7 +2811,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public void removeAcl(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("removeAcl", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("removeAcl");
|
|
|
try {
|
|
|
namenode.removeAcl(src);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2832,7 +2829,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public void setAcl(String src, List<AclEntry> aclSpec) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("setAcl", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("setAcl");
|
|
|
try {
|
|
|
namenode.setAcl(src, aclSpec);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2850,7 +2847,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public AclStatus getAclStatus(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getAclStatus", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getAclStatus", src);
|
|
|
try {
|
|
|
return namenode.getAclStatus(src);
|
|
|
} catch(RemoteException re) {
|
|
@@ -2866,7 +2863,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void createEncryptionZone(String src, String keyName)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("createEncryptionZone", src);
|
|
|
+ TraceScope scope = newPathTraceScope("createEncryptionZone", src);
|
|
|
try {
|
|
|
namenode.createEncryptionZone(src, keyName);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2881,7 +2878,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public EncryptionZone getEZForPath(String src)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getEZForPath", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getEZForPath", src);
|
|
|
try {
|
|
|
return namenode.getEZForPath(src);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2895,14 +2892,14 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public RemoteIterator<EncryptionZone> listEncryptionZones()
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- return new EncryptionZoneIterator(namenode, traceSampler);
|
|
|
+ return new EncryptionZoneIterator(namenode, tracer);
|
|
|
}
|
|
|
|
|
|
|
|
|
public void setErasureCodingPolicy(String src, ErasureCodingPolicy ecPolicy)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("setErasureCodingPolicy", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setErasureCodingPolicy", src);
|
|
|
try {
|
|
|
namenode.setErasureCodingPolicy(src, ecPolicy);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2917,7 +2914,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public void setXAttr(String src, String name, byte[] value,
|
|
|
EnumSet<XAttrSetFlag> flag) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("setXAttr", src);
|
|
|
+ TraceScope scope = newPathTraceScope("setXAttr", src);
|
|
|
try {
|
|
|
namenode.setXAttr(src, XAttrHelper.buildXAttr(name, value), flag);
|
|
|
} catch (RemoteException re) {
|
|
@@ -2934,7 +2931,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public byte[] getXAttr(String src, String name) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getXAttr", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getXAttr", src);
|
|
|
try {
|
|
|
final List<XAttr> xAttrs = XAttrHelper.buildXAttrAsList(name);
|
|
|
final List<XAttr> result = namenode.getXAttrs(src, xAttrs);
|
|
@@ -2950,7 +2947,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public Map<String, byte[]> getXAttrs(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getXAttrs", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getXAttrs", src);
|
|
|
try {
|
|
|
return XAttrHelper.buildXAttrMap(namenode.getXAttrs(src, null));
|
|
|
} catch(RemoteException re) {
|
|
@@ -2965,7 +2962,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public Map<String, byte[]> getXAttrs(String src, List<String> names)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getXAttrs", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getXAttrs", src);
|
|
|
try {
|
|
|
return XAttrHelper.buildXAttrMap(namenode.getXAttrs(
|
|
|
src, XAttrHelper.buildXAttrs(names)));
|
|
@@ -2981,7 +2978,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
public List<String> listXAttrs(String src)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("listXAttrs", src);
|
|
|
+ TraceScope scope = newPathTraceScope("listXAttrs", src);
|
|
|
try {
|
|
|
final Map<String, byte[]> xattrs =
|
|
|
XAttrHelper.buildXAttrMap(namenode.listXAttrs(src));
|
|
@@ -2997,7 +2994,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public void removeXAttr(String src, String name) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("removeXAttr", src);
|
|
|
+ TraceScope scope = newPathTraceScope("removeXAttr", src);
|
|
|
try {
|
|
|
namenode.removeXAttr(src, XAttrHelper.buildXAttr(name));
|
|
|
} catch(RemoteException re) {
|
|
@@ -3014,7 +3011,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public void checkAccess(String src, FsAction mode) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("checkAccess", src);
|
|
|
+ TraceScope scope = newPathTraceScope("checkAccess", src);
|
|
|
try {
|
|
|
namenode.checkAccess(src, mode);
|
|
|
} catch (RemoteException re) {
|
|
@@ -3028,7 +3025,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public ErasureCodingPolicy[] getErasureCodingPolicies() throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = Trace.startSpan("getErasureCodingPolicies", traceSampler);
|
|
|
+ TraceScope scope = tracer.newScope("getErasureCodingPolicies");
|
|
|
try {
|
|
|
return namenode.getErasureCodingPolicies();
|
|
|
} finally {
|
|
@@ -3038,13 +3035,14 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public DFSInotifyEventInputStream getInotifyEventStream() throws IOException {
|
|
|
checkOpen();
|
|
|
- return new DFSInotifyEventInputStream(traceSampler, namenode);
|
|
|
+ return new DFSInotifyEventInputStream(namenode, tracer);
|
|
|
}
|
|
|
|
|
|
public DFSInotifyEventInputStream getInotifyEventStream(long lastReadTxid)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
- return new DFSInotifyEventInputStream(traceSampler, namenode, lastReadTxid);
|
|
|
+ return new DFSInotifyEventInputStream(namenode, tracer,
|
|
|
+ lastReadTxid);
|
|
|
}
|
|
|
|
|
|
@Override // RemotePeerFactory
|
|
@@ -3066,7 +3064,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
return peer;
|
|
|
} finally {
|
|
|
if (!success) {
|
|
|
- IOUtils.cleanup(LOG, peer);
|
|
|
+ IOUtilsClient.cleanup(LOG, peer);
|
|
|
IOUtils.closeSocket(sock);
|
|
|
}
|
|
|
}
|
|
@@ -3179,11 +3177,11 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
/**
|
|
|
* Probe for encryption enabled on this filesystem.
|
|
|
- * See {@link DFSUtil#isHDFSEncryptionEnabled(Configuration)}
|
|
|
+ * See {@link DFSUtilClient#isHDFSEncryptionEnabled(Configuration)}
|
|
|
* @return true if encryption is enabled
|
|
|
*/
|
|
|
public boolean isHDFSEncryptionEnabled() {
|
|
|
- return DFSUtil.isHDFSEncryptionEnabled(this.conf);
|
|
|
+ return DFSUtilClient.isHDFSEncryptionEnabled(this.conf);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -3195,27 +3193,21 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
return saslClient;
|
|
|
}
|
|
|
|
|
|
- TraceScope getPathTraceScope(String description, String path) {
|
|
|
- TraceScope scope = Trace.startSpan(description, traceSampler);
|
|
|
- Span span = scope.getSpan();
|
|
|
- if (span != null) {
|
|
|
- if (path != null) {
|
|
|
- span.addKVAnnotation("path", path);
|
|
|
- }
|
|
|
+ TraceScope newPathTraceScope(String description, String path) {
|
|
|
+ TraceScope scope = tracer.newScope(description);
|
|
|
+ if (path != null) {
|
|
|
+ scope.addKVAnnotation("path", path);
|
|
|
}
|
|
|
return scope;
|
|
|
}
|
|
|
|
|
|
- TraceScope getSrcDstTraceScope(String description, String src, String dst) {
|
|
|
- TraceScope scope = Trace.startSpan(description, traceSampler);
|
|
|
- Span span = scope.getSpan();
|
|
|
- if (span != null) {
|
|
|
- if (src != null) {
|
|
|
- span.addKVAnnotation("src", src);
|
|
|
- }
|
|
|
- if (dst != null) {
|
|
|
- span.addKVAnnotation("dst", dst);
|
|
|
- }
|
|
|
+ TraceScope newSrcDstTraceScope(String description, String src, String dst) {
|
|
|
+ TraceScope scope = tracer.newScope(description);
|
|
|
+ if (src != null) {
|
|
|
+ scope.addKVAnnotation("src", src);
|
|
|
+ }
|
|
|
+ if (dst != null) {
|
|
|
+ scope.addKVAnnotation("dst", dst);
|
|
|
}
|
|
|
return scope;
|
|
|
}
|
|
@@ -3231,7 +3223,7 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
|
|
|
public ErasureCodingPolicy getErasureCodingPolicy(String src) throws IOException {
|
|
|
checkOpen();
|
|
|
- TraceScope scope = getPathTraceScope("getErasureCodingPolicy", src);
|
|
|
+ TraceScope scope = newPathTraceScope("getErasureCodingPolicy", src);
|
|
|
try {
|
|
|
return namenode.getErasureCodingPolicy(src);
|
|
|
} catch (RemoteException re) {
|
|
@@ -3241,4 +3233,8 @@ public class DFSClient implements java.io.Closeable, RemotePeerFactory,
|
|
|
scope.close();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ Tracer getTracer() {
|
|
|
+ return tracer;
|
|
|
+ }
|
|
|
}
|