From ac8b6f9e2d13e214146d6b94ca79ffad491fee29 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 9 Aug 2011 16:22:38 +0000 Subject: [PATCH] HBASE-4181 HConnectionManager can't find cached HRegionInterface and makes clients work very slow git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1155424 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 2 ++ .../hadoop/hbase/client/HConnectionManager.java | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 7c6f592da2b..e9c0478fc6f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -194,6 +194,8 @@ Release 0.91.0 - Unreleased if it already exists (Mikhail Bautin) HBASE-4179 Failed to run RowCounter on top of Hadoop branch-0.22 (Michael Weng) + HBASE-4181 HConnectionManager can't find cached HRegionInterface and makes clients + work very slow (Jia Liu) IMPROVEMENTS HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack) diff --git a/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java b/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java index 6fb53817ce6..aa09b7da5b0 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java +++ b/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java @@ -1166,8 +1166,13 @@ public class HConnectionManager { throws IOException { if (master) getMaster(); HRegionInterface server; - String rsName = isa != null? - isa.toString(): Addressing.createHostAndPortStr(hostname, port); + String rsName = null; + if (isa != null) { + rsName = Addressing.createHostAndPortStr(isa.getHostName(), + isa.getPort()); + } else { + rsName = Addressing.createHostAndPortStr(hostname, port); + } // See if we already have a connection (common case) server = this.servers.get(rsName); if (server == null) { @@ -1190,7 +1195,8 @@ public class HConnectionManager { serverInterfaceClass, HRegionInterface.VERSION, address, this.conf, this.maxRPCAttempts, this.rpcTimeout, this.rpcTimeout); - this.servers.put(address.toString(), server); + this.servers.put(Addressing.createHostAndPortStr( + address.getHostName(), address.getPort()), server); } catch (RemoteException e) { LOG.warn("RemoteException connecting to RS", e); // Throw what the RemoteException was carrying.