HBASE-614 Retiring regions is not used; exploit or remove
git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@654653 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7eddf55102
commit
8544e3d1f3
|
@ -49,6 +49,7 @@ Hbase Change Log
|
||||||
HBASE-600 Filters have excessive DEBUG logging
|
HBASE-600 Filters have excessive DEBUG logging
|
||||||
HBASE-611 regionserver should do basic health check before reporting
|
HBASE-611 regionserver should do basic health check before reporting
|
||||||
alls-well to the master
|
alls-well to the master
|
||||||
|
HBASE-614 Retiring regions is not used; exploit or remove
|
||||||
|
|
||||||
Release 0.1.1 - 04/11/2008
|
Release 0.1.1 - 04/11/2008
|
||||||
|
|
||||||
|
|
|
@ -190,33 +190,11 @@ implements RegionUnavailableListener, HConstants {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void closing(final Text regionName) {
|
public void closing(@SuppressWarnings("unused") final Text regionName) {
|
||||||
startTime = System.currentTimeMillis();
|
|
||||||
server.getWriteLock().lock();
|
|
||||||
try {
|
|
||||||
// Remove region from regions Map and add it to the Map of retiring
|
|
||||||
// regions.
|
|
||||||
server.setRegionClosing(regionName);
|
|
||||||
if (LOG.isDebugEnabled()) {
|
|
||||||
LOG.debug(regionName.toString() + " closing (" +
|
|
||||||
"Adding to retiringRegions)");
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
server.getWriteLock().unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void closed(final Text regionName) {
|
public void closed(@SuppressWarnings("unused") final Text regionName) {
|
||||||
server.getWriteLock().lock();
|
|
||||||
try {
|
|
||||||
server.setRegionClosed(regionName);
|
|
||||||
if (LOG.isDebugEnabled()) {
|
|
||||||
LOG.debug(regionName.toString() + " closed");
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
server.getWriteLock().unlock();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -115,8 +115,6 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
|
||||||
// region name -> HRegion
|
// region name -> HRegion
|
||||||
protected volatile Map<Text, HRegion> onlineRegions =
|
protected volatile Map<Text, HRegion> onlineRegions =
|
||||||
new ConcurrentHashMap<Text, HRegion>();
|
new ConcurrentHashMap<Text, HRegion>();
|
||||||
protected volatile Map<Text, HRegion> retiringRegions =
|
|
||||||
new ConcurrentHashMap<Text, HRegion>();
|
|
||||||
|
|
||||||
protected final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
protected final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
|
||||||
private volatile List<HMsg> outboundMsgs =
|
private volatile List<HMsg> outboundMsgs =
|
||||||
|
@ -1295,43 +1293,11 @@ public class HRegionServer implements HConstants, HRegionInterface, Runnable {
|
||||||
* @throws NotServingRegionException
|
* @throws NotServingRegionException
|
||||||
*/
|
*/
|
||||||
protected HRegion getRegion(final Text regionName)
|
protected HRegion getRegion(final Text regionName)
|
||||||
throws NotServingRegionException {
|
|
||||||
return getRegion(regionName, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Move a region from online to closing. */
|
|
||||||
void setRegionClosing(final Text regionName) {
|
|
||||||
retiringRegions.put(regionName, onlineRegions.remove(regionName));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set a region as closed. */
|
|
||||||
void setRegionClosed(final Text regionName) {
|
|
||||||
retiringRegions.remove(regionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Protected utility method for safely obtaining an HRegion handle.
|
|
||||||
* @param regionName Name of online {@link HRegion} to return
|
|
||||||
* @param checkRetiringRegions Set true if we're to check retiring regions
|
|
||||||
* as well as online regions.
|
|
||||||
* @return {@link HRegion} for <code>regionName</code>
|
|
||||||
* @throws NotServingRegionException
|
|
||||||
*/
|
|
||||||
protected HRegion getRegion(final Text regionName,
|
|
||||||
final boolean checkRetiringRegions)
|
|
||||||
throws NotServingRegionException {
|
throws NotServingRegionException {
|
||||||
HRegion region = null;
|
HRegion region = null;
|
||||||
this.lock.readLock().lock();
|
this.lock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
region = onlineRegions.get(regionName);
|
region = onlineRegions.get(regionName);
|
||||||
if (region == null && checkRetiringRegions) {
|
|
||||||
region = this.retiringRegions.get(regionName);
|
|
||||||
if (LOG.isDebugEnabled()) {
|
|
||||||
if (region != null) {
|
|
||||||
LOG.debug("Found region " + regionName + " in retiringRegions");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (region == null) {
|
if (region == null) {
|
||||||
throw new NotServingRegionException(regionName.toString());
|
throw new NotServingRegionException(regionName.toString());
|
||||||
|
|
Loading…
Reference in New Issue