summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-04-17 15:50:59 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-09-30 12:11:37 +0200
commitf65ba9aeb7eea75656c74da7c20cb4157cb8d943 (patch)
treebc116ccb44b9e2f073654c60515764ee6a99fc2a /sql/sql_prepare.cc
parent98e62e631706f982a6b0e3a63909fa96f98aac5a (diff)
downloadmariadb-git-f65ba9aeb7eea75656c74da7c20cb4157cb8d943.tar.gz
MDEV-17124: mariadb 10.1.34, views and prepared statements: ERROR 1615 (HY000): Prepared statement needs to be re-prepared
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 be 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 around is to increase TDC, other - improve version check for views/triggers (which is done here). Now in suspicious cases we check: - timestamp (microseconds) of the view to be sure that version really have changed; - time (microseconds) of creation of a trigger related to time (microseconds) of statement preparation.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 71dc85c3100..47024e7c219 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -4311,6 +4311,8 @@ bool Prepared_statement::prepare(const char *packet, uint packet_len)
if (thd->spcont == NULL)
general_log_write(thd, COM_STMT_PREPARE, query(), query_length());
}
+ // The same format as for triggers to compare
+ hr_prepare_time= my_hrtime();
DBUG_RETURN(error);
}
@@ -4404,8 +4406,8 @@ Prepared_statement::execute_loop(String *expanded_query,
uchar *packet_end)
{
Reprepare_observer reprepare_observer;
- bool error;
int reprepare_attempt= 0;
+ bool error;
iterations= FALSE;
/*