Merge lp:~allenap/maas/database-locks-revisited-at-start-up--1.5 into lp:maas/1.5

Proposed by Gavin Panella on 2014-06-03
Status: Merged
Approved by: Gavin Panella on 2014-06-03
Approved revision: 2286
Merged at revision: 2286
Proposed branch: lp:~allenap/maas/database-locks-revisited-at-start-up--1.5
Merge into: lp:maas/1.5
Diff against target: 26 lines (+7/-3)
1 file modified
src/maasserver/start_up.py (+7/-3)
To merge this branch: bzr merge lp:~allenap/maas/database-locks-revisited-at-start-up--1.5
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve on 2014-06-03
Review via email: mp+221916@code.launchpad.net

Commit message

Backport of trunk r2400: Lock for start-up in a transaction.

MAAS's database locking code has become more strict and fixing this was missed out.

To post a comment you must log in.
Gavin Panella (allenap) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/start_up.py'
2--- src/maasserver/start_up.py 2014-04-15 07:42:50 +0000
3+++ src/maasserver/start_up.py 2014-06-03 15:54:57 +0000
4@@ -18,7 +18,10 @@
5
6 from textwrap import dedent
7
8-from django.db import connection
9+from django.db import (
10+ connection,
11+ transaction,
12+ )
13 from maasserver import (
14 eventloop,
15 locks,
16@@ -51,8 +54,9 @@
17 but this method uses file-based locking to ensure that the methods it calls
18 internally are not ran concurrently.
19 """
20- with locks.startup:
21- inner_start_up()
22+ with transaction.atomic():
23+ with locks.startup:
24+ inner_start_up()
25
26 eventloop.start().wait(10)
27

Subscribers

People subscribed via source and target branches

to all changes: