summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/contributors.h13
-rw-r--r--sql/item.cc31
-rw-r--r--sql/item.h10
-rw-r--r--sql/item_cmpfunc.cc2
-rw-r--r--sql/item_subselect.cc49
-rw-r--r--sql/item_subselect.h6
-rw-r--r--sql/mysqld.cc3
-rw-r--r--sql/sql_class.h19
-rw-r--r--sql/sql_cte.cc1
-rw-r--r--sql/sql_join_cache.cc88
-rw-r--r--sql/sql_join_cache.h11
-rw-r--r--sql/sql_parse.cc8
-rw-r--r--sql/sql_plugin_services.ic1
-rw-r--r--sql/sql_show.cc11
-rw-r--r--sql/wsrep_dummy.cc10
-rw-r--r--sql/wsrep_thd.cc19
16 files changed, 202 insertions, 80 deletions
diff --git a/sql/contributors.h b/sql/contributors.h
index 34f06087c8c..e16448ee985 100644
--- a/sql/contributors.h
+++ b/sql/contributors.h
@@ -37,22 +37,17 @@ struct show_table_contributors_st {
struct show_table_contributors_st show_table_contributors[]= {
/* MariaDB foundation sponsors, in contribution, size , time order */
- {"Booking.com", "https://www.booking.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
{"Alibaba Cloud", "https://www.alibabacloud.com/", "Platinum Sponsor of the MariaDB Foundation"},
{"Tencent Cloud", "https://cloud.tencent.com", "Platinum Sponsor of the MariaDB Foundation"},
{"Microsoft", "https://microsoft.com/", "Platinum Sponsor of the MariaDB Foundation"},
{"MariaDB Corporation", "https://mariadb.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"},
+ {"ServiceNow", "https://servicenow.com", "Platinum Sponsor of the MariaDB Foundation"},
{"Visma", "https://visma.com", "Gold Sponsor of the MariaDB Foundation"},
{"DBS", "https://dbs.com", "Gold Sponsor of the MariaDB Foundation"},
{"IBM", "https://www.ibm.com", "Gold Sponsor of the MariaDB Foundation"},
- {"Tencent Games", "http://game.qq.com/", "Gold Sponsor of the MariaDB Foundation"},
- {"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"},
- {"Acronis", "https://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"},
- {"Verkkokauppa.com", "https://www.verkkokauppa.com", "Bronze Sponsor of the MariaDB Foundation"},
- {"Virtuozzo", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"},
- {"Tencent Game DBA", "http://tencentdba.com/about", "Bronze Sponsor of the MariaDB Foundation"},
- {"Tencent TDSQL", "http://tdsql.org", "Bronze Sponsor of the MariaDB Foundation"},
- {"Percona", "https://www.percona.com/", "Bronze Sponsor of the MariaDB Foundation"},
+ {"Automattic", "https://automattic.com", "Silver Sponsor of the MariaDB Foundation"},
+ {"Percona", "https://www.percona.com/", "Sponsor of the MariaDB Foundation"},
+ {"Galera Cluster", "https://galeracluster.com", "Sponsor of the MariaDB Foundation"},
/* Sponsors of important features */
{"Google", "USA", "Sponsoring encryption, parallel replication and GTID"},
diff --git a/sql/item.cc b/sql/item.cc
index 3c736316a42..b8eb0d453d5 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2010, 2020, MariaDB Corporation.
+ Copyright (c) 2010, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -9829,7 +9829,7 @@ bool Item_cache_int::cache_value()
return FALSE;
value_cached= TRUE;
value= example->val_int_result();
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
unsigned_flag= example->unsigned_flag;
return TRUE;
}
@@ -9906,7 +9906,7 @@ bool Item_cache_temporal::cache_value()
return false;
value_cached= true;
value= example->val_datetime_packed_result(current_thd);
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
return true;
}
@@ -9917,7 +9917,7 @@ bool Item_cache_time::cache_value()
return false;
value_cached= true;
value= example->val_time_packed_result(current_thd);
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
return true;
}
@@ -10059,7 +10059,7 @@ bool Item_cache_real::cache_value()
return FALSE;
value_cached= TRUE;
value= example->val_result();
- null_value= example->null_value;
+ null_value_inside= null_value= example->null_value;
return TRUE;
}
@@ -10126,7 +10126,8 @@ bool Item_cache_decimal::cache_value()
return FALSE;
value_cached= TRUE;
my_decimal *val= example->val_decimal_result(&decimal_value);
- if (!(null_value= example->null_value) && val != &decimal_value)
+ if (!(null_value_inside= null_value= example->null_value) &&
+ val != &decimal_value)
my_decimal2decimal(val, &decimal_value);
return TRUE;
}
@@ -10175,11 +10176,14 @@ Item *Item_cache_decimal::convert_to_basic_const_item(THD *thd)
bool Item_cache_str::cache_value()
{
if (!example)
+ {
+ DBUG_ASSERT(value_cached == FALSE);
return FALSE;
+ }
value_cached= TRUE;
value_buff.set(buffer, sizeof(buffer), example->collation.collation);
value= example->str_result(&value_buff);
- if ((null_value= example->null_value))
+ if ((null_value= null_value_inside= example->null_value))
value= 0;
else if (value != &value_buff)
{
@@ -10274,6 +10278,8 @@ Item *Item_cache_str::convert_to_basic_const_item(THD *thd)
bool Item_cache_row::setup(THD *thd, Item *item)
{
example= item;
+ null_value= true;
+
if (!values && allocate(thd, item->cols()))
return 1;
for (uint i= 0; i < item_count; i++)
@@ -10306,12 +10312,19 @@ bool Item_cache_row::cache_value()
if (!example)
return FALSE;
value_cached= TRUE;
- null_value= 0;
+ null_value= TRUE;
+ null_value_inside= false;
example->bring_value();
+
+ /*
+ For Item_cache_row null_value is set to TRUE only when ALL the values
+ inside the cache are NULL
+ */
for (uint i= 0; i < item_count; i++)
{
values[i]->cache_value();
- null_value|= values[i]->null_value;
+ null_value&= values[i]->null_value;
+ null_value_inside|= values[i]->null_value;
}
return TRUE;
}
diff --git a/sql/item.h b/sql/item.h
index e2ddbc41542..9b55a515691 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -6751,6 +6751,14 @@ protected:
table_map used_table_map;
public:
+ /*
+ This is set if at least one of the values of a sub query is NULL
+ Item_cache_row returns this with null_inside().
+ For not row items, it's set to the value of null_value
+ It is set after cache_value() is called.
+ */
+ bool null_value_inside;
+
Item_cache(THD *thd):
Item(thd),
Type_handler_hybrid_field_type(&type_handler_string),
@@ -6760,6 +6768,7 @@ public:
{
maybe_null= 1;
null_value= 1;
+ null_value_inside= true;
}
protected:
Item_cache(THD *thd, const Type_handler *handler):
@@ -6771,6 +6780,7 @@ protected:
{
maybe_null= 1;
null_value= 1;
+ null_value_inside= true;
}
public:
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index bbd5fbf073a..875aacec3bc 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -1565,7 +1565,7 @@ longlong Item_in_optimizer::val_int()
DBUG_RETURN(res);
}
- if (cache->null_value)
+ if (cache->null_value_inside)
{
DBUG_PRINT("info", ("Left NULL..."));
/*
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index ad6dba01ad6..486758c823e 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -879,7 +879,7 @@ bool Item_subselect::expr_cache_is_needed(THD *thd)
inline bool Item_in_subselect::left_expr_has_null()
{
- return (*(optimizer->get_cache()))->null_value;
+ return (*(optimizer->get_cache()))->null_value_inside;
}
@@ -1333,7 +1333,17 @@ bool Item_singlerow_subselect::null_inside()
void Item_singlerow_subselect::bring_value()
{
if (!exec() && assigned())
- null_value= 0;
+ {
+ null_value= true;
+ for (uint i= 0; i < max_columns ; i++)
+ {
+ if (!row[i]->null_value)
+ {
+ null_value= false;
+ return;
+ }
+ }
+ }
else
reset();
}
@@ -1359,7 +1369,11 @@ longlong Item_singlerow_subselect::val_int()
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_int();
+ {
+ longlong val= value->val_int();
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1368,6 +1382,7 @@ longlong Item_singlerow_subselect::val_int()
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1376,7 +1391,11 @@ String *Item_singlerow_subselect::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_str(str);
+ {
+ String *res= value->val_str(str);
+ null_value= value->null_value;
+ return res;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1385,6 +1404,7 @@ String *Item_singlerow_subselect::val_str(String *str)
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1412,7 +1432,11 @@ my_decimal *Item_singlerow_subselect::val_decimal(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_decimal(decimal_value);
+ {
+ my_decimal *val= value->val_decimal(decimal_value);
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1421,6 +1445,7 @@ my_decimal *Item_singlerow_subselect::val_decimal(my_decimal *decimal_value)
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1430,7 +1455,11 @@ bool Item_singlerow_subselect::val_bool()
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->val_bool();
+ {
+ bool val= value->val_bool();
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1439,6 +1468,7 @@ bool Item_singlerow_subselect::val_bool()
else
{
reset();
+ DBUG_ASSERT(null_value);
return 0;
}
}
@@ -1448,7 +1478,11 @@ bool Item_singlerow_subselect::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t
{
DBUG_ASSERT(fixed == 1);
if (forced_const)
- return value->get_date(thd, ltime, fuzzydate);
+ {
+ bool val= value->get_date(thd, ltime, fuzzydate);
+ null_value= value->null_value;
+ return val;
+ }
if (!exec() && !value->null_value)
{
null_value= FALSE;
@@ -1457,6 +1491,7 @@ bool Item_singlerow_subselect::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t
else
{
reset();
+ DBUG_ASSERT(null_value);
return 1;
}
}
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index 015b32ae6d6..97e62e891b7 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -50,7 +50,11 @@ class Item_subselect :public Item_result_field,
protected Used_tables_and_const_cache,
protected With_sum_func_cache
{
- bool value_assigned; /* value already assigned to subselect */
+ /*
+ Set to TRUE if the value is assigned for the subselect
+ FALSE: subquery not executed or the subquery returns an empty result
+ */
+ bool value_assigned;
bool own_engine; /* the engine was not taken from other Item_subselect */
protected:
/* thread handler, will be assigned in fix_fields only */
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 71298e2ba00..d0081034c0c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7558,8 +7558,11 @@ static int show_memory_used(THD *thd, SHOW_VAR *var, char *buff,
var->type= SHOW_LONGLONG;
var->value= buff;
if (scope == OPT_GLOBAL)
+ {
+ calc_sum_of_all_status_if_needed(status_var);
*(longlong*) buff= (status_var->global_memory_used +
status_var->local_memory_used);
+ }
else
*(longlong*) buff= status_var->local_memory_used;
return 0;
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 4eabd3da450..34a4edbb761 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -933,11 +933,24 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var);
void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
STATUS_VAR *dec_var);
+uint calc_sum_of_all_status(STATUS_VAR *to);
+static inline void calc_sum_of_all_status_if_needed(STATUS_VAR *to)
+{
+ if (to->local_memory_used == 0)
+ {
+ mysql_mutex_lock(&LOCK_status);
+ *to= global_status_var;
+ mysql_mutex_unlock(&LOCK_status);
+ calc_sum_of_all_status(to);
+ DBUG_ASSERT(to->local_memory_used);
+ }
+}
+
/*
Update global_memory_used. We have to do this with atomic_add as the
global value can change outside of LOCK_status.
*/
-inline void update_global_memory_status(int64 size)
+static inline void update_global_memory_status(int64 size)
{
DBUG_PRINT("info", ("global memory_used: %lld size: %lld",
(longlong) global_status_var.global_memory_used,
@@ -955,7 +968,7 @@ inline void update_global_memory_status(int64 size)
@retval NULL on error
@retval Pointter to CHARSET_INFO with the given name on success
*/
-inline CHARSET_INFO *
+static inline CHARSET_INFO *
mysqld_collation_get_by_name(const char *name,
CHARSET_INFO *name_cs= system_charset_info)
{
@@ -974,7 +987,7 @@ mysqld_collation_get_by_name(const char *name,
return cs;
}
-inline bool is_supported_parser_charset(CHARSET_INFO *cs)
+static inline bool is_supported_parser_charset(CHARSET_INFO *cs)
{
return MY_TEST(cs->mbminlen == 1);
}
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index a9f5443e36d..f3861ebd3e9 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -904,6 +904,7 @@ st_select_lex_unit *With_element::clone_parsed_spec(THD *thd,
with_table->next_global= spec_tables;
}
res= &lex->unit;
+ res->with_element= this;
lex->unit.include_down(with_table->select_lex);
lex->unit.set_slave(with_select);
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 20ed976daab..c62d096ea01 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -1650,7 +1650,7 @@ void JOIN_CACHE::get_record_by_pos(uchar *rec_ptr)
}
-/*
+/*
Get the match flag from the referenced record: the default implementation
SYNOPSIS
@@ -1662,6 +1662,7 @@ void JOIN_CACHE::get_record_by_pos(uchar *rec_ptr)
get the match flag for the record pointed by the reference at the position
rec_ptr. If the match flag is placed in one of the previous buffers the
function first reaches the linked record fields in this buffer.
+ The function returns the value of the first encountered match flag.
RETURN VALUE
match flag for the record at the position rec_ptr
@@ -1686,6 +1687,39 @@ enum JOIN_CACHE::Match_flag JOIN_CACHE::get_match_flag_by_pos(uchar *rec_ptr)
/*
+ Get the match flag for the referenced record from specified join buffer
+
+ SYNOPSIS
+ get_match_flag_by_pos_from_join_buffer()
+ rec_ptr position of the first field of the record in the join buffer
+ tab join table with join buffer where to look for the match flag
+
+ DESCRIPTION
+ This default implementation of the get_match_flag_by_pos_from_join_buffer
+ method gets the match flag for the record pointed by the reference at the
+ position rec_ptr from the join buffer attached to the join table tab.
+
+ RETURN VALUE
+ match flag for the record at the position rec_ptr from the join
+ buffer attached to the table tab.
+*/
+
+enum JOIN_CACHE::Match_flag
+JOIN_CACHE::get_match_flag_by_pos_from_join_buffer(uchar *rec_ptr,
+ JOIN_TAB *tab)
+{
+ DBUG_ASSERT(tab->cache && tab->cache->with_match_flag);
+ for (JOIN_CACHE *cache= this; ; )
+ {
+ if (cache->join_tab == tab)
+ return (enum Match_flag) rec_ptr[0];
+ cache= cache->prev_cache;
+ rec_ptr= cache->get_rec_ref(rec_ptr);
+ }
+}
+
+
+/*
Calculate the increment of the auxiliary buffer for a record write
SYNOPSIS
@@ -1955,6 +1989,10 @@ bool JOIN_CACHE::read_referenced_field(CACHE_FIELD *copy,
If the record is skipped the value of 'pos' is set to point to the position
right after the record.
+ NOTE
+ Currently this function is called only when generating null complemented
+ records for outer joins (=> only when join_tab->first_unmatched != NULL).
+
RETURN VALUE
TRUE the match flag is set to MATCH_FOUND and the record has been skipped
FALSE otherwise
@@ -1967,7 +2005,9 @@ bool JOIN_CACHE::skip_if_matched()
if (prev_cache)
offset+= prev_cache->get_size_of_rec_offset();
/* Check whether the match flag is MATCH_FOUND */
- if (get_match_flag_by_pos(pos+offset) == MATCH_FOUND)
+ if (get_match_flag_by_pos_from_join_buffer(pos+offset,
+ join_tab->first_unmatched) ==
+ MATCH_FOUND)
{
pos+= size_of_rec_len + get_rec_length(pos);
return TRUE;
@@ -1984,13 +2024,23 @@ bool JOIN_CACHE::skip_if_matched()
DESCRIPTION
This default implementation of the virtual function skip_if_not_needed_match
- skips the next record from the join buffer if its match flag is not
- MATCH_NOT_FOUND, and, either its value is MATCH_FOUND and join_tab is the
- first inner table of an inner join, or, its value is MATCH_IMPOSSIBLE
- and join_tab is the first inner table of an outer join.
+ skips the next record from the join when generating join extensions
+ for the records in the join buffer depending on the value of the match flag.
+ - In the case of a semi-nest the match flag may be in two states
+ {MATCH_NOT_FOUND, MATCH_FOUND}. The record is skipped if the flag is set
+ to MATCH_FOUND.
+ - In the case of a outer join nest when not_exists optimization is applied
+ the match may be in three states {MATCH_NOT_FOUND, MATCH_IMPOSSIBLE,
+ MATCH_FOUND. The record is skipped if the flag is set to MATCH_FOUND or
+ to MATCH_IMPOSSIBLE.
+
If the record is skipped the value of 'pos' is set to point to the position
right after the record.
+ NOTE
+ Currently the function is called only when generating non-null complemented
+ extensions for records in the join buffer.
+
RETURN VALUE
TRUE the record has to be skipped
FALSE otherwise
@@ -2001,11 +2051,19 @@ bool JOIN_CACHE::skip_if_not_needed_match()
DBUG_ASSERT(with_length);
enum Match_flag match_fl;
uint offset= size_of_rec_len;
+ bool skip= FALSE;
if (prev_cache)
offset+= prev_cache->get_size_of_rec_offset();
- if ((match_fl= get_match_flag_by_pos(pos+offset)) != MATCH_NOT_FOUND &&
- (join_tab->check_only_first_match() == (match_fl == MATCH_FOUND)) )
+ if (!join_tab->check_only_first_match())
+ return FALSE;
+
+ match_fl= get_match_flag_by_pos(pos+offset);
+ skip= join_tab->first_sj_inner_tab ?
+ match_fl == MATCH_FOUND : // the case of semi-join
+ match_fl != MATCH_NOT_FOUND; // the case of outer-join
+
+ if (skip)
{
pos+= size_of_rec_len + get_rec_length(pos);
return TRUE;
@@ -2105,7 +2163,14 @@ enum_nested_loop_state JOIN_CACHE::join_records(bool skip_last)
goto finish;
}
join_tab->not_null_compl= FALSE;
- /* Prepare for generation of null complementing extensions */
+ /*
+ Prepare for generation of null complementing extensions.
+ For all inner tables of the outer join operation for which
+ regular matches have been just found the field 'first_unmatched'
+ is set to point the the first inner table. After all null
+ complement rows are generated for this outer join this field
+ is set back to NULL.
+ */
for (tab= join_tab->first_inner; tab <= join_tab->last_inner; tab++)
tab->first_unmatched= join_tab->first_inner;
}
@@ -2222,7 +2287,10 @@ enum_nested_loop_state JOIN_CACHE::join_matching_records(bool skip_last)
int error;
enum_nested_loop_state rc= NESTED_LOOP_OK;
join_tab->table->null_row= 0;
- bool check_only_first_match= join_tab->check_only_first_match();
+ bool check_only_first_match=
+ join_tab->check_only_first_match() &&
+ (!join_tab->first_inner || // semi-join case
+ join_tab->first_inner == join_tab->first_unmatched); // outer join case
bool outer_join_first_inner= join_tab->is_first_inner_for_outer_join();
DBUG_ENTER("JOIN_CACHE::join_matching_records");
diff --git a/sql/sql_join_cache.h b/sql/sql_join_cache.h
index 7b8b942180f..d0bf4761f65 100644
--- a/sql/sql_join_cache.h
+++ b/sql/sql_join_cache.h
@@ -206,7 +206,9 @@ protected:
/*
This flag indicates that records written into the join buffer contain
- a match flag field. The flag must be set by the init method.
+ a match flag field. The flag must be set by the init method.
+ Currently any implementation of the virtial init method calls
+ the function JOIN_CACHE::calc_record_fields() to set this flag.
*/
bool with_match_flag;
/*
@@ -646,6 +648,13 @@ public:
/* Shall return the value of the match flag for the positioned record */
virtual enum Match_flag get_match_flag_by_pos(uchar *rec_ptr);
+ /*
+ Shall return the value of the match flag for the positioned record
+ from the join buffer attached to the specified table
+ */
+ virtual enum Match_flag
+ get_match_flag_by_pos_from_join_buffer(uchar *rec_ptr, JOIN_TAB *tab);
+
/* Shall return the position of the current record */
virtual uchar *get_curr_rec() { return curr_rec_pos; }
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index dad7b804e7e..23214020486 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -8987,7 +8987,13 @@ push_new_name_resolution_context(THD *thd,
left_op->first_leaf_for_name_resolution();
on_context->last_name_resolution_table=
right_op->last_leaf_for_name_resolution();
- return thd->lex->push_context(on_context);
+ LEX *lex= thd->lex;
+ on_context->select_lex = lex->current_select;
+ st_select_lex *curr_select= lex->pop_select();
+ st_select_lex *outer_sel= lex->select_stack_head();
+ lex->push_select(curr_select);
+ on_context->outer_context = outer_sel ? &outer_sel->context : 0;
+ return lex->push_context(on_context);
}
diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic
index a8b70e294e1..740569dc76e 100644
--- a/sql/sql_plugin_services.ic
+++ b/sql/sql_plugin_services.ic
@@ -155,7 +155,6 @@ static struct wsrep_service_st wsrep_handler = {
wsrep_thd_retry_counter,
wsrep_thd_ignore_table,
wsrep_thd_trx_seqno,
- wsrep_thd_auto_increment_variables,
wsrep_thd_is_aborting,
wsrep_set_data_home_dir,
wsrep_thd_is_BF,
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index ae93bd3107d..8cb82c602d9 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -3833,15 +3833,8 @@ static bool show_status_array(THD *thd, const char *wild,
if (show_type == SHOW_SYS)
mysql_mutex_lock(&LOCK_global_system_variables);
- else if (show_type >= SHOW_LONG_STATUS && scope == OPT_GLOBAL &&
- !status_var->local_memory_used)
- {
- mysql_mutex_lock(&LOCK_status);
- *status_var= global_status_var;
- mysql_mutex_unlock(&LOCK_status);
- calc_sum_of_all_status(status_var);
- DBUG_ASSERT(status_var->local_memory_used);
- }
+ else if (show_type >= SHOW_LONG_STATUS && scope == OPT_GLOBAL)
+ calc_sum_of_all_status_if_needed(status_var);
pos= get_one_variable(thd, var, scope, show_type, status_var,
&charset, buff, &length);
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index 2503a97590b..129df8e1577 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2014, 2020, MariaDB
+/* Copyright (C) 2014, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -107,14 +107,6 @@ const char* wsrep_thd_client_state_str(const THD*)
const char* wsrep_thd_client_mode_str(const THD*)
{ return 0; }
-void wsrep_thd_auto_increment_variables(THD *thd,
- unsigned long long *offset,
- unsigned long long *increment)
-{
- *offset= thd->variables.auto_increment_offset;
- *increment= thd->variables.auto_increment_increment;
-}
-
const char* wsrep_thd_transaction_state_str(const THD*)
{ return 0; }
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 2d814c62424..023da27c3c1 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -368,25 +368,6 @@ bool wsrep_bf_abort(const THD* bf_thd, THD* victim_thd)
return ret;
}
-/*
- Get auto increment variables for THD. Use global settings for
- applier threads.
- */
-void wsrep_thd_auto_increment_variables(THD* thd,
- unsigned long long* offset,
- unsigned long long* increment)
-{
- if (wsrep_thd_is_applying(thd) &&
- thd->wsrep_trx().state() != wsrep::transaction::s_replaying)
- {
- *offset= global_system_variables.auto_increment_offset;
- *increment= global_system_variables.auto_increment_increment;
- return;
- }
- *offset= thd->variables.auto_increment_offset;
- *increment= thd->variables.auto_increment_increment;
-}
-
int wsrep_create_threadvars()
{
int ret= 0;