hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject svn commit: r1363526 - /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/Result.java
Date Thu, 19 Jul 2012 20:31:44 GMT
Author: tedyu
Date: Thu Jul 19 20:31:44 2012
New Revision: 1363526

URL: http://svn.apache.org/viewvc?rev=1363526&view=rev
Log:
HBASE-4956 Control direct memory buffer consumption by HBaseClient (Bob Copeland)


Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/Result.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/Result.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/Result.java?rev=1363526&r1=1363525&r2=1363526&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/Result.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/client/Result.java Thu
Jul 19 20:31:44 2012
@@ -720,10 +720,18 @@ public class Result implements Writable,
       return;
     }
     byte [] raw = new byte[totalBuffer];
-    in.readFully(raw, 0, totalBuffer);
+    readChunked(in, raw, 0, totalBuffer);
     bytes = new ImmutableBytesWritable(raw, 0, totalBuffer);
   }
 
+  private void readChunked(final DataInput in, byte[] dest, int ofs, int len)
+  throws IOException {
+    int maxRead = 8192;
+
+    for (; ofs < len; ofs += maxRead)
+      in.readFully(dest, ofs, Math.min(len - ofs, maxRead));
+  }
+
   //Create KeyValue[] when needed
   private void readFields() {
     if (bytes == null) {



Mime
View raw message