hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdcry...@apache.org
Subject svn commit: r893676 - in /hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase: client/HBaseAdmin.java master/ChangeTableState.java master/ProcessRegionClose.java regionserver/HRegion.java
Date Thu, 24 Dec 2009 01:23:41 GMT
Author: jdcryans
Date: Thu Dec 24 01:23:40 2009
New Revision: 893676

URL: http://svn.apache.org/viewvc?rev=893676&view=rev
Log:
HBASE-2065 Cannot disable a table if any of its region is opening at the same time

Modified:
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ChangeTableState.java
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java
    hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java?rev=893676&r1=893675&r2=893676&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java (original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/client/HBaseAdmin.java Thu
Dec 24 01:23:40 2009
@@ -326,15 +326,16 @@
     if (this.master == null) {
       throw new MasterNotRunningException("master has been shut down");
     }
-    try {
-      this.master.enableTable(tableName);
-    } catch (RemoteException e) {
-      throw RemoteExceptionHandler.decodeRemoteException(e);
-    }
+
 
     // Wait until all regions are enabled
     boolean enabled = false;
     for (int tries = 0; tries < this.numRetries; tries++) {
+      try {
+       this.master.enableTable(tableName);
+      } catch (RemoteException e) {
+        throw RemoteExceptionHandler.decodeRemoteException(e);
+      }
       enabled = isTableEnabled(tableName);
       if (enabled) break;
       long sleep = getPauseTime(tries);
@@ -382,15 +383,16 @@
     if (this.master == null) {
       throw new MasterNotRunningException("master has been shut down");
     }
-    try {
-      this.master.disableTable(tableName);
-    } catch (RemoteException e) {
-      throw RemoteExceptionHandler.decodeRemoteException(e);
-    }
 
     // Wait until all regions are disabled
     boolean disabled = false;
     for (int tries = 0; tries < this.numRetries; tries++) {
+
+      try {
+        this.master.disableTable(tableName);
+      } catch (RemoteException e) {
+        throw RemoteExceptionHandler.decodeRemoteException(e);
+      }
       disabled = isTableDisabled(tableName);
       if (disabled) break;
       if (LOG.isDebugEnabled()) {

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ChangeTableState.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ChangeTableState.java?rev=893676&r1=893675&r2=893676&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ChangeTableState.java
(original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ChangeTableState.java
Thu Dec 24 01:23:40 2009
@@ -79,6 +79,14 @@
         continue;
       }
 
+      if(!this.online && this.master.regionManager.
+          isPendingOpen(i.getRegionNameAsString())) {
+        LOG.debug("Skipping region " + i.toString() +
+          " because it is pending open, will tell it to close later");
+        continue;
+      }
+
+
       // Update meta table
       Put put = updateRegionInfo(i);
       server.put(m.getRegionName(), put);

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java?rev=893676&r1=893675&r2=893676&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java
(original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/master/ProcessRegionClose.java
Thu Dec 24 01:23:40 2009
@@ -59,33 +59,36 @@
   @Override
   protected boolean process() throws IOException {
     Boolean result = null;
-    if (offlineRegion) {
+    if (offlineRegion || reassignRegion) {
       result =
         new RetryableMetaOperation<Boolean>(getMetaRegion(), this.master) {
           public Boolean call() throws IOException {
-            LOG.info("region closed: " + regionInfo.getRegionNameAsString());
 
             // We can't proceed unless the meta region we are going to update
             // is online. metaRegionAvailable() will put this operation on the
             // delayedToDoQueue, so return true so the operation is not put 
             // back on the toDoQueue
 
-            if (metaRegionAvailable()) {
+            if(offlineRegion) {
               // offline the region in meta and then remove it from the
               // set of regions in transition
               HRegion.offlineRegionInMETA(server, metaRegionName,
                   regionInfo);
               master.regionManager.removeRegion(regionInfo);
+              LOG.info("region closed: " + regionInfo.getRegionNameAsString());
+            } else {
+              // we are reassigning the region eventually, so set it unassigned
+              // and remove the server info
+              HRegion.cleanRegionInMETA(server, metaRegionName,
+                  regionInfo);
+              master.regionManager.setUnassigned(regionInfo, false);
+              LOG.info("region set as unassigned: " + regionInfo.getRegionNameAsString());
             }
             return true;
           }
         }.doWithRetries();
         result = result == null ? true : result;
 
-    } else if (reassignRegion) {
-      LOG.info("region set as unassigned: " + regionInfo.getRegionNameAsString());
-      // we are reassigning the region eventually, so set it unassigned
-      master.regionManager.setUnassigned(regionInfo, false);
     } else {
       LOG.info("Region was neither offlined, or asked to be reassigned, what gives: " +
       regionInfo.getRegionNameAsString());

Modified: hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java?rev=893676&r1=893675&r2=893676&view=diff
==============================================================================
--- hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
(original)
+++ hadoop/hbase/branches/0.20/src/java/org/apache/hadoop/hbase/regionserver/HRegion.java
Thu Dec 24 01:23:40 2009
@@ -1947,10 +1947,7 @@
     info.setOffline(true);
     put.add(CATALOG_FAMILY, REGIONINFO_QUALIFIER, Writables.getBytes(info));
     srvr.put(metaRegionName, put);
-    Delete del = new Delete(row);
-    del.deleteColumns(CATALOG_FAMILY, SERVER_QUALIFIER);
-    del.deleteColumns(CATALOG_FAMILY, STARTCODE_QUALIFIER);
-    srvr.delete(metaRegionName, del);
+    cleanRegionInMETA(srvr, metaRegionName, info);
   }
   
   /**



Mime
View raw message