List:Commits« Previous MessageNext Message »
From:Serge Kozlov Date:November 26 2008 2:46pm
Subject:Re: bzr commit into mysql-6.0-rpl branch (skozlov:2738) Bug#39903
View as plain text  
Hi, Alfranio

Thanks for review. See my answers below:


alfranio correia пишет:
> Hi Serge,
> 
> Great work.
> 
> The patch is almost fine for me.
> I have only four comments.
> 
> 1 - I think the status_type should have a default which must be SESSION.
> Usually, we just want to know what is the current value not the global
> value.

I've discussed with Andrei about this and we can the conclusion:
wait_for_status_ver.inc based on SHOW STATUS query which can be executed 
w/o specifying GLOBAL or SESSION so I don't set any default value to 
keep same behavior.

> 
> 2 - I think there is a similar include to yours, although they have
> different proposals.
> You should highlight in your include or in some other place which are
> the differences
> between both and when to use one and not the other.
> I don't know which is the procedure in this case.
> 
> ./include/wait_condition.inc

We have a lot of similar primitives for support different routines 
especially wait_*.inc. It makes test cases easy for 
development/reading/understanding so we don't need replace anything.


> 
> 3 - I was not able to reproduce the bug.
> I tried :(

It's _sporadic_ issue. I can't reproduce them too )

> 
> 4 - There is a lot of Maria's tests that fail. Is this right?

yes.

> 
> Cheers.
> 
> 
> Serge Kozlov wrote:
>> #At file:///home/ksm/sun/repo/bug39903/mysql-6.0-rpl/ based on
> revid:aelkin@stripped
>>
>>  2738 Serge Kozlov	2008-11-25
>>       Bug#39903: Sporadically some maria tests cannot use default connection
>>       after server restart. It happens because the connections to server
>>       did not restored properly and a test should check them before using.
>>       Suggested solution added checking number of connected threads on server
>>       before restart and then waiting this number on restarted server.
>>       1. include/wait_for_status_var.inc: new primitive for waiting value of
>>       a variable from SHOW STATUS.
>>       2. include/maria_empty_log.inc: added waiting of restoring all connections
>>       to restarted server.
>> added:
>>   mysql-test/include/wait_for_status_var.inc
>> modified:
>>   mysql-test/include/maria_empty_logs.inc
>>
>> === modified file 'mysql-test/include/maria_empty_logs.inc'
>> --- a/mysql-test/include/maria_empty_logs.inc	2008-07-24 18:26:12 +0000
>> +++ b/mysql-test/include/maria_empty_logs.inc	2008-11-25 15:07:31 +0000
>> @@ -7,6 +7,9 @@
>>  connection default;
>>  let $default_db=`select database()`;
>>  let $MYSQLD_DATADIR= `SELECT @@datadir`;
>> +# it will used at end of test for wait_for_status_var.inc primitive
>> +let $status_var= Threads_connected;
>> +let $status_var_value= query_get_value(SHOW STATUS LIKE 'Threads_connected',
> Value, 1);
>>  
>>  connection admin;
>>  -- echo * shut down mysqld, removed logs, restarted it
>> @@ -74,6 +77,8 @@ EOF
>>  --source include/wait_until_connected_again.inc
>>  
>>  connection default;
>> +# Make sure that all connections are restored
>> +--source include/wait_for_status_var.inc
>>  # Restore current database as the effect of "use" was lost after restart
>>  --disable_query_log
>>  eval use $default_db;
>>
>> === added file 'mysql-test/include/wait_for_status_var.inc'
>> --- a/mysql-test/include/wait_for_status_var.inc	1970-01-01 00:00:00 +0000
>> +++ b/mysql-test/include/wait_for_status_var.inc	2008-11-25 15:07:31 +0000
>> @@ -0,0 +1,68 @@
>> +# ==== Purpose ====
>> +#
>> +# Waits until a variable from SHOW STATUS has returned a specified 
>> +# value, or until a timeout is reached.
>> +#
>> +# ==== Usage ====
>> +#
>> +# let $status_var= Threads_connected;
>> +# let $status_var_value= 1;
>> +# --source include/wait_for_status_var.inc
>> +#
>> +# Parameters:
>> +#
>> +# $status_var, $status_var_value
>> +#   This macro will wait until the variable of SHOW STATUS 
>> +#   named $status_var gets the value $status_var_value.  See
>> +#   the example above.
>> +# 
>> +# $status_type= GLOBAL|SESSION
>> +#   To specify the type (attribute) of status variable and
>> +#   run either SHOW GLOBAL STATUS or SHOW SESSION STATUS.
>> +# 
>> +# $status_var_comparsion
>> +#   By default, this file waits until $status_var becomes equal to
>> +#   $status_var_value.  If you want to wait until $status_var
>> +#   becomes *unequal* to $status_var_value, set this parameter to the
>> +#   string '!=', like this:
>> +#     let $status_var_comparsion= !=;
>> +#
>> +# $status_timeout
>> +#   The default timeout is 1 minute. You can change the timeout by
>> +#   setting $status_timeout. The unit is tenths of seconds.
>> +#
>> +
>> +if (`SELECT STRCMP('$status_type', '') * STRCMP(UPPER('$status_type'),
> 'SESSION') * STRCMP(UPPER('$status_type'), 'GLOBAL')`)
>> +{
>> +  --echo **** ERROR: Unknown type of variable status_type: allowed values are:
> SESSION or GLOBAL ****
>> +  exit;
>> +}
>> +
>> +let $_status_timeout_counter= $status_timeout;
>> +if (!$_status_timeout_counter)
>> +{
>> +  let $_status_timeout_counter= 600;
>> +}
>> +
>> +let $_status_var_comparsion= $status_var_comparsion;
>> +if (`SELECT '$_status_var_comparsion' = ''`)
>> +{
>> +  let $_status_var_comparsion= =;
>> +}
>> +
>> +let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE
> '$status_var'", Value, 1);
>> +while (`SELECT NOT('$_show_status_value' $_status_var_comparsion
> '$status_var_value')`)
>> +{
>> +  if (!$_status_timeout_counter)
>> +  {
>> +    --echo **** ERROR: failed while waiting for $status_type $status_var
> $_status_var_comparison $status_var_value ****
>> +    --echo Note: the following output may have changed since the failure was
> detected
>> +    --echo **** Showing STATUS, PROCESSLIST ****
>> +    eval SHOW $status_type STATUS LIKE '$status_var';
>> +    SHOW PROCESSLIST;
>> +    exit;
>> +  }
>> +  dec $_status_timeout_counter;
>> +  sleep 0.1;
>> +  let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE
> '$status_var'", Value, 1);
>> +}
>>
>>
>>   
> 


-- 
Serge Kozlov, QA Developer
MySQL AB, Moscow, Russia, www.mysql.com
Office:

Are you MySQL certified?  www.mysql.com/certification
Thread
bzr commit into mysql-6.0-rpl branch (skozlov:2738) Bug#39903Serge Kozlov25 Nov
  • Re: bzr commit into mysql-6.0-rpl branch (skozlov:2738) Bug#39903alfranio correia26 Nov
    • Re: bzr commit into mysql-6.0-rpl branch (skozlov:2738) Bug#39903Serge Kozlov26 Nov
      • Re: bzr commit into mysql-6.0-rpl branch (skozlov:2738) Bug#39903alfranio correia26 Nov
        • Re: bzr commit into mysql-6.0-rpl branch (skozlov:2738) Bug#39903Serge Kozlov26 Nov
          • Re: bzr commit into mysql-6.0-rpl branch (skozlov:2738) Bug#39903alfranio correia26 Nov