Skip to content

Commit

Permalink
Merge 10.4 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Dec 19, 2023
2 parents 476ff09 + eaa4968 commit 1299555
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 9 deletions.
7 changes: 6 additions & 1 deletion client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -1462,7 +1462,12 @@ int main(int argc, char **argv)
open_mysql_upgrade_file();

if (opt_check_upgrade)
exit(upgrade_already_done(0) == 0);
{
int upgrade_needed = upgrade_already_done(0);
free_used_memory();
my_end(my_end_arg);
exit(upgrade_needed == 0);
}

/* Find mysqlcheck */
find_tool(mysqlcheck_path, IF_WIN("mariadb-check.exe", "mariadb-check"), self_name);
Expand Down
4 changes: 4 additions & 0 deletions mysql-test/main/mysql_upgrade_file_leak.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Running mysql_upgrade with --check-if-upgrade-is-needed
Checking for absence of temporary files by mysql_upgrade
No temporary files found
End of 10.4 tests
24 changes: 24 additions & 0 deletions mysql-test/main/mysql_upgrade_file_leak.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
-- source include/mysql_upgrade_preparation.inc

#
# MDEV-31925 mysqld_upgrade --check-if-upgrade-is-needed leaks files
#

# Run mysql_upgrade with --check-if-upgrade-is-needed
--echo Running mysql_upgrade with --check-if-upgrade-is-needed
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed 2>&1

# Check if temporary files related to mysql_upgrade are cleared
--echo Checking for absence of temporary files by mysql_upgrade
--perl

# Use the temporary directory path from the MySQL configuration
my $tmpdir = "$ENV{MYSQL_TMP_DIR}";

die "Test failed: Found temporary file left by mysql_upgrade\n" if (glob("$tmpdir/mysql_upgrade-*"));
print "No temporary files found\n";
EOF

let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--echo End of 10.4 tests
7 changes: 7 additions & 0 deletions mysql-test/suite/binlog_encryption/rpl_gtid_basic.result
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
SET sql_log_bin= 0;
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
SELECT BINLOG_GTID_POS(@binlog_file, 4);
BINLOG_GTID_POS(@binlog_file, 4)
NULL
DROP TABLE t1;
SET sql_log_bin= 1;
*** Some tests of @@GLOBAL.gtid_binlog_state ***
connection server_2;
include/sync_with_master_gtid.inc
Expand Down
7 changes: 7 additions & 0 deletions mysql-test/suite/rpl/r/rpl_gtid_basic.result
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ BINLOG_GTID_POS('master-bin.000001',18446744073709551616)
NULL
Warnings:
Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated
SET sql_log_bin= 0;
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
SELECT BINLOG_GTID_POS(@binlog_file, 4);
BINLOG_GTID_POS(@binlog_file, 4)
NULL
DROP TABLE t1;
SET sql_log_bin= 1;
*** Some tests of @@GLOBAL.gtid_binlog_state ***
connection server_2;
include/sync_with_master_gtid.inc
Expand Down
7 changes: 7 additions & 0 deletions mysql-test/suite/rpl/t/rpl_gtid_basic.test
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ eval SELECT BINLOG_GTID_POS('$valid_binlog_name',0);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551615);
eval SELECT BINLOG_GTID_POS('$valid_binlog_name',18446744073709551616);

# MDEV-33045: Server crashes in Item_func_binlog_gtid_pos::val_str / Binary_string::c_ptr_safe
SET sql_log_bin= 0;
CREATE TABLE t1 AS SELECT MASTER_POS_WAIT(@binlog_file, 4, 0);
SELECT BINLOG_GTID_POS(@binlog_file, 4);
DROP TABLE t1;
SET sql_log_bin= 1;


--echo *** Some tests of @@GLOBAL.gtid_binlog_state ***
--connection server_2
Expand Down
6 changes: 3 additions & 3 deletions sql/item_strfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3213,12 +3213,12 @@ String *Item_func_binlog_gtid_pos::val_str(String *str)
String name_str, *name;
longlong pos;

if (args[0]->null_value || args[1]->null_value)
goto err;

name= args[0]->val_str(&name_str);
pos= args[1]->val_int();

if (args[0]->null_value || args[1]->null_value)
goto err;

if (pos < 0 || pos > UINT_MAX32)
goto err;

Expand Down
9 changes: 5 additions & 4 deletions sql/rpl_parallel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,7 @@ retry_event_group(rpl_group_info *rgi, rpl_parallel_thread *rpt,
thd->wait_for_commit_ptr->unregister_wait_for_prior_commit();
DBUG_EXECUTE_IF("inject_mdev8031", {
/* Simulate that we get deadlock killed at this exact point. */
rgi->killed_for_retry= rpl_group_info::RETRY_KILL_KILLED;
thd->set_killed(KILL_CONNECTION);
slave_background_kill_request(thd);
});
#ifdef ENABLED_DEBUG_SYNC
DBUG_EXECUTE_IF("rpl_parallel_simulate_wait_at_retry", {
Expand Down Expand Up @@ -2567,8 +2566,10 @@ rpl_parallel::stop_during_until()
bool
rpl_parallel::workers_idle(Relay_log_info *rli)
{
return rli->last_inuse_relaylog->queued_count ==
rli->last_inuse_relaylog->dequeued_count;
mysql_mutex_assert_owner(&rli->data_lock);
return !rli->last_inuse_relaylog ||
rli->last_inuse_relaylog->queued_count ==
rli->last_inuse_relaylog->dequeued_count;
}


Expand Down
8 changes: 7 additions & 1 deletion sql/slave.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5426,19 +5426,25 @@ pthread_handler_t handle_slave_sql(void *arg)
}
else
rli->gtid_skip_flag = GTID_SKIP_NOT;
mysql_mutex_lock(&rli->data_lock);
if (init_relay_log_pos(rli,
rli->group_relay_log_name,
rli->group_relay_log_pos,
1 /*need data lock*/, &errmsg,
0 /*need data lock*/, &errmsg,
1 /*look for a description_event*/))
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
"Error initializing relay log position: %s", errmsg);
mysql_mutex_unlock(&rli->data_lock);
goto err_before_start;
}
rli->reset_inuse_relaylog();
if (rli->alloc_inuse_relaylog(rli->group_relay_log_name))
{
mysql_mutex_unlock(&rli->data_lock);
goto err_before_start;
}
mysql_mutex_unlock(&rli->data_lock);

strcpy(rli->future_event_master_log_name, rli->group_master_log_name);
THD_CHECK_SENTRY(thd);
Expand Down

0 comments on commit 1299555

Please sign in to comment.