Skip to content

Conversation

@Jayesh45-master
Copy link

  • The Jira issue number for this PR is: MDEV-______

MDEV-37674 Refactor Optional_metadata_fields storage

Replace std::vector-based Optional_metadata_fields members with a
more structured representation aligned with MariaDB internal types.

This refactoring simplifies memory allocation, reduces fragmentation,
and prepares the code for using Column_definition as the canonical
holder for column metadata.

No functional behavior is changed.

  • The Jira issue number for this PR is: MDEV-37674

Description

Table_map_log_event::Optional_metadata_fields currently stores per-column
metadata using multiple std::vector members, one for each optional
attribute (types, flags, lengths, etc.).

This design leads to:

  • Multiple independent allocations
  • Complex indexing logic
  • Redundant data structures
  • Harder future maintenance

This PR refactors the internal representation to move away from
std::vector-heavy storage and align metadata handling with MariaDB
internal column structures. The change simplifies memory management,
makes the code easier to reason about, and prepares the ground for
using Column_definition as the single authoritative metadata holder.

This work was split out from MDEV-37674, which previously removed
std::string usage from the same area.

No functional behavior or binary log format is changed.

Release Notes

Internal refactoring of replication log event metadata handling.
No user-visible behavior changes.

How can this PR be tested?

This change is a structural refactoring with no functional behavior
changes. Existing replication and binlog test coverage exercises the
affected code paths.

Recommended validation:

  • Run the existing replication test suite
  • Verify binlog-based replication still functions correctly
  • Confirm no changes in binlog parsing or event decoding behavior

No new tests were added since behavior remains unchanged.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@CLAassistant
Copy link

CLAassistant commented Dec 23, 2025

CLA assistant check
All committers have signed the CLA.

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.

2 participants