You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by ju...@apache.org on 2013/12/11 09:51:13 UTC
svn commit: r1550074 - in
/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs: CHANGES.txt
src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java
Author: junping_du
Date: Wed Dec 11 08:51:12 2013
New Revision: 1550074
URL: http://svn.apache.org/r1550074
Log:
HDFS-5580. Fix infinite loop in Balancer.waitForMoveCompletion. (Binglin Chang via junping_du)
Modified:
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1550074&r1=1550073&r2=1550074&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed Dec 11 08:51:12 2013
@@ -639,6 +639,9 @@ Release 2.4.0 - UNRELEASED
HDFS-5533. Symlink delete/create should be treated as DELETE/CREATE in snapshot diff
report. (Binglin Chang via jing9)
+ HDFS-5580. Fix infinite loop in Balancer.waitForMoveCompletion.
+ (Binglin Chang via junping_du)
+
Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java?rev=1550074&r1=1550073&r2=1550074&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java (original)
+++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java Wed Dec 11 08:51:12 2013
@@ -292,26 +292,27 @@ public class Balancer {
*/
private boolean chooseProxySource() {
final DatanodeInfo targetDN = target.getDatanode();
- boolean find = false;
- for (BalancerDatanode loc : block.getLocations()) {
- // check if there is replica which is on the same rack with the target
- if (cluster.isOnSameRack(loc.getDatanode(), targetDN) && addTo(loc)) {
- find = true;
- // if cluster is not nodegroup aware or the proxy is on the same
- // nodegroup with target, then we already find the nearest proxy
- if (!cluster.isNodeGroupAware()
- || cluster.isOnSameNodeGroup(loc.getDatanode(), targetDN)) {
+ // if node group is supported, first try add nodes in the same node group
+ if (cluster.isNodeGroupAware()) {
+ for (BalancerDatanode loc : block.getLocations()) {
+ if (cluster.isOnSameNodeGroup(loc.getDatanode(), targetDN) && addTo(loc)) {
return true;
}
}
-
- if (!find) {
- // find out a non-busy replica out of rack of target
- find = addTo(loc);
+ }
+ // check if there is replica which is on the same rack with the target
+ for (BalancerDatanode loc : block.getLocations()) {
+ if (cluster.isOnSameRack(loc.getDatanode(), targetDN) && addTo(loc)) {
+ return true;
}
}
-
- return find;
+ // find out a non-busy replica
+ for (BalancerDatanode loc : block.getLocations()) {
+ if (addTo(loc)) {
+ return true;
+ }
+ }
+ return false;
}
// add a BalancerDatanode as proxy source for specific block movement