)]}'
{"monasca_api/db/alembic/versions/26083b298bb7_remove_builtin_notification_types.py":[{"author":{"_account_id":17669,"name":"Doug Szumski","email":"doug@stackhpc.com","username":"DougSzumski"},"change_message_id":"951620c38b6f77ec6ea071199d2170ba280e00c9","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from sqlalchemy.sql import table"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"# revision identifiers, used by Alembic."},{"line_number":26,"context_line":"revision \u003d \u002726083b298bb7\u0027"},{"line_number":27,"context_line":"down_revision \u003d \u0027f69cb3152a76\u0027"},{"line_number":28,"context_line":"branch_labels \u003d None"},{"line_number":29,"context_line":"depends_on \u003d None"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_5cafff9a","line":26,"range":{"start_line":26,"start_character":11,"end_line":26,"end_character":25},"updated":"2018-11-28 15:27:05.000000000","message":"Commit ID and filename needs updating to match the latest revision of this patch.","commit_id":"be2af7fa0c5399bd0025079ba190acea445cc8aa"},{"author":{"_account_id":17669,"name":"Doug Szumski","email":"doug@stackhpc.com","username":"DougSzumski"},"change_message_id":"a98440dab91ea8f1b07c33cb1e9f9fad6809e137","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from sqlalchemy.sql import table"},{"line_number":24,"context_line":""},{"line_number":25,"context_line":"# revision identifiers, used by Alembic."},{"line_number":26,"context_line":"revision \u003d \u002726083b298bb7\u0027"},{"line_number":27,"context_line":"down_revision \u003d \u0027f69cb3152a76\u0027"},{"line_number":28,"context_line":"branch_labels \u003d None"},{"line_number":29,"context_line":"depends_on \u003d None"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_1d5b5061","line":26,"range":{"start_line":26,"start_character":11,"end_line":26,"end_character":25},"in_reply_to":"3f79a3b5_5cafff9a","updated":"2018-12-04 17:09:51.000000000","message":"What was I talking about.. I think this is ok how it is. It\u0027s a unique number which can be referenced by the next migration.","commit_id":"be2af7fa0c5399bd0025079ba190acea445cc8aa"}],"monasca_api/db/fingerprint.py":[{"author":{"_account_id":17669,"name":"Doug Szumski","email":"doug@stackhpc.com","username":"DougSzumski"},"change_message_id":"fa58626bd29ae471f214898a3434378da8e21036","unresolved":false,"context_lines":[{"line_number":29,"context_line":"         # Database created with UTF8 default charset"},{"line_number":30,"context_line":"         \"5dda7af1fd708095e6c9298976abb1242bbd1848\": \"8781a256f0c1\","},{"line_number":31,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"f69cb3152a76\","},{"line_number":32,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"26083b298bb7\"}"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"class Fingerprint(object):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_b5921a9e","line":32,"range":{"start_line":32,"start_character":9,"end_line":32,"end_character":10},"updated":"2018-09-19 13:53:34.000000000","message":"I can\u0027t seem to reproduce this fingerprint, but the schema hasn\u0027t changed (this revision is a \u0027data migration\u0027 which just deletes some rows). With either revision f69cb3 or 26083 I get the same fingerprint.\n\nExample:\n\nMariaDB [(none)]\u003e CREATE DATABASE monasca CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;\n(monasca-api)[root@operator monasca-api]#monasca_db upgrade\n\u003cSNIP\u003e\nINFO  [alembic.runtime.migration] Running upgrade 8781a256f0c1 -\u003e f69cb3152a76, Remove inhibited and silenced from alarms (Git revision f69cb3152a76e7c586dcc9a03600d1d4ed32c4e6)\n(monasca-api)[root@operator monasca-api]# monasca_db fingerprint\n80f1bab3839430faceb0f99b2b1473204f0c763d\n\nAnd then my change (same hash as expected):\n(monasca-api)[root@operator monasca-api]# alembic -c /monasca-api/monasca_api/db/alembic.ini upgrade head\nINFO  [alembic.runtime.migration] Context impl MySQLImpl.\nINFO  [alembic.runtime.migration] Will assume non-transactional DDL.\nINFO  [alembic.runtime.migration] Running upgrade f69cb3152a76 -\u003e 26083b298bb7, Remove builtin notification types\n(monasca-api)[root@operator monasca-api]# monasca_db fingerprint\n80f1bab3839430faceb0f99b2b1473204f0c763d\n\nExactly how was the database create for these fingerprints? Have I missed something?","commit_id":"7da423f3c1b5886ddf14897bcf7f37ff7ca7cff3"},{"author":{"_account_id":17669,"name":"Doug Szumski","email":"doug@stackhpc.com","username":"DougSzumski"},"change_message_id":"fa58626bd29ae471f214898a3434378da8e21036","unresolved":false,"context_lines":[{"line_number":29,"context_line":"         # Database created with UTF8 default charset"},{"line_number":30,"context_line":"         \"5dda7af1fd708095e6c9298976abb1242bbd1848\": \"8781a256f0c1\","},{"line_number":31,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"f69cb3152a76\","},{"line_number":32,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"26083b298bb7\"}"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"class Fingerprint(object):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_55d626f4","line":32,"range":{"start_line":32,"start_character":54,"end_line":32,"end_character":66},"updated":"2018-09-19 13:53:34.000000000","message":"Is this supposed to match the final commit id?","commit_id":"7da423f3c1b5886ddf14897bcf7f37ff7ca7cff3"},{"author":{"_account_id":12542,"name":"Johannes Grassler","email":"jgr-launchpad@btw23.de","username":"jgrassler"},"change_message_id":"7a218b6fe3dc7789097fe47fe4901d0e5fc3c931","unresolved":false,"context_lines":[{"line_number":29,"context_line":"         # Database created with UTF8 default charset"},{"line_number":30,"context_line":"         \"5dda7af1fd708095e6c9298976abb1242bbd1848\": \"8781a256f0c1\","},{"line_number":31,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"f69cb3152a76\","},{"line_number":32,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"26083b298bb7\"}"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"class Fingerprint(object):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_3c38aed2","line":32,"range":{"start_line":32,"start_character":54,"end_line":32,"end_character":66},"in_reply_to":"3f79a3b5_55d626f4","updated":"2018-09-26 13:04:39.000000000","message":"No. This is a SHA1 fingerprint of a schema dump as computed here:\n\nhttps://github.com/openstack/monasca-api/blob/0250f81cdcb9e49361f24b52e76e1597a0674739/monasca_api/db/fingerprint.py#L60\n\nGetting it to match the commit ID would pose a bit of a chicken-egg problem :-)\n\nThe bit that _does_ match commit IDs are the values (i.e. revision IDs) in that hash for any legacy revisions (those created by SQL scripts). For these, the commits are in the past so I used the shortened commit IDs as revision identifiers (to make locating the matching SQL script easier).","commit_id":"7da423f3c1b5886ddf14897bcf7f37ff7ca7cff3"},{"author":{"_account_id":17669,"name":"Doug Szumski","email":"doug@stackhpc.com","username":"DougSzumski"},"change_message_id":"0b37c3344c4c9eb3ae6e96b35d33e88ad48f4637","unresolved":false,"context_lines":[{"line_number":29,"context_line":"         # Database created with UTF8 default charset"},{"line_number":30,"context_line":"         \"5dda7af1fd708095e6c9298976abb1242bbd1848\": \"8781a256f0c1\","},{"line_number":31,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"f69cb3152a76\","},{"line_number":32,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"26083b298bb7\"}"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"class Fingerprint(object):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_065c58ee","line":32,"range":{"start_line":32,"start_character":9,"end_line":32,"end_character":10},"in_reply_to":"3f79a3b5_5cc7aa66","updated":"2018-10-10 13:31:29.000000000","message":"Thanks for the feedback Johannes! Don\u0027t worry, I wasn\u0027t planning on making the hash match the commit id :) What I meant was that I think I need to update the revision ID to match the commit ID of this commit once people are happy with it?","commit_id":"7da423f3c1b5886ddf14897bcf7f37ff7ca7cff3"},{"author":{"_account_id":12542,"name":"Johannes Grassler","email":"jgr-launchpad@btw23.de","username":"jgrassler"},"change_message_id":"7a218b6fe3dc7789097fe47fe4901d0e5fc3c931","unresolved":false,"context_lines":[{"line_number":29,"context_line":"         # Database created with UTF8 default charset"},{"line_number":30,"context_line":"         \"5dda7af1fd708095e6c9298976abb1242bbd1848\": \"8781a256f0c1\","},{"line_number":31,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"f69cb3152a76\","},{"line_number":32,"context_line":"         \"7fb1ce4a60f0065505096843bfd21f4ef4c5d1e0\": \"26083b298bb7\"}"},{"line_number":33,"context_line":""},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"class Fingerprint(object):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_5cc7aa66","line":32,"range":{"start_line":32,"start_character":9,"end_line":32,"end_character":10},"in_reply_to":"3f79a3b5_b5921a9e","updated":"2018-09-26 13:04:39.000000000","message":"\u003e this revision is a \u0027data migration\u0027 which just deletes some rows\n\n\u0027data migration\u0027 is the keyword here. Since it only changes data but not the schema, the fingerprint would not be affected since it uses just the schema as its input.\n\nAlso, there is no real need to add fingerprints for any migrations introduced after the transition to Alembic: the database will be \"fingerprinted\" automatically by virtue of having the alembic revision ID stored in the database (Alembic does that automatically). The fingerprinting mechanism is only useful for identifying legacy revisions that do not have a alembic revision ID stored because they were created by an SQL script.\n\nActually we should modify\n\nhttps://github.com/openstack/monasca-api/blob/0250f81cdcb9e49361f24b52e76e1597a0674739/monasca_api/db/fingerprint.py#L66\n\nto set the revision attribute to the stored alembic revision if it exists (rather than guessing it from the schema fingerprint). That\u0027s less error prone and will work for data migrations as well. Also, we should definitely output a warning in that case.","commit_id":"7da423f3c1b5886ddf14897bcf7f37ff7ca7cff3"},{"author":{"_account_id":21922,"name":"Dobroslaw Zybort","email":"dobroslaw.zybort@ts.fujitsu.com","username":"dobrolaw.zybort"},"change_message_id":"42b30134a56addb305319682d214c5c5912fd35b","unresolved":false,"context_lines":[{"line_number":104,"context_line":"    @staticmethod"},{"line_number":105,"context_line":"    def _lookup_version_from_table(sha1):"},{"line_number":106,"context_line":"        revision \u003d _REVS.get(sha1)"},{"line_number":107,"context_line":"        if not revision:"},{"line_number":108,"context_line":"            LOG.warning(\"Fingerprint: {} does not match any revisions.\""},{"line_number":109,"context_line":"                        .format(sha1))"},{"line_number":110,"context_line":"        return revision"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_c3f50ecb","line":109,"range":{"start_line":107,"start_character":0,"end_line":109,"end_character":38},"updated":"2018-11-19 13:32:50.000000000","message":"Shouldn\u0027t we raise exception here? Also there is no test for such case.","commit_id":"be2af7fa0c5399bd0025079ba190acea445cc8aa"},{"author":{"_account_id":17669,"name":"Doug Szumski","email":"doug@stackhpc.com","username":"DougSzumski"},"change_message_id":"243ed0d10d8d09aa2f373bf236c4475e44f73ed3","unresolved":false,"context_lines":[{"line_number":104,"context_line":"    @staticmethod"},{"line_number":105,"context_line":"    def _lookup_version_from_table(sha1):"},{"line_number":106,"context_line":"        revision \u003d _REVS.get(sha1)"},{"line_number":107,"context_line":"        if not revision:"},{"line_number":108,"context_line":"            LOG.warning(\"Fingerprint: {} does not match any revisions.\""},{"line_number":109,"context_line":"                        .format(sha1))"},{"line_number":110,"context_line":"        return revision"}],"source_content_type":"text/x-python","patch_set":7,"id":"3f79a3b5_e3f12a99","line":109,"range":{"start_line":107,"start_character":0,"end_line":109,"end_character":38},"in_reply_to":"3f79a3b5_c3f50ecb","updated":"2018-11-19 13:53:49.000000000","message":"This just keeps the original behaviour with the addition of a warning message. I think changing it to throw an exception would be best covered in a separate change. This change is to support a data migration and the version should be accessible from the DB.","commit_id":"be2af7fa0c5399bd0025079ba190acea445cc8aa"}]}
