Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Manually merged query cache fixes from
97c02faf0a39dd189eeda4f75fb35bc5db69d541.
  • Loading branch information
sciascid authored and Nirbhay Choubey committed Feb 10, 2016
1 parent 0c7dffe commit 484bbd3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
20 changes: 19 additions & 1 deletion sql/log_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8556,7 +8556,18 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
const_cast<Relay_log_info*>(rli)->m_table_map.set_table(ptr->table_id, ptr->table);

#ifdef HAVE_QUERY_CACHE
query_cache.invalidate_locked_for_write(thd, rli->tables_to_lock);
#ifdef WITH_WSREP
/*
Moved invalidation right before the call to rows_event_stmt_cleanup(),
to avoid query cache being polluted with stale entries.
*/
if (! (WSREP(thd) && (thd->wsrep_exec_mode == REPL_RECV)))
{
#endif /* WITH_WSREP */
query_cache.invalidate_locked_for_write(thd, rli->tables_to_lock);
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
#endif
}

Expand Down Expand Up @@ -8749,6 +8760,13 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli)
DBUG_RETURN(error);
}

#if defined(WITH_WSREP) && defined(HAVE_QUERY_CACHE)
if (get_flags(STMT_END_F) &&
WSREP(thd) && thd->wsrep_exec_mode == REPL_RECV)
{
query_cache.invalidate_locked_for_write(thd, rli->tables_to_lock);
}
#endif /* WITH_WSREP */
if (get_flags(STMT_END_F) && (error= rows_event_stmt_cleanup(rli, thd)))
slave_rows_error_report(ERROR_LEVEL,
thd->is_error() ? 0 : error,
Expand Down
6 changes: 6 additions & 0 deletions sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6544,6 +6544,12 @@ void mysql_parse(THD *thd, char *rawbuf, uint length,
thd->lex->sql_command= SQLCOM_SELECT;
status_var_increment(thd->status_var.com_stat[SQLCOM_SELECT]);
thd->update_stats();
#ifdef WITH_WSREP
if (WSREP_CLIENT(thd))
{
thd->wsrep_sync_wait_gtid = WSREP_GTID_UNDEFINED;
}
#endif /* WITH_WSREP */
}
DBUG_VOID_RETURN;
}
Expand Down

0 comments on commit 484bbd3

Please sign in to comment.