← Back to team overview

launchpad-dev team mailing list archive

Re: Connections left open after switching to read only mode

 

On Fri, 2010-05-07 at 17:46 +0700, Stuart Bishop wrote:
> On Fri, May 7, 2010 at 12:56 AM, Guilherme Salgado
> <salgado@xxxxxxxxxxxxx> wrote:
> 
> > We could do what you suggest, but that'd require teaching the librarian
> > about read-only stores as well, as I think we're using the read-only.txt
> > file to switch the librarian mode as well (although for the librarian we
> > need a restart). We may need to do similar changes on other services
> > that have access the DB, but I'm not sure if there's any.
> 
> That just means we need to make the default database policy
> (MasterDatabasePolicy) aware of read-only.txt and hand out the desired
> Stores, or install a ReadOnlyModeDatabasePolicy on startup if
> read-only.txt exists. Everything in Launchpad retrieves its stores via
> the IStoreSelector and the currently installed IDatabasePolicy so this
> should work fine.
> 

The latter should work as long as the ROMDP returns the romode store
(pointing to the standalone DB) rather than the regular slave one as it
currently does.  The ROMDP is already installed by beforeTraversal() (so
we'll still be able to switch the web app to read-only without
restarting) but as you said we'll need to install that policy on
startup, for things like the librarian.

We also need to make sure that all DatabasePolicies can detect a mode
change and close the stores used by the previous mode, so that we don't
leave open connections behind.

-- 
Guilherme Salgado <https://launchpad.net/~salgado>

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References