Skip to content
Closed
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 VERSION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=11
MYSQL_VERSION_MINOR=8
MYSQL_VERSION_PATCH=7
MYSQL_VERSION_PATCH=9
SERVER_MATURITY=stable
68 changes: 50 additions & 18 deletions client/mysqldump.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/

/* on merge conflict, bump to a higher version again */
#define VER "10.19"
#define VER "10.20"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This pull request contains a large number of changes (such as mysqldump updates, InnoDB buffer pool/transaction vector refactoring, and Groonga warning fixes) that are completely unrelated to the SBOM supplier name fix described in the PR title and description. According to the general rules, unrelated optimizations or bug fixes should be addressed in separate pull requests targeted at the earliest applicable branch rather than being bundled into the current pull request. Please split these unrelated changes into their own dedicated pull requests.

References
  1. Unrelated optimizations or bug fixes should be addressed in separate pull requests targeted at the earliest applicable branch rather than being bundled into the current pull request.


/**
First mysql version supporting sequences.
Expand Down Expand Up @@ -1428,7 +1428,6 @@ static void DB_error(MYSQL *mysql_arg, const char *when)
}



/*
Prints out an error message and kills the process.

Expand Down Expand Up @@ -1491,7 +1490,6 @@ static void maybe_die(int error_num, const char* fmt_reason, ...)
}



/*
Sends a query to server, optionally reads result, prints error message if
some.
Expand All @@ -1502,27 +1500,64 @@ static void maybe_die(int error_num, const char* fmt_reason, ...)
res if non zero, result will be put there with
mysql_store_result()
query query to send to server
no_parse_error Do not print error message for parse errors

RETURN VALUES
0 query sending and (if res!=0) result reading went ok
1 error
-1 Syntax/parse error (for retry code)
*/

static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
const char *query)
const char *query,
bool no_parse_error = false)
{
DBUG_ASSERT(mysql_con);
if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con))))
{
if (no_parse_error && mysql_errno(mysql_con) == ER_PARSE_ERROR)
return -1;
maybe_die(EX_MYSQLERR, "Couldn't execute '%s': %s (%d)",
query, mysql_error(mysql_con), mysql_errno(mysql_con));
query, mysql_error(mysql_con), mysql_errno(mysql_con));
return 1;
}
return 0;
}


/*
Sends a query to server. In case of parse error try another syntax
*/

static int mysql_query_with_retry(MYSQL *mysql_con, MYSQL_RES **res,
const char *query1, const char *query2)
{
int error;
if ((error= mysql_query_with_error_report(mysql_con, res, query1, 1)) == -1)
error= mysql_query_with_error_report(mysql_con, res, query2, 0);
Comment on lines +1537 to +1538
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For better readability and type safety in C++, use true and false instead of 1 and 0 when passing arguments to the bool parameter no_parse_error of mysql_query_with_error_report.

  if ((error= mysql_query_with_error_report(mysql_con, res, query1, true)) == -1)
    error= mysql_query_with_error_report(mysql_con, res, query2, false);

return error;
}

/*
Get slave status from server.

Note that MySQL server does not support 'SHOW ALL' and
multi_source should thus not be set when dumping from MySQL
*/

static int show_slave_status(MYSQL *mysql_con, MYSQL_RES **res)
{
return (mysql_query_with_retry(mysql_con, res,
(multi_source ?
"SHOW ALL REPLICAS STATUS" :
"SHOW REPLICA STATUS"),
(multi_source ?
"SHOW ALL SLAVES STATUS" :
"SHOW SLAVE STATUS")));
}


static int fetch_db_collation(const char *db_name,
char *db_cl_name,
int db_cl_size)
Expand Down Expand Up @@ -6389,8 +6424,9 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos,
}
else
{
if (mysql_query_with_error_report(mysql_con, &master,
"SHOW MASTER STATUS"))
if (mysql_query_with_retry(mysql_con, &master,
"SHOW MASTER STATUS",
"SHOW BINARY LOG STATUS"))
return 1;

row= mysql_fetch_row(master);
Expand Down Expand Up @@ -6477,10 +6513,7 @@ static int do_stop_slave_sql(MYSQL *mysql_con)
!slave_status_res // do_stop_slave_sql() should only be called once
);

if (mysql_query_with_error_report(mysql_con, &slave_status_res,
multi_source ?
"SHOW ALL SLAVES STATUS" :
"SHOW SLAVE STATUS"))
if (show_slave_status(mysql_con, &slave_status_res))
return(1);

