|
@@ -79,7 +79,6 @@ import javax.net.SocketFactory;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
import org.apache.hadoop.classification.InterfaceAudience;
|
|
-import org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate;
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.fs.BlockLocation;
|
|
import org.apache.hadoop.fs.BlockLocation;
|
|
import org.apache.hadoop.fs.BlockStorageLocation;
|
|
import org.apache.hadoop.fs.BlockStorageLocation;
|
|
@@ -115,7 +114,6 @@ import org.apache.hadoop.hdfs.protocol.HdfsConstants;
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants.DatanodeReportType;
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants.DatanodeReportType;
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction;
|
|
import org.apache.hadoop.hdfs.protocol.HdfsConstants.SafeModeAction;
|
|
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
|
import org.apache.hadoop.hdfs.protocol.HdfsFileStatus;
|
|
-import org.apache.hadoop.hdfs.protocol.HdfsProtoUtil;
|
|
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
|
import org.apache.hadoop.hdfs.protocol.NSQuotaExceededException;
|
|
import org.apache.hadoop.hdfs.protocol.NSQuotaExceededException;
|
|
@@ -128,6 +126,7 @@ import org.apache.hadoop.hdfs.protocol.datatransfer.Sender;
|
|
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto;
|
|
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.BlockOpResponseProto;
|
|
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpBlockChecksumResponseProto;
|
|
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.OpBlockChecksumResponseProto;
|
|
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.Status;
|
|
import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.Status;
|
|
|
|
+import org.apache.hadoop.hdfs.protocolPB.PBHelper;
|
|
import org.apache.hadoop.hdfs.security.token.block.BlockTokenIdentifier;
|
|
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.DataEncryptionKey;
|
|
import org.apache.hadoop.hdfs.security.token.block.InvalidBlockTokenException;
|
|
import org.apache.hadoop.hdfs.security.token.block.InvalidBlockTokenException;
|
|
@@ -363,7 +362,7 @@ public class DFSClient implements java.io.Closeable {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Same as this(nameNodeUri, conf, null);
|
|
* Same as this(nameNodeUri, conf, null);
|
|
- * @see #DFSClient(InetSocketAddress, Configuration, org.apache.hadoop.fs.FileSystem.Statistics)
|
|
|
|
|
|
+ * @see #DFSClient(URI, Configuration, FileSystem.Statistics)
|
|
*/
|
|
*/
|
|
public DFSClient(URI nameNodeUri, Configuration conf
|
|
public DFSClient(URI nameNodeUri, Configuration conf
|
|
) throws IOException {
|
|
) throws IOException {
|
|
@@ -372,7 +371,7 @@ public class DFSClient implements java.io.Closeable {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Same as this(nameNodeUri, null, conf, stats);
|
|
* Same as this(nameNodeUri, null, conf, stats);
|
|
- * @see #DFSClient(InetSocketAddress, ClientProtocol, Configuration, org.apache.hadoop.fs.FileSystem.Statistics)
|
|
|
|
|
|
+ * @see #DFSClient(URI, ClientProtocol, Configuration, FileSystem.Statistics)
|
|
*/
|
|
*/
|
|
public DFSClient(URI nameNodeUri, Configuration conf,
|
|
public DFSClient(URI nameNodeUri, Configuration conf,
|
|
FileSystem.Statistics stats)
|
|
FileSystem.Statistics stats)
|
|
@@ -1157,7 +1156,7 @@ public class DFSClient implements java.io.Closeable {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Call {@link #create(String, FsPermission, EnumSet, short, long,
|
|
* Call {@link #create(String, FsPermission, EnumSet, short, long,
|
|
- * Progressable, int)} with default <code>permission</code>
|
|
|
|
|
|
+ * Progressable, int, ChecksumOpt)} with default <code>permission</code>
|
|
* {@link FsPermission#getDefault()}.
|
|
* {@link FsPermission#getDefault()}.
|
|
*
|
|
*
|
|
* @param src File name
|
|
* @param src File name
|
|
@@ -1268,7 +1267,7 @@ public class DFSClient implements java.io.Closeable {
|
|
|
|
|
|
/**
|
|
/**
|
|
* Same as {{@link #create(String, FsPermission, EnumSet, short, long,
|
|
* Same as {{@link #create(String, FsPermission, EnumSet, short, long,
|
|
- * Progressable, int)} except that the permission
|
|
|
|
|
|
+ * Progressable, int, ChecksumOpt)} except that the permission
|
|
* is absolute (ie has already been masked with umask.
|
|
* is absolute (ie has already been masked with umask.
|
|
*/
|
|
*/
|
|
public DFSOutputStream primitiveCreate(String src,
|
|
public DFSOutputStream primitiveCreate(String src,
|
|
@@ -1453,7 +1452,7 @@ public class DFSClient implements java.io.Closeable {
|
|
}
|
|
}
|
|
/**
|
|
/**
|
|
* Delete file or directory.
|
|
* Delete file or directory.
|
|
- * See {@link ClientProtocol#delete(String)}.
|
|
|
|
|
|
+ * See {@link ClientProtocol#delete(String, boolean)}.
|
|
*/
|
|
*/
|
|
@Deprecated
|
|
@Deprecated
|
|
public boolean delete(String src) throws IOException {
|
|
public boolean delete(String src) throws IOException {
|
|
@@ -1678,7 +1677,7 @@ public class DFSClient implements java.io.Closeable {
|
|
new Sender(out).blockChecksum(block, lb.getBlockToken());
|
|
new Sender(out).blockChecksum(block, lb.getBlockToken());
|
|
|
|
|
|
final BlockOpResponseProto reply =
|
|
final BlockOpResponseProto reply =
|
|
- BlockOpResponseProto.parseFrom(HdfsProtoUtil.vintPrefixed(in));
|
|
|
|
|
|
+ BlockOpResponseProto.parseFrom(PBHelper.vintPrefixed(in));
|
|
|
|
|
|
if (reply.getStatus() != Status.SUCCESS) {
|
|
if (reply.getStatus() != Status.SUCCESS) {
|
|
if (reply.getStatus() == Status.ERROR_ACCESS_TOKEN
|
|
if (reply.getStatus() == Status.ERROR_ACCESS_TOKEN
|
|
@@ -1725,8 +1724,8 @@ public class DFSClient implements java.io.Closeable {
|
|
md5.write(md5out);
|
|
md5.write(md5out);
|
|
|
|
|
|
// read crc-type
|
|
// read crc-type
|
|
- final DataChecksum.Type ct = HdfsProtoUtil.
|
|
|
|
- fromProto(checksumData.getCrcType());
|
|
|
|
|
|
+ final DataChecksum.Type ct = PBHelper.convert(checksumData
|
|
|
|
+ .getCrcType());
|
|
if (i == 0) { // first block
|
|
if (i == 0) { // first block
|
|
crcType = ct;
|
|
crcType = ct;
|
|
} else if (crcType != DataChecksum.Type.MIXED
|
|
} else if (crcType != DataChecksum.Type.MIXED
|
|
@@ -1888,7 +1887,7 @@ public class DFSClient implements java.io.Closeable {
|
|
* @param isChecked
|
|
* @param isChecked
|
|
* If true, then check only active namenode's safemode status, else
|
|
* If true, then check only active namenode's safemode status, else
|
|
* check first namenode's status.
|
|
* check first namenode's status.
|
|
- * @see ClientProtocol#setSafeMode(HdfsConstants.SafeModeActio,boolean)
|
|
|
|
|
|
+ * @see ClientProtocol#setSafeMode(HdfsConstants.SafeModeAction, boolean)
|
|
*/
|
|
*/
|
|
public boolean setSafeMode(SafeModeAction action, boolean isChecked) throws IOException{
|
|
public boolean setSafeMode(SafeModeAction action, boolean isChecked) throws IOException{
|
|
return namenode.setSafeMode(action, isChecked);
|
|
return namenode.setSafeMode(action, isChecked);
|