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

mariadb-upgrade should remove mysql.plugin entries for plugins that became bundled

Details

    Description

      For example the unix_socket plugin was a loadable plugin up to 10.3, but became a compiled-in plugin starting with 10.4 due to the privilege tables structure changes. So if the plugin had e.g. be enabled with INSTALL PLUGIN in 10.3 then after an upgrade to 10.4 that mysql.plugin entry leads to a

      [ERROR] mariadbd: Plugin 'unix_socket' is already installed.

      log entry as the plugin is already active due to being built-in, and trying to load it once again while processing mysql.plugin entries will lead to that "already installed" notification.

      As we know which plugins have been changed to be compiled in for a given release we should also take care of not triggering any warnings due to the version upgrade, these just confuse users as they didn't actually do anything wrong.

      Or at a minimum the error message should be more clear on an attempt to load a plugin that's actually already built in into the current server binary, as at first sight I was assuming the usual "plugin_load_add vs INSTALL PLUGIN" situation, and doubted that the user had sent me the correct / complete configuration file ... so "plugin is already built in to the server" instead of "plugin is already loaded"

      Attachments

        Issue Links

          Activity

            danblack Daniel Black added a comment -

            diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
            index 25ce43fd315..b67f9021ae9 100644
            --- a/sql/sql_plugin.cc
            +++ b/sql/sql_plugin.cc
            @@ -1930,7 +1930,7 @@ static void plugin_load(MEM_ROOT *tmp_root)
                   the mutex here to satisfy the assert
                 */
                 mysql_mutex_lock(&LOCK_plugin);
            -    plugin_add(tmp_root, false, &name, &dl, MYF(ME_ERROR_LOG));
            +    plugin_add(tmp_root, true, &name, &dl, MYF(ME_ERROR_LOG));
                 free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE));
                 mysql_mutex_unlock(&LOCK_plugin);
               }
            

            changes the Error to Note for those added with plugin_load_add or in built.

            From:

            2023-08-31 12:09:10 0 [Note] Starting MariaDB 10.4.31-MariaDB source revision 2aea9387497cecb5668ef605b8f80886f9de812c as process 359257
            2023-08-31 12:09:10 0 [ERROR] mariadbd: Plugin 'unix_socket' already installed
            2023-08-31 12:09:10 0 [Note] InnoDB: Using Linux native AIO
            

            to:

            2023-08-31 12:13:49 0 [Note] Starting MariaDB 10.4.31-MariaDB source revision 2aea9387497cecb5668ef605b8f80886f9de812c as process 359600
            2023-08-31 12:13:49 0 [Note] mariadbd: Plugin 'unix_socket' already installed
            2023-08-31 12:13:49 0 [Note] InnoDB: Using Linux native AIO
            2023-08-31 12:13:49 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
            2023-08-31 12:13:49 0 [Note] InnoDB: Uses event mutexes
            

            The error is on those already in mysql.plugin and attempting to install those.

            I verified that unix_socket is working. So that an the mariadb-upgrade script to remove it.

            AFAIK unix_socket is the only one right?

            11.2 $ git grep MYSQL_ADD_PLUGIN | grep DEFAULT
            plugin/auth_socket/CMakeLists.txt:  MYSQL_ADD_PLUGIN(auth_socket auth_socket.c DEFAULT)
            sql/CMakeLists.txt:  MYSQL_ADD_PLUGIN(wsrep_provider ${WSREP_SOURCES} DEFAULT NOT_EMBEDDED LINK_LIBRARIES wsrep-lib wsrep_api_v26)
            sql/CMakeLists.txt: MYSQL_ADD_PLUGIN(thread_pool_info thread_pool_info.cc DEFAULT STATIC_ONLY NOT_EMBEDDED)
            sql/CMakeLists.txt:MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY
            storage/perfschema/CMakeLists.txt:MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES} STORAGE_ENGINE DEFAULT
            storage/sequence/CMakeLists.txt:MYSQL_ADD_PLUGIN(sequence sequence.cc STORAGE_ENGINE DEFAULT)
            

            acceptable?

            danblack Daniel Black added a comment - diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 25ce43fd315..b67f9021ae9 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1930,7 +1930,7 @@ static void plugin_load(MEM_ROOT *tmp_root) the mutex here to satisfy the assert */ mysql_mutex_lock(&LOCK_plugin); - plugin_add(tmp_root, false, &name, &dl, MYF(ME_ERROR_LOG)); + plugin_add(tmp_root, true, &name, &dl, MYF(ME_ERROR_LOG)); free_root(tmp_root, MYF(MY_MARK_BLOCKS_FREE)); mysql_mutex_unlock(&LOCK_plugin); } changes the Error to Note for those added with plugin_load_add or in built. From: 2023-08-31 12:09:10 0 [Note] Starting MariaDB 10.4.31-MariaDB source revision 2aea9387497cecb5668ef605b8f80886f9de812c as process 359257 2023-08-31 12:09:10 0 [ERROR] mariadbd: Plugin 'unix_socket' already installed 2023-08-31 12:09:10 0 [Note] InnoDB: Using Linux native AIO to: 2023-08-31 12:13:49 0 [Note] Starting MariaDB 10.4.31-MariaDB source revision 2aea9387497cecb5668ef605b8f80886f9de812c as process 359600 2023-08-31 12:13:49 0 [Note] mariadbd: Plugin 'unix_socket' already installed 2023-08-31 12:13:49 0 [Note] InnoDB: Using Linux native AIO 2023-08-31 12:13:49 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2023-08-31 12:13:49 0 [Note] InnoDB: Uses event mutexes The error is on those already in mysql.plugin and attempting to install those. I verified that unix_socket is working. So that an the mariadb-upgrade script to remove it. AFAIK unix_socket is the only one right? 11.2 $ git grep MYSQL_ADD_PLUGIN | grep DEFAULT plugin/auth_socket/CMakeLists.txt: MYSQL_ADD_PLUGIN(auth_socket auth_socket.c DEFAULT) sql/CMakeLists.txt: MYSQL_ADD_PLUGIN(wsrep_provider ${WSREP_SOURCES} DEFAULT NOT_EMBEDDED LINK_LIBRARIES wsrep-lib wsrep_api_v26) sql/CMakeLists.txt: MYSQL_ADD_PLUGIN(thread_pool_info thread_pool_info.cc DEFAULT STATIC_ONLY NOT_EMBEDDED) sql/CMakeLists.txt:MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY storage/perfschema/CMakeLists.txt:MYSQL_ADD_PLUGIN(perfschema ${PERFSCHEMA_SOURCES} STORAGE_ENGINE DEFAULT storage/sequence/CMakeLists.txt:MYSQL_ADD_PLUGIN(sequence sequence.cc STORAGE_ENGINE DEFAULT) acceptable?
            danblack Daniel Black added a comment - For review: https://github.com/MariaDB/server/pull/2744

            unix_socket is the one I stumbled across, I don't have total overview of what plugins have changed from loadable to built-in over time

            hholzgra Hartmut Holzgraefe added a comment - unix_socket is the one I stumbled across, I don't have total overview of what plugins have changed from loadable to built-in over time
            danblack Daniel Black added a comment -

            Per the PR, I made it generic.

            danblack Daniel Black added a comment - Per the PR, I made it generic.

            People

              danblack Daniel Black
              hholzgra Hartmut Holzgraefe
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.