[openstack-dev] [all] switch from mysqldb to another eventlet aware mysql client -- status of postgresql drivers?

Mike Bayer mbayer at redhat.com
Mon Jul 14 16:41:26 UTC 2014


On Jul 14, 2014, at 12:29 PM, Chris Friesen <chris.friesen at windriver.com> wrote:

> On 07/09/2014 05:17 AM, Ihar Hrachyshka wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA512
>> 
>> Hi all,
>> 
>> Multiple projects are suffering from db lock timeouts due to deadlocks
>> deep in mysqldb library that we use to interact with mysql servers. In
>> essence, the problem is due to missing eventlet support in mysqldb
>> module, meaning when a db lock is encountered, the library does not
>> yield to the next green thread, allowing other threads to eventually
>> unlock the grabbed lock, and instead it just blocks the main thread,
>> that eventually raises timeout exception (OperationalError).
>> 
>> The failed operation is not retried, leaving failing request not
>> served. In Nova, there is a special retry mechanism for deadlocks,
>> though I think it's more a hack than a proper fix.
> 
> This may be a bit of a tangent to the original discussion, but does anyone know where we stand with postgres and eventlets?  Is pyscopg2 susceptible to the same problems as mysqldb?

if psycopg2 is in use, the set_wait_callback() extension must be enabled.

see http://initd.org/psycopg/docs/extensions.html#psycopg2.extensions.set_wait_callback and https://bitbucket.org/zzzeek/green_sqla/src/2732bb7ea9d06b9d4a61e8cd587a95148ce2599b/green_sqla/psyco_gevent.py?at=default for an example use taken from psycopg2 developers.





More information about the OpenStack-dev mailing list