Commit 5582a45a authored by Sujatha's avatar Sujatha

MDEV-16437: merge 5.7 P_S replication instrumentation and tables

Merge 'replication_connection_configuration' table.

Replaced following columns:
  - CHANNEL_NAME with CONNECTION_NAME
  - AUTO_POSITION with MASTER_USE_GTID
Added new columns for:
  - IGNORE_SERVER_IDS
  - DO_DOMAIN_IDS
  - IGNORE_SERVER_IDS
Removed following columns as they are not part of mariadb replication
connection configuration:
  - NETWORK_INTERFACE
  - TLS_VERSION
parent e5fc78f8
......@@ -21,6 +21,13 @@ show all slaves status;
Connection_name Slave_SQL_State Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert Last_IO_Errno Last_IO_Error Last_SQL_Errno Last_SQL_Error Replicate_Ignore_Server_Ids Master_Server_Id Master_SSL_Crl Master_SSL_Crlpath Using_Gtid Gtid_IO_Pos Replicate_Do_Domain_Ids Replicate_Ignore_Domain_Ids Parallel_Mode SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Slave_DDL_Groups Slave_Non_Transactional_Groups Slave_Transactional_Groups Retried_transactions Max_relay_log_size Executed_log_entries Slave_received_heartbeats Slave_heartbeat_period Gtid_Slave_Pos
slave1 Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_1 60 master-bin.000001 <read_master_log_pos> mysqld-relay-bin-slave1.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> None 0 No 0 No 0 0 1 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 7 0 60.000
slave2 Slave has read all relay log; waiting for more updates Waiting for master to send event 127.0.0.1 root MYPORT_2 60 master-bin.000001 <read_master_log_pos> mysqld-relay-bin-slave2.000002 <relay_log_pos> master-bin.000001 Yes Yes 0 0 <read_master_log_pos> <relay_log_space1> None 0 No 0 No 0 0 2 No optimistic 0 NULL Slave has read all relay log; waiting for more updates 0 0 0 0 1073741824 7 0 60.000
#
# MDEV:16437: merge 5.7 P_S replication instrumentation and tables
#
select * from performance_schema.replication_connection_configuration;
CONNECTION_NAME HOST PORT USER USING_GTID SSL_ALLOWED SSL_CA_FILE SSL_CA_PATH SSL_CERTIFICATE SSL_CIPHER SSL_KEY SSL_VERIFY_SERVER_CERTIFICATE SSL_CRL_FILE SSL_CRL_PATH CONNECTION_RETRY_INTERVAL CONNECTION_RETRY_COUNT HEARTBEAT_INTERVAL IGNORE_SERVER_IDS REPL_DO_DOMAIN_IDS REPL_IGNORE_DOMAIN_IDS
slave2 # # root NO NO NO 60 86400 60.000
slave1 # # root NO NO NO 60 86400 60.000
start all slaves;
stop slave 'slave1';
show slave 'slave1' status;
......
......@@ -48,6 +48,12 @@ let relay_log_space2=`select 3*$binlog_start_pos + 178`;
--replace_result $SERVER_MYPORT_1 MYPORT_1 $SERVER_MYPORT_2 MYPORT_2 $read_master_log_pos <read_master_log_pos> $relay_log_pos <relay_log_pos> $relay_log_space1 <relay_log_space1> $relay_log_space2 <relay_log_space2>
show all slaves status;
--echo #
--echo # MDEV:16437: merge 5.7 P_S replication instrumentation and tables
--echo #
--replace_column 2 # 3 #
select * from performance_schema.replication_connection_configuration;
# Ensure that start all slaves doesn't do anything as all slaves are started
start all slaves;
......
......@@ -873,25 +873,26 @@ def performance_schema replication_applier_status_by_worker LAST_ERROR_MESSAGE 5
def performance_schema replication_applier_status_by_worker LAST_ERROR_TIMESTAMP 6 current_timestamp() NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update current_timestamp() select,insert,update,references NEVER NULL
def performance_schema replication_applier_status_by_worker WORKER_IDLE_TIME 7 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema replication_applier_status_by_worker LAST_TRANS_RETRY_COUNT 8 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration CHANNEL_NAME 1 NULL NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration CONNECTION_NAME 1 NULL NO varchar 256 768 NULL NULL NULL utf8 utf8_general_ci varchar(256) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration HOST 2 NULL NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration PORT 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration USER 4 NULL NO char 32 96 NULL NULL NULL utf8 utf8_bin char(32) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration NETWORK_INTERFACE 5 NULL NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration AUTO_POSITION 6 NULL NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('1','0') select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_ALLOWED 7 NULL NO enum 7 21 NULL NULL NULL utf8 utf8_general_ci enum('YES','NO','IGNORED') select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CA_FILE 8 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CA_PATH 9 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CERTIFICATE 10 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CIPHER 11 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_KEY 12 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_VERIFY_SERVER_CERTIFICATE 13 NULL NO enum 3 9 NULL NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CRL_FILE 14 NULL NO varchar 255 765 NULL NULL NULL utf8 utf8_general_ci varchar(255) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CRL_PATH 15 NULL NO varchar 255 765 NULL NULL NULL utf8 utf8_general_ci varchar(255) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration CONNECTION_RETRY_INTERVAL 16 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration CONNECTION_RETRY_COUNT 17 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration HEARTBEAT_INTERVAL 18 NULL NO double NULL NULL 10 3 NULL NULL NULL double(10,3) unsigned select,insert,update,references Number of seconds after which a heartbeat will be sent . NEVER NULL
def performance_schema replication_connection_configuration TLS_VERSION 19 NULL NO varchar 255 765 NULL NULL NULL utf8 utf8_general_ci varchar(255) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration USING_GTID 5 NULL NO enum 11 33 NULL NULL NULL utf8 utf8_general_ci enum('NO','CURRENT_POS','SLAVE_POS') select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_ALLOWED 6 NULL NO enum 7 21 NULL NULL NULL utf8 utf8_general_ci enum('YES','NO','IGNORED') select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CA_FILE 7 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CA_PATH 8 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CERTIFICATE 9 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CIPHER 10 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_KEY 11 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_VERIFY_SERVER_CERTIFICATE 12 NULL NO enum 3 9 NULL NULL NULL utf8 utf8_general_ci enum('YES','NO') select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CRL_FILE 13 NULL NO varchar 255 765 NULL NULL NULL utf8 utf8_general_ci varchar(255) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration SSL_CRL_PATH 14 NULL NO varchar 255 765 NULL NULL NULL utf8 utf8_general_ci varchar(255) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration CONNECTION_RETRY_INTERVAL 15 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration CONNECTION_RETRY_COUNT 16 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration HEARTBEAT_INTERVAL 17 NULL NO double NULL NULL 10 3 NULL NULL NULL double(10,3) unsigned select,insert,update,references Number of seconds after which a heartbeat will be sent . NEVER NULL
def performance_schema replication_connection_configuration IGNORE_SERVER_IDS 18 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration REPL_DO_DOMAIN_IDS 19 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select,insert,update,references NEVER NULL
def performance_schema replication_connection_configuration REPL_IGNORE_DOMAIN_IDS 20 NULL NO longtext 4294967295 4294967295 NULL NULL NULL utf8 utf8_general_ci longtext select,insert,update,references NEVER NULL
def performance_schema rwlock_instances NAME 1 NULL NO varchar 128 384 NULL NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references NEVER NULL
def performance_schema rwlock_instances OBJECT_INSTANCE_BEGIN 2 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
def performance_schema rwlock_instances WRITE_LOCKED_BY_THREAD_ID 3 NULL YES bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL
......
include/master-slave.inc
[connection master]
# Asserted this: On master, the table should return an empty set.
connection slave;
# Verify that SELECT works for every field and produces an output
# similar to the corresponding field in SHOW SLAVE STATUS(SSS).
include/assert.inc [Value returned by SSS and PS table for Host should be same.]
include/assert.inc [Value returned by SSS and PS table for Port should be same.]
include/assert.inc [Value returned by SSS and PS table for User should be same.]
include/assert.inc [Value returned by SSS and PS table for Using_Gtid should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Allowed should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_CA_File should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_CA_Path should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Certificate should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Cipher should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Key should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Crl_File should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Crl_Path should be same.]
include/assert.inc [Value returned by SSS and PS table for Connection_Retry_Interval should be same.]
include/assert.inc [Value returned by PS table for Connection_Retry_Count should be 10.]
# Heartbeat_Interval is part of I_S and P_S. We will compare the
# two to make sure both match.
include/assert.inc [Value returned by IS and PS table for Heartbeat_Interval should be same.]
# Change configuration parameters and verify that these changes
# are shown correctly by SELECTs from PS table.
connection master;
create user replssl@localhost;
grant replication slave on *.* to replssl@localhost require ssl;
include/sync_slave_sql_with_master.inc
include/stop_slave.inc
change master to
master_user= 'replssl',
master_password= '',
master_ssl= 1,
master_ssl_ca= 'MYSQL_TEST_DIR/std_data/cacert.pem',
master_ssl_cert= 'MYSQL_TEST_DIR/std_data/client-cert.pem',
master_ssl_key= 'MYSQL_TEST_DIR/std_data/client-key.pem';
include/start_slave.inc
connection slave;
# Checking SSL parameters, they were empty in tests done in the
# previous section.
include/assert.inc [Value returned by SSS and PS table for SSL_Allowed should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_CA_File should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_CA_Path should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Certificate should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Cipher should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Key should be same.]
include/assert.inc [Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.]
connection master;
drop user replssl@localhost;
connection slave;
include/stop_slave.inc
CHANGE MASTER TO
master_host= '127.0.0.1',
master_user= 'root',
master_password= '',
master_ssl_ca= '',
master_ssl_cert= '',
master_ssl_key= '',
master_ssl_verify_server_cert=0,
master_ssl=0,
master_use_gtid=no;
include/start_slave.inc
# Test with different MASTER_USE_GTID values
# 1) Test for MASTER_USE_GTID=NO
include/stop_slave.inc
change master to
master_user = 'root',
master_use_gtid = NO;
include/assert.inc [Value returned by SSS and PS table for Using_Gtid should be same.]
# 2) Test for Auto_position= CURRENT_POS.
change master to
master_user = 'root',
master_use_gtid= CURRENT_POS;
include/assert.inc [Value returned by SSS and PS table for Using_Gtid should be same.]
# 3) Test for Auto_position= SLAVE_POS
change master to
master_user = 'root',
master_use_gtid= SLAVE_POS;
include/assert.inc [Value returned by SSS and PS table for Using_Gtid should be same.]
# Test INOGRE_SERVER_IDS
# 1) Test for IGNORE_SERVER_IDS= (10, 100);
connection slave;
change master to IGNORE_SERVER_IDS= (10, 100);
include/assert.inc [Value returned by SSS and PS table for Ignore_server_ids should be same.]
CHANGE MASTER TO IGNORE_SERVER_IDS=();
# 2) Test for IGNORE_DOMAIN_IDS(2)
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(2), MASTER_USE_GTID=slave_pos;
include/start_slave.inc
include/assert.inc [Value returned by SSS and PS table for Replicate_Ignore_Domain_Ids should be same.]
include/stop_slave.inc
# 3) Test for DO_DOMAIN_IDS(1)
CHANGE MASTER TO DO_DOMAIN_IDS=(1), IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
include/start_slave.inc
include/assert.inc [Value returned by SSS and PS table for Replicate_Do_Domain_Ids should be same.]
include/stop_slave.inc
CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=();
include/start_slave.inc
include/rpl_end.inc
# ==== Purpose ====
#
# This test script serves as the functionality testing for the table
# performance_schema.replication_connection_configuration. Test for ddl and dml
# operations is a part of the perfschema suite. The ddl/dml tests are named:
# 1) ddl_replication_connection_configuration.test and
# 2) dml_replication_connection_configuration.test.
#
# This test script does the following:
# - On master, the table returns an empty set.
# - We perform all other testing on connection "slave". So, the below points
# are checked on slave only.
# - Verify that SELECT works for every field in the table.
# - The SELECT per field produces an output similar to the corresponding field
# in SHOW SLAVE STATUS(SSS), if there is one.
# - If there is no matching field in SSS, we resort to other method of testing
# those fields.
#
# The follwing scenarios are tested:
#
# - Test each field on a fresh replication setup.
# - Change configuration parameters using CHANGE MASTER TO and verify that
# these changes are seen in SELECTs from PS table.
# - Verify that, the change in values are correctly shown by the table.
# - Verify different values for MASTER_USE_GTID are present in table.
# - Verify IGNORE_SERVER_IDS, DO_DOMAIN_IDS and IGNORE_DOMAIN_IDS
#
# ==== Related Worklog ====
#
# MDEV-16437: merge 5.7 P_S replication instrumentation and tables
#
source include/master-slave.inc;
source include/have_ssl_communication.inc;
source include/have_binlog_format_mixed.inc;
--let $assert_text= On master, the table should return an empty set.
--let $assert_cond= count(*) = 0 from performance_schema.replication_connection_configuration
--source include/rpl_assert.inc
--connection slave
--echo
--echo # Verify that SELECT works for every field and produces an output
--echo # similar to the corresponding field in SHOW SLAVE STATUS(SSS).
--echo
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
let $ps_value= query_get_value(select Host from performance_schema.replication_connection_configuration, Host, 1);
let $assert_text= Value returned by SSS and PS table for Host should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_Port, 1);
let $ps_value= query_get_value(select Port from performance_schema.replication_connection_configuration, Port, 1);
let $assert_text= Value returned by SSS and PS table for Port should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_User, 1);
let $ps_value= query_get_value(select User from performance_schema.replication_connection_configuration, User, 1);
let $assert_text= Value returned by SSS and PS table for User should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
let $ps_value= query_get_value(select SSL_Allowed from performance_schema.replication_connection_configuration, SSL_Allowed, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Allowed should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_File, 1);
let $ps_value= query_get_value(select SSL_CA_File from performance_schema.replication_connection_configuration, SSL_CA_File, 1);
let $assert_text= Value returned by SSS and PS table for SSL_CA_File should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_Path, 1);
let $ps_value= query_get_value(select SSL_CA_Path from performance_schema.replication_connection_configuration, SSL_CA_Path, 1);
let $assert_text= Value returned by SSS and PS table for SSL_CA_Path should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cert, 1);
let $ps_value= query_get_value(select SSL_Certificate from performance_schema.replication_connection_configuration, SSL_Certificate, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Certificate should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cipher, 1);
let $ps_value= query_get_value(select SSL_Cipher from performance_schema.replication_connection_configuration, SSL_Cipher, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Cipher should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Key, 1);
let $ps_value= query_get_value(select SSL_Key from performance_schema.replication_connection_configuration, SSL_Key, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Key should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1);
let $ps_value= query_get_value(select SSL_Verify_Server_Certificate from performance_schema.replication_connection_configuration, SSL_Verify_Server_Certificate, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crl, 1);
let $ps_value= query_get_value(select SSL_Crl_File from performance_schema.replication_connection_configuration, SSL_Crl_File, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Crl_File should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Crlpath, 1);
let $ps_value= query_get_value(select SSL_Crl_Path from performance_schema.replication_connection_configuration, SSL_Crl_Path, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Crl_Path should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Connect_Retry, 1);
let $ps_value= query_get_value(select Connection_Retry_Interval from performance_schema.replication_connection_configuration, Connection_Retry_Interval, 1);
let $assert_text= Value returned by SSS and PS table for Connection_Retry_Interval should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $ps_value= query_get_value(select Connection_Retry_Count from performance_schema.replication_connection_configuration, Connection_Retry_Count, 1);
let $assert_text= Value returned by PS table for Connection_Retry_Count should be 10.; # master-retry-count=10, as part of default my.cnf used by MTR
let $assert_cond= "$ps_value" = 10;
source include/assert.inc;
--echo
--echo # Heartbeat_Interval is part of I_S and P_S. We will compare the
--echo # two to make sure both match.
--echo
let $is_value= query_get_value(select Variable_Value from information_schema.GLOBAL_STATUS where variable_name= 'Slave_heartbeat_period', Variable_Value, 1);
let $ps_value= query_get_value(select Heartbeat_Interval from performance_schema.replication_connection_configuration, Heartbeat_Interval, 1);
let $assert_text= Value returned by IS and PS table for Heartbeat_Interval should be same.;
let $assert_cond= $is_value = $ps_value;
source include/assert.inc;
--echo
--echo # Change configuration parameters and verify that these changes
--echo # are shown correctly by SELECTs from PS table.
--echo
# create a user for replication that requires ssl encryption
--connection master
create user replssl@localhost;
grant replication slave on *.* to replssl@localhost require ssl;
--source include/sync_slave_sql_with_master.inc
# Setup slave to use SSL for connection to master
--source include/stop_slave.inc
replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR;
replace_column 2 ####;
eval change master to
master_user= 'replssl',
master_password= '',
master_ssl= 1,
master_ssl_ca= '$MYSQL_TEST_DIR/std_data/cacert.pem',
master_ssl_cert= '$MYSQL_TEST_DIR/std_data/client-cert.pem',
master_ssl_key= '$MYSQL_TEST_DIR/std_data/client-key.pem';
--source include/start_slave.inc
--connection slave
--echo
--echo # Checking SSL parameters, they were empty in tests done in the
--echo # previous section.
--echo
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
let $ps_value= query_get_value(select SSL_Allowed from performance_schema.replication_connection_configuration, SSL_Allowed, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Allowed should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_File, 1);
let $ps_value= query_get_value(select SSL_CA_File from performance_schema.replication_connection_configuration, SSL_CA_File, 1);
let $assert_text= Value returned by SSS and PS table for SSL_CA_File should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_CA_Path, 1);
let $ps_value= query_get_value(select SSL_CA_Path from performance_schema.replication_connection_configuration, SSL_CA_Path, 1);
let $assert_text= Value returned by SSS and PS table for SSL_CA_Path should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cert, 1);
let $ps_value= query_get_value(select SSL_Certificate from performance_schema.replication_connection_configuration, SSL_Certificate, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Certificate should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Cipher, 1);
let $ps_value= query_get_value(select SSL_Cipher from performance_schema.replication_connection_configuration, SSL_Cipher, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Cipher should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Key, 1);
let $ps_value= query_get_value(select SSL_Key from performance_schema.replication_connection_configuration, SSL_Key, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Key should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Master_SSL_Verify_Server_Cert, 1);
let $ps_value= query_get_value(select SSL_Verify_Server_Certificate from performance_schema.replication_connection_configuration, SSL_Verify_Server_Certificate, 1);
let $assert_text= Value returned by SSS and PS table for SSL_Verify_Server_Certificate should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--connection master
drop user replssl@localhost;
--sync_slave_with_master
--source include/stop_slave.inc
CHANGE MASTER TO
master_host= '127.0.0.1',
master_user= 'root',
master_password= '',
master_ssl_ca= '',
master_ssl_cert= '',
master_ssl_key= '',
master_ssl_verify_server_cert=0,
master_ssl=0,
master_use_gtid=no;
--source include/start_slave.inc
--echo
--echo # Test with different MASTER_USE_GTID values
--echo
--echo
--echo # 1) Test for MASTER_USE_GTID=NO
--echo
--source include/stop_slave.inc
replace_column 2 ####;
change master to
master_user = 'root',
master_use_gtid = NO;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--echo
--echo # 2) Test for Auto_position= CURRENT_POS.
--echo
replace_column 2 ####;
change master to
master_user = 'root',
master_use_gtid= CURRENT_POS;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--echo
--echo # 3) Test for Auto_position= SLAVE_POS
--echo
replace_column 2 ####;
change master to
master_user = 'root',
master_use_gtid= SLAVE_POS;
let $sss_value= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1);
let $ps_value= query_get_value(select Using_Gtid from performance_schema.replication_connection_configuration, Using_Gtid, 1);
let $assert_text= Value returned by SSS and PS table for Using_Gtid should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--echo
--echo # Test INOGRE_SERVER_IDS
--echo
--echo
--echo # 1) Test for IGNORE_SERVER_IDS= (10, 100);
--echo
--connection slave
change master to IGNORE_SERVER_IDS= (10, 100);
let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
let $ps_value= query_get_value(select Ignore_Server_Ids from performance_schema.replication_connection_configuration, Ignore_Server_Ids, 1);
let $assert_text= Value returned by SSS and PS table for Ignore_server_ids should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
CHANGE MASTER TO IGNORE_SERVER_IDS=();
--echo
--echo # 2) Test for IGNORE_DOMAIN_IDS(2)
--echo
CHANGE MASTER TO IGNORE_DOMAIN_IDS=(2), MASTER_USE_GTID=slave_pos;
--source include/start_slave.inc
let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Domain_Ids, 1);
let $ps_value= query_get_value(select Repl_Ignore_Domain_Ids from performance_schema.replication_connection_configuration, Repl_Ignore_Domain_Ids, 1);
let $assert_text= Value returned by SSS and PS table for Replicate_Ignore_Domain_Ids should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--source include/stop_slave.inc
--echo
--echo # 3) Test for DO_DOMAIN_IDS(1)
--echo
CHANGE MASTER TO DO_DOMAIN_IDS=(1), IGNORE_DOMAIN_IDS=(), MASTER_USE_GTID=slave_pos;
--source include/start_slave.inc
let $sss_value= query_get_value(SHOW SLAVE STATUS, Replicate_Do_Domain_Ids, 1);
let $ps_value= query_get_value(select Repl_Do_Domain_Ids from performance_schema.replication_connection_configuration, Repl_Do_Domain_Ids, 1);
let $assert_text= Value returned by SSS and PS table for Replicate_Do_Domain_Ids should be same.;
let $assert_cond= "$sss_value" = "$ps_value";
source include/assert.inc;
--source include/stop_slave.inc
CHANGE MASTER TO DO_DOMAIN_IDS=(), IGNORE_DOMAIN_IDS=();
--source include/start_slave.inc
source include/rpl_end.inc;
......@@ -40,6 +40,13 @@ class Domain_id_filter
*/
bool m_filter;
public:
/* domain id list types */
enum enum_list_type {
DO_DOMAIN_IDS= 0,
IGNORE_DOMAIN_IDS
};
/*
DO_DOMAIN_IDS (0):
Ignore all the events which do not belong to any of the domain ids in the
......@@ -50,13 +57,6 @@ class Domain_id_filter
*/
DYNAMIC_ARRAY m_domain_ids[2];
public:
/* domain id list types */
enum enum_list_type {
DO_DOMAIN_IDS= 0,
IGNORE_DOMAIN_IDS
};
Domain_id_filter();
~Domain_id_filter();
......
......@@ -54,12 +54,11 @@ table_replication_connection_configuration::m_share=
sizeof(pos_t), /* ref length */
&m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE replication_connection_configuration("
"CHANNEL_NAME CHAR(64) collate utf8_general_ci not null,"
"CONNECTION_NAME VARCHAR(256) collate utf8_general_ci not null,"
"HOST CHAR(60) collate utf8_bin not null,"
"PORT INTEGER not null,"
"USER CHAR(32) collate utf8_bin not null,"
"NETWORK_INTERFACE CHAR(60) collate utf8_bin not null,"
"AUTO_POSITION ENUM('1','0') not null,"
"USING_GTID ENUM('NO','CURRENT_POS','SLAVE_POS') not null,"
"SSL_ALLOWED ENUM('YES','NO','IGNORED') not null,"
"SSL_CA_FILE VARCHAR(512) not null,"
"SSL_CA_PATH VARCHAR(512) not null,"
......@@ -72,10 +71,32 @@ table_replication_connection_configuration::m_share=
"CONNECTION_RETRY_INTERVAL INTEGER not null,"
"CONNECTION_RETRY_COUNT BIGINT unsigned not null,"
"HEARTBEAT_INTERVAL DOUBLE(10,3) unsigned not null COMMENT 'Number of seconds after which a heartbeat will be sent .',"
"TLS_VERSION VARCHAR(255) not null)") },
"IGNORE_SERVER_IDS LONGTEXT not null,"
"REPL_DO_DOMAIN_IDS LONGTEXT not null,"
"REPL_IGNORE_DOMAIN_IDS LONGTEXT not null)") },
false /* perpetual */
};
static char *convert_array_to_str(DYNAMIC_ARRAY *ids)
{
char *buf;
size_t sz, cur_len= 0;
sz= (sizeof(ulong) * 3 + 1) * (1 + ids->elements);
if (!(buf= (char *) my_malloc(PSI_INSTRUMENT_ME, sz, MYF(MY_WME))))
return NULL;
buf[0]= 0;
for (uint i= 0; i < ids->elements; i++)
{
ulong domain_id;
get_dynamic(ids, (void *) &domain_id, i);
cur_len+= my_snprintf(buf + cur_len, sz, (i == 0 ? "%lu" : ", %lu"), domain_id);
sz-= cur_len;
}
return buf;
}
PFS_engine_table* table_replication_connection_configuration::create(void)
{
......@@ -154,7 +175,9 @@ int table_replication_connection_configuration::rnd_pos(const void *pos)
void table_replication_connection_configuration::make_row(Master_info *mi)
{
DBUG_ENTER("table_replication_connection_configuration::make_row");
char * temp_store;
bool error= false;
m_row_exists= false;
......@@ -164,8 +187,8 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
mysql_mutex_lock(&mi->data_lock);
mysql_mutex_lock(&mi->rli.data_lock);
m_row.channel_name_length= static_cast<uint>(mi->connection_name.length);
memcpy(m_row.channel_name, mi->connection_name.str, m_row.channel_name_length);
m_row.connection_name_length= static_cast<uint>(mi->connection_name.length);
memcpy(m_row.connection_name, mi->connection_name.str, m_row.connection_name_length);
m_row.host_length= static_cast<uint>(strlen(mi->host));
memcpy(m_row.host, mi->host, m_row.host_length);
......@@ -177,14 +200,12 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
m_row.user_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.user, temp_store, m_row.user_length);
temp_store= const_cast<char*>(""); //(char*)mi->bind_addr;
m_row.network_interface_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.network_interface, temp_store, m_row.network_interface_length);
if (mi->using_gtid)
m_row.auto_position= PS_RPL_YES;
if (mi->using_gtid == Master_info::USE_GTID_NO)
m_row.using_gtid= PS_USE_GTID_NO;
else if (mi->using_gtid == Master_info::USE_GTID_CURRENT_POS)
m_row.using_gtid= PS_USE_GTID_CURRENT_POS;
else
m_row.auto_position= PS_RPL_NO;
m_row.using_gtid= PS_USE_GTID_SLAVE_POS;
#ifdef HAVE_OPENSSL
m_row.ssl_allowed= mi->ssl? PS_SSL_ALLOWED_YES:PS_SSL_ALLOWED_NO;
......@@ -227,18 +248,43 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
m_row.connection_retry_interval= (unsigned int) mi->connect_retry;
m_row.connection_retry_count= 0; //(ulong) mi->retry_count;
m_row.connection_retry_count= master_retry_count; //(ulong) mi->retry_count;
m_row.heartbeat_interval= (double)mi->heartbeat_period;
temp_store= (char*)""; //mi->tls_version;
m_row.tls_version_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.tls_version, temp_store, m_row.tls_version_length);
m_row.ignore_server_ids= convert_array_to_str(&mi->ignore_server_ids);
if (m_row.ignore_server_ids == NULL)
{
error= true;
goto end;
}
m_row.ignore_server_ids_length= static_cast<uint>(strlen(m_row.ignore_server_ids));
m_row.do_domain_ids_str=
convert_array_to_str(&mi->domain_id_filter.m_domain_ids[Domain_id_filter::DO_DOMAIN_IDS]);
if (m_row.do_domain_ids_str == NULL)
{
error= true;
goto end;
}
m_row.do_domain_ids_str_length= static_cast<uint>(strlen(m_row.do_domain_ids_str));
m_row.ignore_domain_ids_str=
convert_array_to_str(&mi->domain_id_filter.m_domain_ids[Domain_id_filter::IGNORE_DOMAIN_IDS]);
if (m_row.ignore_domain_ids_str == NULL)
{
error= true;
goto end;
}
m_row.ignore_domain_ids_str_length=
static_cast<uint>(strlen(m_row.ignore_domain_ids_str));
end:
mysql_mutex_unlock(&mi->rli.data_lock);
mysql_mutex_unlock(&mi->data_lock);
m_row_exists= true;
if (!error)
m_row_exists= true;
DBUG_VOID_RETURN;
}
int table_replication_connection_configuration::read_row_values(TABLE *table,
......@@ -259,8 +305,8 @@ int table_replication_connection_configuration::read_row_values(TABLE *table,
{
switch(f->field_index)
{
case 0: /** channel_name */
set_field_char_utf8(f, m_row.channel_name, m_row.channel_name_length);
case 0: /** connection_name */
set_field_varchar_utf8(f, m_row.connection_name, m_row.connection_name_length);
break;
case 1: /** host */
set_field_char_utf8(f, m_row.host, m_row.host_length);
......@@ -271,63 +317,69 @@ int table_replication_connection_configuration::read_row_values(TABLE *table,
case 3: /** user */
set_field_char_utf8(f, m_row.user, m_row.user_length);
break;
case 4: /** network_interface */
set_field_char_utf8(f, m_row.network_interface,
m_row.network_interface_length);
break;
case 5: /** auto_position */
set_field_enum(f, m_row.auto_position);
case 4: /** use_gtid */
set_field_enum(f, m_row.using_gtid);
break;
case 6: /** ssl_allowed */
case 5: /** ssl_allowed */
set_field_enum(f, m_row. ssl_allowed);
break;
case 7: /**ssl_ca_file */
case 6: /**ssl_ca_file */
set_field_varchar_utf8(f, m_row.ssl_ca_file,
m_row.ssl_ca_file_length);
break;
case 8: /** ssl_ca_path */
case 7: /** ssl_ca_path */
set_field_varchar_utf8(f, m_row.ssl_ca_path,
m_row.ssl_ca_path_length);
break;
case 9: /** ssl_certificate */
case 8: /** ssl_certificate */
set_field_varchar_utf8(f, m_row.ssl_certificate,
m_row.ssl_certificate_length);
break;
case 10: /** ssl_cipher */
case 9: /** ssl_cipher */
set_field_varchar_utf8(f, m_row.ssl_cipher, m_row.ssl_cipher_length);
break;
case 11: /** ssl_key */
case 10: /** ssl_key */
set_field_varchar_utf8(f, m_row.ssl_key, m_row.ssl_key_length);
break;
case 12: /** ssl_verify_server_certificate */
case 11: /** ssl_verify_server_certificate */
set_field_enum(f, m_row.ssl_verify_server_certificate);
break;
case 13: /** ssl_crl_file */
case 12: /** ssl_crl_file */
set_field_varchar_utf8(f, m_row.ssl_crl_file,
m_row.ssl_crl_file_length);
break;
case 14: /** ssl_crl_path */
case 13: /** ssl_crl_path */
set_field_varchar_utf8(f, m_row.ssl_crl_path,
m_row.ssl_crl_path_length);
break;
case 15: /** connection_retry_interval */
case 14: /** connection_retry_interval */
set_field_ulong(f, m_row.connection_retry_interval);
break;
case 16: /** connect_retry_count */
case 15: /** connect_retry_count */
set_field_ulonglong(f, m_row.connection_retry_count);
break;
case 17:/** number of seconds after which heartbeat will be sent */
case 16:/** number of seconds after which heartbeat will be sent */
set_field_double(f, m_row.heartbeat_interval);
break;
case 18: /** tls_version */
set_field_varchar_utf8(f, m_row.tls_version,
m_row.tls_version_length);
case 17: /** ignore_server_ids */
set_field_longtext_utf8(f, m_row.ignore_server_ids,
m_row.ignore_server_ids_length);
break;
case 18: /** do_domain_ids */
set_field_longtext_utf8(f, m_row.do_domain_ids_str,
m_row.do_domain_ids_str_length);
break;
case 19: /** ignore_domain_ids */
set_field_longtext_utf8(f, m_row.ignore_domain_ids_str,
m_row.ignore_domain_ids_str_length);
break;
default:
DBUG_ASSERT(false);
}
}
}
m_row.cleanup();
return 0;
}
#endif
......@@ -35,8 +35,6 @@
#include "rpl_mi.h"
#include "mysql_com.h"
#include "my_thread.h"
//#include "rpl_msr.h"
//#include "rpl_info.h" /* CHANNEL_NAME_LENGTH*/
class Master_info;
......@@ -59,22 +57,26 @@ enum enum_ssl_allowed {
PS_SSL_ALLOWED_NO,
PS_SSL_ALLOWED_IGNORED
};
enum enum_using_gtid {
PS_USE_GTID_NO= 1,
PS_USE_GTID_CURRENT_POS,
PS_USE_GTID_SLAVE_POS
};
/**
A row in the table. The fields with string values have an additional
length field denoted by <field_name>_length.
*/
struct st_row_connect_config {
char channel_name[CHANNEL_NAME_LENGTH];
uint channel_name_length;
char connection_name[CHANNEL_NAME_LENGTH];
uint connection_name_length;
char host[HOSTNAME_LENGTH];
uint host_length;
uint port;
char user[USERNAME_LENGTH];
uint user_length;
char network_interface[HOSTNAME_LENGTH];
uint network_interface_length;
enum_rpl_yes_no auto_position;
enum_using_gtid using_gtid;
enum_ssl_allowed ssl_allowed;
char ssl_ca_file[FN_REFLEN];
uint ssl_ca_file_length;
......@@ -94,8 +96,31 @@ struct st_row_connect_config {
uint connection_retry_interval;
ulong connection_retry_count;
double heartbeat_interval;
char tls_version[FN_REFLEN];
uint tls_version_length;
char *ignore_server_ids;
uint ignore_server_ids_length;
char *do_domain_ids_str;
uint do_domain_ids_str_length;
char *ignore_domain_ids_str;
uint ignore_domain_ids_str_length;
void cleanup()
{
if (ignore_server_ids != NULL)
{
my_free(ignore_server_ids);
ignore_server_ids= NULL;
}
if (do_domain_ids_str != NULL)
{
my_free(do_domain_ids_str);
do_domain_ids_str= NULL;
}
if (ignore_domain_ids_str != NULL)
{
my_free(ignore_domain_ids_str);
ignore_domain_ids_str= NULL;
}
}
};
/** Table PERFORMANCE_SCHEMA.TABLE_REPLICATION_CONNECTION_CONFIGURATION. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment