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