)]}'
{"neutron/db/l3_db.py":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"2d9d8f36cbea19a9bcb62a7476a757494d374cd8","unresolved":false,"context_lines":[{"line_number":610,"context_line":"        # case where a port might get attached to a router without the"},{"line_number":611,"context_line":"        # owner successfully updating due to an unavailable backend."},{"line_number":612,"context_line":"        self._check_router_port(context, port_id, \u0027\u0027)"},{"line_number":613,"context_line":"        self._core_plugin.update_port("},{"line_number":614,"context_line":"            context, port_id, {\u0027port\u0027: {\u0027device_id\u0027: router.id,"},{"line_number":615,"context_line":"                                        \u0027device_owner\u0027: owner}})"},{"line_number":616,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_36135e68","side":"PARENT","line":613,"range":{"start_line":613,"start_character":13,"end_line":613,"end_character":25},"updated":"2016-05-30 04:26:37.000000000","message":"I think the best way is to make this as part of the transaction.","commit_id":"9e7298a75b32da1b3c87cfffba8319286500ad83"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"00af9a856d02606a2e0b7ef8a2aa01185be64186","unresolved":false,"context_lines":[{"line_number":610,"context_line":"        # case where a port might get attached to a router without the"},{"line_number":611,"context_line":"        # owner successfully updating due to an unavailable backend."},{"line_number":612,"context_line":"        self._check_router_port(context, port_id, \u0027\u0027)"},{"line_number":613,"context_line":"        self._core_plugin.update_port("},{"line_number":614,"context_line":"            context, port_id, {\u0027port\u0027: {\u0027device_id\u0027: router.id,"},{"line_number":615,"context_line":"                                        \u0027device_owner\u0027: owner}})"},{"line_number":616,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_10ea9d0f","side":"PARENT","line":613,"range":{"start_line":613,"start_character":13,"end_line":613,"end_character":25},"in_reply_to":"9abb7d3a_36135e68","updated":"2016-05-30 06:33:48.000000000","message":"Hi, gongysh, thank you. This patch [1] introduced this change, as its commit message said \"Thus L2 plugin/ML2 mechanism driver will be confused when interface is attached to router by port because port owner is different. Use L2 plugin update_port method to update port:owner.\" do we really need to revert it?\nAnd after a quick code searching, there are some code same as this line, but none of those is under a transaction. Because the update_port already have a \"with context.session.begin(subtransactions\u003dTrue):\", and this line is the only place to update the `port` in the router_add_interface procedure. So, IMO, this line of code is enough.\n\n[1] https://review.openstack.org/#/c/202357/12/neutron/db/l3_db.py","commit_id":"9e7298a75b32da1b3c87cfffba8319286500ad83"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"00af9a856d02606a2e0b7ef8a2aa01185be64186","unresolved":false,"context_lines":[{"line_number":605,"context_line":"            raise n_exc.BadRequest(resource\u003d\u0027router\u0027, msg\u003dmsg)"},{"line_number":606,"context_line":"        return port"},{"line_number":607,"context_line":""},{"line_number":608,"context_line":"    def _check_and_get_router_new_interface_subnets(self, context,"},{"line_number":609,"context_line":"                                                    router, port):"},{"line_number":610,"context_line":"        # Only allow one router port with IPv6 subnets per network id"},{"line_number":611,"context_line":"        if self._port_has_ipv6_address(port):"},{"line_number":612,"context_line":"            for existing_port in (rp.port for rp in router.attached_ports):"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_90cfad7e","line":609,"range":{"start_line":608,"start_character":0,"end_line":609,"end_character":66},"updated":"2016-05-30 06:33:48.000000000","message":"For this function, there is no object updating procedure, so I don\u0027t think this need a transaction either.","commit_id":"d7812b0668533734c68bc703065e63dadd9fab49"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"00af9a856d02606a2e0b7ef8a2aa01185be64186","unresolved":false,"context_lines":[{"line_number":655,"context_line":"            context, port_id, {\u0027port\u0027: {\u0027device_id\u0027: router.id,"},{"line_number":656,"context_line":"                                        \u0027device_owner\u0027: owner}})"},{"line_number":657,"context_line":""},{"line_number":658,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":659,"context_line":"            # check again within transaction to mitigate race"},{"line_number":660,"context_line":"            port \u003d self._check_router_port(context, port_id, router.id)"},{"line_number":661,"context_line":"            return port, subnets"},{"line_number":662,"context_line":""},{"line_number":663,"context_line":"    def _port_has_ipv6_address(self, port):"}],"source_content_type":"text/x-python","patch_set":2,"id":"9abb7d3a_b0c4715f","line":660,"range":{"start_line":658,"start_character":7,"end_line":660,"end_character":71},"updated":"2016-05-30 06:33:48.000000000","message":"Maybe these code can be removed.","commit_id":"d7812b0668533734c68bc703065e63dadd9fab49"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"41d28697571e64d8b8d58f0d2c4677766b7910ad","unresolved":false,"context_lines":[{"line_number":641,"context_line":"        return subnets"},{"line_number":642,"context_line":""},{"line_number":643,"context_line":"    def _add_interface_by_port(self, context, router, port_id, owner):"},{"line_number":644,"context_line":"        # Check port to mitigate race"},{"line_number":645,"context_line":"        port \u003d self._check_router_port(context, port_id, \u0027\u0027)"},{"line_number":646,"context_line":"        # Check if there has overlaps first."},{"line_number":647,"context_line":"        subnets \u003d self._check_and_get_router_new_interface_subnets("}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_0c827400","line":644,"updated":"2016-06-03 14:23:47.000000000","message":"Should this all be in a transaction now?  I\u0027m just worried you\u0027re going to introduce another race","commit_id":"b587a8e4f25621078a504f5e2278cddac863f132"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"38420e424feffff1508b89c673866f72839a7187","unresolved":false,"context_lines":[{"line_number":641,"context_line":"        return subnets"},{"line_number":642,"context_line":""},{"line_number":643,"context_line":"    def _add_interface_by_port(self, context, router, port_id, owner):"},{"line_number":644,"context_line":"        # Check port to mitigate race"},{"line_number":645,"context_line":"        port \u003d self._check_router_port(context, port_id, \u0027\u0027)"},{"line_number":646,"context_line":"        # Check if there has overlaps first."},{"line_number":647,"context_line":"        subnets \u003d self._check_and_get_router_new_interface_subnets("}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_c66de805","line":644,"in_reply_to":"9abb7d3a_0c827400","updated":"2016-06-03 15:12:47.000000000","message":"For line 645 and line 646 there is no code to update a db object. I don\u0027t think here needs a transaction. And for the update_port method, it has a transaction inside.","commit_id":"b587a8e4f25621078a504f5e2278cddac863f132"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"41d28697571e64d8b8d58f0d2c4677766b7910ad","unresolved":false,"context_lines":[{"line_number":650,"context_line":"        # Update owner before actual process in order to avoid the"},{"line_number":651,"context_line":"        # case where a port might get attached to a router without the"},{"line_number":652,"context_line":"        # owner successfully updating due to an unavailable backend."},{"line_number":653,"context_line":"        self._check_router_port(context, port_id, \u0027\u0027)"},{"line_number":654,"context_line":"        self._core_plugin.update_port("},{"line_number":655,"context_line":"            context, port_id, {\u0027port\u0027: {\u0027device_id\u0027: router.id,"},{"line_number":656,"context_line":"                                        \u0027device_owner\u0027: owner}})"}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_960313b8","line":653,"updated":"2016-06-03 14:23:47.000000000","message":"You don\u0027t need this and L645","commit_id":"b587a8e4f25621078a504f5e2278cddac863f132"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"38420e424feffff1508b89c673866f72839a7187","unresolved":false,"context_lines":[{"line_number":650,"context_line":"        # Update owner before actual process in order to avoid the"},{"line_number":651,"context_line":"        # case where a port might get attached to a router without the"},{"line_number":652,"context_line":"        # owner successfully updating due to an unavailable backend."},{"line_number":653,"context_line":"        self._check_router_port(context, port_id, \u0027\u0027)"},{"line_number":654,"context_line":"        self._core_plugin.update_port("},{"line_number":655,"context_line":"            context, port_id, {\u0027port\u0027: {\u0027device_id\u0027: router.id,"},{"line_number":656,"context_line":"                                        \u0027device_owner\u0027: owner}})"}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_4659f859","line":653,"in_reply_to":"9abb7d3a_960313b8","updated":"2016-06-03 15:12:47.000000000","message":"This line is needed in oder to reduce the race between two port updating thread for one same port.","commit_id":"b587a8e4f25621078a504f5e2278cddac863f132"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"41d28697571e64d8b8d58f0d2c4677766b7910ad","unresolved":false,"context_lines":[{"line_number":655,"context_line":"            context, port_id, {\u0027port\u0027: {\u0027device_id\u0027: router.id,"},{"line_number":656,"context_line":"                                        \u0027device_owner\u0027: owner}})"},{"line_number":657,"context_line":""},{"line_number":658,"context_line":"        # check again within transaction to mitigate race"},{"line_number":659,"context_line":"        port \u003d self._check_router_port(context, port_id, router.id)"},{"line_number":660,"context_line":"        return port, subnets"},{"line_number":661,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_cc36acb3","line":658,"updated":"2016-06-03 14:23:47.000000000","message":"You removed the transaction code","commit_id":"b587a8e4f25621078a504f5e2278cddac863f132"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"38420e424feffff1508b89c673866f72839a7187","unresolved":false,"context_lines":[{"line_number":655,"context_line":"            context, port_id, {\u0027port\u0027: {\u0027device_id\u0027: router.id,"},{"line_number":656,"context_line":"                                        \u0027device_owner\u0027: owner}})"},{"line_number":657,"context_line":""},{"line_number":658,"context_line":"        # check again within transaction to mitigate race"},{"line_number":659,"context_line":"        port \u003d self._check_router_port(context, port_id, router.id)"},{"line_number":660,"context_line":"        return port, subnets"},{"line_number":661,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_e6074c1b","line":658,"in_reply_to":"9abb7d3a_cc36acb3","updated":"2016-06-03 15:12:47.000000000","message":"Yes, I removed the transaction since patch set 3, because here only has one port check line.","commit_id":"b587a8e4f25621078a504f5e2278cddac863f132"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"41d28697571e64d8b8d58f0d2c4677766b7910ad","unresolved":false,"context_lines":[{"line_number":656,"context_line":"                                        \u0027device_owner\u0027: owner}})"},{"line_number":657,"context_line":""},{"line_number":658,"context_line":"        # check again within transaction to mitigate race"},{"line_number":659,"context_line":"        port \u003d self._check_router_port(context, port_id, router.id)"},{"line_number":660,"context_line":"        return port, subnets"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    def _port_has_ipv6_address(self, port):"}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_f12269a2","line":659,"updated":"2016-06-03 14:23:47.000000000","message":"nit: you don\u0027t need to assign port again, done on L645","commit_id":"b587a8e4f25621078a504f5e2278cddac863f132"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"38420e424feffff1508b89c673866f72839a7187","unresolved":false,"context_lines":[{"line_number":656,"context_line":"                                        \u0027device_owner\u0027: owner}})"},{"line_number":657,"context_line":""},{"line_number":658,"context_line":"        # check again within transaction to mitigate race"},{"line_number":659,"context_line":"        port \u003d self._check_router_port(context, port_id, router.id)"},{"line_number":660,"context_line":"        return port, subnets"},{"line_number":661,"context_line":""},{"line_number":662,"context_line":"    def _port_has_ipv6_address(self, port):"}],"source_content_type":"text/x-python","patch_set":3,"id":"9abb7d3a_094c2141","line":659,"in_reply_to":"9abb7d3a_f12269a2","updated":"2016-06-03 15:12:47.000000000","message":"Yes, this line looks wired. But this line may also reduce the race between two port updating threads.","commit_id":"b587a8e4f25621078a504f5e2278cddac863f132"}]}
