From 6fc41676d94570496650145b701888cd615b3e0a Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 5 Oct 2026 16:59:58 +0200 Subject: [PATCH] PS-11624 [trunk] clang-format Percona-modified sources https://perconadev.atlassian.net/browse/PS-11624 No functional change. Apply the repository .clang-format with clang-format 15, the version it names ("We currently use clang-format version 15."), to every C/C++ file that Percona added or modified relative to mysql-26.7.0. Upstream code in these files was already clang-format 15 clean, so only Percona-introduced formatting changes. storage/innobase/fts/fts0pars.cc is left as is: it is bison-generated and upstream does not format it. (cherry picked from commit 1ce3047b109cd81142593099d7746635c82141af) --- client/mysqldump.cc | 2 +- components/audit_log_filter/audit_keyring.cc | 2 +- .../log_record_formatter/json.cc | 13 +- components/audit_log_filter/log_writer.cc | 2 +- .../audit_log_filter/log_writer/file.cc | 2 +- .../log_writer/file_handle.cc | 4 +- .../log_writer/file_writer.cc | 2 +- components/audit_log_filter/sys_vars.cc | 2 +- .../binlog_utils_udf/binlog_utils_udf.cc | 2 +- components/encryption_udf/server_helpers.cc | 2 +- components/keyrings/common/data/data.h | 4 +- .../keyrings/keyring_file/keyring_file.cc | 3 +- .../keyring_load_service_definition.cc | 6 +- .../keyring_load_service_definition.cc | 6 +- .../keyring_load_service_definition.cc | 6 +- .../src/masking_functions/query_builder.cpp | 10 +- .../src/masking_functions/server_helpers.cpp | 2 +- .../src/masking_functions/sql_context.cpp | 2 +- components/percona_telemetry/data_provider.cc | 5 +- components/percona_udf/percona_udf.cc | 6 +- .../uuid_vx_udf/uuid_vx_udf_component.cc | 29 +++-- include/memory_debugging.h | 2 +- include/my_aes.h | 6 +- include/my_sys.h | 57 ++++----- include/mysqlpp/udf_registration.hpp | 2 +- include/mysqlpp/udf_wrappers.hpp | 2 +- plugin/connection_control/connection_delay.h | 2 +- plugin/fulltext/mecab_parser/plugin_mecab.cc | 4 +- plugin/thread_pool/src/thread_pool.cc | 14 ++- plugin/thread_pool/src/thread_pool.h | 2 +- .../tests/integration/test_routing_direct.cc | 15 ++- .../test_routing_sharing_restart.cc | 8 +- sql/auth/sql_authentication.cc | 7 +- sql/auth/sql_authentication.h | 2 +- sql/auth/sql_authorization.cc | 3 +- sql/auth/sql_user.cc | 15 +-- sql/binlog.cc | 1 - sql/create_field.cc | 7 +- sql/create_field.h | 3 +- sql/dd/impl/dictionary_impl.cc | 4 +- sql/dd/impl/system_registry.cc | 6 +- sql/dd/impl/types/column_impl.cc | 13 +- sql/dd/impl/upgrade/server.cc | 11 +- sql/dd/types/init_mode.h | 4 +- sql/event_parse_data.cc | 4 +- sql/field.cc | 2 +- sql/handler.cc | 19 ++- sql/handler.h | 29 ++--- sql/item_func.cc | 2 +- sql/log_event.cc | 112 +++++++++--------- sql/log_event.h | 2 +- sql/mysqld.cc | 10 +- sql/opt_statistics.cc | 6 +- sql/parse_tree_column_attrs.h | 5 +- sql/parse_tree_nodes.cc | 16 +-- sql/parse_tree_nodes.h | 3 +- sql/partition_info.h | 6 +- sql/partitioning/partition_base.cc | 5 +- sql/range_optimizer/index_range_scan_plan.cc | 3 +- sql/rpl_binlog_sender.cc | 2 +- sql/rpl_event_ctx.cc | 2 +- .../mysql_command_services_imp.cc | 3 +- sql/set_var.h | 4 +- sql/sql_alter.h | 7 +- sql/sql_base.cc | 13 +- sql/sql_class.cc | 9 +- sql/sql_class.h | 11 +- sql/sql_delete.cc | 4 +- sql/sql_parse.cc | 13 +- sql/sql_parse.h | 3 +- sql/sql_partition.cc | 8 +- sql/sql_partition.h | 8 +- sql/sql_planner.cc | 2 +- sql/sql_plugin.cc | 2 +- sql/sql_reload.cc | 5 +- sql/sql_union.cc | 5 +- sql/sql_zip_dict.cc | 16 +-- sql/sys_vars.h | 3 +- sql/table.cc | 1 - sql/tc_log.cc | 3 +- sql/threadpool_common.cc | 2 +- sql/threadpool_unix.cc | 2 +- sql/threadpool_win.cc | 6 +- sql/uniques.cc | 4 +- storage/blackhole/ha_blackhole.h | 4 +- storage/heap/hp_record.cc | 10 +- storage/heap/hp_rrnd.cc | 3 +- storage/heap/hp_rsame.cc | 3 +- storage/heap/hp_scan.cc | 2 +- storage/innobase/btr/btr0sea.cc | 6 +- storage/innobase/buf/buf0rea.cc | 6 +- storage/innobase/fsp/fsp0sysspace.cc | 4 +- storage/innobase/handler/ha_innodb.cc | 14 +-- storage/innobase/handler/ha_innodb.h | 8 +- storage/innobase/handler/ha_innopart.cc | 1 - storage/innobase/handler/ha_innopart.h | 1 - storage/innobase/include/btr0btr.ic | 8 +- storage/innobase/include/data0data.h | 4 +- storage/innobase/include/data0type.ic | 3 +- storage/innobase/include/dict0dict.h | 2 +- storage/innobase/include/fil0fil.h | 9 +- .../fil0innodb_tablespace_node_handle.h | 3 +- storage/innobase/include/fsp0fsp.h | 3 +- storage/innobase/include/ha_prototypes.h | 6 +- storage/innobase/include/os0file.h | 6 +- storage/innobase/include/os0thread.h | 3 +- storage/innobase/include/row0log.h | 15 ++- storage/innobase/include/row0vers.h | 26 ++-- storage/innobase/include/srv0srv.h | 3 +- storage/innobase/include/trx0trx.h | 13 +- storage/innobase/include/ut0mutex.ic | 20 ++-- storage/innobase/os/os0file.cc | 13 +- storage/innobase/os/os0thread.cc | 5 +- storage/innobase/rem/rec.cc | 2 +- storage/innobase/row/row0log.cc | 6 +- storage/innobase/row/row0purge.cc | 8 +- storage/innobase/row/row0umod.cc | 3 +- storage/innobase/srv/srv0start.cc | 14 +-- storage/innobase/srv/srv0tmp.cc | 3 +- storage/myisam/myisamchk.cc | 3 +- storage/rocksdb/ha_rocksdb.cc | 71 +++++------ storage/rocksdb/ib_ut0counter.h | 2 +- storage/rocksdb/rdb_cf_options.h | 2 +- storage/rocksdb/rdb_datadic.cc | 38 +++--- storage/rocksdb/rdb_index_merge.h | 2 +- storage/rocksdb/rdb_iterator.cc | 9 +- storage/rocksdb/rdb_mutex_wrapper.h | 1 - storage/rocksdb/rdb_psi.cc | 4 +- storage/rocksdb/rdb_psi.h | 3 +- .../percona_telemetry/data_provider-t.cc | 20 ++-- unittest/gunit/mock_create_field.h | 20 ++-- utilities/innochecksum.cc | 3 +- 132 files changed, 519 insertions(+), 563 deletions(-) diff --git a/client/mysqldump.cc b/client/mysqldump.cc index d4539dc50024..1d5ef6433dda 100644 --- a/client/mysqldump.cc +++ b/client/mysqldump.cc @@ -1344,7 +1344,7 @@ static int get_options(int *argc, char ***argv) { exclude_user = new std::forward_list(); include_user = new collation_unordered_set(charset_info, PSI_NOT_INSTRUMENTED); - + processed_compression_dictionaries = new collation_unordered_set(charset_info, PSI_NOT_INSTRUMENTED); diff --git a/components/audit_log_filter/audit_keyring.cc b/components/audit_log_filter/audit_keyring.cc index 9085ec7cf2ff..ec6f4bedb0ea 100644 --- a/components/audit_log_filter/audit_keyring.cc +++ b/components/audit_log_filter/audit_keyring.cc @@ -15,7 +15,7 @@ #include "components/audit_log_filter/audit_keyring.h" -#define ALLOW_COMPONENT_INCLUDE // for plugin.h +#define ALLOW_COMPONENT_INCLUDE // for plugin.h #include "components/audit_log_filter/audit_error_log.h" #include "components/audit_log_filter/log_writer/file_handle.h" #include "components/audit_log_filter/sys_vars.h" diff --git a/components/audit_log_filter/log_record_formatter/json.cc b/components/audit_log_filter/log_record_formatter/json.cc index 2b5aa2f1f2c4..cf7e1fc86146 100644 --- a/components/audit_log_filter/log_record_formatter/json.cc +++ b/components/audit_log_filter/log_record_formatter/json.cc @@ -333,9 +333,10 @@ AuditRecordString LogRecordFormatterJson::apply( const auto esc_proxy_user = make_escaped_string(extra.proxy_user); const auto esc_command = make_escaped_string(extra.command); const auto esc_sql_command = make_escaped_string(extra.sql_command); - const auto esc_query = audit_record.extended_info.digest.empty() - ? make_escaped_string(extra.query) - : make_escaped_string(audit_record.extended_info.digest); + const auto esc_query = + audit_record.extended_info.digest.empty() + ? make_escaped_string(extra.query) + : make_escaped_string(audit_record.extended_info.digest); /* clang-format off */ if (SysVars::get_format_type() == AuditLogFormatType::Json) { @@ -392,8 +393,10 @@ AuditRecordString LogRecordFormatterJson::apply( const auto escaped_user = make_escaped_string(&audit_record.event->user); const auto escaped_host = make_escaped_string(&audit_record.event->host); const auto escaped_ip = make_escaped_string(&audit_record.event->ip); - const auto escaped_external_user = make_escaped_string(&audit_record.event->external_user); - const auto escaped_proxy_user = make_escaped_string(&audit_record.event->proxy_user); + const auto escaped_external_user = + make_escaped_string(&audit_record.event->external_user); + const auto escaped_proxy_user = + make_escaped_string(&audit_record.event->proxy_user); /* clang-format off */ if (SysVars::get_format_type() == AuditLogFormatType::Json) { diff --git a/components/audit_log_filter/log_writer.cc b/components/audit_log_filter/log_writer.cc index 9b737e683fc5..88c565f44a61 100644 --- a/components/audit_log_filter/log_writer.cc +++ b/components/audit_log_filter/log_writer.cc @@ -15,7 +15,7 @@ #include "components/audit_log_filter/log_writer.h" -#define ALLOW_COMPONENT_INCLUDE // for plugin.h +#define ALLOW_COMPONENT_INCLUDE // for plugin.h #include "log_record_formatter/base.h" #include "log_writer/file.h" #include "log_writer/file_writer_base.h" diff --git a/components/audit_log_filter/log_writer/file.cc b/components/audit_log_filter/log_writer/file.cc index 366fe5f99bc2..c057b8790160 100644 --- a/components/audit_log_filter/log_writer/file.cc +++ b/components/audit_log_filter/log_writer/file.cc @@ -13,7 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#define ALLOW_COMPONENT_INCLUDE // for plugin.h +#define ALLOW_COMPONENT_INCLUDE // for plugin.h #include "components/audit_log_filter/log_writer/file.h" #include "components/audit_log_filter/log_writer/file_writer.h" diff --git a/components/audit_log_filter/log_writer/file_handle.cc b/components/audit_log_filter/log_writer/file_handle.cc index c608cc9bc148..6e39e0cf04c6 100644 --- a/components/audit_log_filter/log_writer/file_handle.cc +++ b/components/audit_log_filter/log_writer/file_handle.cc @@ -13,7 +13,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#define ALLOW_COMPONENT_INCLUDE // for plugin.h +#define ALLOW_COMPONENT_INCLUDE // for plugin.h #include "components/audit_log_filter/log_writer/file_handle.h" #include "components/audit_log_filter/audit_error_log.h" #include "components/audit_log_filter/audit_psi_info.h" @@ -101,7 +101,7 @@ class FileHandleLockGuard { private: mysql_mutex_t *m_lock; }; -} +} // namespace #if defined(HAVE_PSI_INTERFACE) static PSI_mutex_key key_LOCK_audit_filter_service; diff --git a/components/audit_log_filter/log_writer/file_writer.cc b/components/audit_log_filter/log_writer/file_writer.cc index aa37fc917d75..1281beee7e2e 100644 --- a/components/audit_log_filter/log_writer/file_writer.cc +++ b/components/audit_log_filter/log_writer/file_writer.cc @@ -15,7 +15,7 @@ #include "file_writer.h" -#define ALLOW_COMPONENT_INCLUDE // for plugin.h +#define ALLOW_COMPONENT_INCLUDE // for plugin.h #include "file_handle.h" namespace audit_log_filter::log_writer { diff --git a/components/audit_log_filter/sys_vars.cc b/components/audit_log_filter/sys_vars.cc index effbdba9ea4c..696805984cd1 100644 --- a/components/audit_log_filter/sys_vars.cc +++ b/components/audit_log_filter/sys_vars.cc @@ -18,7 +18,7 @@ #include "components/audit_log_filter/audit_log_filter.h" #include "components/audit_log_filter/audit_log_reader.h" -#define ALLOW_COMPONENT_INCLUDE // for my_io.h and plugin.h +#define ALLOW_COMPONENT_INCLUDE // for my_io.h and plugin.h #include "sql/mysqld.h" #include "sql/sql_class.h" #include "sql/sql_error.h" diff --git a/components/binlog_utils_udf/binlog_utils_udf.cc b/components/binlog_utils_udf/binlog_utils_udf.cc index 2eedf1d41a22..995940c15804 100644 --- a/components/binlog_utils_udf/binlog_utils_udf.cc +++ b/components/binlog_utils_udf/binlog_utils_udf.cc @@ -31,7 +31,7 @@ #include #include -#define ALLOW_COMPONENT_INCLUDE // for my_io.h used by binlog includes +#define ALLOW_COMPONENT_INCLUDE // for my_io.h used by binlog includes #include #include #include diff --git a/components/encryption_udf/server_helpers.cc b/components/encryption_udf/server_helpers.cc index cd3362dfe425..c3c13827f027 100644 --- a/components/encryption_udf/server_helpers.cc +++ b/components/encryption_udf/server_helpers.cc @@ -16,7 +16,7 @@ #include "server_helpers.h" -#define ALLOW_COMPONENT_INCLUDE // for my_io.h +#define ALLOW_COMPONENT_INCLUDE // for my_io.h #include bool is_thd_killed(const THD *thd) noexcept { diff --git a/components/keyrings/common/data/data.h b/components/keyrings/common/data/data.h index a000ff2a93e1..26df19a370ed 100644 --- a/components/keyrings/common/data/data.h +++ b/components/keyrings/common/data/data.h @@ -64,9 +64,7 @@ struct Sensitive_data { std::size_t size() const { return data.size(); } std::size_t length() const { return data.size(); } - void mask() { - data.replace(0, data.size(), data.size(), '*'); - } + void mask() { data.replace(0, data.size(), data.size(), '*'); } pfs_string decode() const { auto ret = data; diff --git a/components/keyrings/keyring_file/keyring_file.cc b/components/keyrings/keyring_file/keyring_file.cc index ce6c24cf54da..634584be7624 100644 --- a/components/keyrings/keyring_file/keyring_file.cc +++ b/components/keyrings/keyring_file/keyring_file.cc @@ -325,8 +325,7 @@ REQUIRES_SERVICE_PLACEHOLDER(psi_memory_v2); BEGIN_COMPONENT_REQUIRES(component_keyring_file) REQUIRES_SERVICE(log_builtins), REQUIRES_SERVICE(log_builtins_string), REQUIRES_SERVICE(registry_registration), - REQUIRES_SERVICE(status_variable_registration), - REQUIRES_PSI_MEMORY_SERVICE, + REQUIRES_SERVICE(status_variable_registration), REQUIRES_PSI_MEMORY_SERVICE, END_COMPONENT_REQUIRES(); /** Component description */ diff --git a/components/keyrings/keyring_kmip/service_implementation/keyring_load_service_definition.cc b/components/keyrings/keyring_kmip/service_implementation/keyring_load_service_definition.cc index ddcf03db93f2..0da25ed9a896 100644 --- a/components/keyrings/keyring_kmip/service_implementation/keyring_load_service_definition.cc +++ b/components/keyrings/keyring_kmip/service_implementation/keyring_load_service_definition.cc @@ -38,13 +38,13 @@ DEFINE_BOOL_METHOD(Keyring_load_service_impl::load, try { if (set_paths(component_path, instance_path) == true) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Failed to set path to component"); + "Failed to set path to component"); return true; } if (init_or_reinit_keyring() == true) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Failed to initialize or reinitialize keyring "); + "Failed to initialize or reinitialize keyring "); return true; } g_keyring_kmip_inited = true; @@ -52,7 +52,7 @@ DEFINE_BOOL_METHOD(Keyring_load_service_impl::load, return false; } catch (...) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Got an exception while loading component"); + "Got an exception while loading component"); return true; } } diff --git a/components/keyrings/keyring_kms/service_implementation/keyring_load_service_definition.cc b/components/keyrings/keyring_kms/service_implementation/keyring_load_service_definition.cc index dded8e39c7a0..b737bf9cb810 100644 --- a/components/keyrings/keyring_kms/service_implementation/keyring_load_service_definition.cc +++ b/components/keyrings/keyring_kms/service_implementation/keyring_load_service_definition.cc @@ -39,13 +39,13 @@ DEFINE_BOOL_METHOD(Keyring_load_service_impl::load, try { if (set_paths(component_path, instance_path) == true) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Failed to set path to component"); + "Failed to set path to component"); return true; } if (init_or_reinit_keyring() == true) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Failed to initialize or reinitialize keyring"); + "Failed to initialize or reinitialize keyring"); return true; } g_keyring_kms_inited = true; @@ -53,7 +53,7 @@ DEFINE_BOOL_METHOD(Keyring_load_service_impl::load, return false; } catch (...) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Got an exception while loading component"); + "Got an exception while loading component"); return true; } } diff --git a/components/keyrings/keyring_vault/service_implementation/keyring_load_service_definition.cc b/components/keyrings/keyring_vault/service_implementation/keyring_load_service_definition.cc index efc2a81cae78..04cf0e396b87 100644 --- a/components/keyrings/keyring_vault/service_implementation/keyring_load_service_definition.cc +++ b/components/keyrings/keyring_vault/service_implementation/keyring_load_service_definition.cc @@ -37,13 +37,13 @@ DEFINE_BOOL_METHOD(Keyring_load_service_impl::load, try { if (set_paths(component_path, instance_path)) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Failed to set path to component"); + "Failed to set path to component"); return true; } if (init_or_reinit_keyring()) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Failed to initialize or reinitialize keyring"); + "Failed to initialize or reinitialize keyring"); return true; } @@ -52,7 +52,7 @@ DEFINE_BOOL_METHOD(Keyring_load_service_impl::load, return false; } catch (...) { LogComponentErr(ERROR_LEVEL, ER_KEYRING_COMPONENT_NOT_INITIALIZED, - "Got an exception while loading component"); + "Got an exception while loading component"); return true; } } diff --git a/components/masking_functions/src/masking_functions/query_builder.cpp b/components/masking_functions/src/masking_functions/query_builder.cpp index cde3787e93d6..271581d95d1d 100644 --- a/components/masking_functions/src/masking_functions/query_builder.cpp +++ b/components/masking_functions/src/masking_functions/query_builder.cpp @@ -39,10 +39,12 @@ std::string query_builder::select_all_from_dictionary() const { // the `mysql.masking_dictionaries` table must be in `utf8mb4`. So, by // adding CONVERT(Term USING utf8mb4) we support other character sets in // the underlying table as well. - oss << "SELECT " << "CONVERT(" << get_dictionary_field_name() << " USING " - << default_result_character_set << "), " << "CONVERT(" - << get_term_field_name() << " USING " << default_result_character_set - << ") FROM " << get_database_name() << '.' << get_table_name(); + oss << "SELECT " + << "CONVERT(" << get_dictionary_field_name() << " USING " + << default_result_character_set << "), " + << "CONVERT(" << get_term_field_name() << " USING " + << default_result_character_set << ") FROM " << get_database_name() << '.' + << get_table_name(); return oss.str(); } diff --git a/components/masking_functions/src/masking_functions/server_helpers.cpp b/components/masking_functions/src/masking_functions/server_helpers.cpp index 8e6e43afb9d8..b4af44157a0f 100644 --- a/components/masking_functions/src/masking_functions/server_helpers.cpp +++ b/components/masking_functions/src/masking_functions/server_helpers.cpp @@ -17,7 +17,7 @@ #include -#define ALLOW_COMPONENT_INCLUDE // for my_io.h +#define ALLOW_COMPONENT_INCLUDE // for my_io.h #include "sql/mysqld.h" #include "sql/sql_class.h" diff --git a/components/masking_functions/src/masking_functions/sql_context.cpp b/components/masking_functions/src/masking_functions/sql_context.cpp index db25b6f0bbe5..7a6ce056a2e9 100644 --- a/components/masking_functions/src/masking_functions/sql_context.cpp +++ b/components/masking_functions/src/masking_functions/sql_context.cpp @@ -24,7 +24,7 @@ #include #include -#include // MYSQL_ERRMSG_SIZE +#include // MYSQL_ERRMSG_SIZE #include #include "masking_functions/command_service_tuple.hpp" diff --git a/components/percona_telemetry/data_provider.cc b/components/percona_telemetry/data_provider.cc index b31b2431c1de..05845bdbf9ca 100644 --- a/components/percona_telemetry/data_provider.cc +++ b/components/percona_telemetry/data_provider.cc @@ -167,9 +167,8 @@ bool DataProvider::do_query(const std::string &query, QueryResult *result, is safe, because internally it checks if provided pointer is valid */ std::shared_ptr mysql_h_close_guard( - &mysql_h, [&srv = command_factory_service_](MYSQL_H *ptr) { - srv.close(*ptr); - }); + &mysql_h, + [&srv = command_factory_service_](MYSQL_H *ptr) { srv.close(*ptr); }); mysql_service_status_t sstatus = command_factory_service_.init(&mysql_h); diff --git a/components/percona_udf/percona_udf.cc b/components/percona_udf/percona_udf.cc index 590519858d4e..8a1f135d22bf 100644 --- a/components/percona_udf/percona_udf.cc +++ b/components/percona_udf/percona_udf.cc @@ -30,8 +30,10 @@ REQUIRES_SERVICE_PLACEHOLDER(udf_registration); -#define DECLARE_UDF_INFO_NO_DEINIT(NAME, TYPE) \ - mysqlpp::udf_info { #NAME, TYPE, (Udf_func_any)&NAME, &NAME##_init, nullptr } +#define DECLARE_UDF_INFO_NO_DEINIT(NAME, TYPE) \ + mysqlpp::udf_info { \ +#NAME, TYPE, (Udf_func_any)&NAME, &NAME##_init, nullptr \ + } static const std::array known_udfs{ DECLARE_UDF_INFO_NO_DEINIT(fnv_64, INT_RESULT), diff --git a/components/uuid_vx_udf/uuid_vx_udf_component.cc b/components/uuid_vx_udf/uuid_vx_udf_component.cc index 95199a96b133..6f7e4b01cf9f 100644 --- a/components/uuid_vx_udf/uuid_vx_udf_component.cc +++ b/components/uuid_vx_udf/uuid_vx_udf_component.cc @@ -36,11 +36,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include +#include #include #include #include -#include - #include @@ -54,7 +53,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include #include - // defined as a macro because needed both raw and stringized #define CURRENT_COMPONENT_NAME uuid_vx_udf #define CURRENT_COMPONENT_NAME_STR BOOST_PP_STRINGIZE(CURRENT_COMPONENT_NAME) @@ -158,7 +156,7 @@ class uuid_vx_version_impl { * - Returns 2 for "Microsoft Corporation backward compatibility" * - Returns 3 for future definitions */ -class uuid_vx_variant_impl { +class uuid_vx_variant_impl { public: explicit uuid_vx_variant_impl(mysqlpp::udf_context &ctx) { if (ctx.get_number_of_args() != 1) { @@ -173,7 +171,7 @@ class uuid_vx_variant_impl { ctx.set_arg_type(0, STRING_RESULT); mysqlpp::udf_context_charset_extension charset_ext{ mysql_service_mysql_udf_metadata}; - charset_ext.set_arg_value_charset(ctx, 0, uuid_charset); + charset_ext.set_arg_value_charset(ctx, 0, uuid_charset); } mysqlpp::udf_result_t calculate(const mysqlpp::udf_context &ctx) { @@ -781,7 +779,6 @@ class bin_to_uuid_vx_impl { } }; - /** * Helper class for timestamp extracting functions */ @@ -835,11 +832,12 @@ class timestamp_based_uuid { std::chrono::milliseconds{milliseconds}}; const auto in_time_t{std::chrono::system_clock::to_time_t(tm)}; - std::tm gm_time = {}; // temp for gmtime_r inside of c_time::gmtime + std::tm gm_time = {}; // temp for gmtime_r inside of c_time::gmtime std::ostringstream oss; - oss << std::put_time(boost::date_time::c_time::gmtime(&in_time_t, &gm_time), "%Y-%m-%d %H:%M:%S") << '.' - << std::setfill('0') << std::setw(3) << milliseconds % 1000; - + oss << std::put_time(boost::date_time::c_time::gmtime(&in_time_t, &gm_time), + "%Y-%m-%d %H:%M:%S") + << '.' << std::setfill('0') << std::setw(3) << milliseconds % 1000; + return oss.str(); } @@ -853,10 +851,11 @@ class timestamp_based_uuid { std::chrono::system_clock::time_point tm{ std::chrono::milliseconds{milliseconds}}; const auto in_time_t{std::chrono::system_clock::to_time_t(tm)}; - + std::ostringstream oss; - std::tm gm_time = {}; // temp for gmtime_r inside of c_time::gmtime - oss << std::put_time(boost::date_time::c_time::gmtime(&in_time_t, &gm_time), "%c %Z"); + std::tm gm_time = {}; // temp for gmtime_r inside of c_time::gmtime + oss << std::put_time(boost::date_time::c_time::gmtime(&in_time_t, &gm_time), + "%c %Z"); return oss.str(); } }; @@ -1014,7 +1013,7 @@ static const std::array known_udfs{ DECLARE_UDF_INFO_AUTO(uuid_vx_to_timestamp_tz), DECLARE_UDF_INFO_AUTO(uuid_vx_to_unixtime)}; -namespace { //anon namespace instead of using static keyword +namespace { // anon namespace instead of using static keyword using udf_bitset_type = mysqlpp::udf_bitset>; udf_bitset_type registered_udfs; @@ -1052,7 +1051,7 @@ mysql_service_status_t component_uuidx_udf_deinit() { registered_udfs); return registered_udfs.none() ? 0 : 1; } -} // namespace +} // namespace // clang-format off BEGIN_COMPONENT_PROVIDES(CURRENT_COMPONENT_NAME) diff --git a/include/memory_debugging.h b/include/memory_debugging.h index 6bcb3ded4c36..c75a961e9838 100644 --- a/include/memory_debugging.h +++ b/include/memory_debugging.h @@ -49,8 +49,8 @@ #elif defined(HAVE_ASAN) -#include #include +#include #define MEM_MALLOCLIKE_BLOCK(p1, p2, p3, p4) ASAN_UNPOISON_MEMORY_REGION(p1, p2) #define MEM_FREELIKE_BLOCK(p1, p2, p3, p4) ASAN_POISON_MEMORY_REGION(p1, p2) diff --git a/include/my_aes.h b/include/my_aes.h index 8a008b544f4c..bebf4f7d8f55 100644 --- a/include/my_aes.h +++ b/include/my_aes.h @@ -122,7 +122,8 @@ int my_aes_encrypt(EVP_CIPHER_CTX *ctx, const unsigned char *source, uint32 source_length, unsigned char *dest, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, const unsigned char *iv, - bool padding = true, std::vector *kdf_options = nullptr); + bool padding = true, + std::vector *kdf_options = nullptr); /** Decrypt an AES encrypted buffer @@ -167,7 +168,8 @@ int my_aes_decrypt(EVP_CIPHER_CTX *ctx, const unsigned char *source, uint32 source_length, unsigned char *dest, const unsigned char *key, uint32 key_length, enum my_aes_opmode mode, const unsigned char *iv, - bool padding = true, std::vector *kdf_options = nullptr); + bool padding = true, + std::vector *kdf_options = nullptr); /** Calculate the size of a buffer large enough for encrypted data. diff --git a/include/my_sys.h b/include/my_sys.h index 4add98ea1c26..9d02650e3d83 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -525,31 +525,26 @@ inline int my_b_get(IO_CACHE *info) { return _my_b_get(info); } -[[nodiscard]] -inline my_off_t my_b_tell(const IO_CACHE *info) { +[[nodiscard]] inline my_off_t my_b_tell(const IO_CACHE *info) { return info->pos_in_file + *info->current_pos - info->request_pos; } -[[nodiscard]] -inline uchar *my_b_get_buffer_start(const IO_CACHE *info) { +[[nodiscard]] inline uchar *my_b_get_buffer_start(const IO_CACHE *info) { return info->request_pos; } -[[nodiscard]] -inline size_t my_b_get_bytes_in_buffer(const IO_CACHE *info) { +[[nodiscard]] inline size_t my_b_get_bytes_in_buffer(const IO_CACHE *info) { return info->read_end - my_b_get_buffer_start(info); } -[[nodiscard]] -inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info) { +[[nodiscard]] inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info) { return info->pos_in_file; } /* tell write offset in the SEQ_APPEND cache */ int my_b_copy_to_file(IO_CACHE *cache, FILE *file); -[[nodiscard]] -inline size_t my_b_bytes_in_cache(const IO_CACHE *info) { +[[nodiscard]] inline size_t my_b_bytes_in_cache(const IO_CACHE *info) { return *info->current_end - *info->current_pos; } @@ -747,32 +742,32 @@ extern bool array_append_string_unique(const char *str, const char **array, void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos); my_off_t my_get_ptr(uchar *ptr, size_t pack_length); -[[nodiscard]] -extern int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize, - enum cache_type type, my_off_t seek_offset, - bool use_async_io, myf cache_myflags, - PSI_file_key file_key); -[[nodiscard]] -extern int init_io_cache(IO_CACHE *info, File file, size_t cachesize, - enum cache_type type, my_off_t seek_offset, - bool use_async_io, myf cache_myflags); -[[nodiscard]] -extern bool reinit_io_cache(IO_CACHE *info, enum cache_type type, - my_off_t seek_offset, bool use_async_io, - bool clear_cache); +[[nodiscard]] extern int init_io_cache_ext(IO_CACHE *info, File file, + size_t cachesize, + enum cache_type type, + my_off_t seek_offset, + bool use_async_io, myf cache_myflags, + PSI_file_key file_key); +[[nodiscard]] extern int init_io_cache(IO_CACHE *info, File file, + size_t cachesize, enum cache_type type, + my_off_t seek_offset, bool use_async_io, + myf cache_myflags); +[[nodiscard]] extern bool reinit_io_cache(IO_CACHE *info, enum cache_type type, + my_off_t seek_offset, + bool use_async_io, bool clear_cache); extern void setup_io_cache(IO_CACHE *info); -[[nodiscard]] -extern int _my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count); -[[nodiscard]] -extern int _my_b_read_r(IO_CACHE *info, uchar *Buffer, size_t Count); +[[nodiscard]] extern int _my_b_read(IO_CACHE *info, uchar *Buffer, + size_t Count); +[[nodiscard]] extern int _my_b_read_r(IO_CACHE *info, uchar *Buffer, + size_t Count); extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, IO_CACHE *write_cache, uint num_threads); extern void remove_io_thread(IO_CACHE *info); -[[nodiscard]] -extern int _my_b_seq_read(IO_CACHE *info, uchar *Buffer, size_t Count); +[[nodiscard]] extern int _my_b_seq_read(IO_CACHE *info, uchar *Buffer, + size_t Count); extern int _my_b_net_read(IO_CACHE *info, uchar *Buffer, size_t Count); -[[nodiscard]] -extern int _my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count); +[[nodiscard]] extern int _my_b_write(IO_CACHE *info, const uchar *Buffer, + size_t Count); extern int my_b_append(IO_CACHE *info, const uchar *Buffer, size_t Count); extern int my_b_safe_write(IO_CACHE *info, const uchar *Buffer, size_t Count); diff --git a/include/mysqlpp/udf_registration.hpp b/include/mysqlpp/udf_registration.hpp index 82e4cf903ae0..4e882a24ba30 100644 --- a/include/mysqlpp/udf_registration.hpp +++ b/include/mysqlpp/udf_registration.hpp @@ -131,7 +131,7 @@ void unregister_udfs(SERVICE_TYPE(udf_registration) * service, // NOLINTBEGIN(cppcoreguidelines-macro-usage) #define DECLARE_UDF_INFO(NAME, TYPE) \ mysqlpp::udf_info { \ - #NAME, TYPE, (Udf_func_any)std::addressof(NAME), \ +#NAME, TYPE, (Udf_func_any)std::addressof(NAME), \ std::addressof(NAME##_init), std::addressof(NAME##_deinit) \ } diff --git a/include/mysqlpp/udf_wrappers.hpp b/include/mysqlpp/udf_wrappers.hpp index a6e1ee96e92a..564ec3db2119 100644 --- a/include/mysqlpp/udf_wrappers.hpp +++ b/include/mysqlpp/udf_wrappers.hpp @@ -28,7 +28,7 @@ #include #include -#include // MYSQL_ERRMSG_SIZE +#include // MYSQL_ERRMSG_SIZE #include #include diff --git a/plugin/connection_control/connection_delay.h b/plugin/connection_control/connection_delay.h index 55900d9e99f0..12e8a82a5b58 100644 --- a/plugin/connection_control/connection_delay.h +++ b/plugin/connection_control/connection_delay.h @@ -35,7 +35,7 @@ #include "plugin/connection_control/connection_control_memory.h" /* Connection_control_alloc */ #include "plugin/connection_control/connection_delay_api.h" /* Constants */ #include "plugin/connection_control/log_rate_limiter.h" -#include "sql/table.h" /* Table_ref */ +#include "sql/table.h" /* Table_ref */ namespace connection_control { /** diff --git a/plugin/fulltext/mecab_parser/plugin_mecab.cc b/plugin/fulltext/mecab_parser/plugin_mecab.cc index afb49b6daa77..ef150c38a765 100644 --- a/plugin/fulltext/mecab_parser/plugin_mecab.cc +++ b/plugin/fulltext/mecab_parser/plugin_mecab.cc @@ -239,8 +239,8 @@ static int mecab_parse(MeCab::Lattice *mecab_lattice, position += node->rlength; ret = param->mysql_add_word(param, const_cast(node->surface), - node->length, - term_converted ? &token_info : bool_info); + node->length, + term_converted ? &token_info : bool_info); if (ret != 0) { break; } diff --git a/plugin/thread_pool/src/thread_pool.cc b/plugin/thread_pool/src/thread_pool.cc index ac66b41d5380..c6d180bd47d5 100644 --- a/plugin/thread_pool/src/thread_pool.cc +++ b/plugin/thread_pool/src/thread_pool.cc @@ -3018,9 +3018,10 @@ extern "C" void *tp_stall_check_thread_main(void *) { tp_group_t *cur_group = &(tp_group_list[i]); tp_client_low_level_t *next = nullptr; - DBUG_LOG("tp_scv", "SC: " << X_(cur_group->group_idx) - << X_(cur_group->waiting_thread) - << X_(is_query_ready_to_process(cur_group, &next))); + DBUG_LOG("tp_scv", + "SC: " << X_(cur_group->group_idx) + << X_(cur_group->waiting_thread) + << X_(is_query_ready_to_process(cur_group, &next))); mysql_mutex_lock(&cur_group->LOCK_group); mark_and_count_stalled_threads(cur_group, stall_check_timpt); auto change_active_threads = update_max_active_threads(cur_group); @@ -3063,9 +3064,10 @@ extern "C" void *tp_stall_check_thread_main(void *) { check_trans_queue_for_prio_kickups(cur_group, new_10ms, stall_check_timpt); - if (change_active_threads > 0 || (cur_group->threads_for_consumer == 0 && - cur_group->threads_for_reserve == 0 && - is_query_ready_to_process(cur_group, &next))) { + if (change_active_threads > 0 || + (cur_group->threads_for_consumer == 0 && + cur_group->threads_for_reserve == 0 && + is_query_ready_to_process(cur_group, &next))) { /* With the change in max_active_threads it might be credit available to start up new jobs and we might be missing threads to execute diff --git a/plugin/thread_pool/src/thread_pool.h b/plugin/thread_pool/src/thread_pool.h index cf33122300cb..8705dfa3f5cb 100644 --- a/plugin/thread_pool/src/thread_pool.h +++ b/plugin/thread_pool/src/thread_pool.h @@ -144,7 +144,7 @@ extern MYSQL_PLUGIN_IMPORT uint threadpool_stall_limit; plugin supports. */ inline ulong percona_stall_limit_to_plugin_units(uint value_ms) { return std::clamp((static_cast(value_ms) + 9) / 10, - TP_MIN_STALL_LIMIT, TP_MAX_STALL_LIMIT); + TP_MIN_STALL_LIMIT, TP_MAX_STALL_LIMIT); } #endif diff --git a/router/tests/integration/test_routing_direct.cc b/router/tests/integration/test_routing_direct.cc index 50d7b6b79e1c..ca021f6d8663 100644 --- a/router/tests/integration/test_routing_direct.cc +++ b/router/tests/integration/test_routing_direct.cc @@ -3809,14 +3809,13 @@ TEST_P(ConnectionTest, classic_protocol_session_vars_nullable) { // ensure that no new nullable sys-vars are added. EXPECT_THAT( var[0], - testing::AnyOf("debug_set_operations_secondary_overflow_at", // debug - "character_set_results", // - "innodb_ft_user_stopword_table", // - "innodb_interpreter_output", // debug - "session_track_system_variables", - "external_table_storage_engine", - "external_table_secondary_storage_engine", - "log_query_errors")); + testing::AnyOf( + "debug_set_operations_secondary_overflow_at", // debug + "character_set_results", // + "innodb_ft_user_stopword_table", // + "innodb_interpreter_output", // debug + "session_track_system_variables", "external_table_storage_engine", + "external_table_secondary_storage_engine", "log_query_errors")); } } } diff --git a/router/tests/integration/test_routing_sharing_restart.cc b/router/tests/integration/test_routing_sharing_restart.cc index e9f0afda8487..3f78eeac44b9 100644 --- a/router/tests/integration/test_routing_sharing_restart.cc +++ b/router/tests/integration/test_routing_sharing_restart.cc @@ -1874,9 +1874,11 @@ TEST_P(ShareConnectionTestWithRestartedServer, { auto cmd_res = query_one<1>(cli, "SELECT @@port"); ASSERT_ERROR(cmd_res); - EXPECT_TRUE(cmd_res.error().value() == 2003 || cmd_res.error().value() == 2013) - << "Expected either 2003 (can't connect) or 2013 (lost connection), got " - << cmd_res.error().value(); + EXPECT_TRUE(cmd_res.error().value() == 2003 || + cmd_res.error().value() == 2013) + << "Expected either 2003 (can't connect) or 2013 (lost connection), " + "got " + << cmd_res.error().value(); } } diff --git a/sql/auth/sql_authentication.cc b/sql/auth/sql_authentication.cc index b4ca6f3a55b7..d104cd4d4101 100644 --- a/sql/auth/sql_authentication.cc +++ b/sql/auth/sql_authentication.cc @@ -3128,9 +3128,10 @@ static size_t parse_client_handshake_packet(THD *thd, MPVIO_EXT *mpvio, SSL context is kept till the end of function */ { - const bool admin_ctx = thd->is_admin_connection() && g_admin_ssl_configured; + const bool admin_ctx = + thd->is_admin_connection() && g_admin_ssl_configured; Lock_and_access_ssl_acceptor_context context(admin_ctx ? mysql_admin - : mysql_main); + : mysql_main); /* Do the SSL layering. */ if (!context.have_ssl()) return packet_error; @@ -4662,7 +4663,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(); diff --git a/sql/auth/sql_authentication.h b/sql/auth/sql_authentication.h index ece831c7f56f..a610f280d65e 100644 --- a/sql/auth/sql_authentication.h +++ b/sql/auth/sql_authentication.h @@ -24,10 +24,10 @@ #ifndef SQL_AUTHENTICATION_INCLUDED #define SQL_AUTHENTICATION_INCLUDED -#include #include #include #include +#include #include #include "lex_string.h" diff --git a/sql/auth/sql_authorization.cc b/sql/auth/sql_authorization.cc index d182c1bd3b7b..358488307b62 100644 --- a/sql/auth/sql_authorization.cc +++ b/sql/auth/sql_authorization.cc @@ -4826,7 +4826,8 @@ void get_privilege_access_maps( // get user function privileges get_sp_access_map(acl_user, func_map, func_priv_hash.get(), effective_grants); // get library privileges - get_sp_access_map(acl_user, lib_map, library_priv_hash.get(), effective_grants); + get_sp_access_map(acl_user, lib_map, library_priv_hash.get(), + effective_grants); // get dynamic privileges get_dynamic_privileges(acl_user, dynamic_acl); /* Find out the existing restrictions of the current user. */ diff --git a/sql/auth/sql_user.cc b/sql/auth/sql_user.cc index da4b9f1ca104..c26e71e8a74c 100644 --- a/sql/auth/sql_user.cc +++ b/sql/auth/sql_user.cc @@ -2170,11 +2170,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; @@ -2565,10 +2566,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; } } diff --git a/sql/binlog.cc b/sql/binlog.cc index ea1eb2c025b6..63990ec0a242 100644 --- a/sql/binlog.cc +++ b/sql/binlog.cc @@ -5358,7 +5358,6 @@ int MYSQL_BIN_LOG::count_binlog_space(bool need_lock_index) { DBUG_RETURN(error); } - /** Purge old logs so that we have a total size lower than binlog_space_limit. diff --git a/sql/create_field.cc b/sql/create_field.cc index 168d5293cd94..67d426ba5610 100644 --- a/sql/create_field.cc +++ b/sql/create_field.cc @@ -200,9 +200,10 @@ bool Create_field::init( const LEX_CSTRING *fld_comment, const char *fld_change, List *fld_interval_list, const CHARSET_INFO *fld_charset, bool has_explicit_collation, uint fld_geom_type, - const LEX_CSTRING *fld_zip_dict_name, Value_generator *fld_gcol_info, Value_generator *fld_default_val_expr, - LEX_CSTRING fld_masking_policy, std::optional srid, - dd::Column::enum_hidden_type hidden, bool is_array_arg) { + const LEX_CSTRING *fld_zip_dict_name, Value_generator *fld_gcol_info, + Value_generator *fld_default_val_expr, LEX_CSTRING fld_masking_policy, + std::optional srid, dd::Column::enum_hidden_type hidden, + bool is_array_arg) { uint sign_len, allowed_type_modifier = 0; ulong max_field_charlength = MAX_FIELD_CHARLENGTH; diff --git a/sql/create_field.h b/sql/create_field.h index 707794ce29cf..48112bb3c4df 100644 --- a/sql/create_field.h +++ b/sql/create_field.h @@ -222,7 +222,8 @@ class Create_field { List *interval_list, const CHARSET_INFO *cs, bool has_explicit_collation, uint uint_geom_type, const LEX_CSTRING *zip_dict_name, Value_generator *gcol_info, - Value_generator *default_val_expr, LEX_CSTRING fld_masking_policy, std::optional srid, + Value_generator *default_val_expr, LEX_CSTRING fld_masking_policy, + std::optional srid, dd::Column::enum_hidden_type hidden, bool is_array = false); ha_storage_media field_storage_type() const { diff --git a/sql/dd/impl/dictionary_impl.cc b/sql/dd/impl/dictionary_impl.cc index d294865f9863..ffea1d42b469 100644 --- a/sql/dd/impl/dictionary_impl.cc +++ b/sql/dd/impl/dictionary_impl.cc @@ -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 diff --git a/sql/dd/impl/system_registry.cc b/sql/dd/impl/system_registry.cc index 2140cba501a9..5c215757d529 100644 --- a/sql/dd/impl/system_registry.cc +++ b/sql/dd/impl/system_registry.cc @@ -28,9 +28,9 @@ #include "sql/dd/impl/system_views/character_sets.h" // Character_sets #include "sql/dd/impl/system_views/check_constraints.h" // Check_constraints #include "sql/dd/impl/system_views/collation_charset_applicability.h" // Collati... -#include "sql/dd/impl/system_views/collations.h" // Collations -#include "sql/dd/impl/system_views/column_statistics.h" // Column_statistics -#include "sql/dd/impl/system_views/columns.h" // Columns +#include "sql/dd/impl/system_views/collations.h" // Collations +#include "sql/dd/impl/system_views/column_statistics.h" // Column_statistics +#include "sql/dd/impl/system_views/columns.h" // Columns #include "sql/dd/impl/system_views/columns_extensions.h" // Columns_extensions #include "sql/dd/impl/system_views/compression_dictionary.h" // Compression_dictionary #include "sql/dd/impl/system_views/compression_dictionary_tables.h" // Compression_dictionary_tables diff --git a/sql/dd/impl/types/column_impl.cc b/sql/dd/impl/types/column_impl.cc index febef8692035..04fea15f8a48 100644 --- a/sql/dd/impl/types/column_impl.cc +++ b/sql/dd/impl/types/column_impl.cc @@ -64,10 +64,15 @@ class Sdi_rcontext; class Sdi_wcontext; static const std::set default_valid_option_keys = { - "column_format", "geom_type", - "interval_count", "not_secondary", - "storage", "treat_bit_as_char", "zip_dict_id", - "is_array", "gipk" /* generated implicit primary key column */, + "column_format", + "geom_type", + "interval_count", + "not_secondary", + "storage", + "treat_bit_as_char", + "zip_dict_id", + "is_array", + "gipk" /* generated implicit primary key column */, "masking_policy"}; /////////////////////////////////////////////////////////////////////////// diff --git a/sql/dd/impl/upgrade/server.cc b/sql/dd/impl/upgrade/server.cc index 8f42a0842925..b456eddea68e 100644 --- a/sql/dd/impl/upgrade/server.cc +++ b/sql/dd/impl/upgrade/server.cc @@ -250,8 +250,9 @@ Upgrade_error_counter Upgrade_error_counter::operator++(int) { namespace { static std::vector 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 class Server_option_guard { @@ -1494,7 +1495,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", @@ -1504,7 +1506,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}; /** diff --git a/sql/dd/types/init_mode.h b/sql/dd/types/init_mode.h index 2538550c4409..96ce448bdc8c 100644 --- a/sql/dd/types/init_mode.h +++ b/sql/dd/types/init_mode.h @@ -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 diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index 80236757ef64..e84137c5e6a0 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -537,8 +537,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; } diff --git a/sql/field.cc b/sql/field.cc index d1dc9669b2bd..d12572e88f25 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -75,7 +75,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 diff --git a/sql/handler.cc b/sql/handler.cc index d60a83ce82d5..a2d7f3edb3ab 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -121,7 +121,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" @@ -2566,7 +2566,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); @@ -3751,9 +3752,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 && @@ -8567,8 +8568,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(); @@ -8847,9 +8847,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; diff --git a/sql/handler.h b/sql/handler.h index 2986e77e044e..7b4dfe09e1cb 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -3296,7 +3296,6 @@ inline constexpr const decltype(handlerton::flags) inline constexpr const decltype(handlerton::flags) HTON_SECONDARY_SUPPORTS_TEMPORARY_TABLE(1 << 25); - /** Start of Percona specific HTON_* defines */ /** @@ -3314,7 +3313,6 @@ inline constexpr const decltype(handlerton::flags) /** End of Percona specific HTON_* defines */ - /* Whether the handlerton is a secondary engine. */ inline bool hton_is_secondary_engine(const handlerton *hton) { return hton != nullptr && (hton->flags & HTON_IS_SECONDARY_ENGINE) != 0U; @@ -7077,16 +7075,16 @@ class handler { for details. */ [[nodiscard]] int ha_fast_update(THD *thd, - mem_root_deque &update_fields, - mem_root_deque &update_values, - Item *conds); + mem_root_deque &update_fields, + mem_root_deque &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 &update_fields, - mem_root_deque &update_values); + mem_root_deque &update_values); private: /** @@ -7109,11 +7107,11 @@ class handler { handler::ha_update_row(...) does not accept conditions. */ [[nodiscard]] virtual int fast_update(THD *thd [[maybe_unused]], - mem_root_deque &update_fields - [[maybe_unused]], - mem_root_deque &update_values - [[maybe_unused]], - Item *conds [[maybe_unused]]) { + mem_root_deque &update_fields + [[maybe_unused]], + mem_root_deque &update_values + [[maybe_unused]], + Item *conds [[maybe_unused]]) { return ENOTSUP; } @@ -7134,10 +7132,10 @@ class handler { @return an error if the insert should be terminated. */ [[nodiscard]] virtual int upsert(THD *thd [[maybe_unused]], - mem_root_deque &update_fields - [[maybe_unused]], - mem_root_deque &update_values - [[maybe_unused]]) { + mem_root_deque &update_fields + [[maybe_unused]], + mem_root_deque &update_values + [[maybe_unused]]) { return ENOTSUP; } @@ -7648,7 +7646,6 @@ class handler { int get_lock_type() const { return m_lock_type; } - public: /* Read-free replication interface */ diff --git a/sql/item_func.cc b/sql/item_func.cc index 0e30d4f4cf0f..3ebba986a597 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -9161,7 +9161,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 diff --git a/sql/log_event.cc b/sql/log_event.cc index a7bce16a86f8..04bde5a778d7 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1163,38 +1163,37 @@ bool Log_event::need_checksum() { static_cast(binlog_checksum_options) : mysql::binlog::event::BINLOG_CHECKSUM_ALG_OFF; - assert( - !ret || - ((common_footer->checksum_alg == - static_cast(binlog_checksum_options) || - /* - Stop event closes the relay-log and its checksum alg - preference is set by the caller can be different - from the server's binlog_checksum_options. - */ - get_type_code() == mysql::binlog::event::STOP_EVENT || - /* - Rotate:s can be checksummed regardless of the server's - binlog_checksum_options. That applies to both - the local RL's Rotate and the master's Rotate - which IO thread instantiates via queue_binlog_ver_3_event. - */ - get_type_code() == mysql::binlog::event::ROTATE_EVENT || - /* - The previous event has its checksum option defined - according to the format description event. - */ - get_type_code() == mysql::binlog::event::PREVIOUS_GTIDS_LOG_EVENT || - /* FD is always checksummed */ - get_type_code() == mysql::binlog::event::FORMAT_DESCRIPTION_EVENT || - /* - View_change_log_event is queued into relay log by the - local member, which may have a different checksum algorithm - than the one of the event source. - */ - get_type_code() == mysql::binlog::event::VIEW_CHANGE_EVENT) && - common_footer->checksum_alg != - mysql::binlog::event::BINLOG_CHECKSUM_ALG_OFF)); + assert(!ret || + ((common_footer->checksum_alg == + static_cast(binlog_checksum_options) || + /* + Stop event closes the relay-log and its checksum alg + preference is set by the caller can be different + from the server's binlog_checksum_options. + */ + get_type_code() == mysql::binlog::event::STOP_EVENT || + /* + Rotate:s can be checksummed regardless of the server's + binlog_checksum_options. That applies to both + the local RL's Rotate and the master's Rotate + which IO thread instantiates via queue_binlog_ver_3_event. + */ + get_type_code() == mysql::binlog::event::ROTATE_EVENT || + /* + The previous event has its checksum option defined + according to the format description event. + */ + get_type_code() == mysql::binlog::event::PREVIOUS_GTIDS_LOG_EVENT || + /* FD is always checksummed */ + get_type_code() == mysql::binlog::event::FORMAT_DESCRIPTION_EVENT || + /* + View_change_log_event is queued into relay log by the + local member, which may have a different checksum algorithm + than the one of the event source. + */ + get_type_code() == mysql::binlog::event::VIEW_CHANGE_EVENT) && + common_footer->checksum_alg != + mysql::binlog::event::BINLOG_CHECKSUM_ALG_OFF)); assert(common_footer->checksum_alg != mysql::binlog::event::BINLOG_CHECKSUM_ALG_UNDEF); @@ -1540,8 +1539,8 @@ static void my_b_write_bit(IO_CACHE *file, const uchar *ptr, uint nbits) { my_b_printf(file, "b'"); for (bitnum = skip_bits; bitnum < nbits8; bitnum++) { const int is_set = (ptr[(bitnum) / 8] >> (7 - bitnum % 8)) & 0x01; - [[maybe_unused]] - int write_res = my_b_write(file, (const uchar *)(is_set ? "1" : "0"), 1); + [[maybe_unused]] int write_res = + my_b_write(file, (const uchar *)(is_set ? "1" : "0"), 1); assert(write_res == 0); } my_b_printf(file, "'"); @@ -4121,8 +4120,8 @@ void Query_log_event::print_query_header( end = my_stpcpy(end, print_event_info->delimiter); *end++ = '\n'; assert(end < buff + sizeof(buff)); - [[maybe_unused]] - int write_res = my_b_write(file, (uchar *)buff, (uint)(end - buff)); + [[maybe_unused]] int write_res = + my_b_write(file, (uchar *)buff, (uint)(end - buff)); assert(write_res == 0); if (!print_event_info->require_row_format && (!print_event_info->thread_id_printed || @@ -4295,8 +4294,8 @@ void Query_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info) const { DBUG_EXECUTE_IF("simulate_file_write_error", { head->write_pos = head->write_end - 500; }); print_query_header(head, print_event_info); - [[maybe_unused]] - int write_res = my_b_write(head, pointer_cast(query), q_len); + [[maybe_unused]] int write_res = + my_b_write(head, pointer_cast(query), q_len); assert(write_res == 0); my_b_printf(head, "\n%s\n", print_event_info->delimiter); } @@ -5599,9 +5598,8 @@ void Rotate_log_event::print(FILE *, PRINT_EVENT_INFO *print_event_info) const { print_header(head, print_event_info, false); my_b_printf(head, "\tRotate to "); if (new_log_ident) { - [[maybe_unused]] - int write_res = my_b_write(head, pointer_cast(new_log_ident), - (uint)ident_len); + [[maybe_unused]] int write_res = my_b_write( + head, pointer_cast(new_log_ident), (uint)ident_len); assert(write_res == 0); } my_b_printf(head, " pos: %s\n", llstr(pos, buf)); @@ -6749,8 +6747,8 @@ void User_var_log_event::print(FILE *, quoted_len = my_strmov_quoted_identifier((char *)quoted_id, (const char *)name_id); quoted_id[quoted_len] = '\0'; - [[maybe_unused]] - int write_res = my_b_write(head, (uchar *)quoted_id, quoted_len); + [[maybe_unused]] int write_res = + my_b_write(head, (uchar *)quoted_id, quoted_len); assert(write_res == 0); if (is_null) { @@ -7948,16 +7946,16 @@ Rows_log_event::Rows_log_event( /* Check extra data has expected value */ check_extra_row_ndb_info(m_extra_row_info.get_ndb_info());); - /* - m_cols and m_cols_ai are of the type MY_BITMAP, which are members of - class Rows_log_event, and are used while applying the row events on - the slave. - The bitmap integer is initialized by copying the contents of the - vector column_before_image for m_cols.bitamp, and vector - column_after_image for m_cols_ai.bitmap. m_cols_ai is only initialized - for UPDATE_ROWS_EVENTS, else it is equal to the before image. - */ - /* if bitmap_init fails, is_valid will be set to false */ + /* + m_cols and m_cols_ai are of the type MY_BITMAP, which are members of + class Rows_log_event, and are used while applying the row events on + the slave. + The bitmap integer is initialized by copying the contents of the + vector column_before_image for m_cols.bitamp, and vector + column_after_image for m_cols_ai.bitmap. m_cols_ai is only initialized + for UPDATE_ROWS_EVENTS, else it is equal to the before image. + */ + /* if bitmap_init fails, is_valid will be set to false */ #if defined(__GNUC__) && (__GNUC__ >= 14) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" @@ -10226,9 +10224,11 @@ int Rows_log_event::do_apply_event(Relay_log_info const *rli) { break; case ROW_LOOKUP_NOT_NEEDED: - assert(get_general_type_code() == mysql::binlog::event::WRITE_ROWS_EVENT || - get_general_type_code() == mysql::binlog::event::DELETE_ROWS_EVENT || - get_general_type_code() == mysql::binlog::event::UPDATE_ROWS_EVENT); + assert( + get_general_type_code() == mysql::binlog::event::WRITE_ROWS_EVENT || + get_general_type_code() == + mysql::binlog::event::DELETE_ROWS_EVENT || + get_general_type_code() == mysql::binlog::event::UPDATE_ROWS_EVENT); /* No need to scan for rows, just apply it */ do_apply_row_ptr = &Rows_log_event::do_apply_row; diff --git a/sql/log_event.h b/sql/log_event.h index 935ec6ceb3e8..94694941f88b 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -44,8 +44,8 @@ #include #include +#include "m_string.h" // native_strncasecmp #include "my_aes.h" -#include "m_string.h" // native_strncasecmp #include "my_bitmap.h" // MY_BITMAP #include "my_checksum.h" // ha_checksum #include "my_dbug.h" diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 662d84f70ef6..4036a1cc29df 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -842,8 +842,8 @@ MySQL clients support the protocol: #include "sql/regexp/regexp_facade.h" // regexp::regexp_lib_charset #include "sql/replication.h" // thd_enter_cond #include "sql/resourcegroups/resource_group_mgr.h" // init, post_init -#include "sql/statement/statement.h" #include "sql/sql_profile.h" +#include "sql/statement/statement.h" #ifdef _WIN32 #include "sql/restart_monitor_win.h" #endif @@ -14374,15 +14374,13 @@ static bool check_secure_path(const char *opt_var, const char *variable_name, auto check_path_overlap = [&](char *buffer, size_t len, const char *message) { if (!case_insensitive_fs) { - if (!strncmp(buffer, opt_var, - len < opt_var_len ? len : opt_var_len)) { + if (!strncmp(buffer, opt_var, len < opt_var_len ? len : opt_var_len)) { warn = true; strcpy(whichdir, message); } } else { - char *longer_str = opt_datadir_len > opt_var_len - ? buffer - : const_cast(opt_var); + char *longer_str = + opt_datadir_len > opt_var_len ? buffer : const_cast(opt_var); const size_t smaller_len = std::min(len, opt_var_len); const char restore = longer_str[smaller_len]; longer_str[smaller_len] = '\0'; diff --git a/sql/opt_statistics.cc b/sql/opt_statistics.cc index 6b7cda5aea95..5aecb2c491f5 100644 --- a/sql/opt_statistics.cc +++ b/sql/opt_statistics.cc @@ -102,9 +102,9 @@ rec_per_key_t guess_rec_per_key(const TABLE *const table, const KEY *const key, if (key->actual_key_parts > 1) { // See formula above rec_per_key = - rec_per_key_first - (rec_per_key_t(used_keyparts - 1) / - (key->actual_key_parts - 1)) * - (rec_per_key_first - rec_per_key_all); + rec_per_key_first - + (rec_per_key_t(used_keyparts - 1) / (key->actual_key_parts - 1)) * + (rec_per_key_first - rec_per_key_all); } else { // Single column index if (key->actual_flags & HA_NOSAME) diff --git a/sql/parse_tree_column_attrs.h b/sql/parse_tree_column_attrs.h index fd7ca0847293..ebdf588da354 100644 --- a/sql/parse_tree_column_attrs.h +++ b/sql/parse_tree_column_attrs.h @@ -498,8 +498,9 @@ class PT_column_format_column_attr : public PT_column_attr_base { column_format_type format; public: - explicit PT_column_format_column_attr(const POS &pos, - column_format_type format, const LEX_CSTRING &zip_dict_name) noexcept + explicit PT_column_format_column_attr( + const POS &pos, column_format_type format, + const LEX_CSTRING &zip_dict_name) noexcept : super(pos), format(format), m_zip_dict_name(zip_dict_name) {} void apply_type_flags(ulong *type_flags) const override { diff --git a/sql/parse_tree_nodes.cc b/sql/parse_tree_nodes.cc index 08ba8f323d0e..0a9b731b4d1c 100644 --- a/sql/parse_tree_nodes.cc +++ b/sql/parse_tree_nodes.cc @@ -1734,8 +1734,8 @@ bool PT_table_factor_function::do_contextualize(Parse_context *pc) { bool PT_table_sequence_function::do_contextualize(Parse_context *pc) { if (super::do_contextualize(pc) || m_expr->itemize(pc, &m_expr)) return true; - auto stf = new (pc->mem_root) - Table_function_sequence(m_table_alias.str, m_expr); + auto stf = + new (pc->mem_root) Table_function_sequence(m_table_alias.str, m_expr); if (stf == nullptr) return true; // OOM LEX_CSTRING alias; @@ -1747,7 +1747,7 @@ bool PT_table_sequence_function::do_contextualize(Parse_context *pc) { if (ti == nullptr) return true; m_table_ref = pc->select->add_table_to_list(pc->thd, ti, m_table_alias.str, 0, - TL_READ, MDL_SHARED_READ); + TL_READ, MDL_SHARED_READ); if (m_table_ref == nullptr) return true; if (pc->select->add_joined_table(m_table_ref)) return true; @@ -2811,8 +2811,7 @@ bool PT_column_def::do_contextualize(Table_ddl_parse_context *pc) { field_def->has_explicit_collation, field_def->uint_geom_type, &field_def->m_zip_dict, field_def->gcol_info, field_def->default_val_info, field_def->masking_policy, opt_place, field_def->m_srid, - field_def->check_const_spec_list, - field_hidden_type); + field_def->check_const_spec_list, field_hidden_type); } Sql_cmd *PT_create_table_stmt::make_cmd(THD *thd) { @@ -3687,9 +3686,10 @@ bool PT_alter_table_change_column::do_contextualize( m_field_def->on_update_value, &m_field_def->comment, m_old_name.str, m_field_def->interval_list, m_field_def->charset, m_field_def->has_explicit_collation, m_field_def->uint_geom_type, - &m_field_def->m_zip_dict, m_field_def->gcol_info, m_field_def->default_val_info, - m_field_def->masking_policy, m_opt_place, m_field_def->m_srid, - m_field_def->check_const_spec_list, field_hidden_type); + &m_field_def->m_zip_dict, m_field_def->gcol_info, + m_field_def->default_val_info, m_field_def->masking_policy, m_opt_place, + m_field_def->m_srid, m_field_def->check_const_spec_list, + field_hidden_type); } bool PT_alter_table_rename::do_contextualize(Table_ddl_parse_context *pc) { diff --git a/sql/parse_tree_nodes.h b/sql/parse_tree_nodes.h index abb51c9c7b0a..0c9ba260d4c6 100644 --- a/sql/parse_tree_nodes.h +++ b/sql/parse_tree_nodes.h @@ -530,7 +530,8 @@ class PT_table_sequence_function : public PT_table_reference { typedef PT_table_reference super; public: - PT_table_sequence_function(const POS &pos, Item *expr, const LEX_CSTRING &table_alias) + PT_table_sequence_function(const POS &pos, Item *expr, + const LEX_CSTRING &table_alias) : super(pos), m_expr(expr), m_table_alias(table_alias) {} bool do_contextualize(Parse_context *pc) override; diff --git a/sql/partition_info.h b/sql/partition_info.h index c670ac055f16..57ef2f05c501 100644 --- a/sql/partition_info.h +++ b/sql/partition_info.h @@ -606,9 +606,9 @@ static inline void init_all_partitions_iterator(partition_info *part_info, @return true - On failure. @return false - On success. */ -[[nodiscard]] -bool fill_first_partition_name(const partition_info *part_info, - const char *normalized_path, char *first_name); +[[nodiscard]] bool fill_first_partition_name(const partition_info *part_info, + const char *normalized_path, + char *first_name); bool fill_partition_tablespace_names(partition_info *part_info, Tablespace_hash_set *tablespace_set); diff --git a/sql/partitioning/partition_base.cc b/sql/partitioning/partition_base.cc index 83db2c347c45..923e7da0460d 100644 --- a/sql/partitioning/partition_base.cc +++ b/sql/partitioning/partition_base.cc @@ -24,8 +24,8 @@ #define MYSQL_SERVER 1 #define LOG_SUBSYSTEM_TAG "partition_base" -#include "partition_base.h" #include "mysql/psi/mysql_file.h" +#include "partition_base.h" #include "pfs_file_provider.h" #include "scope_guard.h" #include "sql/partition_info.h" // partition_info @@ -2387,8 +2387,7 @@ int Partition_base::rnd_init_in_part(uint part_id, bool scan) { @retval != 0 Error code */ -int Partition_base::rnd_end_in_part(uint part_id, - bool scan [[maybe_unused]]) { +int Partition_base::rnd_end_in_part(uint part_id, bool scan [[maybe_unused]]) { return m_file[part_id]->ha_rnd_end(); } diff --git a/sql/range_optimizer/index_range_scan_plan.cc b/sql/range_optimizer/index_range_scan_plan.cc index d6b4a074e444..a01e441e4553 100644 --- a/sql/range_optimizer/index_range_scan_plan.cc +++ b/sql/range_optimizer/index_range_scan_plan.cc @@ -916,8 +916,7 @@ AccessPath *get_key_scans_params(THD *thd, RANGE_OPT_PARAM *param, .add_alnum("cost", "not applicable"); } else { trace_idx.add("rows", found_records).add("cost", cost); - if (thd->optimizer_switch_flag( - OPTIMIZER_SWITCH_FAVOR_RANGE_SCAN)) { + if (thd->optimizer_switch_flag(OPTIMIZER_SWITCH_FAVOR_RANGE_SCAN)) { trace_idx.add("revised_cost", cost.total_cost() * 0.1); cost.multiply(0.1); } diff --git a/sql/rpl_binlog_sender.cc b/sql/rpl_binlog_sender.cc index 96c21221176d..bba750540989 100644 --- a/sql/rpl_binlog_sender.cc +++ b/sql/rpl_binlog_sender.cc @@ -64,8 +64,8 @@ #include "sql/sql_class.h" // THD #include "sql/system_variables.h" #include "sql_string.h" -#include "strings/m_ctype_internals.h" #include "string_with_len.h" +#include "strings/m_ctype_internals.h" #include "typelib.h" #include "unsafe_string_append.h" diff --git a/sql/rpl_event_ctx.cc b/sql/rpl_event_ctx.cc index 74f3b8024b30..3b96af960123 100644 --- a/sql/rpl_event_ctx.cc +++ b/sql/rpl_event_ctx.cc @@ -17,7 +17,7 @@ #include "rpl_event_ctx.h" #include #include -#include "mf_wcomp.h" // wild_one, wild_many +#include "mf_wcomp.h" // wild_one, wild_many #include "mysql/strings/m_ctype.h" #include "sql/mysqld.h" // system_charset_info #include "sql/mysqld_cs.h" diff --git a/sql/server_component/mysql_command_services_imp.cc b/sql/server_component/mysql_command_services_imp.cc index 1b99e2902f7b..3429c0e7bb28 100644 --- a/sql/server_component/mysql_command_services_imp.cc +++ b/sql/server_component/mysql_command_services_imp.cc @@ -621,8 +621,7 @@ DEFINE_BOOL_METHOD(mysql_command_services_imp::set, mysql_session = service->open(nullptr, nullptr); else return true; - if (mysql_session == nullptr) - return true; + if (mysql_session == nullptr) return true; thd = mysql_session->get_thd(); mcs_ext->is_thd_associated = false; Security_context_handle sc; diff --git a/sql/set_var.h b/sql/set_var.h index ebb4141cafb7..88b0328edc95 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -1146,8 +1146,8 @@ bool set_global_variable_attribute(const System_variable_tracker &var_tracker, extern bool get_sysvar_source(const char *name, uint length, enum enum_variable_source *source); -[[nodiscard]] -int sql_set_variables(THD *thd, List *var_list, bool opened); +[[nodiscard]] int sql_set_variables(THD *thd, List *var_list, + bool opened); bool keyring_access_test(); bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type); diff --git a/sql/sql_alter.h b/sql/sql_alter.h index c21f3f19d6f9..c386695280d8 100644 --- a/sql/sql_alter.h +++ b/sql/sql_alter.h @@ -526,9 +526,10 @@ class Alter_info { Item *on_update_value, LEX_CSTRING *comment, const char *change, List *interval_list, const CHARSET_INFO *cs, bool has_explicit_collation, - uint uint_geom_type, const LEX_CSTRING *zip_dict, Value_generator *gcol_info, - Value_generator *default_val_expr, LEX_CSTRING masking_policy, - const char *opt_after, std::optional srid, + uint uint_geom_type, const LEX_CSTRING *zip_dict, + Value_generator *gcol_info, Value_generator *default_val_expr, + LEX_CSTRING masking_policy, const char *opt_after, + std::optional srid, Sql_check_constraint_spec_list *check_cons_list, dd::Column::enum_hidden_type hidden, bool is_array = false); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 5ec3f9ec15df..e5a3f1d6309d 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2445,7 +2445,6 @@ void close_temporary_table(THD *thd, TABLE *table, bool free_share, close_temporary(thd, table, free_share, delete_table); mysql_mutex_unlock(&thd->LOCK_temporary_tables); - } /* @@ -10934,8 +10933,8 @@ Table_node::Table_node(const TABLE *table_arg) } } -inline Column_node *Table_node::get_column_node(const Field *field) const - noexcept { +inline Column_node *Table_node::get_column_node( + const Field *field) const noexcept { return columns[field->field_index()]; } @@ -10990,8 +10989,8 @@ class Const_ordered_table_node final : public Or_node { Const_ordered_table_node::Const_ordered_table_node(const TABLE *table_arg) : table(table_arg), - ordered_table_node(new (*THR_MALLOC) Table_node(table)), - const_table_node(new (*THR_MALLOC) Table_node(table)) { + ordered_table_node(new(*THR_MALLOC) Table_node(table)), + const_table_node(new(*THR_MALLOC) Table_node(table)) { add_successor(ordered_table_node); add_successor(const_table_node); } @@ -11135,7 +11134,7 @@ void Join_node::add_const_equi_columns(Item *cond) { if (is_cond_or(cond)) return; if (is_cond_and(cond)) { const List *args = ((const Item_cond *)cond)->argument_list(); - List_iterator it(*const_cast*>(args)); + List_iterator it(*const_cast *>(args)); Item *c; while ((c = it++)) add_const_equi_columns(c); return; @@ -11178,7 +11177,7 @@ void Join_node::add_const_equi_columns(Item *cond) { } } else { auto it = equal->get_fields().begin(); - Item_field& first_item = *it++; + Item_field &first_item = *it++; for (; it != equal->get_fields().end(); ++it) { add_equi_column(first_item.field, it->field); } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index db4d09e64f88..dfb5c8a1b103 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1788,7 +1788,8 @@ extern "C" long long thd_start_time(const THD *thd) { extern "C" void thd_kill(ulong id) { Find_thd_with_id find_thd_with_id(id, false); - THD_ptr thd_ptr = Global_THD_manager::get_instance()->find_thd(&find_thd_with_id); + THD_ptr thd_ptr = + Global_THD_manager::get_instance()->find_thd(&find_thd_with_id); if (!thd_ptr) return; thd_ptr->awake(THD::KILL_CONNECTION); @@ -2236,9 +2237,9 @@ void THD::shutdown_active_vio() { const char *get_client_host(const THD &client) noexcept { return client.security_context()->host_or_ip().length ? client.security_context()->host_or_ip().str - : client.security_context()->host().length - ? client.security_context()->host().str - : ""; + : client.security_context()->host().length + ? client.security_context()->host().str + : ""; } void THD::shutdown_clone_vio() { diff --git a/sql/sql_class.h b/sql/sql_class.h index 49422de4e65a..57eed4ec34ee 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1347,11 +1347,11 @@ class THD : public MDL_context_owner, */ collation_unordered_map> user_vars{system_charset_info, key_memory_user_var_entry}; - struct rand_struct rand; // used for authentication - struct System_variables variables; // Changeable local variables - struct System_status_var status_var; // Per thread statistic vars - struct rand_struct slog_rand; // used for random slow log - // filtering + struct rand_struct rand; // used for authentication + struct System_variables variables; // Changeable local variables + struct System_status_var status_var; // Per thread statistic vars + struct rand_struct slog_rand; // used for random slow log + // filtering struct System_status_var *copy_status_var_ptr; // A copy of the statistic vars asof the start of // the query @@ -3143,7 +3143,6 @@ class THD : public MDL_context_owner, /** number of name_const() substitutions, see sp_head.cc:subst_spvars() */ uint query_name_consts; - /* Used to update global user stats. The global user stats are updated occasionally with the 'diff' variables. After the update, the 'diff' diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index a4e93e358557..a1708a9a3adf 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -48,8 +48,8 @@ #include "sql/binlog.h" // mysql_bin_log #include "sql/dd/cache/dictionary_client.h" #include "sql/dd/types/table.h" -#include "sql/debug_sync.h" // DEBUG_SYNC -#include "sql/filesort.h" // Filesort +#include "sql/debug_sync.h" // DEBUG_SYNC +#include "sql/filesort.h" // Filesort #include "sql/handler.h" #include "sql/item.h" #include "sql/iterators/delete_rows_iterator.h" diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e21c43de2925..fb5bb8dea43c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5846,8 +5846,8 @@ bool Alter_info::add_field( const char *change, List *interval_list, const CHARSET_INFO *cs, bool has_explicit_collation, uint uint_geom_type, const LEX_CSTRING *zip_dict, Value_generator *gcol_info, - Value_generator *default_val_expr, LEX_CSTRING masking_policy, const char *opt_after, - std::optional srid, + Value_generator *default_val_expr, LEX_CSTRING masking_policy, + const char *opt_after, std::optional srid, Sql_check_constraint_spec_list *col_check_const_spec_list, dd::Column::enum_hidden_type hidden, bool is_array) { const uint8 datetime_precision = decimals ? atoi(decimals) : 0; @@ -6572,11 +6572,10 @@ Table_ref *Query_block::add_table_to_list( // threads since this is expected by the mysql_upgrade utility. if (!(lex->sql_command == SQLCOM_CREATE_VIEW && dd::get_dictionary()->is_system_view_name( - lex->query_tables->db, lex->query_tables->table_name)) -&& !(dd::get_dictionary()->is_system_view_name( - lex->query_tables->db, lex->query_tables->table_name) - && DBUG_EVALUATE_IF("skip_dd_table_access_check", true, false)) - ) { + lex->query_tables->db, lex->query_tables->table_name)) && + !(dd::get_dictionary()->is_system_view_name( + lex->query_tables->db, lex->query_tables->table_name) && + DBUG_EVALUATE_IF("skip_dd_table_access_check", true, false))) { my_error(ER_NO_SYSTEM_TABLE_ACCESS, MYF(0), ER_THD_NONCONST(thd, dictionary->table_type_error_code( ptr->db, ptr->table_name)), diff --git a/sql/sql_parse.h b/sql/sql_parse.h index f864a00e034c..e4a257d0e288 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -118,8 +118,7 @@ inline size_t trim_trailing_semicolons(const CHARSET_INFO *cs, const char *str, bool alloc_query(THD *thd, const char *packet, size_t packet_length); void dispatch_sql_command(THD *thd, Parser_state *parser_state, - bool update_userstat, - bool is_retry = false); + bool update_userstat, bool is_retry = false); void mysql_reset_thd_for_next_command(THD *thd); void create_table_set_open_action_and_adjust_tables(LEX *lex); void add_automatic_sp_privileges(THD *thd, enum_sp_type sp_type, diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 79ab2cce1523..948d8fa00d58 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -274,11 +274,9 @@ static bool is_name_in_list(const char *name, List list_names) { false Success */ -[[nodiscard]] -static bool partition_default_handling(Partition_handler *part_handler, - partition_info *part_info, - bool is_create_table_ind, - const char *normalized_path) { +[[nodiscard]] static bool partition_default_handling( + Partition_handler *part_handler, partition_info *part_info, + bool is_create_table_ind, const char *normalized_path) { DBUG_TRACE; if (!is_create_table_ind) { diff --git a/sql/sql_partition.h b/sql/sql_partition.h index ac83d13f3673..fe0245e20bec 100644 --- a/sql/sql_partition.h +++ b/sql/sql_partition.h @@ -127,11 +127,9 @@ void get_full_part_id_from_key(const TABLE *table, uchar *buf, KEY *key_info, @retval true - On failure. @retval false - On success. */ -[[nodiscard]] -bool get_first_partition_name(THD *thd, Partition_handler *part_handler, - const char *normalized_path, - const char *partition_info_str, - uint partition_info_len, char *first_name); +[[nodiscard]] bool get_first_partition_name( + THD *thd, Partition_handler *part_handler, const char *normalized_path, + const char *partition_info_str, uint partition_info_len, char *first_name); bool mysql_unpack_partition(THD *thd, char *part_buf, uint part_info_len, TABLE *table, bool is_create_table_ind, diff --git a/sql/sql_planner.cc b/sql/sql_planner.cc index c51d61a0eeab..938b408307b3 100644 --- a/sql/sql_planner.cc +++ b/sql/sql_planner.cc @@ -150,7 +150,7 @@ double find_cost_for_ref(const THD *thd, TABLE *table, unsigned keyno, return worst_seeks; } if (table->covering_keys.is_set(keyno) || - (table->file->index_flags(keyno, 0, 0) & HA_CLUSTERED_INDEX)) { + (table->file->index_flags(keyno, 0, 0) & HA_CLUSTERED_INDEX)) { // We can use only index tree const Cost_estimate index_read_cost = table->file->index_scan_cost(keyno, 1, num_rows); diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 9bb8624f11a2..db7da7ee9e6d 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -72,7 +72,7 @@ #include "sql/auth/auth_acls.h" #include "sql/auth/auth_common.h" // check_table_access #include "sql/auth/auth_plugin_shutdown.h" -#include "sql/auto_thd.h" // Auto_THD +#include "sql/auto_thd.h" // Auto_THD #include "sql/current_thd.h" #include "sql/dd/cache/dictionary_client.h" // dd::cache::Dictionary_client #include "sql/dd/dd_schema.h" // dd::Schema_MDL_locker diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index e643a8c62425..09c78308006d 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -53,7 +53,7 @@ #include "sql/sql_class.h" // THD #include "sql/sql_connect.h" // reset_mqh #include "sql/sql_const.h" -#include "sql/sql_error.h" // push_deprecated_warn_no_replacement +#include "sql/sql_error.h" // push_deprecated_warn_no_replacement #include "sql/sql_profile.h" #include "sql/sql_servers.h" // servers_reload #include "sql/system_variables.h" @@ -252,8 +252,7 @@ bool handle_reload_request(THD *thd, unsigned long options, Table_ref *tables, } } - assert(!thd || thd->locked_tables_mode || - !thd->mdl_context.has_locks() || + assert(!thd || thd->locked_tables_mode || !thd->mdl_context.has_locks() || !thd->handler_tables_hash.empty() || thd->mdl_context.has_locks(MDL_key::USER_LEVEL_LOCK) || thd->mdl_context.has_locks(MDL_key::LOCKING_SERVICE) || diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 56a8fcdae95f..ce693de2e34e 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -93,7 +93,7 @@ #include "sql/sql_list.h" #include "sql/sql_optimizer.h" // JOIN #include "sql/sql_select.h" -#include "sql/sql_tmp_table.h" // tmp tables +#include "sql/sql_tmp_table.h" // tmp tables #include "sql/table_function.h" // Table_function #include "sql/thd_raii.h" #include "sql/visible_fields.h" @@ -1246,7 +1246,8 @@ void Query_expression::cleanup(bool full) { if (cleaned >= (full ? UC_CLEAN : UC_PART_CLEAN)) { #ifndef NDEBUG if (cleaned == UC_CLEAN) - for (Query_block *qb = first_query_block(); qb; qb = qb->next_query_block()) + for (Query_block *qb = first_query_block(); qb; + qb = qb->next_query_block()) assert(!qb->join); #endif return; diff --git a/sql/sql_zip_dict.cc b/sql/sql_zip_dict.cc index acd965865316..21c1b2a729bb 100644 --- a/sql/sql_zip_dict.cc +++ b/sql/sql_zip_dict.cc @@ -165,9 +165,9 @@ delete) @return TABLE* on success else nullptr */ static TABLE *open_dictionary_table_write(THD *thd) { Table_ref tablelist(STRING_WITH_LEN(COMPRESSION_DICTIONARY_DB), - STRING_WITH_LEN(COMPRESSION_DICTIONARY_TABLE), - COMPRESSION_DICTIONARY_TABLE, TL_WRITE, - MDL_SHARED_NO_READ_WRITE); + STRING_WITH_LEN(COMPRESSION_DICTIONARY_TABLE), + COMPRESSION_DICTIONARY_TABLE, TL_WRITE, + MDL_SHARED_NO_READ_WRITE); tablelist.next_local = tablelist.next_global = nullptr; const uint flags = (MYSQL_LOCK_IGNORE_TIMEOUT | MYSQL_OPEN_IGNORE_KILLED | @@ -196,8 +196,8 @@ static TABLE *open_dictionary_table_read(THD *thd) { thd->begin_attachable_ro_transaction(); Table_ref tablelist(STRING_WITH_LEN(COMPRESSION_DICTIONARY_DB), - STRING_WITH_LEN(COMPRESSION_DICTIONARY_TABLE), - COMPRESSION_DICTIONARY_TABLE, TL_READ); + STRING_WITH_LEN(COMPRESSION_DICTIONARY_TABLE), + COMPRESSION_DICTIONARY_TABLE, TL_READ); tablelist.next_local = tablelist.next_global = nullptr; uint flags = (MYSQL_LOCK_IGNORE_TIMEOUT | MYSQL_OPEN_IGNORE_KILLED | @@ -247,9 +247,9 @@ table mysql.compression_dictionary static TABLE *open_dictionary_cols_table_write(THD *thd) { Table_ref tablelist(STRING_WITH_LEN(COMPRESSION_DICTIONARY_COLS_DB), - STRING_WITH_LEN(COMPRESSION_DICTIONARY_COLS_TABLE), - COMPRESSION_DICTIONARY_COLS_TABLE, - TL_WRITE_CONCURRENT_DEFAULT, MDL_SHARED_WRITE); + STRING_WITH_LEN(COMPRESSION_DICTIONARY_COLS_TABLE), + COMPRESSION_DICTIONARY_COLS_TABLE, + TL_WRITE_CONCURRENT_DEFAULT, MDL_SHARED_WRITE); tablelist.next_local = tablelist.next_global = nullptr; const uint flags = (MYSQL_LOCK_IGNORE_TIMEOUT | MYSQL_OPEN_IGNORE_KILLED | diff --git a/sql/sys_vars.h b/sql/sys_vars.h index e73c4dc02d38..149db65125dd 100644 --- a/sql/sys_vars.h +++ b/sql/sys_vars.h @@ -430,8 +430,7 @@ class Sys_var_alias : public sys_var { void saved_value_to_string(THD *thd, set_var *var, char *def_val) override { return m_base_var.saved_value_to_string(thd, var, def_val); } - void persist_only_to_string(THD *thd, set_var *var, - String *dest) override { + void persist_only_to_string(THD *thd, set_var *var, String *dest) override { return m_base_var.persist_only_to_string(thd, var, dest); } bool check_update_type(Item_result type) override { diff --git a/sql/table.cc b/sql/table.cc index 19a76e199c4c..3fea8951f8df 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -2088,7 +2088,6 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, assert(share->fields >= frm_context->stored_fields); assert(share->reclength >= share->stored_rec_length); - /* Use share mem root for zip dict name and data */ for (uint i2 = 0; i2 < share->fields; ++i2) { Field *field = share->field[i2]; diff --git a/sql/tc_log.cc b/sql/tc_log.cc index 6c57078d0b64..3b69386b9cff 100644 --- a/sql/tc_log.cc +++ b/sql/tc_log.cc @@ -514,8 +514,7 @@ TC_LOG::enum_result TC_LOG_MMAP::commit(THD *thd, bool all) { int rc = trx_coordinator::commit_in_engines(thd, all); sunlock(); - if (rc) - return RESULT_INCONSISTENT; // Transaction logged, but not committed + if (rc) return RESULT_INCONSISTENT; // Transaction logged, but not committed /* If cookie is non-zero, something was logged */ if (cookie) unlog(cookie, xid); diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 39d95db5bdc7..0b6fe35fc131 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -23,10 +23,10 @@ #include "sql/debug_sync.h" #include "sql/mysqld.h" #include "sql/mysqld_thd_manager.h" +#include "sql/protocol_classic.h" #include "sql/sql_audit.h" #include "sql/sql_class.h" #include "sql/sql_connect.h" -#include "sql/protocol_classic.h" #include "sql/sql_parse.h" #include "sql/threadpool.h" #include "violite.h" diff --git a/sql/threadpool_unix.cc b/sql/threadpool_unix.cc index 22c017708f3b..400c402d8c59 100644 --- a/sql/threadpool_unix.cc +++ b/sql/threadpool_unix.cc @@ -26,11 +26,11 @@ #include "sql/log.h" #include "sql/mysqld.h" #include "sql/mysqld_thd_manager.h" +#include "sql/protocol_classic.h" #include "sql/sql_class.h" #include "sql/sql_connect.h" #include "sql/sql_plist.h" #include "sql/threadpool.h" -#include "sql/protocol_classic.h" #include "violite.h" #ifdef __linux__ #include diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc index f99efaca1a2a..ca083db83b55 100644 --- a/sql/threadpool_win.cc +++ b/sql/threadpool_win.cc @@ -460,9 +460,9 @@ bool tp_init(void) { } } - /* - Control stack size (OS must be Win7 or later, plus corresponding SDK) - */ + /* + Control stack size (OS must be Win7 or later, plus corresponding SDK) + */ #if _MSC_VER >= 1600 if (SetThreadpoolStackInformation) { TP_POOL_STACK_INFORMATION stackinfo; diff --git a/sql/uniques.cc b/sql/uniques.cc index d94b83afd6d0..9ccf00052219 100644 --- a/sql/uniques.cc +++ b/sql/uniques.cc @@ -658,8 +658,8 @@ void Unique::reset() { */ if (elements) { file_ptrs.clear(); - [[maybe_unused]] - int reinit_res = reinit_io_cache(&file, WRITE_CACHE, 0L, false, true); + [[maybe_unused]] int reinit_res = + reinit_io_cache(&file, WRITE_CACHE, 0L, false, true); assert(reinit_res == 0); } /* diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index 5bfda8b96dec..a4c6738a28bc 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -28,8 +28,8 @@ #include "sql/handler.h" /* handler */ #include "sql/key.h" #include "sql/sql_const.h" /* MAX_KEY */ -#include "sql/table.h" /* TABLE_SHARE */ -#include "thr_lock.h" /* THR_LOCK */ +#include "sql/table.h" /* TABLE_SHARE */ +#include "thr_lock.h" /* THR_LOCK */ class String; class THD; diff --git a/storage/heap/hp_record.cc b/storage/heap/hp_record.cc index e1928e11f36e..254a5c881a66 100644 --- a/storage/heap/hp_record.cc +++ b/storage/heap/hp_record.cc @@ -66,9 +66,9 @@ uint hp_get_encoded_data_length(const HP_SHARE &info, const uchar *record, /* >= 5.0.3 true VARCHAR */ pack_length = column->length_bytes; - length = pack_length + (pack_length == 1 - ? (uint) * (const uchar *)(record + src_offset) - : uint2korr(record + src_offset)); + length = pack_length + + (pack_length == 1 ? (uint) * (const uchar *)(record + src_offset) + : uint2korr(record + src_offset)); } else if (is_blob_column(column)) { uint pack_length = column->length_bytes; @@ -129,9 +129,9 @@ static inline bool hp_process_field_data_to_chunkset( while (length > 0) { uint to_copy = info.recordspace.chunk_dataspace_length - dst_offset; if (to_copy == 0) { - /* Jump to the next chunk */ + /* Jump to the next chunk */ #if !defined(NDEBUG) && defined(EXTRA_HEAP_DEBUG) - dump_chunk(info, curr_chunk); + dump_chunk(info, curr_chunk); #endif memcpy(&curr_chunk, curr_chunk + info.recordspace.offset_link, sizeof(uchar *)); diff --git a/storage/heap/hp_rrnd.cc b/storage/heap/hp_rrnd.cc index 16f394aeb25d..324135622014 100644 --- a/storage/heap/hp_rrnd.cc +++ b/storage/heap/hp_rrnd.cc @@ -53,8 +53,7 @@ int heap_rrnd(HP_INFO *info, uchar *record, HP_HEAP_POSITION *pos) { return HA_ERR_RECORD_DELETED; } info->update = HA_STATE_PREV_FOUND | HA_STATE_NEXT_FOUND | HA_STATE_AKTIV; - if (hp_extract_record(info, record, info->current_ptr)) - return my_errno(); + if (hp_extract_record(info, record, info->current_ptr)) return my_errno(); // reposition scan state also info->current_record = pos->record_no; diff --git a/storage/heap/hp_rsame.cc b/storage/heap/hp_rsame.cc index a9361dcd38d6..fda6d545ac8f 100644 --- a/storage/heap/hp_rsame.cc +++ b/storage/heap/hp_rsame.cc @@ -54,8 +54,7 @@ int heap_rsame(HP_INFO *info, uchar *record, int inx) { return my_errno(); } } - if (hp_extract_record(info, record, info->current_ptr)) - return my_errno(); + if (hp_extract_record(info, record, info->current_ptr)) return my_errno(); return 0; } diff --git a/storage/heap/hp_scan.cc b/storage/heap/hp_scan.cc index ec461fcc46cd..3e7722f0c7dc 100644 --- a/storage/heap/hp_scan.cc +++ b/storage/heap/hp_scan.cc @@ -41,7 +41,7 @@ int heap_scan_init(HP_INFO *info) { info->lastinx = -1; info->current_record = (ulong)~0L; /* No current record */ info->update = 0; - //info->next_block = 0; + // info->next_block = 0; return 0; } diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index ac067ccd4124..bff7fcb16ee5 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -1271,9 +1271,9 @@ void btr_search_drop_page_hash_when_freed(const page_id_t &page_id, ut_d(export_vars.innodb_ahi_drop_lookups++); /* Sleep 10ms */ - DBUG_EXECUTE_IF( - "simulate_long_ahi", - std::this_thread::sleep_for(std::chrono::milliseconds(10));;); + DBUG_EXECUTE_IF("simulate_long_ahi", + std::this_thread::sleep_for(std::chrono::milliseconds(10)); + ;); mtr_start(&mtr); diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 082941774f6e..96f329de5066 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -287,9 +287,9 @@ bool buf_read_page(const page_id_t &page_id, const page_size_t &page_size, ulint count; dberr_t err; - count = buf_read_page_low(&err, true, IORequest::Type::UNSET, - BUF_READ_ANY_PAGE, page_id, page_size, false, trx, - false); + count = + buf_read_page_low(&err, true, IORequest::Type::UNSET, BUF_READ_ANY_PAGE, + page_id, page_size, false, trx, false); srv_stats.buf_pool_reads.add(count); diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index abcfbc4cfc9d..c7657ff939e1 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -468,8 +468,8 @@ ut::Expected SysTablespace::read_encryption_metadata() { Encryption_key encryption_key{encryption_metadata.m_key, encryption_metadata.m_iv}; const auto err = - fsp_header_validate(page.get(), space_id(), space_flags_on_disk, - filepath, false, encryption_key); + fsp_header_validate(page.get(), space_id(), space_flags_on_disk, filepath, + false, encryption_key); if (err != DB_SUCCESS) { return ut::Unexpected(err); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 22445e597edf..d5098a13fc74 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5838,13 +5838,13 @@ static int innodb_init(void *p) { innobase_hton->lock_hton_log = innobase_lock_hton_log; innobase_hton->unlock_hton_log = innobase_unlock_hton_log; innobase_hton->collect_hton_log_info = innobase_collect_hton_log_info; - innobase_hton->flags = HTON_SUPPORTS_EXTENDED_KEYS | - HTON_SUPPORTS_FOREIGN_KEYS | HTON_SUPPORTS_ATOMIC_DDL | - HTON_CAN_RECREATE | HTON_SUPPORTS_SECONDARY_ENGINE | - HTON_SUPPORTS_TABLE_ENCRYPTION | - HTON_SUPPORTS_GENERATED_INVISIBLE_PK | - HTON_SUPPORTS_BULK_LOAD | HTON_SUPPORTS_SQL_FK | - HTON_SUPPORTS_ONLINE_BACKUPS | HTON_SUPPORTS_COMPRESSED_COLUMNS; + innobase_hton->flags = + HTON_SUPPORTS_EXTENDED_KEYS | HTON_SUPPORTS_FOREIGN_KEYS | + HTON_SUPPORTS_ATOMIC_DDL | HTON_CAN_RECREATE | + HTON_SUPPORTS_SECONDARY_ENGINE | HTON_SUPPORTS_TABLE_ENCRYPTION | + HTON_SUPPORTS_GENERATED_INVISIBLE_PK | HTON_SUPPORTS_BULK_LOAD | + HTON_SUPPORTS_SQL_FK | HTON_SUPPORTS_ONLINE_BACKUPS | + HTON_SUPPORTS_COMPRESSED_COLUMNS; // TODO(WL9440): to be enabled when distance scan is implemented in innodb. //| HTON_SUPPORTS_DISTANCE_SCAN; diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 82bd22d0df8f..6d9b32cdaa62 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -439,7 +439,6 @@ class ha_innobase : public handler { dd::Table *new_dd_tab) override; /** @} */ - using Reader = Parallel_reader_adapter; /** Initializes a parallel scan. It creates a scan_ctx that has to @@ -1499,10 +1498,9 @@ will be closed before the index creation/drop. @param[in,out] share share structure where index translation table will be constructed in. @return true if index translation table built successfully */ -[[nodiscard]] -bool innobase_build_index_translation(const TABLE *table, - dict_table_t *ib_table, - INNOBASE_SHARE *share); +[[nodiscard]] bool innobase_build_index_translation(const TABLE *table, + dict_table_t *ib_table, + INNOBASE_SHARE *share); uint innodb_force_index_records_in_range(THD *thd); uint innodb_records_in_range(THD *thd); diff --git a/storage/innobase/handler/ha_innopart.cc b/storage/innobase/handler/ha_innopart.cc index b092c304bc1b..ce57aed1e477 100644 --- a/storage/innobase/handler/ha_innopart.cc +++ b/storage/innobase/handler/ha_innopart.cc @@ -2900,7 +2900,6 @@ int ha_innopart::discard_or_import_tablespace(bool discard, return error; } - /** Compare key and rowid. Helper function for sorting records in the priority queue. a/b points to table->record[0] rows which must have the diff --git a/storage/innobase/handler/ha_innopart.h b/storage/innobase/handler/ha_innopart.h index 9af64cb9658c..c10893233145 100644 --- a/storage/innobase/handler/ha_innopart.h +++ b/storage/innobase/handler/ha_innopart.h @@ -388,7 +388,6 @@ class ha_innopart : public ha_innobase, int discard_or_import_tablespace(bool discard, dd::Table *table_def) override; - /** Compare key and rowid. Helper function for sorting records in the priority queue. a/b points to table->record[0] rows which must have the diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index 495b31a4092e..643ed1a1dc9e 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -41,9 +41,11 @@ this program; if not, write to the Free Software Foundation, Inc., #endif /* !UNIV_HOTBACKUP */ #ifndef UNIV_HOTBACKUP -static inline buf_block_t *btr_block_get_func( - const page_id_t &page_id, const page_size_t &page_size, ulint mode, - ut::Location location, const dict_index_t *index, mtr_t *mtr) { +static inline buf_block_t *btr_block_get_func(const page_id_t &page_id, + const page_size_t &page_size, + ulint mode, ut::Location location, + const dict_index_t *index, + mtr_t *mtr) { buf_block_t *block; block = buf_page_get_gen(page_id, page_size, mode, nullptr, diff --git a/storage/innobase/include/data0data.h b/storage/innobase/include/data0data.h index 72ff245cd762..e7da479e7111 100644 --- a/storage/innobase/include/data0data.h +++ b/storage/innobase/include/data0data.h @@ -284,8 +284,8 @@ occupied by the field structs or the tuple struct is not counted. @param[in] tuple typed data tuple @param[in] comp nonzero=ROW_FORMAT=COMPACT @return sum of data lens */ -[[nodiscard]] -static inline ulint dtuple_get_data_size(const dtuple_t *tuple, ulint comp); +[[nodiscard]] static inline ulint dtuple_get_data_size(const dtuple_t *tuple, + ulint comp); /** Compare two data tuples. @param[in] tuple1 first data tuple @param[in] tuple2 second data tuple diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic index 716d2311ec89..01015d3aab8a 100644 --- a/storage/innobase/include/data0type.ic +++ b/storage/innobase/include/data0type.ic @@ -595,7 +595,8 @@ depending on precise column type. @reval 0 if prtype does not include DATA_COMPRESSED flag @reval ZIP_COLUMN_HEADER_LENGTH if prtype includes DATA_COMPRESSED flag */ -static inline ulint prtype_get_compression_extra(ulint prtype) /*!< in: precise type */ +static inline ulint prtype_get_compression_extra( + ulint prtype) /*!< in: precise type */ { return (prtype & DATA_COMPRESSED) != 0 ? ZIP_COLUMN_HEADER_LENGTH : 0; } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 6f65a14b07c7..abc20d902234 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -52,7 +52,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include "row0types.h" #include "sql/dd/object_id.h" #include "sql/dd/types/init_mode.h" // dict_init_mode_t -#include "srv0mon.h" /* for dict0dict.ic */ +#include "srv0mon.h" /* for dict0dict.ic */ #include "sync0rw.h" #include "trx0types.h" #include "univ.i" diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 8989e87aafbf..f10d8499ea4a 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -343,10 +343,11 @@ class fil_node_t { from another thread, when @p sync is false, before or after this call returns. @return DB_SUCCESS if IO was successfully posted, error code otherwise */ - [[nodiscard]] dberr_t post_io_async( - IORequest &type, byte *buf, size_t buffer_len, page_no_t page_no, - std::function callback, trx_t *trx = nullptr, - bool should_buffer = false) const; + [[nodiscard]] dberr_t post_io_async(IORequest &type, byte *buf, + size_t buffer_len, page_no_t page_no, + std::function callback, + trx_t *trx = nullptr, + bool should_buffer = false) const; #endif /* !UNIV_HOTBACKUP */ /** Returns true iff the node is currently opened and allows IO operations. */ diff --git a/storage/innobase/include/fil0innodb_tablespace_node_handle.h b/storage/innobase/include/fil0innodb_tablespace_node_handle.h index ed3fff35fc2b..27e34ac1ffcc 100644 --- a/storage/innobase/include/fil0innodb_tablespace_node_handle.h +++ b/storage/innobase/include/fil0innodb_tablespace_node_handle.h @@ -47,8 +47,7 @@ class Tablespace_node_handle final : public Tablespace_node_handle_interface { bool optimize_writes) override; [[nodiscard]] Status_IO read_page(IORequest req, byte *buffer, - Page_number page_no, - trx_t *trx) override; + Page_number page_no, trx_t *trx) override; #ifndef UNIV_HOTBACKUP [[nodiscard]] Status_IO read_page_async(IORequest req, byte *buffer, diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index a140a21b75fe..ef6bbcd1b034 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -794,8 +794,7 @@ uint32_t fsp_flags_to_dict_tf(uint32_t fsp_flags, bool compact); /** Enable encryption for already existing tablespace. @param[in,out] space tablespace object @return true if success, else false */ -[[nodiscard]] -bool fsp_enable_encryption(fil_space_t *space); +[[nodiscard]] bool fsp_enable_encryption(fil_space_t *space); /** Calculates the descriptor index within a descriptor page. @param[in] page_size page size diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index a0849317e5f8..4f48c2858396 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -227,8 +227,7 @@ void thd_set_lock_wait_time(THD *thd, /** Is FT ignore stopwords variable set. @param thd Thread object @return true if ft_ignore_stopwords is set, false otherwise. */ -[[nodiscard]] -bool thd_has_ft_ignore_stopwords(THD *thd) noexcept; +[[nodiscard]] bool thd_has_ft_ignore_stopwords(THD *thd) noexcept; /** Get the value of innodb_tmpdir. @param[in] thd thread handle, or nullptr to query the global innodb_tmpdir. @@ -471,8 +470,7 @@ void innobase_commit_low(trx_t *trx); /** Get the transaction of the current connection handle if slow query log InnoDB extended statistics should be collected. @return transaction object if statistics should be collected, or NULL. */ -[[nodiscard]] -trx_t *innobase_get_trx_for_slow_log(void) noexcept; +[[nodiscard]] trx_t *innobase_get_trx_for_slow_log(void) noexcept; extern bool innodb_inited; diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index d7c507334dd7..e41016ba42b9 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1020,7 +1020,7 @@ The wrapper functions have the prefix of "innodb_". */ UT_LOCATION_HERE) #define os_file_read_trx_pfs(type, file_name, file, buf, offset, n, trx) \ - pfs_os_file_read_func(type, file_name, file, buf, offset, n, trx, \ + pfs_os_file_read_func(type, file_name, file, buf, offset, n, trx, \ UT_LOCATION_HERE) #define os_file_read_first_page_pfs(type, file_name, file, buf, n_pages, exit) \ @@ -1435,8 +1435,8 @@ to original un-instrumented file I/O APIs */ #define os_file_read_first_page(type, file_name, file, buf, n_pages) \ os_file_read_first_page_pfs(type, file_name, file, buf, n_pages, true) #else -#define os_file_read_first_page(type, file_name, file, buf, n_pages) \ - os_file_read_first_page_pfs(type, file_name, (file).m_file, buf, n_pages, \ +#define os_file_read_first_page(type, file_name, file, buf, n_pages) \ + os_file_read_first_page_pfs(type, file_name, (file).m_file, buf, n_pages, \ true) #endif diff --git a/storage/innobase/include/os0thread.h b/storage/innobase/include/os0thread.h index a31e56307d5c..af67743b7982 100644 --- a/storage/innobase/include/os0thread.h +++ b/storage/innobase/include/os0thread.h @@ -202,8 +202,7 @@ Linux. Currently a no-op on other systems. @param[in] thread_id thread id @param[in] relative_priority system-specific priority value @return An actual thread priority after the update */ -[[nodiscard]] -unsigned long int os_thread_set_priority( +[[nodiscard]] unsigned long int os_thread_set_priority( os_tid_t thread_id, unsigned long int relative_priority) noexcept; #endif /* !os0thread_h */ diff --git a/storage/innobase/include/row0log.h b/storage/innobase/include/row0log.h index 16fb6d433cb9..9ef688b3fe72 100644 --- a/storage/innobase/include/row0log.h +++ b/storage/innobase/include/row0log.h @@ -212,8 +212,7 @@ ulint row_log_estimate_work(const dict_index_t *index); /** Find out if temporary log files encrypted. @return true if temporary log file should be encrypted, false if not */ -[[nodiscard]] -bool log_tmp_is_encrypted() noexcept; +[[nodiscard]] bool log_tmp_is_encrypted() noexcept; /** Check the row log encryption is enabled or not. It will enable the row log encryption. */ @@ -226,9 +225,9 @@ void log_tmp_enable_encryption_if_set(); @param[in] offs offset to block @param[in] space_id tablespace id @return whether the operation succeeded */ -[[nodiscard]] -bool log_tmp_block_encrypt(const byte *src_block, ulint size, byte *dst_block, - os_offset_t offs, space_id_t space_id); +[[nodiscard]] bool log_tmp_block_encrypt(const byte *src_block, ulint size, + byte *dst_block, os_offset_t offs, + space_id_t space_id); /** Decrypt a temporary file block. @param[in] src_block block to decrypt @@ -237,9 +236,9 @@ bool log_tmp_block_encrypt(const byte *src_block, ulint size, byte *dst_block, @param[in] offs offset to block @param[in] space_id tablespace id @return whether the operation succeeded */ -[[nodiscard]] -bool log_tmp_block_decrypt(const byte *src_block, ulint size, byte *dst_block, - os_offset_t offs, space_id_t space_id); +[[nodiscard]] bool log_tmp_block_decrypt(const byte *src_block, ulint size, + byte *dst_block, os_offset_t offs, + space_id_t space_id); #include "row0log.ic" diff --git a/storage/innobase/include/row0vers.h b/storage/innobase/include/row0vers.h index 1aa2535212bc..4f5429729ea1 100644 --- a/storage/innobase/include/row0vers.h +++ b/storage/innobase/include/row0vers.h @@ -78,19 +78,19 @@ bool row_vers_must_preserve_del_marked(trx_id_t trx_id, this case we return true. @return true if earlier version should have */ bool row_vers_old_has_index_entry( - bool also_curr, /*!< in: true if also rec is included in the - versions to search; otherwise only versions - prior to it are searched */ - const rec_t *rec, /*!< in: record in the clustered index; the - caller must have a latch on the page */ - mtr_t *mtr, /*!< in: mtr holding the latch on rec; it will - also hold the latch on purge_view */ - dict_index_t *index, /*!< in: the secondary index */ - const dtuple_t *ientry, /*!< in: the secondary index entry */ - roll_ptr_t roll_ptr, /*!< in: roll_ptr for the purge record */ - trx_id_t trx_id, /*!< in: transaction ID on the purging record */ - row_prebuilt_t *prebuilt); /*!< in: compress_heap must be taken from - here */ + bool also_curr, /*!< in: true if also rec is included in the + versions to search; otherwise only versions + prior to it are searched */ + const rec_t *rec, /*!< in: record in the clustered index; the + caller must have a latch on the page */ + mtr_t *mtr, /*!< in: mtr holding the latch on rec; it will + also hold the latch on purge_view */ + dict_index_t *index, /*!< in: the secondary index */ + const dtuple_t *ientry, /*!< in: the secondary index entry */ + roll_ptr_t roll_ptr, /*!< in: roll_ptr for the purge record */ + trx_id_t trx_id, /*!< in: transaction ID on the purging record */ + row_prebuilt_t *prebuilt); /*!< in: compress_heap must be taken from + here */ /** Constructs the version of a clustered index record which a consistent read should see. We assume that the trx id stored in rec is such that diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 8c6b1cc0f819..92ea8f725864 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -1255,8 +1255,7 @@ void srv_master_thread_disabled_debug_update(THD *thd, SYS_VAR *var, innodb_temp_tablespace_encrypt is TRUE @param[in] enable true to enable encryption, false to disable @return DB_SUCCESS on success, DB_ERROR on failure */ -[[nodiscard]] -dberr_t srv_temp_encryption_update(bool enable); +[[nodiscard]] dberr_t srv_temp_encryption_update(bool enable); /** Status variables to be passed to MySQL */ struct export_var_t { diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index fa377623b7d7..8e1c7e34affa 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -222,8 +222,8 @@ transaction. @param[in] trx receiver transaction @param[in] from_trx donor transaction @return read view clone */ -[[nodiscard]] -Read_view_interface *trx_clone_read_view(trx_t *trx, trx_t *from_trx); +[[nodiscard]] Read_view_interface *trx_clone_read_view(trx_t *trx, + trx_t *from_trx); /** Prepares a transaction for commit/rollback. */ void trx_commit_or_rollback_prepare(trx_t *trx); /*!< in/out: transaction */ @@ -704,8 +704,7 @@ class trx_stats final { already posted read in progress @return value to be passed to end_io_read */ - [[nodiscard]] - static std::chrono::steady_clock::time_point start_io_read( + [[nodiscard]] static std::chrono::steady_clock::time_point start_io_read( trx_t *trx, ulint bytes) noexcept; /** @@ -716,8 +715,7 @@ class trx_stats final { already posted read in progress @return value to be passed to end_io_read */ - [[nodiscard]] - static std::chrono::steady_clock::time_point start_io_read( + [[nodiscard]] static std::chrono::steady_clock::time_point start_io_read( const trx_t &trx, ulint bytes) noexcept; /** @@ -795,8 +793,7 @@ class trx_stats final { @param page_id_fold result of page_id_t::fold */ static void inc_page_get(const trx_t &trx, ulint page_id_fold) noexcept; - [[nodiscard]] - bool enabled() const noexcept { return take_stats; } + [[nodiscard]] bool enabled() const noexcept { return take_stats; } void set(bool take) noexcept { take_stats = take; } diff --git a/storage/innobase/include/ut0mutex.ic b/storage/innobase/include/ut0mutex.ic index 3fe31097ff3c..6643a90354e4 100644 --- a/storage/innobase/include/ut0mutex.ic +++ b/storage/innobase/include/ut0mutex.ic @@ -50,8 +50,8 @@ bool TTASEventMutex::wait(const char *filename, uint32_t line, sync_cell_t *cell; sync_array_t *sync_arr; latch_id_t latch_id = m_policy.get_id(); - ulint type = SYNC_MUTEX; - + ulint type = SYNC_MUTEX; + if (latch_id == LATCH_ID_BUF_BLOCK_MUTEX || latch_id == LATCH_ID_BUF_POOL_ZIP) { type = SYNC_BUF_BLOCK; @@ -180,10 +180,8 @@ bool TTASEventMutex::wait(const char *filename, uint32_t line, So, Y2 can not load `false` neither. Contradiction ends the proof. */ - sync_arr = sync_array_get_and_reserve_cell( - this, - type, - {filename, line}, &cell); + sync_arr = + sync_array_get_and_reserve_cell(this, type, {filename, line}, &cell); /* The memory order of the array reservation and the change in the waiters field is important: when @@ -194,11 +192,11 @@ bool TTASEventMutex::wait(const char *filename, uint32_t line, set_waiters(); - DBUG_EXECUTE_IF("catch_autoinc_mutex_os_lock", - if (m_policy.get_id() == LATCH_ID_AUTOINC) { - DEBUG_SYNC_C("autoinc_mutex_wait"); - } - ); + DBUG_EXECUTE_IF( + "catch_autoinc_mutex_os_lock", + if (m_policy.get_id() == LATCH_ID_AUTOINC) { + DEBUG_SYNC_C("autoinc_mutex_wait"); + }); /* Try to reserve still a few times. */ diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 6ba39623345a..6dfda9ce0d43 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2565,8 +2565,8 @@ void AIO::os_aio_dispatch_read_array_submit_low(bool acquire_mutex) { (low level function). @param[in] acquire_mutex specifies whether to lock array mutex @param[in] arr for which to submit IO */ -void AIO::os_aio_dispatch_read_array_submit_low_for_array( - bool acquire_mutex, const AIO *array) { +void AIO::os_aio_dispatch_read_array_submit_low_for_array(bool acquire_mutex, + const AIO *array) { ulint total_submitted = 0; if (acquire_mutex) { array->acquire(); @@ -5053,12 +5053,9 @@ NUM_RETRIES_ON_PARTIAL_IO times to read/write the complete data. @param[out] o number of bytes actually read @param[in] exit_on_err if true then exit on error @return DB_SUCCESS or error code */ -[[nodiscard]] static dberr_t os_file_read_page(const IORequest &type, - const char *file_name, - os_file_t file, byte *buf, - os_offset_t offset, ulint n, - ulint *o, bool exit_on_err, - trx_t *trx) { +[[nodiscard]] static dberr_t os_file_read_page( + const IORequest &type, const char *file_name, os_file_t file, byte *buf, + os_offset_t offset, ulint n, ulint *o, bool exit_on_err, trx_t *trx) { dberr_t err(DB_ERROR_UNSET); #ifdef UNIV_HOTBACKUP diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc index cd68c52848c4..8324d04f9661 100644 --- a/storage/innobase/os/os0thread.cc +++ b/storage/innobase/os/os0thread.cc @@ -144,9 +144,8 @@ no-op on other systems. @param[in] relative_priority system-specific priority value @return An actual thread priority after the update */ -[[nodiscard]] -ulint os_thread_set_priority(os_tid_t thread_id, - ulint relative_priority) noexcept { +[[nodiscard]] ulint os_thread_set_priority(os_tid_t thread_id, + ulint relative_priority) noexcept { #ifdef UNIV_LINUX const lint thread_nice = 19 - relative_priority; if (setpriority(PRIO_PROCESS, thread_id, thread_nice) == -1) { diff --git a/storage/innobase/rem/rec.cc b/storage/innobase/rem/rec.cc index bd63dbccacc1..11decf02e767 100644 --- a/storage/innobase/rem/rec.cc +++ b/storage/innobase/rem/rec.cc @@ -334,7 +334,7 @@ void rec_init_offsets(const rec_t *rec, const dict_index_t *index, } else { len = offs += field->fixed_len; } -resolved: + resolved: rec_offs_base(offsets)[i + 1] = len; } while (++i < rec_offs_n_fields(offsets)); diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index e1ed1d82cb16..48ccaf99136a 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -2372,9 +2372,9 @@ It is then unmarked. Otherwise, the entry is just inserted to the index. /** It allows to create tuple with virtual column information. */ dtuple_t *entry = row_build_index_entry_low(row, nullptr, index, heap, ROW_BUILD_FOR_INSERT); - upd_t *update = row_upd_build_difference_binary(index, entry, pcur.get_rec(), - cur_offsets, false, nullptr, - heap, dup->m_table, thr->prebuilt, &error); + upd_t *update = row_upd_build_difference_binary( + index, entry, pcur.get_rec(), cur_offsets, false, nullptr, heap, + dup->m_table, thr->prebuilt, &error); if (error != DB_SUCCESS) { goto func_exit; } diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index a439e39a4f87..cdcd2661dc9d 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -287,10 +287,10 @@ bool row_purge_poss_sec(purge_node_t *node, /*!< in/out: row purge node */ ut_ad(!index->is_clustered()); mtr_start(&mtr); - can_delete = - !row_purge_reposition_pcur(BTR_SEARCH_LEAF, node, &mtr) || - !row_vers_old_has_index_entry(true, node->pcur.get_rec(), &mtr, index, - entry, node->roll_ptr, node->trx_id, prebuilt); + can_delete = !row_purge_reposition_pcur(BTR_SEARCH_LEAF, node, &mtr) || + !row_vers_old_has_index_entry(true, node->pcur.get_rec(), &mtr, + index, entry, node->roll_ptr, + node->trx_id, prebuilt); /* Persistent cursor is closed if reposition fails. */ if (node->found_clust) { diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc index dc60f12bd2ef..9104966d4abd 100644 --- a/storage/innobase/row/row0umod.cc +++ b/storage/innobase/row/row0umod.cc @@ -490,8 +490,7 @@ introduced where a call to log_free_check() is bypassed. */ ut_a(success); old_has = row_vers_old_has_index_entry(false, node->pcur.get_rec(), &mtr_vers, - index, entry, 0, 0, - thr->prebuilt); + index, entry, 0, 0, thr->prebuilt); if (old_has) { err = btr_cur_del_mark_set_sec_rec(BTR_NO_LOCKING_FLAG, btr_cur, true, thr, &mtr); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index bd1575044b35..920002d0ce3e 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1185,8 +1185,8 @@ static dberr_t srv_open_tmp_tablespace(ib::fsp::SysTablespace &tmp_space) { fsp_flags_set_encryption((*space)->flags); - const auto encryption_err = fil_set_encryption( - (*space)->id, Encryption::AES, nullptr, nullptr); + const auto encryption_err = + fil_set_encryption((*space)->id, Encryption::AES, nullptr, nullptr); if (encryption_err != DB_SUCCESS) { fil_space_release(*space); return encryption_err; @@ -1678,8 +1678,7 @@ dberr_t srv_start(bool create_new_db) { ib::info(ER_IB_MSG_1130, size, unit, srv_buf_pool_instances, chunk_size, chunk_unit); - if (const auto err = buf_pool_init(srv_buf_pool_size, - srv_buf_pool_populate, + if (const auto err = buf_pool_init(srv_buf_pool_size, srv_buf_pool_populate, srv_buf_pool_instances); err != DB_SUCCESS) { ib::error(ER_IB_MSG_1131); @@ -1951,10 +1950,9 @@ dberr_t srv_start(bool create_new_db) { return srv_init_abort(DB_ERROR); } - DBUG_EXECUTE_IF("ib_recovery_print_mysql_binlog_offset", - if (recv_needed_recovery) { - trx_sys_print_mysql_binlog_offset(); - }); + DBUG_EXECUTE_IF( + "ib_recovery_print_mysql_binlog_offset", + if (recv_needed_recovery) { trx_sys_print_mysql_binlog_offset(); }); /* Validate a few system page types that were left uninitialized by older versions of MySQL. */ diff --git a/storage/innobase/srv/srv0tmp.cc b/storage/innobase/srv/srv0tmp.cc index 6d226ead21a5..3ea91707031f 100644 --- a/storage/innobase/srv/srv0tmp.cc +++ b/storage/innobase/srv/srv0tmp.cc @@ -201,8 +201,7 @@ void Tablespace::decrypt() { rw_lock_x_unlock(&space->latch); } -void Tablespace::rotate_encryption_key() { -} +void Tablespace::rotate_encryption_key() {} uint32_t Tablespace::file_id() const { return (m_space_id - dict_sys_t::s_min_temp_space_id); diff --git a/storage/myisam/myisamchk.cc b/storage/myisam/myisamchk.cc index e4cb1d414ac0..522b698afcfd 100644 --- a/storage/myisam/myisamchk.cc +++ b/storage/myisam/myisamchk.cc @@ -1083,8 +1083,7 @@ static int myisamchk(MI_CHECK *param, char *filename) { if (param->testflag & (T_EXTEND | T_MEDIUM)) (void)init_key_cache(dflt_key_cache, opt_key_cache_block_size, (size_t)param->use_buffers, 0, 0); - [[maybe_unused]] - int init_res = + [[maybe_unused]] int init_res = init_io_cache(¶m->read_cache, datafile, (uint)param->read_buffer_length, READ_CACHE, (param->start_check_pos ? param->start_check_pos diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index fa2f9333c7e7..097fbb3883fd 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -63,11 +63,11 @@ #include "sql/table.h" /* RocksDB includes */ +#include "env/composite_env_wrapper.h" #include "monitoring/histogram.h" #include "rocksdb/compaction_filter.h" #include "rocksdb/convenience.h" #include "rocksdb/env.h" -#include "env/composite_env_wrapper.h" #include "rocksdb/memory_allocator.h" #include "rocksdb/perf_level.h" #include "rocksdb/persistent_cache.h" @@ -77,12 +77,12 @@ #include "rocksdb/thread_status.h" #include "rocksdb/trace_reader_writer.h" #include "rocksdb/utilities/checkpoint.h" -#include "utilities/fault_injection_fs.h" #include "rocksdb/utilities/memory_util.h" #include "rocksdb/utilities/options_util.h" #include "rocksdb/utilities/sim_cache.h" #include "rocksdb/utilities/write_batch_with_index.h" #include "util/stop_watch.h" +#include "utilities/fault_injection_fs.h" /* MyRocks includes */ #include "./event_listener.h" @@ -1216,7 +1216,6 @@ static TYPELIB index_type_typelib = {array_elements(index_type_names) - 1, "index_type_typelib", index_type_names, nullptr}; - // TODO: 0 means don't wait at all, and we don't support it yet? static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_HINTUPDATEABLE, @@ -2063,7 +2062,8 @@ static MYSQL_SYSVAR_UINT64_T(block_size, rocksdb_tbl_options->block_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "BlockBasedTableOptions::block_size for RocksDB", nullptr, nullptr, rocksdb_tbl_options->block_size, - /* min */ 1024L, /* max */ std::numeric_limits::max(), 0); + /* min */ 1024L, + /* max */ std::numeric_limits::max(), 0); static MYSQL_SYSVAR_BOOL(charge_memory, rocksdb_charge_memory, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, @@ -3040,10 +3040,8 @@ static int rocksdb_compact_column_family(THD *const thd, * be used as a rocksdb transaction name */ static std::string rdb_xid_to_string(const XID &src) { - assert(src.get_gtrid_length() >= 0 && - src.get_gtrid_length() <= MAXGTRIDSIZE); - assert(src.get_bqual_length() >= 0 && - src.get_bqual_length() <= MAXBQUALSIZE); + assert(src.get_gtrid_length() >= 0 && src.get_gtrid_length() <= MAXGTRIDSIZE); + assert(src.get_bqual_length() >= 0 && src.get_bqual_length() <= MAXBQUALSIZE); std::string buf; buf.reserve(RDB_XIDHDR_LEN + src.get_gtrid_length() + src.get_bqual_length()); @@ -5043,9 +5041,7 @@ class Rdb_writebatch_impl : public Rdb_transaction { return m_batch->NewIteratorWithBase(it); } - bool is_tx_started() const override { - return (m_batch != nullptr); - } + bool is_tx_started() const override { return (m_batch != nullptr); } void start_tx() override { reset(); @@ -6435,8 +6431,8 @@ static int rocksdb_init_internal(void *const p) { if (rdb_has_rocksdb_corruption()) { LogPluginErrMsg(ERROR_LEVEL, 0, - "There was corruption detected in the RocksDB data files. " - "Check error log emitted earlier for more details."); + "There was corruption detected in the RocksDB data files. " + "Check error log emitted earlier for more details."); if (rocksdb_allow_to_start_after_corruption) { LogPluginErrMsg(INFORMATION_LEVEL, 0, "Set rocksdb_allow_to_start_after_corruption=0 to " @@ -6523,9 +6519,8 @@ static int rocksdb_init_internal(void *const p) { MY_MUTEX_INIT_FAST); Rdb_transaction::init_mutex(); - DBUG_EXECUTE_IF("rocksdb_init_failure_mutexes_initialized", { - DBUG_RETURN(HA_EXIT_FAILURE); - }); + DBUG_EXECUTE_IF("rocksdb_init_failure_mutexes_initialized", + { DBUG_RETURN(HA_EXIT_FAILURE); }); rocksdb_hton->state = SHOW_OPTION_YES; rocksdb_hton->create = rocksdb_create_handler; @@ -6639,9 +6634,8 @@ static int rocksdb_init_internal(void *const p) { } } - DBUG_EXECUTE_IF("rocksdb_init_failure_reads", { - DBUG_RETURN(HA_EXIT_FAILURE); - }); + DBUG_EXECUTE_IF("rocksdb_init_failure_reads", + { DBUG_RETURN(HA_EXIT_FAILURE); }); if (rocksdb_db_options->allow_mmap_writes && rocksdb_db_options->use_direct_io_for_flush_and_compaction) { @@ -6823,8 +6817,7 @@ static int rocksdb_init_internal(void *const p) { DBUG_RETURN(HA_EXIT_FAILURE); } if (!strlen(rocksdb_persistent_cache_path)) { - LogPluginErrMsg(ERROR_LEVEL, 0, - "Specify rocksdb_persistent_cache_path"); + LogPluginErrMsg(ERROR_LEVEL, 0, "Specify rocksdb_persistent_cache_path"); DBUG_RETURN(HA_EXIT_FAILURE); } @@ -6845,9 +6838,8 @@ static int rocksdb_init_internal(void *const p) { DBUG_RETURN(HA_EXIT_FAILURE); } - DBUG_EXECUTE_IF("rocksdb_init_failure_cache", { - DBUG_RETURN(HA_EXIT_FAILURE); - }); + DBUG_EXECUTE_IF("rocksdb_init_failure_cache", + { DBUG_RETURN(HA_EXIT_FAILURE); }); std::unique_ptr cf_options_map(new Rdb_cf_options()); if (!cf_options_map->init(*rocksdb_tbl_options, properties_collector_factory, @@ -6857,9 +6849,8 @@ static int rocksdb_init_internal(void *const p) { DBUG_RETURN(HA_EXIT_FAILURE); } - DBUG_EXECUTE_IF("rocksdb_init_failure_cf_options", { - DBUG_RETURN(HA_EXIT_FAILURE); - }); + DBUG_EXECUTE_IF("rocksdb_init_failure_cf_options", + { DBUG_RETURN(HA_EXIT_FAILURE); }); /* If there are no column families, we're creating the new database. @@ -7972,8 +7963,8 @@ int ha_rocksdb::alloc_key_buffers(const TABLE &table_arg, const auto m_pack_buffer_offset = buf_size; buf_size += max_packed_sk_len; - buffers.reset(static_cast( - my_malloc(PSI_NOT_INSTRUMENTED, buf_size, MYF(0)))); + buffers.reset( + static_cast(my_malloc(PSI_NOT_INSTRUMENTED, buf_size, MYF(0)))); if (buffers == nullptr) { free_key_buffers(); @@ -10148,8 +10139,8 @@ int ha_rocksdb::get_row_by_rowid(uchar *const buf, const char *const rowid, m_pk_descr->get_keyno() == m_dupp_errkey) { assert(m_lock_rows == RDB_LOCK_WRITE); assert(m_dup_key_tuple.length() == key_slice.size()); - assert( - memcmp(m_dup_key_tuple.ptr(), key_slice.data(), key_slice.size()) == 0); + assert(memcmp(m_dup_key_tuple.ptr(), key_slice.data(), key_slice.size()) == + 0); // We have stored the record with duplicate key in // m_dup_key_retrieved_record during write_row already, so just move it @@ -10988,9 +10979,9 @@ int ha_rocksdb::acquire_prefix_lock(const Rdb_key_def &kd, Rdb_transaction *tx, HA_EXIT_SUCCESS OK other HA_ERR error code (can be SE-specific) */ -int ha_rocksdb::check_and_lock_sk( - const uint key_id, const struct update_row_info &row_info, - bool *const found) { +int ha_rocksdb::check_and_lock_sk(const uint key_id, + const struct update_row_info &row_info, + bool *const found) { assert( (row_info.old_data == table->record[1] && row_info.new_data == table->record[0]) || @@ -11100,8 +11091,8 @@ int ha_rocksdb::check_and_lock_sk( The bloom filter may need to be disabled for this lookup. */ assert(!m_key_descr_arr[key_id]->is_partial_index()); - Rdb_iterator_base iter(ha_thd(), *m_key_descr_arr[key_id], - *m_pk_descr, m_tbl_def); + Rdb_iterator_base iter(ha_thd(), *m_key_descr_arr[key_id], *m_pk_descr, + m_tbl_def); /* If all_parts_used is true, then PK uniqueness check/lock would already @@ -11131,8 +11122,7 @@ int ha_rocksdb::check_and_lock_sk( const rocksdb::Slice &rkey = all_parts_used ? new_slice : iter.key(); uint pk_size = kd.get_primary_key_tuple(*m_pk_descr, &rkey, m_pk_packed_tuple); - DBUG_EXECUTE_IF( - "simulate_corrupt_data_update", + DBUG_EXECUTE_IF("simulate_corrupt_data_update", { pk_size = RDB_INVALID_KEY_LEN; }); if (pk_size == RDB_INVALID_KEY_LEN) { rc = handle_rocksdb_corrupt_data_error(); @@ -11913,9 +11903,8 @@ int ha_rocksdb::index_init(uint idx, bool sorted) { new Rdb_iterator_partial(thd, *m_key_descr_arr[active_index_pos()], *m_pk_descr, m_tbl_def, table, dd_table)); } else { - m_iterator.reset(new Rdb_iterator_base(thd, - *m_key_descr_arr[active_index_pos()], - *m_pk_descr, m_tbl_def)); + m_iterator.reset(new Rdb_iterator_base( + thd, *m_key_descr_arr[active_index_pos()], *m_pk_descr, m_tbl_def)); } // If m_lock_rows is not RDB_LOCK_NONE then we will be doing a get_for_update diff --git a/storage/rocksdb/ib_ut0counter.h b/storage/rocksdb/ib_ut0counter.h index e8b36ac277fb..ce535cc99418 100644 --- a/storage/rocksdb/ib_ut0counter.h +++ b/storage/rocksdb/ib_ut0counter.h @@ -28,9 +28,9 @@ this program; if not, write to the Free Software Foundation, Inc., #define UT0COUNTER_H #include -#include "my_dbug.h" #include #include +#include "my_dbug.h" /** CPU cache line size */ #define INNOBASE_CACHE_LINE_SIZE 64 diff --git a/storage/rocksdb/rdb_cf_options.h b/storage/rocksdb/rdb_cf_options.h index cab2db2aa735..26c5e3f11096 100644 --- a/storage/rocksdb/rdb_cf_options.h +++ b/storage/rocksdb/rdb_cf_options.h @@ -56,7 +56,7 @@ class Rdb_cf_options { /* bool true return indicates cf_name was found */ [[nodiscard]] bool get(const std::string &cf_name, - rocksdb::ColumnFamilyOptions *const opts); + rocksdb::ColumnFamilyOptions *const opts); void update(const std::string &cf_name, const std::string &cf_options); diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc index f0a5b8e06071..95b2a2655309 100644 --- a/storage/rocksdb/rdb_datadic.cc +++ b/storage/rocksdb/rdb_datadic.cc @@ -44,7 +44,6 @@ #include "myisampack.h" #include "mysql/strings/m_ctype.h" #include "mysql/thread_pool_priv.h" -#include "strings/m_ctype_internals.h" #include "sql/dd/cache/dictionary_client.h" // dd::cache::Dictionary_client #include "sql/field.h" #include "sql/key.h" @@ -52,6 +51,7 @@ #include "sql/sql_class.h" #include "sql/sql_table.h" #include "sql/table.h" +#include "strings/m_ctype_internals.h" /* MyRocks header files */ #include "./ha_rocksdb.h" @@ -4292,12 +4292,11 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr, // VARCHARs - are compared as if they were space-padded - but are // not actually space-padded (reading the value back produces the // original value, without the padding) - m_unpack_func = - (cs == &my_charset_utf8mb4_bin) - ? Rdb_key_def::unpack_utf8mb4_varlength_space_pad - : (cs == &my_charset_utf8mb3_bin) - ? Rdb_key_def::unpack_utf8_varlength_space_pad - : Rdb_key_def::unpack_binary_varlength_space_pad; + m_unpack_func = (cs == &my_charset_utf8mb4_bin) + ? Rdb_key_def::unpack_utf8mb4_varlength_space_pad + : (cs == &my_charset_utf8mb3_bin) + ? Rdb_key_def::unpack_utf8_varlength_space_pad + : Rdb_key_def::unpack_binary_varlength_space_pad; m_skip_func = Rdb_key_def::skip_variable_space_pad; m_pack_func = Rdb_key_def::pack_with_varlength_space_pad; @@ -4313,11 +4312,10 @@ bool Rdb_field_packing::setup(const Rdb_key_def *const key_descr, // SQL layer pads CHAR(N) values to their maximum length. // We just store that and restore it back. assert(m_make_unpack_info_func == nullptr); - m_unpack_func = (cs == &my_charset_utf8mb4_bin) - ? Rdb_key_def::unpack_utf8mb4_str - : (cs == &my_charset_utf8mb3_bin) - ? Rdb_key_def::unpack_utf8_str - : Rdb_key_def::unpack_binary_str; + m_unpack_func = + (cs == &my_charset_utf8mb4_bin) ? Rdb_key_def::unpack_utf8mb4_str + : (cs == &my_charset_utf8mb3_bin) ? Rdb_key_def::unpack_utf8_str + : Rdb_key_def::unpack_binary_str; } m_covered = Rdb_key_def::KEY_COVERED; } else { @@ -5768,14 +5766,14 @@ bool Rdb_dict_manager::get_index_info( if (error) { LogPluginErrMsg(ERROR_LEVEL, 0, - "Found invalid key version number (%hu" - ", %hhu, %hu" - ", %" PRIu64 - ") from data dictionary. This should never happen " - "and it may be a bug.", - index_info->m_index_dict_version, index_info->m_index_type, - index_info->m_kv_version, index_info->m_ttl_duration); - abort(); + "Found invalid key version number (%hu" + ", %hhu, %hu" + ", %" PRIu64 + ") from data dictionary. This should never happen " + "and it may be a bug.", + index_info->m_index_dict_version, index_info->m_index_type, + index_info->m_kv_version, index_info->m_ttl_duration); + abort(); } return found; diff --git a/storage/rocksdb/rdb_index_merge.h b/storage/rocksdb/rdb_index_merge.h index c58f080a25c4..95aece446faa 100644 --- a/storage/rocksdb/rdb_index_merge.h +++ b/storage/rocksdb/rdb_index_merge.h @@ -80,7 +80,7 @@ class Rdb_index_merge { ulonglong m_curr_offset; /* offset of the record pointer for the block */ ulonglong m_disk_start_offset; /* where the chunk starts on disk */ ulonglong m_disk_curr_offset; /* current offset on disk */ - uint64 m_total_size; /* total # of data bytes in chunk */ + uint64 m_total_size; /* total # of data bytes in chunk */ void store_key_value(const rocksdb::Slice &key, const rocksdb::Slice &val) MY_ATTRIBUTE((__nonnull__)); diff --git a/storage/rocksdb/rdb_iterator.cc b/storage/rocksdb/rdb_iterator.cc index cf99edbf80bf..219c8274df69 100644 --- a/storage/rocksdb/rdb_iterator.cc +++ b/storage/rocksdb/rdb_iterator.cc @@ -27,8 +27,7 @@ namespace myrocks { Rdb_iterator::~Rdb_iterator() {} -Rdb_iterator_base::Rdb_iterator_base(THD *thd, - const Rdb_key_def &kd, +Rdb_iterator_base::Rdb_iterator_base(THD *thd, const Rdb_key_def &kd, const Rdb_key_def &pkd, const Rdb_tbl_def *tbl_def) : m_kd(kd), @@ -398,8 +397,7 @@ int Rdb_iterator_base::get(const rocksdb::Slice *key, skip_wait); } - DBUG_EXECUTE_IF( - "rocksdb_return_status_corrupted", + DBUG_EXECUTE_IF("rocksdb_return_status_corrupted", { s = rocksdb::Status::Corruption(); }); return convert_get_status(*tx, s, value, skip_ttl_check); @@ -664,8 +662,7 @@ int Rdb_iterator_partial::materialize_prefix() { // It is possible that someone else has already materialized this group // before we locked. Double check by doing a locking read on the sentinel. rocksdb::PinnableSlice value; - auto s = rdb_tx_get_for_update(tx, m_kd, cur_prefix_key, &value, - true, false); + auto s = rdb_tx_get_for_update(tx, m_kd, cur_prefix_key, &value, true, false); if (s.ok()) { rdb_tx_release_lock(tx, m_kd, cur_prefix_key, true /* force */); thd_proc_info(m_thd, old_proc_info); diff --git a/storage/rocksdb/rdb_mutex_wrapper.h b/storage/rocksdb/rdb_mutex_wrapper.h index 09049d52f405..cc5dd812f826 100644 --- a/storage/rocksdb/rdb_mutex_wrapper.h +++ b/storage/rocksdb/rdb_mutex_wrapper.h @@ -30,7 +30,6 @@ #include "rdb_utils.h" #include "sql/replication.h" - namespace myrocks { class Rdb_mutex : public rocksdb::TransactionDBMutex { diff --git a/storage/rocksdb/rdb_psi.cc b/storage/rocksdb/rdb_psi.cc index a7672998f713..8a1a0f665218 100644 --- a/storage/rocksdb/rdb_psi.cc +++ b/storage/rocksdb/rdb_psi.cc @@ -38,8 +38,8 @@ my_core::PSI_thread_key rdb_background_psi_thread_key, rdb_drop_idx_psi_thread_key, rdb_is_psi_thread_key, rdb_mc_psi_thread_key; my_core::PSI_thread_info all_rocksdb_threads[] = { - {&rdb_background_psi_thread_key, "background", "rdb_bg", - PSI_FLAG_SINGLETON, 0, PSI_DOCUMENT_ME}, + {&rdb_background_psi_thread_key, "background", "rdb_bg", PSI_FLAG_SINGLETON, + 0, PSI_DOCUMENT_ME}, {&rdb_drop_idx_psi_thread_key, "drop index", "rdb_drop_ix", PSI_FLAG_SINGLETON, 0, PSI_DOCUMENT_ME}, {&rdb_signal_is_psi_mutex_key, "signal index stats calculation", diff --git a/storage/rocksdb/rdb_psi.h b/storage/rocksdb/rdb_psi.h index a44786d5e972..751baf5be482 100644 --- a/storage/rocksdb/rdb_psi.h +++ b/storage/rocksdb/rdb_psi.h @@ -50,8 +50,7 @@ extern my_core::PSI_mutex_key rdb_psi_open_tbls_mutex_key, rdb_bottom_pri_background_compactions_resize_mutex_key; extern my_core::PSI_rwlock_key key_rwlock_collation_exception_list, - key_rwlock_read_free_rpl_tables, - key_rwlock_tbl_prop_coll_factory_lock; + key_rwlock_read_free_rpl_tables, key_rwlock_tbl_prop_coll_factory_lock; extern my_core::PSI_cond_key rdb_signal_bg_psi_cond_key, rdb_signal_drop_idx_psi_cond_key, rdb_signal_is_psi_cond_key, diff --git a/unittest/gunit/components/percona_telemetry/data_provider-t.cc b/unittest/gunit/components/percona_telemetry/data_provider-t.cc index 9eeae751b454..471973fbd8cf 100644 --- a/unittest/gunit/components/percona_telemetry/data_provider-t.cc +++ b/unittest/gunit/components/percona_telemetry/data_provider-t.cc @@ -483,16 +483,16 @@ TEST_F(DataProviderTest, CollectServerConfigNondefaultSysvars) { q.find("'max_connections'") != std::string::npos; }), A(), _, true)) - .WillOnce(DoAll(WithArg<1>(Invoke([](QueryResult *qr) { - qr->clear(); - /* not allowlisted, allowlisted, allowlisted but - * path-like value */ - qr->push_back(Row{"datadir", "/data/mysql", "GLOBAL"}); - qr->push_back(Row{"max_connections", "123", "GLOBAL"}); - qr->push_back( - Row{"thread_handling", "foo/bar", "PERSISTED"}); - })), - Return(false))); + .WillOnce( + DoAll(WithArg<1>(Invoke([](QueryResult *qr) { + qr->clear(); + /* not allowlisted, allowlisted, allowlisted but + * path-like value */ + qr->push_back(Row{"datadir", "/data/mysql", "GLOBAL"}); + qr->push_back(Row{"max_connections", "123", "GLOBAL"}); + qr->push_back(Row{"thread_handling", "foo/bar", "PERSISTED"}); + })), + Return(false))); rapidjson::Document document(rapidjson::Type::kObjectType); EXPECT_FALSE(dataProvider.collect_server_config(&document)); ASSERT_TRUE(document.HasMember("server_config_info")); diff --git a/unittest/gunit/mock_create_field.h b/unittest/gunit/mock_create_field.h index f97a04270bde..2d54813eed53 100644 --- a/unittest/gunit/mock_create_field.h +++ b/unittest/gunit/mock_create_field.h @@ -58,17 +58,17 @@ class Mock_create_field : public Create_field { core dump. This is undocumented, of course. */ - &m_lex_string, // LEX_CSTRING *fld_comment, - nullptr, // char *fld_change, - nullptr, // List *fld_interval_list, - nullptr, // const CHARSET_INFO *fld_charset, - false, // bool has_explicit_collation, - 0, // uint fld_geom_type + &m_lex_string, // LEX_CSTRING *fld_comment, + nullptr, // char *fld_change, + nullptr, // List *fld_interval_list, + nullptr, // const CHARSET_INFO *fld_charset, + false, // bool has_explicit_collation, + 0, // uint fld_geom_type &null_lex_cstr, // zip_dict_name - nullptr, // gcol info - nullptr, // gen default val - EMPTY_CSTR, // policy name - {}, // std::optional srid + nullptr, // gcol info + nullptr, // gen default val + EMPTY_CSTR, // policy name + {}, // std::optional srid dd::Column::enum_hidden_type::HT_VISIBLE); // Visible } }; diff --git a/utilities/innochecksum.cc b/utilities/innochecksum.cc index 218300db37b6..657165d2cc9c 100644 --- a/utilities/innochecksum.cc +++ b/utilities/innochecksum.cc @@ -1395,8 +1395,7 @@ Extract the zip size from tablespace flags. @param[in] flags tablespace flags @return compressed page size of the file-per-table tablespace in bytes, or zero if the table is not compressed. */ -[[nodiscard]] -static ulint fsp_flags_get_zip_size(ulint flags) noexcept { +[[nodiscard]] static ulint fsp_flags_get_zip_size(ulint flags) noexcept { ulint zip_size = 0; const ulint ssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);