)]}'
{"networking_odl/journal/journal.py":[{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"eac2de7d59ba33b33508e9bb97641dcafb0020ce","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        data \u003d _enrich_port("},{"line_number":86,"context_line":"            plugin_context, ml2_context, object_type, operation, data)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    # Calculate dependencies on other journal entries"},{"line_number":89,"context_line":"    dependencies \u003d dependency_validations.calculate("},{"line_number":90,"context_line":"        plugin_context.session, operation, object_type, object_uuid, data)"},{"line_number":91,"context_line":"    db.create_pending_row(plugin_context.session, object_type, object_uuid,"},{"line_number":92,"context_line":"                          operation, data, dependencies\u003ddependencies)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"class OpendaylightJournalThread(object):"}],"source_content_type":"text/x-python","patch_set":2,"id":"bff0334d_db468450","line":92,"range":{"start_line":88,"start_character":0,"end_line":92,"end_character":69},"updated":"2017-04-05 16:43:26.000000000","message":"There is a race condition.\nWhat if two neutron servers(or threads) try to insert dependent rows?\ne.g. update on same resource.","commit_id":"55c6958353c6eea6eb21cd65030cd896528f8a0b"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"1193901f03510e49073598c0991bc0a4c29bb4ab","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            plugin_context, ml2_context, object_type, operation, data)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    # Calculate depending_on on other journal entries"},{"line_number":89,"context_line":"    depending_on \u003d dependency_validations.calculate("},{"line_number":90,"context_line":"        plugin_context.session, operation, object_type, object_uuid, data)"},{"line_number":91,"context_line":"    db.create_pending_row(plugin_context.session, object_type, object_uuid,"},{"line_number":92,"context_line":"                          operation, data, depending_on\u003ddepending_on)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"class OpendaylightJournalThread(object):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7ffa3b31_e682994f","line":92,"range":{"start_line":89,"start_character":0,"end_line":92,"end_character":69},"updated":"2017-04-17 17:57:14.000000000","message":"This is racy because transaction isolation level is repeatable read. Not serialisable.","commit_id":"a31efa8ed13da262ee8728a55554dda139da4a89"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"dc546c26542c6c9ad21f648361624a385dd0ea3c","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            plugin_context, ml2_context, object_type, operation, data)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    # Calculate depending_on on other journal entries"},{"line_number":89,"context_line":"    depending_on \u003d dependency_validations.calculate("},{"line_number":90,"context_line":"        plugin_context.session, operation, object_type, object_uuid, data)"},{"line_number":91,"context_line":"    db.create_pending_row(plugin_context.session, object_type, object_uuid,"},{"line_number":92,"context_line":"                          operation, data, depending_on\u003ddepending_on)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"class OpendaylightJournalThread(object):"}],"source_content_type":"text/x-python","patch_set":9,"id":"5ff73747_e6e2f9d4","line":92,"range":{"start_line":89,"start_character":0,"end_line":92,"end_character":69},"in_reply_to":"5ff73747_9531bca5","updated":"2017-04-30 18:38:56.000000000","message":"YAMAMOTO you\u0027re absolutely correct I didn\u0027t take row level lock into account.\n\nGiven that there\u0027s no race introduced no matter where you calculate the dependencies.\n\nTo explain consider Isaku\u0027s original scenario with transaction isolation level default of \"REPEATABLE READ\":\nThread 1 updates port in transaction T1\nThread 2 updates port in transaction T2\n\nNow if they both happen on the same node, then T2 locks up until T1 commits at which point the journal entry exists and is readable by dependency calculation in T2.\nIf they happen on different nodes simultaneously then then both will execute (each on a different copy of the DB), the winning transaction will commit and the other will fail with a DBDeadlock and have to retry at which point the journal entry of the winning transaction already exists.\n\nSo there is no way for ODL to get out of sync in this scenario.","commit_id":"a31efa8ed13da262ee8728a55554dda139da4a89"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"d439dc5104b2e94e33b7d58e0291f08fd06beb28","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            plugin_context, ml2_context, object_type, operation, data)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    # Calculate depending_on on other journal entries"},{"line_number":89,"context_line":"    depending_on \u003d dependency_validations.calculate("},{"line_number":90,"context_line":"        plugin_context.session, operation, object_type, object_uuid, data)"},{"line_number":91,"context_line":"    db.create_pending_row(plugin_context.session, object_type, object_uuid,"},{"line_number":92,"context_line":"                          operation, data, depending_on\u003ddepending_on)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"class OpendaylightJournalThread(object):"}],"source_content_type":"text/x-python","patch_set":9,"id":"5ff73747_9531bca5","line":92,"range":{"start_line":89,"start_character":0,"end_line":92,"end_character":69},"in_reply_to":"5ff73747_fffff231","updated":"2017-04-25 11:23:40.000000000","message":"Mike,\n\ni\u0027m not sure i understand the race you described.  can you elaborate a bit?\nif two workers update the same resource, usually they update the same db row, and the \"2nd update\" of the row will be blocked by the row-level lock until the \"1st update\"\u0027s transaction is done, either commit or rollback.","commit_id":"a31efa8ed13da262ee8728a55554dda139da4a89"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"4a33833ed68b5671ca04076de03bda25365e51a0","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            plugin_context, ml2_context, object_type, operation, data)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    # Calculate depending_on on other journal entries"},{"line_number":89,"context_line":"    depending_on \u003d dependency_validations.calculate("},{"line_number":90,"context_line":"        plugin_context.session, operation, object_type, object_uuid, data)"},{"line_number":91,"context_line":"    db.create_pending_row(plugin_context.session, object_type, object_uuid,"},{"line_number":92,"context_line":"                          operation, data, depending_on\u003ddepending_on)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"class OpendaylightJournalThread(object):"}],"source_content_type":"text/x-python","patch_set":9,"id":"5ff73747_fffff231","line":92,"range":{"start_line":89,"start_character":0,"end_line":92,"end_character":69},"in_reply_to":"7ffa3b31_771ccb11","updated":"2017-04-23 13:07:18.000000000","message":"No need to lock the table.\n\nAs I explained there theoretically could be a race anyway even in today\u0027s code before this change:\n\nLet\u0027s assume 2 different update to the same resource such as port from 2 different API calls:\n1st update gets handled by neutron DB\n2nd update gets handled by neutron DB \u003c- this update won\n2nd update gets a journal entry X created\n1st update gets a journal entry Y created\n\nNow when the journal thread will process the entries, the Y entry will get sent last as it was created later in the chain of events so it got a bigger seqnum.\n\nSo, we have a discrepancy between Neutron DB and ODL.\n\nThe proposed change doesn\u0027t address this issue nor does it make it worse, whatever entry gets processed last will still win as before.\n\nIf you wish to fix this problem we need to devise an entirely different approach which isn\u0027t tied to this change and can work with either the old way or the proposed way, but is unrelated.\n\nIf you have a different scenario that you had in mind and not the one mentioned above please elaborate and we can think about that.","commit_id":"a31efa8ed13da262ee8728a55554dda139da4a89"},{"author":{"_account_id":7921,"name":"Mike Kolesnik","email":"mkolesni@redhat.com","username":"mkolesni"},"change_message_id":"65bc86c431ee76702a792917795168f7e34ae4c4","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            plugin_context, ml2_context, object_type, operation, data)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    # Calculate depending_on on other journal entries"},{"line_number":89,"context_line":"    depending_on \u003d dependency_validations.calculate("},{"line_number":90,"context_line":"        plugin_context.session, operation, object_type, object_uuid, data)"},{"line_number":91,"context_line":"    db.create_pending_row(plugin_context.session, object_type, object_uuid,"},{"line_number":92,"context_line":"                          operation, data, depending_on\u003ddepending_on)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"class OpendaylightJournalThread(object):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7ffa3b31_f83ea327","line":92,"range":{"start_line":89,"start_character":0,"end_line":92,"end_character":69},"in_reply_to":"7ffa3b31_e682994f","updated":"2017-04-18 11:55:57.000000000","message":"There is generally a race possibility when you record two journal entries as either one can get the lower seqnum so either one recorded at the same time can have \"won\" the race and have a potential to be dependent on by the other.\n\nThis change does not solve this inherent race.\n\nAlso I\u0027m not sure why you mention \"repeatable read\" as a problematic isolation level, as opposed to \"serializable\". If anything serializable is the stricter one which could cause less data to be read.","commit_id":"a31efa8ed13da262ee8728a55554dda139da4a89"},{"author":{"_account_id":333,"name":"Isaku Yamahata","email":"isaku.yamahata@gmail.com","username":"yamahata"},"change_message_id":"8b400996aa4093a85c9ea4090c25c6e4a950a588","unresolved":false,"context_lines":[{"line_number":86,"context_line":"            plugin_context, ml2_context, object_type, operation, data)"},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"    # Calculate depending_on on other journal entries"},{"line_number":89,"context_line":"    depending_on \u003d dependency_validations.calculate("},{"line_number":90,"context_line":"        plugin_context.session, operation, object_type, object_uuid, data)"},{"line_number":91,"context_line":"    db.create_pending_row(plugin_context.session, object_type, object_uuid,"},{"line_number":92,"context_line":"                          operation, data, depending_on\u003ddepending_on)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":""},{"line_number":95,"context_line":"class OpendaylightJournalThread(object):"}],"source_content_type":"text/x-python","patch_set":9,"id":"7ffa3b31_771ccb11","line":92,"range":{"start_line":89,"start_character":0,"end_line":92,"end_character":69},"in_reply_to":"7ffa3b31_f83ea327","updated":"2017-04-18 23:59:02.000000000","message":"The dependency calculation after committing entry, the order \n in the journal table is already determined. So there is  no race condition.\n\nNow you\u0027re trying to calculate the dependency during comiting the journal entry. It\u0027s racy. You\u0027re introducing new race. If you\u0027d like to do so, for example the table needs to be locked to enforce the order. It would have huge performance impact.","commit_id":"a31efa8ed13da262ee8728a55554dda139da4a89"}]}
