Skip to content

MDEV-39768: Optimizer trace should use utf8mb4#5132

Open
spetrunia wants to merge 1 commit into
mainfrom
bb-main-MDEV-39768
Open

MDEV-39768: Optimizer trace should use utf8mb4#5132
spetrunia wants to merge 1 commit into
mainfrom
bb-main-MDEV-39768

Conversation

@spetrunia
Copy link
Copy Markdown
Member

JSON is utf8mb4. Change INFORMATION_SCHEMA.OPTIMIZER_TRACE.TRACE from using utf8mb3 to mb4.

In order to do that:

  • Add m_charset into Show::Type (NULL means "use the default")
  • Make Type_handler_varchar::make_schema_field() check that field and use the specified charset/collation.
  • Add a constructor to Show::Longtext that allows to specify the charset
  • Make optimizer_trace use my_charset_utf8mb4_general_ci.

Copy link
Copy Markdown

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

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-39768 by modifying the optimizer trace to use the utf8mb4 character set. It updates the Type and Longtext classes in sql/sql_i_s.h to support custom character sets, and modifies Type_handler_varchar::make_schema_field in sql/sql_type.cc to respect the custom charset and dynamically calculate octet length based on the character set's maximum byte length. The TRACE column in sql/opt_trace.cc is updated to use utf8mb4_general_ci, and corresponding test files and results are updated to verify this change. There are no review comments, and I have no additional feedback to provide.

@spetrunia spetrunia force-pushed the bb-main-MDEV-39768 branch from f12af37 to 65eddba Compare May 27, 2026 11:19
JSON is utf8mb4. Change INFORMATION_SCHEMA.OPTIMIZER_TRACE.TRACE from
using utf8mb3 to mb4.

In order to do that:
- Add m_charset into Show::Type (NULL means "use the default")
- Make Type_handler_varchar::make_schema_field() check that field
  and use the specified charset/collation.
- Add a constructor to Show::Longtext that allows to specify the charset
- Make optimizer_trace use my_charset_utf8mb4_general_ci.
- In fill_optimizer_trace_info(), indicate that the trace we've
  collected is utf8mb4
@spetrunia spetrunia force-pushed the bb-main-MDEV-39768 branch from 65eddba to 96cf971 Compare May 27, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant