diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 8687c2e0c48..f356aa91929 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -258,7 +258,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, else { /* Clear mutex so that safe_mutex will notice that it's not initialized */ - bzero((char*) &info->append_buffer_lock, sizeof(info)); + bzero((char*) &info->append_buffer_lock, sizeof(info->append_buffer_lock)); } #endif diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc index 8bfef270f4a..a70e2ac46fd 100644 --- a/sql/sql_cache.cc +++ b/sql/sql_cache.cc @@ -2539,6 +2539,7 @@ void Query_cache::init() */ if (global_system_variables.query_cache_type == 0) { + m_cache_status= DISABLE_REQUEST; free_cache(); m_cache_status= DISABLED; } diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 4dc190ab8cb..94fbe0924b6 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -689,6 +689,8 @@ int mysql_update(THD *thd, if (reinit_io_cache(&tempfile,READ_CACHE,0L,0,0)) error=1; /* purecov: inspected */ select->file=tempfile; // Read row ptrs from this file + // select->file was copied, update self-references. + setup_io_cache(&select->file); if (error >= 0) goto err; }