HBASE-1344 WARN IllegalStateException: Cannot set a region as open if it has not been pending

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@772493 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-05-07 03:46:37 +00:00
parent 6566301e47
commit 99de3f7364
5 changed files with 69 additions and 44 deletions

View File

@ -113,6 +113,8 @@ Release 0.20.0 - Unreleased
HBASE-1374 NPE out of ZooKeeperWrapper.loadZooKeeperConfig
HBASE-1336 Splitting up the compare of family+column into 2 different compare
HBASE-1377 RS address is null in master web UI
HBASE-1344 WARN IllegalStateException: Cannot set a region as open if it has
not been pending
IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -556,10 +556,16 @@ public class HColumnDescriptor implements ISerializable, WritableComparable<HCol
s.append("'");
for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e:
values.entrySet()) {
String key = Bytes.toString(e.getKey().get());
String value = Bytes.toString(e.getValue().get());
if (key != null && key.toUpperCase().equals(BLOOMFILTER)) {
// Don't emit bloomfilter. Its not working.
continue;
}
s.append(", ");
s.append(Bytes.toString(e.getKey().get()));
s.append(key);
s.append(" => '");
s.append(Bytes.toString(e.getValue().get()));
s.append(value);
s.append("'");
}
s.append('}');

View File

@ -483,6 +483,18 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor>, I
s.append("'");
for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e:
values.entrySet()) {
String key = Bytes.toString(e.getKey().get());
String value = Bytes.toString(e.getValue().get());
if (key == null) {
continue;
}
String upperCase = key.toUpperCase();
if (upperCase.equals(IS_ROOT) || upperCase.equals(IS_META)) {
// Skip. Don't bother printing out read-only values if false.
if (value.toLowerCase().equals(Boolean.FALSE.toString())) {
continue;
}
}
s.append(", ");
s.append(Bytes.toString(e.getKey().get()));
s.append(" => '");
@ -493,11 +505,13 @@ public class HTableDescriptor implements WritableComparable<HTableDescriptor>, I
s.append(FAMILIES);
s.append(" => ");
s.append(families.values());
if (!indexes.isEmpty()) {
// Don't emit if empty. Has to do w/ transactional hbase.
s.append(", ");
s.append("INDEXES");
s.append(" => ");
s.append(indexes.values());
}
s.append('}');
return s.toString();
}

View File

@ -330,7 +330,6 @@ abstract class BaseScanner extends Chore implements HConstants {
protected void checkAssigned(final HRegionInfo info,
final String serverAddress, final long startCode)
throws IOException {
String serverName = null;
if (serverAddress != null && serverAddress.length() > 0) {
serverName = HServerInfo.getServerName(serverAddress, startCode);
@ -347,7 +346,6 @@ abstract class BaseScanner extends Chore implements HConstants {
this.master.regionManager.regionIsInTransition(
info.getRegionNameAsString()) ||
this.master.serverManager.isDead(serverName)) {
return;
}
storedInfo = this.master.serverManager.getServerInfo(serverName);

View File

@ -281,13 +281,7 @@ class RegionManager implements HConstants {
}
for (RegionState s: regionsToAssign) {
LOG.info("assigning region " + Bytes.toString(s.getRegionName())+
" to server " + info.getServerName());
s.setPendingOpen(info.getServerName());
this.historian.addRegionAssignment(s.getRegionInfo(),
info.getServerName());
returnMsgs.add(
new HMsg(HMsg.Type.MSG_REGION_OPEN, s.getRegionInfo()));
doRegionAssignment(s, info, returnMsgs);
if (--nregions <= 0) {
break;
}
@ -295,6 +289,41 @@ class RegionManager implements HConstants {
}
}
/*
* Assign all to the only server. An unlikely case but still possible.
*
* Note that no synchronization is needed on regionsInTransition while
* iterating on it because the only caller is assignRegions whose caller owns
* the monitor for RegionManager
*
* @param regionsToAssign
* @param serverName
* @param returnMsgs
*/
private void assignRegionsToOneServer(final Set<RegionState> regionsToAssign,
final HServerInfo info, final ArrayList<HMsg> returnMsgs) {
for (RegionState s: regionsToAssign) {
doRegionAssignment(s, info, returnMsgs);
}
}
/*
* Do single region assignment.
* @param rs
* @param sinfo
* @param returnMsgs
*/
private void doRegionAssignment(final RegionState rs,
final HServerInfo sinfo, final ArrayList<HMsg> returnMsgs) {
String regionName = rs.getRegionInfo().getRegionNameAsString();
LOG.info("Assigning region " + regionName + " to " + sinfo.getServerName());
rs.setPendingOpen(sinfo.getServerName());
this.regionsInTransition.put(regionName, rs);
this.historian.addRegionAssignment(rs.getRegionInfo(),
sinfo.getServerName());
returnMsgs.add(new HMsg(HMsg.Type.MSG_REGION_OPEN, rs.getRegionInfo()));
}
/*
* @param nRegionsToAssign
* @param thisServersLoad
@ -395,30 +424,6 @@ class RegionManager implements HConstants {
return nservers;
}
/*
* Assign all to the only server. An unlikely case but still possible.
*
* Note that no synchronization is needed on regionsInTransition while
* iterating on it because the only caller is assignRegions whose caller owns
* the monitor for RegionManager
*
* @param regionsToAssign
* @param serverName
* @param returnMsgs
*/
private void assignRegionsToOneServer(final Set<RegionState> regionsToAssign,
final HServerInfo info, final ArrayList<HMsg> returnMsgs) {
for (RegionState s: regionsToAssign) {
LOG.info("assigning region " + Bytes.toString(s.getRegionName()) +
" to the only server " + info.getServerName());
s.setPendingOpen(info.getServerName());
this.historian.addRegionAssignment(s.getRegionInfo(), info.getServerName());
returnMsgs.add(
new HMsg(HMsg.Type.MSG_REGION_OPEN, s.getRegionInfo()));
}
}
/*
* The server checking in right now is overloaded. We will tell it to close
* some or all of its most loaded regions, allowing it to reduce its load.
@ -719,7 +724,7 @@ class RegionManager implements HConstants {
* @param info
*/
public void removeRegion(HRegionInfo info) {
regionsInTransition.remove(info.getRegionNameAsString());
this.regionsInTransition.remove(info.getRegionNameAsString());
}
/**