hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject hadoop git commit: HDFS-10351. Ozone: Optimize key writes to chunks by providing a bulk write implementation in ChunkOutputStream. Contributed by Chris Nauroth.
Date Mon, 02 May 2016 21:52:29 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 8264b6165 -> 183175e60


HDFS-10351. Ozone: Optimize key writes to chunks by providing a bulk write implementation
in ChunkOutputStream. Contributed by Chris Nauroth.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/183175e6
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/183175e6
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/183175e6

Branch: refs/heads/HDFS-7240
Commit: 183175e60fc677398c38b2d41d898826f22cd595
Parents: 8264b61
Author: Anu Engineer <aengineer@apache.org>
Authored: Mon May 2 14:50:40 2016 -0700
Committer: Anu Engineer <aengineer@apache.org>
Committed: Mon May 2 14:50:40 2016 -0700

----------------------------------------------------------------------
 .../web/localstorage/OzoneMetadataManager.java  |  2 --
 .../ozone/web/storage/ChunkOutputStream.java    | 26 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/183175e6/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java
index ce168f1..73b284e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/localstorage/OzoneMetadataManager.java
@@ -380,8 +380,6 @@ public final class OzoneMetadataManager {
   public ListVolumes listVolumes(ListArgs args) throws OzoneException {
     lock.readLock().lock();
     try {
-      Preconditions.checkState(args.getArgs() instanceof UserArgs);
-
       if (args.isRootScan()) {
         return listAllVolumes(args);
       }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/183175e6/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkOutputStream.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkOutputStream.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkOutputStream.java
index d4e639f..e153bb2 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkOutputStream.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/web/storage/ChunkOutputStream.java
@@ -101,6 +101,32 @@ class ChunkOutputStream extends OutputStream {
   }
 
   @Override
+  public void write(byte[] b, int off, int len) throws IOException {
+    if (b == null) {
+      throw new NullPointerException();
+    }
+    if ((off < 0) || (off > b.length) || (len < 0) ||
+        ((off + len) > b.length) || ((off + len) < 0)) {
+      throw new IndexOutOfBoundsException();
+    }
+    if (len == 0) {
+      return;
+    }
+    checkOpen();
+    while (len > 0) {
+      int writeLen = Math.min(CHUNK_SIZE - buffer.position(), len);
+      int rollbackPosition = buffer.position();
+      int rollbackLimit = buffer.limit();
+      buffer.put(b, off, writeLen);
+      if (buffer.position() == CHUNK_SIZE) {
+        flushBufferToChunk(rollbackPosition, rollbackLimit);
+      }
+      off += writeLen;
+      len -= writeLen;
+    }
+  }
+
+  @Override
   public synchronized void flush() throws IOException {
     checkOpen();
     if (buffer.position() > 0) {


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message