MDEV-21465: expose bind-address parameter via cmd options in client#2750
MDEV-21465: expose bind-address parameter via cmd options in client#2750grooverdan merged 2 commits intoMariaDB:11.4from
Conversation
328c553 to
6aa0836
Compare
grooverdan
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
Can you also update man/mariadb.1 to include the option?
While the MDEV did include only the mysql/mariadb as the client, there are other clients that could be handled the same way.
In client:
- mysqladmin.cc
- mysqlbinlog.cc
- mysqlcheck.c
- mysqldump.c
- mysqlimport.c
- mysqlshow.c
- mysqlslap.c
- mysqltest.cc
And extra/mariabackup/backup_mysql.cc.
If you feel particular keen, and I'd appreciate it (though obviously optional), consolidate the connection methods across the client into a separate file like sql-common/connect.c and include in CMakeLists.txt like:
MYSQL_ADD_EXECUTABLE(mariadb-dump mysqldump.c ../sql-common/my_user.c ../sql-common/connect.c)
Sure, It's might be important point of refactoring and I would appreciate some hints on this. So, as far as I can see, all clients (except mariadb-backup) use the pvio plugin from connector. Once the functionality is implemented there, it is already spread across clients. But only in backup util I had to do it separately. Maybe it worth doing this the same way as it is done in other clients? |
|
mysqlcheck.cc:dbConnect And the other functions you've added to bind to are effectively the same function. They have a program name (which would appreciate an update to the latest version ('mysql' -> 'mariadb', So an interfaces of: Callers would do their: |
|
While hiding the common infrastructure for the all clients connection is a good idea, I didn't see any meaningful reason to only use this parameters as it is ( + bind_address). As long as the code use the same own general variables, the extensibility such method is not the pleasant copy-pasting. So, I suggest using the shared options pack to distribute the shared connection method. I had to make some number of changes, that's why I marked the pr as draft. |
aae415b to
37fb8a6
Compare
grooverdan
left a comment
There was a problem hiding this comment.
Very well done. This is so much neater.
Small changes:
- rebased and changed a few trivial conflicts where
get_tty_password->my_get_tty_passwordwas renamed. - Added a couple of missing includes in libmysqld/examples/ for an embedded build.
- squashed commits up and the commit message
Otherwise looks perfect.
I was concerned at one point there was missing my_free(cl_opts.bind_address); in mysql.cc:mysql_end, mysqlbinlog.cc:cleanup, mysqldump.cc:free_resources, and also the inconsistent my_free(cl_options.{user,password)), but it all seems correct to match the strdups that apply slightly differently in each function.
|
@yvef how are the defined meant to work for the Windows build - its not currently. |
37fb8a6 to
e3c78f4
Compare
|
@grooverdan your are right. that was fixed and included into the main commit. |
e3c78f4 to
b4cb8ed
Compare
LinuxJedi
left a comment
There was a problem hiding this comment.
Excellent cleanup here too, approved for 11.4
| IndentWidth: 2 | ||
| IndentWrappedFunctionNames: false | ||
| KeepEmptyLinesAtTheStartOfBlocks: true | ||
| Language: Cpp |
There was a problem hiding this comment.
Good catch on the duplicate there too :)
Previously, the each mariadb client used it's own set of connection parameter, most of each were general and non-specifiic for the utility e.g. host, user, socket etc. Now the every caller can set up a shared CLNT_CONNECT_OPTIONS and call do_client_connect to run the connection without redundant direct option setting. Also: * update man pages * reimplement socket binding for xtrabackup * use error code in missing section within CLI_MYSQL_REAL_CONNECT function * adjust macro initialization for msvc
b4cb8ed to
7639be7
Compare
|
Thank you @yvef |
- opt_ssl_crl= NULL;
+ cl_opts.opt_ssl_crl= NULL; |
|
So, it's not merged, needs many changes, way past the 11.4 preview deadline. |
Description
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
PR quality check