List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:March 28 2008 12:47pm
Subject:Re: bk commit into 5.1 tree (hezx:1.2675)
View as plain text  
He Zhenxing skrev:
> Hi Magnus
> 
> Thank you for pointing out the spelling errors, will be fixed.
> 
> Unfortunately its not possible to use
>   skip requires '$_engine_type' storage engine;
> 
> 'skip' do not expand variables :(

ok, please file a bug against mysqltest for that one. Or do you like to
fix it? I'll show how.


> 
> When there is no information_schema, it seems $_engines_table will be
> empty.

ok

Maybe we should fix mysqltest to set the variable to something like
"Query failed with error: <mysql_errno>" ? Would that be better than
empty string...

> 
> On 2008-03-25 Tue 16:25 +0100,Magnus Svensson wrote:
>> Patch approved. Just correct the small issues found below.
>>
>> / Magnus
>>
>> He Zhenxing skrev:
>>> Hi Serge, Magnus
>>>
>>> Here is the modified patch of how to test if given storage engine is
> available
>>> or not for versional test. This used to be one part of my previous patch for
>>> versional test. Now I seperate it as an individual patch for you to review.
>>>
>>> As I have discussed with you two, hack the output of show engines
>>> is not a good idea, and Magnus also pointed out that for old versions, we
>>> can use have_<engine type> to check given engine type. So the basic
> idea of
>>> my patch is to check engine types by two means.
>>>   1. use information_schema.engines if its available
>>>   2. use have_<engine type> variable otherwise
>>>
>>>
>>> Below is the list of changes that have just been committed into a local
>>> 5.1 repository of hezx. When hezx does a push these changes will
>>> be propagated to the main repository and, within 24 hours after the
>>> push, to the public repository.
>>> For information on how to access the public repository
>>> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
>>>
>>> ChangeSet@stripped, 2008-03-20 18:06:08+08:00, hezx@stripped +10 -0
>>>   fixes for versional test
>>>   
>>>   added have_engine.inc to check if given engine available, which uses two
> methods
>>>   to check if given engine is available or not:
>>>     1. use information_schema.engines table if available
>>>     2. use have_<engine_type> or have_<engine_type>_engine
> variable
>>>   The second methods is required because engines table is not avaible on 5.0
> and some
>> magnus:                                                             ^
>>
>>>   other old versions.
>>>   
>>>   changed all have_<engine type>.inc to use have_engine.inc
>>>   
>>>   changed have_partition.inc to recognize have_partition_engine variable of
> older versions
>>>
>>>   mysql-test/include/have_archive.inc@stripped, 2008-03-20 18:06:03+08:00,
> hezx@stripped +8 -4
>>>     rewrite using have_engine.inc
>>>
>>>   mysql-test/include/have_blackhole.inc@stripped, 2008-03-20 18:06:03+08:00,
> hezx@stripped +6 -2
>>>     rewrite using have_engine.inc
>>>
>>>   mysql-test/include/have_csv.inc@stripped, 2008-03-20 18:06:03+08:00,
> hezx@stripped +6 -2
>>>     rewrite using have_engine.inc
>>>
>>>   mysql-test/include/have_engine.inc@stripped, 2008-03-20 18:06:04+08:00,
> hezx@stripped +36 -0
>>>     New BitKeeper file ``mysql-test/include/have_engine.inc''
>>>
>>>   mysql-test/include/have_engine.inc@stripped, 2008-03-20 18:06:04+08:00,
> hezx@stripped +0 -0
>>>
>>>   mysql-test/include/have_exampledb.inc@stripped, 2008-03-20 18:06:03+08:00,
> hezx@stripped +6 -2
>>>     rewrite using have_engine.inc
>>>
>>>   mysql-test/include/have_federated_db.inc@stripped, 2008-03-20 18:06:03+08:00,
> hezx@stripped +6 -2
>>>     rewrite using have_engine.inc
>>>
>>>   mysql-test/include/have_innodb.inc@stripped, 2008-03-20 18:06:03+08:00,
> hezx@stripped +6 -2
>>>     rewrite using have_engine.inc
>>>
>>>   mysql-test/include/have_multi_ndb.inc@stripped, 2008-03-20 18:06:03+08:00,
> hezx@stripped +4 -22
>>>     rewrite using have_engine.inc
>>>
>>>   mysql-test/include/have_ndbcluster.inc@stripped, 2008-03-20 18:06:04+08:00,
> hezx@stripped +8 -0
>>>     New BitKeeper file ``mysql-test/include/have_ndbcluster.inc''
>>>
>>>   mysql-test/include/have_ndbcluster.inc@stripped, 2008-03-20 18:06:04+08:00,
> hezx@stripped +0 -0
>>>
>>>   mysql-test/include/have_partition.inc@stripped, 2008-03-20 18:06:04+08:00,
> hezx@stripped +2 -1
>>>     older version use have_partition_engine
>>>
>>> diff -Nrup a/mysql-test/include/have_archive.inc
> b/mysql-test/include/have_archive.inc
>>> --- a/mysql-test/include/have_archive.inc	2007-06-09 19:05:41 +08:00
>>> +++ b/mysql-test/include/have_archive.inc	2008-03-20 18:06:03 +08:00
>>> @@ -1,4 +1,8 @@
>>> ---disable_query_log
>>> ---require r/true.require
>>> -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from
> information_schema.engines where engine = 'archive';
>>> ---enable_query_log
>>> +disable_query_log;
>>> +let $_engine_type=archive;
>>> +source include/have_engine.inc;
>>> +if (!$_have_engine)
>>> +{
>>> +  skip requires 'ARCHIVE' stroage engine;
>> magnus:                        ^ storage
>>
>>
>> Did you consider using
>> +  skip requires '$_engine_type' storage engine;
>> ?
>>
>>> +}
>>> +enable_query_log;
>>> diff -Nrup a/mysql-test/include/have_blackhole.inc
> b/mysql-test/include/have_blackhole.inc
>>> --- a/mysql-test/include/have_blackhole.inc	2007-06-09 19:05:41 +08:00
>>> +++ b/mysql-test/include/have_blackhole.inc	2008-03-20 18:06:03 +08:00
>>> @@ -1,4 +1,8 @@
>>>  disable_query_log;
>>> ---require r/true.require
>>> -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from
> information_schema.engines where engine = 'blackhole';
>>> +let $_engine_type=blackhole;
>>> +source include/have_engine.inc;
>>> +if (!$_have_engine)
>>> +{
>>> +  skip requires 'BLACKHOLE' stroage engine;
>> magnus:                        ^ storage
>>
>>> +}
>>>  enable_query_log;
>>> diff -Nrup a/mysql-test/include/have_csv.inc
> b/mysql-test/include/have_csv.inc
>>> --- a/mysql-test/include/have_csv.inc	2007-06-09 19:05:41 +08:00
>>> +++ b/mysql-test/include/have_csv.inc	2008-03-20 18:06:03 +08:00
>>> @@ -1,4 +1,8 @@
>>>  disable_query_log;
>>> ---require r/true.require
>>> -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from
> information_schema.engines where engine = 'csv';
>>> +let $_engine_type=CSV;
>>> +source include/have_engine.inc;
>>> +if (!$_have_engine)
>>> +{
>>> +  skip requires 'CSV' stroage engine;
>>> +}
>> magnus:                        ^ storage
>>
>>>  enable_query_log;
>>> diff -Nrup a/mysql-test/include/have_engine.inc
> b/mysql-test/include/have_engine.inc
>>> --- /dev/null	Wed Dec 31 16:00:00 196900
>>> +++ b/mysql-test/include/have_engine.inc	2008-03-20 18:06:04 +08:00
>>> @@ -0,0 +1,36 @@
>>> +# have_engine.inc -- test if specified storage engine supported
>>> +
>>> +# set variable $_engine_type before source this file, and the variable
>>> +# $_have_engine will be set to indicate if the specified engine is
>>> +# supported or not.
>>> + 
>>> +# for example:
>>> +#   let $_engine_type=InnoDB;
>>> +#   source include/have_engine.inc;
>>> +#   if ($_have_engine)
>>> +#   {
>>> +#     # do stuff that requires given engine
>>> +#   }
>>> +
>>> +# we now use two methods to check if given engine is supported or not:
>>> +#   1. use information_schema.engines table if its available
>>> +#   2. use have_<engine type> variable otherwise
>>> +
>>> +let $_engines_table= query_get_value(show tables from
>>> +    information_schema like 'ENGINES', Tables_in_information_schema
> (ENGINES), 1);
>> magnus: Just curious, what happens when we don't have 
>> "information_schema"?  What will $_engines_table contain?
>>
>>> +
>>> +let $_have_engines_table= `select '$_engines_table' = 'ENGINES'`;
>>> +
>>> +if ($_have_engines_table)
>>> +{
>>> +  let $_have_engine= `select (support = 'YES' or support = 'DEFAULT' or
>>> +  support = 'ENABLED') as 'TRUE' from information_schema.engines where
> engine = '$_engine_type'`;
>>> +}
>>> +
>>> +if (!$_have_engines_table)
>>> +{
>>> +  # variables for engines like blackhole, merge, federated, example are
>>> +  # ended with a '_engine'
>>> +  let $_engine_var= query_get_value(show variables like
> 'have_$_engine_type%', Value, 1);
>>> +  let $_have_engine= `select '$_engine_var' = 'YES'`;
>>> +}
>>> diff -Nrup a/mysql-test/include/have_exampledb.inc
> b/mysql-test/include/have_exampledb.inc
>>> --- a/mysql-test/include/have_exampledb.inc	2007-06-09 19:05:41 +08:00
>>> +++ b/mysql-test/include/have_exampledb.inc	2008-03-20 18:06:03 +08:00
>>> @@ -1,4 +1,8 @@
>>>  disable_query_log;
>>> ---require r/true.require
>>> -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from
> information_schema.engines where engine = 'example';
>>> +let $_engine_type=example;
>>> +source include/have_engine.inc;
>>> +if (!$_have_engine)
>>> +{
>>> +  skip requires 'EXAMPLE' storage engine;
>>> +}
>>>  enable_query_log;
>>> diff -Nrup a/mysql-test/include/have_federated_db.inc
> b/mysql-test/include/have_federated_db.inc
>>> --- a/mysql-test/include/have_federated_db.inc	2007-06-09 19:05:41 +08:00
>>> +++ b/mysql-test/include/have_federated_db.inc	2008-03-20 18:06:03 +08:00
>>> @@ -1,4 +1,8 @@
>>>  disable_query_log;
>>> ---require r/true.require
>>> -select (support = 'YES' or support = 'DEFAULT') as `TRUE` from
> information_schema.engines where engine = 'federated';
>>> +let $_engine_type=federated;
>>> +source include/have_engine.inc;
>>> +if (!$_have_engine)
>>> +{
>>> +  skip requires 'FEDERATED' storage engine;
>>> +}
>>>  enable_query_log;
>>> diff -Nrup a/mysql-test/include/have_innodb.inc
> b/mysql-test/include/have_innodb.inc
>>> --- a/mysql-test/include/have_innodb.inc	2007-12-21 04:57:00 +08:00
>>> +++ b/mysql-test/include/have_innodb.inc	2008-03-20 18:06:03 +08:00
>>> @@ -1,4 +1,8 @@
>>>  disable_query_log;
>>> ---require r/true.require
>>> -select (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as
> `TRUE` from information_schema.engines where engine = 'innodb';
>>> +let $_engine_type=innodb;
>>> +source include/have_engine.inc;
>>> +if (!$_have_engine)
>>> +{
>>> +  skip requires 'InnoDB' stroage engine;
>>> +}
>>>  enable_query_log;
>>> diff -Nrup a/mysql-test/include/have_multi_ndb.inc
> b/mysql-test/include/have_multi_ndb.inc
>>> --- a/mysql-test/include/have_multi_ndb.inc	2007-12-31 22:30:08 +08:00
>>> +++ b/mysql-test/include/have_multi_ndb.inc	2008-03-20 18:06:03 +08:00
>>> @@ -4,34 +4,16 @@ connect (server2,127.0.0.1,root,,test,$M
>>>  
>>>  # Check that server1 has NDB  support
>>>  connection server1;
>>> -let $engines_table= query_get_value(SHOW TABLES FROM information_schema LIKE
> 'engines', Tables_in_information_schema (engines), 1);
>>> +source include/have_ndbcluster.inc;
>>>  disable_query_log;
>>> ---disable_warnings
>>> -drop table if exists t1, t2;
>>> ---enable_warnings
>>> -flush tables;
>>> -if (`SELECT 1 FROM dual WHERE '$engines_table' = 'engines'`)
>>> -{
>>> ---require r/true.require
>>> -SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as
> `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
>>> ---source include/ndb_not_readonly.inc
>>> -}
>>> +source include/ndb_not_readonly.inc;
>>>  enable_query_log;
>>>  
>>>  # Check that server2 has NDB support
>>>  connection server2;
>>> -let $engines_table= query_get_value(SHOW TABLES FROM information_schema LIKE
> 'engines', Tables_in_information_schema (engines), 1);
>>> +source include/have_ndbcluster.inc;
>>>  disable_query_log;
>>> ---disable_warnings
>>> -drop table if exists t1, t2;
>>> ---enable_warnings
>>> -flush tables;
>>> -if (`SELECT 1 FROM dual WHERE '$engines_table' = 'engines'`)
>>> -{
>>> ---require r/true.require
>>> -SELECT (support = 'YES' or support = 'DEFAULT' or support = 'ENABLED') as
> `TRUE` FROM information_schema.engines WHERE engine = 'ndbcluster';
>>> ---source include/ndb_not_readonly.inc
>>> -}
>>> +source include/ndb_not_readonly.inc;
>>>  enable_query_log;
>>>  
>>>  # Set the default connection to 'server1'
>>> diff -Nrup a/mysql-test/include/have_ndbcluster.inc
> b/mysql-test/include/have_ndbcluster.inc
>>> --- /dev/null	Wed Dec 31 16:00:00 196900
>>> +++ b/mysql-test/include/have_ndbcluster.inc	2008-03-20 18:06:04 +08:00
>>> @@ -0,0 +1,8 @@
>>> +disable_query_log;
>>> +let $_engine_type=ndbcluster;
>>> +source include/have_engine.inc;
>>> +if (!$_have_engine)
>>> +{
>>> +  skip requires 'NDBCLUSTER' storage engine;
>>> +}
>>> +enable_query_log;
>>> diff -Nrup a/mysql-test/include/have_partition.inc
> b/mysql-test/include/have_partition.inc
>>> --- a/mysql-test/include/have_partition.inc	2006-01-23 22:42:26 +08:00
>>> +++ b/mysql-test/include/have_partition.inc	2008-03-20 18:06:04 +08:00
>>> @@ -1,4 +1,5 @@
>>>  -- require r/have_partition.require
>>>  disable_query_log;
>>> -show variables like "have_partitioning";
>>> +--replace_result have_partition_engine have_partitioning
>>> +show variables like "have_partition%";
>>>  enable_query_log;
>>>
> 
> 

Thread
bk commit into 5.1 tree (hezx:1.2675)He Zhenxing21 Mar
  • Re: bk commit into 5.1 tree (hezx:1.2675)Magnus Svensson25 Mar
    • Re: bk commit into 5.1 tree (hezx:1.2675)He Zhenxing26 Mar
      • Re: bk commit into 5.1 tree (hezx:1.2675)Magnus Svensson28 Mar
        • Re: bk commit into 5.1 tree (hezx:1.2675)He Zhenxing3 Apr
          • Re: bk commit into 5.1 tree (hezx:1.2675)Magnus Svensson3 Apr
            • Re: bk commit into 5.1 tree (hezx:1.2675)He Zhenxing3 Apr
  • Re: bk commit into 5.1 tree (hezx:1.2675)Serge Kozlov25 Mar
  • Re: bk commit into 5.1 tree (hezx:1.2675)Magnus Svensson26 Mar
    • Re: bk commit into 5.1 tree (hezx:1.2675)He Zhenxing26 Mar