)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"013503377c5019cdae7ecd9ead19dccd476232fc","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     John Schwarz \u003cjschwarz@redhat.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-10-05 11:17:01 +0300"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"scheduler: add retry indicators for bind_router()"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change I3447ea5bcb7c57365c6f50efe12a1671e86588b3 added a binding_index"},{"line_number":10,"context_line":"to the RouterL3AgentBinding table. In certain (concurrent) cases, a row"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"1a95cdbc_593b8bd1","line":7,"updated":"2016-10-05 16:13:30.000000000","message":"nit: L3 scheduler","commit_id":"9dae3e091d59d1b691f9d4a9247167cb49fc838f"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"4cc5a95b7fe7db82c7538c07df958bb71d934bb3","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     John Schwarz \u003cjschwarz@redhat.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-10-05 11:17:01 +0300"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"scheduler: add retry indicators for bind_router()"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Change I3447ea5bcb7c57365c6f50efe12a1671e86588b3 added a binding_index"},{"line_number":10,"context_line":"to the RouterL3AgentBinding table. In certain (concurrent) cases, a row"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"fa6399be_840f2a87","line":7,"in_reply_to":"1a95cdbc_593b8bd1","updated":"2016-10-13 11:06:29.000000000","message":"Done","commit_id":"9dae3e091d59d1b691f9d4a9247167cb49fc838f"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"013503377c5019cdae7ecd9ead19dccd476232fc","unresolved":false,"context_lines":[{"line_number":12,"context_line":"DBDuplicateEntry. However, that change didn\u0027t retry on this case at all"},{"line_number":13,"context_line":"code-paths, so this patch rectifies this issue."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I228b0084a8e7c48e78bc2ea6a3fccf7437210e73"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"1a95cdbc_395b1f30","line":15,"updated":"2016-10-05 16:13:30.000000000","message":"Is there a bug?","commit_id":"9dae3e091d59d1b691f9d4a9247167cb49fc838f"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"4cc5a95b7fe7db82c7538c07df958bb71d934bb3","unresolved":false,"context_lines":[{"line_number":12,"context_line":"DBDuplicateEntry. However, that change didn\u0027t retry on this case at all"},{"line_number":13,"context_line":"code-paths, so this patch rectifies this issue."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: I228b0084a8e7c48e78bc2ea6a3fccf7437210e73"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"fa6399be_64e696b1","line":15,"in_reply_to":"1a95cdbc_395b1f30","updated":"2016-10-13 11:06:29.000000000","message":"Done","commit_id":"9dae3e091d59d1b691f9d4a9247167cb49fc838f"}],"neutron/db/l3_agentschedulers_db.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d3ff13ec7f473c19b0c98b8a2c1cf4637d4eee25","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        router_id \u003d router[\u0027id\u0027]"},{"line_number":184,"context_line":"        agent_id \u003d agent[\u0027id\u0027]"},{"line_number":185,"context_line":"        if self.router_scheduler:"},{"line_number":186,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("},{"line_number":187,"context_line":"                service_constants.L3_ROUTER_NAT)"},{"line_number":188,"context_line":"            try:"},{"line_number":189,"context_line":"                if router.get(\u0027ha\u0027):"}],"source_content_type":"text/x-python","patch_set":13,"id":"ba5da102_38770ca1","line":186,"updated":"2016-11-03 12:03:28.000000000","message":"any reason why we aren\u0027t doing this in init? (unrelated to this change)","commit_id":"5e38ad26a2e857fcbf1e6f97778914a315c15c4c"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"562685fdd69d89331fdc6698435358d56796c40b","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        router_id \u003d router[\u0027id\u0027]"},{"line_number":184,"context_line":"        agent_id \u003d agent[\u0027id\u0027]"},{"line_number":185,"context_line":"        if self.router_scheduler:"},{"line_number":186,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("},{"line_number":187,"context_line":"                service_constants.L3_ROUTER_NAT)"},{"line_number":188,"context_line":"            try:"},{"line_number":189,"context_line":"                if router.get(\u0027ha\u0027):"}],"source_content_type":"text/x-python","patch_set":13,"id":"ba5da102_78b3440a","line":186,"in_reply_to":"ba5da102_38770ca1","updated":"2016-11-03 12:26:04.000000000","message":"I\u0027m not aware of a reason. We can do this on a followup though.","commit_id":"5e38ad26a2e857fcbf1e6f97778914a315c15c4c"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8af6666c85418083b571e1a12bf97fee7130fd07","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        router_id \u003d router[\u0027id\u0027]"},{"line_number":184,"context_line":"        agent_id \u003d agent[\u0027id\u0027]"},{"line_number":185,"context_line":"        if self.router_scheduler:"},{"line_number":186,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("},{"line_number":187,"context_line":"                service_constants.L3_ROUTER_NAT)"},{"line_number":188,"context_line":"            try:"},{"line_number":189,"context_line":"                if router.get(\u0027ha\u0027):"}],"source_content_type":"text/x-python","patch_set":14,"id":"9a629dbe_b925b2af","line":186,"updated":"2016-11-07 12:36:39.000000000","message":"please base this on https://review.openstack.org/#/c/386845/10","commit_id":"ea77b542ee7935b2e6f7641d6b24d0294cece34b"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"cc9d844f5d916388b6674468fe3f3d5e8374b0cb","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        router_id \u003d router[\u0027id\u0027]"},{"line_number":184,"context_line":"        agent_id \u003d agent[\u0027id\u0027]"},{"line_number":185,"context_line":"        if self.router_scheduler:"},{"line_number":186,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("},{"line_number":187,"context_line":"                service_constants.L3_ROUTER_NAT)"},{"line_number":188,"context_line":"            try:"},{"line_number":189,"context_line":"                if router.get(\u0027ha\u0027):"}],"source_content_type":"text/x-python","patch_set":14,"id":"9a629dbe_ddfaf2bc","line":186,"in_reply_to":"9a629dbe_b925b2af","updated":"2016-11-09 08:12:39.000000000","message":"I realise my patch would need to be re-spun after 386845 merges, but I don\u0027t see why a rebase is required. If 386845 is merged before, I can simply rebase on master, and on the opposite case it\u0027s a simple change to change this code in 386845.\n\nThis is a long patch series (4 patches) as it is, lets not make it longer.","commit_id":"ea77b542ee7935b2e6f7641d6b24d0294cece34b"},{"author":{"_account_id":10267,"name":"venkata anil","email":"anilvenkata@redhat.com","username":"anil"},"change_message_id":"47fe4f8eccd470383fc89de67621f1348e66dcf3","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        router_id \u003d router[\u0027id\u0027]"},{"line_number":184,"context_line":"        agent_id \u003d agent[\u0027id\u0027]"},{"line_number":185,"context_line":"        if self.router_scheduler:"},{"line_number":186,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("},{"line_number":187,"context_line":"                service_constants.L3_ROUTER_NAT)"},{"line_number":188,"context_line":"            try:"},{"line_number":189,"context_line":"                if router.get(\u0027ha\u0027):"}],"source_content_type":"text/x-python","patch_set":14,"id":"9a629dbe_795783ca","line":186,"in_reply_to":"9a629dbe_ddfaf2bc","updated":"2016-11-14 15:00:34.000000000","message":"Agree with John. There is no functional dependency between the two patches and we are not sure which one can go first. And also resolving this merge conflict is easy.","commit_id":"ea77b542ee7935b2e6f7641d6b24d0294cece34b"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d6a0ec6dcfc5a6c6c452cc7e998f0a90bc43a9b9","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        router_id \u003d router[\u0027id\u0027]"},{"line_number":184,"context_line":"        agent_id \u003d agent[\u0027id\u0027]"},{"line_number":185,"context_line":"        if self.router_scheduler:"},{"line_number":186,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("},{"line_number":187,"context_line":"                service_constants.L3_ROUTER_NAT)"},{"line_number":188,"context_line":"            try:"},{"line_number":189,"context_line":"                if router.get(\u0027ha\u0027):"}],"source_content_type":"text/x-python","patch_set":16,"id":"7a77a97e_73611339","line":186,"updated":"2016-11-16 17:23:07.000000000","message":"please base this on https://review.openstack.org/386845","commit_id":"1e195afaf12cbb426a356a11cacfe45f04bd43a2"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"b585a58ecd4e46a652025d1713006c2fe4377c81","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        router_id \u003d router[\u0027id\u0027]"},{"line_number":184,"context_line":"        agent_id \u003d agent[\u0027id\u0027]"},{"line_number":185,"context_line":"        if self.router_scheduler:"},{"line_number":186,"context_line":"            plugin \u003d manager.NeutronManager.get_service_plugins().get("},{"line_number":187,"context_line":"                service_constants.L3_ROUTER_NAT)"},{"line_number":188,"context_line":"            try:"},{"line_number":189,"context_line":"                if router.get(\u0027ha\u0027):"}],"source_content_type":"text/x-python","patch_set":16,"id":"7a77a97e_1c5e1212","line":186,"in_reply_to":"7a77a97e_73611339","updated":"2016-11-17 08:47:11.000000000","message":"I believe it\u0027s better to merge it on this base. Then the back port (on top of https://review.openstack.org/#q,I3447ea5bcb7c57365c6f50efe12a1671e86588b3,n,z) would be straight forward since the code base is the same.","commit_id":"1e195afaf12cbb426a356a11cacfe45f04bd43a2"}],"neutron/scheduler/l3_agent_scheduler.py":[{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"5cee609e965a9dce82efbd5e97158c5f4638a9d7","unresolved":false,"context_lines":[{"line_number":379,"context_line":"                LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":380,"context_line":"                          \"%(agent)s\", {\u0027router\u0027: router_id,"},{"line_number":381,"context_line":"                                        \u0027agent\u0027: agent.id})"},{"line_number":382,"context_line":"            except db_exc.DBReferenceError:"},{"line_number":383,"context_line":"                continue"},{"line_number":384,"context_line":"            else:"},{"line_number":385,"context_line":"                LOG.debug(\u0027HA Router %(router_id)s is scheduled to L3 agent \u0027"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a8ec9b2_28a9ae24","line":382,"updated":"2016-09-16 08:57:53.000000000","message":"This except block should be removed.","commit_id":"3aabaddcdd1518ef5a9c7b5ea6be1f2dd757406d"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"27ca9201a8ddad8935d4c8514ecbe2e65f090522","unresolved":false,"context_lines":[{"line_number":202,"context_line":""},{"line_number":203,"context_line":"    def bind_router(self, context, plugin, router_id, chosen_agent,"},{"line_number":204,"context_line":"                    is_manual_scheduling\u003dFalse, is_ha\u003dFalse):"},{"line_number":205,"context_line":"        \"\"\"Bind the router to the l3 agent which has been chosen.\"\"\""},{"line_number":206,"context_line":"        # Pre-cache the agent\u0027s id so that if an exception is raised we can"},{"line_number":207,"context_line":"        # safely access its value. Otherwise, sqlalchemy will try to fetch it"},{"line_number":208,"context_line":"        # from the database during a rollback, which is bad for us."}],"source_content_type":"text/x-python","patch_set":4,"id":"5a8bc5a2_66dcc073","line":205,"updated":"2016-09-26 12:50:49.000000000","message":"can you put in a docstring to explain what this function returns and what it means when it doesn\u0027t return anything?","commit_id":"89b8a7e88de7e0e57409ac5bde509702e8dd85c2"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"b45c97a83342944de8670ed19102163edcfbbffe","unresolved":false,"context_lines":[{"line_number":202,"context_line":""},{"line_number":203,"context_line":"    def bind_router(self, context, plugin, router_id, chosen_agent,"},{"line_number":204,"context_line":"                    is_manual_scheduling\u003dFalse, is_ha\u003dFalse):"},{"line_number":205,"context_line":"        \"\"\"Bind the router to the l3 agent which has been chosen.\"\"\""},{"line_number":206,"context_line":"        # Pre-cache the agent\u0027s id so that if an exception is raised we can"},{"line_number":207,"context_line":"        # safely access its value. Otherwise, sqlalchemy will try to fetch it"},{"line_number":208,"context_line":"        # from the database during a rollback, which is bad for us."}],"source_content_type":"text/x-python","patch_set":4,"id":"5a8bc5a2_0ee06ef9","line":205,"in_reply_to":"5a8bc5a2_66dcc073","updated":"2016-09-26 14:01:14.000000000","message":"Sure.","commit_id":"89b8a7e88de7e0e57409ac5bde509702e8dd85c2"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"27ca9201a8ddad8935d4c8514ecbe2e65f090522","unresolved":false,"context_lines":[{"line_number":208,"context_line":"        # from the database during a rollback, which is bad for us."},{"line_number":209,"context_line":"        agent_id \u003d chosen_agent.id"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"        for attempts in range(1, db_api.MAX_RETRIES + 1):"},{"line_number":212,"context_line":"            if not is_ha:"},{"line_number":213,"context_line":"                # This case will lead to only one try: all the \u0027except\u0027 blocks"},{"line_number":214,"context_line":"                # in the non-ha case will lead to an immediate break of the"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a8bc5a2_c62d9447","line":211,"updated":"2016-09-26 12:50:49.000000000","message":"we return None in the case that attempts are exceeded and when there was a concurrent binding? Should those two really be the same thing? Maybe we should throw a RetryRequest exception if attempts runs out.","commit_id":"89b8a7e88de7e0e57409ac5bde509702e8dd85c2"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"b45c97a83342944de8670ed19102163edcfbbffe","unresolved":false,"context_lines":[{"line_number":208,"context_line":"        # from the database during a rollback, which is bad for us."},{"line_number":209,"context_line":"        agent_id \u003d chosen_agent.id"},{"line_number":210,"context_line":""},{"line_number":211,"context_line":"        for attempts in range(1, db_api.MAX_RETRIES + 1):"},{"line_number":212,"context_line":"            if not is_ha:"},{"line_number":213,"context_line":"                # This case will lead to only one try: all the \u0027except\u0027 blocks"},{"line_number":214,"context_line":"                # in the non-ha case will lead to an immediate break of the"}],"source_content_type":"text/x-python","patch_set":4,"id":"5a8bc5a2_eeda624a","line":211,"in_reply_to":"5a8bc5a2_c62d9447","updated":"2016-09-26 14:01:14.000000000","message":"We can, but I prefer not to since this adds a lot of overhead (code-wise) surrounding each bind_router() call with a \u0027try-except RetryRequest\" problem (and for each one, do something else. This was my original implementation but it just produced really ugly code so I did this instead.\n\nThe idea is that either bind_router succeeds or it fails after X amount of retires, and it\u0027s smart enough to calculate the number of retries allowed.","commit_id":"89b8a7e88de7e0e57409ac5bde509702e8dd85c2"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"b1e37d744df2bab3dd63cf9d72c4d3a931a3f13d","unresolved":false,"context_lines":[{"line_number":330,"context_line":"        dep_deleter \u003d functools.partial(plugin._delete_ha_network, ctxt)"},{"line_number":331,"context_line":"        dep_id_attr \u003d \u0027network_id\u0027"},{"line_number":332,"context_line":""},{"line_number":333,"context_line":"        binding_index \u003d plugin.get_vacant_binding_index("},{"line_number":334,"context_line":"            context, router_id, is_manual_scheduling)"},{"line_number":335,"context_line":"        if binding_index \u003d\u003d -1:"},{"line_number":336,"context_line":"            LOG.debug(\"Couldn\u0027t find a vacant binding_index for router %s\","},{"line_number":337,"context_line":"                      router_id)"},{"line_number":338,"context_line":"            return"},{"line_number":339,"context_line":""},{"line_number":340,"context_line":"        # This might fail in case of concurrent calls, which is good for us"},{"line_number":341,"context_line":"        # as we can skip the rest of this function."}],"source_content_type":"text/x-python","patch_set":5,"id":"5a8bc5a2_cb000637","line":338,"range":{"start_line":333,"start_character":8,"end_line":338,"end_character":18},"updated":"2016-09-27 08:43:19.000000000","message":"No! Bad Code!\n\n(This is a leftover and should be removed.)","commit_id":"e2456f47c9a5ff7289661bb27c6c2d0d55a73979"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"f2d4bcd549c6a765581b1d330f8fc310102889e2","unresolved":false,"context_lines":[{"line_number":232,"context_line":"                # loop."},{"line_number":233,"context_line":"                binding_index \u003d l3_agentschedulers_db.LOWEST_BINDING_INDEX"},{"line_number":234,"context_line":"            else:"},{"line_number":235,"context_line":"                binding_index \u003d plugin.get_vacant_binding_index("},{"line_number":236,"context_line":"                    context, router_id, is_manual_scheduling)"},{"line_number":237,"context_line":""},{"line_number":238,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":7,"id":"3a98d1f4_18782fc4","line":235,"range":{"start_line":235,"start_character":16,"end_line":235,"end_character":29},"updated":"2016-09-29 07:48:58.000000000","message":"Need to check if binding_index \u003c 0, and if so, fail.","commit_id":"61638499413836169fcb655c88194dc280e7e018"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"0b088aef538594adfa5739ac65194a3dbd38dee3","unresolved":false,"context_lines":[{"line_number":359,"context_line":"                                 chosen_agents):"},{"line_number":360,"context_line":"        port_bindings \u003d plugin.get_ha_router_port_bindings(context,"},{"line_number":361,"context_line":"                                                           [router_id])"},{"line_number":362,"context_line":"        binding_indices \u003d range(l3_agentschedulers_db.LOWEST_BINDING_INDEX,"},{"line_number":363,"context_line":"                                len(port_bindings) + 1)"},{"line_number":364,"context_line":"        for port_binding, agent, binding_index in zip("},{"line_number":365,"context_line":"            port_bindings, chosen_agents, binding_indices):"},{"line_number":366,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3a98d1f4_85275d11","side":"PARENT","line":363,"range":{"start_line":362,"start_character":8,"end_line":363,"end_character":55},"updated":"2016-09-29 15:08:00.000000000","message":"Given that you changed the signature of the bind_router method to don\u0027t consider the binding_index as an argument, I just wondering if that change doesn\u0027t affect the fact that here is using a range of values.","commit_id":"727c79f9f6471b74df6d6f586304e4aaf390b39f"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"37fddc87911967b3fc345474e4cb709b84cc4dd1","unresolved":false,"context_lines":[{"line_number":359,"context_line":"                                 chosen_agents):"},{"line_number":360,"context_line":"        port_bindings \u003d plugin.get_ha_router_port_bindings(context,"},{"line_number":361,"context_line":"                                                           [router_id])"},{"line_number":362,"context_line":"        binding_indices \u003d range(l3_agentschedulers_db.LOWEST_BINDING_INDEX,"},{"line_number":363,"context_line":"                                len(port_bindings) + 1)"},{"line_number":364,"context_line":"        for port_binding, agent, binding_index in zip("},{"line_number":365,"context_line":"            port_bindings, chosen_agents, binding_indices):"},{"line_number":366,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3a98d1f4_e6fe686a","side":"PARENT","line":363,"range":{"start_line":362,"start_character":8,"end_line":363,"end_character":55},"in_reply_to":"3a98d1f4_85275d11","updated":"2016-09-29 15:27:27.000000000","message":"The effect is that bind_router will always try to find a vacant binding_index - an addition of one SQL query per requested binding. I think it\u0027s reasonable seeing as how drastically less complicated the code is without the list logic (and is even simplified further by followup patches).\n\nThe vacancy lookup, in the naive (non-concurrent) case, will simply use a range of indices, starting with LOWEST_BINDING_INDEX and up to len(agents) (which should equal len(port_bindings) anyway).","commit_id":"727c79f9f6471b74df6d6f586304e4aaf390b39f"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"0b088aef538594adfa5739ac65194a3dbd38dee3","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                           \u0027binding_index\u0027: binding_index})"},{"line_number":257,"context_line":"                return binding"},{"line_number":258,"context_line":"            except db_exc.DBDuplicateEntry as error:"},{"line_number":259,"context_line":"                LOG.debug(\u0027Router %(router_id)s has already been scheduled \u0027"},{"line_number":260,"context_line":"                          \u0027to L3 agent %(agent_id)s (tried to bind with \u0027"},{"line_number":261,"context_line":"                          \u0027binding_index %(binding_index)d). The conflict was \u0027"},{"line_number":262,"context_line":"                          \u0027with columns %(columns)r.\u0027,"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a98d1f4_ea4550b3","line":259,"range":{"start_line":259,"start_character":20,"end_line":259,"end_character":25},"updated":"2016-09-29 15:08:00.000000000","message":"shouldn\u0027t this an error log entry?","commit_id":"fc7271d6e3d72d806ca53193d5239bfc1208dfb6"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"37fddc87911967b3fc345474e4cb709b84cc4dd1","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                           \u0027binding_index\u0027: binding_index})"},{"line_number":257,"context_line":"                return binding"},{"line_number":258,"context_line":"            except db_exc.DBDuplicateEntry as error:"},{"line_number":259,"context_line":"                LOG.debug(\u0027Router %(router_id)s has already been scheduled \u0027"},{"line_number":260,"context_line":"                          \u0027to L3 agent %(agent_id)s (tried to bind with \u0027"},{"line_number":261,"context_line":"                          \u0027binding_index %(binding_index)d). The conflict was \u0027"},{"line_number":262,"context_line":"                          \u0027with columns %(columns)r.\u0027,"}],"source_content_type":"text/x-python","patch_set":9,"id":"3a98d1f4_26e850e2","line":259,"range":{"start_line":259,"start_character":20,"end_line":259,"end_character":25},"in_reply_to":"3a98d1f4_ea4550b3","updated":"2016-09-29 15:27:27.000000000","message":"Nope. If we got here it means that the router has already been scheduled, just to another node. We don\u0027t consider this an error as it *was* scheduled, though.","commit_id":"fc7271d6e3d72d806ca53193d5239bfc1208dfb6"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"0b088aef538594adfa5739ac65194a3dbd38dee3","unresolved":false,"context_lines":[{"line_number":274,"context_line":"                    # concurrently added - so the binding was already added."},{"line_number":275,"context_line":"                    return"},{"line_number":276,"context_line":"            except db_exc.DBReferenceError:"},{"line_number":277,"context_line":"                LOG.debug(\u0027Router %s has already been removed \u0027"},{"line_number":278,"context_line":"                          \u0027by concurrent operation\u0027, router_id)"},{"line_number":279,"context_line":"                return"},{"line_number":280,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3a98d1f4_aa698827","line":277,"range":{"start_line":277,"start_character":20,"end_line":277,"end_character":25},"updated":"2016-09-29 15:08:00.000000000","message":"ditto: line 259","commit_id":"fc7271d6e3d72d806ca53193d5239bfc1208dfb6"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"37fddc87911967b3fc345474e4cb709b84cc4dd1","unresolved":false,"context_lines":[{"line_number":274,"context_line":"                    # concurrently added - so the binding was already added."},{"line_number":275,"context_line":"                    return"},{"line_number":276,"context_line":"            except db_exc.DBReferenceError:"},{"line_number":277,"context_line":"                LOG.debug(\u0027Router %s has already been removed \u0027"},{"line_number":278,"context_line":"                          \u0027by concurrent operation\u0027, router_id)"},{"line_number":279,"context_line":"                return"},{"line_number":280,"context_line":""}],"source_content_type":"text/x-python","patch_set":9,"id":"3a98d1f4_c6bdecd8","line":277,"range":{"start_line":277,"start_character":20,"end_line":277,"end_character":25},"in_reply_to":"3a98d1f4_aa698827","updated":"2016-09-29 15:27:27.000000000","message":"ditto","commit_id":"fc7271d6e3d72d806ca53193d5239bfc1208dfb6"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d3ff13ec7f473c19b0c98b8a2c1cf4637d4eee25","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            else:"},{"line_number":202,"context_line":"                self.bind_router(plugin, context, router[\u0027id\u0027], l3_agent)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def bind_router(self, plugin, context, router_id, chosen_agent,"},{"line_number":205,"context_line":"                    is_manual_scheduling\u003dFalse, is_ha\u003dFalse):"},{"line_number":206,"context_line":"        \"\"\"Bind the router to the l3 agent which has been chosen."},{"line_number":207,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"ba5da102_38ec6c29","line":204,"updated":"2016-11-03 12:03:28.000000000","message":"can we wrap this with tenacity?","commit_id":"5e38ad26a2e857fcbf1e6f97778914a315c15c4c"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"562685fdd69d89331fdc6698435358d56796c40b","unresolved":false,"context_lines":[{"line_number":201,"context_line":"            else:"},{"line_number":202,"context_line":"                self.bind_router(plugin, context, router[\u0027id\u0027], l3_agent)"},{"line_number":203,"context_line":""},{"line_number":204,"context_line":"    def bind_router(self, plugin, context, router_id, chosen_agent,"},{"line_number":205,"context_line":"                    is_manual_scheduling\u003dFalse, is_ha\u003dFalse):"},{"line_number":206,"context_line":"        \"\"\"Bind the router to the l3 agent which has been chosen."},{"line_number":207,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"ba5da102_3302cd0a","line":204,"in_reply_to":"ba5da102_38ec6c29","updated":"2016-11-03 12:26:04.000000000","message":"I\u0027m not sure how much benefit we can get from tenacity.retry here. There are (regretfully) multiple failure points (lines 243, 275 and 279) that all point to a different error, a retry point (line 271) and a success point (line 243). Changing the code to work with tenacity.retry might make the code even less understandable (since we\u0027ll now have to comply with the API dictated - for example we can return None for \"quit now\", but then we\u0027ll need an exception to signify \"retry\"). The problem with exception is that adding one makes all the calls to bind_router (4 here) aware of it and surround calls with try-except. This is far from optimal (tried this on earlier revisions, code was ugly).","commit_id":"5e38ad26a2e857fcbf1e6f97778914a315c15c4c"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"d3ff13ec7f473c19b0c98b8a2c1cf4637d4eee25","unresolved":false,"context_lines":[{"line_number":209,"context_line":"        to the database. It returns the binding that was created or None if it"},{"line_number":210,"context_line":"        failed to create it due to some conflict."},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"        If this is an HA router and creating a RouterL3AgentBinding failed"},{"line_number":213,"context_line":"        because the binding_index was concurrently taken by some other worker,"},{"line_number":214,"context_line":"        then the function will retry with a different vacant binding_index (up"},{"line_number":215,"context_line":"        to db_api.MAX_RETRIES times). Otherwise, if it failed because, for"}],"source_content_type":"text/x-python","patch_set":13,"id":"ba5da102_78a42407","line":212,"updated":"2016-11-03 12:03:28.000000000","message":"212-214 does not make sense to me","commit_id":"5e38ad26a2e857fcbf1e6f97778914a315c15c4c"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"562685fdd69d89331fdc6698435358d56796c40b","unresolved":false,"context_lines":[{"line_number":209,"context_line":"        to the database. It returns the binding that was created or None if it"},{"line_number":210,"context_line":"        failed to create it due to some conflict."},{"line_number":211,"context_line":""},{"line_number":212,"context_line":"        If this is an HA router and creating a RouterL3AgentBinding failed"},{"line_number":213,"context_line":"        because the binding_index was concurrently taken by some other worker,"},{"line_number":214,"context_line":"        then the function will retry with a different vacant binding_index (up"},{"line_number":215,"context_line":"        to db_api.MAX_RETRIES times). Otherwise, if it failed because, for"}],"source_content_type":"text/x-python","patch_set":13,"id":"ba5da102_b33dfdc5","line":212,"in_reply_to":"ba5da102_78a42407","updated":"2016-11-03 12:26:04.000000000","message":"Will rephrase.","commit_id":"5e38ad26a2e857fcbf1e6f97778914a315c15c4c"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"8af6666c85418083b571e1a12bf97fee7130fd07","unresolved":false,"context_lines":[{"line_number":228,"context_line":"        # from the database during a rollback, which is bad for us."},{"line_number":229,"context_line":"        agent_id \u003d chosen_agent.id"},{"line_number":230,"context_line":""},{"line_number":231,"context_line":"        for attempts in range(1, db_api.MAX_RETRIES + 1):"},{"line_number":232,"context_line":"            if not is_ha:"},{"line_number":233,"context_line":"                # This case will lead to only one try: all the \u0027except\u0027 blocks"},{"line_number":234,"context_line":"                # in the non-ha case will lead to an immediate break of the"}],"source_content_type":"text/x-python","patch_set":14,"id":"9a629dbe_f91f2a59","line":231,"updated":"2016-11-07 12:36:39.000000000","message":"can we spein this to a sub method? or is that a overkill","commit_id":"ea77b542ee7935b2e6f7641d6b24d0294cece34b"},{"author":{"_account_id":10267,"name":"venkata anil","email":"anilvenkata@redhat.com","username":"anil"},"change_message_id":"47fe4f8eccd470383fc89de67621f1348e66dcf3","unresolved":false,"context_lines":[{"line_number":228,"context_line":"        # from the database during a rollback, which is bad for us."},{"line_number":229,"context_line":"        agent_id \u003d chosen_agent.id"},{"line_number":230,"context_line":""},{"line_number":231,"context_line":"        for attempts in range(1, db_api.MAX_RETRIES + 1):"},{"line_number":232,"context_line":"            if not is_ha:"},{"line_number":233,"context_line":"                # This case will lead to only one try: all the \u0027except\u0027 blocks"},{"line_number":234,"context_line":"                # in the non-ha case will lead to an immediate break of the"}],"source_content_type":"text/x-python","patch_set":14,"id":"9a629dbe_f93393f4","line":231,"in_reply_to":"9a629dbe_07097d31","updated":"2016-11-14 15:00:34.000000000","message":"Because of the comments and log messages, this function is looking big. But the code is less and understandable. So I think no need to break this function.","commit_id":"ea77b542ee7935b2e6f7641d6b24d0294cece34b"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"cc9d844f5d916388b6674468fe3f3d5e8374b0cb","unresolved":false,"context_lines":[{"line_number":228,"context_line":"        # from the database during a rollback, which is bad for us."},{"line_number":229,"context_line":"        agent_id \u003d chosen_agent.id"},{"line_number":230,"context_line":""},{"line_number":231,"context_line":"        for attempts in range(1, db_api.MAX_RETRIES + 1):"},{"line_number":232,"context_line":"            if not is_ha:"},{"line_number":233,"context_line":"                # This case will lead to only one try: all the \u0027except\u0027 blocks"},{"line_number":234,"context_line":"                # in the non-ha case will lead to an immediate break of the"}],"source_content_type":"text/x-python","patch_set":14,"id":"9a629dbe_07097d31","line":231,"in_reply_to":"9a629dbe_f91f2a59","updated":"2016-11-09 08:12:39.000000000","message":"The same comment from patchset #13 applies - putting this in a different function makes this code really difficult in that the function can return 3 separate values (to indicate either \"success\", \"failure\" or \"retry\".","commit_id":"ea77b542ee7935b2e6f7641d6b24d0294cece34b"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"8edaa505e0a0ee5db74a03f4c3715f247f3def81","unresolved":false,"context_lines":[{"line_number":266,"context_line":"                           \u0027router_id\u0027: router_id,"},{"line_number":267,"context_line":"                           \u0027binding_index\u0027: binding_index,"},{"line_number":268,"context_line":"                           \u0027columns\u0027: error.columns})"},{"line_number":269,"context_line":"                if error.columns[0] !\u003d \u0027PRIMARY\u0027 and is_ha:"},{"line_number":270,"context_line":"                    # This is a conflict with binding_index, which means that"},{"line_number":271,"context_line":"                    # the binding for this specific agent wasn\u0027t created yet -"},{"line_number":272,"context_line":"                    # we should retry if this is an HA router."}],"source_content_type":"text/x-python","patch_set":14,"id":"7a77a97e_0abb60e6","line":269,"updated":"2016-11-16 08:38:43.000000000","message":"I\u0027m not a big fan of inspecting Duplicate exceptions if we can avoid it. It makes code-paths brittle to data-model changes.\n\nCan we instead decorate this function with neutron.db.api.retry_db_errors? That will handle retrying DBDuplicate with back-off and max_retries automatically for us.\n\nThat means you can get rid of the for loop and get rid of the exception handler for DBDuplicateEntry.\n\nDue to the auto-arg copying of mutable args in retry_db_errors, you will want to change this function to accept an agent_id rather than an agent DB object. Then change L250 to \"binding.l3_agent_id \u003d agent_id\".","commit_id":"ea77b542ee7935b2e6f7641d6b24d0294cece34b"},{"author":{"_account_id":12444,"name":"John Schwarz","email":"jschwarz@redhat.com","username":"jschwarz"},"change_message_id":"e0b77d0402e734ca830ae225cf5bfe17132dd7ff","unresolved":false,"context_lines":[{"line_number":266,"context_line":"                           \u0027router_id\u0027: router_id,"},{"line_number":267,"context_line":"                           \u0027binding_index\u0027: binding_index,"},{"line_number":268,"context_line":"                           \u0027columns\u0027: error.columns})"},{"line_number":269,"context_line":"                if error.columns[0] !\u003d \u0027PRIMARY\u0027 and is_ha:"},{"line_number":270,"context_line":"                    # This is a conflict with binding_index, which means that"},{"line_number":271,"context_line":"                    # the binding for this specific agent wasn\u0027t created yet -"},{"line_number":272,"context_line":"                    # we should retry if this is an HA router."}],"source_content_type":"text/x-python","patch_set":14,"id":"7a77a97e_b2bae2df","line":269,"in_reply_to":"7a77a97e_0abb60e6","updated":"2016-11-16 13:40:13.000000000","message":"Done","commit_id":"ea77b542ee7935b2e6f7641d6b24d0294cece34b"}]}
