<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
*You are 100% correct that setting the transaction isolation level to READ COMMITTED works in the retry loop*.<br>
<br>
I stand corrected, and humbled :) Please accept my apologies.<br></blockquote><div>Thanks for letting me know :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
One thing I did note, though, is that changing the isolation level of an *already-started transaction* does not change the current transaction's isolation level -- the new isolation level only takes effect once the previously started transaction is committed or rolled back. So, on line 107 in your proposed patch here:<br>
<br>
<a href="https://review.openstack.org/#/c/129288/5/neutron/plugins/ml2/drivers/helpers.py" target="_blank">https://review.openstack.org/#<u></u>/c/129288/5/neutron/plugins/<u></u>ml2/drivers/helpers.py</a><br>
<br>
>From what I could find out in my research, the setting of the isolation level needs to be done *outside* of the session.begin() call, otherwise the isolation level will not take effect until that transaction is committed or rolled back.</blockquote><div> </div><div>You're right. Apparently I've misread sqlalchemy docs at some point. Now I see I've understood them incorrectly.</div><div>Also, from some sqlalchemy code inspection I thought that default engine isolation level is restored after current transaction is committed, but it's not so as well.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Of course, if SQLAlchemy is doing some auto-commit or something in the session, then you may not see this affect, but I certainly was able to see this in my testing in mysql client sessions... so I'm a little perplexed as to how your code works on already-started transactions. The documentation on the MySQL site backs up what I observed:<br>
<br>
<a href="http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html" target="_blank">http://dev.mysql.com/doc/<u></u>refman/5.0/en/set-transaction.<u></u>html</a><br>
<br>
"...the statement sets the default transaction level for all subsequent transactions performed within the current session."<br></blockquote><div> </div><div>That basically means that my patch effectively changes isolation level of every connection that happens to be used for the session.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
All the best, and thanks for the informative lesson of the week!<br></blockquote><div><br></div><div>Thank you for getting to the very bottom of it! :)</div><div> </div><div>Eugene.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
-jay<span class=""><br>
<br></span></blockquote></div></div></div>