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:
parent
3221983dda
commit
1c078c3aad
|
@ -97,6 +97,9 @@ Release 0.21.0 - Unreleased
|
|||
HBASE-1949 KeyValue expiration by Time-to-Live during major compaction is
|
||||
broken (Gary Helmling via Stack)
|
||||
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
|
||||
HBASE-1760 Cleanup TODOs in HTable
|
||||
|
|
|
@ -86,6 +86,14 @@ class ProcessServerShutdown extends RegionServerOperation {
|
|||
if (isRootServer) {
|
||||
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);
|
||||
|
||||
metaRegions = new ArrayList<MetaRegion>();
|
||||
|
@ -93,6 +101,12 @@ class ProcessServerShutdown extends RegionServerOperation {
|
|||
MetaRegion r = master.getRegionManager().offlineMetaRegion(region);
|
||||
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
|
||||
|
@ -347,4 +361,4 @@ class ProcessServerShutdown extends RegionServerOperation {
|
|||
protected int getPriority() {
|
||||
return 2; // high but not highest priority
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -824,6 +824,44 @@ public class RegionManager implements HConstants {
|
|||
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
|
||||
* when we know a region has shut down cleanly.
|
||||
|
@ -1604,4 +1642,4 @@ public class RegionManager implements HConstants {
|
|||
return Bytes.compareTo(getRegionName(), o.getRegionName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -636,6 +636,19 @@ public class ServerManager implements HConstants {
|
|||
if (info != null) {
|
||||
LOG.info("Removing server's info " + serverName);
|
||||
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;
|
||||
// update load information
|
||||
updateLoadToServers(serverName, this.serversToLoad.remove(serverName));
|
||||
|
@ -831,4 +844,4 @@ public class ServerManager implements HConstants {
|
|||
m.putAll(this.loadToServers.headMap(l));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue