On 6 April 2017 at 00:26, Dmitrii Shcherbakov
<dmitrii.shcherba...@canonical.com> wrote:

> https://jujucharms.com/docs/2.1/reference-charm-hooks#leader-elected
> "leader-elected is run at least once to signify that Juju decided this
> unit is the leader. Authors can use this hook to take action if their
> protocols for leadership, consensus, raft, or quorum require one unit
> to assert leadership. If the election process is done internally to
> the service, other code should be used to signal the leader to Juju.
> For more information read the charm leadership document."
>
> This doc says
> "If the election process is done internally to the service, other code
> should be used to signal the leader to Juju.".
>
> However, I don't see any hook tools to assert leadership to Juju from
> a charm based upon application-specific leadership information
> http://paste.ubuntu.com/24319908/
>
> So, as far as I understand, there is no manual way to designate a
> leader and the doc is wrong.
>
> Does anyone know if it is supposed to be that way and if this has not
> been implemented for a reason?

I agree with your reading, and think the documentation is wrong.  If
the election process is done internally to the service, there is no
way (and no need) to signal the internal 'leader' to Juju.

I also put 'leader' in quotes because if your service maintains its
own master, you should not call it 'leader' to avoid confusion with
the Juju leader.

For example, the lead unit in a PostgreSQL service appoints one of the
units as master. The master remains the master until the operator runs
the 'switchover' action on the lead unit, or the master unit is
destroyed causing the lead unit to start the failover process. At no
point does Juju care which unit is 'master'. Its communicated to the
end user using the workload status. Its simple enough to do and works
well.


-- 
Stuart Bishop <stuart.bis...@canonical.com>

-- 
Juju-dev mailing list
Juju-dev@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju-dev

Reply via email to