)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"a995470a2ae062229ac476d7b9ccb5fdfd418c20","unresolved":false,"context_lines":[{"line_number":12,"context_line":"without supplying port_id.  An explicit index on trunk_id is"},{"line_number":13,"context_line":"efficient."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"I wish I could write a migration to remove trunk_id from the primary"},{"line_number":16,"context_line":"key but it seems that is impossible.  We\u0027ll have to live with it in"},{"line_number":17,"context_line":"the primary key even though it doesn\u0027t really make sense to me and it"},{"line_number":18,"context_line":"doesn\u0027t help us out at all."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"7aa08908_f664d422","line":15,"updated":"2016-06-08 05:06:20.000000000","message":"Why would you want to remove it from primary key? Can you elaborate on why you think it does not help enforcing an integrity constraint and model relationship between trunk and Subport?","commit_id":"fe25eda16a01bc9c2f8cf5fce64c0dfb8134a407"}],"neutron/db/migration/alembic_migrations/versions/newton/expand/0e877ec3cba3_add_index_to_trunk_model_and_adjust_.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"fafe540fe58dcb763187eb034673aa60bae040f1","unresolved":false,"context_lines":[{"line_number":17,"context_line":"it in the primary key because the port_id is unique already and so the"},{"line_number":18,"context_line":"combination of (port_id, trunk_id) must also be unique."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This migration is also careful not to drop the index on port_id which was"},{"line_number":21,"context_line":"created by the \"unique\" attribute because dropping that index and failing to"},{"line_number":22,"context_line":"drop trunk_id from the primary key would lose the ability to enforce uniqueness"},{"line_number":23,"context_line":"of port_id."}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_2a19e422","line":20,"updated":"2016-06-07 18:34:41.000000000","message":"Actually, now that I\u0027ve uploaded this, I think there is a problem with this.  Anyone else who tries to auto-generate a migration will probably get a contract migration script that tries to drop this index.  But, that would be bad because it is still needed.\n\nI\u0027m wondering if there is any good way to change a poorly thought out primary key.  It seems like we\u0027re stuck with it for good.","commit_id":"953dda393ce97437862ef311b1657c4ad01845fa"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"e62506b84db55e636bb7c4eb180b9e5d2f4c6998","unresolved":false,"context_lines":[{"line_number":17,"context_line":"it in the primary key because the port_id is unique already and so the"},{"line_number":18,"context_line":"combination of (port_id, trunk_id) must also be unique."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This migration is also careful not to drop the index on port_id which was"},{"line_number":21,"context_line":"created by the \"unique\" attribute because dropping that index and failing to"},{"line_number":22,"context_line":"drop trunk_id from the primary key would lose the ability to enforce uniqueness"},{"line_number":23,"context_line":"of port_id."}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_d10a8289","line":20,"in_reply_to":"7aa08908_2a19e422","updated":"2016-06-08 05:38:45.000000000","message":"The Trunk in the primary key is modeling that a Subport can only be part of a single trunk at any given time. How else would you model this succinctly via integrity constraint?","commit_id":"953dda393ce97437862ef311b1657c4ad01845fa"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"471906471ddd35032a75a97303ba192c97a9d3b0","unresolved":false,"context_lines":[{"line_number":17,"context_line":"it in the primary key because the port_id is unique already and so the"},{"line_number":18,"context_line":"combination of (port_id, trunk_id) must also be unique."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This migration is also careful not to drop the index on port_id which was"},{"line_number":21,"context_line":"created by the \"unique\" attribute because dropping that index and failing to"},{"line_number":22,"context_line":"drop trunk_id from the primary key would lose the ability to enforce uniqueness"},{"line_number":23,"context_line":"of port_id."}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_7efd2b6d","line":20,"in_reply_to":"7aa08908_64b80076","updated":"2016-06-08 16:09:31.000000000","message":"doh, you\u0027re right...I am trying to remember why when I played this in my head made sense...but nothing is coming to mind.","commit_id":"953dda393ce97437862ef311b1657c4ad01845fa"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"f0c8bc96032e7a5136a5cde4d753e857edc97b1a","unresolved":false,"context_lines":[{"line_number":17,"context_line":"it in the primary key because the port_id is unique already and so the"},{"line_number":18,"context_line":"combination of (port_id, trunk_id) must also be unique."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"This migration is also careful not to drop the index on port_id which was"},{"line_number":21,"context_line":"created by the \"unique\" attribute because dropping that index and failing to"},{"line_number":22,"context_line":"drop trunk_id from the primary key would lose the ability to enforce uniqueness"},{"line_number":23,"context_line":"of port_id."}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_64b80076","line":20,"in_reply_to":"7aa08908_d10a8289","updated":"2016-06-08 15:05:22.000000000","message":"It is the opposite.  With trunk_id in the primary key, the following would be allowed because it is the entire primary key that must be unique:\n\n  (port1, trunk1)\n  (port1, trunk2)\n\nBut we\u0027re saved because the port_id is *additionally* marked as unique [1].  It is that property of the port_id that models that a subport can only be part of a single trunk at any given time.  If the primary key were only (port_id) as I wish it were, then that would make the unique property of the port_id redundant.\n\n [1] https://github.com/openstack/neutron/blob/9e7137f7f6/neutron/services/trunk/models.py#L42","commit_id":"953dda393ce97437862ef311b1657c4ad01845fa"}],"neutron/services/trunk/models.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"2d0207331657cd01597ff2355f2ea9f1421261f1","unresolved":false,"context_lines":[{"line_number":53,"context_line":"    segmentation_id \u003d sa.Column(sa.Integer, nullable\u003dFalse)"},{"line_number":54,"context_line":""},{"line_number":55,"context_line":"    __table_args__ \u003d ("},{"line_number":56,"context_line":"        sa.Index(\u0027ix_subports_trunk_id\u0027, \u0027trunk_id\u0027),"},{"line_number":57,"context_line":"        sa.UniqueConstraint("},{"line_number":58,"context_line":"            \u0027trunk_id\u0027,"},{"line_number":59,"context_line":"            \u0027segmentation_type\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_aa331461","line":56,"range":{"start_line":56,"start_character":8,"end_line":56,"end_character":53},"updated":"2016-06-07 18:39:38.000000000","message":"The index is intended to make \"get me the list of subports for the given trunk efficient.\n\nI don\u0027t think that the primary key (port_id, trunk_id) does this because port_id is listed first.  I think in is analogous to search a string index for something that matches the last half of a string.  Indexes are optimized for the first part, right?  I could be wrong.","commit_id":"953dda393ce97437862ef311b1657c4ad01845fa"},{"author":{"_account_id":21273,"name":"Ilya Chukhnakov","email":"Ilya.chukhnakov@gmail.com","username":"ichukhnakov"},"change_message_id":"45a25825d7171d816a4955da23c1df0b02e4d103","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    segmentation_id \u003d sa.Column(sa.Integer, nullable\u003dFalse)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    __table_args__ \u003d ("},{"line_number":59,"context_line":"        sa.Index(\u0027ix_subports_trunk_id\u0027, \u0027trunk_id\u0027),"},{"line_number":60,"context_line":"        sa.UniqueConstraint("},{"line_number":61,"context_line":"            \u0027trunk_id\u0027,"},{"line_number":62,"context_line":"            \u0027segmentation_type\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"7aa08908_f22d55fe","line":59,"range":{"start_line":59,"start_character":8,"end_line":59,"end_character":52},"updated":"2016-06-10 13:49:23.000000000","message":"That index is actually redundant. We already got the (trunk_id,segmentation_type,segmentation_id) index from the UniqueConstraint few lines below and the \u0027trunk_id\u0027 is the leftmost prefix of that index (search [1] for \"leftmost prefix\").\n\n[1] http://dev.mysql.com/doc/refman/5.7/en/multiple-column-indexes.html","commit_id":"6d8d00fea1021cb50087bebf051b7795cda1978d"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"59da577dc404fe8573a0e7494a8097b2b4dbc6a1","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    segmentation_id \u003d sa.Column(sa.Integer, nullable\u003dFalse)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    __table_args__ \u003d ("},{"line_number":59,"context_line":"        sa.Index(\u0027ix_subports_trunk_id\u0027, \u0027trunk_id\u0027),"},{"line_number":60,"context_line":"        sa.UniqueConstraint("},{"line_number":61,"context_line":"            \u0027trunk_id\u0027,"},{"line_number":62,"context_line":"            \u0027segmentation_type\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"7aa08908_2e41313a","line":59,"range":{"start_line":59,"start_character":8,"end_line":59,"end_character":52},"in_reply_to":"7aa08908_6381928f","updated":"2016-06-10 15:34:35.000000000","message":"Also my fault for not actually knowing that a unique constraint creates an index. We can revert this if we are quick.","commit_id":"6d8d00fea1021cb50087bebf051b7795cda1978d"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"1d1bd3ef1a0d8d6f7bc935d78224eaf2c6334762","unresolved":false,"context_lines":[{"line_number":56,"context_line":"    segmentation_id \u003d sa.Column(sa.Integer, nullable\u003dFalse)"},{"line_number":57,"context_line":""},{"line_number":58,"context_line":"    __table_args__ \u003d ("},{"line_number":59,"context_line":"        sa.Index(\u0027ix_subports_trunk_id\u0027, \u0027trunk_id\u0027),"},{"line_number":60,"context_line":"        sa.UniqueConstraint("},{"line_number":61,"context_line":"            \u0027trunk_id\u0027,"},{"line_number":62,"context_line":"            \u0027segmentation_type\u0027,"}],"source_content_type":"text/x-python","patch_set":4,"id":"7aa08908_6381928f","line":59,"range":{"start_line":59,"start_character":8,"end_line":59,"end_character":52},"in_reply_to":"7aa08908_f22d55fe","updated":"2016-06-10 15:29:53.000000000","message":"Ilya, you are totally right!  I did not even notice it in all the times I looked.  And, I should\u0027ve known given my recent comment to Rawiln [1].  This is one of those embarrassing moments...\n\nI suppose that we can just revert this.\n\n[1] https://review.openstack.org/#/c/327201/3/neutron/services/trunk/models.py","commit_id":"6d8d00fea1021cb50087bebf051b7795cda1978d"}]}
