-
Type: Task
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Atlas Streams
-
Fully Compatible
-
Sprint 62
In the streams planner, when we restore from a checkpoint, we restore from an (already optimized) execution plan. See more details in https://docs.google.com/document/d/1jGuo2J0y0uUpT333GtBQ4GQ7926alDa2O2BfMlHG1x0/edit?tab=t.0#heading=h.orfw4mdn3m0r.
Even when we're restoring from an optimized execution plan, we want to iterate through the generated DocumentSource instances and call ::optimize on each. This "self contained" DocumentSource::optimize is safe to do after a checkpoint restore. It will not re-order DocumentSource instances in the Pipeline, which ensures we can still restore from the state in the checkpoint.
Calling DocumentSource::optimize is helpful because it calls Expression::optimize on all expressions involved in the stage.
Note that when restoring from optimized execution plan, we will still skip the Pipeline::optimize and associated DocumentSource::doOptimizeAt calls.