Alfranio Correia пишет:
> Hi Serge,
>
> I have some comments.
>
> 0 - I did not get what is the idea of the part of the test that you have changed.
> I mean I did not get whether you want or not to receive the heartbeat event.
> If you don't want to receive it, why don't you set a greater value?
You mean following line?:
let $result= query_get_value(SELECT ($rcvd_heartbeats_after -
$rcvd_heartbeats_before) > 0 AS Result, Result, 1);
In this case we just check that no events received if master sends
events to slave more often than hb period by following algorithm:
1. store current number of received hb
2. start background task via EVENT object: it generates UPDATE every 1 sec
3. Wait until some UPDATE statements appear on slave
4. store current number of received hb
5. Calculate diff between 4 and 1. It should be 0
> If you do want to receive it, why don't you just set a lower value and do some
> activity (e.g.
> flush logs) to make sure that you get the appropriate result?
>
> So, please, change the values according to your idea.
>
>
> 1 - Although what follows is not directly related to your patch, please, file a bug
> report. There
> is a typo: s/currect/current/
>
> Warning 1624 The *currect* value for master_heartbeat_period exceeds the new value
> of `slave_net_timeout' sec. A sensible value for the period should be less than the
> timeout.
>
>
> 2 - There is a mistake in the sentence: s/sending/sent/
>
> Warning 1624 The requested value for the heartbeat period is less than 1 msec.
> The period is reset to zero which means no heartbeats will be sending
>
>
> Serge Kozlov wrote:
>> #At file:///home/ksm/sun/repo/backport/WL4641-bug43828/mysql-5.1-rep%2B2/ based
> on revid:serge.kozlov@stripped
>>
>> 3129 Serge Kozlov 2009-10-05
>> WL#4641, Bug#43828: fix for rpl_heartbeat_basic.test:
>> The issue appears when number of heartbeat events non-zero before start of
> test block.
>> But really we need to check that no new events has received during test
> block.
>> So I did following:
>> 1. Replace absolute values by diff of values
>> 2. Increase heartbeat period 1.5 to 5 sec against EVENT e1 on master that
> generates statements every 1 sec
>> modified:
>> mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
>> mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
>>
>> === modified file 'mysql-test/suite/rpl/r/rpl_heartbeat_basic.result'
>> --- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result 2009-10-02 19:24:40
> +0000
>> +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result 2009-10-05 10:20:14
> +0000
>> @@ -220,15 +220,10 @@ BEGIN
>> UPDATE test.t1 SET a = a + 1 WHERE a < 10;
>> END|
>> RESET SLAVE;
>> -CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT,
> MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1.5;
>> +CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT,
> MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
>> include/start_slave.inc
>> SET @@global.event_scheduler=1;
>> -SHOW STATUS LIKE 'slave_received_heartbeats';
>> -Variable_name Value
>> -Slave_received_heartbeats 0
>> -SHOW STATUS LIKE 'slave_received_heartbeats';
>> -Variable_name Value
>> -Slave_received_heartbeats 0
>> +Number of received heartbeat events: 0
>> DELETE FROM t1;
>> DROP EVENT e1;
>>
>>
>> === modified file 'mysql-test/suite/rpl/t/rpl_heartbeat_basic.test'
>> --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test 2009-10-02 19:24:40 +0000
>> +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test 2009-10-05 10:20:14 +0000
>> @@ -343,23 +343,28 @@ DELIMITER ;|
>> --connection slave
>> RESET SLAVE;
>> --replace_result $MASTER_MYPORT MASTER_PORT
>> -eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT,
> MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=1.5;
>> +eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT,
> MASTER_USER='root', MASTER_HEARTBEAT_PERIOD=5;
>> --source include/start_slave.inc
>> --connection master
>> # Enable scheduler
>> SET @@global.event_scheduler=1;
>> --connection slave
>> -SHOW STATUS LIKE 'slave_received_heartbeats';
>> +let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE
> 'slave_received_heartbeats', Value, 1);
>> --sync_with_master
>> # Wait some updates for table t1 from master
>> let $wait_condition= SELECT COUNT(*)=1 FROM t1 WHERE a > 5;
>> --source include/wait_condition.inc
>> -SHOW STATUS LIKE 'slave_received_heartbeats';
>> +let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE
> 'slave_received_heartbeats', Value, 1);
>> +let $result= query_get_value(SELECT ($rcvd_heartbeats_after -
> $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
>> +--echo Number of received heartbeat events: $result
>> --connection master
>> DELETE FROM t1;
>> DROP EVENT e1;
>> --echo
>>
>> +
>> +
>> +
>> # Check received heartbeat events while logs flushed on slave
>> --connection slave
>> --echo *** Flush logs on slave ***
>>
>>
--
Serge Kozlov, QA Developer
MySQL AB, Moscow, Russia, www.mysql.com
Office:
Are you MySQL certified? www.mysql.com/certification