HBASE-6487 assign region doesn't check if the region is already assigned -- REVERTED

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1374452 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
jxiang 2012-08-17 21:54:14 +00:00
parent a7e18a9bfd
commit e4635cedad
3 changed files with 4 additions and 19 deletions

View File

@ -2085,13 +2085,8 @@ Server {
LOG.warn("assignRegion specifier type: expected: " + RegionSpecifierType.REGION_NAME LOG.warn("assignRegion specifier type: expected: " + RegionSpecifierType.REGION_NAME
+ " actual: " + type); + " actual: " + type);
} }
RegionStates regionStates = assignmentManager.getRegionStates(); HRegionInfo regionInfo = assignmentManager.getRegionStates().getRegionInfo(regionName);
HRegionInfo regionInfo = regionStates.getRegionInfo(regionName);
if (regionInfo == null) throw new UnknownRegionException(Bytes.toString(regionName)); if (regionInfo == null) throw new UnknownRegionException(Bytes.toString(regionName));
RegionState regionState = regionStates.getRegionState(regionInfo);
if (regionState != null && !regionState.isOffline()) {
throw new IOException("Region " + regionInfo + " is not offline");
}
if (cpHost != null) { if (cpHost != null) {
if (cpHost.preAssign(regionInfo)) { if (cpHost.preAssign(regionInfo)) {
return arr; return arr;

View File

@ -132,13 +132,6 @@ public class RegionStates {
return regionAssignments.containsKey(hri); return regionAssignments.containsKey(hri);
} }
/**
* @return the server the specified region assigned to; null if not assigned.
*/
public synchronized ServerName getAssignedServer(final HRegionInfo hri) {
return regionAssignments.get(hri);
}
/** /**
* Wait for the state map to be updated by assignment manager. * Wait for the state map to be updated by assignment manager.
*/ */
@ -526,11 +519,7 @@ public class RegionStates {
try { try {
Pair<HRegionInfo, ServerName> p = Pair<HRegionInfo, ServerName> p =
MetaReader.getRegion(server.getCatalogTracker(), regionName); MetaReader.getRegion(server.getCatalogTracker(), regionName);
HRegionInfo hri = p == null ? null : p.getFirst(); return p == null ? null : p.getFirst();
if (hri != null) {
createRegionState(hri);
}
return hri;
} catch (IOException e) { } catch (IOException e) {
server.abort("Aborting because error occoured while reading " + server.abort("Aborting because error occoured while reading " +
Bytes.toStringBinary(regionName) + " from .META.", e); Bytes.toStringBinary(regionName) + " from .META.", e);

View File

@ -24,7 +24,8 @@ module Shell
def help def help
return <<-EOF return <<-EOF
Assign a region.Use with caution.If region already assigned, Assign a region.Use with caution.If region already assigned,
this command will throw an exception. For experts only. this command will just go ahead and reassign
the region anyways. For experts only.
EOF EOF
end end