)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"81359a08226775ca1122b4495b8b602b9257894a","unresolved":false,"context_lines":[{"line_number":7,"context_line":"[WIP] New engine facade from oslo_db: Step 3"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Implementing reader and writer."},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Change-Id: I0acc303f3ffe1d18f4331911a54bc94f90f07d98"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"bacf61ea_77d865f0","line":10,"updated":"2016-07-27 22:59:57.000000000","message":"Partially implements: Blueprint enginefacade-switch","commit_id":"d58559824146e649b2d3327cc5ee08cf6fd65bef"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"6ee2b11932a2ca3f40c65161f44dcdaf7119a1f1","unresolved":false,"context_lines":[{"line_number":7,"context_line":"[WIP] New engine facade from oslo_db: Step 3"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Implementing reader and writer."},{"line_number":10,"context_line":""},{"line_number":11,"context_line":"Change-Id: I0acc303f3ffe1d18f4331911a54bc94f90f07d98"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"9ad45d7e_a67fbfde","line":10,"updated":"2016-08-11 02:03:55.000000000","message":"Please add:\nPartial Blueprint: enginefacade-switch","commit_id":"da5e2dbf97f986dabce804dabe11e69c2b350099"}],"neutron/db/securitygroups_db.py":[{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"2398e5d60afc596e92315f83d3c266f42dfd9c2d","unresolved":false,"context_lines":[{"line_number":155,"context_line":"        if not default_sg:"},{"line_number":156,"context_line":"            self._ensure_default_security_group(context, tenant_id)"},{"line_number":157,"context_line":""},{"line_number":158,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":159,"context_line":"            security_group_db \u003d SecurityGroup(id\u003ds.get(\u0027id\u0027) or ("},{"line_number":160,"context_line":"                                              uuidutils.generate_uuid()),"},{"line_number":161,"context_line":"                                              description\u003ds[\u0027description\u0027],"}],"source_content_type":"text/x-python","patch_set":2,"id":"dada55a8_80a411a6","side":"PARENT","line":158,"updated":"2016-07-27 00:06:34.000000000","message":"just replace this with:\n\nwith db_api.context_manager.writer.using(context):\n\nThat should be much less invasive than switching to function decorators.","commit_id":"beee72044f6751fd47a86116face039287532247"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"ac418dde33fc8d691b084fe914a56e5cd260893e","unresolved":false,"context_lines":[{"line_number":155,"context_line":"        if not default_sg:"},{"line_number":156,"context_line":"            self._ensure_default_security_group(context, tenant_id)"},{"line_number":157,"context_line":""},{"line_number":158,"context_line":"        with db_api.autonested_transaction(context.session):"},{"line_number":159,"context_line":"            security_group_db \u003d SecurityGroup(id\u003ds.get(\u0027id\u0027) or ("},{"line_number":160,"context_line":"                                              uuidutils.generate_uuid()),"},{"line_number":161,"context_line":"                                              description\u003ds[\u0027description\u0027],"}],"source_content_type":"text/x-python","patch_set":2,"id":"bacf61ea_3e10964e","side":"PARENT","line":158,"in_reply_to":"dada55a8_80a411a6","updated":"2016-07-27 17:54:57.000000000","message":"Done","commit_id":"beee72044f6751fd47a86116face039287532247"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"ac418dde33fc8d691b084fe914a56e5cd260893e","unresolved":false,"context_lines":[{"line_number":273,"context_line":"                              exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"},{"line_number":274,"context_line":"                              **kwargs)"},{"line_number":275,"context_line":""},{"line_number":276,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":277,"context_line":"            self._registry_notify(resources.SECURITY_GROUP,"},{"line_number":278,"context_line":"                                  events.PRECOMMIT_DELETE,"},{"line_number":279,"context_line":"                                  exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"}],"source_content_type":"text/x-python","patch_set":2,"id":"bacf61ea_a32f51a0","side":"PARENT","line":276,"updated":"2016-07-27 17:54:57.000000000","message":"Seems for some situations like this we will still need to use subtransactions or we will have to change logic.","commit_id":"beee72044f6751fd47a86116face039287532247"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"2398e5d60afc596e92315f83d3c266f42dfd9c2d","unresolved":false,"context_lines":[{"line_number":134,"context_line":"                          {\u0027event\u0027: event, \u0027reason\u0027: e})"},{"line_number":135,"context_line":"                raise exc_cls(reason\u003dreason, id\u003did)"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    @db_api.context_manager.writer"},{"line_number":138,"context_line":"    def create_security_group(self, context, security_group, default_sg\u003dFalse):"},{"line_number":139,"context_line":"        \"\"\"Create security group."},{"line_number":140,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"dada55a8_4055f9bf","line":137,"updated":"2016-07-27 00:06:34.000000000","message":"the issue with this will be that now L196 will be called within a transaction when currently it is not. This changes the semantics of the AFTER_CREATE event that it is generated (because it hasn\u0027t actually been created yet).\n\nWe follow the pattern of starting a session, committing, and then doing post commit events quite a bit so I think using a decorator might require a lot of refactoring to maintain the current semantics.\n\nInstead of using the decorator can you use the \u0027using\u0027 context manager they offer:? https://github.com/openstack/oslo.db/blob/a79479088029e4fa51def91cb36bc652356462b6/oslo_db/sqlalchemy/enginefacade.py#L714","commit_id":"c3eae9d0b35678f34b7a6a70f8cf1fdb9283b70e"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"ac418dde33fc8d691b084fe914a56e5cd260893e","unresolved":false,"context_lines":[{"line_number":134,"context_line":"                          {\u0027event\u0027: event, \u0027reason\u0027: e})"},{"line_number":135,"context_line":"                raise exc_cls(reason\u003dreason, id\u003did)"},{"line_number":136,"context_line":""},{"line_number":137,"context_line":"    @db_api.context_manager.writer"},{"line_number":138,"context_line":"    def create_security_group(self, context, security_group, default_sg\u003dFalse):"},{"line_number":139,"context_line":"        \"\"\"Create security group."},{"line_number":140,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"bacf61ea_fd7bab79","line":137,"in_reply_to":"dada55a8_4055f9bf","updated":"2016-07-27 17:54:57.000000000","message":"I think the decorators are still be preferable for some \u0027reader\u0027 situation, like in the next file securitygroups_rpc_base.py So, I\u0027m confused if it is OK to mix this two approaches.","commit_id":"c3eae9d0b35678f34b7a6a70f8cf1fdb9283b70e"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"ba4aa1ccf6d45d39d3820eea301ef16cd228fa91","unresolved":false,"context_lines":[{"line_number":254,"context_line":"            raise ext_sg.SecurityGroupNotFound(id\u003did)"},{"line_number":255,"context_line":"        return sg"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    @db_api.context_manager.writer"},{"line_number":258,"context_line":"    def delete_security_group(self, context, id):"},{"line_number":259,"context_line":"        filters \u003d {\u0027security_group_id\u0027: [id]}"},{"line_number":260,"context_line":"        ports \u003d self._get_port_security_group_bindings(context, filters)"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_ae5451ca","line":257,"updated":"2016-08-02 16:45:34.000000000","message":"Doesn\u0027t this enclose the whole function in a transaction? If so, that changes the semantics of the AFTER_DELETE notification (uncommitted) and we can\u0027t do that.","commit_id":"d58559824146e649b2d3327cc5ee08cf6fd65bef"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"e0d2d67ae72ff99277cfb7476bd49c79a7a96484","unresolved":false,"context_lines":[{"line_number":254,"context_line":"            raise ext_sg.SecurityGroupNotFound(id\u003did)"},{"line_number":255,"context_line":"        return sg"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    @db_api.context_manager.writer"},{"line_number":258,"context_line":"    def delete_security_group(self, context, id):"},{"line_number":259,"context_line":"        filters \u003d {\u0027security_group_id\u0027: [id]}"},{"line_number":260,"context_line":"        ports \u003d self._get_port_security_group_bindings(context, filters)"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_db18fe77","line":257,"updated":"2016-08-04 10:49:00.000000000","message":"Right, I think for this method we need to just swap out the context manager like the others.","commit_id":"d58559824146e649b2d3327cc5ee08cf6fd65bef"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"b03fe90554bceb67adec28595290ef6bb5430ce6","unresolved":false,"context_lines":[{"line_number":254,"context_line":"            raise ext_sg.SecurityGroupNotFound(id\u003did)"},{"line_number":255,"context_line":"        return sg"},{"line_number":256,"context_line":""},{"line_number":257,"context_line":"    @db_api.context_manager.writer"},{"line_number":258,"context_line":"    def delete_security_group(self, context, id):"},{"line_number":259,"context_line":"        filters \u003d {\u0027security_group_id\u0027: [id]}"},{"line_number":260,"context_line":"        ports \u003d self._get_port_security_group_bindings(context, filters)"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_44e131fe","line":257,"in_reply_to":"bacf61ea_ae5451ca","updated":"2016-08-02 18:23:08.000000000","message":"you dont need to use a decorator around a function if you dont want the whole thing in a transaction.  the context manager form can be used anywhere you want interchangeably.","commit_id":"d58559824146e649b2d3327cc5ee08cf6fd65bef"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"64aeffe1da9932e4fb4759801b49e031868a4c3d","unresolved":false,"context_lines":[{"line_number":274,"context_line":"                              exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"},{"line_number":275,"context_line":"                              **kwargs)"},{"line_number":276,"context_line":""},{"line_number":277,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":278,"context_line":"            self._registry_notify(resources.SECURITY_GROUP,"},{"line_number":279,"context_line":"                                  events.PRECOMMIT_DELETE,"},{"line_number":280,"context_line":"                                  exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_77ad0531","line":277,"updated":"2016-07-27 23:02:35.000000000","message":"What about this one?","commit_id":"d58559824146e649b2d3327cc5ee08cf6fd65bef"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"d9966bdea47d62064ffc59ef27688f98fc5b0f3f","unresolved":false,"context_lines":[{"line_number":274,"context_line":"                              exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"},{"line_number":275,"context_line":"                              **kwargs)"},{"line_number":276,"context_line":""},{"line_number":277,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":278,"context_line":"            self._registry_notify(resources.SECURITY_GROUP,"},{"line_number":279,"context_line":"                                  events.PRECOMMIT_DELETE,"},{"line_number":280,"context_line":"                                  exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_07be5efe","line":277,"in_reply_to":"bacf61ea_2cc269e9","updated":"2016-08-01 17:23:11.000000000","message":"if you\u0027re looking for a separate trans distinct from the enclosing one, you\u0027d use \"with db_api.context_manager.independent.writer.using(context) as session:\" - that gives you totally independent session + DB transaction for that block.","commit_id":"d58559824146e649b2d3327cc5ee08cf6fd65bef"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"1dc34a593b929cf8b21d42e54fbdec1c07f637a5","unresolved":false,"context_lines":[{"line_number":274,"context_line":"                              exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"},{"line_number":275,"context_line":"                              **kwargs)"},{"line_number":276,"context_line":""},{"line_number":277,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":278,"context_line":"            self._registry_notify(resources.SECURITY_GROUP,"},{"line_number":279,"context_line":"                                  events.PRECOMMIT_DELETE,"},{"line_number":280,"context_line":"                                  exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_913d9791","line":277,"in_reply_to":"bacf61ea_77ad0531","updated":"2016-07-31 15:16:32.000000000","message":"We can\u0027t change here for \"with db_api.context_manager.writer.using(context)\" as this will change the logic and as we will have two different session where we get sg (line 264) and here where we try to delete. The variant here is to set \"with db_api.context_manager.writer.using(context)\" before getting sg, but at this moment I just add a decorator for writing session on the method.","commit_id":"d58559824146e649b2d3327cc5ee08cf6fd65bef"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"e7b5a178ff0cbe9989cd0e120adb7f710ba7a795","unresolved":false,"context_lines":[{"line_number":274,"context_line":"                              exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"},{"line_number":275,"context_line":"                              **kwargs)"},{"line_number":276,"context_line":""},{"line_number":277,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":278,"context_line":"            self._registry_notify(resources.SECURITY_GROUP,"},{"line_number":279,"context_line":"                                  events.PRECOMMIT_DELETE,"},{"line_number":280,"context_line":"                                  exc_cls\u003dext_sg.SecurityGroupInUse, id\u003did,"}],"source_content_type":"text/x-python","patch_set":3,"id":"bacf61ea_2cc269e9","line":277,"in_reply_to":"bacf61ea_913d9791","updated":"2016-08-01 17:16:15.000000000","message":"what does a begin of a subtransaction here accomplish?  begin(subtransactions\u003dTrue) pretty much means \"code within wants to call commit() or rollback() but I\u0027m wrapping it, so make sure I acutually control that\".  when using enginefacade the concept of a \"subtransaction\" is completely reimplemented using the decorators and/or context managers.","commit_id":"d58559824146e649b2d3327cc5ee08cf6fd65bef"}]}
