diff options
author | Sujatha <sujatha.sivakumar@mariadb.com> | 2021-04-16 09:05:39 +0530 |
---|---|---|
committer | Sujatha <sujatha.sivakumar@mariadb.com> | 2021-04-16 09:05:39 +0530 |
commit | 767648cc2b4885b080a108bedb952e409fb1c8b0 (patch) | |
tree | 81a45ae6436e9d17cb887a14ab863aab3485f336 | |
parent | 70642871bc404a6844120b5df41b07a36edcdb0f (diff) | |
download | mariadb-git-767648cc2b4885b080a108bedb952e409fb1c8b0.tar.gz |
MDEV-16437: merge 5.7 P_S replication instrumentation and tables
Merge 'replication_applier_configuration' table.
This table captures SQL_THREAD configuration parameters.
6 files changed, 141 insertions, 24 deletions
diff --git a/mysql-test/suite/perfschema/r/information_schema.result b/mysql-test/suite/perfschema/r/information_schema.result index c0aff9bb956..7c7874642b2 100644 --- a/mysql-test/suite/perfschema/r/information_schema.result +++ b/mysql-test/suite/perfschema/r/information_schema.result @@ -228,7 +228,7 @@ mutex_instances 10 Dynamic objects_summary_global_by_type 10 Dynamic performance_timers 10 Fixed prepared_statements_instances 10 Dynamic -replication_applier_configuration 10 Fixed +replication_applier_configuration 10 Dynamic replication_applier_status 10 Fixed replication_applier_status_by_coordinator 10 Dynamic replication_applier_status_by_worker 10 Dynamic diff --git a/mysql-test/suite/perfschema/r/table_schema.result b/mysql-test/suite/perfschema/r/table_schema.result index 817b38feeb7..b0fe0b33cdd 100644 --- a/mysql-test/suite/perfschema/r/table_schema.result +++ b/mysql-test/suite/perfschema/r/table_schema.result @@ -853,7 +853,7 @@ def performance_schema prepared_statements_instances SUM_SORT_ROWS 32 NULL NO bi def performance_schema prepared_statements_instances SUM_SORT_SCAN 33 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema prepared_statements_instances SUM_NO_INDEX_USED 34 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def performance_schema prepared_statements_instances SUM_NO_GOOD_INDEX_USED 35 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL -def performance_schema replication_applier_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_applier_configuration CHANNEL_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_applier_configuration DESIRED_DELAY 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL def performance_schema replication_applier_status 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_applier_status SERVICE_STATE 2 NULL NO enum 3 9 NULL NULL NULL utf8 utf8_general_ci enum('ON','OFF') select,insert,update,references NEVER NULL diff --git a/mysql-test/suite/rpl/r/rpl_perfschema_applier_config.result b/mysql-test/suite/rpl/r/rpl_perfschema_applier_config.result new file mode 100644 index 00000000000..a910bbc834d --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_perfschema_applier_config.result @@ -0,0 +1,35 @@ +include/master-slave.inc +[connection master] +include/assert.inc [On master, the table should return an empty set.] +connection slave; + +# Verify that SELECT works and produces an output similar to +# the corresponding field in SHOW SLAVE STATUS(SSS) in all scenarios. + + +# Verify that output is same as SSS on a fresh slave. + +include/assert.inc [Value returned by SSS and PS table for Desired_Delay should be same.] + +# Verify that the value of this field is correct after STOP SLAVE. + +include/stop_slave.inc +include/assert.inc [Value returned by SSS and PS table for Desired_Delay should be same.] + +# Verify that, when desired delay is set, the value is shown corectly. + +change master to master_delay= 2; +include/start_slave.inc +include/assert.inc [Value returned by SSS and PS table for Desired_Delay should be same.] + +# Verify that the value is preserved after STOP SLAVE. + +include/stop_slave.inc +include/assert.inc [Value returned by SSS and PS table for Desired_Delay should be same.] + +# Verify that, when desired delay is reset, the value is shown corectly. + +change master to master_delay= 0; +include/start_slave.inc +include/assert.inc [Value returned by SSS and PS table for Desired_Delay should be same.] +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_perfschema_applier_config.test b/mysql-test/suite/rpl/t/rpl_perfschema_applier_config.test new file mode 100644 index 00000000000..5e7b1104ed5 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_perfschema_applier_config.test @@ -0,0 +1,97 @@ +# ==== Purpose ==== +# +# This test script serves as the functionality testing for the table +# performance_schema.replication_applier_configuration. Test for ddl and dml +# operations is a part of the perfschema suite. The ddl/dml tests are named: +# 1) ddl_replication_applier_configuration.test and +# 2) dml_replication_applier_configuration.test. +# +# The follwing scenarios are tested in this script: +# +# - Verify that output is same as SSS on a fresh slave. +# - Verify that the value of this field is correct after STOP SLAVE. +# - Verify that, when desired delay is set, the value is shown corectly. +# - Verify that the value is preserved after STOP SLAVE. +# - Verify that, when desired delay is reset, the value is shown corectly. +# +# ==== Related Worklog ==== +# +# MDEV-16437: merge 5.7 P_S replication instrumentation and tables +# + +source include/have_perfschema.inc; +source include/have_binlog_format_mixed.inc; +source include/master-slave.inc; + +let $assert_text= On master, the table should return an empty set.; +let $assert_cond= count(*) = 0 from performance_schema.replication_applier_configuration; +source include/assert.inc; + +--connection slave + +--echo +--echo # Verify that SELECT works and produces an output similar to +--echo # the corresponding field in SHOW SLAVE STATUS(SSS) in all scenarios. +--echo + +--echo +--echo # Verify that output is same as SSS on a fresh slave. +--echo + +let $sss_value= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1); +let $ps_value= query_get_value(select Desired_Delay from performance_schema.replication_applier_configuration, Desired_Delay, 1); +let $assert_text= Value returned by SSS and PS table for Desired_Delay should be same.; +let $assert_cond= "$sss_value" = "$ps_value"; +source include/assert.inc; + +--echo +--echo # Verify that the value of this field is correct after STOP SLAVE. +--echo + +source include/stop_slave.inc; + +let $sss_value= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1); +let $ps_value= query_get_value(select Desired_Delay from performance_schema.replication_applier_configuration, Desired_Delay, 1); +let $assert_text= Value returned by SSS and PS table for Desired_Delay should be same.; +let $assert_cond= "$sss_value" = "$ps_value"; +source include/assert.inc; + +--echo +--echo # Verify that, when desired delay is set, the value is shown corectly. +--echo + +eval change master to master_delay= 2; +source include/start_slave.inc; + +let $sss_value= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1); +let $ps_value= query_get_value(select Desired_Delay from performance_schema.replication_applier_configuration, Desired_Delay, 1); +let $assert_text= Value returned by SSS and PS table for Desired_Delay should be same.; +let $assert_cond= "$sss_value" = "$ps_value"; +source include/assert.inc; + +--echo +--echo # Verify that the value is preserved after STOP SLAVE. +--echo + +source include/stop_slave.inc; + +let $ss_value= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1); +let $ps_value= query_get_value(select Desired_Delay from performance_schema.replication_applier_configuration, Desired_Delay, 1); +let $assert_text= Value returned by SSS and PS table for Desired_Delay should be same.; +let $assert_cond= "$sss_value" = "$ps_value"; +source include/assert.inc; + +--echo +--echo # Verify that, when desired delay is reset, the value is shown corectly. +--echo + +eval change master to master_delay= 0; +source include/start_slave.inc; + +let $sss_value= query_get_value(SHOW SLAVE STATUS, SQL_Delay, 1); +let $ps_value= query_get_value(select Desired_Delay from performance_schema.replication_applier_configuration, Desired_Delay, 1); +let $assert_text= Value returned by SSS and PS table for Desired_Delay should be same.; +let $assert_cond= "$sss_value" = "$ps_value"; +source include/assert.inc; + +source include/rpl_end.inc; diff --git a/storage/perfschema/table_replication_applier_configuration.cc b/storage/perfschema/table_replication_applier_configuration.cc index 06de6c6e141..1abe4e1e6e7 100644 --- a/storage/perfschema/table_replication_applier_configuration.cc +++ b/storage/perfschema/table_replication_applier_configuration.cc @@ -29,17 +29,15 @@ //#define HAVE_REPLICATION #include "my_global.h" +#ifdef HAVE_REPLICATION #include "table_replication_applier_configuration.h" #include "pfs_instr_class.h" #include "pfs_instr.h" #include "slave.h" -//#include "rpl_info.h" #include "rpl_rli.h" #include "rpl_mi.h" #include "sql_parse.h" -//#include "rpl_msr.h" /* Multisource replication */ -#ifdef HAVE_REPLICATION THR_LOCK table_replication_applier_configuration::m_table_lock; PFS_engine_table_share @@ -54,7 +52,7 @@ table_replication_applier_configuration::m_share= sizeof(pos_t), /* ref length */ &m_table_lock, { C_STRING_WITH_LEN("CREATE TABLE replication_applier_configuration(" - "CHANNEL_NAME CHAR(64) collate utf8_general_ci not null," + "CHANNEL_NAME VARCHAR(256) collate utf8_general_ci not null," "DESIRED_DELAY INTEGER not null)") }, false /* perpetual */ }; @@ -141,7 +139,7 @@ void table_replication_applier_configuration::make_row(Master_info *mi) 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.desired_delay= 0; //mi->rli->get_sql_delay(); + m_row.desired_delay= mi->rli.get_sql_delay(); mysql_mutex_unlock(&mi->rli.data_lock); mysql_mutex_unlock(&mi->data_lock); @@ -159,18 +157,7 @@ int table_replication_applier_configuration::read_row_values(TABLE *table, if (unlikely(! m_row_exists)) return HA_ERR_RECORD_DELETED; - /* - Note: - There are no NULL columns in this table, - so there are no null bits reserved for NULL flags per column. - There are no VARCHAR columns either, so the record is not - in HA_OPTION_PACK_RECORD format as most other performance_schema tables. - When HA_OPTION_PACK_RECORD is not set, - the table record reserves an extra null byte, see open_binary_frm(). - */ - - DBUG_ASSERT(table->s->null_bytes == 1); - buf[0]= 0; + DBUG_ASSERT(table->s->null_bytes == 0); for (; (f= *fields) ; fields++) { @@ -178,10 +165,10 @@ int table_replication_applier_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: /* channel_name */ + set_field_varchar_utf8(f, m_row.channel_name, m_row.channel_name_length); break; - case 1: /** desired_delay */ + case 1: /* desired_delay */ set_field_ulong(f, static_cast<ulong>(m_row.desired_delay)); break; default: diff --git a/storage/perfschema/table_replication_applier_configuration.h b/storage/perfschema/table_replication_applier_configuration.h index 18321ac079e..d13ce7ffaef 100644 --- a/storage/perfschema/table_replication_applier_configuration.h +++ b/storage/perfschema/table_replication_applier_configuration.h @@ -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; |