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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/mysqldump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@ static int get_options(int *argc, char ***argv) {
exclude_user = new std::forward_list<string>();
include_user =
new collation_unordered_set<string>(charset_info, PSI_NOT_INSTRUMENTED);

processed_compression_dictionaries =
new collation_unordered_set<string>(charset_info, PSI_NOT_INSTRUMENTED);

Expand Down
2 changes: 1 addition & 1 deletion components/audit_log_filter/audit_keyring.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 8 additions & 5 deletions components/audit_log_filter/log_record_formatter/json.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion components/audit_log_filter/log_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion components/audit_log_filter/log_writer/file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions components/audit_log_filter/log_writer/file_handle.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion components/audit_log_filter/log_writer/file_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion components/audit_log_filter/sys_vars.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion components/binlog_utils_udf/binlog_utils_udf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <mysqlpp/udf_registration.hpp>
#include <mysqlpp/udf_wrappers.hpp>

#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 <sql/binlog.h>
#include <sql/binlog/decompressing_event_object_istream.h>
#include <sql/binlog_reader.h>
Expand Down
2 changes: 1 addition & 1 deletion components/encryption_udf/server_helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sql/sql_class.h>

bool is_thd_killed(const THD *thd) noexcept {
Expand Down
4 changes: 1 addition & 3 deletions components/keyrings/common/data/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions components/keyrings/keyring_file/keyring_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ 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;
LogComponentErr(INFORMATION_LEVEL, ER_NOTE_KEYRING_COMPONENT_INITIALIZED);
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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ 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;
LogComponentErr(INFORMATION_LEVEL, ER_NOTE_KEYRING_COMPONENT_INITIALIZED);
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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <rwlock_scoped_lock.h>

#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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <type_traits>
#include <utility>

#include <mysql/components/services/bits/my_err_bits.h> // MYSQL_ERRMSG_SIZE
#include <mysql/components/services/bits/my_err_bits.h> // MYSQL_ERRMSG_SIZE
#include <mysql/components/services/mysql_command_services.h>

#include "masking_functions/command_service_tuple.hpp"
Expand Down
5 changes: 2 additions & 3 deletions components/percona_telemetry/data_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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> 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);

Expand Down
6 changes: 4 additions & 2 deletions components/percona_udf/percona_udf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
29 changes: 14 additions & 15 deletions components/uuid_vx_udf/uuid_vx_udf_component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */

#include <boost/preprocessor/stringize.hpp>

#include <boost/date_time/c_time.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/date_time/c_time.hpp>


#include <mysql/components/component_implementation.h>

Expand All @@ -54,7 +53,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <mysqlpp/udf_registration.hpp>
#include <mysqlpp/udf_wrappers.hpp>


// 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)
Expand Down Expand Up @@ -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) {
Expand All @@ -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<INT_RESULT> calculate(const mysqlpp::udf_context &ctx) {
Expand Down Expand Up @@ -781,7 +779,6 @@ class bin_to_uuid_vx_impl {
}
};


/**
* Helper class for timestamp extracting functions
*/
Expand Down Expand Up @@ -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();
}

Expand All @@ -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();
}
};
Expand Down Expand Up @@ -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<std::tuple_size_v<decltype(known_udfs)>>;
udf_bitset_type registered_udfs;
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion include/memory_debugging.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@

#elif defined(HAVE_ASAN)

#include <cassert>
#include <sanitizer/asan_interface.h>
#include <cassert>

#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)
Expand Down
6 changes: 4 additions & 2 deletions include/my_aes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> *kdf_options = nullptr);
bool padding = true,
std::vector<std::string> *kdf_options = nullptr);

/**
Decrypt an AES encrypted buffer
Expand Down Expand Up @@ -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<std::string> *kdf_options = nullptr);
bool padding = true,
std::vector<std::string> *kdf_options = nullptr);

/**
Calculate the size of a buffer large enough for encrypted data.
Expand Down
Loading
Loading