HBASE-5310 HConnectionManager server cache key enhancement (Jimmy Xiang)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1239220 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Zhihong Yu 2012-02-01 17:34:04 +00:00
parent 4b698e776d
commit 457d51bec5
2 changed files with 3 additions and 3 deletions

View File

@ -1156,7 +1156,7 @@ public class HConnectionManager {
for (Map<byte[], HRegionLocation> tableLocations : for (Map<byte[], HRegionLocation> tableLocations :
cachedRegionLocations.values()) { cachedRegionLocations.values()) {
for (Entry<byte[], HRegionLocation> e : tableLocations.entrySet()) { for (Entry<byte[], HRegionLocation> e : tableLocations.entrySet()) {
if (e.getValue().getServerAddress().toString().equals(server)) { if (e.getValue().getHostnamePort().equals(server)) {
tableLocations.remove(e.getKey()); tableLocations.remove(e.getKey());
deletedSomething = true; deletedSomething = true;
} }
@ -1215,7 +1215,7 @@ public class HConnectionManager {
getTableLocations(tableName); getTableLocations(tableName);
boolean hasNewCache = false; boolean hasNewCache = false;
synchronized (this.cachedRegionLocations) { synchronized (this.cachedRegionLocations) {
cachedServers.add(location.getServerAddress().toString()); cachedServers.add(location.getHostnamePort());
hasNewCache = (tableLocations.put(startKey, location) == null); hasNewCache = (tableLocations.put(startKey, location) == null);
} }
if (hasNewCache) { if (hasNewCache) {

View File

@ -172,7 +172,7 @@ public abstract class ServerCallable<T> implements Callable<T> {
// .META. again to find the new location // .META. again to find the new location
HRegionLocation hrl = location; HRegionLocation hrl = location;
if (hrl != null) { if (hrl != null) {
getConnection().clearCaches(hrl.getServerAddress().toString()); getConnection().clearCaches(hrl.getHostnamePort());
} }
} }
RetriesExhaustedException.ThrowableWithExtraContext qt = RetriesExhaustedException.ThrowableWithExtraContext qt =