hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r1526010 - in /hbase/branches/0.96/hbase-server/src: main/java/org/apache/hadoop/hbase/master/ test/java/org/apache/hadoop/hbase/master/
Date Tue, 24 Sep 2013 21:05:06 GMT
Author: ddas
Date: Tue Sep 24 21:05:05 2013
New Revision: 1526010

URL: http://svn.apache.org/r1526010
Log:
HBASE-9642. AM ZK Workers stuck doing 100% CPU on HashMap.put

Modified:
    hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
    hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
    hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java

Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java?rev=1526010&r1=1526009&r2=1526010&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
(original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
Tue Sep 24 21:05:05 2013
@@ -171,15 +171,13 @@ public class AssignmentManager extends Z
   private final ExecutorService executorService;
 
   // For unit tests, keep track of calls to ClosedRegionHandler
-  private Map<HRegionInfo, AtomicBoolean> closedRegionHandlerCalled = 
-      new HashMap<HRegionInfo, AtomicBoolean>();
+  private Map<HRegionInfo, AtomicBoolean> closedRegionHandlerCalled = null;
 
   // For unit tests, keep track of calls to OpenedRegionHandler
-  private Map<HRegionInfo, AtomicBoolean> openedRegionHandlerCalled = 
-      new HashMap<HRegionInfo, AtomicBoolean>();
+  private Map<HRegionInfo, AtomicBoolean> openedRegionHandlerCalled = null;
 
   // For unit tests, keep track of calls to SplitRegionHandler
-  private AtomicBoolean splitRegionHandlerCalled = new AtomicBoolean(false);
+  private AtomicBoolean splitRegionHandlerCalled = null;
 
   //Thread pool executor service for timeout monitor
   private java.util.concurrent.ExecutorService threadPoolExecutorService;
@@ -883,7 +881,7 @@ public class AssignmentManager extends Z
           }
           // Run handler to do the rest of the SPLIT handling.
           new SplitRegionHandler(server, this, regionState.getRegion(), sn, daughters).process();
-          splitRegionHandlerCalled.set(true);
+          updateSplitHandlerTracker();
           break;
 
         case RS_ZK_REGION_MERGING:
@@ -951,7 +949,7 @@ public class AssignmentManager extends Z
           if (regionState != null) {
             removeClosedRegion(regionState.getRegion());
             new ClosedRegionHandler(server, this, regionState.getRegion()).process();
-            closedRegionHandlerCalled.put(regionState.getRegion(), new AtomicBoolean(true));
+            updateClosedRegionHandlerTracker(regionState.getRegion());
           }
           break;
 
@@ -1026,7 +1024,7 @@ public class AssignmentManager extends Z
             failedOpenTracker.remove(encodedName); // reset the count, if any
             new OpenedRegionHandler(
               server, this, regionState.getRegion(), sn, expectedVersion).process();
-            openedRegionHandlerCalled.put(regionState.getRegion(), new AtomicBoolean(true));
+            updateOpenedRegionHandlerTracker(regionState.getRegion());
           }
           break;
 
@@ -1064,6 +1062,31 @@ public class AssignmentManager extends Z
     return splitRegionHandlerCalled.compareAndSet(true, false);
   }
 
+  //For unit tests only
+  void initializeHandlerTrackers() {
+    closedRegionHandlerCalled = new HashMap<HRegionInfo, AtomicBoolean>();
+    openedRegionHandlerCalled = new HashMap<HRegionInfo, AtomicBoolean>();
+    splitRegionHandlerCalled = new AtomicBoolean(false);
+  }
+
+  void updateClosedRegionHandlerTracker(HRegionInfo hri) {
+    if (closedRegionHandlerCalled != null) { //only for unit tests this is true
+      closedRegionHandlerCalled.put(hri, new AtomicBoolean(true));
+    }
+  }
+
+  void updateOpenedRegionHandlerTracker(HRegionInfo hri) {
+    if (openedRegionHandlerCalled != null) { //only for unit tests this is true
+      openedRegionHandlerCalled.put(hri, new AtomicBoolean(true));
+    }
+  }
+
+  void updateSplitHandlerTracker() {
+    if (splitRegionHandlerCalled != null) { //only for unit tests this is true
+      splitRegionHandlerCalled.set(true);
+    }
+  }
+
   /**
    * @return Returns true if this RegionState is splittable; i.e. the
    * RegionState is currently in splitting state or pending_close or

Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java?rev=1526010&r1=1526009&r2=1526010&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
(original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMaster.java
Tue Sep 24 21:05:05 2013
@@ -53,6 +53,7 @@ public class TestMaster {
     // Start a cluster of two regionservers.
     TEST_UTIL.startMiniCluster(2);
     admin = TEST_UTIL.getHBaseAdmin();
+    TEST_UTIL.getHBaseCluster().getMaster().assignmentManager.initializeHandlerTrackers();
   }
 
   @AfterClass

Modified: hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java?rev=1526010&r1=1526009&r2=1526010&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
(original)
+++ hbase/branches/0.96/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestZKBasedOpenCloseRegion.java
Tue Sep 24 21:05:05 2013
@@ -80,6 +80,7 @@ public class TestZKBasedOpenCloseRegion 
     waitUntilAllRegionsAssigned();
     addToEachStartKey(countOfRegions);
     t.close();
+    TEST_UTIL.getHBaseCluster().getMaster().assignmentManager.initializeHandlerTrackers();
   }
 
   @AfterClass public static void afterAllTests() throws Exception {



Mime
View raw message