)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"35d485066381682271c4d9fcdf7891cc14cd414f","unresolved":false,"context_lines":[{"line_number":12,"context_line":"Also optimize deleting logic."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Proposed patch gives ~2x performance gain in comparison with"},{"line_number":15,"context_line":"original code on Mysql and Postgesql backends"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I801d967e8e3c0260593f289097d17270ef0b391e"},{"line_number":18,"context_line":"Partial-Bug: #1324875"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"1ae5cdf2_655f4c73","line":15,"range":{"start_line":15,"start_character":27,"end_line":15,"end_character":36},"updated":"2014-06-09 14:46:14.000000000","message":"postgresql","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"182e5b19f65112af190fcf5aaa1ea2fbb5b64d64","unresolved":false,"context_lines":[{"line_number":12,"context_line":"Also optimize deleting logic."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"Proposed patch gives ~2x performance gain in comparison with"},{"line_number":15,"context_line":"original code on Mysql and Postgesql backends"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Change-Id: I801d967e8e3c0260593f289097d17270ef0b391e"},{"line_number":18,"context_line":"Partial-Bug: #1324875"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":6,"id":"1ae5cdf2_c0572e25","line":15,"in_reply_to":"1ae5cdf2_655f4c73","updated":"2014-06-09 15:03:20.000000000","message":"ops, typo! thanks","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"}],"neutron/plugins/common/utils.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"82dac5618e29e647774518e15a5efb172ca17f47","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                      constants.PENDING_DELETE)"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"def list_slice(orig_list, slice_size):"},{"line_number":73,"context_line":"    for chunk in (orig_list[i:i + slice_size]"},{"line_number":74,"context_line":"                  for i in range(0, len(orig_list), slice_size)):"},{"line_number":75,"context_line":"        yield chunk"}],"source_content_type":"text/x-python","patch_set":5,"id":"1ae5cdf2_30876e14","line":72,"updated":"2014-06-06 16:49:37.000000000","message":"This name is a bit lacking.  I think the name should communicate that it is a generator.  Suggestions:  \"iterate_list_by_slices\", \"each_slice_in_list\".  I don\u0027t know.  list_slice doesn\u0027t do it for me.","commit_id":"428e8960d6bea4dda0be66bd6dca8d333c6ce9df"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"04800e6e43e28d8d032f8806cb73bba1cc434327","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                      constants.PENDING_DELETE)"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"def list_slice(orig_list, slice_size):"},{"line_number":73,"context_line":"    for chunk in (orig_list[i:i + slice_size]"},{"line_number":74,"context_line":"                  for i in range(0, len(orig_list), slice_size)):"},{"line_number":75,"context_line":"        yield chunk"}],"source_content_type":"text/x-python","patch_set":5,"id":"1ae5cdf2_1ae36c34","line":72,"in_reply_to":"1ae5cdf2_30876e14","updated":"2014-06-06 18:29:50.000000000","message":"ok, i\u0027ll think about it","commit_id":"428e8960d6bea4dda0be66bd6dca8d333c6ce9df"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8734715bb759f2c459469b11efe8d297458fd2d5","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                      constants.PENDING_DELETE)"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"def each_slice_in_list(orig_list, slice_size):"},{"line_number":73,"context_line":"    for chunk in (orig_list[i:i + slice_size]"},{"line_number":74,"context_line":"                  for i in range(0, len(orig_list), slice_size)):"},{"line_number":75,"context_line":"        yield chunk"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_2825d4c1","line":72,"updated":"2014-06-10 23:51:38.000000000","message":"this is not very robust especially if orig_list is an iterable.  Probably best not to add this method.","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f8b0025a179be68214a331caff869851afbd3738","unresolved":false,"context_lines":[{"line_number":69,"context_line":"                      constants.PENDING_DELETE)"},{"line_number":70,"context_line":""},{"line_number":71,"context_line":""},{"line_number":72,"context_line":"def each_slice_in_list(orig_list, slice_size):"},{"line_number":73,"context_line":"    for chunk in (orig_list[i:i + slice_size]"},{"line_number":74,"context_line":"                  for i in range(0, len(orig_list), slice_size)):"},{"line_number":75,"context_line":"        yield chunk"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_74524e36","line":72,"in_reply_to":"1ae5cdf2_2825d4c1","updated":"2014-06-11 06:48:13.000000000","message":"Done","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"}],"neutron/plugins/ml2/drivers/type_vxlan.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"e57b2dbfc3216b940ddb54bc5cff46c08603add2","unresolved":false,"context_lines":[{"line_number":166,"context_line":"                                  alloc.vxlan_vni)"},{"line_number":167,"context_line":"                        session.delete(alloc)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"            sorted_vnis \u003d sorted(vxlan_vnis)"},{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of 15-20 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_87b305e8","line":169,"updated":"2014-06-04 13:05:49.000000000","message":"Does it need to be sorted?","commit_id":"44b96003813291e9b5e97f225a49f9cb40b3cfca"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"c31a065a6dfec2660742862a360623e116c1b2b9","unresolved":false,"context_lines":[{"line_number":166,"context_line":"                                  alloc.vxlan_vni)"},{"line_number":167,"context_line":"                        session.delete(alloc)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"            sorted_vnis \u003d sorted(vxlan_vnis)"},{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of 15-20 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_a240efa5","line":169,"in_reply_to":"1ae5cdf2_87b305e8","updated":"2014-06-04 13:32:27.000000000","message":"i\u0027m just following existing code. probably this isn\u0027t necessary","commit_id":"44b96003813291e9b5e97f225a49f9cb40b3cfca"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"a06e629603e252f51f0599be428f39a1c4d56cc1","unresolved":false,"context_lines":[{"line_number":176,"context_line":"                # TODO(enikanorov): have to be db backend-specific here"},{"line_number":177,"context_line":"                # as not all dbs support 0 for boolean columns"},{"line_number":178,"context_line":"                bulk \u003d \",\".join(\"(%s, 0)\" % str(vni) for vni in vni_list)"},{"line_number":179,"context_line":"                session.execute(\"INSERT INTO ml2_vxlan_allocations\""},{"line_number":180,"context_line":"                                \"(vxlan_vni, allocated) VALUES %s\" % bulk)"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"    def get_vxlan_allocation(self, session, vxlan_vni):"}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_e769298d","line":179,"updated":"2014-06-04 12:52:03.000000000","message":"This is SQL-dialect dependent (even though it\u0027s still pretty standard ;). Have you considered using the ORM core for abstracting the way you build the query?\n\nhttp://docs.sqlalchemy.org/en/rel_0_8/faq.html#i-m-inserting-400-000-rows-with-the-orm-and-it-s-really-slow","commit_id":"44b96003813291e9b5e97f225a49f9cb40b3cfca"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"3b80d29dc655d29b62cc63092e59a927bb09072a","unresolved":false,"context_lines":[{"line_number":176,"context_line":"                # TODO(enikanorov): have to be db backend-specific here"},{"line_number":177,"context_line":"                # as not all dbs support 0 for boolean columns"},{"line_number":178,"context_line":"                bulk \u003d \",\".join(\"(%s, 0)\" % str(vni) for vni in vni_list)"},{"line_number":179,"context_line":"                session.execute(\"INSERT INTO ml2_vxlan_allocations\""},{"line_number":180,"context_line":"                                \"(vxlan_vni, allocated) VALUES %s\" % bulk)"},{"line_number":181,"context_line":""},{"line_number":182,"context_line":"    def get_vxlan_allocation(self, session, vxlan_vni):"}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_a2f9cf81","line":179,"in_reply_to":"1ae5cdf2_e769298d","updated":"2014-06-04 13:31:59.000000000","message":"yep, that is my concern as well and that\u0027s what i\u0027m exploring right now","commit_id":"44b96003813291e9b5e97f225a49f9cb40b3cfca"},{"author":{"_account_id":11114,"name":"yalei wang","email":"yalei.wang@intel.com","username":"yalie"},"change_message_id":"2b2fd76fbb6dd4a755c844907465adb141670d20","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"1ae5cdf2_9dda5b15","updated":"2014-06-05 02:55:47.000000000","message":"could we make the DB delete operation(167L) in a bulk too?","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"2d601eedf009e914cf4fc741ed33685e94b48ea9","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":4,"id":"1ae5cdf2_25665f2a","in_reply_to":"1ae5cdf2_9dda5b15","updated":"2014-06-06 10:49:10.000000000","message":"See latest patchset. Appreciate if you could test it.","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8e7174c6e36f2c48d3d0ee0473c8bab67b35ba0c","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                        session.delete(alloc)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_aa8253c5","line":170,"updated":"2014-06-05 17:49:43.000000000","message":"sqlite is not a real db, so am I skeptical on the actual performance gains","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":11114,"name":"yalei wang","email":"yalei.wang@intel.com","username":"yalie"},"change_message_id":"51bd7f7fda77a1381dd54f7c13dfbed692b44db4","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                        session.delete(alloc)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_b5e9c7b8","line":170,"in_reply_to":"1ae5cdf2_15ac3b8b","updated":"2014-06-06 04:49:55.000000000","message":"I tested with a remote database in mysql, it would give a 2x benefit.","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"5ca53f2c851031c3190c31c21b4266fc141f5ecc","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                        session.delete(alloc)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_15ac3b8b","line":170,"in_reply_to":"1ae5cdf2_aa8253c5","updated":"2014-06-06 04:43:38.000000000","message":"I\u0027m working on getting the actual numbers","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"659d3c430987a9f36851f3c10e2b0460ed8176e6","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                        session.delete(alloc)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_457a8b88","line":170,"in_reply_to":"1ae5cdf2_b5e9c7b8","updated":"2014-06-06 10:30:17.000000000","message":"I can confirm this number. Also, this patch only improves adding part where you go from short to longer vni range.\nI\u0027m planning to push new version that also improves deleting part (above). Deleting performance could also be improved ~2x times.","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4d2a0de04f13eadd5c6b52539aaf6a6e116fd688","unresolved":false,"context_lines":[{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_35177746","line":173,"updated":"2014-06-06 04:24:59.000000000","message":"Let me know if I\u0027m missing something.  Why chunk these at all?  What is the justification for it?  I was reading the faq on sqlalchemy [1].  It mentions chunking but only in the context of the ORM.  When core is used, the code samples don\u0027t use chunking.\n\n[1] http://docs.sqlalchemy.org/en/rel_0_9/faq.html#i-m-inserting-400-000-rows-with-the-orm-and-it-s-really-slow","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"d840660a49498fab770da2c361120dc23747021c","unresolved":false,"context_lines":[{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_557dcce6","line":173,"in_reply_to":"1ae5cdf2_25bf3f62","updated":"2014-06-06 16:20:43.000000000","message":"can\u0027t you simply insert all rows with a single execute()?  any downside?\n\niiic, it maps to db-api executemany, which seems to have no apparent upper bound for the number of rows.","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"2d601eedf009e914cf4fc741ed33685e94b48ea9","unresolved":false,"context_lines":[{"line_number":170,"context_line":"            # based on some testing with UTs (sqlite),"},{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_25bf3f62","line":173,"in_reply_to":"1ae5cdf2_35177746","updated":"2014-06-06 10:49:10.000000000","message":"per my tests small 10-12% benefit is still seen going from small chunks to chunk size of 50-100 (500 is a  result of testing with sqlite)","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"f9a3f7fa2d90fd6c66f9ec400024949cc1057177","unresolved":false,"context_lines":[{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":177,"context_line":"                        for vni in vni_list]"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_4aef3de9","line":174,"updated":"2014-06-04 15:19:25.000000000","message":"(optional) nit: we could make this a helper util that would divide iterables into chunks","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8e7174c6e36f2c48d3d0ee0473c8bab67b35ba0c","unresolved":false,"context_lines":[{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":177,"context_line":"                        for vni in vni_list]"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_ca85dfcf","line":174,"updated":"2014-06-05 17:49:43.000000000","message":"This is a more common chunking pattern:\n\nwhile vxlan_vnis:\n    vni_list \u003d vxlan_vnis[:bulk_size]\n    bulk \u003d ...\n    session.execute()\n    vxlan_vnis \u003d vxlan_vnis[500:]","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"659d3c430987a9f36851f3c10e2b0460ed8176e6","unresolved":false,"context_lines":[{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":177,"context_line":"                        for vni in vni_list]"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_a56a6fb0","line":174,"in_reply_to":"1ae5cdf2_5585e357","updated":"2014-06-06 10:30:17.000000000","message":"\u003e I notice that the pattern in this patch may be slightly more efficient because it doesn\u0027t manipulate the vnis list.\n\nYes, that was the reason why I\u0027ve chosen it","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4d2a0de04f13eadd5c6b52539aaf6a6e116fd688","unresolved":false,"context_lines":[{"line_number":171,"context_line":"            # bulk size of ~500 is the value from which"},{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":177,"context_line":"                        for vni in vni_list]"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_5585e357","line":174,"in_reply_to":"1ae5cdf2_ca85dfcf","updated":"2014-06-06 04:24:59.000000000","message":"vxlan_vnis would still need to be converted to a list because I don\u0027t think the set will support vxlan_vnis[:bulk_size].\n\nJust looking at the two, I notice that the pattern in this patch may be slightly more efficient because it doesn\u0027t manipulate the vnis list.  I could go either way.","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":7805,"name":"Li Ma","email":"skywalker.nick@gmail.com","username":"Nick"},"change_message_id":"ad54e884fd66be646a4032e1bceae7f917014d20","unresolved":false,"context_lines":[{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":177,"context_line":"                        for vni in vni_list]"},{"line_number":178,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_1a61c8d2","line":175,"updated":"2014-06-06 02:47:19.000000000","message":"nit: we could make \u0027bulk_size\u0027 configurable and provides suggested value for different DBs.\n\nBy the way, testing with sqlite is not sufficient.","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"659d3c430987a9f36851f3c10e2b0460ed8176e6","unresolved":false,"context_lines":[{"line_number":172,"context_line":"            # benefit doesn\u0027t increase."},{"line_number":173,"context_line":"            bulk_size \u003d 500"},{"line_number":174,"context_line":"            for vni_list in [vnis[i:i + bulk_size]"},{"line_number":175,"context_line":"                             for i in range(0, len(vnis), bulk_size)]:"},{"line_number":176,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":177,"context_line":"                        for vni in vni_list]"},{"line_number":178,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":4,"id":"1ae5cdf2_25857f59","line":175,"in_reply_to":"1ae5cdf2_1a61c8d2","updated":"2014-06-06 10:30:17.000000000","message":"I think it doesn\u0027t really is not that important as it only affect one particular place at startup","commit_id":"8cacdd1cea9e0d3ccedb72e42ba76109f4df7e1f"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"82dac5618e29e647774518e15a5efb172ca17f47","unresolved":false,"context_lines":[{"line_number":178,"context_line":"                    delete(synchronize_session\u003d\u0027fetch\u0027))"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":181,"context_line":"            for vni_list in utils.list_slice(vnis, bulk_size):"},{"line_number":182,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":183,"context_line":"                        for vni in vni_list]"},{"line_number":184,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1ae5cdf2_f0d98623","line":181,"updated":"2014-06-06 16:49:37.000000000","message":"I\u0027m not sure that my concern from PS4, L173 has been adequately addressed.  Your response is that some performance gain is \"seen going from small chunks to chunk size of 50-100.\"  My question is, why not just send them all and not bother with chunks?","commit_id":"428e8960d6bea4dda0be66bd6dca8d333c6ce9df"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f3b00ec63661d94db018b92d393a1a6ccd63420d","unresolved":false,"context_lines":[{"line_number":178,"context_line":"                    delete(synchronize_session\u003d\u0027fetch\u0027))"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":181,"context_line":"            for vni_list in utils.list_slice(vnis, bulk_size):"},{"line_number":182,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":183,"context_line":"                        for vni in vni_list]"},{"line_number":184,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1ae5cdf2_d36baf1d","line":181,"in_reply_to":"1ae5cdf2_5887bc12","updated":"2014-06-06 20:44:30.000000000","message":"Done some more tests with both mysql and postgress. while for mysql numbers are quite close (benefit of chunked version is 15% at max, usually near 5%).\n\nFor postgres it\u0027s worse: single query version is almost 50% slower than chunked one (vni addition) and ~35% worse with vni deletion.\n\nI\u0027m going to run those tests again and post results to ML","commit_id":"428e8960d6bea4dda0be66bd6dca8d333c6ce9df"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"1f0ec7f34546351bfb3670f1dbba475983b4b5b4","unresolved":false,"context_lines":[{"line_number":178,"context_line":"                    delete(synchronize_session\u003d\u0027fetch\u0027))"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":181,"context_line":"            for vni_list in utils.list_slice(vnis, bulk_size):"},{"line_number":182,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":183,"context_line":"                        for vni in vni_list]"},{"line_number":184,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1ae5cdf2_5887bc12","line":181,"in_reply_to":"1ae5cdf2_9a021c6e","updated":"2014-06-06 20:03:42.000000000","message":"I\u0027m testing on 100k vnis being added and deleted (so going from 1:1000 to 1:100000 and back to test adding and deleting parts of the code).\nsurprizingly chunking gives 5-10% benefit, but numbers are floating. I think it\u0027s not too much too keep this complexity so i\u0027m fine to remove it.\n\nIt\u0027s still much better than orm","commit_id":"428e8960d6bea4dda0be66bd6dca8d333c6ce9df"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"8e2f559c2a136aef6e122dbe5efb070cc4b65633","unresolved":false,"context_lines":[{"line_number":178,"context_line":"                    delete(synchronize_session\u003d\u0027fetch\u0027))"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":181,"context_line":"            for vni_list in utils.list_slice(vnis, bulk_size):"},{"line_number":182,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":183,"context_line":"                        for vni in vni_list]"},{"line_number":184,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1ae5cdf2_9a021c6e","line":181,"in_reply_to":"1ae5cdf2_dabf44fb","updated":"2014-06-06 18:44:27.000000000","message":"The example in the docs that I linked to in my PS4 comment ran 100,000 queries without chunking.  I\u0027ll be interested to see what your performance testing shows (not with sqlite ;)\n\nThanks.","commit_id":"428e8960d6bea4dda0be66bd6dca8d333c6ce9df"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"04800e6e43e28d8d032f8806cb73bba1cc434327","unresolved":false,"context_lines":[{"line_number":178,"context_line":"                    delete(synchronize_session\u003d\u0027fetch\u0027))"},{"line_number":179,"context_line":""},{"line_number":180,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":181,"context_line":"            for vni_list in utils.list_slice(vnis, bulk_size):"},{"line_number":182,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":183,"context_line":"                        for vni in vni_list]"},{"line_number":184,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":5,"id":"1ae5cdf2_dabf44fb","line":181,"in_reply_to":"1ae5cdf2_f0d98623","updated":"2014-06-06 18:29:50.000000000","message":"That\u0027s an interesting point. I\u0027ll test this and see if this affects performance.\nMy impression was that too long query could be not so good.","commit_id":"428e8960d6bea4dda0be66bd6dca8d333c6ce9df"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"2ce0ea8c646f158dc785ed2cde80b9a553724c2d","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                        session.delete(alloc)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"            # add missing allocatable tunnels to table"},{"line_number":170,"context_line":"            for vxlan_vni in sorted(vxlan_vnis):"},{"line_number":171,"context_line":"                alloc \u003d VxlanAllocation(vxlan_vni\u003dvxlan_vni)"},{"line_number":172,"context_line":"                session.add(alloc)"},{"line_number":173,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_f6f2269a","side":"PARENT","line":170,"updated":"2014-06-09 20:15:10.000000000","message":"Question:  Was there anything to this call to sorted?  I just noticed it here.  Could it be they were trying to insert in sorted order to speed up the inserts?  I\u0027ve heard some anecdotal reports of faster inserts of sorted data but I\u0027m sure it is highly dependent on the database engine and the indexes that exist on the table, etc.","commit_id":"c72fa4e011ae3e6a954ed1f199ec055f979c2096"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"c50133d6578e4cd3132b526fb4faca54bd8655f1","unresolved":false,"context_lines":[{"line_number":167,"context_line":"                        session.delete(alloc)"},{"line_number":168,"context_line":""},{"line_number":169,"context_line":"            # add missing allocatable tunnels to table"},{"line_number":170,"context_line":"            for vxlan_vni in sorted(vxlan_vnis):"},{"line_number":171,"context_line":"                alloc \u003d VxlanAllocation(vxlan_vni\u003dvxlan_vni)"},{"line_number":172,"context_line":"                session.add(alloc)"},{"line_number":173,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_dcc38988","side":"PARENT","line":170,"in_reply_to":"1ae5cdf2_f6f2269a","updated":"2014-06-09 20:30:45.000000000","message":"that was just trying to be close to original code where it was sorted.\nI\u0027ve been pointed that it\u0027s, indeed, unnecessary","commit_id":"c72fa4e011ae3e6a954ed1f199ec055f979c2096"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"2ce0ea8c646f158dc785ed2cde80b9a553724c2d","unresolved":false,"context_lines":[{"line_number":159,"context_line":"            allocs \u003d (session.query(VxlanAllocation)."},{"line_number":160,"context_line":"                      with_lockmode(\"update\").all())"},{"line_number":161,"context_line":"            # collect all vnis present in db"},{"line_number":162,"context_line":"            existing_vnis \u003d set([alloc.vxlan_vni for alloc in allocs])"},{"line_number":163,"context_line":"            # collect those vnis that needs to be deleted from db"},{"line_number":164,"context_line":"            vnis_to_remove \u003d [alloc.vxlan_vni for alloc in allocs"},{"line_number":165,"context_line":"                              if (alloc.vxlan_vni not in vxlan_vnis and"}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_73daadea","line":162,"updated":"2014-06-09 20:15:10.000000000","message":"nit: Don\u0027t need square brackets here.","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"c50133d6578e4cd3132b526fb4faca54bd8655f1","unresolved":false,"context_lines":[{"line_number":159,"context_line":"            allocs \u003d (session.query(VxlanAllocation)."},{"line_number":160,"context_line":"                      with_lockmode(\"update\").all())"},{"line_number":161,"context_line":"            # collect all vnis present in db"},{"line_number":162,"context_line":"            existing_vnis \u003d set([alloc.vxlan_vni for alloc in allocs])"},{"line_number":163,"context_line":"            # collect those vnis that needs to be deleted from db"},{"line_number":164,"context_line":"            vnis_to_remove \u003d [alloc.vxlan_vni for alloc in allocs"},{"line_number":165,"context_line":"                              if (alloc.vxlan_vni not in vxlan_vnis and"}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_bcf6bdf7","line":162,"in_reply_to":"1ae5cdf2_73daadea","updated":"2014-06-09 20:30:45.000000000","message":"Done","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"2ce0ea8c646f158dc785ed2cde80b9a553724c2d","unresolved":false,"context_lines":[{"line_number":165,"context_line":"                              if (alloc.vxlan_vni not in vxlan_vnis and"},{"line_number":166,"context_line":"                                  not alloc.allocated)]"},{"line_number":167,"context_line":"            # collect vnis that need to be added"},{"line_number":168,"context_line":"            vxlan_vnis \u003d vxlan_vnis - existing_vnis"},{"line_number":169,"context_line":"            # Immediately delete vnis in chunks. This leaves no work for"},{"line_number":170,"context_line":"            # flush at the end of transaction"},{"line_number":171,"context_line":"            bulk_size \u003d 100"}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_53bbf171","line":168,"updated":"2014-06-09 20:15:10.000000000","message":"nit:  This kind of breaks the flow for me.  You might consider moving this line to before L178.  You might even inline it if you want.","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"c50133d6578e4cd3132b526fb4faca54bd8655f1","unresolved":false,"context_lines":[{"line_number":165,"context_line":"                              if (alloc.vxlan_vni not in vxlan_vnis and"},{"line_number":166,"context_line":"                                  not alloc.allocated)]"},{"line_number":167,"context_line":"            # collect vnis that need to be added"},{"line_number":168,"context_line":"            vxlan_vnis \u003d vxlan_vnis - existing_vnis"},{"line_number":169,"context_line":"            # Immediately delete vnis in chunks. This leaves no work for"},{"line_number":170,"context_line":"            # flush at the end of transaction"},{"line_number":171,"context_line":"            bulk_size \u003d 100"}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_fcd7654d","line":168,"in_reply_to":"1ae5cdf2_53bbf171","updated":"2014-06-09 20:30:45.000000000","message":"sure","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"2ce0ea8c646f158dc785ed2cde80b9a553724c2d","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                                                     bulk_size):"},{"line_number":174,"context_line":"                session.query(VxlanAllocation).filter("},{"line_number":175,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":176,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":179,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_39671fb9","line":176,"updated":"2014-06-09 20:15:10.000000000","message":"If I were working directly with the SQL engine, I would delete all of these entries with a single DELETE statement (one query).  Something along these lines (my syntax is probably wrong)...\n\nDELETE FROM VxlanAllocation\n WHERE not allocated\n   AND (vxlan_vni \u003c :tun_min OR :tun_max \u003c vxlan_vni)\n\nI\u0027m no sqlalchemy guru so I don\u0027t know how this would be done it that context.","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"99a1f7c9c0cf17edba5cd8b532ac81234745861c","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                                                     bulk_size):"},{"line_number":174,"context_line":"                session.query(VxlanAllocation).filter("},{"line_number":175,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":176,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":179,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_747b2ebe","line":176,"in_reply_to":"1ae5cdf2_0b556d4f","updated":"2014-06-11 06:47:53.000000000","message":"Well, yes, I understand that with some more smart algorithm we could actually work with ranges, but, theoretically speaking, amount of preexisting allocations is O(N) where N is size of all ranges, so such algorithm (in theory, again), might not bring benefits in corner cases.\n\nSo basically I\u0027d like to avoid doing something smart and complex here :)\n\nIt was initially one-by-one and in quite ineffective manner. The code improves it from engineering perspective by making more efficient calls, not from theoretical perspective.","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"c50133d6578e4cd3132b526fb4faca54bd8655f1","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                                                     bulk_size):"},{"line_number":174,"context_line":"                session.query(VxlanAllocation).filter("},{"line_number":175,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":176,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":179,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_9cf3c109","line":176,"in_reply_to":"1ae5cdf2_39671fb9","updated":"2014-06-09 20:30:45.000000000","message":"The issue is that it\u0027s not a single range - that\u0027s why all the complexity here. First of all, configuration consists of list of ranges, secondly, there are some preexisting allocations, that\u0027s why I use set arithmetic and that\u0027s what I\u0027m trying to do with chunked queries.\nAm I missing something obvious here?","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"2f1e1508ed950e44aa06617a2b35136ae768512d","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                                                     bulk_size):"},{"line_number":174,"context_line":"                session.query(VxlanAllocation).filter("},{"line_number":175,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":176,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":177,"context_line":""},{"line_number":178,"context_line":"            vnis \u003d list(vxlan_vnis)"},{"line_number":179,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"}],"source_content_type":"text/x-python","patch_set":6,"id":"1ae5cdf2_0b556d4f","line":176,"in_reply_to":"1ae5cdf2_9cf3c109","updated":"2014-06-11 03:42:08.000000000","message":"My example was over-simplified.  I\u0027m sorry about that but the same concept can be extended to multiple ranges.  The point of my example was that a single DELETE in sql can erase many rows and that the range(s) can be embedded in the query.  I left the rest up to your imagination.\n\nIt is possible that the sqlalchemy abstraction makes this too difficult.  I\u0027m just not much of an sqlalchemy expert.  It is too bad because with direct SQL access, I wouldn\u0027t dare query a bunch of rows just to delete them one by one.\n\nI\u0027m not sure if this use case is common enough to press this issue.","commit_id":"9831f0ed43be2344c593b0ecf36dd0913ea52534"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4fb8f7054ae4af138f068d43230ace3c33758c11","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                                                     bulk_size):"},{"line_number":172,"context_line":"                session.query(VxlanAllocation).filter("},{"line_number":173,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":174,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":175,"context_line":"            # collect vnis that need to be added"},{"line_number":176,"context_line":"            vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":177,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_2b006933","line":174,"updated":"2014-06-11 03:48:29.000000000","message":"I\u0027m not sure that this use case warrants pressing the issue but I thought you might be interested in my reply on the previous patch set.  For academic reasons if nothing else.","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f8b0025a179be68214a331caff869851afbd3738","unresolved":false,"context_lines":[{"line_number":171,"context_line":"                                                     bulk_size):"},{"line_number":172,"context_line":"                session.query(VxlanAllocation).filter("},{"line_number":173,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":174,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":175,"context_line":"            # collect vnis that need to be added"},{"line_number":176,"context_line":"            vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":177,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_b4505633","line":174,"in_reply_to":"1ae5cdf2_2b006933","updated":"2014-06-11 06:48:13.000000000","message":"thanks, replied in previous PS","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8734715bb759f2c459469b11efe8d297458fd2d5","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":174,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":175,"context_line":"            # collect vnis that need to be added"},{"line_number":176,"context_line":"            vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":177,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"},{"line_number":178,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":179,"context_line":"                        for vni in vni_list]"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_c83470fd","line":176,"updated":"2014-06-10 23:51:38.000000000","message":"chunked_vnis \u003d (vnis[i:i + bulk_size] for i in range(0, len(vnis), bulk_size))","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8734715bb759f2c459469b11efe8d297458fd2d5","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":174,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":175,"context_line":"            # collect vnis that need to be added"},{"line_number":176,"context_line":"            vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":177,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"},{"line_number":178,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":179,"context_line":"                        for vni in vni_list]"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_e83bece8","line":176,"updated":"2014-06-10 23:51:38.000000000","message":"so returning to original is best here","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f8b0025a179be68214a331caff869851afbd3738","unresolved":false,"context_lines":[{"line_number":173,"context_line":"                    VxlanAllocation.vxlan_vni.in_(vni_list)).delete("},{"line_number":174,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":175,"context_line":"            # collect vnis that need to be added"},{"line_number":176,"context_line":"            vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":177,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"},{"line_number":178,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":179,"context_line":"                        for vni in vni_list]"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_f4465e7a","line":176,"in_reply_to":"1ae5cdf2_e83bece8","updated":"2014-06-11 06:48:13.000000000","message":"Done","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"8734715bb759f2c459469b11efe8d297458fd2d5","unresolved":false,"context_lines":[{"line_number":174,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":175,"context_line":"            # collect vnis that need to be added"},{"line_number":176,"context_line":"            vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":177,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"},{"line_number":178,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":179,"context_line":"                        for vni in vni_list]"},{"line_number":180,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_083f38d7","line":177,"updated":"2014-06-10 23:51:38.000000000","message":"for vni_list in chunked_vnis:","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f8b0025a179be68214a331caff869851afbd3738","unresolved":false,"context_lines":[{"line_number":174,"context_line":"                        synchronize_session\u003dFalse)"},{"line_number":175,"context_line":"            # collect vnis that need to be added"},{"line_number":176,"context_line":"            vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":177,"context_line":"            for vni_list in utils.each_slice_in_list(vnis, bulk_size):"},{"line_number":178,"context_line":"                bulk \u003d [{\u0027vxlan_vni\u0027: vni, \u0027allocated\u0027: False}"},{"line_number":179,"context_line":"                        for vni in vni_list]"},{"line_number":180,"context_line":"                session.execute(VxlanAllocation.__table__.insert(), bulk)"}],"source_content_type":"text/x-python","patch_set":7,"id":"1ae5cdf2_145f4a42","line":177,"in_reply_to":"1ae5cdf2_083f38d7","updated":"2014-06-11 06:48:13.000000000","message":"Done","commit_id":"3b46dc7a9fc6d0165a9d0103dbf624f3564e34d6"}]}
