From a46c74894f20e8fb727c0545f645591fbde99559 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Wed, 22 Sep 2010 18:42:41 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 1 + .../apache/hadoop/hbase/master/AssignmentManager.java | 5 +++-- .../java/org/apache/hadoop/hbase/master/HMaster.java | 5 +++-- .../hbase/master/handler/ServerShutdownHandler.java | 9 ++++++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 6000ec1fb37..c2788f3c98f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java b/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java index 210b89d87c1..2f0775bbb53 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java +++ b/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java @@ -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; diff --git a/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index f580c0b9313..36ba5c1b035 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -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 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); } } diff --git a/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java b/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java index ccd4d36cfa7..4747c25ee57 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java +++ b/src/main/java/org/apache/hadoop/hbase/master/handler/ServerShutdownHandler.java @@ -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 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,10 +152,12 @@ 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 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); } } -} \ No newline at end of file +}