Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relation_set in relation-departed behavior is unclear #2357

Closed
dshcherb opened this issue Jan 6, 2018 · 4 comments
Closed

relation_set in relation-departed behavior is unclear #2357

dshcherb opened this issue Jan 6, 2018 · 4 comments

Comments

@dshcherb
Copy link
Contributor

dshcherb commented Jan 6, 2018

https://jujucharms.com/docs/2.3/authors-relations-in-depth#departing-relations

  • For every known related unit (those which have joined and not yet departed), run the relation-departed hook.
  • Run the relation-broken hook.
  • depart from its scope in the relation.

So what's the difference between relation-departed and relation-broken? Think of relation-departed as the "saying goodbye" event. While in the latter state, relation settings can still be read (with relation-get) and a relation can even still be set (with relation-set). Once relation-broken fires, however, the relation no longer exists.

I think there is a logical mistake + unclear behavior description.

"the latter" should be "the former" because relation-departed runs first. In other words:

departed == can still read and write to relation data

But if I can still do relation_set in -relation-departed how will the other side react to that to read this new relation data? Will it receive another -relation-changed event or not? It is not clear at all.

What are the ordering guarantees for -departed in this case?

To make use of relation_set in -departed more information is needed. If there are two applications A and B in would be useful to know what happens after juju remove-relation A B:

  1. Do all units in A get a chance to run relation-departed before all units in B? Or there is no order to that?
  2. Can relation-set be used on all A and B units? How will they receive relation data updates before -relation-broken?
  3. Is there a guarantee that no -broken event will be triggered while there are still -departed events to be processed on individual units of A or B?

It would make sense to me if something like that was described:

  1. Any A or B unit can do relation_set in -relation-departed
    OR relation_set cannot be used in -relation-departed;
  2. Any A or B unit can do relation_get in -relation-broken to retrieve settings set in -relation-departed
    OR relation_get and relation_set cannot be used in -relation-broken
    OR there is no way to do a relation_set after -relation-departed

I think it is a valid use-case to send some data over a relation after an operator runs remove-relation because there may be some information needed on A or B units from the other side for proper cleanup besides the information already present on a given relation when -relation-departed fires.

@dshcherb
Copy link
Contributor Author

Similar Juju bug https://bugs.launchpad.net/juju/+bug/1417874

@pmatulis
Copy link

@dshcherb Yes, the "latter" was intended to refer to relation-departed. The rest will require some digging.

@pmatulis
Copy link

I asked about this on the Juju Discourse channel.

@pmatulis pmatulis self-assigned this Aug 29, 2018
@pmatulis pmatulis removed their assignment Sep 7, 2018
@pmatulis
Copy link

@dshcherb Here is a response from Discourse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants