)]}'
{"nova/db/sqlalchemy/api_migrations/migrate_repo/versions/062_instance_mapping_add_user_id.py":[{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"1bc1354072d6d1660d217e7da2f7d62c2815f8dd","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    if not hasattr(instance_mappings.c, \u0027user_id\u0027):"},{"line_number":26,"context_line":"        instance_mappings.create_column(Column(\u0027user_id\u0027, String(length\u003d255),"},{"line_number":27,"context_line":"            nullable\u003dTrue))"}],"source_content_type":"text/x-python","patch_set":4,"id":"5fc1f717_f427d2b5","line":27,"updated":"2019-03-06 19:55:42.000000000","message":"Hmm, if we\u0027re going to use this for mass lookups and counting, don\u0027t we want an  index on this new column?","commit_id":"554f2c850707b85b178425c68166d49f34df5561"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"2656a11d88107f41a3a4577b6babe6a7cb52f3c1","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    if not hasattr(instance_mappings.c, \u0027user_id\u0027):"},{"line_number":26,"context_line":"        instance_mappings.create_column(Column(\u0027user_id\u0027, String(length\u003d255),"},{"line_number":27,"context_line":"            nullable\u003dTrue))"}],"source_content_type":"text/x-python","patch_set":4,"id":"5fc1f717_854888cc","line":27,"in_reply_to":"5fc1f717_170b808e","updated":"2019-03-07 13:39:12.000000000","message":"Melanie, go ahead and add an index on user_id only. We can add an index on (project_id, user_id) at some later time if needed.","commit_id":"554f2c850707b85b178425c68166d49f34df5561"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"f06339fcf7e6a47a067a5d68f4c8efe759281985","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    if not hasattr(instance_mappings.c, \u0027user_id\u0027):"},{"line_number":26,"context_line":"        instance_mappings.create_column(Column(\u0027user_id\u0027, String(length\u003d255),"},{"line_number":27,"context_line":"            nullable\u003dTrue))"}],"source_content_type":"text/x-python","patch_set":4,"id":"5fc1f717_170b808e","line":27,"in_reply_to":"5fc1f717_3448faca","updated":"2019-03-06 20:57:33.000000000","message":"Just noticed too that the server group members count is only filtering on user_id, so, just to make things more complicated:\n\nhttps://review.openstack.org/#/c/638324/16/nova/objects/instance_mapping.py@450","commit_id":"554f2c850707b85b178425c68166d49f34df5561"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"dca37a484fbb264317b6e14b1ee121c8797d7088","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    if not hasattr(instance_mappings.c, \u0027user_id\u0027):"},{"line_number":26,"context_line":"        instance_mappings.create_column(Column(\u0027user_id\u0027, String(length\u003d255),"},{"line_number":27,"context_line":"            nullable\u003dTrue))"}],"source_content_type":"text/x-python","patch_set":4,"id":"5fc1f717_689a1115","line":27,"in_reply_to":"5fc1f717_854888cc","updated":"2019-03-07 14:27:02.000000000","message":"After chatting with Matt on IRC, it seems that for some unknown reason, the server group member quota query uses user_id and only user_id. I don\u0027t know why this is the case and why project_id is not also used in that query, but meh. Best to create two indexes then, one on user_id alone and another on (project_id, user_id).","commit_id":"554f2c850707b85b178425c68166d49f34df5561"},{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"fa45df3d8aedea50ed061493d101e962fae670bf","unresolved":false,"context_lines":[{"line_number":24,"context_line":""},{"line_number":25,"context_line":"    if not hasattr(instance_mappings.c, \u0027user_id\u0027):"},{"line_number":26,"context_line":"        instance_mappings.create_column(Column(\u0027user_id\u0027, String(length\u003d255),"},{"line_number":27,"context_line":"            nullable\u003dTrue))"}],"source_content_type":"text/x-python","patch_set":4,"id":"5fc1f717_3448faca","line":27,"in_reply_to":"5fc1f717_f427d2b5","updated":"2019-03-06 20:17:41.000000000","message":"Good point -- I didn\u0027t think about this because...of my lack of database expertise.\n\nAs we discussed on IRC, we already have an index on project_id. So the question is, if the access pattern is going to be (project_id) and (project_id, user_id), should the new index be on only the user_id column or the project_id _and_ user_id columns?\n\nI\u0027m reminded of what jaypipes had recommended on the consumers table:\n\nhttps://github.com/openstack/nova/blob/eaa29f71ef01f5da2edfa79886a302f8a5f352ae/nova/db/sqlalchemy/api_models.py#L646-L648\n\nbut that is not exactly the same case as we have here. So I need to get his recommendation about whether this would be OK on only user_id or if it needs to be both.","commit_id":"554f2c850707b85b178425c68166d49f34df5561"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"f643c424d34dd310666bca6b2b7e2c89045ea385","unresolved":false,"context_lines":[{"line_number":27,"context_line":"        instance_mappings.create_column(Column(\u0027user_id\u0027, String(length\u003d255),"},{"line_number":28,"context_line":"            nullable\u003dTrue))"},{"line_number":29,"context_line":"        uindex \u003d Index(\u0027instance_mappings_user_id_idx\u0027,"},{"line_number":30,"context_line":"                       instance_mappings.c.user_id)"},{"line_number":31,"context_line":"        uindex.create()"},{"line_number":32,"context_line":""},{"line_number":33,"context_line":"        upindex \u003d Index(\u0027instance_mappings_user_id_project_id_idx\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5fc1f717_996a317e","line":30,"updated":"2019-03-07 16:03:56.000000000","message":"there is no need for an index on just user_id if you have an index on (user_id, project_id) below because of the single-column index will prefix-match everything in the multi-column index.\n\nThe idea was to have a (project_id, user_id) index that would solve queries that used both project_id and user_id and a single user_id index for queries that only used user_id. There is already an index on (project_id) alone (https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api_models.py#L134) therefore a (project_id, user_id) index would make the single (project_id) index redundant.\n\nSo, it\u0027s enough here to just add one multi-column (user_id, project_id) index.\n\nThat said, that index would not be able to satisfy queries such as \"get me the number of distinct users that have instances in each project\" because of the order of the columns in the index. Not sure that is actually something we will want to query for in the future, though, so for now, just one index on (user_id, project_id) is fine.","commit_id":"1b36de08ada2b482d803c16f6436322513d46e2b"}],"nova/db/sqlalchemy/api_models.py":[{"author":{"_account_id":26936,"name":"Surya Seetharaman","email":"suryaseetharaman.9@gmail.com","username":"tssurya"},"change_message_id":"61a6f4a7e6be04acb7a4f56df8254dfe9e4e5f8d","unresolved":false,"context_lines":[{"line_number":143,"context_line":"    project_id \u003d Column(String(255), nullable\u003dFalse)"},{"line_number":144,"context_line":"    # FIXME(melwitt): This should eventually be non-nullable, but we need a"},{"line_number":145,"context_line":"    # transition period first."},{"line_number":146,"context_line":"    user_id \u003d Column(String(255), nullable\u003dTrue)"},{"line_number":147,"context_line":"    queued_for_delete \u003d Column(Boolean)"},{"line_number":148,"context_line":"    cell_mapping \u003d orm.relationship(\u0027CellMapping\u0027,"},{"line_number":149,"context_line":"            backref\u003dbackref(\u0027instance_mapping\u0027, uselist\u003dFalse),"}],"source_content_type":"text/x-python","patch_set":2,"id":"9fdfeff1_b3e7fb46","line":146,"range":{"start_line":146,"start_character":34,"end_line":146,"end_character":47},"updated":"2019-02-21 12:40:21.000000000","message":"ok so by default its NULL for now. But like your note says you will fix this after the migration gets removed.","commit_id":"430baa37bf961e5a5bc1fa1956e13c52000150fa"}],"nova/tests/functional/db/api/test_migrations.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"840f9cf45733178e19c2a39f792e230f55a63f6e","unresolved":false,"context_lines":[{"line_number":727,"context_line":"            \u0027queued_for_delete\u0027)"},{"line_number":728,"context_line":""},{"line_number":729,"context_line":"    def _check_062(self, engine, data):"},{"line_number":730,"context_line":"        self.assertColumnExists(engine, \u0027instance_mappings\u0027, \u0027user_id\u0027)"},{"line_number":731,"context_line":""},{"line_number":732,"context_line":""},{"line_number":733,"context_line":"class TestNovaAPIMigrationsWalkSQLite(NovaAPIMigrationsWalk,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5fc1f717_791bc51a","line":730,"updated":"2019-03-07 16:05:14.000000000","message":"You can also add something like this for the two new indexes:\n\nself.assertIndexExists(engine, \u0027resource_providers\u0027,\n            \u0027resource_providers_root_provider_id_idx\u0027)\n        self.assertIndexExists(engine, \u0027resource_providers\u0027,\n            \u0027resource_providers_parent_provider_id_idx\u0027)","commit_id":"1b36de08ada2b482d803c16f6436322513d46e2b"}]}
