)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"8290c42a59c28c23876385cef01eff6f7df7bb33","unresolved":false,"context_lines":[{"line_number":5,"context_line":"CommitDate: 2014-12-12 15:34:02 -0700"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Allocate segment id from a pool of available ids"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Attempt to allocate a network segment id from a pool of unallocated"},{"line_number":10,"context_line":"ids.  This is done because multiple network create requests across"},{"line_number":11,"context_line":"multiple processes can result in a race condition where the same"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"3a961159_bc753499","line":8,"updated":"2015-01-08 10:01:51.000000000","message":"I think this needs rewording a bit. The previous code actually had an attempt to protect against this with the DB_MAX_ATTEMPTS and retry logic. It was supposed to do precisely what you describe here in the commit message.\n\nIt took me a while to understand why it looked like you were rewriting the same protection that\nwas already there but in a different way. After looking at the patch for I while I can see the previous protection was broken.\n\nPlease reword this to indicate that it\u0027s a fix for the retry logic that didn\u0027t work since it was performing repeated selects in the same transaction, which meant that it ended up returning the same segment every time instead of the next available one as the original author intended.","commit_id":"cab6b8d524a8764c788e2e2cea40561a580a786e"}],"neutron/plugins/ml2/drivers/helpers.py":[{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"ccd05746ed11e495e619a303f67620cefe4bf5cf","unresolved":false,"context_lines":[{"line_number":109,"context_line":"            # Selected segment can be allocated by another process before this"},{"line_number":110,"context_line":"            # transaction completes so continue trying from a pool of"},{"line_number":111,"context_line":"            # unallocated segments until successful."},{"line_number":112,"context_line":"            unallocated_pool \u003d select.limit(UNALLOCATED_SEGMENT_POOL_SIZE)"},{"line_number":113,"context_line":"            for alloc in unallocated_pool:"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"                if not alloc:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_89be87ac","line":112,"updated":"2014-12-12 20:14:44.000000000","message":"unallocated_pool is ambiguous as it does not contain all unallocated networks, \"candidates\" seems better.\n\nIt seem (at least with mysql/postgres) selects return the same result over and over if no change is done in the db and quite the same result if few changes are done ... so many concurrent select.limit(x) will return unallocated_pools with a big overlap.\n\nA select with randomly order will reduce such overlap, but it seems there is no unified way in sqlalchemy[1] to use a random order and it increases sql query cost.\n\n\n\n[1]http://stackoverflow.com/questions/60805/getting-random-row-through-sqlalchemy (it\u0027s quite old)","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":5209,"name":"Ed Bak","email":"ed.bak2@hpe.com","username":"ed-bak2"},"change_message_id":"bb18e6614d0734fc65af82dfe0a97454684e9abc","unresolved":false,"context_lines":[{"line_number":109,"context_line":"            # Selected segment can be allocated by another process before this"},{"line_number":110,"context_line":"            # transaction completes so continue trying from a pool of"},{"line_number":111,"context_line":"            # unallocated segments until successful."},{"line_number":112,"context_line":"            unallocated_pool \u003d select.limit(UNALLOCATED_SEGMENT_POOL_SIZE)"},{"line_number":113,"context_line":"            for alloc in unallocated_pool:"},{"line_number":114,"context_line":""},{"line_number":115,"context_line":"                if not alloc:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_150f0438","line":112,"in_reply_to":"3a961159_89be87ac","updated":"2014-12-12 22:31:05.000000000","message":"Changed unallocated_pool to candidate_pool","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"ccd05746ed11e495e619a303f67620cefe4bf5cf","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                         filter_by(allocated\u003dFalse, **raw_segment)."},{"line_number":122,"context_line":"                         update({\"allocated\": True}))"},{"line_number":123,"context_line":"                if count:"},{"line_number":124,"context_line":"                    LOG.debug(\"%(type)s segment %(segment)s allocated \""},{"line_number":125,"context_line":"                              \"from pool \","},{"line_number":126,"context_line":"                              {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":127,"context_line":"                    return alloc"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_89ecc7bc","line":124,"updated":"2014-12-12 20:14:44.000000000","message":"i prefer previous log because if multiple allocation are done concurrently, it will be a mess to understand what appends.","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":5209,"name":"Ed Bak","email":"ed.bak2@hpe.com","username":"ed-bak2"},"change_message_id":"bb18e6614d0734fc65af82dfe0a97454684e9abc","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                         filter_by(allocated\u003dFalse, **raw_segment)."},{"line_number":122,"context_line":"                         update({\"allocated\": True}))"},{"line_number":123,"context_line":"                if count:"},{"line_number":124,"context_line":"                    LOG.debug(\"%(type)s segment %(segment)s allocated \""},{"line_number":125,"context_line":"                              \"from pool \","},{"line_number":126,"context_line":"                              {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":127,"context_line":"                    return alloc"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_a0027007","line":124,"in_reply_to":"3a961159_89ecc7bc","updated":"2014-12-12 22:31:05.000000000","message":"I\u0027m not exactly sure what you mean here, but I added back a LOG.debug prior to the update.  If that\u0027s not what you\u0027re looking for, let me know.","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"ccd05746ed11e495e619a303f67620cefe4bf5cf","unresolved":false,"context_lines":[{"line_number":126,"context_line":"                              {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":127,"context_line":"                    return alloc"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"                # Segment allocated by another process since select"},{"line_number":130,"context_line":"                LOG.debug(\"Allocate %(type)s segment %(segment)s from pool \""},{"line_number":131,"context_line":"                          \"failed, trying another segment \","},{"line_number":132,"context_line":"                          {\"type\": network_type, \"segment\": raw_segment})"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_a9634340","line":129,"updated":"2014-12-12 20:14:44.000000000","message":"provide no new information and is in general false","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":5209,"name":"Ed Bak","email":"ed.bak2@hpe.com","username":"ed-bak2"},"change_message_id":"bb18e6614d0734fc65af82dfe0a97454684e9abc","unresolved":false,"context_lines":[{"line_number":126,"context_line":"                              {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":127,"context_line":"                    return alloc"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":"                # Segment allocated by another process since select"},{"line_number":130,"context_line":"                LOG.debug(\"Allocate %(type)s segment %(segment)s from pool \""},{"line_number":131,"context_line":"                          \"failed, trying another segment \","},{"line_number":132,"context_line":"                          {\"type\": network_type, \"segment\": raw_segment})"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_601c086b","line":129,"in_reply_to":"3a961159_a9634340","updated":"2014-12-12 22:31:05.000000000","message":"Removed the comment","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"ccd05746ed11e495e619a303f67620cefe4bf5cf","unresolved":false,"context_lines":[{"line_number":128,"context_line":""},{"line_number":129,"context_line":"                # Segment allocated by another process since select"},{"line_number":130,"context_line":"                LOG.debug(\"Allocate %(type)s segment %(segment)s from pool \""},{"line_number":131,"context_line":"                          \"failed, trying another segment \","},{"line_number":132,"context_line":"                          {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        LOG.warning(_LW(\"Allocate %(type)s segment from pool failed \""}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_49249f0c","line":131,"updated":"2014-12-12 20:14:44.000000000","message":"itto","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":5209,"name":"Ed Bak","email":"ed.bak2@hpe.com","username":"ed-bak2"},"change_message_id":"bb18e6614d0734fc65af82dfe0a97454684e9abc","unresolved":false,"context_lines":[{"line_number":128,"context_line":""},{"line_number":129,"context_line":"                # Segment allocated by another process since select"},{"line_number":130,"context_line":"                LOG.debug(\"Allocate %(type)s segment %(segment)s from pool \""},{"line_number":131,"context_line":"                          \"failed, trying another segment \","},{"line_number":132,"context_line":"                          {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        LOG.warning(_LW(\"Allocate %(type)s segment from pool failed \""}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_a029908b","line":131,"in_reply_to":"3a961159_49249f0c","updated":"2014-12-12 22:31:05.000000000","message":"Not sure what you mean??","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"ccd05746ed11e495e619a303f67620cefe4bf5cf","unresolved":false,"context_lines":[{"line_number":132,"context_line":"                          {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        LOG.warning(_LW(\"Allocate %(type)s segment from pool failed \""},{"line_number":135,"context_line":"                        \"for all segments \"),"},{"line_number":136,"context_line":"                    {\"type\": network_type})"},{"line_number":137,"context_line":"        raise exc.NoNetworkFoundInMaximumAllowedAttempts()"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_c90a4f89","line":135,"updated":"2014-12-12 20:14:44.000000000","message":"all?","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":5209,"name":"Ed Bak","email":"ed.bak2@hpe.com","username":"ed-bak2"},"change_message_id":"bb18e6614d0734fc65af82dfe0a97454684e9abc","unresolved":false,"context_lines":[{"line_number":132,"context_line":"                          {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"        LOG.warning(_LW(\"Allocate %(type)s segment from pool failed \""},{"line_number":135,"context_line":"                        \"for all segments \"),"},{"line_number":136,"context_line":"                    {\"type\": network_type})"},{"line_number":137,"context_line":"        raise exc.NoNetworkFoundInMaximumAllowedAttempts()"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_e01f1859","line":135,"in_reply_to":"3a961159_c90a4f89","updated":"2014-12-12 22:31:05.000000000","message":"Removed the all","commit_id":"81d68ff13187cde6c165645fc9a7eca482633af6"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"d8efc807f34dfd61fd84a462883ef4bbdd20761d","unresolved":false,"context_lines":[{"line_number":109,"context_line":"            # Selected segment can be allocated by another process before this"},{"line_number":110,"context_line":"            # transaction completes so continue trying from a pool of"},{"line_number":111,"context_line":"            # unallocated segments until successful."},{"line_number":112,"context_line":"            candidate_pool \u003d select.limit(CANDIDATE_SEGMENT_POOL_SIZE).all()"},{"line_number":113,"context_line":"            if not len(candidate_pool):"},{"line_number":114,"context_line":"                # No segment available"},{"line_number":115,"context_line":"                return"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_e0aab883","line":112,"updated":"2014-12-12 22:45:20.000000000","message":"candidate_pool do not solve the trouble, it\u0027s still unclear what \"pool\" in log messages refers to .. is it segment pool or unallocated_pool?\n\ncandidates avoids such ambiguity","commit_id":"cab6b8d524a8764c788e2e2cea40561a580a786e"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"d8efc807f34dfd61fd84a462883ef4bbdd20761d","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            # transaction completes so continue trying from a pool of"},{"line_number":111,"context_line":"            # unallocated segments until successful."},{"line_number":112,"context_line":"            candidate_pool \u003d select.limit(CANDIDATE_SEGMENT_POOL_SIZE).all()"},{"line_number":113,"context_line":"            if not len(candidate_pool):"},{"line_number":114,"context_line":"                # No segment available"},{"line_number":115,"context_line":"                return"},{"line_number":116,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_20984077","line":113,"updated":"2014-12-12 22:45:20.000000000","message":"len() seems not needed","commit_id":"cab6b8d524a8764c788e2e2cea40561a580a786e"},{"author":{"_account_id":12683,"name":"KaiLin","email":"linkai3@huawei.com","username":"LinKai"},"change_message_id":"04a4bd700600786fbf32c7d688081c69843cdb77","unresolved":false,"context_lines":[{"line_number":110,"context_line":"            # transaction completes so continue trying from a pool of"},{"line_number":111,"context_line":"            # unallocated segments until successful."},{"line_number":112,"context_line":"            candidate_pool \u003d select.limit(CANDIDATE_SEGMENT_POOL_SIZE).all()"},{"line_number":113,"context_line":"            if not len(candidate_pool):"},{"line_number":114,"context_line":"                # No segment available"},{"line_number":115,"context_line":"                return"},{"line_number":116,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_fa99876d","line":113,"in_reply_to":"3a961159_20984077","updated":"2015-01-08 02:23:22.000000000","message":"+1","commit_id":"cab6b8d524a8764c788e2e2cea40561a580a786e"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"d8efc807f34dfd61fd84a462883ef4bbdd20761d","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                         filter_by(allocated\u003dFalse, **raw_segment)."},{"line_number":124,"context_line":"                         update({\"allocated\": True}))"},{"line_number":125,"context_line":"                if count:"},{"line_number":126,"context_line":"                    LOG.debug(\"%(type)s segment %(segment)s allocated \""},{"line_number":127,"context_line":"                              \"from pool \","},{"line_number":128,"context_line":"                              {\"type\": network_type, \"segment\": raw_segment})"},{"line_number":129,"context_line":"                    return alloc"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_c08e9c2d","line":126,"updated":"2014-12-12 22:45:20.000000000","message":"with many concurrent segment allocations at the same time, you will see with debug enabled:\n\n  Attempting gre segment $segment-descX allocation\n  Attempting gre segment $segment-descY allocation\n  Attempting gre segment $segment-descZ allocation\n  ...\n  Attempting gre segment $segment-descZ allocation\n  ...\n\nyou won\u0027t see how many candidates are required to finally find the ONE except if you reach L135. logging \"attempt\" avoids such trouble.","commit_id":"cab6b8d524a8764c788e2e2cea40561a580a786e"}]}