/* Loop over all slaves */
Expand All @@ -6493,7 +6526,8 @@ static int do_stop_slave_sql(MYSQL *mysql_con)
{
char query[160];
if (multi_source)
snprintf(query, sizeof(query), "STOP SLAVE '%.80s' SQL_THREAD", row[0]);
snprintf(query, sizeof(query), "STOP SLAVE '%.80s' SQL_THREAD",
row[0]);
else
strmov(query, "STOP SLAVE SQL_THREAD");

Expand Down Expand Up @@ -6542,10 +6576,7 @@ static int do_show_slave_status(MYSQL *mysql_con, int have_mariadb_gtid,
const char *gtid_comment_prefix= (use_gtid ? comment_prefix : "-- ");
const char *nogtid_comment_prefix= (!use_gtid ? comment_prefix : "-- ");

if (mysql_query_with_error_report(mysql_con, &slave,
multi_source ?
"SHOW ALL SLAVES STATUS" :
"SHOW SLAVE STATUS"))
if (show_slave_status(mysql_con, &slave))
{
if (!ignore_errors)
{
Expand Down Expand Up @@ -6705,8 +6736,9 @@ static int get_bin_log_name(MYSQL *mysql_con,
MYSQL_RES *res;
MYSQL_ROW row;

if (mysql_query(mysql_con, "SHOW MASTER STATUS") ||
!(res= mysql_store_result(mysql)))
if (mysql_query_with_retry(mysql_con, &res,
"SHOW MASTER STATUS",
"SHOW BINARY LOG STATUS"))
return 1;

if (!(row= mysql_fetch_row(res)))
Expand Down
2 changes: 1 addition & 1 deletion cmake/generate_sbom.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ FUNCTION (sbom_get_supplier repo_name repo_user varname)
ELSEIF (repo_name MATCHES "boost")
SET(${varname} "Boost.org" PARENT_SCOPE)
ELSEIF(repo_user MATCHES "mariadb-corporation|mariadb")
SET(${varname} "MariaDB")
SET(${varname} "MariaDB" PARENT_SCOPE)
ELSE()
# Capitalize just first letter in repo_user
STRING(SUBSTRING "${repo_user}" 0 1 first_letter)
Expand Down
2 changes: 2 additions & 0 deletions extra/mariadb_migrate_config_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ static size_t global_copied_lines=0, global_unsupported_lines= 0;
static size_t global_mariadbd_additions= 0;

static PSI_memory_key key_memory_upgrade_config;
#ifdef HAVE_PSI_FILE_INTERFACE
static PSI_file_key key_file_cnf;
#endif
static size_t global_update_count= 0;
static my_bool give_error_for_missing_files= 0;
static my_bool opt_mariadbd_testing;
Expand Down
4 changes: 4 additions & 0 deletions include/my_atomic_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ template <typename Type> class Atomic_relaxed
std::memory_order o1= std::memory_order_relaxed,
std::memory_order o2= std::memory_order_relaxed)
{ return m.compare_exchange_strong(i1, i2, o1, o2); }
bool compare_exchange_weak(Type& i1, const Type i2,
std::memory_order o1= std::memory_order_relaxed,
std::memory_order o2= std::memory_order_relaxed)
{ return m.compare_exchange_weak(i1, i2, o1, o2); }
Type exchange(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.exchange(i, o); }
};
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/create_drop_binlog.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ reset master;
--let $pos=`select $binlog_start_pos + 73`

--let $binlog_file=query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start=query_get_value(SHOW MASTER STATUS, Position, 1)
--let $binlog_start=query_get_value(SHOW BINARY LOG STATUS, Position, 1)

CREATE OR REPLACE DATABASE d1;
CREATE OR REPLACE DATABASE d1;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/max_session_mem_used.test
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# memory usage is sensitive to valgrind/ps-protocol/embedded
source include/not_msan.inc;
source include/not_valgrind.inc;
source include/not_valgrind_build.inc;
source include/no_protocol.inc;
source include/not_embedded.inc;
source include/have_64bit.inc;
Expand Down
1 change: 1 addition & 0 deletions mysql-test/main/show_check.result
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ show create database test;
show create table t1;
show create view v1;
show master status;
show binary log status;
show slave status;
show create procedure p1;
show create function f1;
Expand Down
1 change: 1 addition & 0 deletions mysql-test/main/show_check.test
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ show create database test;
show create table t1;
show create view v1;
show master status;
show binary log status;
show slave status;
show create procedure p1;
show create function f1;
Expand Down
1 change: 1 addition & 0 deletions sql/lex.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ SYMBOL symbols[] = {
{ "LOCK", SYM(LOCK_SYM)},
{ "LOCKED", SYM(LOCKED_SYM)},
{ "LOCKS", SYM(LOCKS_SYM)},
{ "LOG", SYM(LOG_SYM)},
{ "LOGFILE", SYM(LOGFILE_SYM)},
{ "LOGS", SYM(LOGS_SYM)},
{ "LONG", SYM(LONG_SYM)},
Expand Down
6 changes: 6 additions & 0 deletions sql/sql_yacc.yy
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%token <kwd> LOCKS_SYM
%token <kwd> LOGFILE_SYM
%token <kwd> LOGS_SYM
%token <kwd> LOG_SYM
%token <kwd> MASTER_CONNECT_RETRY_SYM
%token <kwd> MASTER_DELAY_SYM
%token <kwd> MASTER_GTID_POS_SYM
Expand Down Expand Up @@ -14546,6 +14547,10 @@ show_param:
{
Lex->sql_command = SQLCOM_SHOW_BINLOG_STAT;
}
| BINARY LOG_SYM STATUS_SYM
{
Lex->sql_command = SQLCOM_SHOW_BINLOG_STAT;
}
| ALL SLAVES STATUS_SYM
{
LEX *lex= Lex;
Expand Down Expand Up @@ -16563,6 +16568,7 @@ keyword_func_sp_var_and_label:
| LIST_SYM
| LOCKED_SYM
| LOCKS_SYM
| LOG_SYM
| LOGFILE_SYM
| LOGS_SYM
| MAX_ROWS
Expand Down
Loading
Loading