)]}'
{"neutron/objects/trunk.py":[{"author":{"_account_id":27654,"name":"Hongbin Lu","email":"kira034@163.com","username":"hongbin.lu"},"change_message_id":"a8e50e1ccf32a735ffa5da5ee4e70b57b4b2608e","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                #"},{"line_number":70,"context_line":"                # [1] https://github.com/openstack/oslo.db/blob/3fadd5a"},{"line_number":71,"context_line":"                #     /oslo_db/sqlalchemy/exc_filters.py#L190-L203"},{"line_number":72,"context_line":"                self.obj_context.session.rollback()"},{"line_number":73,"context_line":"                with self.db_context_reader(self.obj_context):"},{"line_number":74,"context_line":"                    if not Trunk.get_object(self.obj_context,"},{"line_number":75,"context_line":"                                            id\u003dself.trunk_id):"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_8de1c2d3","line":72,"range":{"start_line":72,"start_character":16,"end_line":72,"end_character":51},"updated":"2019-07-04 03:17:38.000000000","message":"Do you really need this. It doesn\u0027t seem to rollback any session since the writer session is already finished at this point.","commit_id":"f5e2f3ae23d2dca605fd40cad24e2ca8c27ec696"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"1a966f3a64cd5524c5a0f54257d2885f7d9c6e8e","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                #"},{"line_number":70,"context_line":"                # [1] https://github.com/openstack/oslo.db/blob/3fadd5a"},{"line_number":71,"context_line":"                #     /oslo_db/sqlalchemy/exc_filters.py#L190-L203"},{"line_number":72,"context_line":"                self.obj_context.session.rollback()"},{"line_number":73,"context_line":"                with self.db_context_reader(self.obj_context):"},{"line_number":74,"context_line":"                    if not Trunk.get_object(self.obj_context,"},{"line_number":75,"context_line":"                                            id\u003dself.trunk_id):"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_48088d27","line":72,"range":{"start_line":72,"start_character":16,"end_line":72,"end_character":51},"in_reply_to":"7faddb67_8de1c2d3","updated":"2019-07-04 14:19:40.000000000","message":"The session is closed but not rollbacked. We need to execute this before using the context session again: https://github.com/openstack/neutron/blob/d9e61138ffa458d95137264b6b66a4981deeaf57/neutron/services/portforwarding/pf_plugin.py#L443-L446","commit_id":"f5e2f3ae23d2dca605fd40cad24e2ca8c27ec696"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"7cb00c85f74a6c71aa3fbcd68ab12cf668b6600b","unresolved":false,"context_lines":[{"line_number":66,"context_line":"                #"},{"line_number":67,"context_line":"                # [1] https://github.com/openstack/oslo.db/blob/3fadd5a"},{"line_number":68,"context_line":"                #     /oslo_db/sqlalchemy/exc_filters.py#L190-L203"},{"line_number":69,"context_line":"                self.obj_context.session.rollback()"},{"line_number":70,"context_line":"                with self.db_context_reader(self.obj_context):"},{"line_number":71,"context_line":"                    if not Trunk.get_object(self.obj_context,"},{"line_number":72,"context_line":"                                            id\u003dself.trunk_id):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7faddb67_4ac87a54","line":69,"range":{"start_line":69,"start_character":16,"end_line":69,"end_character":51},"updated":"2019-07-05 08:48:24.000000000","message":"I still don\u0027t understand why this is needed even after comments in patch set 3. Does the writer session affect the reader session?","commit_id":"24acbf941407b52f3721709464cf3ff82c82794a"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"ca4bb3a51cdfc7e2902a148b25b6d27e2a0f5cea","unresolved":false,"context_lines":[{"line_number":66,"context_line":"                #"},{"line_number":67,"context_line":"                # [1] https://github.com/openstack/oslo.db/blob/3fadd5a"},{"line_number":68,"context_line":"                #     /oslo_db/sqlalchemy/exc_filters.py#L190-L203"},{"line_number":69,"context_line":"                self.obj_context.session.rollback()"},{"line_number":70,"context_line":"                with self.db_context_reader(self.obj_context):"},{"line_number":71,"context_line":"                    if not Trunk.get_object(self.obj_context,"},{"line_number":72,"context_line":"                                            id\u003dself.trunk_id):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7faddb67_5374b235","line":69,"range":{"start_line":69,"start_character":16,"end_line":69,"end_character":51},"in_reply_to":"7faddb67_4ac87a54","updated":"2019-07-05 15:28:03.000000000","message":"We usually have one context with a session. This session will start a transaction every time we call the context_writer or reader. This will create several nested transaction calls. Remember a session has only one transaction. If new transaction is needed inside another one, the second one will be nested [1].\n\nIn case of exception, we usually return an exception and end the context (closing the session and finishing the transactions).\n\nIf a transaction raises an exception, it\u0027s not possible to nest another transaction: the first transaction is considered \"DEACTIVE\" and [2] is risen.\n\nThe session will rollback the transactions only when the session context finishes [3]. Because this is not the case (we don\u0027t want to finish this session), we\u0027ll need to force the rollback (which will close and delete the transaction) and open a new one (self.db_context_reader(self.obj_context)).\n\n[1] https://github.com/sqlalchemy/sqlalchemy/blob/28daa34cb887e0f07e9f53e4b9e7596e6df12cd9/lib/sqlalchemy/orm/session.py#L938\n[2] https://github.com/sqlalchemy/sqlalchemy/blob/28daa34cb887e0f07e9f53e4b9e7596e6df12cd9/lib/sqlalchemy/orm/session.py#L289\n[3] https://github.com/sqlalchemy/sqlalchemy/blob/28daa34cb887e0f07e9f53e4b9e7596e6df12cd9/lib/sqlalchemy/orm/session.py#L607","commit_id":"24acbf941407b52f3721709464cf3ff82c82794a"}],"neutron/services/trunk/plugin.py":[{"author":{"_account_id":27654,"name":"Hongbin Lu","email":"kira034@163.com","username":"hongbin.lu"},"change_message_id":"a8e50e1ccf32a735ffa5da5ee4e70b57b4b2608e","unresolved":false,"context_lines":[{"line_number":321,"context_line":"                obj.create()"},{"line_number":322,"context_line":"                trunk[\u0027sub_ports\u0027].append(obj)"},{"line_number":323,"context_line":"                added_subports.append(obj)"},{"line_number":324,"context_line":"                trunk.update_fields({\u0027sub_ports\u0027: [obj]})"},{"line_number":325,"context_line":"                trunk.update()"},{"line_number":326,"context_line":"            payload \u003d callbacks.TrunkPayload(context, trunk_id,"},{"line_number":327,"context_line":"                                             current_trunk\u003dtrunk,"},{"line_number":328,"context_line":"                                             original_trunk\u003doriginal_trunk,"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_8d930250","line":325,"range":{"start_line":324,"start_character":0,"end_line":325,"end_character":30},"updated":"2019-07-04 03:17:38.000000000","message":"Don\u0027t quite get the reason of adding these two lines. Also, line #324 looks contradict with line #322","commit_id":"f5e2f3ae23d2dca605fd40cad24e2ca8c27ec696"},{"author":{"_account_id":16688,"name":"Rodolfo Alonso","email":"ralonsoh@redhat.com","username":"rodolfo-alonso-hernandez"},"change_message_id":"1a966f3a64cd5524c5a0f54257d2885f7d9c6e8e","unresolved":false,"context_lines":[{"line_number":321,"context_line":"                obj.create()"},{"line_number":322,"context_line":"                trunk[\u0027sub_ports\u0027].append(obj)"},{"line_number":323,"context_line":"                added_subports.append(obj)"},{"line_number":324,"context_line":"                trunk.update_fields({\u0027sub_ports\u0027: [obj]})"},{"line_number":325,"context_line":"                trunk.update()"},{"line_number":326,"context_line":"            payload \u003d callbacks.TrunkPayload(context, trunk_id,"},{"line_number":327,"context_line":"                                             current_trunk\u003dtrunk,"},{"line_number":328,"context_line":"                                             original_trunk\u003doriginal_trunk,"}],"source_content_type":"text/x-python","patch_set":3,"id":"7faddb67_2894318b","line":325,"range":{"start_line":324,"start_character":0,"end_line":325,"end_character":30},"in_reply_to":"7faddb67_8d930250","updated":"2019-07-04 14:19:40.000000000","message":"This is a mistake, something I forgot the delete. Thanks!!","commit_id":"f5e2f3ae23d2dca605fd40cad24e2ca8c27ec696"}]}
