HBASE-1928 ROOT and META tables stay in transition state (making the system not usable) if the designated regionServer dies before the assignment is complete

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@833779 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-11-07 23:42:55 +00:00
parent 3221983dda
commit 1c078c3aad
4 changed files with 71 additions and 3 deletions

View File

@ -97,6 +97,9 @@ Release 0.21.0 - Unreleased
HBASE-1949 KeyValue expiration by Time-to-Live during major compaction is HBASE-1949 KeyValue expiration by Time-to-Live during major compaction is
broken (Gary Helmling via Stack) broken (Gary Helmling via Stack)
HBASE-1957 Get-s can't set a Filter HBASE-1957 Get-s can't set a Filter
HBASE-1928 ROOT and META tables stay in transition state (making the system
not usable) if the designated regionServer dies before the
assignment is complete (Yannis Pavlidis via Stack)
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable HBASE-1760 Cleanup TODOs in HTable

View File

@ -86,6 +86,14 @@ class ProcessServerShutdown extends RegionServerOperation {
if (isRootServer) { if (isRootServer) {
master.getRegionManager().unsetRootRegion(); master.getRegionManager().unsetRootRegion();
} }
else {
//HBASE-1928: Check whether this server has been transitioning the ROOT table
isRootServer = master.getRegionManager().isRootServerCandidate (deadServer);
if (isRootServer) {
master.getRegionManager().unsetRootRegion();
}
}
List<byte[]> metaStarts = master.getRegionManager().listMetaRegionsForServer(deadServerAddress); List<byte[]> metaStarts = master.getRegionManager().listMetaRegionsForServer(deadServerAddress);
metaRegions = new ArrayList<MetaRegion>(); metaRegions = new ArrayList<MetaRegion>();
@ -93,6 +101,12 @@ class ProcessServerShutdown extends RegionServerOperation {
MetaRegion r = master.getRegionManager().offlineMetaRegion(region); MetaRegion r = master.getRegionManager().offlineMetaRegion(region);
metaRegions.add(r); metaRegions.add(r);
} }
//HBASE-1928: Check whether this server has been transitioning the META table
HRegionInfo metaServerRegionInfo = master.getRegionManager().getMetaServerRegionInfo (deadServer);
if (metaServerRegionInfo != null) {
metaRegions.add (new MetaRegion (deadServerAddress, metaServerRegionInfo));
}
} }
@Override @Override

View File

@ -824,6 +824,44 @@ public class RegionManager implements HConstants {
return false; return false;
} }
/**
* Is this server assigned to transition the ROOT table. HBASE-1928
*
* @param server Server
* @return true if server is transitioning the ROOT table
*/
public boolean isRootServerCandidate(final String server) {
for (RegionState s : regionsInTransition.values()) {
if (s.getRegionInfo().isRootRegion()
&& !s.isUnassigned()
&& s.getServerName() != null
&& s.getServerName().equals(server)) {
// Has an outstanding root region to be assigned.
return true;
}
}
return false;
}
/**
* Is this server assigned to transition a META table. HBASE-1928
*
* @param server Server
* @return if this server was transitioning a META table then a not null HRegionInfo pointing to it
*/
public HRegionInfo getMetaServerRegionInfo(final String server) {
for (RegionState s : regionsInTransition.values()) {
if (s.getRegionInfo().isMetaRegion()
&& !s.isUnassigned()
&& s.getServerName() != null
&& s.getServerName().equals(server)) {
// Has an outstanding meta region to be assigned.
return s.getRegionInfo();
}
}
return null;
}
/** /**
* Call to take this metaserver offline for immediate reassignment. Used only * Call to take this metaserver offline for immediate reassignment. Used only
* when we know a region has shut down cleanly. * when we know a region has shut down cleanly.

View File

@ -636,6 +636,19 @@ public class ServerManager implements HConstants {
if (info != null) { if (info != null) {
LOG.info("Removing server's info " + serverName); LOG.info("Removing server's info " + serverName);
this.master.getRegionManager().offlineMetaServer(info.getServerAddress()); this.master.getRegionManager().offlineMetaServer(info.getServerAddress());
//HBASE-1928: Check whether this server has been transitioning the ROOT table
if (this.master.getRegionManager().isRootServerCandidate (serverName)) {
this.master.getRegionManager().unsetRootRegion();
this.master.getRegionManager().reassignRootRegion();
}
//HBASE-1928: Check whether this server has been transitioning the META table
HRegionInfo metaServerRegionInfo = this.master.getRegionManager().getMetaServerRegionInfo (serverName);
if (metaServerRegionInfo != null) {
this.master.getRegionManager().setUnassigned(metaServerRegionInfo, true);
}
infoUpdated = true; infoUpdated = true;
// update load information // update load information
updateLoadToServers(serverName, this.serversToLoad.remove(serverName)); updateLoadToServers(serverName, this.serversToLoad.remove(serverName));