diff options
author | unknown <guilhem@gbichot2> | 2003-10-09 00:06:21 +0200 |
---|---|---|
committer | unknown <guilhem@gbichot2> | 2003-10-09 00:06:21 +0200 |
commit | a7a7a8cacd3e81432c6dc5df9959d732de4d5804 (patch) | |
tree | 04ae3b48547dd3595548a23422470803ab6ca73b /sql/slave.h | |
parent | 198e1b92949a6d4f23cfb77a67a4328c1880c78d (diff) | |
download | mariadb-git-a7a7a8cacd3e81432c6dc5df9959d732de4d5804.tar.gz |
Final push for WL#1098:
"Add a column "Timestamp_of_last_master_event_executed" in SHOW SLAVE STATUS".
Finally this is adding
- Slave_IO_State (a copy of the State column of SHOW PROCESSLIST for the I/O thread,
so that the users, most of the time, has enough info with only SHOW SLAVE STATUS).
- Seconds_behind_master. When the slave connects to the master it does SELECT UNIX_TIMESTAMP()
on the master, computes the absolute difference between the master's and the slave's clock.
It records the timestamp of the last event executed by the SQL thread, and does a
small computation to find the number of seconds by which the slave is late.
mysql-test/r/rpl000015.result:
result update
mysql-test/r/rpl_empty_master_crash.result:
result update
mysql-test/r/rpl_error_ignored_table.result:
result update
mysql-test/r/rpl_flush_log_loop.result:
result update
mysql-test/r/rpl_loaddata.result:
result update
mysql-test/r/rpl_log.result:
result update
mysql-test/r/rpl_log_pos.result:
result update
mysql-test/r/rpl_max_relay_size.result:
result update
mysql-test/r/rpl_redirect.result:
result update
mysql-test/r/rpl_replicate_do.result:
result update
mysql-test/r/rpl_reset_slave.result:
result update
mysql-test/r/rpl_rotate_logs.result:
result update
mysql-test/r/rpl_trunc_binlog.result:
result update
mysql-test/r/rpl_until.result:
result update
mysql-test/t/rpl000015.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_empty_master_crash.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_error_ignored_table.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_flush_log_loop.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_loaddata.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_log.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_log_pos.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_max_relay_size.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_openssl.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_redirect.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_replicate_do.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_reset_slave.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_rotate_logs.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_trunc_binlog.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
mysql-test/t/rpl_until.test:
update to be independant of the new column Seconds_behind_master in SHOW SLAVE STATUS
sql/log_event.cc:
when the SQL thread executes an event, we record its timestamp
sql/slave.cc:
in check_master_version() we know read the master's clock, to know the clock difference
with the slave.
In show_master_info() we send the state of the I/O thread, and compute the number of
seconds by which the slave is late.
sql/slave.h:
timestamp of the last master's event executed by the SQL thread,
and difference between the clocks of the master and slave.
sql/sql_repl.cc:
clear the Seconds_behind_master column of SHOW SLAVE STATUS when RESET SLAVE or CHANGE MASTER.
Diffstat (limited to 'sql/slave.h')
-rw-r--r-- | sql/slave.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/slave.h b/sql/slave.h index 05cf7a23b0f..618b04311b9 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -213,6 +213,8 @@ typedef struct st_relay_log_info */ int event_len; + time_t last_master_timestamp; + /* Needed for problems when slave stops and we want to restart it skipping one or more events in the master log that have caused @@ -390,6 +392,16 @@ typedef struct st_master_info enum enum_binlog_formats old_format; volatile bool abort_slave, slave_running; volatile ulong slave_run_id; + /* + The difference in seconds between the clock of the master and the clock of + the slave (second - first). It must be signed as it may be <0 or >0. + clock_diff_with_master is computed when the I/O thread starts; for this the + I/O thread does a SELECT UNIX_TIMESTAMP() on the master. + "how late the slave is compared to the master" is computed like this: + clock_of_slave - last_timestamp_executed_by_SQL_thread - clock_diff_with_master + + */ + long clock_diff_with_master; st_master_info() :ssl(0), fd(-1), io_thd(0), inited(0), old_format(BINLOG_FORMAT_CURRENT), @@ -512,7 +524,7 @@ void slave_print_error(RELAY_LOG_INFO* rli, int err_code, const char* msg, ...); void end_slave(); /* clean up */ void init_master_info_with_options(MASTER_INFO* mi); void clear_until_condition(RELAY_LOG_INFO* rli); -void clear_last_slave_error(RELAY_LOG_INFO* rli); +void clear_slave_error_timestamp(RELAY_LOG_INFO* rli); int init_master_info(MASTER_INFO* mi, const char* master_info_fname, const char* slave_info_fname, bool abort_if_no_master_info_file); |