Skip to content

MDEV-38144: update Optional_metadata_fields to use new aggregate per-column struct#4720

Open
EricHayter wants to merge 16 commits into
MariaDB:mainfrom
EricHayter:mdev-38144
Open

MDEV-38144: update Optional_metadata_fields to use new aggregate per-column struct#4720
EricHayter wants to merge 16 commits into
MariaDB:mainfrom
EricHayter:mdev-38144

Conversation

@EricHayter
Copy link
Copy Markdown

Currently Optional_metadata_fields has many members that use classes from the C++ standard library, most notably the use of std::vector and std::string. These members have been updated to use existing MariaDB types instead.

@EricHayter
Copy link
Copy Markdown
Author

Running .clangformat seemed to add lots of line changes. Working on providing a separate commit just with the main changes to make review easier.

@EricHayter EricHayter force-pushed the mdev-38144 branch 2 times, most recently from 1c7c5f4 to 18a122c Compare March 2, 2026 20:08
@grooverdan grooverdan requested a review from bnestere March 2, 2026 21:35
@grooverdan
Copy link
Copy Markdown
Member

Running .clangformat seemed to add lots of line changes. Working on providing a separate commit just with the main changes to make review easier.

I think it was determined that the coding standard wasn't acheivable with clang-format. I'm not sure if worth the effort.

@grooverdan grooverdan added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 2, 2026
Copy link
Copy Markdown
Contributor

@bnestere bnestere left a comment

Choose a reason for hiding this comment

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

Hi @EricHayter !

Thank you for submitting the PR! It is good to update our types to be consistent with MariaDB types. One thing this PR misses, that is in the description of MDEV-38144, is that rather than having an array per field, it would be better to have one array that has elements of a complex type which describe a field.

Previously, another contributor had prepared a patch, PR #4494, which looked to satisfy this; however, it was never thoroughly reviewed because they never got it to compile / pass tests on our CI system. I'd suggest looking through it for some inspiration (though I'm not sure of the quality of it).

Something the previous patch didn't try (though the JIRA mentions) is to use the Column_definition type defined in sql/field.h. That would be another improvement.

Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution! This is a preliminary review.

LGTM after reverting the space-only changes.

Please keep working with Brandon on the final review.

Comment thread sql/sql_array.h
Comment thread sql/sql_array.h
size_t old_size= elements();
if (reserve(new_size))
return true;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please avoid space only changes.

@EricHayter
Copy link
Copy Markdown
Author

Hi @EricHayter !

Thank you for submitting the PR! It is good to update our types to be consistent with MariaDB types. One thing this PR misses, that is in the description of MDEV-38144, is that rather than having an array per field, it would be better to have one array that has elements of a complex type which describe a field.

Previously, another contributor had prepared a patch, PR #4494, which looked to satisfy this; however, it was never thoroughly reviewed because they never got it to compile / pass tests on our CI system. I'd suggest looking through it for some inspiration (though I'm not sure of the quality of it).

Something the previous patch didn't try (though the JIRA mentions) is to use the Column_definition type defined in sql/field.h. That would be another improvement.

Noted. I'll take a look at that previous PR and update mine accordingly. Thanks.

Comment thread sql/log_event.cc
Currently Optional_metadata_fields has many members that use classes
from the C++ standard library, most notably the use of std::vector and
std::string. These members have been updated to use existing MariaDB
types instead.
Beginning to create a per-field aggregate struct for all of the possibly
required metadata values. Slowly going to start incorporating the
existing vectors into this.
@EricHayter EricHayter changed the title MDEV-38144: update Optional_metadata_fields to use MariaDB types MDEV-38144: update Optional_metadata_fields to use new aggregate per-column struct Mar 14, 2026
@EricHayter
Copy link
Copy Markdown
Author

I've made some changes to the PR introducing a new struct (Column_metadata) to store the metadata for each column. I did initially investigate using the existing Column_definition as mentioned by @bnestere earlier, but including the headers from the server code (which contains the definition for Column_definition) seemed to create some clashing with macros from the client code which seemed a bit too sharp for me to be changing.

Please note that this newer version of the PR does end up changing more code as the logic for parsing the optional metadata data is a bit more involved with this new struct.

I've also updated the PR title to be representative of the change.

Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

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

Please keep a single commit.

@ParadoxV5 ParadoxV5 removed their request for review March 21, 2026 00:02
@ParadoxV5 ParadoxV5 dismissed their stale review March 21, 2026 00:02

Obsolete

@bnestere bnestere added the Replication Patches involved in replication label Apr 22, 2026
Copy link
Copy Markdown
Contributor

@bnestere bnestere left a comment

Choose a reason for hiding this comment

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

Thanks for the update, @EricHayter ! Sorry it took so long for review, I missed that you'd updated the patch.

You've clearly spent time to understand what each piece of code is doing, and put thought into "what makes sense." That is great, thank you for the effort!

Please see my notes.

Comment thread sql/log_event.cc Outdated
Comment thread sql/log_event.h Outdated
Comment thread sql/log_event.cc Outdated
Comment thread sql/log_event.cc Outdated
Comment thread sql/log_event.cc
Comment thread sql/log_event.cc
Comment thread sql/log_event.cc Outdated
Comment thread sql/log_event_client.cc Outdated
Comment thread sql/log_event_client.cc Outdated
@EricHayter
Copy link
Copy Markdown
Author

Thank you very much for the feedback @bnestere. I will be away from home for a few weeks, so unfortunately I won't be able to address these comments right away, but I will still look to get these resolved.

Wasn't using the fact that the default charset and charset fields were mutually exclusive. Also removed the need to use optionals anywhere in the optional metadata stuff. Just filling the char columns with the charset first and then overrriding later...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. Replication Patches involved in replication

Development

Successfully merging this pull request may close these issues.

5 participants