HBASE-7800 RegionMovedException can cause servers to play ping pong with client (Sergey)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1448767 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10e9c4eb39
commit
49cab5a7c2
|
@ -2532,7 +2532,6 @@ public class HRegionServer implements ClientProtocol,
|
||||||
}
|
}
|
||||||
addToMovedRegions(r.getRegionInfo().getEncodedName(), destination, closeSeqNum);
|
addToMovedRegions(r.getRegionInfo().getEncodedName(), destination, closeSeqNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
return toReturn != null;
|
return toReturn != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3480,6 +3479,10 @@ public class HRegionServer implements ClientProtocol,
|
||||||
" - ignoring this new request for this region.");
|
" - ignoring this new request for this region.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We are opening this region. If it moves back and forth for whatever reason, we don't
|
||||||
|
// want to keep returning the stale moved record while we are opening/if we close again.
|
||||||
|
removeFromMovedRegions(region.getEncodedName());
|
||||||
|
|
||||||
if (previous == null) {
|
if (previous == null) {
|
||||||
// If there is no action in progress, we can submit a specific handler.
|
// If there is no action in progress, we can submit a specific handler.
|
||||||
// Need to pass the expected version in the constructor.
|
// Need to pass the expected version in the constructor.
|
||||||
|
@ -3967,9 +3970,11 @@ public class HRegionServer implements ClientProtocol,
|
||||||
LOG.info("Adding moved region record: " + encodedName + " to "
|
LOG.info("Adding moved region record: " + encodedName + " to "
|
||||||
+ destination.getServerName() + ":" + destination.getPort()
|
+ destination.getServerName() + ":" + destination.getPort()
|
||||||
+ " as of " + closeSeqNum);
|
+ " as of " + closeSeqNum);
|
||||||
movedRegions.put(
|
movedRegions.put(encodedName, new MovedRegionInfo(destination, closeSeqNum));
|
||||||
encodedName,
|
}
|
||||||
new MovedRegionInfo(destination, closeSeqNum));
|
|
||||||
|
private void removeFromMovedRegions(String encodedName) {
|
||||||
|
movedRegions.remove(encodedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MovedRegionInfo getMovedRegion(final String encodedRegionName) {
|
private MovedRegionInfo getMovedRegion(final String encodedRegionName) {
|
||||||
|
@ -3990,7 +3995,7 @@ public class HRegionServer implements ClientProtocol,
|
||||||
/**
|
/**
|
||||||
* Remove the expired entries from the moved regions list.
|
* Remove the expired entries from the moved regions list.
|
||||||
*/
|
*/
|
||||||
protected void cleanMovedRegions(){
|
protected void cleanMovedRegions() {
|
||||||
final long cutOff = System.currentTimeMillis() - TIMEOUT_REGION_MOVED;
|
final long cutOff = System.currentTimeMillis() - TIMEOUT_REGION_MOVED;
|
||||||
Iterator<Entry<String, MovedRegionInfo>> it = movedRegions.entrySet().iterator();
|
Iterator<Entry<String, MovedRegionInfo>> it = movedRegions.entrySet().iterator();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue