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

Cannot use UDF's when their library is embedded

    Details

      Description

      The CONNECT storage engine comes with additional UDF's used to generate JSON items.

      All is right when the plugin is not embedded. It can be installed using:

      INSTALL PLUGIN CONNECT SONAME 'ha_connect';
      

      To create the functions, one can use statements such as:

      CREATE FUNCTION function_name RETURNS STRING SONAME 'ha_connect.{so|dll'};
      

      However, when the server was compiled with:

      WITH STORAGE ENGIE CONNECT=ON
      

      there is no more ha_connect library and apparently it is impossible to create the UDF's.

      There should be a syntax to indicate they are located in the MariaDB server.

      Additional question:
      The 'INSTALL PLUGIN' command accepts the library file type to be omited and resolved to 'so' on Linux and to 'dll' on Windows. However, the 'CREATE FUNCTION' does not. This makes complicated to make tests that should run on on both operating systems.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            serg Sergei Golubchik added a comment -

            To write tests you can use the following (copied from udf.test):

            
            --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB
            eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO";
            

            This works both on Windows and on Linux/etc.

            As for UDFs inside the main binary… UDF interface is at least 15 years old, it was created long before plugins. I've wanted to replace it with UDF plugins for, like, 10 years (see MYSQL_UDF_PLUGIN in plugin.h), but it always kinda worked. May be it's time to do it, finally. I would rather not add new features to old UDFs.

            Show
            serg Sergei Golubchik added a comment - To write tests you can use the following (copied from udf.test): --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION metaphon RETURNS STRING SONAME "$UDF_EXAMPLE_SO" ; This works both on Windows and on Linux/etc. As for UDFs inside the main binary… UDF interface is at least 15 years old, it was created long before plugins. I've wanted to replace it with UDF plugins for, like, 10 years (see MYSQL_UDF_PLUGIN in plugin.h), but it always kinda worked . May be it's time to do it, finally. I would rather not add new features to old UDFs.
            Hide
            bertrandop Olivier Bertrand added a comment - - edited

            Le 26/04/2015 22:25, Sergei Golubchik (JIRA) a écrit :

            "This works both on Windows and on Linux/etc."

            However, it is said before that:

            #
            # To run this tests the "sql/udf_example.c" need to be compiled into
            # udf_example.so and LD_LIBRARY_PATH should be setup to point out where
            # the library are.
            #
            

            Probably also on Windows. This explaining why it works.

            The way I was obliged to do it is in the attached file json_udf.inc, not quite friendly.

            But you're right: "May be it's time to do it". Implementing UDF's specific to a plugin storage engine should be a normal and useful feature of MariaDB that already offers many things not existing in MySQL such as additional create options and discovery.

            BTW I don't see why it would change anything to old UDF's.

            Show
            bertrandop Olivier Bertrand added a comment - - edited Le 26/04/2015 22:25, Sergei Golubchik (JIRA) a écrit : "This works both on Windows and on Linux/etc." However, it is said before that: # # To run this tests the "sql/udf_example.c" need to be compiled into # udf_example.so and LD_LIBRARY_PATH should be setup to point out where # the library are. # Probably also on Windows. This explaining why it works. The way I was obliged to do it is in the attached file json_udf.inc, not quite friendly. But you're right: "May be it's time to do it". Implementing UDF's specific to a plugin storage engine should be a normal and useful feature of MariaDB that already offers many things not existing in MySQL such as additional create options and discovery. BTW I don't see why it would change anything to old UDF's.
            Hide
            bertrandop Olivier Bertrand added a comment -

            I am developing more JSON UDF's that will be an major feature of the JSON facility.
            On buildbot about half servers fail to load the JSON UDF's probably because they are compiled with plugins embedded.
            It should not be very difficult to retrieve the function addresses from the main program (the function doing this goes to the main program when given a NULL lib handle)
            It becomes critical to offer facilities that are available with all configurations.

            Show
            bertrandop Olivier Bertrand added a comment - I am developing more JSON UDF's that will be an major feature of the JSON facility. On buildbot about half servers fail to load the JSON UDF's probably because they are compiled with plugins embedded. It should not be very difficult to retrieve the function addresses from the main program (the function doing this goes to the main program when given a NULL lib handle) It becomes critical to offer facilities that are available with all configurations.

              People

              • Assignee:
                bertrandop Olivier Bertrand
                Reporter:
                bertrandop Olivier Bertrand
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: