[SERVER-80483] [CQF] Split last-ref analysis into a separate pass Created: 28/Aug/23  Updated: 29/Oct/23  Resolved: 15/Sep/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.2.0-rc0

Type: Task Priority: Major - P3
Reporter: David Percy Assignee: David Percy
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Related
related to SERVER-80953 Efficient ref tracking - replace useM... Closed
is related to SERVER-78353 [CQF] Investigate reference tracker s... Closed
Backwards Compatibility: Fully Compatible
Sprint: QO 2023-09-04, QO 2023-09-18
Participants:
Linked BF Score: 35

 Description   

Every time we run the reference tracker, it gathers a set of last-refs (Variable expressions safe to move from), but we only use this information in lowering. We should split this into a separate pass so we skip that work during all the other phases.



 Comments   
Comment by Githook User [ 15/Sep/23 ]

Author:

{'name': 'David Percy', 'email': 'david.percy@mongodb.com', 'username': 'dpercy'}

Message: SERVER-80483 Only compute lastRefs where needed for lowering

Most phases in the optimizer use VariableEnvironment only to connect
definitions and uses. The last-ref analysis is only needed when lowering
to SBE.

This commit:

  • changes the implementation of VariableEnvironment to compute
    lastRefs in a separate pass.
  • lets the caller choose to skip this separate pass.

It also makes the intermediate data structure in last-refs more
efficient, by not representing non-last-ref variables. Previously we
were iterating over these uninteresting variables at every level of the
recursion.
Branch: master
https://github.com/mongodb/mongo/commit/96464e8d57559625b52138ee6f3967300db6425f

Generated at Thu Feb 08 06:43:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.