)]}'
{"neutron/plugins/ml2/drivers/type_vxlan.py":[{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"026977fa618d5f7588236ed6b6d174d6bd24b1e3","unresolved":false,"context_lines":[{"line_number":161,"context_line":"            existing_vnis \u003d set(alloc.vxlan_vni for alloc in allocs)"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"            # delete those vnis that needs to be deleted from db"},{"line_number":164,"context_line":"            betweens \u003d [sa.between(VxlanAllocation.vxlan_vni, lo, hi)"},{"line_number":165,"context_line":"                        for lo, hi in self.vxlan_vni_ranges]"},{"line_number":166,"context_line":"            (session.query(VxlanAllocation)."},{"line_number":167,"context_line":"             filter_by(allocated\u003dFalse)."}],"source_content_type":"text/x-python","patch_set":1,"id":"1ae5cdf2_c0b10503","line":164,"updated":"2014-06-23 19:36:22.000000000","message":"that logic only accounts for ranges in configuration, which may less wide than what\u0027s in db.","commit_id":"3c86066e181235bb5a2827b271a7cf9929d1da38"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"8317b5e6edbe42ac42bc540e58c8c65f4505b90e","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":155,"context_line":"            # remove from table unallocated tunnels not currently allocatable"},{"line_number":156,"context_line":"            # fetch results as list via all() because we\u0027ll be iterating"},{"line_number":157,"context_line":"            # through them twice"},{"line_number":158,"context_line":"            allocs \u003d (session.query(VxlanAllocation)."},{"line_number":159,"context_line":"                      with_lockmode(\"update\").all())"},{"line_number":160,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"1ae5cdf2_ce34cfae","line":157,"updated":"2014-06-23 22:51:38.000000000","message":"this comment needs update","commit_id":"182d35796047c8e5b48ec2befb15c24fe56b372a"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"771193439dac53a6a5476126f4f6fb53eba76dcd","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":155,"context_line":"            # remove from table unallocated tunnels not currently allocatable"},{"line_number":156,"context_line":"            # fetch results as list via all() because we\u0027ll be iterating"},{"line_number":157,"context_line":"            # through them twice"},{"line_number":158,"context_line":"            allocs \u003d (session.query(VxlanAllocation)."},{"line_number":159,"context_line":"                      with_lockmode(\"update\").all())"},{"line_number":160,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"1ae5cdf2_b3c7b145","line":157,"in_reply_to":"1ae5cdf2_ce34cfae","updated":"2014-06-25 07:52:20.000000000","message":"Done","commit_id":"182d35796047c8e5b48ec2befb15c24fe56b372a"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"4f2de63aea714a6277d3ac7b789e7e1e345eeab9","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":155,"context_line":"            # Select all tunnels"},{"line_number":156,"context_line":"            allocs \u003d (session.query(VxlanAllocation)."},{"line_number":157,"context_line":"                      with_lockmode(\"update\").all())"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"            # Delete obsolete unallocated tunnels"},{"line_number":160,"context_line":"            query \u003d session.query(VxlanAllocation).filter_by(allocated\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1ae5cdf2_d7fc28b8","line":157,"range":{"start_line":157,"start_character":22,"end_line":157,"end_character":45},"updated":"2014-06-25 08:18:43.000000000","message":"is this \"for update\" still useful?","commit_id":"10c9bdc4bebfcef0d105e60ff1596e843ff5d9b5"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"400e8e01891028f3f786be68ff0618686e99de89","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":155,"context_line":"            # Select all tunnels"},{"line_number":156,"context_line":"            allocs \u003d (session.query(VxlanAllocation)."},{"line_number":157,"context_line":"                      with_lockmode(\"update\").all())"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"            # Delete obsolete unallocated tunnels"},{"line_number":160,"context_line":"            query \u003d session.query(VxlanAllocation).filter_by(allocated\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1ae5cdf2_eafe4969","line":157,"in_reply_to":"1ae5cdf2_3aaa9185","updated":"2014-06-27 03:32:06.000000000","message":"nits:  This could move down to just before L169.  Maybe even inline it but I don\u0027t care either way about inlining.  You can also get rid of the call to .all().  I think that would improve the flow a bit.\n\nallocs \u003d session.query(VxlanAllocation).with_lockmode(\"update\")","commit_id":"10c9bdc4bebfcef0d105e60ff1596e843ff5d9b5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"304bceb5ece40fb0ca87e2394e3032655c79938c","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":155,"context_line":"            # Select all tunnels"},{"line_number":156,"context_line":"            allocs \u003d (session.query(VxlanAllocation)."},{"line_number":157,"context_line":"                      with_lockmode(\"update\").all())"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"            # Delete obsolete unallocated tunnels"},{"line_number":160,"context_line":"            query \u003d session.query(VxlanAllocation).filter_by(allocated\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1ae5cdf2_3aaa9185","line":157,"in_reply_to":"1ae5cdf2_d7fc28b8","updated":"2014-06-25 08:53:46.000000000","message":"It is still required because of https://bugs.launchpad.net/neutron/+bug/1307295","commit_id":"10c9bdc4bebfcef0d105e60ff1596e843ff5d9b5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"6efdd559a8134f0c48bc601c6ca7bd7953211600","unresolved":false,"context_lines":[{"line_number":154,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":155,"context_line":"            # Select all tunnels"},{"line_number":156,"context_line":"            allocs \u003d (session.query(VxlanAllocation)."},{"line_number":157,"context_line":"                      with_lockmode(\"update\").all())"},{"line_number":158,"context_line":""},{"line_number":159,"context_line":"            # Delete obsolete unallocated tunnels"},{"line_number":160,"context_line":"            query \u003d session.query(VxlanAllocation).filter_by(allocated\u003dFalse)"}],"source_content_type":"text/x-python","patch_set":3,"id":"1ae5cdf2_a068ddf4","line":157,"in_reply_to":"1ae5cdf2_eafe4969","updated":"2014-06-27 09:42:44.000000000","message":"Done\n\nI also replace VxlanAllocation select by VxlanAllocation.vxlan_vni select to reduce ORM object construction cost.","commit_id":"10c9bdc4bebfcef0d105e60ff1596e843ff5d9b5"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"400e8e01891028f3f786be68ff0618686e99de89","unresolved":false,"context_lines":[{"line_number":160,"context_line":"            query \u003d session.query(VxlanAllocation).filter_by(allocated\u003dFalse)"},{"line_number":161,"context_line":"            if self.vxlan_vni_ranges:"},{"line_number":162,"context_line":"                betweens \u003d [sa.between(VxlanAllocation.vxlan_vni, lo, hi)"},{"line_number":163,"context_line":"                            for lo, hi in self.vxlan_vni_ranges]"},{"line_number":164,"context_line":"                query \u003d query.filter(sa.not_(sa.or_(*betweens)))"},{"line_number":165,"context_line":"            query.delete(synchronize_session\u003dFalse)"},{"line_number":166,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1ae5cdf2_2a6e7196","line":163,"updated":"2014-06-27 03:32:06.000000000","message":"Do you know how the BETWEEN operator behaves with various db engines with respect to the inclusivity of the boundary test values?  I\u0027m a little concerned because the following link indicates that it is not consistent.  See the notice near the bottom.\n\nhttp://www.w3schools.com/sql/sql_between.asp\n\nIf this proves true then we may need to replace betweens with explicit ranges (e.g. lo \u003c\u003d id and id \u003c\u003dhigh)\n\nWhat are your thoughts?","commit_id":"10c9bdc4bebfcef0d105e60ff1596e843ff5d9b5"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"6efdd559a8134f0c48bc601c6ca7bd7953211600","unresolved":false,"context_lines":[{"line_number":160,"context_line":"            query \u003d session.query(VxlanAllocation).filter_by(allocated\u003dFalse)"},{"line_number":161,"context_line":"            if self.vxlan_vni_ranges:"},{"line_number":162,"context_line":"                betweens \u003d [sa.between(VxlanAllocation.vxlan_vni, lo, hi)"},{"line_number":163,"context_line":"                            for lo, hi in self.vxlan_vni_ranges]"},{"line_number":164,"context_line":"                query \u003d query.filter(sa.not_(sa.or_(*betweens)))"},{"line_number":165,"context_line":"            query.delete(synchronize_session\u003dFalse)"},{"line_number":166,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"1ae5cdf2_e06bc51c","line":163,"in_reply_to":"1ae5cdf2_2a6e7196","updated":"2014-06-27 09:42:44.000000000","message":"postgres, mysql and sqlite have coherent behaviour (tested):\n\n  x BETWEEN lo and hi \u003d\u003d\u003d lo \u003c\u003d x \u003c\u003d hi\n\ndb2 also (according to docs).\n\nAccording to my benchmarks, between is faster than and(lo \u003c\u003d x, x \u003c\u003d hi) by the performance impact but the time impact seems small and really small compared to replacing select VxlanAllocation by select VxlanAllocation.vxlan","commit_id":"10c9bdc4bebfcef0d105e60ff1596e843ff5d9b5"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"10ccbb0b98255e6da9a894156c5f24889d027799","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"            # Select existing vxlan vnis"},{"line_number":165,"context_line":"            # lockmode is required to avoid concurrent insertions done by"},{"line_number":166,"context_line":"            # concurrent sync allocation or provider network create"},{"line_number":167,"context_line":"            allocs \u003d (session.query(VxlanAllocation.vxlan_vni)."},{"line_number":168,"context_line":"                      with_lockmode(\"update\"))"},{"line_number":169,"context_line":"            existing_vnis \u003d set(alloc[0] for alloc in allocs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"dab895d6_70c72813","line":166,"updated":"2014-06-30 08:43:18.000000000","message":"select for update only locks selected rows.\ni don\u0027t think it prevents contenders from inserting new rows.","commit_id":"8eeff7b54cf421c3babbd097b7f17935c2d79187"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"6942bae67c2d2429aa64044cc706f90b943903ce","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"            # Select existing vxlan vnis"},{"line_number":165,"context_line":"            # lockmode is required to avoid concurrent insertions done by"},{"line_number":166,"context_line":"            # concurrent sync allocation or provider network create"},{"line_number":167,"context_line":"            allocs \u003d (session.query(VxlanAllocation.vxlan_vni)."},{"line_number":168,"context_line":"                      with_lockmode(\"update\"))"},{"line_number":169,"context_line":"            existing_vnis \u003d set(alloc[0] for alloc in allocs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_09b96e2e","line":166,"in_reply_to":"baada198_5331530a","updated":"2014-06-30 20:40:09.000000000","message":"i will clarify how select for update ensure a unique sync at a time","commit_id":"8eeff7b54cf421c3babbd097b7f17935c2d79187"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"af0dfce9570b3008567ae718d2e5ae0674985ad8","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"            # Select existing vxlan vnis"},{"line_number":165,"context_line":"            # lockmode is required to avoid concurrent insertions done by"},{"line_number":166,"context_line":"            # concurrent sync allocation or provider network create"},{"line_number":167,"context_line":"            allocs \u003d (session.query(VxlanAllocation.vxlan_vni)."},{"line_number":168,"context_line":"                      with_lockmode(\"update\"))"},{"line_number":169,"context_line":"            existing_vnis \u003d set(alloc[0] for alloc in allocs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_8912de60","line":166,"in_reply_to":"baada198_5331530a","updated":"2014-06-30 21:05:54.000000000","message":"isn\u0027t there a case where the table has no rows?","commit_id":"8eeff7b54cf421c3babbd097b7f17935c2d79187"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"0126c83a0529cc9ba0da495e679ad88e2fe847d0","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"            # Select existing vxlan vnis"},{"line_number":165,"context_line":"            # lockmode is required to avoid concurrent insertions done by"},{"line_number":166,"context_line":"            # concurrent sync allocation or provider network create"},{"line_number":167,"context_line":"            allocs \u003d (session.query(VxlanAllocation.vxlan_vni)."},{"line_number":168,"context_line":"                      with_lockmode(\"update\"))"},{"line_number":169,"context_line":"            existing_vnis \u003d set(alloc[0] for alloc in allocs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"dab895d6_909597e6","line":166,"in_reply_to":"dab895d6_70c72813","updated":"2014-06-30 11:19:34.000000000","message":"It implies https://bugs.launchpad.net/neutron/+bug/1307295 is not solved for postgres (mysql lock the table).","commit_id":"8eeff7b54cf421c3babbd097b7f17935c2d79187"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"0c89ebadc0b3e6c862696aef2b2f8222b6bb11b1","unresolved":false,"context_lines":[{"line_number":163,"context_line":""},{"line_number":164,"context_line":"            # Select existing vxlan vnis"},{"line_number":165,"context_line":"            # lockmode is required to avoid concurrent insertions done by"},{"line_number":166,"context_line":"            # concurrent sync allocation or provider network create"},{"line_number":167,"context_line":"            allocs \u003d (session.query(VxlanAllocation.vxlan_vni)."},{"line_number":168,"context_line":"                      with_lockmode(\"update\"))"},{"line_number":169,"context_line":"            existing_vnis \u003d set(alloc[0] for alloc in allocs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_5331530a","line":166,"in_reply_to":"dab895d6_909597e6","updated":"2014-06-30 19:57:56.000000000","message":"That should work for postgres since the query locks every row in a table and another process will just block on the first locked row.","commit_id":"8eeff7b54cf421c3babbd097b7f17935c2d79187"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"df3dc9c342f37ae041a49301d742e7844d1172bd","unresolved":false,"context_lines":[{"line_number":165,"context_line":"            # lockmode is required to avoid concurrent insertions done by"},{"line_number":166,"context_line":"            # concurrent sync allocation or provider network create"},{"line_number":167,"context_line":"            allocs \u003d (session.query(VxlanAllocation.vxlan_vni)."},{"line_number":168,"context_line":"                      with_lockmode(\"update\"))"},{"line_number":169,"context_line":"            existing_vnis \u003d set(alloc[0] for alloc in allocs)"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"            # Create missing tunnels using previous select result"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_4fab4ad6","line":168,"updated":"2014-07-09 11:40:35.000000000","message":"select for update will block other concurrent insertion until this method terminates, but will not prevent them. transaction isolation should ensure in my opinion that you won\u0027t get those in this query, but other reports suggested this will happen instead with postgres.\n\nSo my question is... even if we have concurrent insertions, what could be the problem? I think the fact they\u0027re in range is validate when they\u0027re inserted, isn\u0027t it?","commit_id":"8eeff7b54cf421c3babbd097b7f17935c2d79187"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"533ff9f24c9026132fd0eb7f87b042070e9530ed","unresolved":false,"context_lines":[{"line_number":165,"context_line":"            # lockmode is required to avoid concurrent insertions done by"},{"line_number":166,"context_line":"            # concurrent sync allocation or provider network create"},{"line_number":167,"context_line":"            allocs \u003d (session.query(VxlanAllocation.vxlan_vni)."},{"line_number":168,"context_line":"                      with_lockmode(\"update\"))"},{"line_number":169,"context_line":"            existing_vnis \u003d set(alloc[0] for alloc in allocs)"},{"line_number":170,"context_line":""},{"line_number":171,"context_line":"            # Create missing tunnels using previous select result"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_4536c9e8","line":168,"in_reply_to":"baada198_4fab4ad6","updated":"2014-07-09 12:34:03.000000000","message":"i am working on a version without SELECT FOR UPDATE (same principle as https://review.openstack.org/#/c/71904/21/neutron/plugins/ml2/drivers/helpers.py).\n\nWithout bulk mode, if an insert fails, it implies someone else already insert it \u003d\u003d\u003eOK\n\nBut with bulk mode if an insert fails, it implies someone else already insert at least one for the vxlan in the bulk, others vxlan are not inserted \u003d\u003d\u003e KO, we need to iterate","commit_id":"8eeff7b54cf421c3babbd097b7f17935c2d79187"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"222aab318a533831764d5cd779622928ff247c32","unresolved":false,"context_lines":[{"line_number":194,"context_line":"            else:"},{"line_number":195,"context_line":"                count \u003d query.count()"},{"line_number":196,"context_line":"                if count !\u003d len(vxlan_vnis):"},{"line_number":197,"context_line":"                    LOG.critical(_(\"Failed to populate vxlan pools after %s \""},{"line_number":198,"context_line":"                                 \"retries\"), helpers.DB_MAX_RETRIES)"},{"line_number":199,"context_line":"                    raise SystemExit(1)"},{"line_number":200,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_489b12c9","line":197,"updated":"2014-07-10 13:36:13.000000000","message":"please use the logging hint _LC here","commit_id":"6754cdff3563406b38429f20da85973f60903721"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"0256b863cffd43352232fa589396e48ada3fa1a5","unresolved":false,"context_lines":[{"line_number":188,"context_line":"                    try:"},{"line_number":189,"context_line":"                        session.execute(VxlanAllocation.__table__.insert(),"},{"line_number":190,"context_line":"                                        bulk)"},{"line_number":191,"context_line":"                    except db_exc.DBError:"},{"line_number":192,"context_line":"                        # someone else inserted a tunnel in bulk"},{"line_number":193,"context_line":"                        pass"},{"line_number":194,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_a0ce292b","line":191,"range":{"start_line":191,"start_character":34,"end_line":191,"end_character":41},"updated":"2014-07-14 05:19:40.000000000","message":"can this be more specific?  e.g. DBDuplicateEntry","commit_id":"d50012d356044bc88a8be567f3760cdf73b3f386"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"a11bcbde502cfc18d4dcc613dfbff0a7385b1d0b","unresolved":false,"context_lines":[{"line_number":188,"context_line":"                    try:"},{"line_number":189,"context_line":"                        session.execute(VxlanAllocation.__table__.insert(),"},{"line_number":190,"context_line":"                                        bulk)"},{"line_number":191,"context_line":"                    except db_exc.DBError:"},{"line_number":192,"context_line":"                        # someone else inserted a tunnel in bulk"},{"line_number":193,"context_line":"                        pass"},{"line_number":194,"context_line":"            else:"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_8493eea1","line":191,"in_reply_to":"baada198_a0ce292b","updated":"2014-07-14 11:25:00.000000000","message":"It seems not to work with sqlite on my computer ... but it has not impact on tests \u003d\u003d\u003e will do.","commit_id":"d50012d356044bc88a8be567f3760cdf73b3f386"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"5f68c748962428bbb1e578a06ef39ca5a7e7d825","unresolved":false,"context_lines":[{"line_number":152,"context_line":"                            \"%(tun_min)s:%(tun_max)s\"),"},{"line_number":153,"context_line":"                          {\u0027tun_min\u0027: tun_min, \u0027tun_max\u0027: tun_max})"},{"line_number":154,"context_line":"            else:"},{"line_number":155,"context_line":"                vxlan_vnis |\u003d set(xrange(tun_min, tun_max + 1))"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"        session \u003d db_api.get_session()"},{"line_number":158,"context_line":"        with session.begin(subtransactions\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_c081f9c4","line":155,"updated":"2014-07-16 09:09:56.000000000","message":"could you please use moves.xrange() for compatibility with Python 3?","commit_id":"5c56f6f79eedc204235f8ea1479872f68cdf50f2"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"2b67e7ded6e5b8c2fb6c07e50f8053e765a1bea9","unresolved":false,"context_lines":[{"line_number":152,"context_line":"                            \"%(tun_min)s:%(tun_max)s\"),"},{"line_number":153,"context_line":"                          {\u0027tun_min\u0027: tun_min, \u0027tun_max\u0027: tun_max})"},{"line_number":154,"context_line":"            else:"},{"line_number":155,"context_line":"                vxlan_vnis |\u003d set(xrange(tun_min, tun_max + 1))"},{"line_number":156,"context_line":""},{"line_number":157,"context_line":"        session \u003d db_api.get_session()"},{"line_number":158,"context_line":"        with session.begin(subtransactions\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_1b499832","line":155,"in_reply_to":"baada198_c081f9c4","updated":"2014-07-16 12:41:42.000000000","message":"Done","commit_id":"5c56f6f79eedc204235f8ea1479872f68cdf50f2"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"4bf3b72f48da7687b620d319fdd9b86a67658e52","unresolved":false,"context_lines":[{"line_number":174,"context_line":"            # population or DB_MAX_RETRIES retries"},{"line_number":175,"context_line":"            bulk_size \u003d 100"},{"line_number":176,"context_line":"            query \u003d session.query(VxlanAllocation.vxlan_vni).filter(criteria)"},{"line_number":177,"context_line":"            for i in range(helpers.DB_MAX_RETRIES):"},{"line_number":178,"context_line":"                existing_vnis \u003d set(x[0] for x in query.all())"},{"line_number":179,"context_line":"                vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":180,"context_line":"                if not vnis:"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_c4dec6d9","line":177,"updated":"2014-07-14 11:40:05.000000000","message":"I\u0027d prefer explicit locking here, which actually solves the issue in simpler manner.\n\nThe better and full solution would be to do initialization only once. That would require some more changes - either separate table on which to lock on, or a conf option to set master role for a server to do initialization.\n\nThe proposed code seems to be quite confusing and complex, just because it tries to solve concurrency issue that appears only at startup. I\u0027d go for simple code here.","commit_id":"5c56f6f79eedc204235f8ea1479872f68cdf50f2"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"70e3ab480109279655b6242564ef56c015f4f2db","unresolved":false,"context_lines":[{"line_number":174,"context_line":"            # population or DB_MAX_RETRIES retries"},{"line_number":175,"context_line":"            bulk_size \u003d 100"},{"line_number":176,"context_line":"            query \u003d session.query(VxlanAllocation.vxlan_vni).filter(criteria)"},{"line_number":177,"context_line":"            for i in range(helpers.DB_MAX_RETRIES):"},{"line_number":178,"context_line":"                existing_vnis \u003d set(x[0] for x in query.all())"},{"line_number":179,"context_line":"                vnis \u003d list(vxlan_vnis - existing_vnis)"},{"line_number":180,"context_line":"                if not vnis:"}],"source_content_type":"text/x-python","patch_set":7,"id":"baada198_425b7c53","line":177,"in_reply_to":"baada198_c4dec6d9","updated":"2014-07-14 16:13:36.000000000","message":"In multiple changes, removing SELECT FOR UPDATE has be requested. Moreover - as Yamamoto pointed out - current locking is not working with postgresql if vxlan table is empty.","commit_id":"5c56f6f79eedc204235f8ea1479872f68cdf50f2"}]}
