Serge Kozlov wrote:
> alfranio correia пишет:
>> Hi Serge,
>>
>> Great work.
>>
>> I have just few comments. No strong opinions though.
>>
>> 1 - First, I can't understand the following text from the worklog:
>
> Initial goal of task to mark tests as 'big-test' if run more than most
> of other tests (and list of these tests in OLD DESCRIPTION). But after
> discuss with Lars, Sven and me we change goal of WL (there are serious
> reasons against 'big-test' marking) and now we need to optimize tests
> by decreasing time of execution.
OK !!!
>
>
> Also do you approve patch with your suggestion for var $wait_time or
> do I need to ask you again? :)
Serge the patch is *approved*.
>
>>
>> OLD DESCRIPTION
>> ===============
>> 1. Set value of "big-test" limit is 10 sec.
>> 2. The list of candidates (average time of execution):
>> rpl_locktrans_innodb (26): waiting locks, complex code
>> rpl_row_sp003 (106): waiting locks, sleep for NDB testing
>> rpl_row_mysqlbinlog (13): use large arrays of data
>> rpl_err_ignoretable (10): waiting locks
>> rpl_optimize (14): large data
>> rpl_row_blob_myisam (20): use BLOBS, sleeps for NDB
>> rpl_stm_000001 (13): sleeps, large data
>> rpl_deadlock_innodb (25): waiting deadlocks
>> rpl_row_blob_innodb (20): use BLOBS, sleeps for NDB
>> rpl_row_func003 (12): sleeps for NDB
>> rpl_row_trig004 (10): sleeps for NDB
>>
>> After talk with Lars and Sven this worklog should be changed:
>> 1. Do not need to mark tests with 'big' flag because 'big' tests
>> skipped by PB and
>> number of candidates is small.
>> 2. Decreasing the time of execution for these tests by ways below:
>> a) use sleeps for NDB only if engine_type=NDB:
>> extra/rpl_tests/rpl_row_blob.test
>> extra/rpl_tests/rpl_row_func003.test
>> extra/rpl_tests/rpl_row_sp003.test
>> extra/rpl_tests/rpl_trig004.test
>> b) replace sleeps by "waiting" primitves
>> extra/rpl_tests/rpl_stm_000001.test
>>
>>
>>
>> 2 - See in-line comments.
>>
>> Sven Sandberg wrote:
>>> Hi Serge,
>>>
>>> Good work, patch approved!
>>>
>>> /Sven
>>>
>>>
>>> Serge Kozlov wrote:
>>>> #At file:///home/ksm/sun/repo/WL4416/mysql-6.0-rpl/ based on
>>>> revid:sven@stripped
>>>>
>>>> 2744 Serge Kozlov 2008-12-04
>>>> WL#4416:
>>>> 1. Skip sleeps for primitives from rpl_extra if used engine is
>>>> not NDB (via new primitive wait_for_ndb_to_binlog.inc)
>>>> 2. Replace sleep by sync_slave_io_master.inc for
>>>> rpl_stm_000001.test added:
>>>> mysql-test/include/wait_for_ndb_to_binlog.inc
>>>> modified:
>>>> mysql-test/extra/rpl_tests/rpl_row_blob.test
>>>> mysql-test/extra/rpl_tests/rpl_row_func003.test
>>>> mysql-test/extra/rpl_tests/rpl_row_sp003.test
>>>> mysql-test/extra/rpl_tests/rpl_stm_000001.test
>>>> mysql-test/extra/rpl_tests/rpl_trig004.test
>>>>
>>>> === modified file 'mysql-test/extra/rpl_tests/rpl_row_blob.test'
>>>> --- a/mysql-test/extra/rpl_tests/rpl_row_blob.test 2007-06-18
>>>> 13:36:10 +0000
>>>> +++ b/mysql-test/extra/rpl_tests/rpl_row_blob.test 2008-12-03
>>>> 21:49:25 +0000
>>>> @@ -36,7 +36,7 @@ SELECT LENGTH(data) FROM test.t1 WHERE c
>>>> save_master_pos;
>>>> connection slave;
>>>> sync_with_master; -sleep 5;
>>>> +--source include/wait_for_ndb_to_binlog.inc
>>>> --echo
>>>> --echo **** Data Insert Validation Slave Section test.t1 ****
>>>> --echo
>>>> @@ -56,12 +56,10 @@ UPDATE t1 set data=repeat('c',17*1024) w
>>>> --echo
>>>> SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
>>>> SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
>>>> -# Sleep is needed for NDB to allow time for
>>>> -# Injector thread to populate the bin log.
>>>> save_master_pos;
>>>> connection slave;
>>>> sync_with_master; -sleep 5;
>>>> +--source include/wait_for_ndb_to_binlog.inc
>>>> --echo
>>>> --echo **** Data Update Validation Slave Section test.t1 ****
>>>> --echo
>>>> @@ -132,7 +130,7 @@ FROM test.t2 WHERE c1=2;
>>>> save_master_pos;
>>>> connection slave;
>>>> sync_with_master; -sleep 5;
>>>> +--source include/wait_for_ndb_to_binlog.inc
>>>> --echo
>>>> --echo **** Data Insert Validation Slave Section test.t2 ****
>>>> --echo
>>>> @@ -155,12 +153,10 @@ SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900
>>>> FROM test.t2 WHERE c1=1;
>>>> SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4),
>>>> SUBSTR(c4,1+3*900,3)
>>>> FROM test.t2 WHERE c1=2;
>>>> -# Sleep is needed for NDB to allow time for
>>>> -# Injector thread to populate the bin log.
>>>> save_master_pos;
>>>> connection slave;
>>>> sync_with_master; -sleep 5;
>>>> +--source include/wait_for_ndb_to_binlog.inc
>>>> --echo
>>>> --echo **** Data Update Validation Slave Section test.t2 ****
>>>> --echo
>>>>
>>>> === modified file 'mysql-test/extra/rpl_tests/rpl_row_func003.test'
>>>> --- a/mysql-test/extra/rpl_tests/rpl_row_func003.test 2007-06-18
>>>> 13:36:10 +0000
>>>> +++ b/mysql-test/extra/rpl_tests/rpl_row_func003.test 2008-12-03
>>>> 21:49:25 +0000
>>>> @@ -44,9 +44,10 @@ END|
>>>> delimiter ;|
>>>>
>>>> INSERT INTO test.t1 VALUES
>>>> (null,test.f1()),(null,test.f1()),(null,test.f1());
>>>> -sleep 6;
>>>> +let $wait_time= 6;
>>>> +--source include/wait_for_ndb_to_binlog.inc
>>>> INSERT INTO test.t1 VALUES
>>>> (null,test.f1()),(null,test.f1()),(null,test.f1());
>>>> -sleep 6;
>>>> +--source include/wait_for_ndb_to_binlog.inc
>>>>
>>>> #Select in this test are used for debugging
>>>> #select * from test.t1;
>>>>
>>>> === modified file 'mysql-test/extra/rpl_tests/rpl_row_sp003.test'
>>>> --- a/mysql-test/extra/rpl_tests/rpl_row_sp003.test 2007-06-18
>>>> 13:36:10 +0000
>>>> +++ b/mysql-test/extra/rpl_tests/rpl_row_sp003.test 2008-12-03
>>>> 21:49:25 +0000
>>>> @@ -41,10 +41,7 @@ CALL test.p2();
>>>> SELECT release_lock("test");
>>>> SELECT * FROM test.t1; #show binlog events;
>>>> -# Added sleep for use with NDB to ensure that
>>>> -# the injector thread will populate log before
>>>> -# we switch to the slave.
>>>> -sleep 5;
>>>> +--source include/wait_for_ndb_to_binlog.inc
>>>> sync_slave_with_master;
>>>> connection slave;
>>>> SELECT * FROM test.t1;
>>>>
>>>> === modified file 'mysql-test/extra/rpl_tests/rpl_stm_000001.test'
>>>> --- a/mysql-test/extra/rpl_tests/rpl_stm_000001.test 2007-12-12
>>>> 17:19:24 +0000
>>>> +++ b/mysql-test/extra/rpl_tests/rpl_stm_000001.test 2008-12-03
>>>> 21:49:25 +0000
>>>> @@ -68,8 +68,8 @@ enable_query_log;
>>>> connection slave;
>>>> lock tables t1 read;
>>>> start slave;
>>>> -#hope this is long enough for I/O thread to fetch over 16K relay log
>>>> data
>>>> -sleep 3;
>>>> +connection master;
>>>> +--source include/sync_slave_io_with_master.inc
>>>> unlock tables;
>>>>
>>>> #test handling of aborted connection in the middle of update
>>>>
>>>> === modified file 'mysql-test/extra/rpl_tests/rpl_trig004.test'
>>>> --- a/mysql-test/extra/rpl_tests/rpl_trig004.test 2007-06-06
>>>> 17:57:07 +0000
>>>> +++ b/mysql-test/extra/rpl_tests/rpl_trig004.test 2008-12-03
>>>> 21:49:25 +0000
>>>> @@ -35,9 +35,8 @@ INSERT INTO test.t2 VALUES (1, 0.0);
>>>> #show binlog events; select * from test.t1;
>>>> select * from test.t2;
>>>> -# Have to sleep for a few seconds to allow -# NDB injector thread to
>>>> populate binlog
>>>> -sleep 10;
>>>> +let $wait_time= 10;
>>>> +--source include/wait_for_ndb_to_binlog.inc
>>>> sync_slave_with_master;
>>>> connection slave;
>>>> select * from test.t1;
>>>>
>>>> === added file 'mysql-test/include/wait_for_ndb_to_binlog.inc'
>>>> --- a/mysql-test/include/wait_for_ndb_to_binlog.inc 1970-01-01
>>>> 00:00:00 +0000
>>>> +++ b/mysql-test/include/wait_for_ndb_to_binlog.inc 2008-12-03
>>>> 21:49:25 +0000
>>>> @@ -0,0 +1,33 @@
>>>> +# ==== Purpose ====
>>>> +# +# Several test primitives from mysql-test/extra/rpl_tests +#
>>>> shared for test cases for MyISAM, InnoDB, NDB and other +# engines.
>>>> But for NDB all events will be added by NDB +# injector and now there
>>>> are no way to detect the state of +# NDB injector therefore this
>>>> primitive waits 5 sec +# if engine type is NDB. +# In future that
>>>> should be fixed by waiting of proper +# state of NDB injector. +#
>>>> +# ==== Usage ====
>>>> +#
>>>> +# let $engine_type= NDB;
>> Please, I think you should explain where this variable comes from.
>> Is it really necessary to define it? I though this was somehow
>> automatically defined by mtr/mysqltest.
>> This is given the wrong impression that the user should manually
>> define it.
>
> All primitives have input variables. If it is not defined then this
> block will just skipped.
>
>>
>>>> +# --source include/wait_for_ndb_to_binlog.inc
>>>> +#
>>>> +# ==== Parameters =====
>>>> +#
>>>> +# $engine_type
>>>> +# Type of engine. If type is NDB then it waits $wait_time sec
>>>> +# +# $wait_time
>>>> +# Test will wait $wait_time seconds
>>>> +
>>>> +let $_wait_time= $wait_time;
>>>> +if (!$wait_time) {
>>>> + let $_wait_time= 5;
>>>> +}
>> I would do this a little bit different:
>>
>> let $_wait_time= 5;
>> if ($wait_time) {
>> let $_wait_time= $wait_time;
>> }
>>
>> Maybe putting let $_wait_time= 5; in the beginning of the file.
>
> ok
>
>>
>>>> +
>>>> +if (`SELECT UPPER(LEFT('$engine_type',3))`) {
>>>> + sleep $_wait_time;
>>>> +}
>>>> +
>>>>
>>>>
>>>
>>
>> Cheers.
>
>