HDFS-3417. svn merge -c 1338767 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1338780 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-05-15 16:17:21 +00:00
parent 715b4cfad1
commit b20ef722c5
2 changed files with 19 additions and 15 deletions

View File

@ -326,6 +326,9 @@ Release 2.0.0 - UNRELEASED
HDFS-3335. check for edit log corruption at the end of the log HDFS-3335. check for edit log corruption at the end of the log
(Colin Patrick McCabe via todd) (Colin Patrick McCabe via todd)
HDFS-3417. Rename BalancerDatanode#getName to getDisplayName to be
consistent with Datanode. (eli)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-2477. Optimize computing the diff between a block report and the HDFS-2477. Optimize computing the diff between a block report and the

View File

@ -262,9 +262,9 @@ public class Balancer {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Decided to move block "+ block.getBlockId() LOG.debug("Decided to move block "+ block.getBlockId()
+" with a length of "+StringUtils.byteDesc(block.getNumBytes()) +" with a length of "+StringUtils.byteDesc(block.getNumBytes())
+ " bytes from " + source.getName() + " bytes from " + source.getDisplayName()
+ " to " + target.getName() + " to " + target.getDisplayName()
+ " using proxy source " + proxySource.getName() ); + " using proxy source " + proxySource.getDisplayName() );
} }
return true; return true;
} }
@ -317,15 +317,15 @@ public class Balancer {
receiveResponse(in); receiveResponse(in);
bytesMoved.inc(block.getNumBytes()); bytesMoved.inc(block.getNumBytes());
LOG.info( "Moving block " + block.getBlock().getBlockId() + LOG.info( "Moving block " + block.getBlock().getBlockId() +
" from "+ source.getName() + " to " + " from "+ source.getDisplayName() + " to " +
target.getName() + " through " + target.getDisplayName() + " through " +
proxySource.getName() + proxySource.getDisplayName() +
" is succeeded." ); " is succeeded." );
} catch (IOException e) { } catch (IOException e) {
LOG.warn("Error moving block "+block.getBlockId()+ LOG.warn("Error moving block "+block.getBlockId()+
" from " + source.getName() + " to " + " from " + source.getDisplayName() + " to " +
target.getName() + " through " + target.getDisplayName() + " through " +
proxySource.getName() + proxySource.getDisplayName() +
": "+e.getMessage()); ": "+e.getMessage());
} finally { } finally {
IOUtils.closeStream(out); IOUtils.closeStream(out);
@ -378,7 +378,8 @@ public class Balancer {
public void run() { public void run() {
if (LOG.isDebugEnabled()) { if (LOG.isDebugEnabled()) {
LOG.debug("Starting moving "+ block.getBlockId() + LOG.debug("Starting moving "+ block.getBlockId() +
" from " + proxySource.getName() + " to " + target.getName()); " from " + proxySource.getDisplayName() + " to " +
target.getDisplayName());
} }
dispatch(); dispatch();
} }
@ -475,7 +476,7 @@ public class Balancer {
@Override @Override
public String toString() { public String toString() {
return getClass().getSimpleName() + "[" + getName() return getClass().getSimpleName() + "[" + datanode
+ ", utilization=" + utilization + "]"; + ", utilization=" + utilization + "]";
} }
@ -507,8 +508,8 @@ public class Balancer {
} }
/** Get the name of the datanode */ /** Get the name of the datanode */
protected String getName() { protected String getDisplayName() {
return datanode.getName(); return datanode.toString();
} }
/* Get the storage id of the datanode */ /* Get the storage id of the datanode */
@ -831,7 +832,7 @@ public class Balancer {
this.aboveAvgUtilizedDatanodes.add((Source)datanodeS); this.aboveAvgUtilizedDatanodes.add((Source)datanodeS);
} else { } else {
assert(isOverUtilized(datanodeS)) : assert(isOverUtilized(datanodeS)) :
datanodeS.getName()+ "is not an overUtilized node"; datanodeS.getDisplayName()+ "is not an overUtilized node";
this.overUtilizedDatanodes.add((Source)datanodeS); this.overUtilizedDatanodes.add((Source)datanodeS);
overLoadedBytes += (long)((datanodeS.utilization-avg overLoadedBytes += (long)((datanodeS.utilization-avg
-threshold)*datanodeS.datanode.getCapacity()/100.0); -threshold)*datanodeS.datanode.getCapacity()/100.0);
@ -842,7 +843,7 @@ public class Balancer {
this.belowAvgUtilizedDatanodes.add(datanodeS); this.belowAvgUtilizedDatanodes.add(datanodeS);
} else { } else {
assert isUnderUtilized(datanodeS) : "isUnderUtilized(" assert isUnderUtilized(datanodeS) : "isUnderUtilized("
+ datanodeS.getName() + ")=" + isUnderUtilized(datanodeS) + datanodeS.getDisplayName() + ")=" + isUnderUtilized(datanodeS)
+ ", utilization=" + datanodeS.utilization; + ", utilization=" + datanodeS.utilization;
this.underUtilizedDatanodes.add(datanodeS); this.underUtilizedDatanodes.add(datanodeS);
underLoadedBytes += (long)((avg-threshold- underLoadedBytes += (long)((avg-threshold-