diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-11-13 10:10:09 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-11-13 10:10:09 +0100 |
commit | 5e63f616a7ed511e6e69581f6659f60f1ec8633b (patch) | |
tree | 5939124c3b798374f9c76f022206ca66d3f4034a /sql/table.cc | |
parent | 1368a63589d0b4900f7d7efb57444c4ea34e6c26 (diff) | |
download | mariadb-git-bb-10.1-MDEV-17124.tar.gz |
MDEV-17124: mariadb 10.1.34, views and prepared statements: ERROR 1615 (HY000): Prepared statement needs to be re-preparedbb-10.1-MDEV-17124
The problem is that if table definition cache (TDC) is full of real tables which are in tables cache, view definition can not stay there so will me removed by its own underlying tables.
In situation above old mechanism of detection matching definition in PS and current version always require reprepare and so prevent executing the PS.
One work arount is to increase TDC, other - improve version check for views (which is done here).
Now in suspiciouse cases we check MD5 of the view to be sure that version really have chenged.
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/sql/table.cc b/sql/table.cc index e1edcc0b407..a6fbce9f3dd 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -7495,6 +7495,32 @@ void TABLE_LIST::set_lock_type(THD *thd, enum thr_lock_type lock) } } + +bool TABLE_LIST::is_table_ref_id_equal(TABLE_SHARE *s) +{ + enum enum_table_ref_type tp= s->get_table_ref_type(); + if (m_table_ref_type == tp) + { + bool res= m_table_ref_version == s->get_table_ref_version(); + + /* + If definition is different object with view we can check MD5 in frm + to check if the same view got into table definition cache again. + */ + if (!res && + tp == TABLE_REF_VIEW && + mariadb_view_version_check(this, s)) + { + // to avoid relatively expensive parsing of frm next time + set_table_ref_id(s); + return TRUE; + } + return res; + } + return FALSE; +} + + uint TABLE_SHARE::actual_n_key_parts(THD *thd) { return use_ext_keys && |