HADOOP-8144. svn merge -c 1325367 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1325368 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2012-04-12 16:38:52 +00:00
parent cb3d6c3d98
commit cb7907aef2
2 changed files with 6 additions and 2 deletions

View File

@ -233,6 +233,10 @@ Release 2.0.0 - UNRELEASED
HADOOP-8270. hadoop-daemon.sh stop action should return 0 for an HADOOP-8270. hadoop-daemon.sh stop action should return 0 for an
already stopped service. (Roman Shaposhnik via eli) already stopped service. (Roman Shaposhnik via eli)
HADOOP-8144. pseudoSortByDistance in NetworkTopology doesn't work
properly if no local node and first node is local rack node.
(Junping Du)
BREAKDOWN OF HADOOP-7454 SUBTASKS BREAKDOWN OF HADOOP-7454 SUBTASKS
HADOOP-7455. HA: Introduce HA Service Protocol Interface. (suresh) HADOOP-7455. HA: Introduce HA Service Protocol Interface. (suresh)

View File

@ -662,8 +662,8 @@ public class NetworkTopology {
*/ */
public void pseudoSortByDistance( Node reader, Node[] nodes ) { public void pseudoSortByDistance( Node reader, Node[] nodes ) {
int tempIndex = 0; int tempIndex = 0;
if (reader != null ) {
int localRackNode = -1; int localRackNode = -1;
if (reader != null ) {
//scan the array to find the local node & local rack node //scan the array to find the local node & local rack node
for(int i=0; i<nodes.length; i++) { for(int i=0; i<nodes.length; i++) {
if(tempIndex == 0 && reader == nodes[i]) { //local node if(tempIndex == 0 && reader == nodes[i]) { //local node
@ -693,7 +693,7 @@ public class NetworkTopology {
} }
// put a random node at position 0 if it is not a local/local-rack node // put a random node at position 0 if it is not a local/local-rack node
if(tempIndex == 0 && nodes.length != 0) { if(tempIndex == 0 && localRackNode == -1 && nodes.length != 0) {
swap(nodes, 0, r.nextInt(nodes.length)); swap(nodes, 0, r.nextInt(nodes.length));
} }
} }