Details
-
Task
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Currently, code of UDF libraries is only called when the function is called and there is no function or functionality that ensures that a certain piece of code is executed once when the library is loaded and once when the piece of code is stopped.
So anything that requires a certain other library to be initialized exactly once or requires a certain stopping sequence is not possible. It could only be implemented as native code.
For code that can't just be added to the mariadb code because it's proprietary or some other reasons, that means that that functionality couldn't be added.
Because of upwards and backwards compatibility, the UDF interface needs to be stable, so another one is needed in order to enable what I described.
The changes required would be something like that:
Similiar as to the passing of initid (UDF_INIT) to the UDFs, the new interface would need to call an initial function, probably called $(lib_name%.)_init_lib (e.g. if the library is called foo.so, then the initial function would be called foo_init_lib, which gets passed a similiar structure like UDF_INIT, which also has a user definable pointer field and is passed to each call to a function in the library. So the functions foo_one and foo_two, which are in foo.so, would get passed that structure. When mysqld shuts down, $(lib_name%.)_deinit_lib would be called in order to deinitialize anything that requires deinitialization or an ordered shutdown.