← Back to team overview

launchpad-dev team mailing list archive

Re: Connections left open after switching to read only mode

 

On Thu, 2010-05-06 at 23:23 +0700, Stuart Bishop wrote:
> On Thu, May 6, 2010 at 9:41 PM, Guilherme Salgado <salgado@xxxxxxxxxxxxx> wrote:
> 
> > My changes for the read-only switch, though, introduced a way of
> > changing config values at runtime, thus exposing the problem.
> 
> Is there any particular reason we are reconnecting Stores to different
> databases rather than just having a seperate romode Store?

IIRC, I wanted to implement this on the lowest possible level so that
it'd just work for anything that connects to the database -- that's why
I went with the dynamic configs.  When I realized it wouldn't work
transparently, though, I thought of adding the publication hooks instead
of starting over. Maybe that was the wrong thing to do.

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.

> 
> ie. The signal handler would set a flag. At the start and end of a
> request, if the flag is set we disconnect the rw stores. At the start
> of a request, if the flag is set we install a romode IDatabasePolicy
> that only returns the romode store instead of the normal
> LaunchpadDatabasePolicy.
> 


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

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


Follow ups

References