HBASE-3296 Newly created table ends up disabled instead of assigned

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1041569 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2010-12-02 20:18:29 +00:00
parent 1eb39242c4
commit 5593052365
2 changed files with 14 additions and 4 deletions

View File

@ -738,6 +738,7 @@ Release 0.90.0 - Unreleased
and it's very confusing
HBASE-3301 Treat java.net.SocketTimeoutException same as ConnectException
assigning/unassigning regions
HBASE-3296 Newly created table ends up disabled instead of assigned
IMPROVEMENTS

View File

@ -767,18 +767,27 @@ implements HMasterInterface, HMasterRegionInterface, MasterServices, Server {
throw new TableExistsException(tableName);
}
for(HRegionInfo newRegion : newRegions) {
// 1. Create HRegion
// 1. Set table enabling flag up in zk.
try {
assignmentManager.getZKTable().setEnabledTable(tableName);
} catch (KeeperException e) {
throw new IOException("Unable to ensure that the table will be" +
" enabled because of a ZooKeeper issue", e);
}
// 2. Create HRegion
HRegion region = HRegion.createHRegion(newRegion,
fileSystemManager.getRootDir(), conf);
// 2. Insert into META
// 3. Insert into META
MetaEditor.addRegionToMeta(catalogTracker, region.getRegionInfo());
// 3. Close the new region to flush to disk. Close log file too.
// 4. Close the new region to flush to disk. Close log file too.
region.close();
region.getLog().closeAndDelete();
// 4. Trigger immediate assignment of this region
// 5. Trigger immediate assignment of this region
assignmentManager.assign(region.getRegionInfo(), true);
}