hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1188438 - in /hbase/branches/0.92: CHANGES.txt src/main/java/org/apache/hadoop/hbase/master/handler/TableEventHandler.java
Date Mon, 24 Oct 2011 23:12:13 GMT
Author: stack
Date: Mon Oct 24 23:12:12 2011
New Revision: 1188438

URL: http://svn.apache.org/viewvc?rev=1188438&view=rev
Log:
HBASE-4578 NPE when altering a table that has moving regions

Modified:
    hbase/branches/0.92/CHANGES.txt
    hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/handler/TableEventHandler.java

Modified: hbase/branches/0.92/CHANGES.txt
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/CHANGES.txt?rev=1188438&r1=1188437&r2=1188438&view=diff
==============================================================================
--- hbase/branches/0.92/CHANGES.txt (original)
+++ hbase/branches/0.92/CHANGES.txt Mon Oct 24 23:12:12 2011
@@ -363,6 +363,7 @@ Release 0.92.0 - Unreleased
    HBASE-4647  RAT finds about 40 files missing licenses
    HBASE-4642  Add Apache License Header
    HBASE-4591  TTL for old HLogs should be calculated from last modification time
+   HBASE-4578  NPE when altering a table that has moving regions (gaojinchao)
 
   TESTS
    HBASE-4492  TestRollingRestart fails intermittently

Modified: hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/handler/TableEventHandler.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/handler/TableEventHandler.java?rev=1188438&r1=1188437&r2=1188438&view=diff
==============================================================================
--- hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/handler/TableEventHandler.java
(original)
+++ hbase/branches/0.92/src/main/java/org/apache/hadoop/hbase/master/handler/TableEventHandler.java
Mon Oct 24 23:12:12 2011
@@ -20,6 +20,7 @@
 package org.apache.hadoop.hbase.master.handler;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.NavigableMap;
@@ -86,7 +87,6 @@ public abstract class TableEventHandler 
       if (eventType.isOnlineSchemaChangeSupported() && this.masterServices.
           getAssignmentManager().getZKTable().
           isEnabledTable(Bytes.toString(tableName))) {
-        this.masterServices.getAssignmentManager().setRegionsToReopen(hris);
         if (reOpenAllRegions(hris)) {
           LOG.info("Completed table operation " + eventType + " on table " +
               Bytes.toString(tableName));
@@ -108,17 +108,27 @@ public abstract class TableEventHandler 
     TreeMap<ServerName, List<HRegionInfo>> serverToRegions = Maps
         .newTreeMap();
     NavigableMap<HRegionInfo, ServerName> hriHserverMapping = table.getRegionLocations();
-
+    List<HRegionInfo> reRegions = new ArrayList<HRegionInfo>();
     for (HRegionInfo hri : regions) {
       ServerName rsLocation = hriHserverMapping.get(hri);
+
+      // Skip the offlined split parent region
+      // See HBASE-4578 for more information.
+      if (null == rsLocation) {
+        LOG.info("Skip " + hri);
+        continue;
+      }
       if (!serverToRegions.containsKey(rsLocation)) {
         LinkedList<HRegionInfo> hriList = Lists.newLinkedList();
         serverToRegions.put(rsLocation, hriList);
       }
+      reRegions.add(hri);
       serverToRegions.get(rsLocation).add(hri);
     }
-    LOG.info("Reopening " + regions.size() + " regions on "
+    
+    LOG.info("Reopening " + reRegions.size() + " regions on "
         + serverToRegions.size() + " region servers.");
+    this.masterServices.getAssignmentManager().setRegionsToReopen(reRegions);
     BulkReOpen bulkReopen = new BulkReOpen(this.server, serverToRegions,
         this.masterServices.getAssignmentManager());
     while (true) {



Mime
View raw message