Skip to content

Commit

Permalink
Added COM_SEND_REPLICA_STATISTICS & background thread to send lag sta…
Browse files Browse the repository at this point in the history
…tistics from secondary to primary and store it in information_schema.replica_statistics

Summary:
* I am adding a new RPC `COM_SEND_REPLICA_STATISTICS`. Slaves will use this RPC to send lag statistics to master. This will be done in the next diff.

* In addition, I have added the information_schema table named `replica_statistics` to store the slave lag stats.

* Added a new background thread that is started when the `mysqld` process starts and continuously publishes lag statistics from slaves to master every `slave_stats_daemon_interval` seconds.

The default values of `slave_stats_daemon_interval` is set to 0, which means do not send lag statistics to master. The unit for this sys_var is seconds.

**Points to note -**

* The background thread re-uses the connection to master to send stats. It does not reconnect every cycle.
* If it is not able to connect to the master in one cycle, it retries the connection in successive cycles until it is able to connect. After this point, it reuses the same connection.
* In case of topology changes, the thread is able to reconnect to the new master and send stats.

Reviewed By: mzait, lth

Differential Revision: D21440060

fbshipit-source-id: 9178c96
  • Loading branch information
Rahul-Singhal authored and facebook-github-bot committed Jul 2, 2020
1 parent a0a2023 commit 06e7367
Show file tree
Hide file tree
Showing 30 changed files with 1,169 additions and 313 deletions.
3 changes: 2 additions & 1 deletion include/mysql.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON,
COM_BINLOG_DUMP_GTID, COM_RESET_CONNECTION,
COM_END,
COM_TOP_END = 254,
COM_TOP_END = 253,
COM_SEND_REPLICA_STATISTICS = 254,
COM_QUERY_ATTRS = 255,
COM_MAX = 256,
};
Expand Down
7 changes: 4 additions & 3 deletions include/mysql_com.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ enum enum_server_command
The following are Facebook specific commands. They are put at the top end
to avoid conflicting with upstream.
*/
COM_TOP_END = 254,
COM_TOP_END = 253,
COM_SEND_REPLICA_STATISTICS = 254,
COM_QUERY_ATTRS = 255,
COM_MAX = 256,
};
Expand Down Expand Up @@ -784,8 +785,8 @@ typedef struct st_udf_init
char *ptr; /* free pointer for function data */
my_bool const_item; /* 1 if function always returns the same value */
void *extension;
} UDF_INIT;
/*
} UDF_INIT;
/*
TODO: add a notion for determinism of the UDF.
See Item_udf_func::update_used_tables ()
*/
Expand Down
1 change: 1 addition & 0 deletions mysql-test/include/check-testcase.test
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ if ($tmp)
--echo Master_SSL_Actual_Cipher #
--echo Master_SSL_Subject #
--echo Master_SSL_Issuer #
--echo Slave_Lag_Stats_Thread_Running No
}
if (!$tmp) {
# Note: after WL#5177, fields 13-18 shall not be filtered-out.
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/r/disabled_replication.result
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SHOW SLAVE STATUS;
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_Symbolic_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 Lag_Peak_Over_Last_Period 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_UUID Master_Info_File SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Master_Retry_Count Master_Bind Last_IO_Error_Timestamp Last_SQL_Error_Timestamp Master_SSL_Crl Master_SSL_Crlpath Retrieved_Gtid_Set Executed_Gtid_Set Auto_Position Master_SSL_Actual_Cipher Master_SSL_Subject Master_SSL_Issuer
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_Symbolic_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 Lag_Peak_Over_Last_Period 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_UUID Master_Info_File SQL_Delay SQL_Remaining_Delay Slave_SQL_Running_State Master_Retry_Count Master_Bind Last_IO_Error_Timestamp Last_SQL_Error_Timestamp Master_SSL_Crl Master_SSL_Crlpath Retrieved_Gtid_Set Executed_Gtid_Set Auto_Position Master_SSL_Actual_Cipher Master_SSL_Subject Master_SSL_Issuer Slave_Lag_Stats_Thread_Running
RESET SLAVE;
ERROR HY000: Slave is not configured or failed to initialize properly. You must at least set --server-id to enable either a master or a slave. Additional error messages can be found in the MySQL error log.
SHOW RELAYLOG EVENTS;
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/r/information_schema-big.result
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ VIEWS TABLE_SCHEMA
AUTHINFO ID
SLAVE_DB_LOAD DB
RBR_BI_INCONSISTENCIES TABLE
REPLICA_STATISTICS SERVER_ID
SCHEMATA_EXT SCHEMA_NAME
SOCKET_DIAG_SLAVES ID
USER_TABLE_STATISTICS TABLE_SCHEMA
Expand Down Expand Up @@ -141,6 +142,7 @@ VIEWS TABLE_SCHEMA
AUTHINFO ID
SLAVE_DB_LOAD DB
RBR_BI_INCONSISTENCIES TABLE
REPLICA_STATISTICS SERVER_ID
SCHEMATA_EXT SCHEMA_NAME
SOCKET_DIAG_SLAVES ID
USER_TABLE_STATISTICS TABLE_SCHEMA
Expand Down
5 changes: 4 additions & 1 deletion mysql-test/r/information_schema.result
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ VIEWS
AUTHINFO
SLAVE_DB_LOAD
RBR_BI_INCONSISTENCIES
REPLICA_STATISTICS
SCHEMATA_EXT
SOCKET_DIAG_SLAVES
USER_TABLE_STATISTICS
Expand Down Expand Up @@ -886,6 +887,7 @@ TABLES CREATE_TIME datetime
TABLES UPDATE_TIME datetime
TABLES CHECK_TIME datetime
TRIGGERS CREATED datetime
REPLICA_STATISTICS TIMESTAMP datetime
SQL_STATISTICS QUERY_SAMPLE_SEEN datetime
event execute_at datetime
event last_executed datetime
Expand Down Expand Up @@ -954,7 +956,7 @@ table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest')
AND table_name not like 'ndb%' AND table_name not like 'innodb_%' AND table_name not like 'rocksdb_%'
GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 56
information_schema 57
mysql 27
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row
Expand Down Expand Up @@ -1425,6 +1427,7 @@ QUERY_ATTRIBUTES information_schema.QUERY_ATTRIBUTES 1
QUERY_PERF_COUNTER information_schema.QUERY_PERF_COUNTER 1
RBR_BI_INCONSISTENCIES information_schema.RBR_BI_INCONSISTENCIES 1
REFERENTIAL_CONSTRAINTS information_schema.REFERENTIAL_CONSTRAINTS 1
REPLICA_STATISTICS information_schema.REPLICA_STATISTICS 1
ROUTINES information_schema.ROUTINES 1
SCHEMATA information_schema.SCHEMATA 1
SCHEMATA_EXT information_schema.SCHEMATA_EXT 1
Expand Down
1 change: 1 addition & 0 deletions mysql-test/r/information_schema_db.result
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ VIEWS
AUTHINFO
SLAVE_DB_LOAD
RBR_BI_INCONSISTENCIES
REPLICA_STATISTICS
SCHEMATA_EXT
SOCKET_DIAG_SLAVES
USER_TABLE_STATISTICS
Expand Down
7 changes: 6 additions & 1 deletion mysql-test/r/mysqld--help-notwin-profiling.result
Original file line number Diff line number Diff line change
Expand Up @@ -1932,6 +1932,10 @@ The following options may be given as the first argument:
network before writing them to the relay log. Enabled by
default.
(Defaults to on; use --skip-slave-sql-verify-checksum to disable.)
--slave-stats-daemon-interval=#
Period(seconds) for the background thread responsible for
sending slave lag statistics to master.New period is
applied after the current period finishes.
--slave-transaction-retries=#
Number of times the slave SQL thread will retry a
transaction in case it failed with a deadlock or elapsed
Expand Down Expand Up @@ -2454,7 +2458,7 @@ performance-schema-max-rwlock-instances -1
performance-schema-max-socket-classes 10
performance-schema-max-socket-instances -1
performance-schema-max-stage-classes 150
performance-schema-max-statement-classes 187
performance-schema-max-statement-classes 188
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
performance-schema-max-thread-classes 50
Expand Down Expand Up @@ -2725,6 +2729,7 @@ slave-rows-search-algorithms TABLE_SCAN,INDEX_SCAN
slave-run-triggers-for-rbr NO
slave-skip-errors (No default value)
slave-sql-verify-checksum TRUE
slave-stats-daemon-interval 0
slave-transaction-retries 10
slave-tx-isolation REPEATABLE-READ
slave-type-conversions
Expand Down
7 changes: 6 additions & 1 deletion mysql-test/r/mysqld--help-notwin.result
Original file line number Diff line number Diff line change
Expand Up @@ -1930,6 +1930,10 @@ The following options may be given as the first argument:
network before writing them to the relay log. Enabled by
default.
(Defaults to on; use --skip-slave-sql-verify-checksum to disable.)
--slave-stats-daemon-interval=#
Period(seconds) for the background thread responsible for
sending slave lag statistics to master.New period is
applied after the current period finishes.
--slave-transaction-retries=#
Number of times the slave SQL thread will retry a
transaction in case it failed with a deadlock or elapsed
Expand Down Expand Up @@ -2452,7 +2456,7 @@ performance-schema-max-rwlock-instances -1
performance-schema-max-socket-classes 10
performance-schema-max-socket-instances -1
performance-schema-max-stage-classes 150
performance-schema-max-statement-classes 187
performance-schema-max-statement-classes 188
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
performance-schema-max-thread-classes 50
Expand Down Expand Up @@ -2722,6 +2726,7 @@ slave-rows-search-algorithms TABLE_SCAN,INDEX_SCAN
slave-run-triggers-for-rbr NO
slave-skip-errors (No default value)
slave-sql-verify-checksum TRUE
slave-stats-daemon-interval 0
slave-transaction-retries 10
slave-tx-isolation REPEATABLE-READ
slave-type-conversions
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/r/mysqlshow.result
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ DROP TABLE t1, t2;
| QUERY_PERF_COUNTER |
| RBR_BI_INCONSISTENCIES |
| REFERENTIAL_CONSTRAINTS |
| REPLICA_STATISTICS |
| ROCKSDB_CFSTATS |
| ROCKSDB_CF_OPTIONS |
| ROCKSDB_COMPACTION_STATS |
Expand Down Expand Up @@ -235,6 +236,7 @@ DROP TABLE t1, t2;
| QUERY_PERF_COUNTER |
| RBR_BI_INCONSISTENCIES |
| REFERENTIAL_CONSTRAINTS |
| REPLICA_STATISTICS |
| ROCKSDB_CFSTATS |
| ROCKSDB_CF_OPTIONS |
| ROCKSDB_COMPACTION_STATS |
Expand Down
101 changes: 101 additions & 0 deletions mysql-test/r/slave_stats_daemon.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
include/master-slave.inc
Warnings:
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
[connection master]
select @@slave_stats_daemon_interval;
@@slave_stats_daemon_interval
0
select sleep(2);
sleep(2)
0
select count(*) = 0 as stats_samples_collected from information_schema.replica_statistics;
stats_samples_collected
1
set @@GLOBAL.slave_stats_daemon_interval=1;
select @@slave_stats_daemon_interval;
@@slave_stats_daemon_interval
1
select sleep(2);
sleep(2)
0
select count(*) > 0 as stats_samples_collected from information_schema.replica_statistics;
stats_samples_collected
1
set @@GLOBAL.slave_stats_daemon_interval=1;
select @@slave_stats_daemon_interval;
@@slave_stats_daemon_interval
1
select sleep(1);
sleep(1)
0
select count(*) > 0 as stats_samples_collected from information_schema.replica_statistics;
stats_samples_collected
1
select sleep(1);
sleep(1)
0
select count(*) > 0 as stats_samples_collected from information_schema.replica_statistics;
stats_samples_collected
1
set @@GLOBAL.slave_stats_daemon_interval=1;
Master_User = 'root'
Master_Host = '127.0.0.1'
include/stop_slave.inc
change master to master_user='test';
Warnings:
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
start slave;
Master_User = 'test'
Master_Host = '127.0.0.1'
select sleep(2);
sleep(2)
0
select now() - max(timestamp) > 1 as more_than_1_sec_old_most_recent_stats from information_schema.replica_statistics;
more_than_1_sec_old_most_recent_stats
1
include/stop_slave.inc
change master to master_user='root';
Warnings:
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
include/start_slave.inc
Master_User = 'root'
Master_Host = '127.0.0.1'
select sleep(2);
sleep(2)
0
select now() - max(timestamp) <= 1 as less_than_1_sec_old_most_recent_stats from information_schema.replica_statistics;
less_than_1_sec_old_most_recent_stats
1
set @@GLOBAL.slave_stats_daemon_interval=1;
set @@GLOBAL.slave_stats_daemon_interval=1;
select * from information_schema.replica_statistics;
SERVER_ID TIMESTAMP MILLI_SEC_BEHIND_MASTER
Stop slave;
reset slave all;
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'root', MASTER_PORT= MASTER_PORT;;
Warnings:
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
start slave;
select sleep(2);
sleep(2)
0
select sleep(2);
sleep(2)
0
select count(*) > 0 as stats_samples_collected from information_schema.replica_statistics;
stats_samples_collected
1
set @@GLOBAL.slave_stats_daemon_interval=0;
Stop slave;
reset slave all;
set @@GLOBAL.slave_stats_daemon_interval=0;
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'root', MASTER_PORT= MASTER_PORT;;
Warnings:
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
Note 1760 Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
start slave;
include/rpl_end.inc
6 changes: 6 additions & 0 deletions mysql-test/suite/funcs_1/r/is_columns_is.result
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,9 @@ def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_CATALOG 4 NO v
def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_NAME 6 NULL YES varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema REFERENTIAL_CONSTRAINTS UNIQUE_CONSTRAINT_SCHEMA 5 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema REFERENTIAL_CONSTRAINTS UPDATE_RULE 8 NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema REPLICA_STATISTICS MILLI_SEC_BEHIND_MASTER 3 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select
def information_schema REPLICA_STATISTICS SERVER_ID 1 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select
def information_schema REPLICA_STATISTICS TIMESTAMP 2 0000-00-00 00:00:00 NO datetime NULL NULL NULL NULL 0 NULL NULL datetime select
def information_schema ROUTINES CHARACTER_MAXIMUM_LENGTH 7 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select
def information_schema ROUTINES CHARACTER_OCTET_LENGTH 8 NULL YES int NULL NULL 10 0 NULL NULL NULL int(21) select
def information_schema ROUTINES CHARACTER_SET_CLIENT 29 NO varchar 32 96 NULL NULL NULL utf8 utf8_general_ci varchar(32) select
Expand Down Expand Up @@ -986,6 +989,9 @@ NULL information_schema QUERY_PERF_COUNTER NUM_QUERIES bigint NULL NULL NULL NUL
3.0000 information_schema REFERENTIAL_CONSTRAINTS DELETE_RULE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema REFERENTIAL_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema REFERENTIAL_CONSTRAINTS REFERENCED_TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
NULL information_schema REPLICA_STATISTICS SERVER_ID bigint NULL NULL NULL NULL bigint(21)
NULL information_schema REPLICA_STATISTICS TIMESTAMP datetime NULL NULL NULL NULL datetime
NULL information_schema REPLICA_STATISTICS MILLI_SEC_BEHIND_MASTER bigint NULL NULL NULL NULL bigint(21)
3.0000 information_schema ROUTINES SPECIFIC_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema ROUTINES ROUTINE_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema ROUTINES ROUTINE_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
Expand Down
46 changes: 46 additions & 0 deletions mysql-test/suite/funcs_1/r/is_tables_is.result
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME REPLICA_STATISTICS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 10
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
TABLE_TYPE SYSTEM VIEW
ENGINE MyISAM
Expand Down Expand Up @@ -1987,6 +2010,29 @@ user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME REPLICA_STATISTICS
TABLE_TYPE SYSTEM VIEW
ENGINE MEMORY
VERSION 10
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION utf8_general_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA information_schema
TABLE_NAME ROUTINES
TABLE_TYPE SYSTEM VIEW
ENGINE MyISAM
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/perfschema/r/dml_setup_instruments.result
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ wait/synch/cond/sql/COND_flush_thread_cache YES YES
wait/synch/cond/sql/COND_manager YES YES
wait/synch/cond/sql/COND_queue_state YES YES
wait/synch/cond/sql/COND_server_started YES YES
wait/synch/cond/sql/COND_slave_stats_daemon YES YES
wait/synch/cond/sql/COND_thread_cache YES YES
wait/synch/cond/sql/COND_thread_count YES YES
wait/synch/cond/sql/Delayed_insert::cond YES YES
wait/synch/cond/sql/Delayed_insert::cond_client YES YES
select * from performance_schema.setup_instruments
where name='Wait';
select * from performance_schema.setup_instruments
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Default value of slave_stats_daemon_interval is 0
SELECT @@global.slave_stats_daemon_interval;
@@global.slave_stats_daemon_interval
0
SELECT @@session.slave_stats_daemon_interval;
ERROR HY000: Variable 'slave_stats_daemon_interval' is a GLOBAL variable
Expected error 'Variable is a GLOBAL variable'
slave_stats_daemon_interval is a dynamic variable (change to 1)
set @@global.slave_stats_daemon_interval = 1;
SELECT @@global.slave_stats_daemon_interval;
@@global.slave_stats_daemon_interval
1
restore the default value
SET @@global.slave_stats_daemon_interval = 0;
SELECT @@global.slave_stats_daemon_interval;
@@global.slave_stats_daemon_interval
0
restart the server with non default value (1)
SELECT @@global.slave_stats_daemon_interval;
@@global.slave_stats_daemon_interval
1
restart the server with the default value (0)
SELECT @@global.slave_stats_daemon_interval;
@@global.slave_stats_daemon_interval
0

0 comments on commit 06e7367

Please sign in to comment.