Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
11.7.2
-
None
-
Ubuntu 24.04, MariaDB 11.7.2
Description
I've created a shared library with some custom functions.
I can load and use them, i.e.:
CREATE OR REPLACE FUNCTION my_func RETURNS STRING SONAME 'my_lib.so'; |
|
SELECT my_func(); |
-> 'version 1'; |
However, when I DROP the function, recompile the library and move it to the plugin directory, and CREATE the UDF again, MariaDB still has the old version of the library in memory:
DROP FUNCTION my_func(); |
CREATE OR REPLACE FUNCTION my_func RETURNS STRING SONAME 'my_lib.so'; |
|
SELECT my_func(); |
-> 'version 1'; |
(but should return 'version 2')
When I rename the library and create the function with the new name, it works:
CREATE OR REPLACE FUNCTION my_func RETURNS STRING SONAME 'my_lib2.so'; |
|
SELECT my_func(); |
-> 'version 2'; |
According to the documentation, the correct sequence is:
To upgrade the UDF's shared library, first run a DROP FUNCTION statement, then upgrade the shared library and finally
run the CREATE FUNCTION statement. If you upgrade without following this process, you may crash the server.
Conclusion:
MariaDB server doesn't unload the shared library, when there are no more functions that use it. Consequence is, that the server has to be restarted every time a new version of a shared library for UDFs is installed.
So, either this is a bug, or the documentation should reflect this limitation.