-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
MDEV-38144: Optional_metadata_fields Replace std::vector with MariaDB Types #4494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
MDEV-38144: Optional_metadata_fields Replace std::vector with MariaDB Types #4494
Conversation
bnestere
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @SharonIV0x86 !
Thanks for asking for early feedback on your contribution! I added a couple notes so far, but generally, it looks like things are in the right direction.
sql/log_event.cc
Outdated
| Dynamic_array<str_vector> enum_str_value(PSI_INSTRUMENT_MEM, 0, 0); | ||
| Dynamic_array<str_vector> set_str_value(PSI_INSTRUMENT_MEM, 0, 0); | ||
| Dynamic_array<unsigned int> geometry_type(PSI_INSTRUMENT_MEM, 0, 0); | ||
| Dynamic_array<uint_pair> primary_key(PSI_INSTRUMENT_MEM, 0, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need these Dynamic_arrays. I think you can start the
m_columns = Dynamic_array<Column_metadata>(PSI_INSTRUMENT_MEM, 0, 0);
here, and then build up each Column_metadata one by one here. This would then change the signature of each parse_* function to take in a Column_metadata* type, which it would directly modify.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, i am working on it.
sql/log_event.cc
Outdated
| unsigned char *field, unsigned int length) | ||
| { | ||
| unsigned char* p= field; | ||
| unsigned char* p = field; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MariaDB coding standards actually dictate the original:
Assignments should not have a space on the left side of the equals, and one space on the right hand side. For example:
a= 1; // Correct a = 1; // Incorrect for the server code,
|
I have made the changes as you suggested. I had to add a new parser function, I split And modified the |
Description
This PR aims to replace stl types with mariadb types. Thus introduces a
Column_metadatastruct to allocate values.The
Table_map_log_event::Optional_metadata_fieldsstruct is full ofstd::vectortypes, one for each column option/type/attribute etc. Instead, it would be better to have an array of fields. This would allow us to allocate everything in one go (except column names) and would simplify a lot of the current functions.The current build will fail as in
log_client.ccthe old STL types containers are being used and this file also requires refactoring.Release Notes
There is no change to system variables or status variables, just how the table field values are stored and parsed is modified.
How can this PR be tested?
TODO: modify the automated test suite to verify that the PR causes MariaDB to behave as intended.
Consult the documentation on "Writing good test cases".
If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.
Basing the PR against the correct MariaDB version
mainbranch.PR quality check