hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r776063 - in /hadoop/hbase/branches/0.19: ./ src/java/org/apache/hadoop/hbase/io/ src/java/org/apache/hadoop/hbase/master/
Date Mon, 18 May 2009 19:39:01 GMT
Author: stack
Date: Mon May 18 19:39:00 2009
New Revision: 776063

URL: http://svn.apache.org/viewvc?rev=776063&view=rev
Log:
HBASE-1421 Processing a regionserver message -- OPEN, CLOSE, SPLIT, etc. -- and if we're carrying
more than one message in payload, if exception, all messages that follow are dropped on floor

Modified:
    hadoop/hbase/branches/0.19/CHANGES.txt
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/io/SequenceFile.java
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionManager.java
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionServerOperation.java
    hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ServerManager.java

Modified: hadoop/hbase/branches/0.19/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/CHANGES.txt?rev=776063&r1=776062&r2=776063&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/CHANGES.txt (original)
+++ hadoop/hbase/branches/0.19/CHANGES.txt Mon May 18 19:39:00 2009
@@ -9,6 +9,9 @@
                (Nitay Joffe via Stack)
    HBASE-1431  NPE in HTable.checkAndSave when row doesn't exist (Guilherme
                Mauro Germoglio Barbosa via Andrew Purtell)
+   HBASE-1421  Processing a regionserver message -- OPEN, CLOSE, SPLIT, etc.
+               -- and if we're carrying more than one message in payload,
+               if exception, all messages that follow are dropped on floor
 
   IMPROVEMENTS
    HBASE-1418  Transacitonal improvments and fixes (Clint Morgan via Stack)

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/io/SequenceFile.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/io/SequenceFile.java?rev=776063&r1=776062&r2=776063&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/io/SequenceFile.java (original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/io/SequenceFile.java Mon May
18 19:39:00 2009
@@ -952,6 +952,13 @@
       }
     }
 
+    /** flush all currently written data to the file system */
+    public void syncFs() throws IOException {
+      if (out != null) {
+        out.sync();                               // flush contents to file system
+      }
+    }
+
     /** Returns the configuration of this file. */
     Configuration getConf() { return conf; }
     

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java?rev=776063&r1=776062&r2=776063&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java
(original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ProcessRegionOpen.java
Mon May 18 19:39:00 2009
@@ -41,12 +41,10 @@
    * @param master
    * @param info
    * @param regionInfo
-   * @throws IOException
    */
   @SuppressWarnings("unused")
   public ProcessRegionOpen(HMaster master, HServerInfo info, 
-    HRegionInfo regionInfo)
-  throws IOException {
+      HRegionInfo regionInfo) {
     super(master, regionInfo);
     this.serverAddress = info.getServerAddress();
     if (this.serverAddress == null) {
@@ -121,4 +119,4 @@
     }.doWithRetries();
     return result == null ? true : result;
   }
-}
\ No newline at end of file
+}

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionManager.java?rev=776063&r1=776062&r2=776063&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionManager.java
(original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionManager.java
Mon May 18 19:39:00 2009
@@ -1168,9 +1168,8 @@
      */
     synchronized void setPendingOpen(final String serverName) {
       if (!this.unassigned) {
-        throw new IllegalStateException(
-            "Cannot assign a region that is not currently unassigned. State: " +
-            toString());
+        LOG.warn("Cannot assign a region that is not currently unassigned. " +
+          "FIX!! State: " + toString());
       }
       this.unassigned = false;
       this.pendingOpen = true;
@@ -1188,9 +1187,8 @@
 
     synchronized void setOpen() {
       if (!pendingOpen) {
-        throw new IllegalStateException(
-            "Cannot set a region as open if it has not been pending. State: " +
-            toString());
+        LOG.warn("Cannot set a region as open if it has not been pending. " +
+          "FIX!! State: " + toString());
       }
       this.unassigned = false;
       this.pendingOpen = false;
@@ -1222,9 +1220,8 @@
 
     synchronized void setPendingClose() {
       if (!closing) {
-        throw new IllegalStateException(
-            "Cannot set a region as pending close if it has not been closing. " +
-            "State: " + toString());
+        LOG.warn("Cannot set a region as pending close if it has not been " +
+          "closing.  FIX!! State: " + toString());
       }
       this.unassigned = false;
       this.pendingOpen = false;
@@ -1285,4 +1282,4 @@
       return Bytes.compareTo(getRegionName(), o.getRegionName());
     }
   }
-}
+}
\ No newline at end of file

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionServerOperation.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionServerOperation.java?rev=776063&r1=776062&r2=776063&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionServerOperation.java
(original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/RegionServerOperation.java
Mon May 18 19:39:00 2009
@@ -42,7 +42,7 @@
     // DelayQueue we're inserted in on lease expiration.
     this.expire = System.currentTimeMillis() + this.master.leaseTimeout / 2;
   }
