|
@@ -57,6 +57,7 @@ import org.apache.hadoop.fs.FileEncryptionInfo;
|
|
|
import org.apache.hadoop.fs.HasEnhancedByteBufferAccess;
|
|
|
import org.apache.hadoop.fs.ReadOption;
|
|
|
import org.apache.hadoop.fs.StorageType;
|
|
|
+import org.apache.hadoop.fs.StreamCapabilities;
|
|
|
import org.apache.hadoop.hdfs.DFSUtilClient.CorruptedBlocks;
|
|
|
import org.apache.hadoop.hdfs.client.impl.BlockReaderFactory;
|
|
|
import org.apache.hadoop.hdfs.client.impl.DfsClientConf;
|
|
@@ -81,6 +82,7 @@ import org.apache.hadoop.security.token.SecretManager.InvalidToken;
|
|
|
import org.apache.hadoop.security.token.Token;
|
|
|
import org.apache.hadoop.util.IdentityHashStore;
|
|
|
import org.apache.hadoop.util.StopWatch;
|
|
|
+import org.apache.hadoop.util.StringUtils;
|
|
|
import org.apache.htrace.core.SpanId;
|
|
|
import org.apache.htrace.core.TraceScope;
|
|
|
import org.apache.htrace.core.Tracer;
|
|
@@ -96,7 +98,7 @@ import javax.annotation.Nonnull;
|
|
|
@InterfaceAudience.Private
|
|
|
public class DFSInputStream extends FSInputStream
|
|
|
implements ByteBufferReadable, CanSetDropBehind, CanSetReadahead,
|
|
|
- HasEnhancedByteBufferAccess, CanUnbuffer {
|
|
|
+ HasEnhancedByteBufferAccess, CanUnbuffer, StreamCapabilities {
|
|
|
@VisibleForTesting
|
|
|
public static boolean tcpReadsDisabledForTesting = false;
|
|
|
private long hedgedReadOpsLoopNumForTesting = 0;
|
|
@@ -1779,4 +1781,16 @@ public class DFSInputStream extends FSInputStream
|
|
|
public synchronized void unbuffer() {
|
|
|
closeCurrentBlockReaders();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean hasCapability(String capability) {
|
|
|
+ switch (StringUtils.toLowerCase(capability)) {
|
|
|
+ case StreamCapabilities.READAHEAD:
|
|
|
+ case StreamCapabilities.DROPBEHIND:
|
|
|
+ case StreamCapabilities.UNBUFFER:
|
|
|
+ return true;
|
|
|
+ default:
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|