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 ar...@apache.org on 2016/09/14 16:35:47 UTC
[1/3] hadoop git commit: HDFS-10805. Reduce runtime for append test.
Contributed by Gergely Novak.
Repository: hadoop
Updated Branches:
refs/heads/branch-2 3b9268cfb -> 853e1e694
refs/heads/branch-2.8 6a7ce4ee5 -> bdc71bd60
refs/heads/trunk 53a12fa72 -> 2a8f55a0c
HDFS-10805. Reduce runtime for append test. Contributed by Gergely Novak.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2a8f55a0
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2a8f55a0
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2a8f55a0
Branch: refs/heads/trunk
Commit: 2a8f55a0cf147b567d70c0c07f84cf27fd413c19
Parents: 53a12fa
Author: Arpit Agarwal <ar...@apache.org>
Authored: Wed Sep 14 09:31:17 2016 -0700
Committer: Arpit Agarwal <ar...@apache.org>
Committed: Wed Sep 14 09:31:17 2016 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hdfs/AppendTestUtil.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2a8f55a0/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
index de4da5f..268bdf9 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hdfs;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -238,7 +239,8 @@ public class AppendTestUtil {
}
public static void testAppend(FileSystem fs, Path p) throws IOException {
- final byte[] bytes = new byte[1000];
+ final int size = 1000;
+ final byte[] bytes = randomBytes(seed, size);
{ //create file
final FSDataOutputStream out = fs.create(p, (short)1);
@@ -247,12 +249,22 @@ public class AppendTestUtil {
assertEquals(bytes.length, fs.getFileStatus(p).getLen());
}
- for(int i = 2; i < 500; i++) {
+ final int appends = 50;
+ for (int i = 2; i < appends; i++) {
//append
final FSDataOutputStream out = fs.append(p);
out.write(bytes);
out.close();
- assertEquals(i*bytes.length, fs.getFileStatus(p).getLen());
+ assertEquals(i * bytes.length, fs.getFileStatus(p).getLen());
}
+
+ // Check the appended content
+ final FSDataInputStream in = fs.open(p);
+ for (int i = 0; i < appends - 1; i++) {
+ byte[] read = new byte[size];
+ in.read(i * bytes.length, read, 0, size);
+ assertArrayEquals(bytes, read);
+ }
+ in.close();
}
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[2/3] hadoop git commit: HDFS-10805. Reduce runtime for append test.
Contributed by Gergely Novak.
Posted by ar...@apache.org.
HDFS-10805. Reduce runtime for append test. Contributed by Gergely Novak.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/853e1e69
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/853e1e69
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/853e1e69
Branch: refs/heads/branch-2
Commit: 853e1e69466d1acf4bdb8bf3d1441e8f561031a4
Parents: 3b9268c
Author: Arpit Agarwal <ar...@apache.org>
Authored: Wed Sep 14 09:31:17 2016 -0700
Committer: Arpit Agarwal <ar...@apache.org>
Committed: Wed Sep 14 09:31:24 2016 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hdfs/AppendTestUtil.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/853e1e69/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
index de4da5f..268bdf9 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hdfs;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -238,7 +239,8 @@ public class AppendTestUtil {
}
public static void testAppend(FileSystem fs, Path p) throws IOException {
- final byte[] bytes = new byte[1000];
+ final int size = 1000;
+ final byte[] bytes = randomBytes(seed, size);
{ //create file
final FSDataOutputStream out = fs.create(p, (short)1);
@@ -247,12 +249,22 @@ public class AppendTestUtil {
assertEquals(bytes.length, fs.getFileStatus(p).getLen());
}
- for(int i = 2; i < 500; i++) {
+ final int appends = 50;
+ for (int i = 2; i < appends; i++) {
//append
final FSDataOutputStream out = fs.append(p);
out.write(bytes);
out.close();
- assertEquals(i*bytes.length, fs.getFileStatus(p).getLen());
+ assertEquals(i * bytes.length, fs.getFileStatus(p).getLen());
}
+
+ // Check the appended content
+ final FSDataInputStream in = fs.open(p);
+ for (int i = 0; i < appends - 1; i++) {
+ byte[] read = new byte[size];
+ in.read(i * bytes.length, read, 0, size);
+ assertArrayEquals(bytes, read);
+ }
+ in.close();
}
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org
[3/3] hadoop git commit: HDFS-10805. Reduce runtime for append test.
Contributed by Gergely Novak.
Posted by ar...@apache.org.
HDFS-10805. Reduce runtime for append test. Contributed by Gergely Novak.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bdc71bd6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bdc71bd6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bdc71bd6
Branch: refs/heads/branch-2.8
Commit: bdc71bd608b5572a38c75a917b28d5cbc9b7ce2c
Parents: 6a7ce4e
Author: Arpit Agarwal <ar...@apache.org>
Authored: Wed Sep 14 09:31:17 2016 -0700
Committer: Arpit Agarwal <ar...@apache.org>
Committed: Wed Sep 14 09:31:35 2016 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hdfs/AppendTestUtil.java | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hadoop/blob/bdc71bd6/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
index de4da5f..268bdf9 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/AppendTestUtil.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hdfs;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -238,7 +239,8 @@ public class AppendTestUtil {
}
public static void testAppend(FileSystem fs, Path p) throws IOException {
- final byte[] bytes = new byte[1000];
+ final int size = 1000;
+ final byte[] bytes = randomBytes(seed, size);
{ //create file
final FSDataOutputStream out = fs.create(p, (short)1);
@@ -247,12 +249,22 @@ public class AppendTestUtil {
assertEquals(bytes.length, fs.getFileStatus(p).getLen());
}
- for(int i = 2; i < 500; i++) {
+ final int appends = 50;
+ for (int i = 2; i < appends; i++) {
//append
final FSDataOutputStream out = fs.append(p);
out.write(bytes);
out.close();
- assertEquals(i*bytes.length, fs.getFileStatus(p).getLen());
+ assertEquals(i * bytes.length, fs.getFileStatus(p).getLen());
}
+
+ // Check the appended content
+ final FSDataInputStream in = fs.open(p);
+ for (int i = 0; i < appends - 1; i++) {
+ byte[] read = new byte[size];
+ in.read(i * bytes.length, read, 0, size);
+ assertArrayEquals(bytes, read);
+ }
+ in.close();
}
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org