hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r591162 - in /lucene/hadoop/trunk/src/contrib/hbase: CHANGES.txt src/java/org/apache/hadoop/hbase/HMaster.java src/test/org/apache/hadoop/hbase/OOMEHMaster.java
Date Thu, 01 Nov 2007 22:49:12 GMT
Author: jimk
Date: Thu Nov  1 15:49:08 2007
New Revision: 591162

URL: http://svn.apache.org/viewvc?rev=591162&view=rev
Log:
HADOOP-2109 Fixed race condition in processing server lease timeout.

Modified:
    lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
    lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java
    lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/OOMEHMaster.java

Modified: lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt?rev=591162&r1=591161&r2=591162&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/CHANGES.txt Thu Nov  1 15:49:08 2007
@@ -18,6 +18,7 @@
    HADOOP-2079 HADOOP-2056 Fix generated HLog, HRegion names
    HADOOP-2124 Use of `hostname` does not work on Cygwin in some cases
    HADOOP-2083 TestTableIndex failed in #970 and #956
+   HADOOP-2109 Fixed race condition in processing server lease timeout.
 
   IMPROVEMENTS
     HADOOP-2401 Add convenience put method that takes writable

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java?rev=591162&r1=591161&r2=591162&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java (original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/java/org/apache/hadoop/hbase/HMaster.java Thu
Nov  1 15:49:08 2007
@@ -409,8 +409,7 @@
     }
 
     protected void checkAssigned(final HRegionInfo info,
-      final String serverName, final long startCode)
-    throws IOException {
+      final String serverName, final long startCode) throws IOException {
       // Skip region - if ...
       if(info.isOffline()                                 // offline
           || killedRegions.contains(info.getRegionName()) // queued for offline
@@ -435,7 +434,7 @@
         }
         synchronized (serversToServerInfo) {
           storedInfo = serversToServerInfo.get(serverName);
-          if (storedInfo != null && deadServers.contains(serverName)) {
+          if (deadServers.contains(serverName)) {
             deadServer = true;
           }
         }
@@ -443,10 +442,23 @@
       if (LOG.isDebugEnabled()) {
         LOG.debug("Checking " + info.getRegionName() + " is assigned");
       }
-      if (!(unassignedRegions.containsKey(info.getRegionName()) ||
-            pendingRegions.contains(info.getRegionName()))
-          && (storedInfo == null || 
-              (storedInfo.getStartCode() != startCode && !deadServer))) {
+
+      /*
+       * If the server is not dead and either:
+       *   the stored info is not null and the start code does not match
+       * or:
+       *   the stored info is null and the region is neither unassigned nor pending
+       * then:
+       */ 
+      if (!deadServer &&
+          ((storedInfo != null && storedInfo.getStartCode() != startCode) ||
+              (storedInfo == null &&
+                  !unassignedRegions.containsKey(info.getRegionName()) &&
+                  !pendingRegions.contains(info.getRegionName())
+              )
+          )
+      ) {
+
         // The current assignment is no good
         if (LOG.isDebugEnabled()) {
           LOG.debug("Current assignment of " + info.getRegionName() +
@@ -2390,6 +2402,7 @@
     return !closed.get();
   }
 
+  /** {@inheritDoc} */
   public void shutdown() {
     TimerTask tt = new TimerTask() {
       @Override
@@ -3021,8 +3034,8 @@
   }
 
   protected static void doMain(String [] args,
-      Class<? extends HMaster> masterClass)
-  throws IOException {
+      Class<? extends HMaster> masterClass) {
+
     if (args.length < 1) {
       printUsageAndExit();
     }
@@ -3079,9 +3092,8 @@
   /**
    * Main program
    * @param args
-   * @throws IOException 
    */
-  public static void main(String [] args) throws IOException {
+  public static void main(String [] args) {
     doMain(args, HMaster.class);
   }
 }

Modified: lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/OOMEHMaster.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/OOMEHMaster.java?rev=591162&r1=591161&r2=591162&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/OOMEHMaster.java
(original)
+++ lucene/hadoop/trunk/src/contrib/hbase/src/test/org/apache/hadoop/hbase/OOMEHMaster.java
Thu Nov  1 15:49:08 2007
@@ -54,9 +54,8 @@
 
   /**
    * @param args
-   * @throws IOException 
    */
-  public static void main(String[] args) throws IOException {
+  public static void main(String[] args) {
     doMain(args, OOMEHMaster.class);
   }
 }



Mime
View raw message