HBASE-6089 SSH and AM.joinCluster causes Concurrent Modification exception. (Rajesh)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1344816 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2012-05-31 17:05:59 +00:00
parent ff2bcd4760
commit f05b600cf4
3 changed files with 17 additions and 20 deletions

View File

@ -358,7 +358,6 @@ public class AssignmentManager extends ZooKeeperListener {
/** /**
* Called on startup. * Called on startup.
* Figures whether a fresh cluster start of we are joining extant running cluster. * Figures whether a fresh cluster start of we are joining extant running cluster.
* @param onlineServers onlined servers when master started
* @throws IOException * @throws IOException
* @throws KeeperException * @throws KeeperException
* @throws InterruptedException * @throws InterruptedException
@ -426,17 +425,19 @@ public class AssignmentManager extends ZooKeeperListener {
// Run through all regions. If they are not assigned and not in RIT, then // Run through all regions. If they are not assigned and not in RIT, then
// its a clean cluster startup, else its a failover. // its a clean cluster startup, else its a failover.
for (Map.Entry<HRegionInfo, ServerName> e: this.regions.entrySet()) { synchronized (this.regions) {
if (!e.getKey().isMetaTable() && e.getValue() != null) { for (Map.Entry<HRegionInfo, ServerName> e: this.regions.entrySet()) {
LOG.debug("Found " + e + " out on cluster"); if (!e.getKey().isMetaTable() && e.getValue() != null) {
this.failover = true; LOG.debug("Found " + e + " out on cluster");
break; this.failover = true;
} break;
if (nodes.contains(e.getKey().getEncodedName())) { }
LOG.debug("Found " + e.getKey().getRegionNameAsString() + " in RITs"); if (nodes.contains(e.getKey().getEncodedName())) {
// Could be a meta region. LOG.debug("Found " + e.getKey().getRegionNameAsString() + " in RITs");
this.failover = true; // Could be a meta region.
break; this.failover = true;
break;
}
} }
} }
@ -2547,8 +2548,6 @@ public class AssignmentManager extends ZooKeeperListener {
* <p> * <p>
* Returns a map of servers that are not found to be online and the regions * Returns a map of servers that are not found to be online and the regions
* they were hosting. * they were hosting.
* @param onlineServers if one region's location belongs to onlineServers, it
* doesn't need to be assigned.
* @return map of servers not online to their assigned regions, as stored * @return map of servers not online to their assigned regions, as stored
* in META * in META
* @throws IOException * @throws IOException
@ -2624,8 +2623,10 @@ public class AssignmentManager extends ZooKeeperListener {
// add only if region not in disabled and enabling table // add only if region not in disabled and enabling table
if (false == checkIfRegionBelongsToDisabled(regionInfo) if (false == checkIfRegionBelongsToDisabled(regionInfo)
&& false == checkIfRegionsBelongsToEnabling(regionInfo)) { && false == checkIfRegionsBelongsToEnabling(regionInfo)) {
regions.put(regionInfo, regionLocation); synchronized (this.regions) {
addToServers(regionLocation, regionInfo); regions.put(regionInfo, regionLocation);
addToServers(regionLocation, regionInfo);
}
} }
disablingOrEnabling = addTheTablesInPartialState(this.disablingTables, disablingOrEnabling = addTheTablesInPartialState(this.disablingTables,
this.enablingTables, regionInfo, tableName); this.enablingTables, regionInfo, tableName);
@ -3366,7 +3367,6 @@ public class AssignmentManager extends ZooKeeperListener {
* Run through remaining regionservers and unassign all catalog regions. * Run through remaining regionservers and unassign all catalog regions.
*/ */
void unassignCatalogRegions() { void unassignCatalogRegions() {
this.servers.entrySet();
synchronized (this.regions) { synchronized (this.regions) {
for (Map.Entry<ServerName, Set<HRegionInfo>> e: this.servers.entrySet()) { for (Map.Entry<ServerName, Set<HRegionInfo>> e: this.servers.entrySet()) {
Set<HRegionInfo> regions = e.getValue(); Set<HRegionInfo> regions = e.getValue();

View File

@ -663,7 +663,6 @@ Server {
/** /**
* Override to change master's splitLogAfterStartup. Used testing * Override to change master's splitLogAfterStartup. Used testing
* @param mfs * @param mfs
* @param onlineServers
*/ */
protected void splitLogAfterStartup(final MasterFileSystem mfs) { protected void splitLogAfterStartup(final MasterFileSystem mfs) {
mfs.splitLogAfterStartup(); mfs.splitLogAfterStartup();

View File

@ -187,8 +187,6 @@ public class MasterFileSystem {
/** /**
* Inspect the log directory to recover any log file without * Inspect the log directory to recover any log file without
* an active region server. * an active region server.
* @param onlineServers Set of online servers keyed by
* {@link ServerName}
*/ */
void splitLogAfterStartup() { void splitLogAfterStartup() {
boolean retrySplitting = !conf.getBoolean("hbase.hlog.split.skip.errors", boolean retrySplitting = !conf.getBoolean("hbase.hlog.split.skip.errors",