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

Spider does not clean up UDFs upon deinstallation

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4(EOL), 10.5, 10.6, 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL)
    • 10.5, 10.6, 10.11
    • None

    Description

      Upon installation, Spider creates several UDFs

      10.4 1adfdfbd

      +------------------------------+-----+--------------+-----------+
      | name                         | ret | dl           | type      |
      +------------------------------+-----+--------------+-----------+
      | spider_direct_sql            |   2 | ha_spider.so | function  |
      | spider_bg_direct_sql         |   2 | ha_spider.so | aggregate |
      | spider_ping_table            |   2 | ha_spider.so | function  |
      | spider_copy_tables           |   2 | ha_spider.so | function  |
      | spider_flush_table_mon_cache |   2 | ha_spider.so | function  |
      +------------------------------+-----+--------------+-----------+
      

      When the engine is uninstalled, the functions remain in mysql.func table.

      In case of package installation it means that if the package is uninstalled, the library is removed and all consequent server startups throw errors

      2023-09-15 18:18:55 0 [Note] Server socket created on IP: '::'.
      2023-09-15 18:18:55 0 [ERROR] Can't open shared library 'ha_spider.so' (errno: 2, cannot open shared object file: No such file or directory)
      2023-09-15 18:18:55 0 [ERROR] Can't open shared library 'ha_spider.so' (errno: 2, cannot open shared object file: No such file or directory)
      2023-09-15 18:18:55 0 [ERROR] Can't open shared library 'ha_spider.so' (errno: 2, cannot open shared object file: No such file or directory)
      2023-09-15 18:18:55 0 [ERROR] Can't open shared library 'ha_spider.so' (errno: 2, cannot open shared object file: No such file or directory)
      2023-09-15 18:18:55 0 [ERROR] Can't open shared library 'ha_spider.so' (errno: 2, cannot open shared object file: No such file or directory)
      2023-09-15 18:18:55 0 [Note] Reading of all Master_info entries succeeded
      

      Attachments

        Issue Links

          Activity

            ycp Yuchen Pei added a comment -

            to reprod:

            # previous workdir: src dir
            ln -sf $PWD/storage/spider/ha_spider.so ./mysql-test/var/plugins/ha_spider.so
            rm -rf /tmp/${PWD##*/}-datadir && mkdir -p /tmp/${PWD##*/}-datadir && scripts/mysql_install_db --no-defaults --srcdir=$OLDPWD --builddir=$PWD --datadir=/tmp/${PWD##*/}-datadir --verbose && sql/mysqld --no-defaults --partition --skip-networking --datadir=/tmp/${PWD##*/}-datadir --socket=/tmp/${PWD##*/}.sock --plugin-dir=${PWD}/mysql-test/var/plugins/ --verbose
            # in the terminal to run the client
            ./client/mysql -S/tmp/build.sock test <<< "install soname 'ha_spider';
            uninstall soname 'ha_spider';
            shutdown;"
            rm mysql-test/var/plugins/ha_spider.so
            # This should show the [ERROR]
            sql/mysqld --no-defaults --datadir=/tmp/${PWD##*/}-datadir --socket=/tmp/${PWD##*/}.sock --plugin-dir=${PWD}/mysql-test/var/plugins/ --verbose
            # in the terminal to run the client
            ./client/mysql -S/tmp/build.sock test <<< "shutdown;"
            

            ycp Yuchen Pei added a comment - to reprod: # previous workdir: src dir ln -sf $PWD/storage/spider/ha_spider.so ./mysql-test/var/plugins/ha_spider.so rm -rf /tmp/${PWD##*/}-datadir && mkdir -p /tmp/${PWD##*/}-datadir && scripts/mysql_install_db --no-defaults --srcdir=$OLDPWD --builddir=$PWD --datadir=/tmp/${PWD##*/}-datadir --verbose && sql/mysqld --no-defaults --partition --skip-networking --datadir=/tmp/${PWD##*/}-datadir --socket=/tmp/${PWD##*/}.sock --plugin-dir=${PWD}/mysql-test/var/plugins/ --verbose # in the terminal to run the client ./client/mysql -S/tmp/build.sock test <<< "install soname 'ha_spider'; uninstall soname 'ha_spider'; shutdown;" rm mysql-test/var/plugins/ha_spider.so # This should show the [ERROR] sql/mysqld --no-defaults --datadir=/tmp/${PWD##*/}-datadir --socket=/tmp/${PWD##*/}.sock --plugin-dir=${PWD}/mysql-test/var/plugins/ --verbose # in the terminal to run the client ./client/mysql -S/tmp/build.sock test <<< "shutdown;"
            ycp Yuchen Pei added a comment -

            This does not seem like it's gonna be a quick win because of MDEV-32796, see the demo commit below

            upstream/bb-mdev-10.5-mdev-32180 657b356f1b682984a5de76dabe1a5e6be85bf1ff
            MDEV-32180 [demo] drop functions in spider deinit
             
            This will not work because of MDEV-32796: if spider is used in any
            way (e.g. create table ... engine=Spider), any attempt to uninstall it
            will be deferred to server shutdown, by which time it would be
            impossible to send queries over local sql service, because
            close_connection() sets thd->killed to KILL_CONNECTION

            ycp Yuchen Pei added a comment - This does not seem like it's gonna be a quick win because of MDEV-32796 , see the demo commit below upstream/bb-mdev-10.5-mdev-32180 657b356f1b682984a5de76dabe1a5e6be85bf1ff MDEV-32180 [demo] drop functions in spider deinit   This will not work because of MDEV-32796: if spider is used in any way (e.g. create table ... engine=Spider), any attempt to uninstall it will be deferred to server shutdown, by which time it would be impossible to send queries over local sql service, because close_connection() sets thd->killed to KILL_CONNECTION

            People

              ycp Yuchen Pei
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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