Comment 10 for bug 1942289

Revision history for this message
Alex Kavanagh (ajkavanagh) wrote :

> Juju is designed to keep a unit the leader during the dying phase and will only revoke leadership once the unit transitions to dead, just prior to removal and after all hooks have been run.

> The unit, if leader prior to removal, retains leadership so that it may do "leader" type things during the relation departed/broken hooks.

Just seeking clarification, but essentially, in a multi-unit set-up, if the leader is removed, a leadership election doesn't take place until the unit is removed?

So to pose a question: how does a unit 'know' that, when it is dying, that it isn't the last unit and not to do things like clean-up, etc? i.e. as the leader, how should it determine not to do clean-up? Is there an (option of/way to implement) atomic counter of units that are still 'alive' in the application?