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

Wangda Tan commented on HADOOP-13035:
-------------------------------------

Hi [[email protected]],

Thanks for sharing background and thoughts about this issue.

Given this looks like a fundamental change. And could possibly cause other 
issues for example:
bq. the fact that calling start() on a service which is started or in the 
process of starting is required to be a no-op.

I think adding:
bq. a transitionInProgress variable and accessor
Sounds like a good plan if we add it to AbstractService, add the 
transitionInProgress to following blocks:
{code}
    synchronized (stateChangeLock) {
      if (enterState(STATE.INITED) != STATE.INITED) {
         // set in-progress-flag
         // other logics
         // unset in-progress-flag
      }
    ...
{code}

Since every state transition needs to acquire stateChangeLock, it seems safe to 
me when stop() is called when start() is invoking or call start() when init() 
is invoking, etc.

Adding an ExtendedService is a more comprehensive fix, and I agree that it is 
doable, but we have to fix all existing subclasses of AbstractService to use 
that.

I think a simpler but incompatible fix is rename existing STARTED/INITED to 
STARTING/INITING, and adding a new STARTED/INITED to Service. Probably we can 
do that on trunk before Hadoop-3 get released. Could you please share your 
thoughts?

Thanks,

> Add states INITING and STARTING to YARN Service model to cover in-transition 
> states.
> ------------------------------------------------------------------------------------
>
>                 Key: HADOOP-13035
>                 URL: https://issues.apache.org/jira/browse/HADOOP-13035
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Bibin A Chundatt
>         Attachments: 0001-HADOOP-13035.patch, 0002-HADOOP-13035.patch, 
> 0003-HADOOP-13035.patch
>
>
> As per the discussion in YARN-3971 the we should be setting the service state 
> to STARTED only after serviceStart() 
> Currently {{AbstractService#start()}} is set
> {noformat} 
>      if (stateModel.enterState(STATE.STARTED) != STATE.STARTED) {
>         try {
>           startTime = System.currentTimeMillis();
>           serviceStart();
> ..
>  }
> {noformat}
> enterState sets the service state to proposed state. So in 
> {{service.getServiceState}} in {{serviceStart()}} will return STARTED .



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to