[ 
https://issues.apache.org/jira/browse/MAPREDUCE-5966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14071106#comment-14071106
 ] 

Karthik Kambatla commented on MAPREDUCE-5966:
---------------------------------------------

Looks like this patch doesn't apply anymore, may be due MR-5979. Can you please 
update it? 

Also, I have the following minor comments:
# Reword the following comment to say "Update demands and weights of jobs and 
pools"
{code}
"+      // Update demands of jobs and pools and update weights
{code}
# In the test case, I don't think Math.max is required anymore.
{code}
+
+        // Until MAPREDUCE-5966 gets fixed we cannot have zero weight set
+        return Math.max(curWeight * random, 0.001);
{code}
# We should be able to fit the following in two lines with throws in the line 
after the method name?
{code}
+  public void testJobSchedulableSortingWithCustomWeightAdjuster() throws
+      IOException,
+      InterruptedException {
{code}
# Can we make all these variables final and capital letters. Also, don't see 
the need for numRacks and numNodesPerRack.
{code}
+    final int iterations = 100;
+    int jobCount = 100;
+    int numRacks = 100;
+    int numNodesPerRack = 2;
+    final int totalTaskTrackers = numNodesPerRack * numRacks;
{code}
# We should probably use pure camel-caps for this variable - {{randomTtid}}

> MR1 FairScheduler use of custom weight adjuster is not thread safe for 
> comparisons
> ----------------------------------------------------------------------------------
>
>                 Key: MAPREDUCE-5966
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-5966
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>          Components: scheduler
>    Affects Versions: 1.2.1
>            Reporter: Anubhav Dhoot
>            Assignee: Anubhav Dhoot
>         Attachments: MAPREDUCE-5966.001.patch
>
>
> When comparing JobSchedulables one of the factors is the weight. If someone 
> uses a custom weight adjuster, that may be called multiple times during a 
> sort causing different values to return. That causes a failure in sorting 
> because the weight may change during the sort.
> This reproes as 
> {code}
> java.io.IOException: java.lang.IllegalArgumentException: Comparison method 
> violates its general contract!
> at java.util.TimSort.mergeHi(TimSort.java:868)
> at java.util.TimSort.mergeAt(TimSort.java:485)
> at java.util.TimSort.mergeCollapse(TimSort.java:410)
> at java.util.TimSort.sort(TimSort.java:214)
> at java.util.TimSort.sort(TimSort.java:173)
> at java.util.Arrays.sort(Arrays.java:659)
> at java.util.Collections.sort(Collections.java:217)
> at 
> org.apache.hadoop.mapred.PoolSchedulable.assignTask(PoolSchedulable.java:163)
> at org.apache.hadoop.mapred.FairScheduler.assignTasks(FairScheduler.java:499)
> at org.apache.hadoop.mapred.JobTracker.heartbeat(JobTracker.java:2961)
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to