cleanup: ifdefs

This commit is contained in:
Sergei Golubchik 2022-11-07 16:10:10 +01:00
commit 8a8f71b8b8
7 changed files with 15 additions and 25 deletions

View file

@ -10508,7 +10508,6 @@ void Column_definition::create_length_to_internal_length_newdecimal()
bool check_expression(Virtual_column_info *vcol, const LEX_CSTRING *name,
enum_vcol_info_type type, Alter_info *alter_info)
{
bool ret;
Item::vcol_func_processor_result res;

View file

@ -1560,7 +1560,7 @@ bool Item_field::check_vcol_func_processor(void *arg)
{
context= 0;
vcol_func_processor_result *res= (vcol_func_processor_result *) arg;
if (res && res->alter_info)
if (res->alter_info)
{
for (Key &k: res->alter_info->key_list)
{

View file

@ -53,6 +53,7 @@
#include "wsrep_mysqld.h"
#include "sql_insert.h"
#include "sql_table.h"
#include <mysql/service_wsrep.h>
#include <my_bitmap.h>
#include "rpl_utility.h"
@ -5027,17 +5028,13 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
}
}
#ifdef HAVE_QUERY_CACHE
/*
Moved invalidation right before the call to rows_event_stmt_cleanup(),
to avoid query cache being polluted with stale entries,
Query cache is not invalidated on wsrep applier here
*/
# ifdef WITH_WSREP
/* Query cache is not invalidated on wsrep applier here */
if (!(WSREP(thd) && wsrep_thd_is_applying(thd)))
# endif /* WITH_WSREP */
query_cache.invalidate_locked_for_write(thd, rgi->tables_to_lock);
#endif /* HAVE_QUERY_CACHE */
}
table= m_table= rgi->m_table_map.get_table(m_table_id);
@ -5250,10 +5247,8 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
/* remove trigger's tables */
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);
#endif /* WITH_WSREP && HAVE_QUERY_CACHE */
query_cache_invalidate_locked_for_write(thd, rgi->tables_to_lock);
if (get_flags(STMT_END_F))
{
@ -6751,14 +6746,12 @@ int Rows_log_event::write_row(rpl_group_info *rgi, const bool overwrite)
TODO: Add safety measures against infinite looping.
*/
if (table->s->sequence)
if (unlikely(table->s->sequence))
error= update_sequence();
else while (unlikely(error= table->file->ha_write_row(table->record[0])))
{
if (error == HA_ERR_LOCK_DEADLOCK ||
error == HA_ERR_LOCK_WAIT_TIMEOUT ||
(keynum= table->file->get_dup_key(error)) < 0 ||
!overwrite)
if (error == HA_ERR_LOCK_DEADLOCK || error == HA_ERR_LOCK_WAIT_TIMEOUT ||
(keynum= table->file->get_dup_key(error)) < 0 || !overwrite)
{
DBUG_PRINT("info",("get_dup_key returns %d)", keynum));
/*
@ -7431,7 +7424,7 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
if (table->key_info->flags & HA_NOSAME)
{
/* Unique does not have non nullable part */
if (!(table->key_info->flags & (HA_NULL_PART_KEY)))
if (!(table->key_info->flags & HA_NULL_PART_KEY))
{
error= 0;
goto end;

View file

@ -197,8 +197,7 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
info->table=table;
info->sort_info= filesort;
if ((table->s->tmp_table == INTERNAL_TMP_TABLE) &&
!using_addon_fields)
if ((table->s->tmp_table == INTERNAL_TMP_TABLE) && !using_addon_fields)
(void) table->file->extra(HA_EXTRA_MMAP);
if (using_addon_fields)

View file

@ -584,6 +584,8 @@ struct Query_cache_query_flags
query_cache.send_result_to_client(A, B, C)
#define query_cache_invalidate_by_MyISAM_filename_ref \
&query_cache_invalidate_by_MyISAM_filename
#define query_cache_invalidate_locked_for_write(A, B) \
query_cache.invalidate_locked_for_write(A, B)
/* note the "maybe": it's a read without mutex */
#define query_cache_maybe_disabled(T) \
(T->variables.query_cache_type == 0 || query_cache.query_cache_size == 0)
@ -601,6 +603,7 @@ struct Query_cache_query_flags
#define query_cache_invalidate1(A,B) do { } while(0)
#define query_cache_send_result_to_client(A, B, C) 0
#define query_cache_invalidate_by_MyISAM_filename_ref NULL
#define query_cache_invalidate_locked_for_write(A, B) do { } while(0)
#define query_cache_abort(A,B) do { } while(0)
#define query_cache_end_of_result(A) do { } while(0)

View file

@ -4899,10 +4899,8 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
}
else
{
#ifdef HAVE_QUERY_CACHE
if (thd->variables.query_cache_wlock_invalidate)
query_cache.invalidate_locked_for_write(thd, first_table);
#endif /*HAVE_QUERY_CACHE*/
query_cache_invalidate_locked_for_write(thd, first_table);
my_ok(thd);
}
break;

View file

@ -10965,11 +10965,9 @@ do_continue:;
DEBUG_SYNC(thd, "alter_table_intermediate_table_created");
/* Open the table since we need to copy the data. */
new_table= thd->create_and_open_tmp_table(&frm,
alter_ctx.get_tmp_path(),
new_table= thd->create_and_open_tmp_table(&frm, alter_ctx.get_tmp_path(),
alter_ctx.new_db.str,
alter_ctx.new_name.str,
true);
alter_ctx.new_name.str, true);
if (!new_table)
goto err_new_table_cleanup;