MDEV-39360: set statement optimizer_record_context for query fails#5259
Conversation
Move the initialization of context recorder, and replay after run_set_statement_if_requested() is invoked in the mysql_execute_command() in sql_parse.cc
There was a problem hiding this comment.
Code Review
This pull request addresses MDEV-39360, where using SET STATEMENT optimizer_record_context=1 FOR <query> failed to record the optimizer context. The fix moves the initialization of the optimizer context replay and recorder (init_optimizer_context_replay_if_needed and init_optimizer_context_recorder_if_needed) to occur after ots.init(...) in mysql_execute_command, ensuring that statement-specific variable overrides are properly applied before initialization. Additionally, corresponding regression tests have been added to verify this behavior. There are no review comments, and I have no further feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Move the initialization of context recorder, and replay after run_set_statement_if_requested() is invoked in the mysql_execute_command() in sql_parse.cc