hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1033782 - in /hbase/trunk: ./ src/main/java/org/apache/hadoop/hbase/catalog/ src/main/java/org/apache/hadoop/hbase/master/ src/main/java/org/apache/hadoop/hbase/master/handler/
Date Thu, 11 Nov 2010 00:19:52 GMT
Author: stack
Date: Thu Nov 11 00:19:52 2010
New Revision: 1033782

URL: http://svn.apache.org/viewvc?rev=1033782&view=rev
Log:
HBASE-3219 Split parents are reassigned on restart and on disable/enable

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java

Modified: hbase/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1033782&r1=1033781&r2=1033782&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Nov 11 00:19:52 2010
@@ -674,6 +674,7 @@ Release 0.90.0 - Unreleased
    HBASE-3214  TestMasterFailover.testMasterFailoverWithMockedRITOnDeadRS is
                failing (Gary via jgray)
    HBASE-3216  Move HBaseFsck from client to util
+   HBASE-3219  Split parents are reassigned on restart and on disable/enable
 
 
   IMPROVEMENTS

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java?rev=1033782&r1=1033781&r2=1033782&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/catalog/MetaReader.java Thu Nov 11 00:19:52
2010
@@ -150,6 +150,28 @@ public class MetaReader {
   public static Map<HRegionInfo,HServerAddress> fullScan(
       CatalogTracker catalogTracker, final Set<String> disabledTables)
   throws IOException {
+    return fullScan(catalogTracker, disabledTables, false);
+  }
+
+  /**
+   * Performs a full scan of <code>.META.</code>, skipping regions from any
+   * tables in the specified set of disabled tables.
+   * <p>
+   * Returns a map of every region to it's currently assigned server, according
+   * to META.  If the region does not have an assignment it will have a null
+   * value in the map.
+   *
+   * @param catalogTracker
+   * @param disabledTables set of disabled tables that will not be returned
+   * @param excludeOfflinedSplitParents If true, do not include offlined split
+   * parents in the return.
+   * @return map of regions to their currently assigned server
+   * @throws IOException
+   */
+  public static Map<HRegionInfo,HServerAddress> fullScan(
+      CatalogTracker catalogTracker, final Set<String> disabledTables,
+      final boolean excludeOfflinedSplitParents)
+  throws IOException {
     final Map<HRegionInfo,HServerAddress> regions =
       new TreeMap<HRegionInfo,HServerAddress>();
     Visitor v = new Visitor() {
@@ -158,9 +180,12 @@ public class MetaReader {
         if (r ==  null || r.isEmpty()) return true;
         Pair<HRegionInfo,HServerAddress> region = metaRowToRegionPair(r);
         if (region == null) return true;
+        HRegionInfo hri = region.getFirst();
         if (disabledTables.contains(
-            region.getFirst().getTableDesc().getNameAsString())) return true;
-        regions.put(region.getFirst(), region.getSecond());
+            hri.getTableDesc().getNameAsString())) return true;
+        // Are we to include split parents in the list?
+        if (excludeOfflinedSplitParents && hri.isSplitParent()) return true;
+        regions.put(hri, region.getSecond());
         return true;
       }
     };
@@ -416,6 +441,21 @@ public class MetaReader {
   public static List<HRegionInfo> getTableRegions(CatalogTracker catalogTracker,
       byte [] tableName)
   throws IOException {
+    return getTableRegions(catalogTracker, tableName, false);
+  }
+
+  /**
+   * Gets all of the regions of the specified table.
+   * @param catalogTracker
+   * @param tableName
+   * @param excludeOfflinedSplitParents If true, do not include offlined split
+   * parents in the return.
+   * @return Ordered list of {@link HRegionInfo}.
+   * @throws IOException
+   */
+  public static List<HRegionInfo> getTableRegions(CatalogTracker catalogTracker,
+      byte [] tableName, final boolean excludeOfflinedSplitParents)
+  throws IOException {
     if (Bytes.equals(tableName, HConstants.ROOT_TABLE_NAME)) {
       // If root, do a bit of special handling.
       List<HRegionInfo> list = new ArrayList<HRegionInfo>();
@@ -446,6 +486,8 @@ public class MetaReader {
               data.getValue(HConstants.CATALOG_FAMILY,
                   HConstants.REGIONINFO_QUALIFIER));
           if (info.getTableDesc().getNameAsString().equals(tableString)) {
+            // Are we to include split parents in the list?
+            if (excludeOfflinedSplitParents && info.isSplitParent()) continue;
             regions.add(info);
           } else {
             break;

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1033782&r1=1033781&r2=1033782&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java Thu Nov
11 00:19:52 2010
@@ -1105,7 +1105,7 @@ public class AssignmentManager extends Z
 
     // Scan META for all user regions, skipping any disabled tables
     Map<HRegionInfo,HServerAddress> allRegions =
-      MetaReader.fullScan(catalogTracker, this.zkTable.getDisabledTables());
+      MetaReader.fullScan(catalogTracker, this.zkTable.getDisabledTables(), true);
     if (allRegions == null || allRegions.isEmpty()) return;
 
     // Determine what type of assignment to do on startup

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java?rev=1033782&r1=1033781&r2=1033782&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/master/handler/EnableTableHandler.java
Thu Nov 11 00:19:52 2010
@@ -87,7 +87,7 @@ public class EnableTableHandler extends 
       // Get the regions of this table. We're done when all listed
       // tables are onlined.
       List<HRegionInfo> regionsInMeta =
-        MetaReader.getTableRegions(this.ct, tableName);
+        MetaReader.getTableRegions(this.ct, tableName, true);
       int countOfRegionsInTable = regionsInMeta.size();
       List<HRegionInfo> regions = regionsToAssign(regionsInMeta);
       if (regions.size() == 0) {



Mime
View raw message