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

Hong Tang commented on MAPREDUCE-1715:
--------------------------------------

Found this bug when working on MAPREDUCE-1695. The code (after MAPREDUCE-1695) 
reads as follows:
{code}
  private void updateNoOfSlotsOccupiedByUser(Map<String, Integer> nou) {
    for (Iterator<Map.Entry<String, Integer>> it = nou.entrySet().iterator(); 
it.hasNext(); ) {
      Map.Entry<String, Integer> entry = it.next();
      String key = entry.getKey();
      Integer currentVal = numSlotsOccupiedByUser.get(key);
      if (currentVal != null) {
        this.numSlotsOccupiedByUser.put(key, currentVal + entry.getValue());
      }
    }
  }
{code}

What this method does is to add the incremental update of slot usage by users 
to the global data structure. However, if a user is not existent in the global 
map numSlotsOccupiedByUser, the update would be ignored. Since this is the only 
place where the global map is updated and that it starts empty, this method has 
no effect (namely, currentVal will always be null).

The change is rather simple:
{code}
  private void updateNoOfSlotsOccupiedByUser(Map<String, Integer> nou) {
    for (Iterator<Map.Entry<String, Integer>> it = nou.entrySet().iterator(); 
it.hasNext(); ) {
      Map.Entry<String, Integer> entry = it.next();
      String key = entry.getKey();
      Integer currentVal = numSlotsOccupiedByUser.get(key);
      if (currentVal != null) {
        this.numSlotsOccupiedByUser.put(key, currentVal + entry.getValue());
      } else {
        this.numSlotsOccupiedByUser.put(key, entry.getValue());
      }
    }
  }
{code}

> TaskSchedulingContext.updateNoOfSlotsOccupiedByUser does not update slots 
> used by a new user
> --------------------------------------------------------------------------------------------
>
>                 Key: MAPREDUCE-1715
>                 URL: https://issues.apache.org/jira/browse/MAPREDUCE-1715
>             Project: Hadoop Map/Reduce
>          Issue Type: Bug
>            Reporter: Hong Tang
>
> TaskSchedulingContext.updateNoOfSlotsOccupiedByUser does not update slots 
> used by a new user.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to