HBASE-5589 Add of the offline call to the Master Interface

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1303519 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Hsieh 2012-03-21 19:30:54 +00:00
parent 5b2d6ebfc5
commit 865b14133b
2 changed files with 27 additions and 1 deletions

View File

@ -55,7 +55,8 @@ public interface HMasterInterface extends VersionedProtocol {
// meant all HBase RPC was broke though only one of the three RPC Interfaces // meant all HBase RPC was broke though only one of the three RPC Interfaces
// had changed. This has since been undone. // had changed. This has since been undone.
// 29: 4/3/2010 - changed ClusterStatus serialization // 29: 4/3/2010 - changed ClusterStatus serialization
public static final long VERSION = 29L; // 30: 3/20/2012 - HBASE-5589: Added offline method
public static final long VERSION = 30L;
/** @return true if master is available */ /** @return true if master is available */
public boolean isMasterRunning(); public boolean isMasterRunning();
@ -217,6 +218,18 @@ public interface HMasterInterface extends VersionedProtocol {
public void unassign(final byte [] regionName, final boolean force) public void unassign(final byte [] regionName, final boolean force)
throws IOException; throws IOException;
/**
* Offline a region from the assignment manager's in-memory state. The
* region should be in a closed state and there will be no attempt to
* automatically reassign the region as in unassign. This is a special
* method, and should only be used by experts or hbck.
* @param regionName Region to offline. Will clear any existing RegionPlan
* if one found.
* @throws IOException
*/
public void offline(final byte[] regionName) throws IOException;
/** /**
* Run the balancer. Will run the balancer and if regions to move, it will * Run the balancer. Will run the balancer and if regions to move, it will
* go ahead and do the reassignments. Can NOT run for various reasons. Check * go ahead and do the reassignments. Can NOT run for various reasons. Check

View File

@ -1822,6 +1822,19 @@ Server {
public double getAverageLoad() { public double getAverageLoad() {
return this.assignmentManager.getAverageLoad(); return this.assignmentManager.getAverageLoad();
} }
/**
* Special method, only used by hbck.
*/
@Override
public void offline(final byte[] regionName)
throws IOException {
Pair<HRegionInfo, ServerName> pair =
MetaReader.getRegion(this.catalogTracker, regionName);
if (pair == null) throw new UnknownRegionException(Bytes.toStringBinary(regionName));
HRegionInfo hri = pair.getFirst();
this.assignmentManager.regionOffline(hri);
}
/** /**
* Utility for constructing an instance of the passed HMaster class. * Utility for constructing an instance of the passed HMaster class.