summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-06-16 14:49:19 +0200
committerSergei Golubchik <serg@mariadb.org>2021-06-17 19:30:24 +0200
commitaedf3143339b588bc54eaa1c4f2708b9ba0f8e62 (patch)
tree7fb0044f25c807dc3545cac525930b820c5f9a4a
parent510662e81bf4d294bf012897bc1e6122c9ca5e07 (diff)
downloadmariadb-git-aedf3143339b588bc54eaa1c4f2708b9ba0f8e62.tar.gz
MDEV-16708: spurious ER_NEED_REPREPARE for gtid_slave_pos and event_scheduler
do not try to detect metadata change (and reprepare) for internal short-lived TABLE_LIST objects that couldn't have possibly lived long enough to see prepare and cache the metadata.
-rw-r--r--mysql-test/main/events_restart.test2
-rw-r--r--sql/sql_base.cc8
2 files changed, 7 insertions, 3 deletions
diff --git a/mysql-test/main/events_restart.test b/mysql-test/main/events_restart.test
index b96a3954e33..624c4188f9a 100644
--- a/mysql-test/main/events_restart.test
+++ b/mysql-test/main/events_restart.test
@@ -1,6 +1,5 @@
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
---disable_ps_protocol
call mtr.add_suppression("Column count of mysql.event is wrong. Expected .*, found .*\. The table is probably corrupted");
let $collation_server=`select @@collation_server`;
@@ -172,4 +171,3 @@ select name, originator, status from mysql.event;
# Cleanup
drop event ev;
---enable_ps_protocol
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 0d3c476c0e5..51e4bcad16b 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -2815,7 +2815,13 @@ static bool
check_and_update_table_version(THD *thd,
TABLE_LIST *tables, TABLE_SHARE *table_share)
{
- if (! tables->is_table_ref_id_equal(table_share))
+ /*
+ First, verify that TABLE_LIST was indeed *created by the parser* -
+ it must be in the global TABLE_LIST list. Standalone TABLE_LIST objects
+ created with TABLE_LIST::init_one_table() have a short life time and
+ aren't linked anywhere.
+ */
+ if (tables->prev_global && !tables->is_table_ref_id_equal(table_share))
{
if (thd->m_reprepare_observer &&
thd->m_reprepare_observer->report_error(thd))