-  
+
   public long getDelay(TimeUnit unit) {
     return unit.convert(this.expire - System.currentTimeMillis(),
       TimeUnit.MILLISECONDS);

Modified: hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ServerManager.java
URL: http://svn.apache.org/viewvc/hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ServerManager.java?rev=776063&r1=776062&r2=776063&view=diff
==============================================================================
--- hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ServerManager.java
(original)
+++ hadoop/hbase/branches/0.19/src/java/org/apache/hadoop/hbase/master/ServerManager.java
Mon May 18 19:39:00 2009
@@ -396,11 +396,15 @@
     return processMsgs(serverName, serverInfo, mostLoadedRegions, msgs);
   }
 
-  /** 
+  /* 
    * Process all the incoming messages from a server that's contacted us.
    * 
    * Note that we never need to update the server's load information because
    * that has already been done in regionServerReport.
+   * @param serverInfo
+   * @param mostLoadedRegions
+   * @param incomingMsgs
+   * @return
    */
   private HMsg[] processMsgs(String serverName, HServerInfo serverInfo, 
     HRegionInfo[] mostLoadedRegions, HMsg incomingMsgs[])
@@ -411,6 +415,8 @@
         "hbase-958 debugging");
     }
     // Get reports on what the RegionServer did.
+    // Be careful that in message processors we don't throw exceptions that
+    // break the switch below because then we might drop messages on the floor.
     int openingCount = 0;
     for (int i = 0; i < incomingMsgs.length; i++) {
       HRegionInfo region = incomingMsgs[i].getRegionInfo();
@@ -434,8 +440,7 @@
           break;
 
         default:
-          throw new IOException(
-            "Impossible state during message processing. Instruction: " +
+          LOG.warn("Impossible state during message processing. Instruction: " +
             incomingMsgs[i].getType());
       }
     }
@@ -463,7 +468,7 @@
     return returnMsgs.toArray(new HMsg[returnMsgs.size()]);
   }
   
-  /**
+  /*
    * A region has split.
    *
    * @param serverName
@@ -558,15 +563,22 @@
           // Note that the table has been assigned and is waiting for the
           // meta table to be updated.
           master.regionManager.setOpen(region.getRegionName());
-          // Queue up an update to note the region location.
-          try {
-            master.toDoQueue.put(
-                new ProcessRegionOpen(master, serverInfo, region));
-          } catch (InterruptedException e) {
-            throw new RuntimeException(
-                "Putting into toDoQueue was interrupted.", e);
+          // Queue up an update to note the region location.  Do inside
+          // a retry loop in case interrupted.
+          boolean succeeded = false;
+          for (int i = 0; i < 10; i++) {
+            try {
+              master.toDoQueue.
+                put(new ProcessRegionOpen(master, serverInfo, region));
+              succeeded = true;
+            } catch (InterruptedException e) {
+              LOG.warn("Putting into toDoQueue was interrupted.", e);
+            }
+          }
+          if (!succeeded) {
+            LOG.warn("FAILED ADDING OPEN TO TODO QUEUE: " + serverInfo);
           }
-        } 
+        }
       }
     }
   }



Mime
View raw message