HBASE-3026 Fixup of missing daughters on split is too aggressive

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1000133 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-09-22 18:42:41 +00:00
parent 0de40fe1b0
commit a46c74894f
4 changed files with 13 additions and 7 deletions

View File

@ -534,6 +534,7 @@ Release 0.21.0 - Unreleased
servers assigning in bulk to one at a time
HBASE-3023 NPE processing server crash in MetaReader. getServerUserRegions
HBASE-3024 NPE processing server crash in MetaEditor.addDaughter
HBASE-3026 Fixup of "missing" daughters on split is too aggressive
IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable

View File

@ -486,7 +486,6 @@ public class AssignmentManager extends ZooKeeperListener {
* @param regionName server to be assigned
*/
public void assign(HRegionInfo region) {
LOG.debug("Starting assignment for region " + region.getRegionNameAsString());
// Grab the state of this region and synchronize on it
String encodedName = region.getEncodedName();
RegionState state;
@ -546,6 +545,9 @@ public class AssignmentManager extends ZooKeeperListener {
}
}
try {
LOG.debug("Assigning region " +
state.getRegion().getRegionNameAsString() + " to " +
plan.getDestination().getServerName());
// Send OPEN RPC. This can fail if the server on other end is is not up.
serverManager.sendRegionOpen(plan.getDestination(), state.getRegion());
// Transition RegionState to PENDING_OPEN
@ -726,7 +728,6 @@ public class AssignmentManager extends ZooKeeperListener {
// regionsInTransition timing out. Currently its not possible given the
// Executor architecture on the regionserver side. St.Ack 20100920.
for (HRegionInfo region : regions) {
LOG.debug("Assigning " + region.getRegionNameAsString() + " to " + this.server);
regionPlans.put(region.getEncodedName(), new RegionPlan(region, null, server));
assign(region);
if (this.stopper.isStopped()) break;

View File

@ -563,7 +563,8 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
// Only allow one balance run at at time.
if (this.assignmentManager.isRegionsInTransition()) {
LOG.debug("Not running balancer because regions in transition: " +
this.assignmentManager.getRegionsInTransition());
org.apache.commons.lang.StringUtils.
abbreviate(this.assignmentManager.getRegionsInTransition().toString(), 64));
return false;
}
if (!this.serverManager.getDeadServers().isEmpty()) {
@ -582,7 +583,7 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
List<RegionPlan> plans = this.balancer.balanceCluster(assignments);
if (plans != null && !plans.isEmpty()) {
for (RegionPlan plan: plans) {
LOG.info("balance=" + plan);
LOG.info("balance " + plan);
this.assignmentManager.balance(plan);
}
}

View File

@ -27,6 +27,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HServerAddress;
import org.apache.hadoop.hbase.HServerInfo;
import org.apache.hadoop.hbase.Server;
import org.apache.hadoop.hbase.catalog.MetaEditor;
@ -106,7 +107,7 @@ public class ServerShutdownHandler extends EventHandler {
NavigableMap<HRegionInfo, Result> hris =
MetaReader.getServerUserRegions(this.server.getCatalogTracker(), this.hsi);
LOG.info("Reassigning the " + hris.size() + " region(s) that " + serverName +
" was carrying.");
" was carrying");
// We should encounter -ROOT- and .META. first in the Set given how its
// a sorted set.
@ -151,7 +152,9 @@ public class ServerShutdownHandler extends EventHandler {
byte [] bytes = result.getValue(HConstants.CATALOG_FAMILY, qualifier);
if (bytes == null || bytes.length <= 0) return;
HRegionInfo hri = Writables.getHRegionInfo(bytes);
if (!hris.containsKey(hri)) {
Pair<HRegionInfo, HServerAddress> pair =
MetaReader.getRegion(this.server.getCatalogTracker(), hri.getRegionName());
if (pair == null || pair.getFirst() == null) {
LOG.info("Fixup; missing daughter " + hri.getEncodedName());
MetaEditor.addDaughter(this.server.getCatalogTracker(), hri, null);
this.services.getAssignmentManager().assign(hri);