Hi,
You would certainly experience some interesting effects attempting to
call mysql_install_plugin from within the plugin initializer
function... mysql_install_plugin was not intended to be reentrant.
Your best bet would be to somehow defer the operation in some way...
If you're using the fork I have, a third alternative becomes
available: You can use the mysql client library to perform an inline
statement to install additional plugins... Imagine the following
scenrio:
1. INSTALL PLUGIN fooloader SONAME 'foo.so';
2. CREATE PROCEDURE fooinstall() MODIFIES SQL DATA LANGUAGE fooloader
EXTERNAL NAME 'install';
3. CALL fooinstall();
4. fooinstall performs dynamic SQL to install other plugins before
deinstalling itself.
Just food for thought,
Regards,
Antony
On 15 Jun, 2008, at 12:00, Muslimas Chochlovas wrote:
> Hello all,
>
> I am participating in Google Summer of Code 2008 and currently I am
> working
> on
> SIGAR information schema plugin implementation.
> The idea is quite simple - there should be one so-called loader
> plugin,
> which loads
> other information schema plugins and then goes off or stays
> resident. Loader
> plugin
> provides no data and its only task is to load plugins. The plugins
> which are
> being loaded
> carry different OS specific information, which is gathered by SIGAR
> library.
>
>
> 1. I came up with tables design which could be viewed here
> http://uosis.mif.vu.lt/~much1973/tables_revised_210508.pdf
> Each table would be represented by corresponding information schema
> plugin.
> And before
> I start implementing them I would really like to get any feedback on
> that.
>
> 2. Now I already started loader plugin implementation and there were
> some
> issues. I found out
> that there are two ways of how plugins could be loaded from inside a
> loader
> plugin. We can use mysql_install_plugin() function or
> call a simple system() function.
> Suppose we have just two plugins: SIGAR_LOADER (sigar_plugin.so) and
> OS_STATUS (os_status.so).
> And we want to load OS_STATUS plugin from inside SIGAR_LOADER.
> I produced two different pieces of code:
> a) with mysql_install_plugin()
> /*
> THD *thd= current_thd;
> const char* name= "OS_STATUS";
> const LEX_STRING pl_name= {(char*)name, strlen(name)};
> const char* dl= "os_status.so";
> const LEX_STRING dl_name= {(char*)dl, strlen(dl)};
> mysql_install_plugin(
> thd
> , &pl_name
> , &dl_name
> );
> */
> b) with system()
> /*
> system(
> "path_to_mysql/mysql "
> "--execute=\"install plugin OS_STATUS soname 'os_status.so'\""
> );
> */
> At last when I put any of the code above into SIGAR_LOADER plugin's
> fill_table() function it works
> just fine, but the problem is - it loads OS_STATUS only after there
> was a
> SELECT from SIGAR_LOADER.
> And when I put the code into SIGAR_LOADER init() function MySQL
> server stops
> responding. Although it's not a crash.
> When I started MySQL with gdb and tried to load SIGAR_LOADER with
> the code
> inside init() function the
> output in gdb was:
> New thread started _address_(.....):
> So that thread never exits although it should.
>
> To sum up, I would appreciate all your comments on table design -
> 1., and I
> really need
> to find a solution on how to load plugins from inside init()
> function in
> SIGAR_LOADER - 2.
>
> Cheers,
>
> M.Chochlovas
>
>
> --
> MySQL Internals Mailing List
> For list archives: http://lists.mysql.com/internals
> To unsubscribe: http://lists.mysql.com/internals?unsub=1
>