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

DEFAULT udf(x) does not return an error when UDF is dropped

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Won't Fix
    • 10.2(EOL)
    • N/A
    • OTHER
    • None

    Description

      I'm testing the MDEV-10134 feature tree, branch bb-10.2-default.

      I add this script to mysql-test/t/udf.test and run "./mtr udf"

      --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
      eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
      SELECT METAPHON('Hello');
      CREATE TABLE t1 (a VARCHAR(10), b VARCHAR(10) DEFAULT METAPHON(a));
      INSERT INTO t1 (a) VALUES ('Hello');
      SELECT * FROM t1;
      DROP FUNCTION METAPHON;
      # QQ: this should return an error
      INSERT INTO t1 (a) VALUES ('Hello');
      SELECT * FROM t1;
      DROP TABLE t1;
      

      After the function METAPHON is dropped, INSERT still uses it.
      It should return an error in the INSERT which goes after "DROP FUNCTION".

      Attachments

        Issue Links

          Activity

            MDEV-10134 has been closed, but the behavior described above still exists.

            After running FLUSH TABLES server starts returning the error.

            elenst Elena Stepanova added a comment - MDEV-10134 has been closed, but the behavior described above still exists. After running FLUSH TABLES server starts returning the error.

            This is basically what plugins do in this case. If you UNINSTALL a plugin that is used (locked) at the moment, it will not be completely uninstalled, but only marked as "being uninstalled". You cannot start using it anymore (e.g. cannot open a table in this storage engine), but already opened tables will be able to continue using it. This status is visible in the INFORMATION_SCHEMA.PLUGINS table. When the last user of the plugin will release it, the plugin will be automatically uninstalled.

            Same happens with UDFs — an open table with a DEFAULT (or a virtual column) using UDF keeps it loaded. When the table is closed, it releases the UDF and it is unloaded automatically.

            But because UDF API is much simpler (and older) that Plugin API, there is no explicit server control over this process and the user has no visibility into it. This can only be fixed when we move UDFs to use the Plugin API.

            serg Sergei Golubchik added a comment - This is basically what plugins do in this case. If you UNINSTALL a plugin that is used (locked) at the moment, it will not be completely uninstalled, but only marked as "being uninstalled". You cannot start using it anymore (e.g. cannot open a table in this storage engine), but already opened tables will be able to continue using it. This status is visible in the INFORMATION_SCHEMA.PLUGINS table. When the last user of the plugin will release it, the plugin will be automatically uninstalled. Same happens with UDFs — an open table with a DEFAULT (or a virtual column) using UDF keeps it loaded. When the table is closed, it releases the UDF and it is unloaded automatically. But because UDF API is much simpler (and older) that Plugin API, there is no explicit server control over this process and the user has no visibility into it. This can only be fixed when we move UDFs to use the Plugin API.

            People

              serg Sergei Golubchik
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.