)]}'
{"nova/db/sqlalchemy/migrate_repo/versions/275_fix_unique_constraint_for_compute_node.py":[{"author":{"_account_id":1849,"name":"Joe Gordon","email":"joe.gordon0@gmail.com","username":"jogo"},"change_message_id":"11f9af84748df730b2c197337e518c1b919886e7","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright (c) 2015 Intel, Inc."},{"line_number":2,"context_line":"# All Rights Reserved."},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":5,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_206f6093","line":2,"updated":"2015-02-12 17:12:11.000000000","message":"nit: this line literally means nothing, and is just a waste of space.","commit_id":"aa5fe4fd6a446a29d91c760f25b7484433ec83e3"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"61eb5e949e0f2700b11629aee9067e8e23d387c6","unresolved":false,"context_lines":[{"line_number":1,"context_line":"# Copyright (c) 2015 Intel, Inc."},{"line_number":2,"context_line":"# All Rights Reserved."},{"line_number":3,"context_line":"#"},{"line_number":4,"context_line":"#    Licensed under the Apache License, Version 2.0 (the \"License\"); you may"},{"line_number":5,"context_line":"#    not use this file except in compliance with the License. You may obtain"}],"source_content_type":"text/x-python","patch_set":4,"id":"da86d52c_a3cb3f51","line":2,"in_reply_to":"da86d52c_206f6093","updated":"2015-02-13 07:04:31.000000000","message":"Done","commit_id":"aa5fe4fd6a446a29d91c760f25b7484433ec83e3"}],"nova/db/sqlalchemy/migrate_repo/versions/277_fix_unique_constraint_for_compute_node.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"0f3916e71aa8860a3f1d786291c419f24ba3b680","unresolved":false,"context_lines":[{"line_number":27,"context_line":"                            name\u003d\"uniq_compute_nodes0host0hypervisor_hostname\")"},{"line_number":28,"context_line":"    ukey.drop()"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    # Add new UniqueConstraint"},{"line_number":31,"context_line":"    ukey \u003d UniqueConstraint("},{"line_number":32,"context_line":"        \u0027host\u0027, \u0027hypervisor_hostname\u0027, \u0027deleted\u0027,"},{"line_number":33,"context_line":"        table\u003dcompute_nodes,"}],"source_content_type":"text/x-python","patch_set":6,"id":"da86d52c_6970c640","line":30,"updated":"2015-02-17 18:30:08.000000000","message":"Not that we\u0027re supporting DB2 (yet?), but I had to look at this to see if it would cause a failure with DB2.\n\nDB2 has a restriction that any ForeignKey has to have columns in a UniqueConstraint or PrimaryKeyConstraint.  And for DB2 to have a UniqueConstraint, it won\u0027t allow nullable columns.\n\nThe host and deleted columns are nullable in the DB model today so DB2 won\u0027t actually create a UC over these, it will create a UniqueIndex which excludes nulls under the covers.  However, as noted, a UniqueIndex won\u0027t fly with a ForeignKeyConstraint in DB2.\n\nLooking at the compute_nodes model, the only FKey I see is on the service_id and deleted columns:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/db/sqlalchemy/models.py#n116\n\nAnd that FKey is going to be dropped in this change:\n\nhttps://review.openstack.org/#/c/155319/\n\nSo while the compute_nodes.deleted column is in a ForeignKeyConstraint with the services table and deleted is nullable\u003dTrue (which is going to be a long time probably since it\u0027s global and in oslo.db), DB2 wouldn\u0027t allow this UC to be created.\n\nGiven https://review.openstack.org/#/c/155319/ will land light years before my DB2 change https://review.openstack.org/#/c/69047/ this is probably OK.  In the DB2 change I\u0027ll have to avoid creating this UC for DB2 and then recreate it later when we add DB2 support in a migration (which adds the missing FKeys due to the aforementioned constraint shenanigans).","commit_id":"11e4fcf99385bb53dbf12ae8934911c886c43bf8"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"46c4f9374f67ec242b91a8afb73355c3ef321932","unresolved":false,"context_lines":[{"line_number":27,"context_line":"                            name\u003d\"uniq_compute_nodes0host0hypervisor_hostname\")"},{"line_number":28,"context_line":"    ukey.drop()"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    # Add new UniqueConstraint"},{"line_number":31,"context_line":"    ukey \u003d UniqueConstraint("},{"line_number":32,"context_line":"        \u0027host\u0027, \u0027hypervisor_hostname\u0027, \u0027deleted\u0027,"},{"line_number":33,"context_line":"        table\u003dcompute_nodes,"}],"source_content_type":"text/x-python","patch_set":6,"id":"da86d52c_39da9f78","line":30,"in_reply_to":"da86d52c_6970c640","updated":"2015-02-17 18:45:54.000000000","message":"An example of a special case I already have to handle for DB2 is in the 247 migration here:\n\nhttps://review.openstack.org/#/c/69047/43/nova/db/sqlalchemy/migrate_repo/versions/247_nullable_mismatch.py\n\nI think the \"easiest\" solution here to avoid a special case in this migration when DB2 support is added would be to land bauzas\u0027 migratoin here first:\n\nhttps://review.openstack.org/#/c/155319/\n\nThat would drop the FKey that has the common problem column, which is compute_nodes.deleted (it\u0027s the problem since it\u0027s nullable\u003dTrue).  This migration adds a UC over the deleted column and currently (if we merged this today), the FKey in compute_nodes is on the deleted column also, which will blow up for DB2.\n\nIf we merge https://review.openstack.org/#/c/155319/ first, then the FKey is gone and we can create a UC over the deleted column because DB2 will just create a UniqueIndex instead - there are several of these in the model today already (UC over nullable column(s) where those columns aren\u0027t in FKeys).\n\nThe majorly painful ones were all of the UCs and FKeys over the instances.uuid column which was nullable until the 267 migration which will allow me to do this for DB2 (add the FKeys back for instances.uuid):\n\nhttps://review.openstack.org/#/c/69047/43/nova/db/sqlalchemy/migrate_repo/versions/277_add_missing_db2_fkeys.py","commit_id":"11e4fcf99385bb53dbf12ae8934911c886c43bf8"}],"nova/tests/unit/db/test_migrations.py":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"88381b962e19429e2f9ae69a0b74e25e6738317c","unresolved":false,"context_lines":[{"line_number":857,"context_line":"        inspector \u003d reflection.Inspector.from_engine(engine)"},{"line_number":858,"context_line":"        constraints \u003d inspector.get_unique_constraints(\u0027compute_nodes\u0027)"},{"line_number":859,"context_line":"        constraint_names \u003d [constraint[\u0027name\u0027] for constraint in constraints]"},{"line_number":860,"context_line":"        self.assertIn(\u0027uniq_compute_nodes0host0hypervisor_hostname0deleted\u0027,"},{"line_number":861,"context_line":"                      constraint_names)"},{"line_number":862,"context_line":""},{"line_number":863,"context_line":"    def _post_downgrade_279(self, engine):"}],"source_content_type":"text/x-python","patch_set":8,"id":"9a80dd14_b834004b","line":860,"updated":"2015-03-17 21:23:15.000000000","message":"nit: you could also assert that \u0027uniq_compute_nodes0host0hypervisor_hostname\u0027 is not in constraint_names since you dropped it.","commit_id":"4ba6f619129be7ca56976ebe427f3dda3a23ac7d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"5f045a8bfa6d40c87bd3362ceac802aac7bf304a","unresolved":false,"context_lines":[{"line_number":857,"context_line":"        inspector \u003d reflection.Inspector.from_engine(engine)"},{"line_number":858,"context_line":"        constraints \u003d inspector.get_unique_constraints(\u0027compute_nodes\u0027)"},{"line_number":859,"context_line":"        constraint_names \u003d [constraint[\u0027name\u0027] for constraint in constraints]"},{"line_number":860,"context_line":"        self.assertIn(\u0027uniq_compute_nodes0host0hypervisor_hostname0deleted\u0027,"},{"line_number":861,"context_line":"                      constraint_names)"},{"line_number":862,"context_line":""},{"line_number":863,"context_line":"    def _post_downgrade_279(self, engine):"}],"source_content_type":"text/x-python","patch_set":8,"id":"9a80dd14_d004201a","line":860,"in_reply_to":"9a80dd14_b834004b","updated":"2015-03-18 05:06:11.000000000","message":"Done","commit_id":"4ba6f619129be7ca56976ebe427f3dda3a23ac7d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"88381b962e19429e2f9ae69a0b74e25e6738317c","unresolved":false,"context_lines":[{"line_number":864,"context_line":"        inspector \u003d reflection.Inspector.from_engine(engine)"},{"line_number":865,"context_line":"        constraints \u003d inspector.get_unique_constraints(\u0027compute_nodes\u0027)"},{"line_number":866,"context_line":"        constraint_names \u003d [constraint[\u0027name\u0027] for constraint in constraints]"},{"line_number":867,"context_line":"        self.assertIn(\u0027uniq_compute_nodes0host0hypervisor_hostname\u0027,"},{"line_number":868,"context_line":"                      constraint_names)"},{"line_number":869,"context_line":""},{"line_number":870,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"9a80dd14_d837f44b","line":867,"updated":"2015-03-17 21:23:15.000000000","message":"nit: similar comment for \u0027uniq_compute_nodes0host0hypervisor_hostname0deleted\u0027.","commit_id":"4ba6f619129be7ca56976ebe427f3dda3a23ac7d"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"5f045a8bfa6d40c87bd3362ceac802aac7bf304a","unresolved":false,"context_lines":[{"line_number":864,"context_line":"        inspector \u003d reflection.Inspector.from_engine(engine)"},{"line_number":865,"context_line":"        constraints \u003d inspector.get_unique_constraints(\u0027compute_nodes\u0027)"},{"line_number":866,"context_line":"        constraint_names \u003d [constraint[\u0027name\u0027] for constraint in constraints]"},{"line_number":867,"context_line":"        self.assertIn(\u0027uniq_compute_nodes0host0hypervisor_hostname\u0027,"},{"line_number":868,"context_line":"                      constraint_names)"},{"line_number":869,"context_line":""},{"line_number":870,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"9a80dd14_f0ff6400","line":867,"in_reply_to":"9a80dd14_d837f44b","updated":"2015-03-18 05:06:11.000000000","message":"Done","commit_id":"4ba6f619129be7ca56976ebe427f3dda3a23ac7d"}]}
