)]}'
{"nova/api/openstack/placement/objects/resource_provider.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c7d916ec5d9e554c52989095e3d7c60551708e57","unresolved":false,"context_lines":[{"line_number":738,"context_line":"    # SELECT"},{"line_number":739,"context_line":"    #   rp.id"},{"line_number":740,"context_line":"    # FROM resource_providers AS rp"},{"line_number":741,"context_line":"    # JOIN resource_provider_aggregates AS rpa1"},{"line_number":742,"context_line":"    #   ON rp.id \u003d rpa1.resource_provider_id"},{"line_number":743,"context_line":"    #   AND rpa1.aggregate_id IN ($AGG1_ID)"},{"line_number":744,"context_line":"    # JOIN resource_provider_aggregates AS rpa2"},{"line_number":745,"context_line":"    #   ON rp.id \u003d rpa2.resource_provider_id"},{"line_number":746,"context_line":"    #   AND rpa2.aggregate_id IN ($AGG2_ID)"},{"line_number":747,"context_line":"    # JOIN resource_provider_aggregates AS rpa3"},{"line_number":748,"context_line":"    #   ON rp.id \u003d rpa3.resource_provider_id"},{"line_number":749,"context_line":"    #   AND rpa3.aggregate_id IN ($AGG3_ID, $AGG4_ID)"},{"line_number":750,"context_line":""},{"line_number":751,"context_line":"    # First things first, get a map of all the aggregate UUID to internal"},{"line_number":752,"context_line":"    # aggregate IDs"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_73e1899b","line":749,"range":{"start_line":741,"start_character":0,"end_line":749,"end_character":53},"updated":"2018-06-18 13:34:28.000000000","message":"Should update this.","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"d1d3667529897ba624d30b8b7666ab80f0dc79e2","unresolved":false,"context_lines":[{"line_number":738,"context_line":"    # SELECT"},{"line_number":739,"context_line":"    #   rp.id"},{"line_number":740,"context_line":"    # FROM resource_providers AS rp"},{"line_number":741,"context_line":"    # JOIN resource_provider_aggregates AS rpa1"},{"line_number":742,"context_line":"    #   ON rp.id \u003d rpa1.resource_provider_id"},{"line_number":743,"context_line":"    #   AND rpa1.aggregate_id IN ($AGG1_ID)"},{"line_number":744,"context_line":"    # JOIN resource_provider_aggregates AS rpa2"},{"line_number":745,"context_line":"    #   ON rp.id \u003d rpa2.resource_provider_id"},{"line_number":746,"context_line":"    #   AND rpa2.aggregate_id IN ($AGG2_ID)"},{"line_number":747,"context_line":"    # JOIN resource_provider_aggregates AS rpa3"},{"line_number":748,"context_line":"    #   ON rp.id \u003d rpa3.resource_provider_id"},{"line_number":749,"context_line":"    #   AND rpa3.aggregate_id IN ($AGG3_ID, $AGG4_ID)"},{"line_number":750,"context_line":""},{"line_number":751,"context_line":"    # First things first, get a map of all the aggregate UUID to internal"},{"line_number":752,"context_line":"    # aggregate IDs"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_0b432313","line":749,"range":{"start_line":741,"start_character":0,"end_line":749,"end_character":53},"in_reply_to":"5f7c97a3_73e1899b","updated":"2018-06-19 07:30:28.000000000","message":"Done","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c7d916ec5d9e554c52989095e3d7c60551708e57","unresolved":false,"context_lines":[{"line_number":777,"context_line":"        join_cond \u003d sa.and_("},{"line_number":778,"context_line":"            rp_tbl.c.id \u003d\u003d rpa_tbl.c.resource_provider_id,"},{"line_number":779,"context_line":"            rpa_tbl.c.aggregate_id.in_(agg_ids))"},{"line_number":780,"context_line":"        if rp_ids:"},{"line_number":781,"context_line":"            join_cond \u003d sa.and_("},{"line_number":782,"context_line":"                join_cond, rp_tbl.c.id.in_(rp_ids))"},{"line_number":783,"context_line":"        join_chain \u003d sa.join(join_chain, rpa_tbl, join_cond)"},{"line_number":784,"context_line":"    sel \u003d sa.select([rp_tbl.c.id]).select_from(join_chain)"},{"line_number":785,"context_line":"    return [r[0] for r in context.session.execute(sel).fetchall()]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_d382dda5","line":782,"range":{"start_line":780,"start_character":0,"end_line":782,"end_character":51},"updated":"2018-06-18 13:34:28.000000000","message":"Is this (putting the same condition within each JOIN clause) more efficient than putting a single WHERE on the outside?","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"138ac622ff7f20225afeb118391acdf99e653d9f","unresolved":false,"context_lines":[{"line_number":777,"context_line":"        join_cond \u003d sa.and_("},{"line_number":778,"context_line":"            rp_tbl.c.id \u003d\u003d rpa_tbl.c.resource_provider_id,"},{"line_number":779,"context_line":"            rpa_tbl.c.aggregate_id.in_(agg_ids))"},{"line_number":780,"context_line":"        if rp_ids:"},{"line_number":781,"context_line":"            join_cond \u003d sa.and_("},{"line_number":782,"context_line":"                join_cond, rp_tbl.c.id.in_(rp_ids))"},{"line_number":783,"context_line":"        join_chain \u003d sa.join(join_chain, rpa_tbl, join_cond)"},{"line_number":784,"context_line":"    sel \u003d sa.select([rp_tbl.c.id]).select_from(join_chain)"},{"line_number":785,"context_line":"    return [r[0] for r in context.session.execute(sel).fetchall()]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_2ac4d040","line":782,"range":{"start_line":780,"start_character":0,"end_line":782,"end_character":51},"updated":"2018-06-19 14:29:16.000000000","message":"This will work, but it isn\u0027t necessary and makes the SQL more complicated than it needs to be. Instead of adding this to each join condition, simply add a single WHERE condition after line 784, like so:\n\n sel \u003d sel.where(rp_tbl.c.id.in_(rp_ids))\n\nthe effect will be the same, since the join condition for each joined copy of the resource_provider_aggregates table is on (resource_providers.id \u003d resource_provider_aggregates.resource_provider_id).\n\nThe filter on resource_providers.id will be \"pushed down\" into the JOIN conditions automatically.\n\nYou can see evidence of this here:\n\nhttp://paste.openstack.org/show/723833/\n\nSame thing for PostgreSQL.","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"d961930d91176b04d356b700da08ad03466abd02","unresolved":false,"context_lines":[{"line_number":777,"context_line":"        join_cond \u003d sa.and_("},{"line_number":778,"context_line":"            rp_tbl.c.id \u003d\u003d rpa_tbl.c.resource_provider_id,"},{"line_number":779,"context_line":"            rpa_tbl.c.aggregate_id.in_(agg_ids))"},{"line_number":780,"context_line":"        if rp_ids:"},{"line_number":781,"context_line":"            join_cond \u003d sa.and_("},{"line_number":782,"context_line":"                join_cond, rp_tbl.c.id.in_(rp_ids))"},{"line_number":783,"context_line":"        join_chain \u003d sa.join(join_chain, rpa_tbl, join_cond)"},{"line_number":784,"context_line":"    sel \u003d sa.select([rp_tbl.c.id]).select_from(join_chain)"},{"line_number":785,"context_line":"    return [r[0] for r in context.session.execute(sel).fetchall()]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_764e2a6f","line":782,"range":{"start_line":780,"start_character":0,"end_line":782,"end_character":51},"in_reply_to":"5f7c97a3_2ac4d040","updated":"2018-06-20 02:08:51.000000000","message":"Thank you for your kindness that you included that link of the evidence! Learned a lot, and ...it sounds that MYSQL and PostgreSQL are cleverer than me. :P\n\nDone.","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"f67d1a8eacbf56c7701dec67ee15a05a2806a53f","unresolved":false,"context_lines":[{"line_number":777,"context_line":"        join_cond \u003d sa.and_("},{"line_number":778,"context_line":"            rp_tbl.c.id \u003d\u003d rpa_tbl.c.resource_provider_id,"},{"line_number":779,"context_line":"            rpa_tbl.c.aggregate_id.in_(agg_ids))"},{"line_number":780,"context_line":"        if rp_ids:"},{"line_number":781,"context_line":"            join_cond \u003d sa.and_("},{"line_number":782,"context_line":"                join_cond, rp_tbl.c.id.in_(rp_ids))"},{"line_number":783,"context_line":"        join_chain \u003d sa.join(join_chain, rpa_tbl, join_cond)"},{"line_number":784,"context_line":"    sel \u003d sa.select([rp_tbl.c.id]).select_from(join_chain)"},{"line_number":785,"context_line":"    return [r[0] for r in context.session.execute(sel).fetchall()]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_57fd396c","line":782,"range":{"start_line":780,"start_character":0,"end_line":782,"end_character":51},"in_reply_to":"5f7c97a3_ab14704e","updated":"2018-06-19 13:55:14.000000000","message":"Oh, no, don\u0027t hold up the patch for this.  If you want to put in a TODO to investigate, that\u0027s fine.  Or maybe Jay could answer off the top of his head.","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"d1d3667529897ba624d30b8b7666ab80f0dc79e2","unresolved":false,"context_lines":[{"line_number":777,"context_line":"        join_cond \u003d sa.and_("},{"line_number":778,"context_line":"            rp_tbl.c.id \u003d\u003d rpa_tbl.c.resource_provider_id,"},{"line_number":779,"context_line":"            rpa_tbl.c.aggregate_id.in_(agg_ids))"},{"line_number":780,"context_line":"        if rp_ids:"},{"line_number":781,"context_line":"            join_cond \u003d sa.and_("},{"line_number":782,"context_line":"                join_cond, rp_tbl.c.id.in_(rp_ids))"},{"line_number":783,"context_line":"        join_chain \u003d sa.join(join_chain, rpa_tbl, join_cond)"},{"line_number":784,"context_line":"    sel \u003d sa.select([rp_tbl.c.id]).select_from(join_chain)"},{"line_number":785,"context_line":"    return [r[0] for r in context.session.execute(sel).fetchall()]"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_ab14704e","line":782,"range":{"start_line":780,"start_character":0,"end_line":782,"end_character":51},"in_reply_to":"5f7c97a3_d382dda5","updated":"2018-06-19 07:30:28.000000000","message":"That depends, but if it is a large cloud and the table is big enough, I think so.\n\nAssuming JOINing two tables with N rows on \"condition A\" costs N^2 evaluations. We should reduce this quadratically increased evaluations paying the costs of N evaluations for each JOIN for aggregate which is linear.\n\n[later] But let me think, rp_ids have pretty many values in it, so this evaluation is costly itself, isn\u0027t it? ... I\u0027m not sure if this is faster even than the original. I think we need evaluations tests for this. -W\u0027ed this.","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c7d916ec5d9e554c52989095e3d7c60551708e57","unresolved":false,"context_lines":[{"line_number":2871,"context_line":"    \"\"\"Returns a list of two-tuples (provider internal ID, root provider"},{"line_number":2872,"context_line":"    internal ID) for providers that satisfy the request for resources."},{"line_number":2873,"context_line":""},{"line_number":2874,"context_line":"    If traits are also required, this function only returns results where the"},{"line_number":2875,"context_line":"    set of providers within a tree that satisfy the resource request"},{"line_number":2876,"context_line":"    collectively have all the required traits associated with them. This means"},{"line_number":2877,"context_line":"    that given the following provider tree:"},{"line_number":2878,"context_line":""},{"line_number":2879,"context_line":"    cn1"},{"line_number":2880,"context_line":"     |"},{"line_number":2881,"context_line":"     --\u003e pf1 (SRIOV_NET_VF:2)"},{"line_number":2882,"context_line":"     |"},{"line_number":2883,"context_line":"     --\u003e pf2 (SRIOV_NET_VF:1, HW_NIC_OFFLOAD_GENEVE)"},{"line_number":2884,"context_line":""},{"line_number":2885,"context_line":"    If a user requests 1 SRIOV_NET_VF resource and no required traits will"},{"line_number":2886,"context_line":"    return both pf1 and pf2. However, a request for 2 SRIOV_NET_VF and required"},{"line_number":2887,"context_line":"    trait of HW_NIC_OFFLOAD_GENEVE will return no results (since pf1 is the"},{"line_number":2888,"context_line":"    only provider with enough inventory of SRIOV_NET_VF but it does not have"},{"line_number":2889,"context_line":"    the required HW_NIC_OFFLOAD_GENEVE trait)."},{"line_number":2890,"context_line":""},{"line_number":2891,"context_line":"    :note: This function is used for scenarios that do NOT involve sharing"},{"line_number":2892,"context_line":"    providers AND where there are nested providers present in the deployment."}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_13161557","line":2889,"range":{"start_line":2874,"start_character":0,"end_line":2889,"end_character":46},"updated":"2018-06-18 13:34:28.000000000","message":"This is kind of old, I guess.  It doesn\u0027t talk about forbidden traits or aggregates.  (Don\u0027t change it - just musing.)","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c7d916ec5d9e554c52989095e3d7c60551708e57","unresolved":false,"context_lines":[{"line_number":2888,"context_line":"    only provider with enough inventory of SRIOV_NET_VF but it does not have"},{"line_number":2889,"context_line":"    the required HW_NIC_OFFLOAD_GENEVE trait)."},{"line_number":2890,"context_line":""},{"line_number":2891,"context_line":"    :note: This function is used for scenarios that do NOT involve sharing"},{"line_number":2892,"context_line":"    providers AND where there are nested providers present in the deployment."},{"line_number":2893,"context_line":""},{"line_number":2894,"context_line":"    :param ctx: Session context to use"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_b32161b8","line":2891,"range":{"start_line":2891,"start_character":52,"end_line":2891,"end_character":74},"updated":"2018-06-18 13:34:28.000000000","message":"okay","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"c7d916ec5d9e554c52989095e3d7c60551708e57","unresolved":false,"context_lines":[{"line_number":2963,"context_line":"    # resource providers that meet the member_of constraints."},{"line_number":2964,"context_line":"    if member_of:"},{"line_number":2965,"context_line":"        rps_in_aggs \u003d _provider_ids_matching_aggregates(ctx, member_of,"},{"line_number":2966,"context_line":"                                                        trees_with_inv)"},{"line_number":2967,"context_line":"        if not rps_in_aggs:"},{"line_number":2968,"context_line":"            # Short-circuit. The user either asked for a non-existing"},{"line_number":2969,"context_line":"            # aggregate or there were no resource providers that matched"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_33bb1176","line":2966,"range":{"start_line":2966,"start_character":56,"end_line":2966,"end_character":70},"updated":"2018-06-18 13:34:28.000000000","message":"please name kwargs","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"d1d3667529897ba624d30b8b7666ab80f0dc79e2","unresolved":false,"context_lines":[{"line_number":2963,"context_line":"    # resource providers that meet the member_of constraints."},{"line_number":2964,"context_line":"    if member_of:"},{"line_number":2965,"context_line":"        rps_in_aggs \u003d _provider_ids_matching_aggregates(ctx, member_of,"},{"line_number":2966,"context_line":"                                                        trees_with_inv)"},{"line_number":2967,"context_line":"        if not rps_in_aggs:"},{"line_number":2968,"context_line":"            # Short-circuit. The user either asked for a non-existing"},{"line_number":2969,"context_line":"            # aggregate or there were no resource providers that matched"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_ebd2685b","line":2966,"range":{"start_line":2966,"start_character":56,"end_line":2966,"end_character":70},"in_reply_to":"5f7c97a3_33bb1176","updated":"2018-06-19 07:30:28.000000000","message":"Done","commit_id":"d936ffc03f222be97c4e481709ce81f48ea4d0e0"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"a700d6bdbf49868b5d10aa9d4eb2b8470caba835","unresolved":false,"context_lines":[{"line_number":785,"context_line":"        join_chain \u003d sa.join(join_chain, rpa_tbl, join_cond)"},{"line_number":786,"context_line":"    sel \u003d sa.select([rp_tbl.c.id]).select_from(join_chain)"},{"line_number":787,"context_line":"    if rp_ids:"},{"line_number":788,"context_line":"        sel \u003d sel.where(rp_tbl.c.id.in_(rp_ids))"},{"line_number":789,"context_line":"    return [r[0] for r in context.session.execute(sel).fetchall()]"},{"line_number":790,"context_line":""},{"line_number":791,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_d8b39f09","line":788,"updated":"2018-06-20 11:41:23.000000000","message":"++","commit_id":"aa6dd0648e04e2e5617d694174a96db4547f5c90"}]}
