3371 Rohit Kalhans 2011-08-16
BUG#12761358: SLAVE_LAST_HEARTBEAT RETURNS EPOCH DATE EVEN WHEN SLAVE NOT ENABLED
modified:
mysql-test/suite/rpl/r/rpl_heartbeat.result
mysql-test/suite/rpl/t/rpl_heartbeat.test
sql/mysqld.cc
3370 Sneha Modi 2011-08-16 [merge]
Merging from MySQL-5.5 --> MySQL-trunk.
modified:
mysql-test/suite/sys_vars/r/innodb_file_per_table_basic.result
mysql-test/suite/sys_vars/r/innodb_lock_wait_timeout_basic.result
mysql-test/suite/sys_vars/t/innodb_autoinc_lock_mode_basic.test
mysql-test/suite/sys_vars/t/innodb_fast_shutdown_basic.test
mysql-test/suite/sys_vars/t/innodb_file_per_table_basic.test
mysql-test/suite/sys_vars/t/innodb_io_capacity_basic.test
mysql-test/suite/sys_vars/t/innodb_lock_wait_timeout_basic.test
mysql-test/suite/sys_vars/t/innodb_max_dirty_pages_pct_basic.test
=== modified file 'mysql-test/suite/rpl/r/rpl_heartbeat.result'
--- a/mysql-test/suite/rpl/r/rpl_heartbeat.result 2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat.result 2011-08-16 16:30:11 +0000
@@ -1,6 +1,10 @@
-reset master;
+include/master-slave.inc
+[connection master]
set @restore_slave_net_timeout= @@global.slave_net_timeout;
set @@global.slave_net_timeout= 10;
+SHOW STATUS LIKE "Slave_last_heartbeat";
+Variable_name Slave_last_heartbeat
+Value
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
show status like 'Slave_heartbeat_period';;
Variable_name Slave_heartbeat_period
@@ -57,7 +61,7 @@ show status like 'Slave_heartbeat_period
Variable_name Slave_heartbeat_period
Value 0.500
A heartbeat has been received by the slave
+include/assert.inc [Slave_last_heartbeat should not be empty]
drop table t1;
set @@global.slave_net_timeout= @restore_slave_net_timeout;
-include/stop_slave.inc
-End of tests
+include/rpl_end.inc
=== modified file 'mysql-test/suite/rpl/t/rpl_heartbeat.test'
--- a/mysql-test/suite/rpl/t/rpl_heartbeat.test 2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat.test 2011-08-16 16:30:11 +0000
@@ -6,19 +6,22 @@
# - no rotation of relay log if heartbeat is less that slave_net_timeout
# - SHOW STATUS like 'Slave_received_heartbeats' action
# - SHOW STATUS like 'Slave_heartbeat_period' report
+# - SHOW STATUS like 'Slave_last_heartbeat' check
--- source include/have_log_bin.inc
-
-connect (master,localhost,root,,test,$MASTER_MYPORT,$MASTER_MYSOCK);
-connect (slave,localhost,root,,test,$SLAVE_MYPORT,$SLAVE_MYSOCK);
-
-connection master;
-reset master;
+--let $rpl_skip_start_slave= 1
+--let $rpl_skip_reset_master_and_slave= 1
+--let $rpl_skip_change_master= 1
+--source include/master-slave.inc
connection slave;
set @restore_slave_net_timeout= @@global.slave_net_timeout;
set @@global.slave_net_timeout= 10;
+#
+# check for null value of the Slave_last_heartbeat variable when the slave is not enabled
+#
+--query_vertical SHOW STATUS LIKE "Slave_last_heartbeat"
+
###
### Checking the range
###
@@ -156,6 +159,14 @@ while (!$slave_value)
let $slave_value= query_get_value("SHOW STATUS like 'Slave_received_heartbeats'", Value, 1);
}
--echo A heartbeat has been received by the slave
+
+#
+# check for non-null value of the Slave_last_heartbeat variable when the slave is enabled
+#
+--let $assert_text= Slave_last_heartbeat should not be empty
+--let $assert_cond= \'[SHOW STATUS LIKE "Slave_last_heartbeat", Value, 1]\' != ""
+--source include/assert.inc
+
# cleanup
connection master;
@@ -165,6 +176,4 @@ drop table t1;
sync_slave_with_master;
set @@global.slave_net_timeout= @restore_slave_net_timeout;
---source include/stop_slave.inc
-
---echo End of tests
+--source include/rpl_end.inc
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2011-08-11 08:47:53 +0000
+++ b/sql/mysqld.cc 2011-08-16 16:30:11 +0000
@@ -6535,9 +6535,14 @@ static int show_slave_last_heartbeat(THD
{
var->type= SHOW_CHAR;
var->value= buff;
- thd->variables.time_zone->gmt_sec_to_TIME(&received_heartbeat_time,
- active_mi->last_heartbeat);
- my_datetime_to_str(&received_heartbeat_time, buff);
+ if (active_mi->last_heartbeat == 0)
+ buff[0]='\0';
+ else
+ {
+ thd->variables.time_zone->gmt_sec_to_TIME(&received_heartbeat_time,
+ active_mi->last_heartbeat);
+ my_datetime_to_str(&received_heartbeat_time, buff);
+ }
}
else
var->type= SHOW_UNDEF;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (rohit.kalhans:3370 to 3371) Bug#12761358 | Rohit Kalhans | 17 Aug |