HDFS-2553. Fix BlockPoolSliceScanner spinning in a tight loop. Contributed by Uma Maheswara Rao G.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1220316 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
27524695ed
commit
c881725a86
|
@ -104,6 +104,9 @@ Release 0.23.1 - UNRELEASED
|
||||||
|
|
||||||
HDFS-2640. Javadoc generation hangs. (tomwhite)
|
HDFS-2640. Javadoc generation hangs. (tomwhite)
|
||||||
|
|
||||||
|
HDFS-2553. Fix BlockPoolSliceScanner spinning in a tight loop (Uma
|
||||||
|
Maheswara Rao G via todd)
|
||||||
|
|
||||||
Release 0.23.0 - 2011-11-01
|
Release 0.23.0 - 2011-11-01
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -450,14 +450,14 @@ class BlockPoolSliceScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized long getEarliestScanTime() {
|
private synchronized long getEarliestScanTime() {
|
||||||
if ( blockInfoSet.size() > 0 ) {
|
if (!blockInfoSet.isEmpty()) {
|
||||||
return blockInfoSet.first().lastScanTime;
|
return blockInfoSet.first().lastScanTime;
|
||||||
}
|
}
|
||||||
return Long.MAX_VALUE;
|
return Long.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized boolean isFirstBlockProcessed() {
|
private synchronized boolean isFirstBlockProcessed() {
|
||||||
if (blockInfoSet.size() > 0 ) {
|
if (!blockInfoSet.isEmpty()) {
|
||||||
long blockId = blockInfoSet.first().block.getBlockId();
|
long blockId = blockInfoSet.first().block.getBlockId();
|
||||||
if ((processedBlocks.get(blockId) != null)
|
if ((processedBlocks.get(blockId) != null)
|
||||||
&& (processedBlocks.get(blockId) == 1)) {
|
&& (processedBlocks.get(blockId) == 1)) {
|
||||||
|
@ -471,7 +471,7 @@ class BlockPoolSliceScanner {
|
||||||
private void verifyFirstBlock() {
|
private void verifyFirstBlock() {
|
||||||
Block block = null;
|
Block block = null;
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if ( blockInfoSet.size() > 0 ) {
|
if (!blockInfoSet.isEmpty()) {
|
||||||
block = blockInfoSet.first().block;
|
block = blockInfoSet.first().block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ class BlockPoolSliceScanner {
|
||||||
* lastModificationTime > 0.
|
* lastModificationTime > 0.
|
||||||
*/
|
*/
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (blockInfoSet.size() > 0 ) {
|
if (!blockInfoSet.isEmpty()) {
|
||||||
BlockScanInfo info;
|
BlockScanInfo info;
|
||||||
while ((info = blockInfoSet.first()).lastScanTime < 0) {
|
while ((info = blockInfoSet.first()).lastScanTime < 0) {
|
||||||
delBlockInfo(info);
|
delBlockInfo(info);
|
||||||
|
@ -630,7 +630,7 @@ class BlockPoolSliceScanner {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (((now - getEarliestScanTime()) >= scanPeriod)
|
if (((now - getEarliestScanTime()) >= scanPeriod)
|
||||||
|| (!(this.isFirstBlockProcessed()))) {
|
|| ((!blockInfoSet.isEmpty()) && !(this.isFirstBlockProcessed()))) {
|
||||||
verifyFirstBlock();
|
verifyFirstBlock();
|
||||||
} else {
|
} else {
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled()) {
|
||||||
|
|
Loading…
Reference in New Issue