HBASE-9642. AM ZK Workers stuck doing 100% CPU on HashMap.put
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1526009 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
29909882ea
commit
49a29f6e94
|
@ -171,15 +171,13 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
private final ExecutorService executorService;
|
private final ExecutorService executorService;
|
||||||
|
|
||||||
// For unit tests, keep track of calls to ClosedRegionHandler
|
// For unit tests, keep track of calls to ClosedRegionHandler
|
||||||
private Map<HRegionInfo, AtomicBoolean> closedRegionHandlerCalled =
|
private Map<HRegionInfo, AtomicBoolean> closedRegionHandlerCalled = null;
|
||||||
new HashMap<HRegionInfo, AtomicBoolean>();
|
|
||||||
|
|
||||||
// For unit tests, keep track of calls to OpenedRegionHandler
|
// For unit tests, keep track of calls to OpenedRegionHandler
|
||||||
private Map<HRegionInfo, AtomicBoolean> openedRegionHandlerCalled =
|
private Map<HRegionInfo, AtomicBoolean> openedRegionHandlerCalled = null;
|
||||||
new HashMap<HRegionInfo, AtomicBoolean>();
|
|
||||||
|
|
||||||
// For unit tests, keep track of calls to SplitRegionHandler
|
// 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
|
//Thread pool executor service for timeout monitor
|
||||||
private java.util.concurrent.ExecutorService threadPoolExecutorService;
|
private java.util.concurrent.ExecutorService threadPoolExecutorService;
|
||||||
|
@ -883,7 +881,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
}
|
}
|
||||||
// Run handler to do the rest of the SPLIT handling.
|
// Run handler to do the rest of the SPLIT handling.
|
||||||
new SplitRegionHandler(server, this, regionState.getRegion(), sn, daughters).process();
|
new SplitRegionHandler(server, this, regionState.getRegion(), sn, daughters).process();
|
||||||
splitRegionHandlerCalled.set(true);
|
updateSplitHandlerTracker();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RS_ZK_REGION_MERGING:
|
case RS_ZK_REGION_MERGING:
|
||||||
|
@ -951,7 +949,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
if (regionState != null) {
|
if (regionState != null) {
|
||||||
removeClosedRegion(regionState.getRegion());
|
removeClosedRegion(regionState.getRegion());
|
||||||
new ClosedRegionHandler(server, this, regionState.getRegion()).process();
|
new ClosedRegionHandler(server, this, regionState.getRegion()).process();
|
||||||
closedRegionHandlerCalled.put(regionState.getRegion(), new AtomicBoolean(true));
|
updateClosedRegionHandlerTracker(regionState.getRegion());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1026,7 +1024,7 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
failedOpenTracker.remove(encodedName); // reset the count, if any
|
failedOpenTracker.remove(encodedName); // reset the count, if any
|
||||||
new OpenedRegionHandler(
|
new OpenedRegionHandler(
|
||||||
server, this, regionState.getRegion(), sn, expectedVersion).process();
|
server, this, regionState.getRegion(), sn, expectedVersion).process();
|
||||||
openedRegionHandlerCalled.put(regionState.getRegion(), new AtomicBoolean(true));
|
updateOpenedRegionHandlerTracker(regionState.getRegion());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1064,6 +1062,31 @@ public class AssignmentManager extends ZooKeeperListener {
|
||||||
return splitRegionHandlerCalled.compareAndSet(true, false);
|
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
|
* @return Returns true if this RegionState is splittable; i.e. the
|
||||||
* RegionState is currently in splitting state or pending_close or
|
* RegionState is currently in splitting state or pending_close or
|
||||||
|
|
|
@ -53,6 +53,7 @@ public class TestMaster {
|
||||||
// Start a cluster of two regionservers.
|
// Start a cluster of two regionservers.
|
||||||
TEST_UTIL.startMiniCluster(2);
|
TEST_UTIL.startMiniCluster(2);
|
||||||
admin = TEST_UTIL.getHBaseAdmin();
|
admin = TEST_UTIL.getHBaseAdmin();
|
||||||
|
TEST_UTIL.getHBaseCluster().getMaster().assignmentManager.initializeHandlerTrackers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
|
|
|
@ -80,6 +80,7 @@ public class TestZKBasedOpenCloseRegion {
|
||||||
waitUntilAllRegionsAssigned();
|
waitUntilAllRegionsAssigned();
|
||||||
addToEachStartKey(countOfRegions);
|
addToEachStartKey(countOfRegions);
|
||||||
t.close();
|
t.close();
|
||||||
|
TEST_UTIL.getHBaseCluster().getMaster().assignmentManager.initializeHandlerTrackers();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass public static void afterAllTests() throws Exception {
|
@AfterClass public static void afterAllTests() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue