← Back to team overview

maria-developers team mailing list archive

Re: I wonder what elements add to CMakeLists.txt


Hi,  kyungnam!

On Mar 24,  kyungnam wrote:
> Hi, Sergei! 
> Thanks for your advice and I agree with you.
> Accoring to your advice, It's not a good plan to pass some data to my
> plugin agent from sql_parse.cc because it needs to compile mariadb
> server.
> So I hava a another concept. 
> Instead of put some code to sql_parse.cc, plugin collects a some data
> like below sample conceptual code.
> I_List_iterator<THD> it(threads);
> while ((tmp_thd=it++))
>         {
>                 if ((tmp_thd->get_command() == COM_QUERY)
> ||(tmp_thd->get_command() == COM_STMT_EXECUTE) )
>                   continue;
>                 char* sql = tmp_thd->query();
>                 if(sql)
>                 {
>                         ...
>                         send_data();       
>                 } 
>         }
> In this case, I though that it doesn't need to  compile maria server,
> but it need to recompile whenever structure of THD is changed.

Yes, that's better. There are many plugins that access THD,
even though THD is not officially a part of the plugin API.

> Otherwise, if i hardcode directly into the server, can I contribute
> this community ?

Sure. You can contribute anything. The question is whether community
will accept and use your contribution. I think the your contribution
will be used more if it won't require anyone to recompile the server.

> Additionally, you asked me about what information I want to collect.
>  I want to collect data like below. 
>  * events_statements_current
>  * events_stages_current
>  * events_waits_current
>  * events_statements_summary_by_digest

Oh, my. These are stored in the internal perfschema data structures. I
don't think you can get them even from sql_parse.cc

> These data easily collected by sql . but it's hard to collect by access
> memory.(THD or something else.)
> I wonder if it is possible to collect these data without using pfs (or
> psi) data structure.

I doubt it. The only reasonable way to get this is to query performance
schema. Either using SQL or with a lower-level handler interface. You
can do either from your plugin.