diff options
author | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2021-07-22 13:05:34 +0700 |
---|---|---|
committer | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2021-07-22 13:05:34 +0700 |
commit | 191ff6981d5181c44aa36448a43f382d865cc06a (patch) | |
tree | 236951659daf45279af9125ef66635c5a9b81811 | |
parent | 49843d13438e258ddda82e98bfc5d82169db6656 (diff) | |
download | mariadb-git-bb-10.6-MDEV-25973.tar.gz |
MDEV-25973: fixed the test plugins.test_sql_servicebb-10.6-MDEV-25973
Set the data member THD::m_prepare_observer temporary to nullptr
to avoid running a handler when a table version in TABLE_LIST
differs from a value of version in TABLE_SHARE. It happens
for any table when the method Ed_connection::execute_direct()
is called from execute_sql_command() since the data members
TABLE_LIST::m_table_ref_type and TABLES_LIST::m_table_ref_version
have zero values on opening a table but corresponding members
of TABLE_SHARE doesn't have. If the function execute_sql_command()
is called on handling a Prepared statement it results in
issuing the error ER_NEED_REPREPARE that is not issued in case the
statement is run in regular way. So, to make fix the issue
reset the data member THD::m_prepare_observer before runnig
Ed_connection::execute_direct() and restoring it on return.
-rw-r--r-- | mysql-test/suite/plugins/t/test_sql_service.test | 4 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/mysql-test/suite/plugins/t/test_sql_service.test b/mysql-test/suite/plugins/t/test_sql_service.test index 2ff2db2fce0..3384b523bda 100644 --- a/mysql-test/suite/plugins/t/test_sql_service.test +++ b/mysql-test/suite/plugins/t/test_sql_service.test @@ -1,7 +1,3 @@ -if (`SELECT $PS_PROTOCOL != 0`) -{ - --skip Test temporarily disabled for ps-protocol -} --source include/not_embedded.inc diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 646a6e3b5a0..29cd1e94840 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -6228,6 +6228,7 @@ extern "C" int execute_sql_command(const char *command, THD *new_thd= 0; int result; my_bool qc_save= 0; + Reprepare_observer *save_reprepare_observer= nullptr; if (!thd) { @@ -6248,6 +6249,8 @@ extern "C" int execute_sql_command(const char *command, qc_save= thd->query_cache_is_applicable; thd->query_cache_is_applicable= 0; + save_reprepare_observer= thd->m_reprepare_observer; + thd->m_reprepare_observer= nullptr; } sql_text.str= (char *) command; sql_text.length= strlen(command); @@ -6285,7 +6288,10 @@ extern "C" int execute_sql_command(const char *command, if (new_thd) delete new_thd; else + { thd->query_cache_is_applicable= qc_save; + thd->m_reprepare_observer= save_reprepare_observer; + } *hosts= 0; return result; |