From d5f2595ceee450a92734bfcc9665a8a604cb5bbe Mon Sep 17 00:00:00 2001 From: Jim Kellerman Date: Thu, 17 Jul 2008 18:54:25 +0000 Subject: [PATCH] HBASE-424 Should be able to enable/disable .META. table git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@677684 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../hadoop/hbase/client/HBaseAdmin.java | 2 -- .../hadoop/hbase/master/RegionManager.java | 22 ++++++++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 39b2d53f1d5..74f538f5e3b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -193,6 +193,7 @@ Trunk (unreleased changes) HBASE-34 Set memcache flush size per column (Andrew Purtell via Stack) HBASE-42 Set region split size on table creation (Andrew Purtell via Stack) HBASE-43 Add a read-only attribute to columns (Andrew Purtell via Stack) + HBASE-424 Should be able to enable/disable .META. table IMPROVEMENTS HBASE-559 MR example job to count table rows diff --git a/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java index e276b3116a8..54189baa1c9 100644 --- a/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java +++ b/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java @@ -312,7 +312,6 @@ public class HBaseAdmin { if (this.master == null) { throw new MasterNotRunningException("master has been shut down"); } - HTableDescriptor.isLegalTableName(tableName); try { this.master.enableTable(tableName); } catch (RemoteException e) { @@ -373,7 +372,6 @@ public class HBaseAdmin { if (this.master == null) { throw new MasterNotRunningException("master has been shut down"); } - HTableDescriptor.isLegalTableName(tableName); try { this.master.disableTable(tableName); } catch (RemoteException e) { diff --git a/src/java/org/apache/hadoop/hbase/master/RegionManager.java b/src/java/org/apache/hadoop/hbase/master/RegionManager.java index aa5e0f7857b..be76b8b33f6 100644 --- a/src/java/org/apache/hadoop/hbase/master/RegionManager.java +++ b/src/java/org/apache/hadoop/hbase/master/RegionManager.java @@ -519,15 +519,21 @@ class RegionManager implements HConstants { byte [] firstMetaRegion = null; Set metaRegions = new HashSet(); - synchronized (onlineMetaRegions) { - if (onlineMetaRegions.size() == 1) { - firstMetaRegion = onlineMetaRegions.firstKey(); - } else if (onlineMetaRegions.containsKey(tableName)) { - firstMetaRegion = tableName; - } else { - firstMetaRegion = onlineMetaRegions.headMap(tableName).lastKey(); + if (Bytes.equals(tableName, HConstants.META_TABLE_NAME)) { + metaRegions.add(new MetaRegion(rootRegionLocation.get(), + HRegionInfo.ROOT_REGIONINFO.getRegionName())); + + } else { + synchronized (onlineMetaRegions) { + if (onlineMetaRegions.size() == 1) { + firstMetaRegion = onlineMetaRegions.firstKey(); + } else if (onlineMetaRegions.containsKey(tableName)) { + firstMetaRegion = tableName; + } else { + firstMetaRegion = onlineMetaRegions.headMap(tableName).lastKey(); + } + metaRegions.addAll(onlineMetaRegions.tailMap(firstMetaRegion).values()); } - metaRegions.addAll(onlineMetaRegions.tailMap(firstMetaRegion).values()); } return metaRegions; }