barbican/barbican
Dave McCowan 71829664b2 Fix Race Condition in get_or_create_project()
get_or_create_project() first calls a get (query of the database).
If that fails, then it calls create.  The issues is when
there are two threads and both fail the original get, then
each will call create.  One of those creates will fail, resulting
in the traceback.

One way to protect this critical region is to call create first,
then if that fails, call get.

In this case, get_or_create_project() is called for every
Barbican API operation.  The create action (which is slow), happens
once per project for the life of the cloud.  The get action happens
every other time.  For performance gains, I left call get first,
since that call succeeds almost always.

Change-Id: I2f13b495a6b45e226e0742291f76ee88dbcf52df
Closes-bug: #1726203
2017-10-22 22:19:26 -04:00
..
api Merge "Pick up general URI when constructing barbican endpoint" 2017-09-22 02:55:55 +00:00
cmd Stop using deprecated 'message' attribute in Exception 2017-07-26 05:30:17 +00:00
common Fix Race Condition in get_or_create_project() 2017-10-22 22:19:26 -04:00
hacking Remove log translation related check 2017-03-30 09:25:20 +08:00
locale/zh_CN/LC_MESSAGES Imported Translations from Zanata 2017-08-23 09:52:44 +00:00
model Merge "Replaces uuid.uuid4 with uuidutils.generate_uuid()" 2017-07-14 19:23:36 +00:00
plugin Merge "Use PortOpt for port options" 2017-09-14 08:04:59 +00:00
queue Merge "Use get_rpc_transport instead of get_transport" 2017-06-08 06:58:51 +00:00
tasks Remove translation of log messages 2017-06-03 10:18:55 +07:00
tests Merge "Pick up general URI when constructing barbican endpoint" 2017-09-22 02:55:55 +00:00
__init__.py Files with no code must be left completely empty 2016-11-17 14:19:47 +08:00
context.py Don't inspect oslo.context 2016-09-13 10:49:20 +10:00
i18n.py Remove translation logging prefixes from i18n 2017-06-08 03:13:19 +00:00
version.py Enable tag-based full version reporting via pbr 2014-01-22 18:01:30 -06:00