← Back to team overview

launchpad-dev team mailing list archive

Re: Help with xx-read-only-mode.txt

 

On Thu, Sep 17, 2009 at 9:42 AM, Stuart Bishop
<stuart.bishop@xxxxxxxxxxxxx> wrote:
> On Thu, Sep 17, 2009 at 6:03 AM, Guilherme Salgado
> <salgado@xxxxxxxxxxxxx> wrote:
>> On Wed, 2009-09-16 at 20:02 -0300, Guilherme Salgado wrote:
>>> Hi Stuart,
>>>
>>> That test is failing on my lp:~salgado/launchpad/person-three-o branch
>>> because of a new menu Link that is rendered there on the top of the
>>> page. We hit the DB in order to figure out whether or not the link
>>> should be enabled, and that's when ReadOnlyModeDisallowedStore gets
>>> raised.
>>
>> Here's the failure, btw: http://paste.ubuntu.com/272402/
>>
>> --
>> Guilherme Salgado <salgado@xxxxxxxxxxxxx>
>>
>
>      File "/var/launchpad/test/lib/canonical/launchpad/database/oauth.py",
> line 74, in _get_store
>        return getUtility(IStoreSelector).get(MAIN_STORE, MASTER_FLAVOR)
>      File "/var/launchpad/test/lib/canonical/launchpad/webapp/adapter.py",
> line 510, in get
>        return db_policy.getStore(name, flavor)
>      File "/var/launchpad/test/lib/canonical/launchpad/webapp/dbpolicy.py",
> line 283, in getStore
>        raise ReadOnlyModeDisallowedStore(name, flavor)
>    ReadOnlyModeDisallowedStore: ('main', 'master')
>
>
> So you get to line 74 of oauth.py and explicitly request the master
> database. Code that needs to run in read only mode can't do that - it
> needs to use slave or default stores as the master is down for
> maintenance.

So OAuth._get_store needs to be smarter, or you need to stop using the
SQLObject compatibility layer in person.py's oauth_tokens method
allowing you to choose what store gets used.

-- 
Stuart Bishop <stuart@xxxxxxxxxxxxxxxx>
http://www.stuartbishop.net/



References