)]}'
{"ceilometer/storage/impl_sqlalchemy.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"7d0d71af33fb79ff0528e9b01a15a045e61a648c","unresolved":false,"context_lines":[{"line_number":460,"context_line":"            models.Resource.internal_id \u003d\u003d models.Sample.resource_id).group_by("},{"line_number":461,"context_line":"            models.Sample.meter_id, models.Resource.resource_id)"},{"line_number":462,"context_line":"        if resource:"},{"line_number":463,"context_line":"            subq \u003d subq.filter(models.Resource.resource_id \u003d\u003d resource)"},{"line_number":464,"context_line":"        subq \u003d subq.subquery()"},{"line_number":465,"context_line":""},{"line_number":466,"context_line":"        # get meter details for samples."}],"source_content_type":"text/x-python","patch_set":11,"id":"baada198_c3afcede","line":463,"updated":"2014-08-08 17:18:57.000000000","message":"As far as I can tell from some rudimentary testing, having this filter is redundant if \"resource\" is in s_filter in line 449 above.\n\nIn fact it appears that the entire subq may be unnecessary, but I\u0027m unsure how to  test it properly. I\u0027ll work on that a bit and see where it gets me. If I\u0027m still stuck I\u0027ll link to a paste of the diff I\u0027m working from or commit a dependent change.","commit_id":"bff053ec27496799f65a56b05b31588a6c1ad52d"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"1181268756a3a3d98ceb7236805b69312d162603","unresolved":false,"context_lines":[{"line_number":460,"context_line":"            models.Resource.internal_id \u003d\u003d models.Sample.resource_id).group_by("},{"line_number":461,"context_line":"            models.Sample.meter_id, models.Resource.resource_id)"},{"line_number":462,"context_line":"        if resource:"},{"line_number":463,"context_line":"            subq \u003d subq.filter(models.Resource.resource_id \u003d\u003d resource)"},{"line_number":464,"context_line":"        subq \u003d subq.subquery()"},{"line_number":465,"context_line":""},{"line_number":466,"context_line":"        # get meter details for samples."}],"source_content_type":"text/x-python","patch_set":11,"id":"baada198_89a6d7aa","line":463,"in_reply_to":"baada198_c3afcede","updated":"2014-08-08 18:30:05.000000000","message":"so the redundant filter is to speed up the subquery... so it doesn\u0027t work on entire sample set","commit_id":"bff053ec27496799f65a56b05b31588a6c1ad52d"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"88da7ee82d4a47e34b50f0525ce6d5a177d0538a","unresolved":false,"context_lines":[{"line_number":261,"context_line":"                         rmeta):"},{"line_number":262,"context_line":"        new_res \u003d False"},{"line_number":263,"context_line":"        try:"},{"line_number":264,"context_line":"            nested \u003d session.connection().dialect.name !\u003d \u0027sqlite\u0027"},{"line_number":265,"context_line":"            m_hash \u003d jsonutils.dumps(rmeta)"},{"line_number":266,"context_line":"            with session.begin(nested\u003dnested,"},{"line_number":267,"context_line":"                               subtransactions\u003dnot nested):"}],"source_content_type":"text/x-python","patch_set":12,"id":"9ab29df4_2b3711b2","line":264,"updated":"2014-08-13 20:34:00.000000000","message":"the fact that we can\u0027t use \"nested\" for sqlite can be resolved.  we have this resolved in an upcoming oslo.db, or the workaround can be set up in ceilometer directly if oslo.db isn\u0027t used.","commit_id":"6ba18baa74d7df7ebfcf975d9e088318bbf3f768"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"88da7ee82d4a47e34b50f0525ce6d5a177d0538a","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                                          resource_metadata\u003drmeta)"},{"line_number":280,"context_line":"                    session.add(obj)"},{"line_number":281,"context_line":"                    new_res \u003d True"},{"line_number":282,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":283,"context_line":"            # retry function to pick up duplicate committed object"},{"line_number":284,"context_line":"            obj \u003d Connection._create_resource(session, res_id, user_id,"},{"line_number":285,"context_line":"                                              project_id, source_id, rmeta)"}],"source_content_type":"text/x-python","patch_set":12,"id":"9ab29df4_0beecdec","line":282,"updated":"2014-08-13 20:34:00.000000000","message":"the way this is working is expensive.  We are using the nested transaction, which has some expense, particularly if the resource exists, though makes it \"safe\" to do the insert, OK, but then we are querying for the resource anyway, so then it\u0027s even more expensive.   It\u0027s true the Resource here will add some insert overhead but depending on how often the Resource already exists vs. doesn\u0027t exist might be useful to apply towards optimizing this function.   If Resource objects usually don\u0027t exist, then it might be best to not do the SELECT up front as we are doing here.\n\nNow.  what could *really* speed it up, if applicable, is if this Connection object is long lived for a span of many calls to record_metering_data().  Then you could actually memoize some information about existing Resources that are created, and even skip having to do any kind of SELECT at all in the case that you\u0027ve already located a particular resource id.","commit_id":"6ba18baa74d7df7ebfcf975d9e088318bbf3f768"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"dbf9614bf341f26070d458d273247a199de5c1b4","unresolved":false,"context_lines":[{"line_number":279,"context_line":"                                          resource_metadata\u003drmeta)"},{"line_number":280,"context_line":"                    session.add(obj)"},{"line_number":281,"context_line":"                    new_res \u003d True"},{"line_number":282,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":283,"context_line":"            # retry function to pick up duplicate committed object"},{"line_number":284,"context_line":"            obj \u003d Connection._create_resource(session, res_id, user_id,"},{"line_number":285,"context_line":"                                              project_id, source_id, rmeta)"}],"source_content_type":"text/x-python","patch_set":12,"id":"9ab29df4_a688b8c7","line":282,"in_reply_to":"9ab29df4_0beecdec","updated":"2014-08-13 21:24:44.000000000","message":"hmm... interesting idea of having an in-memory cache... maybe i\u0027ll try that to avoid the constant queries.\n\ni\u0027ll leave that for a secondary patch.","commit_id":"6ba18baa74d7df7ebfcf975d9e088318bbf3f768"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"88da7ee82d4a47e34b50f0525ce6d5a177d0538a","unresolved":false,"context_lines":[{"line_number":282,"context_line":"        except dbexc.DBDuplicateEntry:"},{"line_number":283,"context_line":"            # retry function to pick up duplicate committed object"},{"line_number":284,"context_line":"            obj \u003d Connection._create_resource(session, res_id, user_id,"},{"line_number":285,"context_line":"                                              project_id, source_id, rmeta)"},{"line_number":286,"context_line":""},{"line_number":287,"context_line":"        return obj, new_res"},{"line_number":288,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"9ab29df4_6babc989","line":285,"updated":"2014-08-13 20:34:00.000000000","message":"then here, we know the Resource exists.  So going into the SAVEPOINT again spends a lot of time setting up and tearing down that SAVEPOINT (since we\u0027re looking for speed here).   Plus, we know the identifier of the resource, so there\u0027s no need to even SELECT the whole thing - we only need \"internal_id\".   So I\u0027d get just the \"internal_id\" here and return that, as this is all that the current caller needs - session.query(Resource.internal_id) uses much less overhead than loading the whole object (more on the Python than the SQL side).","commit_id":"6ba18baa74d7df7ebfcf975d9e088318bbf3f768"},{"author":{"_account_id":11816,"name":"mike bayer","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"88da7ee82d4a47e34b50f0525ce6d5a177d0538a","unresolved":false,"context_lines":[{"line_number":316,"context_line":"            session.add(sample)"},{"line_number":317,"context_line":"            session.flush()"},{"line_number":318,"context_line":""},{"line_number":319,"context_line":"            if new_res and rmetadata:"},{"line_number":320,"context_line":"                if isinstance(rmetadata, dict):"},{"line_number":321,"context_line":"                    for key, v in utils.dict_to_keyval(rmetadata):"},{"line_number":322,"context_line":"                        try:"}],"source_content_type":"text/x-python","patch_set":12,"id":"9ab29df4_4bbb65c4","line":319,"updated":"2014-08-13 20:34:00.000000000","message":"how come this part isn\u0027t part of _create_resource()?  rmetdata is being passed to it, shouldn\u0027t whether or not it had to do \"new_res\" be local to that?","commit_id":"6ba18baa74d7df7ebfcf975d9e088318bbf3f768"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"dbf9614bf341f26070d458d273247a199de5c1b4","unresolved":false,"context_lines":[{"line_number":316,"context_line":"            session.add(sample)"},{"line_number":317,"context_line":"            session.flush()"},{"line_number":318,"context_line":""},{"line_number":319,"context_line":"            if new_res and rmetadata:"},{"line_number":320,"context_line":"                if isinstance(rmetadata, dict):"},{"line_number":321,"context_line":"                    for key, v in utils.dict_to_keyval(rmetadata):"},{"line_number":322,"context_line":"                        try:"}],"source_content_type":"text/x-python","patch_set":12,"id":"9ab29df4_262ca84a","line":319,"in_reply_to":"9ab29df4_4bbb65c4","updated":"2014-08-13 21:24:44.000000000","message":"... very good question... very good question... lol i\u0027ll fix that.","commit_id":"6ba18baa74d7df7ebfcf975d9e088318bbf3f768"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"9ef20c09bfc7eeea6f2bb0e6ec602316b4fbbede","unresolved":false,"context_lines":[{"line_number":263,"context_line":"        # TODO(gordc): implement lru_cache to improve performance"},{"line_number":264,"context_line":"        try:"},{"line_number":265,"context_line":"            nested \u003d session.connection().dialect.name !\u003d \u0027sqlite\u0027"},{"line_number":266,"context_line":"            m_hash \u003d jsonutils.dumps(rmeta, sort_keys\u003dTrue)"},{"line_number":267,"context_line":"            with session.begin(nested\u003dnested,"},{"line_number":268,"context_line":"                               subtransactions\u003dnot nested):"},{"line_number":269,"context_line":"                obj_id \u003d (session.query(models.Resource.internal_id)"}],"source_content_type":"text/x-python","patch_set":21,"id":"1abeadc6_d57a2af0","line":266,"updated":"2014-08-28 03:13:15.000000000","message":"If we\u0027re sorting during jsondumps for hash calculation here, should do the same thing for the old data in the migration script 038_normalise_tables.py too?","commit_id":"3ef2400998353358349bb20873defcc71378ae49"},{"author":{"_account_id":6537,"name":"gordon chung","email":"gord@live.ca","username":"chungg"},"change_message_id":"3810a9f6b963a9b175fba4aff5e0bf0c5da32bfe","unresolved":false,"context_lines":[{"line_number":263,"context_line":"        # TODO(gordc): implement lru_cache to improve performance"},{"line_number":264,"context_line":"        try:"},{"line_number":265,"context_line":"            nested \u003d session.connection().dialect.name !\u003d \u0027sqlite\u0027"},{"line_number":266,"context_line":"            m_hash \u003d jsonutils.dumps(rmeta, sort_keys\u003dTrue)"},{"line_number":267,"context_line":"            with session.begin(nested\u003dnested,"},{"line_number":268,"context_line":"                               subtransactions\u003dnot nested):"},{"line_number":269,"context_line":"                obj_id \u003d (session.query(models.Resource.internal_id)"}],"source_content_type":"text/x-python","patch_set":21,"id":"1abeadc6_53528e35","line":266,"in_reply_to":"1abeadc6_d57a2af0","updated":"2014-08-28 22:05:11.000000000","message":"yes we should. thanks for catching that.","commit_id":"3ef2400998353358349bb20873defcc71378ae49"}]}
