1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge remote-tracking branch 'origin/11.2' into 11.4

This commit is contained in:
Alexander Barkov
2024-07-09 17:41:26 +04:00
636 changed files with 14636 additions and 11289 deletions

View File

@@ -500,6 +500,9 @@ START SLAVE UNTIL master_gtid_pos="ssu_middle_binlog_pos";
Warnings:
Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mariadbd restart
# Slave needs time to start and stop automatically
# Waiting for both SQL and IO threads to have started..
# Waiting for SQL thread to be killed..
# Waiting for IO thread to be killed..
# Validating neither SQL nor IO threads are running..
# ..success
# Clean slave state of master

View File

@@ -355,7 +355,7 @@ a`
show binlog events in 'master-bin.000002' from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 # Gtid 1 # GTID #-#-#
master-bin.000002 # Query 1 # DELETE FROM `db1``; select 'oops!'`.`t``1`
master-bin.000002 # Query 1 # TRUNCATE TABLE `db1``; select 'oops!'`.`t``1`
connection slave;
include/start_slave.inc
connection master;

View File

@@ -0,0 +1,39 @@
include/master-slave.inc
[connection master]
connection master;
create table t (val int) engine=MEMORY;
# DELETE trigger should never be activated
create trigger tr after delete on t for each row update t2 set val = 1;
insert into t values (1),(2);
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
# Check pre-restart values
include/diff_tables.inc [master:test.t,slave:test.t]
# Restarting master should empty master and slave `t`
connection master;
include/rpl_restart_server.inc [server_number=1]
connection master;
# Validating MEMORY table on master is empty after restart
# MYSQL_BINLOG datadir/binlog_file --result-file=assert_file
include/assert_grep.inc [Query to truncate the MEMORY table should be the contents of the new event]
# Ensuring slave MEMORY table is empty
connection master;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/diff_tables.inc [master:test.t,slave:test.t]
# Ensure new events replicate correctly
connection master;
insert into t values (3),(4);
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
# Validate values on slave, after master restart, do not include those inserted previously
include/diff_tables.inc [master:test.t,slave:test.t]
#
# Cleanup
connection master;
drop table t;
include/rpl_end.inc
# End of rpl_memory_engine_truncate_on_restart.test

View File

@@ -50,7 +50,7 @@ on slave must be 2
SELECT @@GLOBAL.gtid_current_pos;
@@GLOBAL.gtid_current_pos
0-1-4
# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1
# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE
connection server_1;
# Ensuring variable rpl_semi_sync_slave_enabled is ON..
# Ensuring status rpl_semi_sync_slave_status is OFF..
@@ -136,7 +136,7 @@ on slave must be 5
SELECT @@GLOBAL.gtid_current_pos;
@@GLOBAL.gtid_current_pos
0-2-7
# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1
# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE
connection server_2;
# Ensuring variable rpl_semi_sync_slave_enabled is ON..
# Ensuring status rpl_semi_sync_slave_status is OFF..
@@ -221,7 +221,7 @@ on slave must be 7
SELECT @@GLOBAL.gtid_current_pos;
@@GLOBAL.gtid_current_pos
0-1-9
# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1
# restart: --skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE
connection server_1;
# Ensuring variable rpl_semi_sync_slave_enabled is ON..
# Ensuring status rpl_semi_sync_slave_status is OFF..

View File

@@ -0,0 +1,28 @@
include/master-slave.inc
[connection master]
include/assert.inc [Password length is 96]
connection master;
SET SQL_LOG_BIN=0;
GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY '123456789X12141618202224262830323436384042444648505254565860626466687072747678808284868890929496';
SET SQL_LOG_BIN=1;
connection slave;
include/stop_slave.inc
CHANGE MASTER TO MASTER_HOST='127.0.0.1', master_user='rpl', master_password='123456789X12141618202224262830323436384042444648505254565860626466687072747678808284868890929496';
include/start_slave.inc
include/check_slave_param.inc [Slave_IO_Running]
connection master;
include/rpl_restart_server.inc [server_number=2]
connection slave;
include/start_slave.inc
include/check_slave_param.inc [Slave_IO_Running]
connection master;
SET SQL_LOG_BIN=0;
DROP USER rpl@127.0.0.1;
FLUSH PRIVILEGES;
SET SQL_LOG_BIN=1;
connection slave;
include/stop_slave.inc
CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = '';
include/start_slave.inc
connection master;
include/rpl_end.inc

View File

@@ -64,7 +64,10 @@ connection server_2;
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
domain_id seq_no
0 12
connection server_1;
include/save_master_gtid.inc
connection server_3;
include/sync_with_master_gtid.inc
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
domain_id seq_no
0 12
@@ -77,6 +80,7 @@ select @@slave_parallel_threads;
@@slave_parallel_threads
0
connection server_4;
include/sync_with_master_gtid.inc
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
domain_id seq_no
0 12

View File

@@ -52,6 +52,7 @@ master-bin.000001 # Query 1 # use `test`; create table t3( a int primary key, b
# let's stop at first CA processing (in process_commit_alter)
connection slave;
include/sync_with_master_gtid.inc
# wait for CA_1 waiting itself
connect extra_slave,127.0.0.1,root,,test,$SLAVE_MYPORT;
stop slave;;
connection slave;

View File

@@ -276,14 +276,27 @@ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHER
--echo # binlog position and should still succeed despite the SSU stop
--echo # position pointing to a previous event (because
--echo # master_demote_to_slave=1 merges gtid_binlog_pos into gtid_slave_pos).
--let $pre_start_slave_thread_count= query_get_value(SHOW STATUS LIKE 'Connections', Value, 1)
--replace_result $ssu_middle_binlog_pos ssu_middle_binlog_pos
eval START SLAVE UNTIL master_gtid_pos="$ssu_middle_binlog_pos";
--echo # Slave needs time to start and stop automatically
# Note sync_with_master_gtid.inc, wait_for_slave_to_start.inc, and
# wait_for_slave_to_stop.inc won't work due to replication state and race
# conditions
--sleep 1
--echo # Waiting for both SQL and IO threads to have started..
--let $expected_cons_after_start_slave= `SELECT ($pre_start_slave_thread_count + 2)`
--let $status_var= Connections
--let $status_var_value= $expected_cons_after_start_slave
--let $status_var_comparsion= >=
--source include/wait_for_status_var.inc
--let $status_var_comparsion=
--echo # Waiting for SQL thread to be killed..
--let $wait_condition= SELECT count(*)=0 from information_schema.PROCESSLIST where COMMAND="Slave_SQL"
--source include/wait_condition.inc
--echo # Waiting for IO thread to be killed..
--let $wait_condition= SELECT count(*)=0 from information_schema.PROCESSLIST where COMMAND="Slave_IO"
--source include/wait_condition.inc
--echo # Validating neither SQL nor IO threads are running..
--let $io_state= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1)

View File

@@ -0,0 +1,82 @@
#
# This test ensures that a table with engine=memory is kept consistent with
# the slave when the master restarts. That is, when the master is restarted, it
# should binlog a new TRUNCATE TABLE command for tables with MEMORY engines,
# such that after the slave executes these events, its MEMORY-engine tables
# should be empty.
#
# References:
# MDEV-25607: Auto-generated DELETE from HEAP table can break replication
#
--source include/master-slave.inc
--connection master
create table t (val int) engine=MEMORY;
-- echo # DELETE trigger should never be activated
create trigger tr after delete on t for each row update t2 set val = 1;
insert into t values (1),(2);
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
-- echo # Check pre-restart values
--let $diff_tables= master:test.t,slave:test.t
--source include/diff_tables.inc
--echo # Restarting master should empty master and slave `t`
--connection master
--let $seq_no_before_restart= `SELECT REGEXP_REPLACE(@@global.gtid_binlog_pos, "0-1-", "")`
--let $rpl_server_number= 1
--source include/rpl_restart_server.inc
--connection master
--echo # Validating MEMORY table on master is empty after restart
--let $table_size= `select count(*) from t`
if ($table_size)
{
--echo # MEMORY table is not empty
--die MEMORY table is not empty
}
--let $seq_no_after_restart= `SELECT REGEXP_REPLACE(@@global.gtid_binlog_pos, "0-1-", "")`
if ($seq_no_before_restart == $seq_no_after_restart)
{
--echo # Event to empty MEMORY table was not binlogged
--die Event to empty MEMORY table was not binlogged
}
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $datadir=`select @@datadir`
--let assert_file= $MYSQLTEST_VARDIR/tmp/binlog_decoded.out
--echo # MYSQL_BINLOG datadir/binlog_file --result-file=assert_file
--exec $MYSQL_BINLOG $datadir/$binlog_file --result-file=$assert_file
--let assert_text= Query to truncate the MEMORY table should be the contents of the new event
--let assert_count= 1
--let assert_select= TRUNCATE TABLE
--source include/assert_grep.inc
--echo # Ensuring slave MEMORY table is empty
--connection master
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--source include/diff_tables.inc
--echo # Ensure new events replicate correctly
--connection master
insert into t values (3),(4);
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--echo # Validate values on slave, after master restart, do not include those inserted previously
--source include/diff_tables.inc
--echo #
--echo # Cleanup
--connection master
drop table t;
--source include/rpl_end.inc
--echo # End of rpl_memory_engine_truncate_on_restart.test

View File

@@ -74,7 +74,7 @@ source include/wait_for_slave_param.inc;
SELECT @@GLOBAL.gtid_current_pos;
--let $restart_parameters=--skip-slave-start=1 --rpl-semi-sync-slave-enabled=1
--let $restart_parameters=--skip-slave-start=1 --rpl-semi-sync-slave-enabled=1 --init-rpl-role=SLAVE
--let $allow_rpl_inited=1
--source include/start_mysqld.inc
--connection server_$server_to_crash

View File

@@ -0,0 +1,80 @@
#
# This test validates a fix for a bug where slaves only read the
# first 41 characters of MASTER_PASSWORD from the master.info file
# after restarts.
#
# The test ensures that passwords up to the maximum allowable
# length (96 ASCII characters) will be read from the master.info
# file after slave restarts
#
# References:
# MDEV-23857: replication master password length
#
# Test is format independent, so only run with one format
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
#####
# Setup
#
--let $passwd=123456789X12141618202224262830323436384042444648505254565860626466687072747678808284868890929496
--let $expected_pwlen=96
--let assert_cond=CHAR_LENGTH("$passwd")=$expected_pwlen
--let assert_text=Password length is $expected_pwlen
--source include/assert.inc
connection master;
SET SQL_LOG_BIN=0;
--eval GRANT REPLICATION SLAVE ON *.* TO rpl@127.0.0.1 IDENTIFIED BY '$passwd'
SET SQL_LOG_BIN=1;
#####
#####
# Change master to new user/password combination
#
connection slave;
--source include/stop_slave.inc
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', master_user='rpl', master_password='$passwd'
--source include/start_slave.inc
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Yes
--source include/check_slave_param.inc
#####
#####
# Ensure slave can re-connect to master after restart
#
connection master;
--let $rpl_server_number= 2
--source include/rpl_restart_server.inc
connection slave;
--source include/start_slave.inc
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Yes
--source include/check_slave_param.inc
#####
#####
# Cleanup
#
connection master;
SET SQL_LOG_BIN=0;
DROP USER rpl@127.0.0.1;
FLUSH PRIVILEGES;
SET SQL_LOG_BIN=1;
connection slave;
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USER = 'root', MASTER_PASSWORD = '';
--source include/start_slave.inc
connection master;
-- source include/rpl_end.inc
#####

View File

@@ -39,7 +39,11 @@ connect(slave_node,127.0.0.1,root,,test, $SERVER_MYPORT_2);
--connection server_2
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
--connection server_1
--source include/save_master_gtid.inc
--connection server_3
--source include/sync_with_master_gtid.inc
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
--source include/stop_slave.inc
--eval set global slave_parallel_threads = $slave_parallel_threads;
@@ -49,6 +53,7 @@ select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
select @@slave_parallel_threads;
--connection server_4
--source include/sync_with_master_gtid.inc
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
--source include/rpl_end.inc

View File

@@ -73,6 +73,10 @@ create table t3( a int primary key, b int) engine=innodb;
--connection slave
--source include/sync_with_master_gtid.inc
--echo # wait for CA_1 waiting itself
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: now';
--source include/wait_condition.inc
# set debug_sync="now wait_for CA_1_processing";
connect(extra_slave,127.0.0.1,root,,test,$SLAVE_MYPORT);
--send stop slave;