List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:April 4 2011 12:02pm
Subject:Re: bzr commit into mysql-5.1 branch (guilhem.bichot:3645) Bug#11765141
View as plain text  
LGTM

-- didrik

On Fri, Apr 1, 2011 at 4:28 PM, Guilhem Bichot <guilhem.bichot@stripped>wrote:

> #At file:///home/mysql_src/bzrrepos_new/mysql-5.1/ based on
> revid:magne.mahre@stripped
>
>  3645 Guilhem Bichot    2011-04-01
>      Fix for Bug#11765141 - "58072: LOAD DATA INFILE: LEAKS IO CACHE MEMORY
> WHEN ERROR OCCURS"
>     @ mysql-test/t/loaddata.test
>        test for bug; without fix, running the test with --valgrind would
> show the leak
>        and make the test fail.
>     @ sql/sql_load.cc
>        In READ_INFO class, 'need_end_io_cache' is true as long as
> init_io_cache() was called,
>        so if it's true, we need to call end_io_cache(), to free memory
> allocated
>        by init_io_cache(). No matter the value of 'error'. In the bug's
> scenario,
>        'error' was set to true in read_sep_field() because
>        '1' (read from file) isn't suitable to load into a geometric column.
> Because of
>        'error', end_io_cache() was not called.
>        Note: end_io_cache() calls my_b_flush_io_cache(), which will do
> nothing wrong given
>        that the file is opened for reads only; see the init_io_cache() call
> which uses
>        only those read-only types:
>        (get_it_from_net) ? READ_NET : (is_fifo ? READ_FIFO : READ_CACHE).
>        *IF* the cache were rather used to write to the file,
> my_b_flush_io_cache() may
>        write to it, and it may be questionable to write to the file
>        if 'error' is true. But here there's no problem.
>
>    modified:
>      mysql-test/r/loaddata.result
>      mysql-test/t/loaddata.test
>      sql/sql_load.cc
> === modified file 'mysql-test/r/loaddata.result'
> --- a/mysql-test/r/loaddata.result      2010-07-14 11:54:51 +0000
> +++ b/mysql-test/r/loaddata.result      2011-04-01 14:28:53 +0000
> @@ -532,4 +532,13 @@ a
>  0
>  1
>  DROP TABLE t1;
> +#
> +# Bug#11765141 - 58072: LOAD DATA INFILE: LEAKS IO CACHE MEMORY
> +# WHEN ERROR OCCURS
> +#
> +SELECT '1\n' INTO DUMPFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt';
> +create table t1(a point);
> +LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug11735141.txt' INTO TABLE t1;
> +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY
> field
> +drop table t1;
>  End of 5.1 tests
>
> === modified file 'mysql-test/t/loaddata.test'
> --- a/mysql-test/t/loaddata.test        2010-07-14 11:54:51 +0000
> +++ b/mysql-test/t/loaddata.test        2011-04-01 14:28:53 +0000
> @@ -612,4 +612,19 @@ let $MYSQLD_DATADIR= `select @@datadir`;
>  remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
>
>
> +--echo #
> +--echo # Bug#11765141 - 58072: LOAD DATA INFILE: LEAKS IO CACHE MEMORY
> +--echo # WHEN ERROR OCCURS
> +--echo #
> +
> +--let $file=$MYSQLTEST_VARDIR/tmp/bug11735141.txt
> +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
> +--eval SELECT '1\n' INTO DUMPFILE '$file'
> +
> +create table t1(a point);
> +--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
> +--error ER_CANT_CREATE_GEOMETRY_OBJECT
> +--eval LOAD DATA INFILE '$file' INTO TABLE t1
> +drop table t1;
> +
>  --echo End of 5.1 tests
>
> === modified file 'sql/sql_load.cc'
> --- a/sql/sql_load.cc   2010-12-17 13:05:50 +0000
> +++ b/sql/sql_load.cc   2011-04-01 14:28:53 +0000
> @@ -1151,7 +1151,7 @@ READ_INFO::READ_INFO(File file_par, uint
>
>  READ_INFO::~READ_INFO()
>  {
> -  if (!error && need_end_io_cache)
> +  if (need_end_io_cache)
>     ::end_io_cache(&cache);
>
>   my_free(buffer, MYF(MY_ALLOW_ZERO_PTR));
>
>
>
> --
> MySQL Code Commits Mailing List
> For list archives: http://lists.mysql.com/commits
> To unsubscribe:
> http://lists.mysql.com/commits?unsub=1
>

Thread
bzr commit into mysql-5.1 branch (guilhem.bichot:3645) Bug#11765141Guilhem Bichot1 Apr
  • Re: bzr commit into mysql-5.1 branch (guilhem.bichot:3645) Bug#11765141Tor Didriksen4 Apr
Re: bzr commit into mysql-5.1 branch (guilhem.bichot:3645) Bug#11765141Guilhem Bichot7 Apr