Guarantee order of relation-joined & relation-changed?

Andreas Hasenack andreas at canonical.com
Fri Jul 5 14:31:38 UTC 2013


On Fri, Jul 5, 2013 at 11:15 AM, Matthew Wedgwood <
matthew.wedgwood at canonical.com> wrote:

> > So if you deploy the three services and relate them to each other
> > immediately, there is a big chance that the client relation will
> > fail, because the app wasn't related to the DB yet.
>
> Again, why should the relation fail? If the app isn't related to the DB,
> the client will simply receive error responses/timeouts from the app,
> right? There's no guarantee that the app can always talk to the database,
> even when the relation is fully established.
>

I agree the relation shouldn't fail. I'm just wondering how to best handle
this:
1) client retries, as you suggested
2) server holding off sending the configuration details to the client until
the server is ready

There are details here. For example, the server might only know all the
configuration details once it's ready with all its relations. So the client
won't have it all until that happens, and that's essentially case 2 above.


> If you're implying that the appserver passes along some information to the
> client from the database, then I would expect the app to run
> relation-changed (on the client's relation) when the database relation was
> established.
>

That's what I'm experimenting with now. Once the server has all the
details, I will call relation-set on the client relation and give them. So,
for example:
- client joins
- server runs relation-joined, notices it's not ready to "serve", returns
success but sets no relation data
- client runs joined, noop
- client runs changed, has no relation-data to work with, does nothing
At this point the relation is established, but the client isn't configured
yet.
- server joins with the db
- at the end of relation-joined and -changed, notices it has all the info
it needs to work properly
- calls a function to relation-set all configs to all client relations that
didn't have it set already
- clients run relation-changed, notice the config bits in the relation data
and configure themselves and are ready to work
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20130705/9a990d4f/attachment.html>


More information about the Juju mailing list