MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Evgeny Potemkin Date:December 9 2009 3:39pm
Subject:Re: bzr commit into mysql-5.1-bugteam branch (epotemkin:3252) Bug#49489
View as plain text  
Hi Oystein,

Øystein Grøvlen wrote:
> Hi,
> 
> I have verified that the fix in this patch makes the included test
> case run correctly, but I have a few question to the fix:
> 
>  - Why do need to call both store() and setup().? Would not setup() be
>    sufficient?  No test in the main test suite fails if I drop the
>    call to store().
You're right, setup also saves the item to be cached. There is no need in
store.
> 
>  - If both are to be called, its seems a bit strange to call setup
>    after store.  I notice that in Item_sum_hybrid::setup the opposite
>    ordering is used.
The purpose of setup is to save properties of item to be cached (like 
max_length), pupose of store is to save item to be cached. Thus in this case 
their order doesn't matter.
> 
>  - Item_cache_row contains the following comment for setup:
>   /*
>     'setup' is needed only by row => it not called by simple row subselect
>     (only by IN subselect (in subselect optimizer))
>   */
>    I guess this is really not true since Item_cache::setup() is also
>   used for single values in your case.
Yes, the comment is wrong.
> 
> -- 
> Øystein
> 
Regards, Evgen.
> Evgeny Potemkin wrote:
>  > #At file:///work/bzrroot/49489-bug-5.1-bugteam/ based on 
> revid:luis.soares@stripped
>  >
>  >  3252 Evgeny Potemkin    2009-12-08
>  >       Bug#49489: Uninitialized cache led to a wrong result.
>  >
>  >       Arg_comparator uses Item_cache objects to store constants being 
> compared when
>  >       they're need a type conversion. Because this cache wasn't 
> initialized properly
>  >       Arg_comparator might produce wrong comparison result.
>  >
>  >       The Arg_comparator::cache_converted_constant function now 
> initializes cache
>  >       prior to usage.
>  >      @ mysql-test/r/select.result
>  >         Added a test case for he bug#49489.
>  >      @ mysql-test/t/select.test
>  >         Added a test case for he bug#49489.
>  >      @ sql/item_cmpfunc.cc
>  >         Bug#49489: Uninitialized cache led to a wrong result.
>  >         The Arg_comparator::cache_converted_constant function now 
> initializes cache
>  >         prior to usage.
>  >
>  >     modified:
>  >       mysql-test/r/select.result
>  >       mysql-test/t/select.test
>  >       sql/item_cmpfunc.cc
>  > === modified file 'mysql-test/r/select.result'
>  > --- a/mysql-test/r/select.result    2009-11-13 11:22:39 +0000
>  > +++ b/mysql-test/r/select.result    2009-12-08 14:02:26 +0000
>  > @@ -4609,4 +4609,14 @@ HAVING v <= 't'
>  >  ORDER BY pk;
>  >  v
>  >  DROP TABLE t1;
>  > +#
>  > +# Bug#49489 Uninitialized cache led to a wrong result.
>  > +#
>  > +CREATE TABLE t1(c1 DOUBLE(5,4));
>  > +INSERT INTO t1 VALUES (9.1234);
>  > +SELECT * FROM t1 WHERE c1 < 9.12345;
>  > +c1
>  > +9.1234
>  > +DROP TABLE t1;
>  > +# End of test for bug#49489.
>  >  End of 5.1 tests
>  >
>  > === modified file 'mysql-test/t/select.test'
>  > --- a/mysql-test/t/select.test    2009-11-13 11:22:39 +0000
>  > +++ b/mysql-test/t/select.test    2009-12-08 14:02:26 +0000
>  > @@ -3964,4 +3964,13 @@ ORDER BY pk;
>  >
>  >  DROP TABLE t1;
>  >
>  > +--echo #
>  > +--echo # Bug#49489 Uninitialized cache led to a wrong result.
>  > +--echo #
>  > +CREATE TABLE t1(c1 DOUBLE(5,4));
>  > +INSERT INTO t1 VALUES (9.1234);
>  > +SELECT * FROM t1 WHERE c1 < 9.12345;
>  > +DROP TABLE t1;
>  > +--echo # End of test for bug#49489.
>  > +
>  >  --echo End of 5.1 tests
>  >
>  > === modified file 'sql/item_cmpfunc.cc'
>  > --- a/sql/item_cmpfunc.cc    2009-12-02 13:49:21 +0000
>  > +++ b/sql/item_cmpfunc.cc    2009-12-08 14:02:26 +0000
>  > @@ -1024,6 +1024,7 @@ Item** Arg_comparator::cache_converted_c
>  >    {
>  >      Item_cache *cache= Item_cache::get_cache(*value, type);
>  >      cache->store(*value);
>  > +    cache->setup(*value);
>  >      *cache_item= cache;
>  >      return cache_item;
>  >    }
>  >
>  >
>  >
>  > ------------------------------------------------------------------------
>  >
>  >
> 
> 
Thread
bzr commit into mysql-5.1-bugteam branch (epotemkin:3252) Bug#49489Evgeny Potemkin8 Dec
  • Re: bzr commit into mysql-5.1-bugteam branch (epotemkin:3252) Bug#49489Øystein Grøvlen9 Dec
    • Re: bzr commit into mysql-5.1-bugteam branch (epotemkin:3252) Bug#49489Evgeny Potemkin9 Dec