You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by dd...@apache.org on 2013/04/19 03:16:19 UTC

svn commit: r1469655 - in /hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc: HBaseClient.java IPCUtil.java

Author: ddas
Date: Fri Apr 19 01:16:19 2013
New Revision: 1469655

URL: http://svn.apache.org/r1469655
Log:
HBASE-7239. Introduces chunked reading for large cellblocks

Modified:
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
    hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=1469655&r1=1469654&r2=1469655&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java (original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Fri Apr 19 01:16:19 2013
@@ -1026,7 +1026,7 @@ public class HBaseClient {
           if (responseHeader.hasCellBlockMeta()) {
             int size = responseHeader.getCellBlockMeta().getLength();
             byte [] cellBlock = new byte[size];
-            IOUtils.readFully(this.in, cellBlock, 0, cellBlock.length);
+            IPCUtil.readChunked(this.in, cellBlock, 0, size);
             cellBlockScanner = ipcUtil.createCellScanner(this.codec, this.compressor, cellBlock);
           }
           // it's possible that this call may have been cleaned up due to a RPC

Modified: hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java?rev=1469655&r1=1469654&r2=1469655&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java (original)
+++ hbase/branches/0.95/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java Fri Apr 19 01:16:19 2013
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hbase.ipc;
 
 import java.io.ByteArrayInputStream;
+import java.io.DataInput;
 import java.io.DataInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -231,6 +232,23 @@ class IPCUtil {
   }
 
   /**
+   * Read in chunks of 8K (HBASE-7239)
+   * @param in
+   * @param dest
+   * @param offset
+   * @param len
+   * @throws IOException
+   */
+  static void readChunked(final DataInput in, byte[] dest, int offset, int len)
+      throws IOException {
+    int maxRead = 8192;
+
+    for (; offset < len; offset += maxRead) {
+      in.readFully(dest, offset, Math.min(len - offset, maxRead));
+    }
+  }
+
+  /**
    * @param header
    * @param body
    * @return Size on the wire when the two messages are written with writeDelimitedTo