From 5593052365198b6fbc0f78b9db2893fd4a0852c9 Mon Sep 17 00:00:00 2001 From: Jean-Daniel Cryans Date: Thu, 2 Dec 2010 20:18:29 +0000 Subject: [PATCH] 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 --- CHANGES.txt | 1 + .../org/apache/hadoop/hbase/master/HMaster.java | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f098e9148d0..749a1682443 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index a09ae5241e6..634c0dc40c4 100644 --- a/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -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); }