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/branches/branch-2@1432318 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
596007fdc4
commit
f07582bc84
|
@ -399,6 +399,9 @@ Release 2.0.3-alpha - Unreleased
|
|||
HDFS-4328. TestLargeBlock#testLargeBlockSize is timing out. (Chris Nauroth
|
||||
via atm)
|
||||
|
||||
HDFS-4274. BlockPoolSliceScanner does not close verification log during
|
||||
shutdown. (Chris Nauroth via suresh)
|
||||
|
||||
BREAKDOWN OF HDFS-3077 SUBTASKS
|
||||
|
||||
HDFS-3077. Quorum-based protocol for reading and writing edit logs.
|
||||
|
|
|
@ -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