HDFS-4274. BlockPoolSliceScanner does not close verification log during shutdown. Contributed by Chris Nauroth.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1422276 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4bc4daae66
commit
8aee71d1bc
|
@ -280,6 +280,9 @@ Trunk (Unreleased)
|
|||
HDFS-4310. fix test org.apache.hadoop.hdfs.server.datanode.
|
||||
TestStartSecureDataNode (Ivan A. Veselovsky via atm)
|
||||
|
||||
HDFS-4274. BlockPoolSliceScanner does not close verification log during
|
||||
shutdown. (Chris Nauroth via suresh)
|
||||
|
||||
Release 2.0.3-alpha - Unreleased
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -603,6 +603,15 @@ class BlockPoolSliceScanner {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shuts down this BlockPoolSliceScanner and releases any internal resources.
|
||||
*/
|
||||
void shutdown() {
|
||||
if (verificationLog != null) {
|
||||
verificationLog.close();
|
||||
}
|
||||
}
|
||||
|
||||
private void scan() {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Starting to scan blockpool: " + blockPoolId);
|
||||
|
@ -610,7 +619,8 @@ class BlockPoolSliceScanner {
|
|||
try {
|
||||
adjustThrottler();
|
||||
|
||||
while (datanode.shouldRun && !Thread.interrupted()
|
||||
while (datanode.shouldRun
|
||||
&& !datanode.blockScanner.blockScannerThread.isInterrupted()
|
||||
&& datanode.isBPServiceAlive(blockPoolId)) {
|
||||
long now = Time.now();
|
||||
synchronized (this) {
|
||||
|
|
|
@ -100,6 +100,11 @@ public class DataBlockScanner implements Runnable {
|
|||
}
|
||||
bpScanner.scanBlockPoolSlice();
|
||||
}
|
||||
|
||||
// Call shutdown for each allocated BlockPoolSliceScanner.
|
||||
for (BlockPoolSliceScanner bpss: blockPoolScannerMap.values()) {
|
||||
bpss.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for at least one block pool to be up
|
||||
|
@ -232,12 +237,24 @@ public class DataBlockScanner implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
public synchronized void shutdown() {
|
||||
public void shutdown() {
|
||||
synchronized (this) {
|
||||
if (blockScannerThread != null) {
|
||||
blockScannerThread.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
// We cannot join within the synchronized block, because it would create a
|
||||
// deadlock situation. blockScannerThread calls other synchronized methods.
|
||||
if (blockScannerThread != null) {
|
||||
try {
|
||||
blockScannerThread.join();
|
||||
} catch (InterruptedException e) {
|
||||
// shutting down anyway
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void addBlockPool(String blockPoolId) {
|
||||
if (blockPoolScannerMap.get(blockPoolId) != null) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue