Hello,
On Wed, Jul 11, 2007 at 10:49:57AM +0300, kgeorge@stripped wrote:
> ChangeSet@stripped, 2007-07-11 10:49:54+03:00, gkodinov@stripped +9 -0
> Bug #29325:
> By default MyISAM overwrites .MYD and .MYI files no
> DATA DIRECTORY option is used. This can lead to two tables
> using the same .MYD and .MYI files (that can't be dropped).
>
> To prevent CREATE TABLE from overwriting a file a new option
> is introduced : keep_files_on_create
> When this is on the CREATE TABLE throws an error if either
> the .MYD or .MYI exists for a MyISAM table.
> The option is off by default (resulting in compatible behavior).
> diff -Nrup a/myisam/mi_create.c b/myisam/mi_create.c
> --- a/myisam/mi_create.c 2007-03-13 16:05:10 +02:00
> +++ b/myisam/mi_create.c 2007-07-11 10:49:53 +03:00
> @@ -586,7 +586,8 @@ int mi_create(const char *name,uint keys
> 32 : 0));
> linkname_ptr=0;
> /* Replace the current file */
> - create_flag=MY_DELETE_OLD;
> + if (!(flags & HA_CREATE_KEEP_FILES))
> + create_flag=MY_DELETE_OLD;
> }
>
> /*
> @@ -647,7 +648,8 @@ int mi_create(const char *name,uint keys
> {
> fn_format(filename,name,"",MI_NAME_DEXT,4);
> linkname_ptr=0;
> - create_flag=MY_DELETE_OLD;
> + if (!(flags & HA_CREATE_KEEP_FILES))
> + create_flag=MY_DELETE_OLD;
> }
> if ((dfile=
> my_create_with_symlink(linkname_ptr, filename, 0, create_mode,
ha_myisam::create() and mi_create() are also called in case of
TRUNCATE TABLE (destroying old data and index files as it creates new
empty ones). I wonder if it could fail now, with the new option on.
Could you please verify, with the new option on and a simple table
like this:
create table t(a int) engine=myisam;
insert into t values(1);
truncate table t;
that TRUNCATE still works, and if it works, add this in a .test file?
Thank you!
--
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Guilhem Bichot <guilhem@stripped>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Lead Software Engineer
/_/ /_/\_, /___/\___\_\___/ Bordeaux, France
<___/ www.mysql.com