You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yarn-issues@hadoop.apache.org by "Sunil G (JIRA)" <ji...@apache.org> on 2016/11/10 14:19:58 UTC

[jira] [Comment Edited] (YARN-5825) ProportionalPreemptionalPolicy could use readLock over LeafQueue instead of synchronized block

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

Sunil G edited comment on YARN-5825 at 11/10/16 2:19 PM:
---------------------------------------------------------

Attaching an initial version of patch.

In PCPP#cloneQueues, we use CSQueue abstract object. So I had to add {{getReadLock}} as an api in CSQueue interface to do lock. I agree this is not so clean way, however the alternative way is also not clean.

We might need to add below code in PCPP if we want to remove {{getReadQueue}} from CSQueue interface
{code}
  private ReentrantReadWriteLock.ReadLock getQueueReadLock(CSQueue curQueue) {
    if (curQueue instanceof ParentQueue) {
      return ((ParentQueue) curQueue).getReadLock();
    } else if (curQueue instanceof LeafQueue) {
      return ((LeafQueue) curQueue).getReadLock();
    }
    return null;
  }
{code}

[~leftnoteasy] [~jianhe] thoughts?


was (Author: sunilg):
Attaching an initial version of patch.

In PCPP#cloneQueues, we use CSQueue abstract object. So I had to add {{getReadLock}} as an api in CSQueue interface to do lock. I agree this is not so clean way, however the alternative way is also not clean.

We might need to add below code in PCPP if we want to remove {{getReadQueue}} from CSQueue interface
{code}
  private ReentrantReadWriteLock.ReadLock getQueueReadLock(CSQueue curQueue) {
    if (curQueue instanceof ParentQueue) {
      return ((ParentQueue) curQueue).getReadLock();
    } else if (curQueue instanceof LeafQueue) {
      return ((LeafQueue) curQueue).getReadLock();
    }
    return null;
  }
{code}

[~leftnoteasy] thoughts?

> ProportionalPreemptionalPolicy could use readLock over LeafQueue instead of synchronized block
> ----------------------------------------------------------------------------------------------
>
>                 Key: YARN-5825
>                 URL: https://issues.apache.org/jira/browse/YARN-5825
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: capacity scheduler
>            Reporter: Sunil G
>            Assignee: Sunil G
>         Attachments: YARN-5825.0001.patch
>
>
> Currently in PCPP, {{synchronized (curQueue)}} is used in various places. Such instances could be replaced with a read lock. Thank you [~jianhe] for pointing out the same as comment [here|https://issues.apache.org/jira/browse/YARN-2009?focusedCommentId=15626578&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-15626578]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: yarn-issues-help@hadoop.apache.org