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.
|
HDFS-4310. fix test org.apache.hadoop.hdfs.server.datanode.
|
||||||
TestStartSecureDataNode (Ivan A. Veselovsky via atm)
|
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
|
Release 2.0.3-alpha - Unreleased
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
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() {
|
private void scan() {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
LOG.debug("Starting to scan blockpool: " + blockPoolId);
|
LOG.debug("Starting to scan blockpool: " + blockPoolId);
|
||||||
|
@ -610,7 +619,8 @@ class BlockPoolSliceScanner {
|
||||||
try {
|
try {
|
||||||
adjustThrottler();
|
adjustThrottler();
|
||||||
|
|
||||||
while (datanode.shouldRun && !Thread.interrupted()
|
while (datanode.shouldRun
|
||||||
|
&& !datanode.blockScanner.blockScannerThread.isInterrupted()
|
||||||
&& datanode.isBPServiceAlive(blockPoolId)) {
|
&& datanode.isBPServiceAlive(blockPoolId)) {
|
||||||
long now = Time.now();
|
long now = Time.now();
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
|
|
|
@ -100,6 +100,11 @@ public class DataBlockScanner implements Runnable {
|
||||||
}
|
}
|
||||||
bpScanner.scanBlockPoolSlice();
|
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
|
// 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) {
|
if (blockScannerThread != null) {
|
||||||
blockScannerThread.interrupt();
|
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) {
|
public synchronized void addBlockPool(String blockPoolId) {
|
||||||
if (blockPoolScannerMap.get(blockPoolId) != null) {
|
if (blockPoolScannerMap.get(blockPoolId) != null) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue