diff options
Diffstat (limited to 'sql/log_event_server.cc')
-rw-r--r-- | sql/log_event_server.cc | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index 786b1d08aa9..b665f40e3bc 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -5622,20 +5622,14 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) } } -#ifdef HAVE_QUERY_CACHE -#ifdef WITH_WSREP +#if defined(WITH_WSREP) && defined(HAVE_QUERY_CACHE) /* Moved invalidation right before the call to rows_event_stmt_cleanup(), to avoid query cache being polluted with stale entries, */ - if (! (WSREP(thd) && wsrep_thd_is_applying(thd))) - { -#endif /* WITH_WSREP */ - query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock); -#ifdef WITH_WSREP - } -#endif /* WITH_WSREP */ -#endif + if (WSREP(thd) && wsrep_thd_is_applying(thd)) + query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock); +#endif /* WITH_WSREP && HAVE_QUERY_CACHE */ } table= m_table= rgi->m_table_map.get_table(m_table_id); @@ -5836,19 +5830,20 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) restore_empty_query_table_list(thd->lex); #if defined(WITH_WSREP) && defined(HAVE_QUERY_CACHE) - if (WSREP(thd) && wsrep_thd_is_applying(thd)) - { - query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock); - } + if (WSREP(thd) && wsrep_thd_is_applying(thd)) + query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock); #endif /* WITH_WSREP && HAVE_QUERY_CACHE */ - if (unlikely(get_flags(STMT_END_F) && - (error= rows_event_stmt_cleanup(rgi, thd)))) - slave_rows_error_report(ERROR_LEVEL, - thd->is_error() ? 0 : error, - rgi, thd, table, - get_type_str(), - RPL_LOG_NAME, log_pos); + if (get_flags(STMT_END_F)) + { + if (unlikely((error= rows_event_stmt_cleanup(rgi, thd)))) + slave_rows_error_report(ERROR_LEVEL, thd->is_error() ? 0 : error, + rgi, thd, table, get_type_str(), + RPL_LOG_NAME, log_pos); + if (thd->slave_thread) + free_root(thd->mem_root, MYF(MY_KEEP_PREALLOC)); + } + DBUG_RETURN(error); err: |