)]}'
{"ceilometer/service.py":[{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":42,"context_line":"                    default\u003d[\u0027database\u0027],"},{"line_number":43,"context_line":"                    help\u003d\u0027Dispatcher to process data.\u0027),"},{"line_number":44,"context_line":"    cfg.IntOpt(\u0027collector_workers\u0027,"},{"line_number":45,"context_line":"               default\u003d2,"},{"line_number":46,"context_line":"               help\u003d\u0027Number of workers for collector service. A single \u0027"},{"line_number":47,"context_line":"               \u0027collector is enabled by default.\u0027),"},{"line_number":48,"context_line":"    cfg.IntOpt(\u0027notification_workers\u0027,"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_204c4870","line":45,"updated":"2014-05-02 11:33:14.000000000","message":"Wondering about this choice of default value, wasn\u0027t it previously set equal to the number of CPUs?","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"8aabae4ebdf9b45aee59d0e163bf57d315b7fe15","unresolved":false,"context_lines":[{"line_number":42,"context_line":"                    default\u003d[\u0027database\u0027],"},{"line_number":43,"context_line":"                    help\u003d\u0027Dispatcher to process data.\u0027),"},{"line_number":44,"context_line":"    cfg.IntOpt(\u0027collector_workers\u0027,"},{"line_number":45,"context_line":"               default\u003d2,"},{"line_number":46,"context_line":"               help\u003d\u0027Number of workers for collector service. A single \u0027"},{"line_number":47,"context_line":"               \u0027collector is enabled by default.\u0027),"},{"line_number":48,"context_line":"    cfg.IntOpt(\u0027notification_workers\u0027,"}],"source_content_type":"text/x-python","patch_set":25,"id":"7adec928_7651d461","line":45,"in_reply_to":"7adec928_664db072","updated":"2014-05-08 15:17:49.000000000","message":"sure. seems safer","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":42,"context_line":"                    default\u003d[\u0027database\u0027],"},{"line_number":43,"context_line":"                    help\u003d\u0027Dispatcher to process data.\u0027),"},{"line_number":44,"context_line":"    cfg.IntOpt(\u0027collector_workers\u0027,"},{"line_number":45,"context_line":"               default\u003d2,"},{"line_number":46,"context_line":"               help\u003d\u0027Number of workers for collector service. A single \u0027"},{"line_number":47,"context_line":"               \u0027collector is enabled by default.\u0027),"},{"line_number":48,"context_line":"    cfg.IntOpt(\u0027notification_workers\u0027,"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_d180cc48","line":45,"in_reply_to":"9ad9bd40_204c4870","updated":"2014-05-02 13:20:43.000000000","message":"we\u0027ll probably need to update devstack-gate... the number of cpu of gate has been bumped up to 8 in past few months which seems like an extremely high number to let it default to... kept it at 2 for testing but i\u0027ll change this.","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"98500ad89babc0f82b06d7848e54b85297b4afd1","unresolved":false,"context_lines":[{"line_number":42,"context_line":"                    default\u003d[\u0027database\u0027],"},{"line_number":43,"context_line":"                    help\u003d\u0027Dispatcher to process data.\u0027),"},{"line_number":44,"context_line":"    cfg.IntOpt(\u0027collector_workers\u0027,"},{"line_number":45,"context_line":"               default\u003d2,"},{"line_number":46,"context_line":"               help\u003d\u0027Number of workers for collector service. A single \u0027"},{"line_number":47,"context_line":"               \u0027collector is enabled by default.\u0027),"},{"line_number":48,"context_line":"    cfg.IntOpt(\u0027notification_workers\u0027,"}],"source_content_type":"text/x-python","patch_set":25,"id":"7adec928_664db072","line":45,"in_reply_to":"9ad9bd40_d180cc48","updated":"2014-05-08 05:26:27.000000000","message":"Can we push a patch to change the ceilometer configuration file in devstack-gate only and leave this to be 1 by default?","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"98500ad89babc0f82b06d7848e54b85297b4afd1","unresolved":false,"context_lines":[{"line_number":43,"context_line":"                    help\u003d\u0027Dispatcher to process data.\u0027),"},{"line_number":44,"context_line":"    cfg.IntOpt(\u0027collector_workers\u0027,"},{"line_number":45,"context_line":"               default\u003d2,"},{"line_number":46,"context_line":"               help\u003d\u0027Number of workers for collector service. A single \u0027"},{"line_number":47,"context_line":"               \u0027collector is enabled by default.\u0027),"},{"line_number":48,"context_line":"    cfg.IntOpt(\u0027notification_workers\u0027,"},{"line_number":49,"context_line":"               default\u003d1,"}],"source_content_type":"text/x-python","patch_set":25,"id":"7adec928_a657b801","line":46,"updated":"2014-05-08 05:26:27.000000000","message":"If we really need to change the default value, I think the help message should be changed too.","commit_id":"e568955219004613bb3898d5537b96976cbba7df"}],"ceilometer/storage/impl_sqlalchemy.py":[{"author":{"_account_id":7763,"name":"Alexei Kornienko","email":"akornienko@mirantis.com","username":"akornienko"},"change_message_id":"40017eef867c502ca857f9d7c53a5e7a201b4396","unresolved":false,"context_lines":[{"line_number":80,"context_line":"              }"},{"line_number":81,"context_line":"        - resource"},{"line_number":82,"context_line":"          - the metadata for resources"},{"line_number":83,"context_line":"          - { id: resource uuid }"},{"line_number":84,"context_line":"        - sourceassoc"},{"line_number":85,"context_line":"          - the relationships"},{"line_number":86,"context_line":"          - { sample_id: sample id           (-\u003esample.id)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2FAso%3D","line":83,"updated":"2014-03-20 23:18:00.000000000","message":"What\u0027s the point of the table if it only contains 1 field?","commit_id":"7b1b31012ad345df4272f6145e5558f66fa60f1a"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"d06a066ada76547f33446f93dacacda70188943f","unresolved":false,"context_lines":[{"line_number":80,"context_line":"              }"},{"line_number":81,"context_line":"        - resource"},{"line_number":82,"context_line":"          - the metadata for resources"},{"line_number":83,"context_line":"          - { id: resource uuid }"},{"line_number":84,"context_line":"        - sourceassoc"},{"line_number":85,"context_line":"          - the relationships"},{"line_number":86,"context_line":"          - { sample_id: sample id           (-\u003esample.id)"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAWH%2F%2FArM%3D","line":83,"in_reply_to":"AAAAWH%2F%2FAso%3D","updated":"2014-03-20 23:22:24.000000000","message":"there\u0027s no point to this table (imho). i want to blow up this table along with source,user,project, and sourceassoc... nothing in our api seems to require these associations","commit_id":"7b1b31012ad345df4272f6145e5558f66fa60f1a"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"affbe54ca2c1c79b4caf7dca42ad2d564ee3cffe","unresolved":false,"context_lines":[{"line_number":265,"context_line":"            # transaction and doesn\u0027t have concurrency problem)"},{"line_number":266,"context_line":"            nested \u003d session.connection().dialect.name !\u003d \u0027sqlite\u0027"},{"line_number":267,"context_line":"            with session.begin(nested\u003dnested,"},{"line_number":268,"context_line":"                               subtransactions\u003dnot nested):"},{"line_number":269,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":270,"context_line":"                if obj is None:"},{"line_number":271,"context_line":"                    obj \u003d model_class(id\u003dstr(_id))"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAAXX%2F%2FuAE%3D","line":268,"updated":"2014-04-28 13:47:12.000000000","message":"I see no reason at all why nested or subtransactions are needed here. You aren\u0027t doing anything in this method that is an atomically-separable unit of work from work that is done by the supplied session object before this function begins.","commit_id":"23cb4e0ee9d1b331f14f6fce69321e69911886b8"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"b08f2a38ac9bb72dd2120c70709cc924d4ee49eb","unresolved":false,"context_lines":[{"line_number":265,"context_line":"            # transaction and doesn\u0027t have concurrency problem)"},{"line_number":266,"context_line":"            nested \u003d session.connection().dialect.name !\u003d \u0027sqlite\u0027"},{"line_number":267,"context_line":"            with session.begin(nested\u003dnested,"},{"line_number":268,"context_line":"                               subtransactions\u003dnot nested):"},{"line_number":269,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":270,"context_line":"                if obj is None:"},{"line_number":271,"context_line":"                    obj \u003d model_class(id\u003dstr(_id))"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAAXX%2F%2FtNA%3D","line":268,"in_reply_to":"AAAAXX%2F%2FuAE%3D","updated":"2014-04-28 15:09:02.000000000","message":"this code is actually used by alarms as well.","commit_id":"23cb4e0ee9d1b331f14f6fce69321e69911886b8"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"affbe54ca2c1c79b4caf7dca42ad2d564ee3cffe","unresolved":false,"context_lines":[{"line_number":277,"context_line":"            # re-query for duplicate entry, retry a few times in case dup"},{"line_number":278,"context_line":"            # hasn\u0027t been committed. retry function in case duplicate was"},{"line_number":279,"context_line":"            # rolled-back"},{"line_number":280,"context_line":"            for __ in xrange(5):"},{"line_number":281,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":282,"context_line":"                if obj:"},{"line_number":283,"context_line":"                    break"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAAXX%2F%2FuDg%3D","line":280,"updated":"2014-04-28 13:47:12.000000000","message":"5 times, no sleep or backoff? Seems a bit arbitrary to me...","commit_id":"23cb4e0ee9d1b331f14f6fce69321e69911886b8"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"b08f2a38ac9bb72dd2120c70709cc924d4ee49eb","unresolved":false,"context_lines":[{"line_number":277,"context_line":"            # re-query for duplicate entry, retry a few times in case dup"},{"line_number":278,"context_line":"            # hasn\u0027t been committed. retry function in case duplicate was"},{"line_number":279,"context_line":"            # rolled-back"},{"line_number":280,"context_line":"            for __ in xrange(5):"},{"line_number":281,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":282,"context_line":"                if obj:"},{"line_number":283,"context_line":"                    break"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAAXX%2F%2FtMU%3D","line":280,"in_reply_to":"AAAAXX%2F%2FuDg%3D","updated":"2014-04-28 15:09:02.000000000","message":"i\u0027ll add a delay.","commit_id":"23cb4e0ee9d1b331f14f6fce69321e69911886b8"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"affbe54ca2c1c79b4caf7dca42ad2d564ee3cffe","unresolved":false,"context_lines":[{"line_number":324,"context_line":"        with session.begin():"},{"line_number":325,"context_line":"            source \u003d self._create_or_update(session, models.Source,"},{"line_number":326,"context_line":"                                            data[\u0027source\u0027])"},{"line_number":327,"context_line":"        with session.begin():"},{"line_number":328,"context_line":"            user \u003d self._create_or_update(session, models.User,"},{"line_number":329,"context_line":"                                          data[\u0027user_id\u0027], source)"},{"line_number":330,"context_line":"        with session.begin():"}],"source_content_type":"text/x-python","patch_set":22,"id":"AAAAXX%2F%2Ft%2Fg%3D","line":327,"updated":"2014-04-28 13:47:12.000000000","message":"See comment above... By doing this, you are ensuring that there is no need to issue a subtransaction or nested transaction inside the _create_or_update() method. So, just remove the nested stuff inside _create_or_update()","commit_id":"23cb4e0ee9d1b331f14f6fce69321e69911886b8"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":85,"context_line":"              resource_metadata: metadata dictionaries"},{"line_number":86,"context_line":"              project_id: project uuid      (-\u003eproject.id)"},{"line_number":87,"context_line":"              user_id: user uuid            (-\u003euser.id)"},{"line_number":88,"context_line":"              }"},{"line_number":89,"context_line":"        - sourceassoc"},{"line_number":90,"context_line":"          - the relationships"},{"line_number":91,"context_line":"          - { sample_id: sample id           (-\u003esample.id)"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_0b3be538","side":"PARENT","line":88,"updated":"2014-05-02 11:33:14.000000000","message":"Does removing the most recent resource metadata from the resource table introduce a difference in capabilities between the drivers, in terms of constraining resource queries by metadata?\n\ne.g. for mongo, I can query thusly:\n\n  GET /v2/resources?q.field\u003dresource_metadata.status\u0026q.op\u003deq\u0026q.value\u003dactive\n\nto get a list of \"active\" things (images, instances etc.)\n\nWouldn\u0027t such querying no longer be possible with the sql-a driver?\n\nDo we need to spell this out in the capabilities?","commit_id":"800395fff85988c5e7d97f8a583ffe056798a824"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":85,"context_line":"              resource_metadata: metadata dictionaries"},{"line_number":86,"context_line":"              project_id: project uuid      (-\u003eproject.id)"},{"line_number":87,"context_line":"              user_id: user uuid            (-\u003euser.id)"},{"line_number":88,"context_line":"              }"},{"line_number":89,"context_line":"        - sourceassoc"},{"line_number":90,"context_line":"          - the relationships"},{"line_number":91,"context_line":"          - { sample_id: sample id           (-\u003esample.id)"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_f1af90e1","side":"PARENT","line":88,"in_reply_to":"9ad9bd40_0b3be538","updated":"2014-05-02 13:20:43.000000000","message":"the functionality is still there... part of the misleading purpose of the side tables which  is something to be addressed when we remodel because there is no clear purpose for them... we aren\u0027t using them at all in sql, they\u0027re just being populated\n\nthe resource/user/project tables, in all backends, do not contain unique data aside from sourceassoc (which i\u0027m not sure what it\u0027s for since no api allows access to data)","commit_id":"800395fff85988c5e7d97f8a583ffe056798a824"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":261,"context_line":"        if not _id:"},{"line_number":262,"context_line":"            return None"},{"line_number":263,"context_line":"        try:"},{"line_number":264,"context_line":"            # create a nested session for the case of two call of"},{"line_number":265,"context_line":"            # record_metering_data run in parallel to not fail the"},{"line_number":266,"context_line":"            # record of this sample"},{"line_number":267,"context_line":"            # (except for sqlite, that doesn\u0027t support nested"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_40478c4b","line":264,"updated":"2014-05-02 11:33:14.000000000","message":"s/call of/calls to/","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":262,"context_line":"            return None"},{"line_number":263,"context_line":"        try:"},{"line_number":264,"context_line":"            # create a nested session for the case of two call of"},{"line_number":265,"context_line":"            # record_metering_data run in parallel to not fail the"},{"line_number":266,"context_line":"            # record of this sample"},{"line_number":267,"context_line":"            # (except for sqlite, that doesn\u0027t support nested"},{"line_number":268,"context_line":"            # transaction and doesn\u0027t have concurrency problem)"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_60757097","line":265,"updated":"2014-05-02 11:33:14.000000000","message":"s/run in parallel/running in parallel/","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":263,"context_line":"        try:"},{"line_number":264,"context_line":"            # create a nested session for the case of two call of"},{"line_number":265,"context_line":"            # record_metering_data run in parallel to not fail the"},{"line_number":266,"context_line":"            # record of this sample"},{"line_number":267,"context_line":"            # (except for sqlite, that doesn\u0027t support nested"},{"line_number":268,"context_line":"            # transaction and doesn\u0027t have concurrency problem)"},{"line_number":269,"context_line":"            nested \u003d session.connection().dialect.name !\u003d \u0027sqlite\u0027"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_c072bcac","line":266,"updated":"2014-05-02 11:33:14.000000000","message":"s/record/recording/","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":279,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":280,"context_line":"            # re-query for duplicate entry, retry a few times in case dup"},{"line_number":281,"context_line":"            # hasn\u0027t been committed. retry function in case duplicate was"},{"line_number":282,"context_line":"            # rolled-back"},{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_4b16cdf2","line":282,"updated":"2014-05-02 11:33:14.000000000","message":"I\u0027m confused about the scenario that lead both the current worker *and* the duplicate that it collided with to be *both* rolled back. Can you explain?","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":279,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":280,"context_line":"            # re-query for duplicate entry, retry a few times in case dup"},{"line_number":281,"context_line":"            # hasn\u0027t been committed. retry function in case duplicate was"},{"line_number":282,"context_line":"            # rolled-back"},{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_d1ce0cb4","line":282,"in_reply_to":"9ad9bd40_4b16cdf2","updated":"2014-05-02 13:20:43.000000000","message":"so the reason for having this backoff retry logic is because the transaction isn\u0027t commit here, it\u0027s flushed.\n\nso there are two scenarios, both start with: two workers come in, one worker successfully creates obj, the other tries to create same obj but receives a dup error. at this point nothing is commited to the db yet. the first worker has flushed its obj there so the db knows about it.\n\nscenario one: the first worker, continues on with transaction successfully but the timing of first worker and second worker is so close that before first worker can commit, the second worker (in dbdup section), tries to query for first worker\u0027s obj. because the obj hasn\u0027t been commited yet, the query will return nothing so we keep retrying a few times to give the first worker time to finish transaction and commit. if it doesn\u0027t commit before 5 retries we try call function again and it\u0027ll just end up back in except section, querying for obj.\n\nscenario two: the first worker, continues on with transaction but fails before it commits, thus rolling back the obj it previously flushed. the second worker here will try to query for obj a few times and eventually exhaust retry, and it will retry to create obj which it can since the first worker had it\u0027s work rolled back.\n\ni didn\u0027t push for this patch much since i\u0027m not sure if we\u0027ll still need it after remodel. but as a first step, this is it.","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"91ff411360a6fe28de65d258433b1290bfb18832","unresolved":false,"context_lines":[{"line_number":279,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":280,"context_line":"            # re-query for duplicate entry, retry a few times in case dup"},{"line_number":281,"context_line":"            # hasn\u0027t been committed. retry function in case duplicate was"},{"line_number":282,"context_line":"            # rolled-back"},{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_b2489788","line":282,"in_reply_to":"9ad9bd40_807a6fef","updated":"2014-05-02 21:29:59.000000000","message":"i\u0027m not sure i have one (especially since i cut the size of transaction)... i really only kept it as a theoretical edge case so we try as hard as we can to retain data","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"45f1075b09d60273ed825a35a7d20aa4218441fd","unresolved":false,"context_lines":[{"line_number":279,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":280,"context_line":"            # re-query for duplicate entry, retry a few times in case dup"},{"line_number":281,"context_line":"            # hasn\u0027t been committed. retry function in case duplicate was"},{"line_number":282,"context_line":"            # rolled-back"},{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_807a6fef","line":282,"in_reply_to":"9ad9bd40_d1ce0cb4","updated":"2014-05-02 14:42:27.000000000","message":"A-ha, that makes it a lot clearer, thanks!\n\nJust one follow-on question: in what circumstances would the pre-commit failure occur under scenario two?","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":282,"context_line":"            # rolled-back"},{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":286,"context_line":"                if obj:"},{"line_number":287,"context_line":"                    break"},{"line_number":288,"context_line":"                time.sleep(delay)"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_0b912552","line":285,"updated":"2014-05-02 11:33:14.000000000","message":"So if obj now exists, we break and avoid the recursive call.\n\nI may have been wrong on this point, but I thought the main reason why we needed the recursion on duplicate collision was to handle updating (a) the sources (if changed) and (b) the resource metadata.\n\nNow case (b) has gone away, as you no longer store the \"latest\" resource metadata in the resources table.\n\nBut what about case (a)? Is there a subtle change in behaviour we\u0027re previously a collision when create a single resource/user/project with different sources would lead to be both sources being being persisted. With your changes, would only the source specified by the \"winning\" worker actually be persisted?","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":282,"context_line":"            # rolled-back"},{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":286,"context_line":"                if obj:"},{"line_number":287,"context_line":"                    break"},{"line_number":288,"context_line":"                time.sleep(delay)"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_3177383c","line":285,"in_reply_to":"9ad9bd40_0b912552","updated":"2014-05-02 13:20:43.000000000","message":"see above","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":286,"context_line":"                if obj:"},{"line_number":287,"context_line":"                    break"},{"line_number":288,"context_line":"                time.sleep(delay)"},{"line_number":289,"context_line":"                delay +\u003d Connection.BACKOFF_DELAY"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_60ead010","line":286,"updated":"2014-05-02 11:33:14.000000000","message":"Better to be consistent with the form used in line 273? i.e.:\n\n  if obj is None:","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"91ff411360a6fe28de65d258433b1290bfb18832","unresolved":false,"context_lines":[{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":286,"context_line":"                if obj:"},{"line_number":287,"context_line":"                    break"},{"line_number":288,"context_line":"                time.sleep(delay)"},{"line_number":289,"context_line":"                delay +\u003d Connection.BACKOFF_DELAY"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_923c73e4","line":286,"in_reply_to":"9ad9bd40_404a27c6","updated":"2014-05-02 21:29:59.000000000","message":"will do","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":286,"context_line":"                if obj:"},{"line_number":287,"context_line":"                    break"},{"line_number":288,"context_line":"                time.sleep(delay)"},{"line_number":289,"context_line":"                delay +\u003d Connection.BACKOFF_DELAY"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_b142680e","line":286,"in_reply_to":"9ad9bd40_60ead010","updated":"2014-05-02 13:20:43.000000000","message":"you mean change to the following?\n\n    if obj  is not None:","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"45f1075b09d60273ed825a35a7d20aa4218441fd","unresolved":false,"context_lines":[{"line_number":283,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":284,"context_line":"            for __ in xrange(5):"},{"line_number":285,"context_line":"                obj \u003d session.query(model_class).get(str(_id))"},{"line_number":286,"context_line":"                if obj:"},{"line_number":287,"context_line":"                    break"},{"line_number":288,"context_line":"                time.sleep(delay)"},{"line_number":289,"context_line":"                delay +\u003d Connection.BACKOFF_DELAY"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_404a27c6","line":286,"in_reply_to":"9ad9bd40_b142680e","updated":"2014-05-02 14:42:27.000000000","message":"Yeah, sorry, exactly what I meant but mistyped ... just to follow the same style in both checks for existence.","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":305,"context_line":"                if obj is None:"},{"line_number":306,"context_line":"                    obj \u003d models.Meter(name\u003dname, type\u003dtype, unit\u003dunit)"},{"line_number":307,"context_line":"                    session.add(obj)"},{"line_number":308,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":309,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":310,"context_line":"            for __ in xrange(5):"},{"line_number":311,"context_line":"                obj \u003d session.query(models.Meter)\\"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_cb801d49","line":308,"updated":"2014-05-02 11:33:14.000000000","message":"I\u0027m a bit confused about the actual case that the new retry logic is designed to apply to.\n\nSuppose there are just two workers attempting to create the same meter concurrently. I was assuming that one of those workers will win out and its txn will be persisted, while the second worker will be rolled back with DBDuplicateEntry.\n\nBut in that case, the re-query on line 311 would always return non-None on the first backed-off for loop iteration, due to the first worker\u0027s changes having been made durable.\n\nSo do *both* contending workers see the DBDuplicateEntry?\n\nI may be missing the point, but it seems that the backed-off for loop would only be useful if the winning worker\u0027s changes may not have been persisted first time round.\n\nAnd if it is the case that *both* contending workers get bumped to the DBDuplicateEntry handling clause, then it seems like a \"Mexican standoff\" for both to backoff at the *same* rate waiting for the other to complete. Would it be better for one worker to attempt to jump in eagerly? Could this be made more likely by randomizing the backoff delay and/or the loop limit?","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":305,"context_line":"                if obj is None:"},{"line_number":306,"context_line":"                    obj \u003d models.Meter(name\u003dname, type\u003dtype, unit\u003dunit)"},{"line_number":307,"context_line":"                    session.add(obj)"},{"line_number":308,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":309,"context_line":"            delay \u003d Connection.BACKOFF_DELAY"},{"line_number":310,"context_line":"            for __ in xrange(5):"},{"line_number":311,"context_line":"                obj \u003d session.query(models.Meter)\\"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_51683c87","line":308,"in_reply_to":"9ad9bd40_cb801d49","updated":"2014-05-02 13:20:43.000000000","message":"see reply to comment above","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":312,"context_line":"                    .filter(models.Meter.name \u003d\u003d name)\\"},{"line_number":313,"context_line":"                    .filter(models.Meter.type \u003d\u003d type)\\"},{"line_number":314,"context_line":"                    .filter(models.Meter.unit \u003d\u003d unit).first()"},{"line_number":315,"context_line":"                if obj:"},{"line_number":316,"context_line":"                    break"},{"line_number":317,"context_line":"                time.sleep(delay)"},{"line_number":318,"context_line":"                delay +\u003d Connection.BACKOFF_DELAY"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_06367ce7","line":315,"updated":"2014-05-02 11:33:14.000000000","message":"More consistent as:\n\n    if obj is None:","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":312,"context_line":"                    .filter(models.Meter.name \u003d\u003d name)\\"},{"line_number":313,"context_line":"                    .filter(models.Meter.type \u003d\u003d type)\\"},{"line_number":314,"context_line":"                    .filter(models.Meter.unit \u003d\u003d unit).first()"},{"line_number":315,"context_line":"                if obj:"},{"line_number":316,"context_line":"                    break"},{"line_number":317,"context_line":"                time.sleep(delay)"},{"line_number":318,"context_line":"                delay +\u003d Connection.BACKOFF_DELAY"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_316d7899","line":315,"in_reply_to":"9ad9bd40_06367ce7","updated":"2014-05-02 13:20:43.000000000","message":"same as above, this is the opposite condition to what it currently looks for.","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":317,"context_line":"                time.sleep(delay)"},{"line_number":318,"context_line":"                delay +\u003d Connection.BACKOFF_DELAY"},{"line_number":319,"context_line":"            else:"},{"line_number":320,"context_line":"                obj \u003d Connection._create_meter(session, name, type, unit)"},{"line_number":321,"context_line":"        return obj"},{"line_number":322,"context_line":""},{"line_number":323,"context_line":"    def record_metering_data(self, data):"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_c0163c55","line":320,"updated":"2014-05-02 11:33:14.000000000","message":"No guarantee that the recursive call won\u0027t fall back into dbexc.DBDuplicateEntry handling a second time, correct?\n\n(since the the subsequent query-and-update are scoped within a fresh transaction, unless I\u0027m missed some of subtlety around the nested transaction logic)\n\nIn that case would it make sense for the initial back-off delay to be parmeterized in the recursive call, so that if necessary it can continue where it left off as opposed to being reset back to Connection.BACKOFF_DELAY?","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":317,"context_line":"                time.sleep(delay)"},{"line_number":318,"context_line":"                delay +\u003d Connection.BACKOFF_DELAY"},{"line_number":319,"context_line":"            else:"},{"line_number":320,"context_line":"                obj \u003d Connection._create_meter(session, name, type, unit)"},{"line_number":321,"context_line":"        return obj"},{"line_number":322,"context_line":""},{"line_number":323,"context_line":"    def record_metering_data(self, data):"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_f1a3109c","line":320,"in_reply_to":"9ad9bd40_c0163c55","updated":"2014-05-02 13:20:43.000000000","message":"i think it\u0027s safe to reset back to original BACKOFF_DELAY. if we keep passing the value recursively, it could become really long... i consider this a poor man\u0027s attempt at identifying performance issue. (ie if it still can\u0027t query for obj after x amount of retries with relatively lax backoff_delay... there\u0027s a problem)","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"98500ad89babc0f82b06d7848e54b85297b4afd1","unresolved":false,"context_lines":[{"line_number":333,"context_line":"        with session.begin():"},{"line_number":334,"context_line":"            source \u003d self._create_or_update(session, models.Source,"},{"line_number":335,"context_line":"                                            data[\u0027source\u0027])"},{"line_number":336,"context_line":"        with session.begin():"},{"line_number":337,"context_line":"            user \u003d self._create_or_update(session, models.User,"},{"line_number":338,"context_line":"                                          data[\u0027user_id\u0027], source)"},{"line_number":339,"context_line":"        with session.begin():"}],"source_content_type":"text/x-python","patch_set":25,"id":"7adec928_531a3518","line":336,"updated":"2014-05-08 05:26:27.000000000","message":"Does the 5 times re-try in _create_or_update can guarantee that it will always succeed without exception? If no, I wonder this split will result the success of _create_or_update of Source but failure in _create_or_update of User?","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"8aabae4ebdf9b45aee59d0e163bf57d315b7fe15","unresolved":false,"context_lines":[{"line_number":333,"context_line":"        with session.begin():"},{"line_number":334,"context_line":"            source \u003d self._create_or_update(session, models.Source,"},{"line_number":335,"context_line":"                                            data[\u0027source\u0027])"},{"line_number":336,"context_line":"        with session.begin():"},{"line_number":337,"context_line":"            user \u003d self._create_or_update(session, models.User,"},{"line_number":338,"context_line":"                                          data[\u0027user_id\u0027], source)"},{"line_number":339,"context_line":"        with session.begin():"}],"source_content_type":"text/x-python","patch_set":25,"id":"7adec928_51af82e3","line":336,"in_reply_to":"7adec928_531a3518","updated":"2014-05-08 15:17:49.000000000","message":"this scenario can occur. the question is does a stray item in one of these side tables affect accuracy of results... technically every api query can be done without these tables...","commit_id":"e568955219004613bb3898d5537b96976cbba7df"}],"ceilometer/storage/sqlalchemy/migrate_repo/versions/035_clean_resource_model.py":[{"author":{"_account_id":2284,"name":"Eoghan Glynn","email":"eglynn@redhat.com","username":"eglynn"},"change_message_id":"422dedc4e18311f439a1d471f5043a89c1761295","unresolved":false,"context_lines":[{"line_number":38,"context_line":"            sa.Index(uniq_name, resource.c.user_id,"},{"line_number":39,"context_line":"                     resource.c.project_id)]"},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    if not downgrade:"},{"line_number":42,"context_line":"        for key in keys:"},{"line_number":43,"context_line":"            key.drop()"},{"line_number":44,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_40d78ced","line":41,"updated":"2014-05-02 11:33:14.000000000","message":"Since downgrade is only checked in the negative sense, would it be clearer to reverse the sense of this kwarg so that the conditional becomes:\n\n  if upgrade:","commit_id":"e568955219004613bb3898d5537b96976cbba7df"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"7fb4b1cb4d98261669dc2b805a4d0a24228ec71f","unresolved":false,"context_lines":[{"line_number":38,"context_line":"            sa.Index(uniq_name, resource.c.user_id,"},{"line_number":39,"context_line":"                     resource.c.project_id)]"},{"line_number":40,"context_line":""},{"line_number":41,"context_line":"    if not downgrade:"},{"line_number":42,"context_line":"        for key in keys:"},{"line_number":43,"context_line":"            key.drop()"},{"line_number":44,"context_line":"    else:"}],"source_content_type":"text/x-python","patch_set":25,"id":"9ad9bd40_912f24f6","line":41,"in_reply_to":"9ad9bd40_40d78ced","updated":"2014-05-02 13:20:43.000000000","message":"sounds good.","commit_id":"e568955219004613bb3898d5537b96976cbba7df"}]}
