You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2013/07/25 15:59:48 UTC

[jira] [Created] (SLING-2979) Scheduled task should only run on leader

Carsten Ziegeler created SLING-2979:
---------------------------------------

             Summary: Scheduled task should only run on leader
                 Key: SLING-2979
                 URL: https://issues.apache.org/jira/browse/SLING-2979
             Project: Sling
          Issue Type: New Feature
          Components: Commons
            Reporter: Carsten Ziegeler
            Assignee: Carsten Ziegeler
             Fix For: Commons Scheduler 2.3.6


With the new topology api we have support for leader election. In many cases scheduled tasks should only run on a single instance in a cluster. So far this can only be done by manually adding the task through the Scheduler interface but not with the whiteboard support.
We should add a new property scheduler.leaderonly which defaults to false but can be set to true. IN this case the task is only started on the leader.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Re: [jira] [Created] (SLING-2979) Scheduled task should only run on leader

Posted by Carsten Ziegeler <cz...@apache.org>.
Yes, this was my first idea as well (the single property pointing to either
an instance id or having the constant "LEADER"). I decided against this as
the most common use case right now is "run this on a single instance"; I
could also imagine the use case of running the task on a group of machines
which are "tagged" somehow. Obviously we don't have anything in that
direction yet.

So, maybe we should go with a property which can contain:
- a list of sling ids or
- LEADER or
- SINGLETON (maybe we need a better name for that - it just means, run only
on a single instance)

Regards
Carsten


2013/7/29 Felix Meschberger <fm...@adobe.com>

> Hi
>
> Am 29.07.2013 um 16:14 schrieb Carsten Ziegeler:
>
> > Yepp, I thought about this as well and came to the same conclusion.
> > However, apart from the Sling ID there is today no other mechanism to
> > identify an instance - apart from the leader. So I went with the easiest
> > case first.
>
> Right. The Sling ID is it -- and I think this is the one to use in any
> case -- optionally we can use the name, but this does not have the same
> uniqueness guarantee, which might just be good enough.
>
> But going with a specific ".leaderonly" property will get us - eventually
> - to two properties which may even be contradiction: Consider a task
> registered with .leaderonly=true and .runon=slingid. Will this run only if
> slingid is the leader ?
>
> I would prefer a single property .runon (better names welcome) which is
> the sling-id or sling-name or the constant "LEADER" meaning to run on the
> leader, no matter what the id or name. ... and you have to solve the
> problem of what happens if there are two or more instances with the same
> sling-name.
>
> Regards
> Felix
>
> >
> > Regards
> > Carsten
> >
> >
> > 2013/7/29 Felix Meschberger <fm...@adobe.com>
> >
> >> Hi
> >>
> >> Is it really so, that a job may be run on any instance or the leader
> >> instance ? Shouldn't we be able to bind a scheduled job just any
> instance X
> >> where "LEADER" might just be a special well-known instance name (like
> the
> >> HEAD revision in subversion) ?
> >>
> >> Regards
> >> Felix
> >>
> >> Am 25.07.2013 um 15:59 schrieb Carsten Ziegeler (JIRA):
> >>
> >>> Carsten Ziegeler created SLING-2979:
> >>> ---------------------------------------
> >>>
> >>>            Summary: Scheduled task should only run on leader
> >>>                Key: SLING-2979
> >>>                URL: https://issues.apache.org/jira/browse/SLING-2979
> >>>            Project: Sling
> >>>         Issue Type: New Feature
> >>>         Components: Commons
> >>>           Reporter: Carsten Ziegeler
> >>>           Assignee: Carsten Ziegeler
> >>>            Fix For: Commons Scheduler 2.3.6
> >>>
> >>>
> >>> With the new topology api we have support for leader election. In many
> >> cases scheduled tasks should only run on a single instance in a
> cluster. So
> >> far this can only be done by manually adding the task through the
> Scheduler
> >> interface but not with the whiteboard support.
> >>> We should add a new property scheduler.leaderonly which defaults to
> >> false but can be set to true. IN this case the task is only started on
> the
> >> leader.
> >>>
> >>> --
> >>> This message is automatically generated by JIRA.
> >>> If you think it was sent incorrectly, please contact your JIRA
> >> administrators
> >>> For more information on JIRA, see:
> >> http://www.atlassian.com/software/jira
> >>
> >>
> >
> >
> > --
> > Carsten Ziegeler
> > cziegeler@apache.org
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: [jira] [Created] (SLING-2979) Scheduled task should only run on leader

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

Am 29.07.2013 um 16:14 schrieb Carsten Ziegeler:

> Yepp, I thought about this as well and came to the same conclusion.
> However, apart from the Sling ID there is today no other mechanism to
> identify an instance - apart from the leader. So I went with the easiest
> case first.

Right. The Sling ID is it -- and I think this is the one to use in any case -- optionally we can use the name, but this does not have the same uniqueness guarantee, which might just be good enough.

But going with a specific ".leaderonly" property will get us - eventually - to two properties which may even be contradiction: Consider a task registered with .leaderonly=true and .runon=slingid. Will this run only if slingid is the leader ?

