Skip to content
/ server Public
Open
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
86 changes: 86 additions & 0 deletions mysql-test/main/reset_slave_all_leaks_master_info.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#
# MDEV-38497 RESET SLAVE ALL doesn't remove all slave related configurations
#
CHANGE MASTER TO
MASTER_HOST='localhost',
MASTER_USER='replssl',
MASTER_PASSWORD='password',
MASTER_PORT=3001,
MASTER_CONNECT_RETRY=7,
MASTER_HEARTBEAT_PERIOD=3,
MASTER_SSL=1,
MASTER_SSL_CA='MYSQL_TEST_DIR/std_data/cacert.pem',
MASTER_SSL_CAPATH='MYSQL_TEST_DIR/std_data',
MASTER_SSL_CERT='MYSQL_TEST_DIR/std_data/client-cert.pem',
MASTER_SSL_KEY='MYSQL_TEST_DIR/std_data/client-key.pem',
MASTER_SSL_CRL='MYSQL_TEST_DIR/std_data/crl.pem',
MASTER_SSL_CRLPATH='MYSQL_TEST_DIR/std_data',
MASTER_SSL_CIPHER='AES256-SHA',
MASTER_SSL_VERIFY_SERVER_CERT=1,
MASTER_RETRY_COUNT=17,
MASTER_USE_GTID=current_pos,
IGNORE_SERVER_IDS=(123),
DO_DOMAIN_IDS=(19);
RESET SLAVE ALL;
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
SHOW SLAVE STATUS;
Slave_IO_State
Master_Host 127.0.0.1
Master_User root
Master_Port 3306
Connect_Retry 60
Master_Log_File
Read_Master_Log_Pos 4
Relay_Log_File mysqld-relay-bin.000001
Relay_Log_Pos 4
Relay_Master_Log_File
Slave_IO_Running No
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos 0
Relay_Log_Space 257
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed Yes
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master NULL
Master_SSL_Verify_Server_Cert No
Last_IO_Errno 0
Last_IO_Error
Last_SQL_Errno 0
Last_SQL_Error
Replicate_Ignore_Server_Ids
Master_Server_Id 0
Master_SSL_Crl
Master_SSL_Crlpath
Using_Gtid Slave_Pos
Gtid_IO_Pos
Replicate_Do_Domain_Ids
Replicate_Ignore_Domain_Ids
Parallel_Mode optimistic
SQL_Delay 0
SQL_Remaining_Delay NULL
Slave_SQL_Running_State
Slave_DDL_Groups 0
Slave_Non_Transactional_Groups 0
Slave_Transactional_Groups 0
Replicate_Rewrite_DB
Connects_Tried 0
Master_Retry_Count 100000
RESET SLAVE ALL;
# End of reset_slave_all_leaks_master_info.test
43 changes: 43 additions & 0 deletions mysql-test/main/reset_slave_all_leaks_master_info.test
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought I saw RESET SLAVE already tested somewhere.
Maybe it didn’t cover RESET SLAVE ALL well.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
--source include/not_embedded.inc

--echo #
--echo # MDEV-38497 RESET SLAVE ALL doesn't remove all slave related configurations
--echo #

# Test replica should clear ALL master connection info

--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval CHANGE MASTER TO
MASTER_HOST='localhost',
MASTER_USER='replssl',
MASTER_PASSWORD='password',
MASTER_PORT=3001,
MASTER_CONNECT_RETRY=7,
MASTER_HEARTBEAT_PERIOD=3,
MASTER_SSL=1,
MASTER_SSL_CA='$MYSQL_TEST_DIR/std_data/cacert.pem',
MASTER_SSL_CAPATH='$MYSQL_TEST_DIR/std_data',
MASTER_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem',
MASTER_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem',
MASTER_SSL_CRL='$MYSQL_TEST_DIR/std_data/crl.pem',
MASTER_SSL_CRLPATH='$MYSQL_TEST_DIR/std_data',
MASTER_SSL_CIPHER='AES256-SHA',
MASTER_SSL_VERIFY_SERVER_CERT=1,
MASTER_RETRY_COUNT=17,
MASTER_USE_GTID=current_pos,
IGNORE_SERVER_IDS=(123),
DO_DOMAIN_IDS=(19);

#
# Everything must be cleared / set to default values
#
RESET SLAVE ALL;

CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';

--query_vertical SHOW SLAVE STATUS

# Cleanup
RESET SLAVE ALL;

--echo # End of reset_slave_all_leaks_master_info.test
44 changes: 44 additions & 0 deletions sql/rpl_mi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@

static void init_master_log_pos(Master_info* mi);

static void init_ssl_config(Master_info* mi);

static void init_connection_config(Master_info* mi);

static void init_group_counters(Master_info* mi);

Master_info::Master_info(LEX_CSTRING *connection_name_arg,
bool is_slave_recovery):
Master_info_file(ignore_server_ids, domain_id_filter.m_domain_ids[0],
Expand Down Expand Up @@ -177,9 +183,47 @@ void Master_info::clear_in_memory_info(bool all)
host[0] = 0; user[0] = 0; password[0] = 0;
domain_id_filter.clear_ids();
reset_dynamic(&ignore_server_ids);
init_ssl_config(this);
init_connection_config(this);
init_group_counters(this);
}
}


void init_ssl_config(Master_info* mi)
{
DBUG_ENTER("init_ssl_config");
mi->master_ssl= 1;
mi->master_ssl_verify_server_cert= 0;
mi->master_ssl_ca= nullptr; mi->master_ssl_capath= nullptr; mi->master_ssl_cert= nullptr;
mi->master_ssl_cipher= nullptr; mi->master_ssl_key= nullptr; mi->master_ssl_crl= nullptr;
mi->master_ssl_crlpath= nullptr;
Comment on lines +198 to +200
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should fix the earlier LTS versions as well.

In either case, this section is unique to a refactor on 12.3.

DBUG_VOID_RETURN;
}


void init_group_counters(Master_info* mi)
{
DBUG_ENTER("init_group_counters");
mi->total_ddl_groups= 0;
mi->total_non_trans_groups= 0;
mi->total_trans_groups= 0;
DBUG_VOID_RETURN;
}


void init_connection_config(Master_info* mi)
{
DBUG_ENTER("init_connection_config");
mi->connect_retry.set_default();
mi->retry_count.set_default();
mi->master_id= 0;
mi->prev_master_id= 0;
mi->received_heartbeats= 0;
DBUG_VOID_RETURN;
}


void init_master_log_pos(Master_info* mi)
{
DBUG_ENTER("init_master_log_pos");
Expand Down