Merge lp:~allenap/maas/rpc-create-table-race into lp:~maas-committers/maas/trunk
Proposed by
Gavin Panella
Status: | Merged |
---|---|
Approved by: | Gavin Panella |
Approved revision: | no longer in the source branch. |
Merged at revision: | 2217 |
Proposed branch: | lp:~allenap/maas/rpc-create-table-race |
Merge into: | lp:~maas-committers/maas/trunk |
Diff against target: |
109 lines (+45/-3) 4 files modified
src/maasserver/locks.py (+4/-0) src/maasserver/rpc/regionservice.py (+5/-1) src/maasserver/rpc/tests/test_regionservice.py (+32/-1) src/maasserver/utils/dblocks.py (+4/-1) |
To merge this branch: | bzr merge lp:~allenap/maas/rpc-create-table-race |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeroen T. Vermeulen (community) | Approve | ||
Review via email: mp+213539@code.launchpad.net |
Commit message
Take an advisory lock to prevent concurrent creation of the eventloops table.
Creating tables in PostgreSQL is a transactional operation like any
other. If the isolation level is not sufficient - the default in Django
- it is susceptible to races. Using a higher isolation level may lead to
serialisation failures, for example. Advisory locking side-steps this.
To post a comment you must log in.
Actually postgres does guard against races when creating new tables. The operation is transactional, much like a normal data manipulation statement. I suspect the problem happens at a higher level — possibly because of the lack of a transaction.