Make pgcreate robust against race conditions

Bug #353865 reported by Francis J. Lacoste
2
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
High
Stuart Bishop

Bug Description

Our database initialization process sometimes fails because of race conditions. This race seems to happen more often in EC2:

Traceback (most recent call last):
  File "../../utilities/pgcreate.py", line 42, in ?
    sys.exit(main())
  File "../../utilities/pgcreate.py", line 27, in main
    cur.execute(
psycopg2.OperationalError: source database "launchpad_empty" is being accessed by other users

When this error happens, the script should sleep and retry a few times.

Changed in launchpad-foundations:
importance: Undecided → High
milestone: none → 2.2.4
status: New → Triaged
Revision history for this message
Stuart Bishop (stub) wrote :

I just checked pgcreate.py and we have already implemented this behavior. I don't know what is causing the ec2 failures we see occasionally.

Revision history for this message
Stuart Bishop (stub) wrote :

Some instrumentation and possible improvements is on lp:~stub/launchpad/pgmassacre, awaiting review. It increases the createdb timeout to 20 seconds, which should be plenty even if the ec2 box is loaded.

Revision history for this message
Stuart Bishop (stub) wrote :

lp:~stub/launchpad/trivial contains the fix, but I can't land it on lp:~launchpad-pqm/launchpad/devel due to the db check failing. The branch is safe as far as edge goes.

[testfix][r=jtv][ui=none][bugs=353865] Disable autovacuum on template databases to avoid conflicting with our build scripts

Revision history for this message
Stuart Bishop (stub) wrote :

Its been landed on lp:~launchpad-pqm/launchpad/db-devel so some spurious failures should stop, but still needs to land on lp:~launchpad-pqm/launchpad/devel

Changed in launchpad-foundations:
status: Triaged → In Progress
Stuart Bishop (stub)
Changed in launchpad-foundations:
assignee: nobody → Stuart Bishop (stub)
status: In Progress → 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.