when switched to read-only and with the master disabled, we're still querying the master DB in staging

Bug #716494 reported by Tom Haddon
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical SSO provider
Fix Released
High
Ricardo Kirkner

Bug Description

During testing of the SSO staging schema upgrade today we discovered that when we switch both the ubuntu branded and launchpad branded staging SSO appservers to read-only mode and with the master DB disabled, we were still sending queries to the master DB, and none to the slave DB.

It's possible this has also been affecting us in production but we've never been aware of it before because we've never done DB upgrades that take out locks before, so we wouldn't have noticed.

Related branches

Tom Haddon (mthaddon)
tags: added: canonical-losa-isd
Changed in canonical-identity-provider:
importance: Undecided → High
Revision history for this message
Tom Haddon (mthaddon) wrote :

We took the master DB down, and every page OOPSed. Had though this might switch things over for us, but it wasn't the case.

Revision history for this message
Ricardo Kirkner (ricardokirkner) wrote :

Found the issue. It's because django changed some code between 1.0.2 and 1.1.1 that broke this.

In 1.0.4, the DatabaseWrapper object would query the global settings in order to retrieve the database connection parameters. Since django 1.1 this was changed so that this object caches a copy of the setting it uses.
Because of this, updating the global settings has no longer the desired effect of creating connections to the new (right) database, but keeps creating them to the original database.

Changed in canonical-identity-provider:
status: New → Fix Committed
assignee: nobody → Ricardo Kirkner (ricardokirkner)
Changed in canonical-identity-provider:
milestone: none → 11.02
Revision history for this message
Dave Morley (davmor2) wrote :

Passes on production

Changed in canonical-identity-provider:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.