Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions sql/auth/sha2_password.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1126,8 +1126,7 @@ static int caching_sha2_password_authenticate(MYSQL_PLUGIN_VIO *vio,
*/

int caching_sha2_password_generate(char *outbuf, unsigned int *buflen,
const char *inbuf,
unsigned int inbuflen) {
const char *inbuf, unsigned int inbuflen) {
DBUG_TRACE;
std::string digest;
const std::string source(inbuf, inbuflen);
Expand Down
2 changes: 1 addition & 1 deletion sql/auth/sql_authentication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4578,7 +4578,7 @@ int acl_authenticate(THD *thd, enum_server_command command) {
ret = 0;
end:
if (mpvio.restrictions) mpvio.restrictions->~Restrictions();
/* Ready to handle queries */
/* Ready to handle queries */
#ifdef HAVE_PSI_THREAD_INTERFACE
LEX_CSTRING main_sctx_user = thd->m_main_security_ctx.user();
LEX_CSTRING main_sctx_host_or_ip = thd->m_main_security_ctx.host_or_ip();
Expand Down
2 changes: 1 addition & 1 deletion sql/auth/sql_authentication.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#ifndef SQL_AUTHENTICATION_INCLUDED
#define SQL_AUTHENTICATION_INCLUDED

#include <map>
#include <openssl/rsa.h>
#include <stddef.h>
#include <sys/types.h>
#include <map>
#include <vector>

#include "lex_string.h"
Expand Down
6 changes: 3 additions & 3 deletions sql/auth/sql_authorization.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4816,9 +4816,9 @@ void get_privilege_access_maps(
boost::vector_property_map<boost::default_color_type> v_color(
boost::num_vertices(*g_granted_roles));

const Get_access_maps vis(acl_user, access, db_map, db_wild_map, table_map, sp_map,
func_map, with_admin_acl, dynamic_acl, &restrictions,
effective_grants);
const Get_access_maps vis(acl_user, access, db_map, db_wild_map, table_map,
sp_map, func_map, with_admin_acl, dynamic_acl,
&restrictions, effective_grants);
if (has_granted_roles || mandatory_roles.size() > 0) {
bool acl_user_has_vertex = (user_vertex_it != g_authid_to_vertex->end());
if (!acl_user_has_vertex) return;
Expand Down
27 changes: 14 additions & 13 deletions sql/auth/sql_user.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2125,11 +2125,12 @@ bool change_password(THD *thd, LEX_USER *lex_user, const char *new_password,
return true;
}

/* trying to change the password of the utility user? */
if (acl_is_utility_user(acl_user->user, acl_user->host.get_host(), nullptr)) {
my_error(ER_PASSWORD_NO_MATCH, MYF(0));
return true;
}
/* trying to change the password of the utility user? */
if (acl_is_utility_user(acl_user->user, acl_user->host.get_host(),
nullptr)) {
my_error(ER_PASSWORD_NO_MATCH, MYF(0));
return true;
}

assert(acl_user->plugin.length != 0);
is_role = acl_user->is_role;
Expand Down Expand Up @@ -2510,10 +2511,10 @@ static int handle_grant_data(THD *thd, Table_ref *tables, bool drop,
if (acl_utility_user.user) {
if (user_from && acl_is_utility_user(user_from->user.str,
user_from->host.str, nullptr)) {
return -1;
return -1;
} else if (user_to && acl_is_utility_user(user_to->user.str,
user_to->host.str, nullptr)) {
return -1;
return -1;
}
}

Expand Down Expand Up @@ -2858,12 +2859,12 @@ bool mysql_create_user(THD *thd, List<LEX_USER> &list, bool if_not_exists,
return true;
}
while ((tmp_user_name = user_list++)) {
if (acl_is_utility_user(tmp_user_name->user.str, tmp_user_name->host.str,
nullptr)) {
log_user(thd, &wrong_users, tmp_user_name, wrong_users.length() > 0);
result = true;
continue;
}
if (acl_is_utility_user(tmp_user_name->user.str, tmp_user_name->host.str,
nullptr)) {
log_user(thd, &wrong_users, tmp_user_name, wrong_users.length() > 0);
result = true;
continue;
}
bool history_check_done = false;
I_multi_factor_auth *mfa = nullptr;
/*
Expand Down
3 changes: 1 addition & 2 deletions sql/basic_ostream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ bool IO_CACHE_ostream::truncate(my_off_t offset) {

if (my_chsize(m_io_cache.file, offset, 0, MYF(MY_WME))) return true;

[[maybe_unused]]
const auto reinit_res =
[[maybe_unused]] const auto reinit_res =
reinit_io_cache(&m_io_cache, WRITE_CACHE, offset, false, true);
assert(reinit_res == 0);
return false;
Expand Down
4 changes: 2 additions & 2 deletions sql/dd/impl/dictionary_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
#include "sql/sql_class.h" // THD
#include "sql/sql_zip_dict.h"
#include "sql/system_variables.h"
#include "sql/thd_raii.h" // Disable_autocommit_guard, Disable_binlog_guard
#include "sql/transaction.h" // trans_commit()
#include "sql/thd_raii.h" // Disable_autocommit_guard, Disable_binlog_guard
#include "sql/transaction.h" // trans_commit()
#include "storage/perfschema/pfs_dd_version.h" // PFS_DD_VERSION

extern Cost_constant_cache *cost_constant_cache; // defined in
Expand Down
4 changes: 2 additions & 2 deletions sql/dd/impl/types/index_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class Sdi_wcontext;
class Table;

static const std::set<String_type> default_valid_option_keys = {
"block_size", "flags", "parser_name","gipk" /* generated implicit primary key */,
"clustering_key"};
"block_size", "flags", "parser_name",
"gipk" /* generated implicit primary key */, "clustering_key"};

///////////////////////////////////////////////////////////////////////////
// Index_impl implementation.
Expand Down
3 changes: 1 addition & 2 deletions sql/dd/impl/upgrade/dd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
#include "sql/dd/impl/tables/tables.h" // dd::tables::Tables
#include "sql/dd/impl/tables/tablespaces.h" // dd::tables::Tablespaces
#include "sql/dd/impl/tables/triggers.h" // dd::tables::Triggers
#include "sql/dd/impl/upgrade/server.h" // Routine_event_context_guard
#include "sql/dd/object_id.h"
#include "sql/dd/types/object_table.h" // dd::Object_table
#include "sql/dd/types/object_table_definition.h" // dd::Object_table_definition
#include "sql/dd/types/schema.h"
#include "sql/dd/impl/upgrade/server.h" // Routine_event_context_guard
#include "sql/sd_notify.h" // sysd::notify
#include "sql/sql_class.h" // THD
#include "sql/table.h" // MYSQL_SCHEMA_NAME
Expand Down Expand Up @@ -895,7 +895,6 @@ bool migrate_meta_data(THD *thd, const std::set<String_type> &create_set,
<< MYSQL_SCHEMA_NAME.str << "." << (*it);
if (dd::execute_query(thd, ss.str().c_str()))
return dd::end_transaction(thd, true);

}
}

Expand Down
11 changes: 7 additions & 4 deletions sql/dd/impl/upgrade/server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ Upgrade_error_counter Upgrade_error_counter::operator--(int) {
namespace {

static std::vector<uint> ignored_errors{
ER_DUP_FIELDNAME, ER_DUP_KEYNAME, ER_BAD_FIELD_ERROR,
ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2, ER_DUP_ENTRY, ER_NO_SUCH_TABLE};
ER_DUP_FIELDNAME, ER_DUP_KEYNAME,
ER_BAD_FIELD_ERROR, ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE_V2,
ER_DUP_ENTRY, ER_NO_SUCH_TABLE};

template <typename T>
class Server_option_guard {
Expand Down Expand Up @@ -1525,7 +1526,8 @@ static const char *percona_telemetry_install[] = {
"THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED','N',"
"CURRENT_TIMESTAMP,NULL,'Y', 'N', 'N', NULL, NULL, NULL, NULL);\n",
"UPDATE mysql.user SET Select_priv = 'Y', Repl_slave_priv = 'Y', "
"Repl_client_priv = 'Y' WHERE User = 'percona.telemetry' AND Host = 'localhost';\n",
"Repl_client_priv = 'Y' WHERE User = 'percona.telemetry' AND Host = "
"'localhost';\n",
"UPDATE mysql.user SET Shutdown_priv = 'N', Super_priv = 'N', "
"Create_role_priv = 'N', Drop_role_priv = 'N' WHERE User = "
"'percona.telemetry' AND Host = 'localhost';\n",
Expand All @@ -1535,7 +1537,8 @@ static const char *percona_telemetry_uninstall[] = {
"USE mysql;\n",
"DELETE FROM mysql.component WHERE "
"component_urn=\"file://component_percona_telemetry\"\n;",
"DELETE FROM mysql.user WHERE user='percona.telemetry' AND Host = 'localhost';\n",
"DELETE FROM mysql.user WHERE user='percona.telemetry' AND Host = "
"'localhost';\n",
NULL};

/**
Expand Down
4 changes: 2 additions & 2 deletions sql/dd/types/init_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

/// Mode for initializing the data dictionary.
enum dict_init_mode_t {
DICT_INIT_CREATE_FILES, ///< Create all required SE files
DICT_INIT_CHECK_FILES, ///< Verify existence of expected files
DICT_INIT_CREATE_FILES, ///< Create all required SE files
DICT_INIT_CHECK_FILES, ///< Verify existence of expected files
};

#endif // DD_INIT_MODE_T_H_INCLUDED
4 changes: 2 additions & 2 deletions sql/event_parse_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ void Event_parse_data::check_originator_id(THD *thd) {
to_string(name));
if ((status == Event_parse_data::ENABLED && !event_needs_reenable) ||
(status == Event_parse_data::DISABLED)) {
DBUG_PRINT(
"info", ("Invoked object status set to REPLICA_SIDE_DISABLED."));
DBUG_PRINT("info",
("Invoked object status set to REPLICA_SIDE_DISABLED."));
status = Event_parse_data::REPLICA_SIDE_DISABLED;
status_changed = true;
}
Expand Down
2 changes: 1 addition & 1 deletion sql/field.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
#include "sql/mysqld_cs.h"
#include "sql/protocol.h"
#include "sql/psi_memory_key.h"
#include "sql/spatial.h" // Geometry
#include "sql/spatial.h" // Geometry
#include "sql/sql_base.h"
#include "sql/sql_class.h" // THD
#include "sql/sql_exception_handler.h" // handle_std_exception
Expand Down
19 changes: 9 additions & 10 deletions sql/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
#include "sql/sql_select.h" // actual_key_parts
#include "sql/sql_table.h" // build_table_filename
#include "sql/sql_zip_dict.h"
#include "sql/strfunc.h" // strnncmp_nopads
#include "sql/strfunc.h" // strnncmp_nopads
#include "sql/system_variables.h"
#include "sql/table.h"
#include "sql/tc_log.h"
Expand Down Expand Up @@ -2507,7 +2507,8 @@ static int ha_clone_consistent_snapshot(THD *thd) {

{
Find_thd_with_id find_thd_with_id(id, true);
from_thd_ptr = Global_THD_manager::get_instance()->find_thd(&find_thd_with_id);
from_thd_ptr =
Global_THD_manager::get_instance()->find_thd(&find_thd_with_id);

if (!from_thd_ptr) {
my_error(ER_NO_SUCH_THREAD, MYF(0), id);
Expand Down Expand Up @@ -3629,9 +3630,9 @@ bool handler::is_using_full_key(key_part_map keypart_map,
(keypart_map == ((key_part_map(1) << actual_key_parts) - 1));
}

bool handler::is_using_full_unique_key(uint index, key_part_map keypart_map,
enum ha_rkey_function find_flag) const
noexcept {
bool handler::is_using_full_unique_key(
uint index, key_part_map keypart_map,
enum ha_rkey_function find_flag) const noexcept {
return (
is_using_full_key(keypart_map, table->key_info[index].actual_key_parts) &&
find_flag == HA_READ_KEY_EXACT &&
Expand Down Expand Up @@ -8434,8 +8435,7 @@ int handler::ha_write_row(uchar *buf) {

DBUG_TRACE;
DEBUG_SYNC(ha_thd(), "start_ha_write_row");
DBUG_EXECUTE_IF("inject_error_ha_write_row",
return HA_ERR_INTERNAL_ERROR;);
DBUG_EXECUTE_IF("inject_error_ha_write_row", return HA_ERR_INTERNAL_ERROR;);
DBUG_EXECUTE_IF("simulate_storage_engine_out_of_memory",
return HA_ERR_SE_OUT_OF_MEMORY;);
mark_trx_read_write();
Expand Down Expand Up @@ -8714,9 +8714,8 @@ static void copy_blob_data(const TABLE *table, const MY_BITMAP *const fields,
}
}

bool handler::is_using_prohibited_gap_locks(TABLE *table,
bool using_full_primary_key) const
noexcept {
bool handler::is_using_prohibited_gap_locks(
TABLE *table, bool using_full_primary_key) const noexcept {
const THD *thd = table->in_use;
const thr_lock_type lock_type = table->reginfo.lock_type;

Expand Down
26 changes: 13 additions & 13 deletions sql/handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -6776,16 +6776,16 @@ class handler {
for details.
*/
[[nodiscard]] int ha_fast_update(THD *thd,
mem_root_deque<Item *> &update_fields,
mem_root_deque<Item *> &update_values,
Item *conds);
mem_root_deque<Item *> &update_fields,
mem_root_deque<Item *> &update_values,
Item *conds);

/**
@brief Offload an upsert to the storage engine. See handler::upsert()
for details.
*/
[[nodiscard]] int ha_upsert(THD *thd, mem_root_deque<Item *> &update_fields,
mem_root_deque<Item *> &update_values);
mem_root_deque<Item *> &update_values);

private:
/**
Expand All @@ -6808,11 +6808,11 @@ class handler {
handler::ha_update_row(...) does not accept conditions.
*/
[[nodiscard]] virtual int fast_update(THD *thd [[maybe_unused]],
mem_root_deque<Item *> &update_fields
[[maybe_unused]],
mem_root_deque<Item *> &update_values
[[maybe_unused]],
Item *conds [[maybe_unused]]) {
mem_root_deque<Item *> &update_fields
[[maybe_unused]],
mem_root_deque<Item *> &update_values
[[maybe_unused]],
Item *conds [[maybe_unused]]) {
return ENOTSUP;
}

Expand All @@ -6833,10 +6833,10 @@ class handler {
@return an error if the insert should be terminated.
*/
[[nodiscard]] virtual int upsert(THD *thd [[maybe_unused]],
mem_root_deque<Item *> &update_fields
[[maybe_unused]],
mem_root_deque<Item *> &update_values
[[maybe_unused]]) {
mem_root_deque<Item *> &update_fields
[[maybe_unused]],
mem_root_deque<Item *> &update_values
[[maybe_unused]]) {
return ENOTSUP;
}

Expand Down
2 changes: 1 addition & 1 deletion sql/item_func.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8742,7 +8742,7 @@ static bool check_table_and_trigger_access(Item **args, bool check_trigger_acl,
// Don't show compression dictionary tables in "SHOW TABLES"
if (compression_dict::is_hardcoded(dd::String_type(sch_name),
dd::String_type(tbl_name))) {
return false;
return false;
}

// Skip INFORMATION_SCHEMA database
Expand Down
12 changes: 7 additions & 5 deletions sql/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,8 @@ static void copy_global_to_session(THD *thd, ulong flag, const Val *val) {
std::is_unsigned<Val>::value,
"Check value type passed to copy_global_to_session template");

const ptrdiff_t offset = ((const char *)val - (const char *)&global_system_variables);
const ptrdiff_t offset =
((const char *)val - (const char *)&global_system_variables);
if (opt_slow_query_log_use_global_control & (1ULL << flag))
*(Val *)((char *)&thd->variables + offset) = *val;
}
Expand Down Expand Up @@ -2014,7 +2015,8 @@ bool log_slow_applicable(THD *thd, int sp_sql_command) {
opt_log_queries_not_using_indexes &&
!(sql_command_flags[thd->lex->sql_command] & CF_STATUS_COMMAND));
const bool log_this_query =
((thd->server_status & SERVER_QUERY_WAS_SLOW) || warn_no_index || warn_failed_query) &&
((thd->server_status & SERVER_QUERY_WAS_SLOW) || warn_no_index ||
warn_failed_query) &&
(thd->get_examined_row_count() >= thd->variables.min_examined_row_limit);

// The docs say slow queries must be counted even when the log is off.
Expand Down Expand Up @@ -2050,7 +2052,7 @@ bool log_slow_applicable(THD *thd, int sp_sql_command) {
/* Follow the slow log filter configuration. */
if (thd->variables.log_slow_filter != 0 &&
!(thd->variables.log_slow_filter & thd->query_plan_flags))
return false;
return false;

/*
Don't log the CALL statement if slow statements logging
Expand Down Expand Up @@ -2079,15 +2081,15 @@ bool log_slow_applicable(THD *thd, int sp_sql_command) {
query_exec_time < slow_query_log_always_write_time &&
(thd->variables.long_query_time >= 1000000 ||
(ulong)query_exec_time < 1000000)) {
return false;
return false;
}
if (opt_slow_query_log_rate_type == SLOG_RT_SESSION &&
thd->variables.log_slow_rate_limit &&
thd->thread_id() % thd->variables.log_slow_rate_limit &&
query_exec_time < slow_query_log_always_write_time &&
(thd->variables.long_query_time >= 1000000 ||
(ulong)query_exec_time < 1000000)) {
return false;
return false;
}

const bool suppress_logging =
Expand Down
Loading
Loading