MDEV-39433: Crash when recording context for a sequence query#5193
Conversation
There was a problem hiding this comment.
Code Review
This pull request addresses MDEV-39433 by fixing a crash that occurs when selecting from a sequence with optimizer_record_context enabled. The fix updates the is_base_table function in sql/opt_context_store_replay.cc to ensure that sequences are not treated as base tables by checking !tbl->table->s->sequence. Corresponding test cases and results have also been added to verify the fix. No review comments were provided, so there is no additional feedback.
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.
269210c to
52fe014
Compare
With optimizer_record_context enabled, a simple query involving sequence such as: create sequence s1; Explain select * from s1; is crashing in store_optimizer_costs(). There are no costs associated with sequence tables, and their fields, and hence when trying to access cost information for them, a crash occurs. Solution ======== Don't try to store stats or cost information for sequences
52fe014 to
5152905
Compare
5152905
into
bb-12.3-MDEV-39368-test-replay
With optimizer_record_context enabled, a simple query involving sequence such as:
create sequence s1;
Explain select * from s1;
is crashing in store_optimizer_costs(). There are no costs associated with sequence tables, and their fields, and hence when trying to access cost information for them, a crash occurs.
Solution
in store_optimizer_costs() return immediately if the costs is set to null