|
@@ -42,6 +42,7 @@ import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
|
|
|
import org.apache.hadoop.fs.ContentSummary;
|
|
|
import org.apache.hadoop.fs.CreateFlag;
|
|
|
import org.apache.hadoop.fs.FSDataInputStream;
|
|
|
+import org.apache.hadoop.fs.FSDataOutputStream;
|
|
|
import org.apache.hadoop.fs.FileAlreadyExistsException;
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
|
import org.apache.hadoop.fs.FsServerDefaults;
|
|
@@ -79,7 +80,6 @@ import org.apache.hadoop.hdfs.protocol.proto.DataTransferProtos.Status;
|
|
|
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
|
|
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
|
|
|
import org.apache.hadoop.hdfs.server.common.UpgradeStatusReport;
|
|
|
-import org.apache.hadoop.hdfs.server.datanode.DataNode;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.NameNode;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.SafeModeException;
|
|
|
import org.apache.hadoop.io.DataOutputBuffer;
|
|
@@ -867,12 +867,20 @@ public class DFSClient implements java.io.Closeable {
|
|
|
*
|
|
|
* @param src file name
|
|
|
* @param buffersize buffer size
|
|
|
- * @param progress for reporting write-progress
|
|
|
+ * @param progress for reporting write-progress; null is acceptable.
|
|
|
+ * @param statistics file system statistics; null is acceptable.
|
|
|
* @return an output stream for writing into the file
|
|
|
*
|
|
|
* @see ClientProtocol#append(String, String)
|
|
|
*/
|
|
|
- public DFSOutputStream append(String src, int buffersize, Progressable progress)
|
|
|
+ public FSDataOutputStream append(final String src, final int buffersize,
|
|
|
+ final Progressable progress, final FileSystem.Statistics statistics
|
|
|
+ ) throws IOException {
|
|
|
+ final DFSOutputStream out = append(src, buffersize, progress);
|
|
|
+ return new FSDataOutputStream(out, statistics, out.getInitialLen());
|
|
|
+ }
|
|
|
+
|
|
|
+ private DFSOutputStream append(String src, int buffersize, Progressable progress)
|
|
|
throws IOException {
|
|
|
checkOpen();
|
|
|
HdfsFileStatus stat = getFileInfo(src);
|