From d4d7ceef684b359fcd93f64892747c9c298dfce5 Mon Sep 17 00:00:00 2001 From: Todd Lipcon Date: Tue, 19 Oct 2010 06:03:25 +0000 Subject: [PATCH] HBASE-3115. HBaseClient wastes 1 TCP packet per RPC git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1024125 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 3ccfa524d2d..7f5d5868717 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java b/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java index 2b5eeb6d244..ac44b40da71 100644 --- a/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java +++ b/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java @@ -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) {