)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"46ab143539f3f8b6537cab28d3443d42232f3490","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The SQLAlchemy ORM call ``.distinct(\u0027host\u0027)`` indicates that"},{"line_number":10,"context_line":"an expression such as \"DISTINCT ON host\" should be rendered."},{"line_number":11,"context_line":"However, this syntax is only available on PostgreSQL.   When run"},{"line_number":12,"context_line":"on any other backend, the expression delivers SQL \"DISTINCT\""},{"line_number":13,"context_line":"and the additional expressions are ignored."},{"line_number":14,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"3fa7e38b_f10d4492","line":11,"updated":"2020-02-06 23:42:17.000000000","message":"AFAIK, we still support postgres so I\u0027m wondering, does it hurt to leave the \".distinct(\u0027host\u0027)\" as-is if it does something in postgres and doesn\u0027t cause any negative effects in mysql?\n\nBut, I\u0027m also thinking that having an expression that might behave differently depending on the database backend is not desirable.","commit_id":"57b08f817a15b345ef09a85a753d548858cd79bb"}],"nova/db/sqlalchemy/api.py":[{"author":{"_account_id":4690,"name":"melanie witt","display_name":"melwitt","email":"melwittt@gmail.com","username":"melwitt"},"change_message_id":"46ab143539f3f8b6537cab28d3443d42232f3490","unresolved":false,"context_lines":[{"line_number":485,"context_line":"    query \u003d query.join(models.ComputeNode,"},{"line_number":486,"context_line":"                       models.Service.host \u003d\u003d models.ComputeNode.host).\\"},{"line_number":487,"context_line":"                  filter(models.ComputeNode.hypervisor_type \u003d\u003d hv_type).\\"},{"line_number":488,"context_line":"                  distinct()"},{"line_number":489,"context_line":"    return query.all()"},{"line_number":490,"context_line":""},{"line_number":491,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_bc3a4394","line":488,"updated":"2020-02-06 23:42:17.000000000","message":"So this was intended to collapse \u0027compute_nodes\u0027 table records that have the same \u0027host\u0027 but different \"node\" into single records (in ironic, for example: ComputeNode(host\u003d\u0027host1\u0027, node\u003d\u0027node1\u0027), ComputeNode(host\u003d\u0027host1\u0027, node\u003d\u0027node2\u0027) represent two ironic nodes that have the same nova-compute service on host1)\n\nBut it wasn\u0027t doing that for anything other than postgres and was/is instead just taking distinct rows (which the above example would _not_ be collapsed and thus not do what was intended).\n\nAnd it apparently doesn\u0027t matter because the left table in the join is the \u0027services\u0027 table which has unique constraints on \u0027host\u0027, \u0027binary\u0027/\u0027topic\u0027, and \u0027deleted\u0027:\n\nhttps://opendev.org/openstack/nova/src/commit/69ce0f01b60dfe0f020ac57eb82a42e5935064c4/nova/db/sqlalchemy/models.py#L81-L84\n\nand we\u0027ll only take rows from the \u0027services\u0027 table that match \u0027compute_nodes\u0027 where hypervisor type matches.\n\nAll of this is to ask, should we keep distinct here at all? Am I missing a desired thing that it\u0027s doing?","commit_id":"57b08f817a15b345ef09a85a753d548858cd79bb"},{"author":{"_account_id":11816,"name":"mike_mp@zzzcomputing.com","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"6d9e7d3c440cf98fb4b86d0f09ff81452fc2349f","unresolved":false,"context_lines":[{"line_number":485,"context_line":"    query \u003d query.join(models.ComputeNode,"},{"line_number":486,"context_line":"                       models.Service.host \u003d\u003d models.ComputeNode.host).\\"},{"line_number":487,"context_line":"                  filter(models.ComputeNode.hypervisor_type \u003d\u003d hv_type).\\"},{"line_number":488,"context_line":"                  distinct()"},{"line_number":489,"context_line":"    return query.all()"},{"line_number":490,"context_line":""},{"line_number":491,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_89c4e862","line":488,"in_reply_to":"3fa7e38b_bc3a4394","updated":"2020-02-06 23:54:36.000000000","message":"from my pov distinct() is usually not that useful with full object queries, not to mention it\u0027s a poor performer, because it\u0027s having to DISTINCT every column you\u0027re getting back.  The ORM already \"uniques\" all the objects coming back on primary key identity so this can\u0027t actually change the result.  So it\u0027s likely you might want to take this out altogether.","commit_id":"57b08f817a15b345ef09a85a753d548858cd79bb"}],"tools/hooks/post_test_hook.sh":[{"author":{"_account_id":11816,"name":"mike_mp@zzzcomputing.com","display_name":"Mike Bayer","email":"mike_mp@zzzcomputing.com","username":"zzzeek","status":"Red Hat"},"change_message_id":"a20bd03ce0354e69a48bddf9e9f9b9e45bd86dc2","unresolved":false,"context_lines":[{"line_number":1,"context_line":"../../gate/post_test_hook.sh"}],"source_content_type":"x-git/symlink","patch_set":1,"id":"3fa7e38b_1dcffc54","side":"PARENT","line":1,"updated":"2020-02-04 23:28:32.000000000","message":"i have no idea why this got removed","commit_id":"b42c54752f4c7d66bde313bdc1e8053d76b5588a"}]}
