summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-05-18 10:30:47 +0200
committerSergei Golubchik <serg@mariadb.org>2022-05-18 10:30:47 +0200
commitb2187662bcba12b66667bc0531727453b3b8a666 (patch)
tree5a7983713a99cbac9e645483125c8ef4fceb3fcb /sql
parent98ca71ab28fffbb65c4590cda904f1f0dfd975bb (diff)
parent7970ac7fe87d1da34e3e212dccd57b112b94b3fe (diff)
downloadmariadb-git-b2187662bcba12b66667bc0531727453b3b8a666.tar.gz
Merge branch '10.5' into 10.6mariadb-10.6.8
Diffstat (limited to 'sql')
-rw-r--r--sql/gcalc_tools.cc2
-rw-r--r--sql/gcalc_tools.h16
-rw-r--r--sql/ha_partition.h1
-rw-r--r--sql/item_sum.cc6
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/partition_info.cc2
-rw-r--r--sql/slave.cc34
-rw-r--r--sql/sql_class.h4
-rw-r--r--sql/sql_lex.cc2
-rw-r--r--sql/sql_lex.h12
-rw-r--r--sql/sql_parse.cc18
-rw-r--r--sql/sql_select.cc9
-rw-r--r--sql/sql_yacc.yy1
-rw-r--r--sql/wsrep_trans_observer.h4
14 files changed, 37 insertions, 76 deletions
diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc
index 307f063fb43..25c80a7a796 100644
--- a/sql/gcalc_tools.cc
+++ b/sql/gcalc_tools.cc
@@ -132,7 +132,7 @@ int Gcalc_function::count_internal(const char *cur_func, uint set_type,
int mask= (c_op & op_not) ? 1:0;
uint n_ops= c_op & ~(op_any | op_not | v_mask);
uint n_shape= c_op & ~(op_any | op_not | v_mask); /* same as n_ops */
- value v_state= (value) (c_op & v_mask);
+ op_type v_state= (op_type) (c_op & v_mask);
int result= 0;
const char *sav_cur_func= cur_func;
diff --git a/sql/gcalc_tools.h b/sql/gcalc_tools.h
index e625b355d95..bb1f473e180 100644
--- a/sql/gcalc_tools.h
+++ b/sql/gcalc_tools.h
@@ -52,17 +52,15 @@ private:
int count_internal(const char *cur_func, uint set_type,
const char **end);
public:
- enum value
- {
- v_empty= 0x0000000,
- v_find_t= 0x1000000,
- v_find_f= 0x2000000,
- v_t_found= 0x3000000,
- v_f_found= 0x4000000,
- v_mask= 0x7000000
- };
enum op_type
{
+ v_empty= 0x00000000,
+ v_find_t= 0x01000000,
+ v_find_f= 0x02000000,
+ v_t_found= 0x03000000,
+ v_f_found= 0x04000000,
+ v_mask= 0x07000000,
+
op_not= 0x80000000,
op_shape= 0x00000000,
op_union= 0x10000000,
diff --git a/sql/ha_partition.h b/sql/ha_partition.h
index 29763447e6e..a9010e76389 100644
--- a/sql/ha_partition.h
+++ b/sql/ha_partition.h
@@ -1616,7 +1616,6 @@ public:
for (; part_id < part_id_end; ++part_id)
{
handler *file= m_file[part_id];
- DBUG_ASSERT(bitmap_is_set(&(m_part_info->read_partitions), part_id));
file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_OPEN);
part_recs+= file->stats.records;
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index ca757b6b94a..d33202d0a42 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -4255,9 +4255,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
result.set_charset(collation.collation);
result_field= 0;
null_value= 1;
- max_length= (uint32)MY_MIN(thd->variables.group_concat_max_len
- / collation.collation->mbminlen
- * collation.collation->mbmaxlen, UINT_MAX32);
+ max_length= (uint32) MY_MIN((ulonglong) thd->variables.group_concat_max_len
+ / collation.collation->mbminlen
+ * collation.collation->mbmaxlen, UINT_MAX32);
uint32 offset;
if (separator->needs_conversion(separator->length(), separator->charset(),
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 87b92cf8b0e..854fcd61b82 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -5344,7 +5344,9 @@ static int init_server_components()
if (ha_recover(0))
unireg_abort(1);
+#ifndef EMBEDDED_LIBRARY
start_handle_manager();
+#endif
if (opt_bin_log)
{
int error;
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index d96c6a82617..ba24d36ad17 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -891,8 +891,6 @@ void partition_info::vers_check_limit(THD *thd)
uint32 part_id= vers_info->hist_part->id * sub_factor;
const uint32 part_id_end= part_id + sub_factor;
DBUG_ASSERT(part_id_end <= num_parts * sub_factor);
- for (; part_id < part_id_end; ++part_id)
- bitmap_set_bit(&read_partitions, part_id);
ha_partition *hp= (ha_partition*)(table->file);
ha_rows hist_rows= hp->part_records(vers_info->hist_part);
diff --git a/sql/slave.cc b/sql/slave.cc
index 54be2f07b3d..7f7f121db7e 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -7154,8 +7154,9 @@ dbug_gtid_accept:
mi->using_gtid != Master_info::USE_GTID_NO &&
mi->events_queued_since_last_gtid > 0 &&
( (mi->last_queued_gtid_standalone &&
- !Log_event::is_part_of_group((Log_event_type)(uchar)
- buf[EVENT_TYPE_OFFSET])) ||
+ (LOG_EVENT_IS_QUERY((Log_event_type)(uchar)
+ buf[EVENT_TYPE_OFFSET]) ||
+ (uchar)buf[EVENT_TYPE_OFFSET] == INCIDENT_EVENT)) ||
(!mi->last_queued_gtid_standalone &&
((uchar)buf[EVENT_TYPE_OFFSET] == XID_EVENT ||
(uchar)buf[EVENT_TYPE_OFFSET] == XA_PREPARE_LOG_EVENT ||
@@ -7189,33 +7190,8 @@ dbug_gtid_accept:
mi->gtid_current_pos.update(&mi->last_queued_gtid);
mi->events_queued_since_last_gtid= 0;
- if (unlikely(gtid_skip_enqueue))
- {
- error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
- sql_print_error("Recieved a group closing %s event "
- "at %llu position in the group while there are "
- "still %llu events to skip upon reconnecting; "
- "the last seen GTID is %u-%u-%llu",
- Log_event::get_type_str((Log_event_type) (uchar)
- buf[EVENT_TYPE_OFFSET]),
- (mi->events_queued_since_last_gtid -
- mi->gtid_reconnect_event_skip_count),
- mi->events_queued_since_last_gtid,
- mi->last_queued_gtid);
- goto err;
- }
- else
- {
- /*
- The whole of the current event group is queued. So in case of
- reconnect we can start from after the current GTID.
- */
- mi->gtid_current_pos.update(&mi->last_queued_gtid);
- mi->events_queued_since_last_gtid= 0;
-
- /* Reset the domain_id_filter flag. */
- mi->domain_id_filter.reset_filter();
- }
+ /* Reset the domain_id_filter flag. */
+ mi->domain_id_filter.reset_filter();
}
skip_relay_logging:
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 5684fa921de..d9e56ed5e5b 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -5622,8 +5622,8 @@ my_eof(THD *thd)
inline date_conv_mode_t sql_mode_for_dates(THD *thd)
{
- static_assert((date_conv_mode_t::KNOWN_MODES &
- time_round_mode_t::KNOWN_MODES) == 0,
+ static_assert((ulonglong(date_conv_mode_t::KNOWN_MODES) &
+ ulonglong(time_round_mode_t::KNOWN_MODES)) == 0,
"date_conv_mode_t and time_round_mode_t must use different "
"bit values");
static_assert(MODE_NO_ZERO_DATE == date_mode_t::NO_ZERO_DATE &&
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index dd9429af96b..934e7e7e7e0 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -7798,7 +7798,7 @@ bool LEX::maybe_start_compound_statement(THD *thd)
if (!make_sp_head(thd, NULL, &sp_handler_procedure, DEFAULT_AGGREGATE))
return true;
sphead->set_suid(SP_IS_NOT_SUID);
- sphead->set_body_start(thd, thd->m_parser_state->m_lip.get_cpp_ptr());
+ sphead->set_body_start(thd, thd->m_parser_state->m_lip.get_cpp_tok_start());
}
return false;
}
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 098cc52f1d0..a9040f7c3d2 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -2048,8 +2048,7 @@ public:
@retval nonzero if the statement is a row injection
*/
inline bool is_stmt_row_injection() const {
- return binlog_stmt_flags &
- (1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION));
+ return binlog_stmt_flags & (1U << BINLOG_STMT_TYPE_ROW_INJECTION);
}
/**
@@ -2059,8 +2058,7 @@ public:
*/
inline void set_stmt_row_injection() {
DBUG_ENTER("set_stmt_row_injection");
- binlog_stmt_flags|=
- (1U << (BINLOG_STMT_UNSAFE_COUNT + BINLOG_STMT_TYPE_ROW_INJECTION));
+ binlog_stmt_flags|= (1U << BINLOG_STMT_TYPE_ROW_INJECTION);
DBUG_VOID_RETURN;
}
@@ -2336,7 +2334,7 @@ private:
The statement is a row injection (i.e., either a BINLOG
statement or a row event executed by the slave SQL thread).
*/
- BINLOG_STMT_TYPE_ROW_INJECTION = 0,
+ BINLOG_STMT_TYPE_ROW_INJECTION = BINLOG_STMT_UNSAFE_COUNT,
/** The last element of this enumeration type. */
BINLOG_STMT_TYPE_COUNT
@@ -2350,8 +2348,8 @@ private:
- The low BINLOG_STMT_UNSAFE_COUNT bits indicate the types of
unsafeness that the current statement has.
- - The next BINLOG_STMT_TYPE_COUNT bits indicate if the statement
- is of some special type.
+ - The next BINLOG_STMT_TYPE_COUNT-BINLOG_STMT_TYPE_COUNT bits indicate if
+ the statement is of some special type.
This must be a member of LEX, not of THD: each stored procedure
needs to remember its unsafeness state between calls and each
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index cddcb3552df..0aae981db27 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -1507,22 +1507,6 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
}
#ifdef WITH_WSREP
-static my_bool wsrep_read_only_option(THD *thd, TABLE_LIST *all_tables)
-{
- int opt_readonly_saved = opt_readonly;
- privilege_t flag_saved= thd->security_ctx->master_access & PRIV_IGNORE_READ_ONLY;
-
- opt_readonly = 0;
- thd->security_ctx->master_access &= ~PRIV_IGNORE_READ_ONLY;
-
- my_bool ret = !deny_updates_if_read_only_option(thd, all_tables);
-
- opt_readonly = opt_readonly_saved;
- thd->security_ctx->master_access |= flag_saved;
-
- return ret;
-}
-
static void wsrep_copy_query(THD *thd)
{
thd->wsrep_retry_command = thd->get_command();
@@ -7851,7 +7835,7 @@ static bool wsrep_mysql_parse(THD *thd, char *rawbuf, uint length,
{
bool is_autocommit=
!thd->in_multi_stmt_transaction_mode() &&
- wsrep_read_only_option(thd, thd->lex->query_tables);
+ !thd->wsrep_applier;
bool retry_autocommit;
do
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 673ce8b1573..fa33f0e0500 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -9943,10 +9943,11 @@ best_extension_by_limited_search(JOIN *join,
for (JOIN_TAB **pos= join->best_ref + idx ; (s= *pos) ; pos++)
{
table_map real_table_bit= s->table->map;
- if ((remaining_tables & real_table_bit) &&
- (allowed_tables & real_table_bit) &&
+ DBUG_ASSERT(remaining_tables & real_table_bit);
+
+ if ((allowed_tables & real_table_bit) &&
!(remaining_tables & s->dependent) &&
- (!idx || !check_interleaving_with_nj(s)))
+ !check_interleaving_with_nj(s))
{
double current_record_count, current_read_time;
double partial_join_cardinality;
@@ -17271,7 +17272,6 @@ static uint reset_nj_counters(JOIN *join, List<TABLE_LIST> *join_list)
static bool check_interleaving_with_nj(JOIN_TAB *next_tab)
{
- TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding;
JOIN *join= next_tab->join;
if (join->cur_embedding_map & ~next_tab->embedding_map)
@@ -17283,6 +17283,7 @@ static bool check_interleaving_with_nj(JOIN_TAB *next_tab)
return TRUE;
}
+ TABLE_LIST *next_emb= next_tab->table->pos_in_table_list->embedding;
/*
Do update counters for "pairs of brackets" that we've left (marked as
X,Y,Z in the above picture)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 76180cc05f1..28ab93362c8 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2331,6 +2331,7 @@ create:
lex->create_info.default_table_charset= NULL;
lex->name= null_clex_str;
lex->create_last_non_select_table= lex->last_table();
+ lex->inc_select_stack_outer_barrier();
}
create_body
{
diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h
index c4528b8ef2a..f21eca47fa2 100644
--- a/sql/wsrep_trans_observer.h
+++ b/sql/wsrep_trans_observer.h
@@ -232,6 +232,10 @@ static inline int wsrep_before_prepare(THD* thd, bool all)
WSREP_DEBUG("wsrep_before_prepare: %d", wsrep_is_real(thd, all));
int ret= 0;
DBUG_ASSERT(wsrep_run_commit_hook(thd, all));
+ if ((ret= thd->wsrep_parallel_slave_wait_for_prior_commit()))
+ {
+ DBUG_RETURN(ret);
+ }
if ((ret= thd->wsrep_cs().before_prepare()) == 0)
{
DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined());