)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"9fb0cbe810882759dca4b64d4f022cfd9426a842","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Add retry_on_deadlock decorator to retry DB operations"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Port retry_on_deadlock decorator from nova"},{"line_number":10,"context_line":"https://review.openstack.org/#/c/22276 . Add this decorator to some"},{"line_number":11,"context_line":" methods in db_base_plugin and ml2 plugin. In this way if a DB deadlock"},{"line_number":12,"context_line":"occurs the operation will be retried."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Fixes-bug: 1338606"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"baada198_e260f302","line":11,"range":{"start_line":10,"start_character":41,"end_line":11,"end_character":42},"updated":"2014-07-07 21:37:33.000000000","message":"can you explain how these methods can deadlock?","commit_id":"4db1867680462d80fec090579052d6689a262793"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"be5e3516ec912d31d4dbd42f7e0ebef68774248a","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Port retry_on_deadlock decorator from nova"},{"line_number":10,"context_line":"https://review.openstack.org/#/c/22276 . Add this decorator to some"},{"line_number":11,"context_line":"methods in db_base_plugin and ml2 plugin, to retry a transaction if it"},{"line_number":12,"context_line":"gets rolled back because of a deadlock. Deadlocks are a classis problem"},{"line_number":13,"context_line":"in relational DB and they are due to the fact that no operation is really"},{"line_number":14,"context_line":"atomic."},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baada198_d478d891","line":12,"range":{"start_line":12,"start_character":56,"end_line":12,"end_character":63},"updated":"2014-07-09 02:57:00.000000000","message":"classic?","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"2c81e4925503e2aae230295cc1dac7a1d3fae6eb","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Port retry_on_deadlock decorator from nova"},{"line_number":10,"context_line":"https://review.openstack.org/#/c/22276 . Add this decorator to some"},{"line_number":11,"context_line":"methods in db_base_plugin and ml2 plugin, to retry a transaction if it"},{"line_number":12,"context_line":"gets rolled back because of a deadlock. Deadlocks are a classis problem"},{"line_number":13,"context_line":"in relational DB and they are due to the fact that no operation is really"},{"line_number":14,"context_line":"atomic."},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baada198_8a2b74ea","line":12,"in_reply_to":"baada198_23ad3c89","updated":"2014-07-10 01:19:05.000000000","message":"i meant, is classis a typo of classic?","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"3907fbba4aeb20f6d378712f1ecc54e882c4f688","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Port retry_on_deadlock decorator from nova"},{"line_number":10,"context_line":"https://review.openstack.org/#/c/22276 . Add this decorator to some"},{"line_number":11,"context_line":"methods in db_base_plugin and ml2 plugin, to retry a transaction if it"},{"line_number":12,"context_line":"gets rolled back because of a deadlock. Deadlocks are a classis problem"},{"line_number":13,"context_line":"in relational DB and they are due to the fact that no operation is really"},{"line_number":14,"context_line":"atomic."},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baada198_bee6a414","line":12,"in_reply_to":"baada198_8a2b74ea","updated":"2014-07-10 14:32:14.000000000","message":"Yes, sorry now I get your comment :)","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"ad3c1126c7ba6adb3aab0b2188be7ad70bec25bc","unresolved":false,"context_lines":[{"line_number":9,"context_line":"Port retry_on_deadlock decorator from nova"},{"line_number":10,"context_line":"https://review.openstack.org/#/c/22276 . Add this decorator to some"},{"line_number":11,"context_line":"methods in db_base_plugin and ml2 plugin, to retry a transaction if it"},{"line_number":12,"context_line":"gets rolled back because of a deadlock. Deadlocks are a classis problem"},{"line_number":13,"context_line":"in relational DB and they are due to the fact that no operation is really"},{"line_number":14,"context_line":"atomic."},{"line_number":15,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baada198_23ad3c89","line":12,"in_reply_to":"baada198_d478d891","updated":"2014-07-09 20:45:35.000000000","message":"quoted from: http://dev.mysql.com/doc/refman/5.0/en/innodb-deadlocks.html","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"be5e3516ec912d31d4dbd42f7e0ebef68774248a","unresolved":false,"context_lines":[{"line_number":11,"context_line":"methods in db_base_plugin and ml2 plugin, to retry a transaction if it"},{"line_number":12,"context_line":"gets rolled back because of a deadlock. Deadlocks are a classis problem"},{"line_number":13,"context_line":"in relational DB and they are due to the fact that no operation is really"},{"line_number":14,"context_line":"atomic."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Fixes-bug: 1338606"},{"line_number":17,"context_line":"Change-Id: Ie155cb2efa67b34f7c1435c243d3f3658bfcd7e3"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baada198_9447404b","line":14,"updated":"2014-07-09 02:57:00.000000000","message":"questions:\n\n- do you mean some dbs raise deadlock errors semi-randomly?  my understanding is that the error happens eg. when two transactions updating rows in a different order.\n- what criteria did you used to choose methods to put the decorator?\n- how do you think about other retry-able errors like serialization failure?","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"2c81e4925503e2aae230295cc1dac7a1d3fae6eb","unresolved":false,"context_lines":[{"line_number":11,"context_line":"methods in db_base_plugin and ml2 plugin, to retry a transaction if it"},{"line_number":12,"context_line":"gets rolled back because of a deadlock. Deadlocks are a classis problem"},{"line_number":13,"context_line":"in relational DB and they are due to the fact that no operation is really"},{"line_number":14,"context_line":"atomic."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Fixes-bug: 1338606"},{"line_number":17,"context_line":"Change-Id: Ie155cb2efa67b34f7c1435c243d3f3658bfcd7e3"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baada198_0a6da432","line":14,"in_reply_to":"baada198_03fd983b","updated":"2014-07-10 01:19:05.000000000","message":"have you observed deadlocks on these operations?\n\nif they involve several transactions, generally you can\u0027t safely retry them, right?\ndo you mean several updates in a transaction?\n\nwe should do either of:\n\n- operation FOO locks A and B in a transaction, operation BAR can lock them in a different order, thus we put the decorator on them and comment the rationale, etc\n\n- put the decorator on all retry-able operations.\n\ni prefer the latter.","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"3907fbba4aeb20f6d378712f1ecc54e882c4f688","unresolved":false,"context_lines":[{"line_number":11,"context_line":"methods in db_base_plugin and ml2 plugin, to retry a transaction if it"},{"line_number":12,"context_line":"gets rolled back because of a deadlock. Deadlocks are a classis problem"},{"line_number":13,"context_line":"in relational DB and they are due to the fact that no operation is really"},{"line_number":14,"context_line":"atomic."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Fixes-bug: 1338606"},{"line_number":17,"context_line":"Change-Id: Ie155cb2efa67b34f7c1435c243d3f3658bfcd7e3"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baada198_fe19fc22","line":14,"in_reply_to":"baada198_0a6da432","updated":"2014-07-10 14:32:14.000000000","message":"Sorry , I didn\u0027t mean transaction but operations. Thanks for catching this!","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"ad3c1126c7ba6adb3aab0b2188be7ad70bec25bc","unresolved":false,"context_lines":[{"line_number":11,"context_line":"methods in db_base_plugin and ml2 plugin, to retry a transaction if it"},{"line_number":12,"context_line":"gets rolled back because of a deadlock. Deadlocks are a classis problem"},{"line_number":13,"context_line":"in relational DB and they are due to the fact that no operation is really"},{"line_number":14,"context_line":"atomic."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Fixes-bug: 1338606"},{"line_number":17,"context_line":"Change-Id: Ie155cb2efa67b34f7c1435c243d3f3658bfcd7e3"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"baada198_03fd983b","line":14,"in_reply_to":"baada198_9447404b","updated":"2014-07-09 20:45:35.000000000","message":"DB deadlock can occur because a single operation might require locks on several rows that can be already locked by another transaction. If you have any suggestions on how improving the commit message, I\u0027d be happy to follow them. Anyway I think an explanation of the deadlock problem in this commit message is a bit out of scope.\nI put the decorator on the methods that are more likely to receive a deadlock error because they involve several transactions.\nOther retry-able errors can be addressed by other patches.","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"}],"neutron/db/api.py":[{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"40f7f2a60221241e49ca69d9c305359cf40d4c54","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    \"\"\"Decorator to retry a DB API call if Deadlock was received.\"\"\""},{"line_number":93,"context_line":"    @functools.wraps(f)"},{"line_number":94,"context_line":"    def wrapped(*args, **kwargs):"},{"line_number":95,"context_line":"        while True:"},{"line_number":96,"context_line":"            try:"},{"line_number":97,"context_line":"                return f(*args, **kwargs)"},{"line_number":98,"context_line":"            except db_exc.DBDeadlock:"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_759442e8","line":95,"updated":"2014-07-17 04:03:04.000000000","message":"There is a potential for an infinite loop here. I would prefer to see a limit, either a maximum number of retries, or a time limit.","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"298bb01888f8ecce39ff9d484a4df2436d97eeb4","unresolved":false,"context_lines":[{"line_number":92,"context_line":"    \"\"\"Decorator to retry a DB API call if Deadlock was received.\"\"\""},{"line_number":93,"context_line":"    @functools.wraps(f)"},{"line_number":94,"context_line":"    def wrapped(*args, **kwargs):"},{"line_number":95,"context_line":"        while True:"},{"line_number":96,"context_line":"            try:"},{"line_number":97,"context_line":"                return f(*args, **kwargs)"},{"line_number":98,"context_line":"            except db_exc.DBDeadlock:"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_2e35bcf6","line":95,"in_reply_to":"baada198_759442e8","updated":"2014-07-25 12:57:24.000000000","message":"Thanks Henry, I agree with all your points, anyway since I \"ported\" the code from nova I haven\u0027t modified it. Regarding the infinite loop there\u0027s already a bug in nova for that https://bugs.launchpad.net/nova/+bug/1268895","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"40f7f2a60221241e49ca69d9c305359cf40d4c54","unresolved":false,"context_lines":[{"line_number":98,"context_line":"            except db_exc.DBDeadlock:"},{"line_number":99,"context_line":"                LOG.warn(_(\"Deadlock detected when running \""},{"line_number":100,"context_line":"                         \"\u0027%(func_name)s\u0027: Retrying...\"),"},{"line_number":101,"context_line":"                         dict(func_name\u003df.__name__))"},{"line_number":102,"context_line":"                # Retry!"},{"line_number":103,"context_line":"                time.sleep(0.5)"},{"line_number":104,"context_line":"    functools.update_wrapper(wrapped, f)"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_473315f6","line":101,"updated":"2014-07-17 04:03:04.000000000","message":"This means a warning will be logged twice per second while there is a deadlock. I would prefer to see a throttle on the log rate.","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"40f7f2a60221241e49ca69d9c305359cf40d4c54","unresolved":false,"context_lines":[{"line_number":100,"context_line":"                         \"\u0027%(func_name)s\u0027: Retrying...\"),"},{"line_number":101,"context_line":"                         dict(func_name\u003df.__name__))"},{"line_number":102,"context_line":"                # Retry!"},{"line_number":103,"context_line":"                time.sleep(0.5)"},{"line_number":104,"context_line":"    functools.update_wrapper(wrapped, f)"},{"line_number":105,"context_line":"    return wrapped"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_352e4aa6","line":103,"updated":"2014-07-17 04:03:04.000000000","message":"How did you decide on this sleep interval time? It may not be appropriate for all deployments, so ideally it should be configurable.","commit_id":"6b55c111ce5f238098241d08cab20ab1c709e239"}],"neutron/db/db_base_plugin_v2.py":[{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"da59108f962c08b9e5d1bd0367eff3dfa204c932","unresolved":false,"context_lines":[{"line_number":68,"context_line":"                         dict(func_name\u003df.__name__))"},{"line_number":69,"context_line":"                # Retry!"},{"line_number":70,"context_line":"                time.sleep(0.5)"},{"line_number":71,"context_line":"                continue"},{"line_number":72,"context_line":"    functools.update_wrapper(wrapped, f)"},{"line_number":73,"context_line":"    return wrapped"},{"line_number":74,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_596b7fb6","line":71,"updated":"2014-07-06 08:53:26.000000000","message":"unnecessary","commit_id":"6011bf9654de3c398f7c4ebc29bfdcbaefdb8ef0"}]}
