From f65ba9aeb7eea75656c74da7c20cb4157cb8d943 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 17 Apr 2019 15:50:59 +0200 Subject: 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. --- include/my_sys.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/my_sys.h b/include/my_sys.h index 5cabfc25c12..a32a0c09234 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -964,6 +964,17 @@ extern ulonglong my_getcputime(void); #define hrtime_sec_part(X) ((ulong)((X).val % HRTIME_RESOLUTION)) #define my_time(X) hrtime_to_time(my_hrtime_coarse()) +/** + Make high resolution time from two parts. +*/ + +static inline my_hrtime_t make_hr_time(my_time_t time, ulong time_sec_part) +{ + my_hrtime_t res= {((ulonglong) time)*1000000 + time_sec_part}; + return res; +} + + #if STACK_DIRECTION < 0 #define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END)) #else -- cgit v1.2.1