HDFS-3616. Fix a ConcurrentModificationException bug that BP actor threads may not be shutdown properly in DataNode. Contributed by Jing Zhao
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1402608 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0e796b61e8
commit
3335e50244
|
@ -504,6 +504,9 @@ Release 2.0.3-alpha - Unreleased
|
||||||
out stream returned by WebHdfsFileSystem does not support it. (Jing Zhao
|
out stream returned by WebHdfsFileSystem does not support it. (Jing Zhao
|
||||||
via szetszwo)
|
via szetszwo)
|
||||||
|
|
||||||
|
HDFS-3616. Fix a ConcurrentModificationException bug that BP actor threads
|
||||||
|
may not be shutdown properly in DataNode. (Jing Zhao via szetszwo)
|
||||||
|
|
||||||
Release 2.0.2-alpha - 2012-09-07
|
Release 2.0.2-alpha - 2012-09-07
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -106,15 +106,15 @@ class BlockPoolManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void shutDownAll() throws InterruptedException {
|
void shutDownAll(BPOfferService[] bposArray) throws InterruptedException {
|
||||||
BPOfferService[] bposArray = this.getAllNamenodeThreads();
|
if (bposArray != null) {
|
||||||
|
for (BPOfferService bpos : bposArray) {
|
||||||
for (BPOfferService bpos : bposArray) {
|
bpos.stop(); //interrupts the threads
|
||||||
bpos.stop(); //interrupts the threads
|
}
|
||||||
}
|
//now join
|
||||||
//now join
|
for (BPOfferService bpos : bposArray) {
|
||||||
for (BPOfferService bpos : bposArray) {
|
bpos.join();
|
||||||
bpos.join();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1095,6 +1095,12 @@ public class DataNode extends Configured
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We need to make a copy of the original blockPoolManager#offerServices to
|
||||||
|
// make sure blockPoolManager#shutDownAll() can still access all the
|
||||||
|
// BPOfferServices, since after setting DataNode#shouldRun to false the
|
||||||
|
// offerServices may be modified.
|
||||||
|
BPOfferService[] bposArray = this.blockPoolManager == null ? null
|
||||||
|
: this.blockPoolManager.getAllNamenodeThreads();
|
||||||
this.shouldRun = false;
|
this.shouldRun = false;
|
||||||
shutdownPeriodicScanners();
|
shutdownPeriodicScanners();
|
||||||
|
|
||||||
|
@ -1141,7 +1147,7 @@ public class DataNode extends Configured
|
||||||
|
|
||||||
if(blockPoolManager != null) {
|
if(blockPoolManager != null) {
|
||||||
try {
|
try {
|
||||||
this.blockPoolManager.shutDownAll();
|
this.blockPoolManager.shutDownAll(bposArray);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
LOG.warn("Received exception in BlockPoolManager#shutDownAll: ", ie);
|
LOG.warn("Received exception in BlockPoolManager#shutDownAll: ", ie);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue