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; ...@@ -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 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 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 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; start all slaves;
stop slave 'slave1'; stop slave 'slave1';
show slave 'slave1' status; show slave 'slave1' status;
......
...@@ -48,6 +48,12 @@ let relay_log_space2=`select 3*$binlog_start_pos + 178`; ...@@ -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> --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; 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 # Ensure that start all slaves doesn't do anything as all slaves are started
start all slaves; start all slaves;
......
...@@ -873,25 +873,26 @@ def performance_schema replication_applier_status_by_worker LAST_ERROR_MESSAGE 5 ...@@ -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 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 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_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 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 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 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 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 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 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_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 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_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 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 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 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 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 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_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 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_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 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 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_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 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 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 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 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 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 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 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 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 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 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
This diff is collapsed.
...@@ -40,6 +40,13 @@ class Domain_id_filter ...@@ -40,6 +40,13 @@ class Domain_id_filter
*/ */
bool m_filter; bool m_filter;
public:
/* domain id list types */
enum enum_list_type {
DO_DOMAIN_IDS= 0,
IGNORE_DOMAIN_IDS
};
/* /*
DO_DOMAIN_IDS (0): DO_DOMAIN_IDS (0):
Ignore all the events which do not belong to any of the domain ids in the Ignore all the events which do not belong to any of the domain ids in the
...@@ -50,13 +57,6 @@ class Domain_id_filter ...@@ -50,13 +57,6 @@ class Domain_id_filter
*/ */
DYNAMIC_ARRAY m_domain_ids[2]; 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();
~Domain_id_filter(); ~Domain_id_filter();
......
...@@ -54,12 +54,11 @@ table_replication_connection_configuration::m_share= ...@@ -54,12 +54,11 @@ table_replication_connection_configuration::m_share=
sizeof(pos_t), /* ref length */ sizeof(pos_t), /* ref length */
&m_table_lock, &m_table_lock,
{ C_STRING_WITH_LEN("CREATE TABLE replication_connection_configuration(" { 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," "HOST CHAR(60) collate utf8_bin not null,"
"PORT INTEGER not null," "PORT INTEGER not null,"
"USER CHAR(32) collate utf8_bin not null," "USER CHAR(32) collate utf8_bin not null,"
"NETWORK_INTERFACE CHAR(60) collate utf8_bin not null," "USING_GTID ENUM('NO','CURRENT_POS','SLAVE_POS') not null,"
"AUTO_POSITION ENUM('1','0') not null,"
"SSL_ALLOWED ENUM('YES','NO','IGNORED') not null," "SSL_ALLOWED ENUM('YES','NO','IGNORED') not null,"
"SSL_CA_FILE VARCHAR(512) not null," "SSL_CA_FILE VARCHAR(512) not null,"
"SSL_CA_PATH VARCHAR(512) not null," "SSL_CA_PATH VARCHAR(512) not null,"
...@@ -72,10 +71,32 @@ table_replication_connection_configuration::m_share= ...@@ -72,10 +71,32 @@ table_replication_connection_configuration::m_share=
"CONNECTION_RETRY_INTERVAL INTEGER not null," "CONNECTION_RETRY_INTERVAL INTEGER not null,"
"CONNECTION_RETRY_COUNT BIGINT unsigned 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 .'," "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 */ 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) PFS_engine_table* table_replication_connection_configuration::create(void)
{ {
...@@ -154,7 +175,9 @@ int table_replication_connection_configuration::rnd_pos(const void *pos) ...@@ -154,7 +175,9 @@ int table_replication_connection_configuration::rnd_pos(const void *pos)
void table_replication_connection_configuration::make_row(Master_info *mi) void table_replication_connection_configuration::make_row(Master_info *mi)
{ {
DBUG_ENTER("table_replication_connection_configuration::make_row");
char * temp_store; char * temp_store;
bool error= false;
m_row_exists= false; m_row_exists= false;
...@@ -164,8 +187,8 @@ void table_replication_connection_configuration::make_row(Master_info *mi) ...@@ -164,8 +187,8 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
mysql_mutex_lock(&mi->data_lock); mysql_mutex_lock(&mi->data_lock);
mysql_mutex_lock(&mi->rli.data_lock); mysql_mutex_lock(&mi->rli.data_lock);
m_row.channel_name_length= static_cast<uint>(mi->connection_name.length); m_row.connection_name_length= static_cast<uint>(mi->connection_name.length);
memcpy(m_row.channel_name, mi->connection_name.str, m_row.channel_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)); m_row.host_length= static_cast<uint>(strlen(mi->host));
memcpy(m_row.host, mi->host, m_row.host_length); memcpy(m_row.host, mi->host, m_row.host_length);
...@@ -177,14 +200,12 @@ void table_replication_connection_configuration::make_row(Master_info *mi) ...@@ -177,14 +200,12 @@ void table_replication_connection_configuration::make_row(Master_info *mi)
m_row.user_length= static_cast<uint>(strlen(temp_store)); m_row.user_length= static_cast<uint>(strlen(temp_store));
memcpy(m_row.user, temp_store, m_row.user_length); memcpy(m_row.user, temp_store, m_row.user_length);
temp_store= const_cast<char*>(""); //(char*)mi->bind_addr; if (mi->using_gtid == Master_info::USE_GTID_NO)
m_row.network_interface_length= static_cast<uint>(strlen(temp_store)); m_row.using_gtid= PS_USE_GTID_NO;
memcpy(m_row.network_interface, temp_store, m_row.network_interface_length); else if (mi->using_gtid == Master_info::USE_GTID_CURRENT_POS)
m_row.using_gtid= PS_USE_GTID_CURRENT_POS;
if (mi->using_gtid)
m_row.auto_position= PS_RPL_YES;
else else
m_row.auto_position= PS_RPL_NO; m_row.using_gtid= PS_USE_GTID_SLAVE_POS;
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
m_row.ssl_allowed= mi->ssl? PS_SSL_ALLOWED_YES:PS_SSL_ALLOWED_NO; 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) ...@@ -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_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; m_row.heartbeat_interval= (double)mi->heartbeat_period;
temp_store= (char*)""; //mi->tls_version; m_row.ignore_server_ids= convert_array_to_str(&mi->ignore_server_ids);
m_row.tls_version_length= static_cast<uint>(strlen(temp_store)); if (m_row.ignore_server_ids == NULL)
memcpy(m_row.tls_version, temp_store, m_row.tls_version_length); {
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->rli.data_lock);
mysql_mutex_unlock(&mi->data_lock); mysql_mutex_unlock(&mi->data_lock);
if (!error)
m_row_exists= true; m_row_exists= true;
DBUG_VOID_RETURN;
} }
int table_replication_connection_configuration::read_row_values(TABLE *table, int table_replication_connection_configuration::read_row_values(TABLE *table,
...@@ -259,8 +305,8 @@ 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) switch(f->field_index)
{ {
case 0: /** channel_name */ case 0: /** connection_name */
set_field_char_utf8(f, m_row.channel_name, m_row.channel_name_length); set_field_varchar_utf8(f, m_row.connection_name, m_row.connection_name_length);
break; break;
case 1: /** host */ case 1: /** host */
set_field_char_utf8(f, m_row.host, m_row.host_length); 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, ...@@ -271,63 +317,69 @@ int table_replication_connection_configuration::read_row_values(TABLE *table,
case 3: /** user */ case 3: /** user */
set_field_char_utf8(f, m_row.user, m_row.user_length); set_field_char_utf8(f, m_row.user, m_row.user_length);
break; break;
case 4: /** network_interface */ case 4: /** use_gtid */
set_field_char_utf8(f, m_row.network_interface, set_field_enum(f, m_row.using_gtid);
m_row.network_interface_length);
break;
case 5: /** auto_position */
set_field_enum(f, m_row.auto_position);
break; break;
case 6: /** ssl_allowed */ case 5: /** ssl_allowed */
set_field_enum(f, m_row. ssl_allowed); set_field_enum(f, m_row. ssl_allowed);
break; break;
case 7: /**ssl_ca_file */ case 6: /**ssl_ca_file */
set_field_varchar_utf8(f, m_row.ssl_ca_file, set_field_varchar_utf8(f, m_row.ssl_ca_file,
m_row.ssl_ca_file_length); m_row.ssl_ca_file_length);
break; break;
case 8: /** ssl_ca_path */ case 7: /** ssl_ca_path */
set_field_varchar_utf8(f, m_row.ssl_ca_path, set_field_varchar_utf8(f, m_row.ssl_ca_path,
m_row.ssl_ca_path_length); m_row.ssl_ca_path_length);
break; break;
case 9: /** ssl_certificate */ case 8: /** ssl_certificate */
set_field_varchar_utf8(f, m_row.ssl_certificate, set_field_varchar_utf8(f, m_row.ssl_certificate,
m_row.ssl_certificate_length); m_row.ssl_certificate_length);
break; break;
case 10: /** ssl_cipher */ case 9: /** ssl_cipher */
set_field_varchar_utf8(f, m_row.ssl_cipher, m_row.ssl_cipher_length); set_field_varchar_utf8(f, m_row.ssl_cipher, m_row.ssl_cipher_length);
break; break;
case 11: /** ssl_key */ case 10: /** ssl_key */
set_field_varchar_utf8(f, m_row.ssl_key, m_row.ssl_key_length); set_field_varchar_utf8(f, m_row.ssl_key, m_row.ssl_key_length);
break; break;
case 12: /** ssl_verify_server_certificate */ case 11: /** ssl_verify_server_certificate */
set_field_enum(f, m_row.ssl_verify_server_certificate); set_field_enum(f, m_row.ssl_verify_server_certificate);
break; break;
case 13: /** ssl_crl_file */ case 12: /** ssl_crl_file */
set_field_varchar_utf8(f, m_row.ssl_crl_file, set_field_varchar_utf8(f, m_row.ssl_crl_file,
m_row.ssl_crl_file_length); m_row.ssl_crl_file_length);
break; break;
case 14: /** ssl_crl_path */ case 13: /** ssl_crl_path */
set_field_varchar_utf8(f, m_row.ssl_crl_path, set_field_varchar_utf8(f, m_row.ssl_crl_path,
m_row.ssl_crl_path_length); m_row.ssl_crl_path_length);
break; break;
case 15: /** connection_retry_interval */ case 14: /** connection_retry_interval */
set_field_ulong(f, m_row.connection_retry_interval); set_field_ulong(f, m_row.connection_retry_interval);
break; break;
case 16: /** connect_retry_count */ case 15: /** connect_retry_count */
set_field_ulonglong(f, m_row.connection_retry_count); set_field_ulonglong(f, m_row.connection_retry_count);
break; 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); set_field_double(f, m_row.heartbeat_interval);
break; break;
case 18: /** tls_version */ case 17: /** ignore_server_ids */
set_field_varchar_utf8(f, m_row.tls_version, set_field_longtext_utf8(f, m_row.ignore_server_ids,
m_row.tls_version_length); 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; 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: default:
DBUG_ASSERT(false); DBUG_ASSERT(false);
} }
} }
} }
m_row.cleanup();
return 0; return 0;
} }
#endif #endif
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
#include "rpl_mi.h" #include "rpl_mi.h"
#include "mysql_com.h" #include "mysql_com.h"
#include "my_thread.h" #include "my_thread.h"
//#include "rpl_msr.h"
//#include "rpl_info.h" /* CHANNEL_NAME_LENGTH*/
class Master_info; class Master_info;
...@@ -59,22 +57,26 @@ enum enum_ssl_allowed { ...@@ -59,22 +57,26 @@ enum enum_ssl_allowed {
PS_SSL_ALLOWED_NO, PS_SSL_ALLOWED_NO,
PS_SSL_ALLOWED_IGNORED 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 A row in the table. The fields with string values have an additional
length field denoted by <field_name>_length. length field denoted by <field_name>_length.
*/ */
struct st_row_connect_config { struct st_row_connect_config {
char channel_name[CHANNEL_NAME_LENGTH]; char connection_name[CHANNEL_NAME_LENGTH];
uint channel_name_length; uint connection_name_length;
char host[HOSTNAME_LENGTH]; char host[HOSTNAME_LENGTH];
uint host_length; uint host_length;
uint port; uint port;
char user[USERNAME_LENGTH]; char user[USERNAME_LENGTH];
uint user_length; uint user_length;
char network_interface[HOSTNAME_LENGTH]; enum_using_gtid using_gtid;
uint network_interface_length;
enum_rpl_yes_no auto_position;
enum_ssl_allowed ssl_allowed; enum_ssl_allowed ssl_allowed;
char ssl_ca_file[FN_REFLEN]; char ssl_ca_file[FN_REFLEN];
uint ssl_ca_file_length; uint ssl_ca_file_length;
...@@ -94,8 +96,31 @@ struct st_row_connect_config { ...@@ -94,8 +96,31 @@ struct st_row_connect_config {
uint connection_retry_interval; uint connection_retry_interval;
ulong connection_retry_count; ulong connection_retry_count;
double heartbeat_interval; double heartbeat_interval;
char tls_version[FN_REFLEN]; char *ignore_server_ids;
uint tls_version_length; 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. */ /** 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