PostgreSQL Use Case/Issues

James Beedy jamesbeedy at gmail.com
Thu Feb 23 14:16:45 UTC 2017


Awesome. Thanks for this!

> On Feb 23, 2017, at 4:15 AM, Stuart Bishop <stuart.bishop at canonical.com> wrote:
> 
>> On 23 February 2017 at 15:46, Stuart Bishop <stuart.bishop at canonical.com> wrote:
>> On 23 February 2017 at 01:46, James Beedy <jamesbeedy at gmail.com> wrote:
>> 
>>>> I think I can fix this, but I'll need to make a corresponding
>>>> adjustment in the PostgreSQL charm and the fix will only take effect
>>>> with updated services.
>>>> 
>>> +1 for a fix. Thanks.
>> 
>>>> Its related to the above issue. Your charm connects and gets the
>>>> db.master.available state set. But you want to specify the database
>>>> name, so a handler runs calling set_database(). At this point the
>>>> .master and .standbys properties start correctly returning None, but
>>>> set_database() neglected to remove the *.available states so handlers
>>>> got kicked in that shouldn't have.
>>>> 
>>> Ok, so a fix coming for this too in that case? This one is borking on my
>>> devs who are deploying my bundles, in turn causing me grief, but also
>>> borking on me too, making me question my own sanity :(
>> 
>> Yes. I'll push a fix out shortly.
> 
> I've pushed a fix for your second issue (the 'available' states not
> being removed when you change the requested database name).
> 
> I won't be able to fix the first issue today. For now, I think you can
> work around it using an extra state.
> 
> @when('db.connected')
> @when_not('dbname.requested')
> def request_database_name(psql):
>    psql.set_database('foobar')
>    reactive.set_state('dbname.requested')
> 
> @when_all('db.master.available', 'dbname.requested')
> def do_stuff_needing_master_db(psql):
>    assert psql.master is not None
>    assert psql.master.dbname == 'foobar'
> 
> 
> -- 
> Stuart Bishop <stuart.bishop at canonical.com>



More information about the Juju mailing list