Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24248

my_print_defaults is not taking all the values when using -e option which is called from mysql.server (extra_args).

Details

    Description

      It is reported by one of our customers the my_print_defaults -e option is not working with MariaDB server 10.5

      Here are the test results:

      At MariaDB server 10.4.17, my_print_defaults -e giving the required output. Whereas at MariaDB server 10.5.x, -e option is not working instead has to specify --defaults-extra-file (alias).

      /root/my.cnf

      [mariadb-10.4]
      key_buffer_size=20M
      max_allowed_packet=250M
      table_open_cache=1000
      table_definition_cache=2000
      read_buffer_size=1M
      thread_cache_size=8
      max_connections=1024
      long_query_time=60
      slow_query_log=1
      

      [root@test001 ~]# mysql --version
      mysql  Ver 15.1 Distrib 10.4.17-MariaDB, for Linux (x86_64) using readline 5.1
       
      [root@test001 ~]# my_print_defaults -e /root/my.cnf --mysqld mysql.server
      --key_buffer_size=20M
      --max_allowed_packet=250M
      --table_open_cache=1000
      --table_definition_cache=2000
      --read_buffer_size=1M
      --thread_cache_size=8
      --max_connections=1024
      --long_query_time=60
      --slow_query_log=1
      

      /root/my.cnf

      [mariadb-10.5]
      key_buffer_size=20M
      max_allowed_packet=250M
      table_open_cache=1000
      table_definition_cache=2000
      read_buffer_size=1M
      thread_cache_size=8
      max_connections=1024
      long_query_time=60
      slow_query_log=1
      

      [root@test001 ~]# mysql --version
      mysql  Ver 15.1 Distrib 10.5.8-MariaDB, for Linux (x86_64) using readline 5.1
      [root@test001 ~]#
      [root@test001 ~]# my_print_defaults -e /root/my.cnf --mysqld mysql.server
      [root@test001 ~]# my_print_defaults --defaults-extra-file=/root/my.cnf --mysqld mysql.server
      --key_buffer_size=20M
      --max_allowed_packet=250M
      --table_open_cache=1000
      --table_definition_cache=2000
      --read_buffer_size=1M
      --thread_cache_size=8
      --max_connections=1024
      --long_query_time=60
      --slow_query_log=1
      

      Attachments

        Issue Links

          Activity

            The difference comes from this commit:

            commit 3e56972712395d371f82cda564b039dcbda3100a
            Author: Sergei Golubchik
            Date:   Sat Oct 12 21:21:50 2019 +0200
             
                cleanup: unify --defaults* option handling
                
                process all --defaults* options uniformly,
                get rid of special case for --no-defaults and --print-defaults
                use realpath instead of blindly concatenating pwd and relative path.
            

            elenst Elena Stepanova added a comment - The difference comes from this commit: commit 3e56972712395d371f82cda564b039dcbda3100a Author: Sergei Golubchik Date: Sat Oct 12 21:21:50 2019 +0200   cleanup: unify --defaults* option handling process all --defaults* options uniformly, get rid of special case for --no-defaults and --print-defaults use realpath instead of blindly concatenating pwd and relative path.

            mysql.server should use --defaults-extra-file not -e

            serg Sergei Golubchik added a comment - mysql.server should use --defaults-extra-file not -e
            rucha174 Rucha Deodhar added a comment - - edited Latest patch: https://github.com/MariaDB/server/commit/f88d130e710338607adf2517bef436de624c76b9

            rucha174, no, as we discussed there should be no changes in my_default.c, instead my_print_defaults should generate a new command line specifically for calling load_default(), as doesn't make sense to reuse it in this case.

            serg Sergei Golubchik added a comment - rucha174 , no, as we discussed there should be no changes in my_default.c , instead my_print_defaults should generate a new command line specifically for calling load_default() , as doesn't make sense to reuse it in this case.
            serg Sergei Golubchik added a comment - - edited

            There are two approaches, basically. One is to let handle_options() handle --defaults* options too. This will make -e to work, --defaults-extra-file⎵ to work, in any position on the command line, very flexible, anything works. But this is very inconsistent with how --default* options work in any other executable (only at the beginning on the command line, only with =).

            The other option is to let load_defaults() (that is, get_defaults_options()) handle --default* options. This will provide exactly the same behavior as elsewhere, so one won't, for example, wonder why --defaults-extra-file my.cnf works in my_print_defaults, but not in mysqldump. But -e and -g won't work.

            I personally think that the second option would be less confusing long term.

            serg Sergei Golubchik added a comment - - edited There are two approaches, basically. One is to let handle_options() handle --defaults* options too. This will make -e to work, --defaults-extra-file⎵ to work, in any position on the command line, very flexible, anything works. But this is very inconsistent with how --default* options work in any other executable (only at the beginning on the command line, only with = ). The other option is to let load_defaults() (that is, get_defaults_options() ) handle --default* options. This will provide exactly the same behavior as elsewhere, so one won't, for example, wonder why --defaults-extra-file my.cnf works in my_print_defaults , but not in mysqldump . But -e and -g won't work. I personally think that the second option would be less confusing long term.
            rucha174 Rucha Deodhar added a comment - - edited

            Created a patch to address this specific issue by changing mysql.server script to use --defaults-extra-file instead of -e so that this issue can be closed faster.
            Created another issue about -e not working correctly in 10.5+ : MDEV-25908

            rucha174 Rucha Deodhar added a comment - - edited Created a patch to address this specific issue by changing mysql.server script to use --defaults-extra-file instead of -e so that this issue can be closed faster. Created another issue about -e not working correctly in 10.5+ : MDEV-25908

            f88d130e710 is ok to push, thanks

            serg Sergei Golubchik added a comment - f88d130e710 is ok to push, thanks
            rucha174 Rucha Deodhar added a comment -

            fixed failing test on buildbot

            rucha174 Rucha Deodhar added a comment - fixed failing test on buildbot

            How is MDEV-24248 fixed? mysql_print_default -e still doesn't work and mysql.server is still using -e, isn't it?

            serg Sergei Golubchik added a comment - How is MDEV-24248 fixed? mysql_print_default -e still doesn't work and mysql.server is still using -e , isn't it?
            rucha174 Rucha Deodhar added a comment - - edited

            Hi serg It is only MDEV-24248. As discussed I had changed mysql.server to use --defaults-extra-file instead o f -e. mysql.server is not using -e anymore. See https://github.com/MariaDB/server/commit/534553897f7178eb1456b11aa6c70f6025364407
            I had reopened this issue because my_print_defaults.test was failing in old buildbot. The reason was it was reading default config file before reading the extra default file. And so there was diff in the result file on buildbot. Fixed it by adding adding a default config file for the test along with defaults extra file.

            MDEV-25908 is still open where I have fixed -e option 10.5 and removed short options for 10.7.

            rucha174 Rucha Deodhar added a comment - - edited Hi serg It is only MDEV-24248 . As discussed I had changed mysql.server to use --defaults-extra-file instead o f -e. mysql.server is not using -e anymore. See https://github.com/MariaDB/server/commit/534553897f7178eb1456b11aa6c70f6025364407 I had reopened this issue because my_print_defaults.test was failing in old buildbot. The reason was it was reading default config file before reading the extra default file. And so there was diff in the result file on buildbot. Fixed it by adding adding a default config file for the test along with defaults extra file. MDEV-25908 is still open where I have fixed -e option 10.5 and removed short options for 10.7.

            Yes, you fixed it in https://github.com/MariaDB/server/commit/f88d130e710
            but in https://github.com/MariaDB/server/commit/826eab3f9b2 you reverted that change.
            As of now, mysql.server in 10.5 is using -e again. That's why I asked, why this issue is closed.

            serg Sergei Golubchik added a comment - Yes, you fixed it in https://github.com/MariaDB/server/commit/f88d130e710 but in https://github.com/MariaDB/server/commit/826eab3f9b2 you reverted that change. As of now, mysql.server in 10.5 is using -e again. That's why I asked, why this issue is closed.
            rucha174 Rucha Deodhar added a comment -

            closing the issue because fix is already pushed: https://github.com/MariaDB/server/commit/534553897f7178eb1456b11aa6c70f6025364407
            (And small fixup to remove config file made during test, which was missed in previous commit: https://github.com/MariaDB/server/commit/675b72d0da1839a3988ec29bc3ea06372890be54)

            rucha174 Rucha Deodhar added a comment - closing the issue because fix is already pushed: https://github.com/MariaDB/server/commit/534553897f7178eb1456b11aa6c70f6025364407 (And small fixup to remove config file made during test, which was missed in previous commit: https://github.com/MariaDB/server/commit/675b72d0da1839a3988ec29bc3ea06372890be54 )

            People

              rucha174 Rucha Deodhar
              suresh.ramagiri@mariadb.com suresh ramagiri
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.