HADOOP-2109 Fix another race condition in processing dead servers, Fix error online meta regions: was using region name and not startKey as key for map.put

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk/src/contrib/hbase@591722 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jim Kellerman 2007-11-04 01:47:24 +00:00
parent ad743978ed
commit 41c71508db
2 changed files with 25 additions and 19 deletions

View File

@ -20,7 +20,9 @@ Trunk (unreleased changes)
HADOOP-2083 TestTableIndex failed in #970 and #956 HADOOP-2083 TestTableIndex failed in #970 and #956
HADOOP-2109 Fixed race condition in processing server lease timeout. HADOOP-2109 Fixed race condition in processing server lease timeout.
HADOOP-2137 hql.jsp : The character 0x19 is not valid HADOOP-2137 hql.jsp : The character 0x19 is not valid
HADOOP-2109 Fix another race condition in processing dead servers HADOOP-2109 Fix another race condition in processing dead servers,
Fix error online meta regions: was using region name and not
startKey as key for map.put
IMPROVEMENTS IMPROVEMENTS
HADOOP-2401 Add convenience put method that takes writable HADOOP-2401 Add convenience put method that takes writable

View File

@ -1927,6 +1927,10 @@ HMasterRegionInterface {
"meta and clearing pendingRegions"); "meta and clearing pendingRegions");
if (info.getTableDesc().getName().equals(META_TABLE_NAME)) { if (info.getTableDesc().getName().equals(META_TABLE_NAME)) {
if (LOG.isDebugEnabled()) {
LOG.debug("removing meta region " + info.getRegionName() +
" from online meta regions");
}
onlineMetaRegions.remove(info.getStartKey()); onlineMetaRegions.remove(info.getStartKey());
} }
@ -2082,27 +2086,27 @@ HMasterRegionInterface {
rootRescanned = true; rootRescanned = true;
} }
if (LOG.isDebugEnabled()) {
LOG.debug("numberOfMetaRegions: " + numberOfMetaRegions.get() +
", onlineMetaRegions.size(): " + onlineMetaRegions.size());
}
if (numberOfMetaRegions.get() != onlineMetaRegions.size()) {
// We can't proceed because not all of the meta regions are online.
// We can't block either because that would prevent the meta region
// online message from being processed. So return false to have this
// operation requeued.
if (LOG.isDebugEnabled()) {
LOG.debug(
"Requeuing shutdown because not all meta regions are online");
}
return false;
}
for (int tries = 0; tries < numRetries; tries++) { for (int tries = 0; tries < numRetries; tries++) {
try { try {
if (closed.get()) { if (closed.get()) {
return true; return true;
} }
if (!rootRescanned ||
numberOfMetaRegions.get() != onlineMetaRegions.size()) {
// We can't proceed because not all of the meta regions are online.
// We can't block either because that would prevent the meta region
// online message from being processed. So return false to have this
// operation requeued.
if (LOG.isDebugEnabled()) {
LOG.debug("Requeuing shutdown because rootScanned: " +
rootRescanned + ", numberOfMetaRegions: " +
numberOfMetaRegions.get() + ", onlineMetaRegions.size(): " +
onlineMetaRegions.size());
}
return false;
}
for (MetaRegion r: onlineMetaRegions.values()) { for (MetaRegion r: onlineMetaRegions.values()) {
HRegionInterface server = null; HRegionInterface server = null;
@ -2364,7 +2368,7 @@ HMasterRegionInterface {
if (region.getTableDesc().getName().equals(META_TABLE_NAME)) { if (region.getTableDesc().getName().equals(META_TABLE_NAME)) {
// It's a meta region. // It's a meta region.
MetaRegion m = new MetaRegion(this.serverAddress, MetaRegion m = new MetaRegion(this.serverAddress,
this.region.getRegionName(), this.region.getRegionName()); this.region.getRegionName(), this.region.getStartKey());
if (!initialMetaScanComplete) { if (!initialMetaScanComplete) {
// Put it on the queue to be scanned for the first time. // Put it on the queue to be scanned for the first time.
try { try {
@ -2377,7 +2381,7 @@ HMasterRegionInterface {
} else { } else {
// Add it to the online meta regions // Add it to the online meta regions
LOG.debug("Adding to onlineMetaRegions: " + m.toString()); LOG.debug("Adding to onlineMetaRegions: " + m.toString());
onlineMetaRegions.put(this.region.getRegionName(), m); onlineMetaRegions.put(this.region.getStartKey(), m);
} }
} }
// If updated successfully, remove from pending list. // If updated successfully, remove from pending list.