You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-commits@hadoop.apache.org by vi...@apache.org on 2012/02/08 02:57:02 UTC
svn commit: r1241735 - in
/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project: ./
hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/
hadoop-mapreduce-client/hadoop-mapreduce-client-ap...
Author: vinodkv
Date: Wed Feb 8 01:57:02 2012
New Revision: 1241735
URL: http://svn.apache.org/viewvc?rev=1241735&view=rev
Log:
MAPREDUCE-3834. Changed MR AM to not add the same rack entry multiple times into the container request table when multiple hosts for a split happen to be on the same rack. Contributed by Siddarth Seth.
svn merge --ignore-ancestry -c 1241734 ../../trunk/
Modified:
hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java
Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt?rev=1241735&r1=1241734&r2=1241735&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/CHANGES.txt Wed Feb 8 01:57:02 2012
@@ -721,6 +721,10 @@ Release 0.23.1 - Unreleased
the same FS scheme, instead of randomly using one. (Mahadev Konar via
sseth)
+ MAPREDUCE-3834. Changed MR AM to not add the same rack entry multiple times
+ into the container request table when multiple hosts for a split happen to
+ be on the same rack. (Siddarth Seth via vinodkv)
+
Release 0.23.0 - 2011-11-01
INCOMPATIBLE CHANGES
Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java?rev=1241735&r1=1241734&r2=1241735&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TaskAttemptImpl.java Wed Feb 8 01:57:02 2012
@@ -27,9 +27,11 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
@@ -1079,14 +1081,14 @@ public abstract class TaskAttemptImpl im
taskAttempt.attemptId,
taskAttempt.resourceCapability));
} else {
- int i = 0;
- String[] racks = new String[taskAttempt.dataLocalHosts.length];
+ Set<String> racks = new HashSet<String>();
for (String host : taskAttempt.dataLocalHosts) {
- racks[i++] = RackResolver.resolve(host).getNetworkLocation();
+ racks.add(RackResolver.resolve(host).getNetworkLocation());
}
taskAttempt.eventHandler.handle(new ContainerRequestEvent(
taskAttempt.attemptId, taskAttempt.resourceCapability, taskAttempt
- .resolveHosts(taskAttempt.dataLocalHosts), racks));
+ .resolveHosts(taskAttempt.dataLocalHosts), racks
+ .toArray(new String[racks.size()])));
}
}
}
Modified: hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java?rev=1241735&r1=1241734&r2=1241735&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java (original)
+++ hadoop/common/branches/branch-0.23/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/job/impl/TestTaskAttempt.java Wed Feb 8 01:57:02 2012
@@ -81,7 +81,39 @@ public class TestTaskAttempt{
MRApp app = new FailingAttemptsMRApp(0, 1);
testMRAppHistory(app);
}
-
+
+ @SuppressWarnings("rawtypes")
+ @Test
+ public void testSingleRackRequest() throws Exception {
+ TaskAttemptImpl.RequestContainerTransition rct =
+ new TaskAttemptImpl.RequestContainerTransition(false);
+
+ EventHandler eventHandler = mock(EventHandler.class);
+ String[] hosts = new String[3];
+ hosts[0] = "host1";
+ hosts[1] = "host2";
+ hosts[2] = "host3";
+ TaskSplitMetaInfo splitInfo =
+ new TaskSplitMetaInfo(hosts, 0, 128 * 1024 * 1024l);
+
+ TaskAttemptImpl mockTaskAttempt =
+ createMapTaskAttemptImplForTest(eventHandler, splitInfo);
+ TaskAttemptEvent mockTAEvent = mock(TaskAttemptEvent.class);
+
+ rct.transition(mockTaskAttempt, mockTAEvent);
+
+ ArgumentCaptor<Event> arg = ArgumentCaptor.forClass(Event.class);
+ verify(eventHandler, times(2)).handle(arg.capture());
+ if (!(arg.getAllValues().get(1) instanceof ContainerRequestEvent)) {
+ Assert.fail("Second Event not of type ContainerRequestEvent");
+ }
+ ContainerRequestEvent cre =
+ (ContainerRequestEvent) arg.getAllValues().get(1);
+ String[] requestedRacks = cre.getRacks();
+ //Only a single occurance of /DefaultRack
+ assertEquals(1, requestedRacks.length);
+ }
+
@SuppressWarnings("rawtypes")
@Test
public void testHostResolveAttempt() throws Exception {