I would prefer a single property .runon (better names welcome) which is the sling-id or sling-name or the constant "LEADER" meaning to run on the leader, no matter what the id or name. ... and you have to solve the problem of what happens if there are two or more instances with the same sling-name.

Regards
Felix

> 
> Regards
> Carsten
> 
> 
> 2013/7/29 Felix Meschberger <fm...@adobe.com>
> 
>> Hi
>> 
>> Is it really so, that a job may be run on any instance or the leader
>> instance ? Shouldn't we be able to bind a scheduled job just any instance X
>> where "LEADER" might just be a special well-known instance name (like the
>> HEAD revision in subversion) ?
>> 
>> Regards
>> Felix
>> 
>> Am 25.07.2013 um 15:59 schrieb Carsten Ziegeler (JIRA):
>> 
>>> Carsten Ziegeler created SLING-2979:
>>> ---------------------------------------
>>> 
>>>            Summary: Scheduled task should only run on leader
>>>                Key: SLING-2979
>>>                URL: https://issues.apache.org/jira/browse/SLING-2979
>>>            Project: Sling
>>>         Issue Type: New Feature
>>>         Components: Commons
>>>           Reporter: Carsten Ziegeler
>>>           Assignee: Carsten Ziegeler
>>>            Fix For: Commons Scheduler 2.3.6
>>> 
>>> 
>>> With the new topology api we have support for leader election. In many
>> cases scheduled tasks should only run on a single instance in a cluster. So
>> far this can only be done by manually adding the task through the Scheduler
>> interface but not with the whiteboard support.
>>> We should add a new property scheduler.leaderonly which defaults to
>> false but can be set to true. IN this case the task is only started on the
>> leader.
>>> 
>>> --
>>> This message is automatically generated by JIRA.
>>> If you think it was sent incorrectly, please contact your JIRA
>> administrators
>>> For more information on JIRA, see:
>> http://www.atlassian.com/software/jira
>> 
>> 
> 
> 
> -- 
> Carsten Ziegeler
> cziegeler@apache.org


Re: [jira] [Created] (SLING-2979) Scheduled task should only run on leader

Posted by Carsten Ziegeler <cz...@apache.org>.
Yepp, I thought about this as well and came to the same conclusion.
However, apart from the Sling ID there is today no other mechanism to
identify an instance - apart from the leader. So I went with the easiest
case first.

Regards
Carsten


2013/7/29 Felix Meschberger <fm...@adobe.com>

> Hi
>
> Is it really so, that a job may be run on any instance or the leader
> instance ? Shouldn't we be able to bind a scheduled job just any instance X
> where "LEADER" might just be a special well-known instance name (like the
> HEAD revision in subversion) ?
>
> Regards
> Felix
>
> Am 25.07.2013 um 15:59 schrieb Carsten Ziegeler (JIRA):
>
> > Carsten Ziegeler created SLING-2979:
> > ---------------------------------------
> >
> >             Summary: Scheduled task should only run on leader
> >                 Key: SLING-2979
> >                 URL: https://issues.apache.org/jira/browse/SLING-2979
> >             Project: Sling
> >          Issue Type: New Feature
> >          Components: Commons
> >            Reporter: Carsten Ziegeler
> >            Assignee: Carsten Ziegeler
> >             Fix For: Commons Scheduler 2.3.6
> >
> >
> > With the new topology api we have support for leader election. In many
> cases scheduled tasks should only run on a single instance in a cluster. So
> far this can only be done by manually adding the task through the Scheduler
> interface but not with the whiteboard support.
> > We should add a new property scheduler.leaderonly which defaults to
> false but can be set to true. IN this case the task is only started on the
> leader.
> >
> > --
> > This message is automatically generated by JIRA.
> > If you think it was sent incorrectly, please contact your JIRA
> administrators
> > For more information on JIRA, see:
> http://www.atlassian.com/software/jira
>
>


-- 
Carsten Ziegeler
cziegeler@apache.org

Re: [jira] [Created] (SLING-2979) Scheduled task should only run on leader

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

Is it really so, that a job may be run on any instance or the leader instance ? Shouldn't we be able to bind a scheduled job just any instance X where "LEADER" might just be a special well-known instance name (like the HEAD revision in subversion) ?

Regards
Felix

Am 25.07.2013 um 15:59 schrieb Carsten Ziegeler (JIRA):

> Carsten Ziegeler created SLING-2979:
> ---------------------------------------
> 
>             Summary: Scheduled task should only run on leader
>                 Key: SLING-2979
>                 URL: https://issues.apache.org/jira/browse/SLING-2979
>             Project: Sling
>          Issue Type: New Feature
>          Components: Commons
>            Reporter: Carsten Ziegeler
>            Assignee: Carsten Ziegeler
>             Fix For: Commons Scheduler 2.3.6
> 
> 
> With the new topology api we have support for leader election. In many cases scheduled tasks should only run on a single instance in a cluster. So far this can only be done by manually adding the task through the Scheduler interface but not with the whiteboard support.
> We should add a new property scheduler.leaderonly which defaults to false but can be set to true. IN this case the task is only started on the leader.
> 
> --
> This message is automatically generated by JIRA.
> If you think it was sent incorrectly, please contact your JIRA administrators
> For more information on JIRA, see: http://www.atlassian.com/software/jira