Skip to content

MDEV-24658: Optimizer trace reads a column not marked for read#5321

Open
DaveGosselin-MariaDB wants to merge 1 commit into
10.11from
10.11-mdev-24658-asan
Open

MDEV-24658: Optimizer trace reads a column not marked for read#5321
DaveGosselin-MariaDB wants to merge 1 commit into
10.11from
10.11-mdev-24658-asan

Conversation

@DaveGosselin-MariaDB

Copy link
Copy Markdown
Member

When the optimizer trace is enabled, it's safe to read from a constant table because the value in record[0] was materialized during optimization and remains available, even after constants propagation has removed the table from the read set.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses MDEV-24658 where the optimizer trace reads a column not marked for read. The fix updates Field::marked_for_read() in sql/field.cc to return true if the table is a constant table (table->const_table), as its row is read during optimization and remains materialized in record[0]. Additionally, a corresponding test case has been added to mysql-test/main/opt_trace.test and its expected output updated in mysql-test/main/opt_trace.result. There are no review comments to address, 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.

When the optimizer trace is enabled, it's safe to read from a
constant table because the value in record[0] was materialized
during optimization and remains available, even after constants
propagation has removed the table from the read set.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant