Author: todd
Date: Tue Oct 19 06:03:25 2010
New Revision: 1024125
URL: http://svn.apache.org/viewvc?rev=1024125&view=rev
Log:
HBASE-3115. HBaseClient wastes 1 TCP packet per RPC
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
Modified: hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1024125&r1=1024124&r2=1024125&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Tue Oct 19 06:03:25 2010
@@ -1013,6 +1013,7 @@ Release 0.21.0 - Unreleased
table in all tests and tests enable/disable/delete
HBASE-3097 Merge in hbase-1200 doc on bloomfilters into hbase book
HBASE-2700 Test of: Handle master failover for regions in transition
+ HBASE-3115 HBaseClient wastes 1 TCP packet per RPC
NEW FEATURES
HBASE-1961 HBase EC2 scripts
Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=1024125&r1=1024124&r2=1024125&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Tue
Oct 19 06:03:25 2010
@@ -23,6 +23,7 @@ package org.apache.hadoop.hbase.ipc;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.io.DataOutputBuffer;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.io.ObjectWritable;
@@ -484,12 +485,14 @@ public class HBaseClient {
//for serializing the
//data to be written
d = new DataOutputBuffer();
+ d.writeInt(0xdeadbeef); // placeholder for data length
d.writeInt(call.id);
call.param.write(d);
byte[] data = d.getData();
int dataLength = d.getLength();
- out.writeInt(dataLength); //first put the data length
- out.write(data, 0, dataLength);//write the data
+ // fill in the placeholder
+ Bytes.putInt(data, 0, dataLength - 4);
+ out.write(data, 0, dataLength);
out.flush();
}
} catch(IOException e) {