summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/event_data_objects.cc6
-rw-r--r--sql/events.cc11
-rw-r--r--sql/handler.cc2
-rw-r--r--sql/item_func.cc5
-rw-r--r--sql/log.cc3
-rw-r--r--sql/log.h4
-rw-r--r--sql/mysqld.cc12
-rw-r--r--sql/rpl_gtid.h2
-rw-r--r--sql/rpl_mi.cc2
-rw-r--r--sql/sp_head.cc2
-rw-r--r--sql/sql_acl.cc23
-rw-r--r--sql/sql_array.h14
-rw-r--r--sql/sql_select.cc3
-rw-r--r--sql/sql_select.h6
-rw-r--r--sql/table.cc2
-rw-r--r--sql/table.h9
-rw-r--r--sql/transaction.cc8
-rw-r--r--sql/xa.cc2
18 files changed, 61 insertions, 55 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 5ea8300b7e4..81e703b5653 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1430,10 +1430,8 @@ Event_job_data::execute(THD *thd, bool drop)
if (parse_sql(thd, & parser_state, creation_ctx))
{
- sql_print_error("Event Scheduler: "
- "%serror during compilation of %s.%s",
- thd->is_fatal_error ? "fatal " : "",
- (const char *) dbname.str, (const char *) name.str);
+ sql_print_error("Event Scheduler: %serror during compilation of %s.%s",
+ thd->is_fatal_error ? "fatal " : "", dbname.str, name.str);
goto end;
}
}
diff --git a/sql/events.cc b/sql/events.cc
index 68e013adfae..f4400abdeb5 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -832,13 +832,12 @@ Events::fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */)
*/
if (thd->lex->sql_command == SQLCOM_SHOW_EVENTS)
{
- DBUG_ASSERT(thd->lex->first_select_lex()->db.str);
- if (!is_infoschema_db(&thd->lex->first_select_lex()->db) && // There is no events in I_S
- check_access(thd, EVENT_ACL, thd->lex->first_select_lex()->db.str,
- NULL, NULL, 0, 0))
+ LEX_CSTRING *lexdb= &thd->lex->first_select_lex()->db;
+ DBUG_ASSERT(lexdb);
+ if (!is_infoschema_db(lexdb) && !is_perfschema_db(lexdb) &&
+ check_access(thd, EVENT_ACL, lexdb->str, NULL, NULL, 0, 0))
DBUG_RETURN(1);
- db= normalize_db_name(thd->lex->first_select_lex()->db.str,
- db_tmp, sizeof(db_tmp));
+ db= normalize_db_name(lexdb->str, db_tmp, sizeof(db_tmp));
}
ret= db_repository->fill_schema_events(thd, tables, db);
diff --git a/sql/handler.cc b/sql/handler.cc
index 49a265a9f23..109c7dd01bf 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -1459,9 +1459,7 @@ int ha_commit_trans(THD *thd, bool all)
thd->transaction.cleanup();
#ifdef WITH_WSREP
if (wsrep_is_active(thd) && is_real_trans && !error)
- {
wsrep_commit_empty(thd, all);
- }
#endif /* WITH_WSREP */
DBUG_RETURN(0);
}
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 14a17bd09de..a263391a41a 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4299,7 +4299,7 @@ static PSI_mutex_key key_LOCK_item_func_sleep;
static PSI_mutex_info item_func_sleep_mutexes[]=
{
- { &key_LOCK_item_func_sleep, "LOCK_user_locks", PSI_FLAG_GLOBAL}
+ { &key_LOCK_item_func_sleep, "LOCK_item_func_sleep", PSI_FLAG_GLOBAL}
};
@@ -4682,8 +4682,7 @@ update_hash(user_var_entry *entry, bool set_null, void *ptr, size_t length,
entry->value=0;
entry->value= (char*) my_realloc(entry->value, length,
MYF(MY_ALLOW_ZERO_PTR | MY_WME |
- ME_FATAL |
- MY_THREAD_SPECIFIC));
+ ME_FATAL | MY_THREAD_SPECIFIC));
if (!entry->value)
return 1;
}
diff --git a/sql/log.cc b/sql/log.cc
index 56e83bf2448..b2d971f3a4f 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1723,7 +1723,8 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
if (len > 0) wsrep_dump_rbr_buf(thd, buf, len);
}
#endif /* WITH_WSREP */
- DBUG_ASSERT(cache_mngr->trx_cache.empty() && cache_mngr->stmt_cache.empty());
+ DBUG_ASSERT(cache_mngr->trx_cache.empty());
+ DBUG_ASSERT(cache_mngr->stmt_cache.empty());
cache_mngr->~binlog_cache_mngr();
my_free(cache_mngr);
DBUG_RETURN(0);
diff --git a/sql/log.h b/sql/log.h
index 8684eaba786..fa8b9fca37e 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -424,7 +424,7 @@ class MYSQL_BIN_LOG: public TC_LOG, private MYSQL_LOG
/** The instrumentation key to use for opening the log index file. */
PSI_file_key m_key_file_log_index;
- PSI_file_key m_key_COND_queue_busy;
+ PSI_cond_key m_key_COND_queue_busy;
/** The instrumentation key to use for LOCK_binlog_end_pos. */
PSI_mutex_key m_key_LOCK_binlog_end_pos;
#endif
@@ -675,7 +675,7 @@ public:
PSI_cond_key key_bin_log_update,
PSI_file_key key_file_log,
PSI_file_key key_file_log_index,
- PSI_file_key key_COND_queue_busy,
+ PSI_cond_key key_COND_queue_busy,
PSI_mutex_key key_LOCK_binlog_end_pos)
{
m_key_LOCK_index= key_LOCK_index;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index dfe2c88e975..a94ffa900eb 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -9180,10 +9180,10 @@ PSI_stage_info stage_invalidating_query_cache_entries_table= { 0, "Invalidating
PSI_stage_info stage_invalidating_query_cache_entries_table_list= { 0, "Invalidating query cache entries (table list)", 0};
PSI_stage_info stage_killing_slave= { 0, "Killing slave", 0};
PSI_stage_info stage_logging_slow_query= { 0, "Logging slow query", 0};
-PSI_stage_info stage_making_temp_file_append_before_load_data= { 0, "Making temporary file (append) before replaying LOAD DATA INFILE.", 0};
-PSI_stage_info stage_making_temp_file_create_before_load_data= { 0, "Making temporary file (create) before replaying LOAD DATA INFILE.", 0};
+PSI_stage_info stage_making_temp_file_append_before_load_data= { 0, "Making temporary file (append) before replaying LOAD DATA INFILE", 0};
+PSI_stage_info stage_making_temp_file_create_before_load_data= { 0, "Making temporary file (create) before replaying LOAD DATA INFILE", 0};
PSI_stage_info stage_manage_keys= { 0, "Manage keys", 0};
-PSI_stage_info stage_master_has_sent_all_binlog_to_slave= { 0, "Master has sent all binlog to slave; waiting for binlog to be updated", 0};
+PSI_stage_info stage_master_has_sent_all_binlog_to_slave= { 0, "Master has sent all binlog to slave; waiting for more updates", 0};
PSI_stage_info stage_opening_tables= { 0, "Opening tables", 0};
PSI_stage_info stage_optimizing= { 0, "Optimizing", 0};
PSI_stage_info stage_preparing= { 0, "Preparing", 0};
@@ -9210,7 +9210,7 @@ PSI_stage_info stage_sending_cached_result_to_client= { 0, "Sending cached resul
PSI_stage_info stage_sending_data= { 0, "Sending data", 0};
PSI_stage_info stage_setup= { 0, "Setup", 0};
PSI_stage_info stage_show_explain= { 0, "Show explain", 0};
-PSI_stage_info stage_slave_has_read_all_relay_log= { 0, "Slave has read all relay log; waiting for the slave I/O thread to update it", 0};
+PSI_stage_info stage_slave_has_read_all_relay_log= { 0, "Slave has read all relay log; waiting for more updates", 0};
PSI_stage_info stage_sorting= { 0, "Sorting", 0};
PSI_stage_info stage_sorting_for_group= { 0, "Sorting for group", 0};
PSI_stage_info stage_sorting_for_order= { 0, "Sorting for order", 0};
@@ -9258,7 +9258,7 @@ PSI_stage_info stage_binlog_processing_checkpoint_notify= { 0, "Processing binlo
PSI_stage_info stage_binlog_stopping_background_thread= { 0, "Stopping binlog background thread", 0};
PSI_stage_info stage_waiting_for_work_from_sql_thread= { 0, "Waiting for work from SQL thread", 0};
PSI_stage_info stage_waiting_for_prior_transaction_to_commit= { 0, "Waiting for prior transaction to commit", 0};
-PSI_stage_info stage_waiting_for_prior_transaction_to_start_commit= { 0, "Waiting for prior transaction to start commit before starting next transaction", 0};
+PSI_stage_info stage_waiting_for_prior_transaction_to_start_commit= { 0, "Waiting for prior transaction to start commit", 0};
PSI_stage_info stage_waiting_for_room_in_worker_thread= { 0, "Waiting for room in worker thread event queue", 0};
PSI_stage_info stage_waiting_for_workers_idle= { 0, "Waiting for worker threads to be idle", 0};
PSI_stage_info stage_waiting_for_ftwrl= { 0, "Waiting due to global read lock", 0};
@@ -9266,7 +9266,7 @@ PSI_stage_info stage_waiting_for_ftwrl_threads_to_pause= { 0, "Waiting for worke
PSI_stage_info stage_waiting_for_rpl_thread_pool= { 0, "Waiting while replication worker thread pool is busy", 0};
PSI_stage_info stage_master_gtid_wait_primary= { 0, "Waiting in MASTER_GTID_WAIT() (primary waiter)", 0};
PSI_stage_info stage_master_gtid_wait= { 0, "Waiting in MASTER_GTID_WAIT()", 0};
-PSI_stage_info stage_gtid_wait_other_connection= { 0, "Waiting for other master connection to process GTID received on multiple master connections", 0};
+PSI_stage_info stage_gtid_wait_other_connection= { 0, "Waiting for other master connection to process the same GTID", 0};
PSI_stage_info stage_slave_background_process_request= { 0, "Processing requests", 0};
PSI_stage_info stage_slave_background_wait_request= { 0, "Waiting for requests", 0};
PSI_stage_info stage_waiting_for_deadlock_kill= { 0, "Waiting for parallel replication deadlock handling to complete", 0};
diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h
index 167d7461a7e..523af4856ae 100644
--- a/sql/rpl_gtid.h
+++ b/sql/rpl_gtid.h
@@ -27,6 +27,8 @@ extern const LEX_CSTRING rpl_gtid_slave_state_table_name;
class String;
+#define GTID_MAX_STR_LENGTH (10+1+10+1+20)
+
struct rpl_gtid
{
uint32 domain_id;
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 43a02147496..f3c87517f21 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -1570,6 +1570,8 @@ uint any_slave_sql_running(bool already_locked)
if (!already_locked)
mysql_mutex_lock(&LOCK_active_mi);
+ else
+ mysql_mutex_assert_owner(&LOCK_active_mi);
if (unlikely(abort_loop || !master_info_index))
count= 1;
else
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index c15465f105e..04595a6f32f 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -3444,7 +3444,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
thd->mdl_context.release_statement_locks();
}
}
- //TODO: why is this here if log_slow_query is in sp_instr_stmt_execute?
+ //TODO: why is this here if log_slow_query is in sp_instr_stmt::execute?
delete_explain_query(m_lex);
if (m_lex->query_tables_own_last)
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index aeb05f27b30..c713f40cdf3 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -68,6 +68,15 @@ const uint max_hostname_length= 60;
const uint max_dbname_length= 64;
#endif
+const char *safe_vio_type_name(Vio *vio)
+{
+ int unused;
+#ifdef EMBEDDED_LIBRARY
+ if (!vio) return "Internal";
+#endif
+ return vio_type_name(vio_type(vio), &unused);
+}
+
#include "sql_acl_getsort.ic"
static LEX_CSTRING native_password_plugin_name= {
@@ -13994,17 +14003,9 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
*/
if (sctx->user)
{
- if (strcmp(sctx->priv_user, sctx->user))
- {
- general_log_print(thd, command, "%s@%s as %s on %s",
- sctx->user, sctx->host_or_ip,
- sctx->priv_user[0] ? sctx->priv_user : "anonymous",
- safe_str(mpvio.db.str));
- }
- else
- general_log_print(thd, command, (char*) "%s@%s on %s",
- sctx->user, sctx->host_or_ip,
- safe_str(mpvio.db.str));
+ general_log_print(thd, command, (char*) "%s@%s on %s using %s",
+ sctx->user, sctx->host_or_ip,
+ safe_str(mpvio.db.str), safe_vio_type_name(thd->net.vio));
}
if (res > CR_OK && mpvio.status != MPVIO_EXT::SUCCESS)
diff --git a/sql/sql_array.h b/sql/sql_array.h
index 44dde114d62..70aeaabc8ec 100644
--- a/sql/sql_array.h
+++ b/sql/sql_array.h
@@ -170,6 +170,11 @@ public:
return ((const Elem*)array.buffer) + array.elements - 1;
}
+ const Elem *end() const
+ {
+ return back() + 1;
+ }
+
/// @returns pointer to n-th element
Elem *get_pos(size_t idx)
{
@@ -182,7 +187,6 @@ public:
return ((const Elem*)array.buffer) + idx;
}
-
/**
@retval false ok
@retval true OOM, @c my_error() has been called.
@@ -240,10 +244,16 @@ public:
freeze_size(&array);
}
+ bool reserve(size_t new_size)
+ {
+ return allocate_dynamic(&array, (uint)new_size);
+ }
+
+
bool resize(size_t new_size, Elem default_val)
{
size_t old_size= elements();
- if (unlikely(allocate_dynamic(&array, (uint)new_size)))
+ if (reserve(new_size))
return true;
if (new_size > old_size)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ccf4a18a91f..f48edc8c180 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13495,8 +13495,7 @@ bool JOIN_TAB::preread_init()
if ((!derived->get_unit()->executed ||
derived->is_recursive_with_table() ||
derived->get_unit()->uncacheable) &&
- mysql_handle_single_derived(join->thd->lex,
- derived, DT_CREATE | DT_FILL))
+ mysql_handle_single_derived(join->thd->lex, derived, DT_CREATE | DT_FILL))
return TRUE;
if (!(derived->get_unit()->uncacheable & UNCACHEABLE_DEPENDENT) ||
diff --git a/sql/sql_select.h b/sql/sql_select.h
index e3501fb98c6..616d4769e2f 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -247,13 +247,13 @@ class SplM_opt_info;
typedef struct st_join_table {
TABLE *table;
TABLE_LIST *tab_list;
- KEYUSE *keyuse; /**< pointer to first used key */
+ KEYUSE *keyuse; /**< pointer to first used key */
KEY *hj_key; /**< descriptor of the used best hash join key
- not supported by any index */
+ not supported by any index */
SQL_SELECT *select;
COND *select_cond;
COND *on_precond; /**< part of on condition to check before
- accessing the first inner table */
+ accessing the first inner table */
QUICK_SELECT_I *quick;
/*
The value of select_cond before we've attempted to do Index Condition
diff --git a/sql/table.cc b/sql/table.cc
index 718efa5767c..8f5f5614cd8 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -273,7 +273,7 @@ TABLE_CATEGORY get_table_category(const LEX_CSTRING *db,
if (is_infoschema_db(db))
return TABLE_CATEGORY_INFORMATION;
- if (lex_string_eq(&PERFORMANCE_SCHEMA_DB_NAME, db))
+ if (is_perfschema_db(db))
return TABLE_CATEGORY_PERFORMANCE;
if (lex_string_eq(&MYSQL_SCHEMA_NAME, db))
diff --git a/sql/table.h b/sql/table.h
index 6ce92ee048e..416490a80a9 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -3060,9 +3060,12 @@ extern LEX_CSTRING MYSQL_PROC_NAME;
inline bool is_infoschema_db(const LEX_CSTRING *name)
{
- return (INFORMATION_SCHEMA_NAME.length == name->length &&
- !my_strcasecmp(system_charset_info,
- INFORMATION_SCHEMA_NAME.str, name->str));
+ return lex_string_eq(&INFORMATION_SCHEMA_NAME, name);
+}
+
+inline bool is_perfschema_db(const LEX_CSTRING *name)
+{
+ return lex_string_eq(&PERFORMANCE_SCHEMA_DB_NAME, name);
}
inline void mark_as_null_row(TABLE *table)
diff --git a/sql/transaction.cc b/sql/transaction.cc
index f0426b1fcc4..330baaf3fc7 100644
--- a/sql/transaction.cc
+++ b/sql/transaction.cc
@@ -245,18 +245,12 @@ bool trans_commit(THD *thd)
if res is non-zero, then ha_commit_trans has rolled back the
transaction, so the hooks for rollback will be called.
*/
- if (res)
- {
#ifdef HAVE_REPLICATION
+ if (res)
repl_semisync_master.wait_after_rollback(thd, FALSE);
-#endif
- }
else
- {
-#ifdef HAVE_REPLICATION
repl_semisync_master.wait_after_commit(thd, FALSE);
#endif
- }
thd->variables.option_bits&= ~(OPTION_BEGIN | OPTION_KEEP_LOG);
thd->transaction.all.reset();
thd->lex->start_transaction_opt= 0;
diff --git a/sql/xa.cc b/sql/xa.cc
index e0ae0caa1a2..efcb3ea5c00 100644
--- a/sql/xa.cc
+++ b/sql/xa.cc
@@ -22,7 +22,7 @@
/***************************************************************************
- Handling of XA id cacheing
+ Handling of XA id caching
***************************************************************************/
enum xa_states { XA_ACTIVE= 0, XA_IDLE, XA_PREPARED, XA_ROLLBACK_ONLY };