Re: [Maria-developers] I wonder what elements add to CMakeLists.txt

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_parser.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. Can you accept that? Otherwise, if i hardcode directly into the server, can I contribute this community ? 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 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. If it is possible, Is THD class is entry point or something else? If you don't mind, please let me know the best way to collect these data. Dear, kyungnam. ps: my email address changed from gmail to my company's mail address. ------------------------------------------------------------------------ ---- From: Sergei Golubchik <serg@mariadb.org> Date: 2015-03-24 0:11 GMT+09:00 Subject: Re: [Maria-developers] I wonder what elements add to CMakeLists.txt To: kyung nam Kim <knamkim@gmail.com> Cc: maria-developers@lists.launchpad.net Hi, kyung! On Mar 23, kyung nam Kim wrote:
Hi, Sergei! Thanks for your reply. You asked me about information which I want to send to my plugin. I have a plan to develop monitoring tool for mariadb. I want to develop a agent as a mariadb plugin. Agent collect data from sql_parse.cc (I' don't know exactly where more infomation about performance .) and sends that data to APM (Application Performance Monitoring) Server. and Users use databoard to see that data via APM server.
We have already have a APM Server, Dashboard and many kinds of agent. (for server, was). I want to add agent for mariaDB and contribute this community if possible.
Right. That's exactly why I ask. We cannot accept your plugin and it'll be of little use to the community (not "of no use", it'll be used, but less than it could've been) if one would need to modify and recompile MariaDB to use your plugin. If you'd like, let's try to figure out whether you can collect your infomation without patching the server. So what data do you need, exactly?
Your advice is right. It's easier my header file to sql folder. But When I want to develop my agent as a plugin type, I meet error as follows. ============================================ [ 98%] Built target mysqlserver Linking CXX shared library libmysqld.so ../../sql_parse.cc:linenum: undefined reference to 'Mymon::Mymon()' ../../sql_parse.cc:linenum: undefined reference to 'Mymon::putData(THD* thd);
Of course. Because you want sql_parse.cc to call your plugin, your plugin *always must be in the server*. You cannot have it as a separate shared object. To do that, add the MANDATORY keyword to your MYSQL_ADD_PLUGIN() declaration in CMakeLists.txt Regards, Sergei _____ 상기 메시지와 첨부화일 내에는 비밀정보가 포함되어 있을 수 있으며, 지정된 수신자에 한하여 조회 및 사용될 수 있습니다. 만약 송신자의 실수로 인하여 상기 메시지를 수신하였다면, 송신자에게 메시지를 반송해 주시고, 원본 메시지와 모든 사본을 폐기해 주시기 바랍니다. 상기 메시지의 전체 또는 일부에 대해 무단 열람, 사용, 공개, 배포하는 것은 금지되어 있습니다.(주)LG CNS. This message and its attachments may contain confidential information, and they are intended to be viewed or used by only the individuals specified in the message. If you have received this message in an error from the sender, please contact the sender immediately to notify the error and delete all of the message and its copies. It is prohibited to view, use, make public and/or distribute part or whole of this message without written permission.

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. Regards, Sergei

I doubt it. The only reasonable way to get this is to query
Hi, Sergei !! Thankyou for your response. performance
schema. Either using SQL or with a lower-level handler interface. You can do either from your plugin.
Does a lower-level handler interface means PSI? Is there a guide or document using PSI? It's a bit difficult to use PSI. Regards, kyungnam. ----------------------------Original Message---------------------------- From: Sergei Golubchik(serg@mariadb.org) To: 김경남/부책임연구원/신기술개발팀 Cc: community list[maria-developers@lists.launchpad.net] Date: 2015.03.24 15:22 Subject: Re: [Maria-developers] 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. Regards, Sergei _____ 상기 메시지와 첨부화일 내에는 비밀정보가 포함되어 있을 수 있으며, 지정된 수신자에 한하여 조회 및 사용될 수 있습니다. 만약 송신자의 실수로 인하여 상기 메시지를 수신하였다면, 송신자에게 메시지를 반송해 주시고, 원본 메시지와 모든 사본을 폐기해 주시기 바랍니다. 상기 메시지의 전체 또는 일부에 대해 무단 열람, 사용, 공개, 배포하는 것은 금지되어 있습니다.(주)LG CNS. This message and its attachments may contain confidential information, and they are intended to be viewed or used by only the individuals specified in the message. If you have received this message in an error from the sender, please contact the sender immediately to notify the error and delete all of the message and its copies. It is prohibited to view, use, make public and/or distribute part or whole of this message without written permission.

Hi, kyungnam! On Mar 24, 김경남 wrote:
Hi, Sergei !!
Thankyou for your response.
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.
Does a lower-level handler interface means PSI?
No, TABLE structure and the handler class. To open a P_S table as a normal table and read the data from it. See, e.g. sql_udf.cc or sql_acl.cc or sql_help.cc for an example of reading a table using low-level functions.
Is there a guide or document using PSI? It's a bit difficult to use PSI.
No, it was never supposed to be used by plugins. Regards, Sergei
participants (2)
-
Sergei Golubchik
-
김경남