Hi, Sergey! On Jun 23, Sergey Vojtovich wrote:
Okay. But as neither thd_query_string() nor thd_query() are part of the plugin API, I'd suggest to remove them, they're inherently unsafe and should not be used. Few other engines use thd_query_string() need to be fixed too (but they bypass the plugin API and we don't promise stability for internal functions).
thd_query() - yes, this looks fairly broken. thd_query_string() - I'd say this one should stay, because in most cases we need to access query_string from the same thread; in this case we better avoid mutex for performance reasons.
Makes sense. May be you can enforce it with an assert? At least, make sure that a function comment says that thd_query_string can only be used by the THD owner thread. Regards, Sergei Chief Architect MariaDB and security@mariadb.org