You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by in...@apache.org on 2017/05/02 22:05:40 UTC
[23/50] [abbrv] hadoop git commit: HDFS-11718. DFSStripedOutputStream
hsync/hflush should not throw UnsupportedOperationException. (Manoj
Govindassamy via lei)
HDFS-11718. DFSStripedOutputStream hsync/hflush should not throw UnsupportedOperationException. (Manoj Govindassamy via lei)
Change-Id: I4cc226b80c64a0d900a3b1ce71e51f051cd29c22
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/19a7e94e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/19a7e94e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/19a7e94e
Branch: refs/heads/HDFS-10467
Commit: 19a7e94ee47f81557f0db6fb76bdf6bc49944dd0
Parents: 2e52789
Author: Lei Xu <le...@apache.org>
Authored: Fri Apr 28 17:06:14 2017 -0700
Committer: Lei Xu <le...@apache.org>
Committed: Fri Apr 28 17:06:14 2017 -0700
----------------------------------------------------------------------
.../hadoop/hdfs/DFSStripedOutputStream.java | 4 +--
.../hadoop/hdfs/TestDFSStripedOutputStream.java | 29 +++++++++++++++++++-
2 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/19a7e94e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java
index 22b30e9..3dd07f7 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java
+++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java
@@ -783,12 +783,12 @@ public class DFSStripedOutputStream extends DFSOutputStream {
@Override
public void hflush() {
- throw new UnsupportedOperationException();
+ // not supported yet
}
@Override
public void hsync() {
- throw new UnsupportedOperationException();
+ // not supported yet
}
@Override
http://git-wip-us.apache.org/repos/asf/hadoop/blob/19a7e94e/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedOutputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedOutputStream.java
index 14825ca..70309c9 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedOutputStream.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStripedOutputStream.java
@@ -17,15 +17,21 @@
*/
package org.apache.hadoop.hdfs;
+import static org.apache.hadoop.fs.contract.ContractTestUtils.fail;
+
+import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.protocol.DatanodeInfo;
import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy;
+import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.erasurecode.CodecUtil;
import org.apache.hadoop.io.erasurecode.ErasureCodeNative;
import org.apache.hadoop.io.erasurecode.rawcoder.NativeRSRawErasureCoderFactory;
@@ -170,7 +176,6 @@ public class TestDFSStripedOutputStream {
blockSize * dataBlocks + cellSize+ 123);
}
-
@Test
public void testFileMoreThanABlockGroup3() throws Exception {
testOneFile("/MoreThanABlockGroup3",
@@ -178,6 +183,28 @@ public class TestDFSStripedOutputStream {
+ cellSize + 123);
}
+ /**
+ * {@link DFSStripedOutputStream} doesn't support hflush() or hsync() yet.
+ * This test is to make sure that DFSStripedOutputStream doesn't throw any
+ * {@link UnsupportedOperationException} on hflush() or hsync() so as to
+ * comply with output stream spec.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testStreamFlush() throws Exception {
+ final byte[] bytes = StripedFileTestUtil.generateBytes(blockSize *
+ dataBlocks * 3 + cellSize * dataBlocks + cellSize + 123);
+ try (FSDataOutputStream os = fs.create(new Path("/ec-file-1"))) {
+ InputStream is = new ByteArrayInputStream(bytes);
+ IOUtils.copyBytes(is, os, bytes.length);
+ os.hflush();
+ os.hsync();
+ } catch (Exception e) {
+ fail("hflush()/hsync() on striped file output stream failed!", e);
+ }
+ }
+
private void testOneFile(String src, int writeBytes) throws Exception {
src += "_" + writeBytes;
Path testPath = new Path(src);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org