[openstack-dev] [all] [oslo] Proposed database connectivity patterns

Ihar Hrachyshka ihrachys at redhat.com
Fri Oct 10 10:13:51 UTC 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 09/10/14 21:29, Mike Bayer wrote:
> So so far, everyone seems really positive and psyched about the
> proposal.
> 
> It looks like providing some options for how to use would be best,
> that is provide decorators and context managers.
> 
> Now the thing with the context manager, it can be as I stated:
> 
> with sql.reader() as session:
> 
> or we can even have that accept the “context”:
> 
> with sql.reader(context) as session:
> 
> The latter again avoids having to use thread locals.
> 
> But can I get a feel for how comfortable we are with using thread
> local storage to implement this feature?   I had anticipated people
> wouldn’t like it because it’s kind of a “global” object, even
> though it will be hidden behind this facade (of course CONF is
> global as is sys.modules, and I think it is fine).     If I just
> use a tlocal, this whole thing is pretty simple.

Won't the approach conflict with eventlet consumers that for some
reason do not patch thread module, or do not patch it early enough? I
guess in that case we may end up with mixed contexts.

/Ihar
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.22 (Darwin)

iQEcBAEBCgAGBQJUN7FeAAoJEC5aWaUY1u57sq0IANSM8gKCQZbgEY62uvyhZqzN
9gRDcFbTrH/yUNMv0tt3+e2vVEbn8VIatDWG4/OYghzuI1BerKzhP7JD5J+mV8yK
sB0fc6ybHmz14T962LhFkAxWKybPW3sJO/0GIy606ty0OEV8QAgPwaYvjW596MUa
BAp0IRAz4/MglT/M80OkT2jFdMV+a9SAFUKvnF/21KSGo/t4qcawA/+B0c3Ownle
eYt+Auk3hcgJnZAvCOwy7bcAb1b12gonk4nIwMl/Mik8IKNR5fnl1IqTiISUO2Jw
PV95/7muukSrt54lY+9u4SW9o/Zf/gaNCMmK3xfDmvMug6tk0SWzkzBZLva3wNc=
=04Wx
-----END PGP SIGNATURE-----



More information about the OpenStack-dev mailing list