HBASE-1573 Holes in master state change; updated startcode and server go into .META. but catalog scanner just got old values

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@799014 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-07-29 19:00:35 +00:00
parent 344da145cf
commit ea183fe272
4 changed files with 21 additions and 20 deletions

View File

@ -302,6 +302,8 @@ Release 0.20.0 - Unreleased
have (Doğacan Güney via Ryan Rawson and Stack) have (Doğacan Güney via Ryan Rawson and Stack)
HBASE-1718 Reuse of KeyValue during log replay could cause the wrong HBASE-1718 Reuse of KeyValue during log replay could cause the wrong
data to be used data to be used
HBASE-1573 Holes in master state change; updated startcode and server
go into .META. but catalog scanner just got old values (redux)
IMPROVEMENTS IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -347,14 +347,11 @@ abstract class BaseScanner extends Chore implements HConstants {
HServerInfo storedInfo = null; HServerInfo storedInfo = null;
synchronized (this.master.regionManager) { synchronized (this.master.regionManager) {
/* We don't assign regions that are offline, in transition or were on /* We don't assign regions that are offline, in transition or were on
* a dead server (unless they have an empty serverName which would imply * a dead server. Regions that were on a dead server will get reassigned
* they haven't been assigned in the first place OR it was closed from * by ProcessServerShutdown
* the shell with 'close_region' which deletes server and startcode
* from .META. so region gets reassigned). Regions that were on a dead
* server will get reassigned by ProcessServerShutdown
*/ */
if (info.isOffline() || if (info.isOffline() ||
(serverName != null && this.master.regionManager.regionIsInTransition(info.getRegionNameAsString())) || this.master.regionManager.regionIsInTransition(info.getRegionNameAsString()) ||
(serverName != null && this.master.serverManager.isDead(serverName))) { (serverName != null && this.master.serverManager.isDead(serverName))) {
return; return;
} }
@ -368,8 +365,8 @@ abstract class BaseScanner extends Chore implements HConstants {
// The current assignment is invalid // The current assignment is invalid
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Current assignment of " + info.getRegionNameAsString() + LOG.debug("Current assignment of " + info.getRegionNameAsString() +
" is not valid; " + " Server '" + serverAddress + "' startCode: " + " is not valid; " + " serverAddress=" + serverAddress +
startCode + " unknown."); ", startCode=" + startCode + " unknown.");
} }
// Now get the region assigned // Now get the region assigned
this.master.regionManager.setUnassigned(info, true); this.master.regionManager.setUnassigned(info, true);

View File

@ -1025,10 +1025,16 @@ public class HMaster extends Thread implements HConstants, HMasterInterface,
servername = servername =
Bytes.toString(rr.getValue(CATALOG_FAMILY, SERVER_QUALIFIER)); Bytes.toString(rr.getValue(CATALOG_FAMILY, SERVER_QUALIFIER));
} }
// Need to make up a HServerInfo 'servername' for that is how
// items are keyed in regionmanager Maps.
HServerAddress addr = new HServerAddress(servername);
long startCode =
Bytes.toLong(rr.getValue(CATALOG_FAMILY, STARTCODE_QUALIFIER));
String name = HServerInfo.getServerName(addr, startCode);
LOG.info("Marking " + hri.getRegionNameAsString() + LOG.info("Marking " + hri.getRegionNameAsString() +
" as closed on " + servername + "; cleaning SERVER + STARTCODE; " + " as closing on " + name + "; cleaning SERVER + STARTCODE; " +
"master will tell regionserver to close region on next heartbeat"); "master will tell regionserver to close region on next heartbeat");
this.regionManager.setClosing(servername, hri, hri.isOffline()); this.regionManager.setClosing(name, hri, hri.isOffline());
MetaRegion meta = this.regionManager.getMetaRegionForRow(regionname); MetaRegion meta = this.regionManager.getMetaRegionForRow(regionname);
HRegionInterface srvr = getMETAServer(meta); HRegionInterface srvr = getMETAServer(meta);
HRegion.cleanRegionInMETA(srvr, meta.getRegionName(), hri); HRegion.cleanRegionInMETA(srvr, meta.getRegionName(), hri);

View File

@ -25,11 +25,8 @@ import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HServerAddress; import org.apache.hadoop.hbase.HServerAddress;
import org.apache.hadoop.hbase.HServerInfo; import org.apache.hadoop.hbase.HServerInfo;
import org.apache.hadoop.hbase.RegionHistorian; import org.apache.hadoop.hbase.RegionHistorian;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.ipc.HRegionInterface; import org.apache.hadoop.hbase.ipc.HRegionInterface;
import org.apache.hadoop.hbase.io.BatchUpdate;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
/** /**
@ -77,16 +74,15 @@ class ProcessRegionOpen extends ProcessRegionStatusChange {
serverInfo.getServerAddress().toString()); serverInfo.getServerAddress().toString());
// Register the newly-available Region's location. // Register the newly-available Region's location.
LOG.info("updating row " + regionInfo.getRegionNameAsString() +
" in region " + Bytes.toString(metaRegionName) +
" with startcode " + serverInfo.getStartCode() + " and server " +
serverInfo.getServerAddress());
Put p = new Put(regionInfo.getRegionName()); Put p = new Put(regionInfo.getRegionName());
p.add(CATALOG_FAMILY, SERVER_QUALIFIER, p.add(CATALOG_FAMILY, SERVER_QUALIFIER,
Bytes.toBytes(serverInfo.getServerAddress().toString())); Bytes.toBytes(serverInfo.getServerAddress().toString()));
p.add(CATALOG_FAMILY, STARTCODE_QUALIFIER, p.add(CATALOG_FAMILY, STARTCODE_QUALIFIER,
Bytes.toBytes(serverInfo.getStartCode())); Bytes.toBytes(serverInfo.getStartCode()));
server.put(metaRegionName, p); server.put(metaRegionName, p);
LOG.info("Updated row " + regionInfo.getRegionNameAsString() +
" in region " + Bytes.toString(metaRegionName) + " with startcode=" +
serverInfo.getStartCode() + ", server=" + serverInfo.getServerAddress());
if (!historian.isOnline()) { if (!historian.isOnline()) {
// This is safest place to do the onlining of the historian in // This is safest place to do the onlining of the historian in
// the master. When we get to here, we know there is a .META. // the master. When we get to here, we know there is a .META.