From a178584d8a8a81e461c1107f8558ee6233258ce5 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 31 May 2001 14:07:17 +0300 Subject: Removed compiler warnings. Added preliminary handling of symlinks in MyISAM. When using myisamchk to check tables with --force, don't repair tables that are marked as 'not closed' if they are ok. Change fn_format() to use my_real_path and my_symlink include/myisam.h: Added handling of symlinks myisam/ft_boolean_search.c: cleanup myisam/ft_dump.c: cleanup myisam/mi_check.c: Added handling of symlinks. When using check and --force, don't repair tables that are marked as 'not closed' if they are ok. myisam/mi_create.c: Added handling of symlinks. myisam/mi_dbug.c: Added handling of symlinks. myisam/mi_info.c: Added handling of symlinks. myisam/mi_open.c: Added handling of symlinks. myisam/mi_search.c: cleanup myisam/myisamchk.c: Added handling of symlinks. myisam/myisamdef.h: Added handling of symlinks. myisam/myisamlog.c: Fixed bug when using new trees myisam/myisampack.c: cleanup mysys/mf_cache.c: cleanup mysys/mf_format.c: Change to use my_real_path and my_symlink mysys/my_alloc.c: cleanup BitKeeper/etc/ignore: Added libmysqld/sql_command libmysqld/backup_dir libmysqld/simple-test to the ignore list BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- myisam/mi_create.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'myisam/mi_create.c') diff --git a/myisam/mi_create.c b/myisam/mi_create.c index 6de13f8f84a..baac816092d 100644 --- a/myisam/mi_create.c +++ b/myisam/mi_create.c @@ -468,16 +468,20 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, if (! (flags & HA_DONT_TOUCH_DATA)) share.state.create_time= (long) time((time_t*) 0); - if ((file = my_create(fn_format(buff,name,"",MI_NAME_IEXT,4),0, - O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) + if ((file= my_create_with_symlink(ci->index_file_name, + fn_format(buff,name,"",MI_NAME_IEXT,4+ + (ci->index_file_name ? 0 : 32)), + 0, O_RDWR | O_TRUNC, + MYF(MY_WME | MY_DELETE_OLD))) < 0) goto err; errpos=1; - VOID(fn_format(buff,name,"",MI_NAME_DEXT,2+4)); + if (!(flags & HA_DONT_TOUCH_DATA)) { #ifdef USE_RAID if (share.base.raid_type) { + (void) fn_format(buff,name,"",MI_NAME_DEXT,2+4); if ((dfile=my_raid_create(buff,0,O_RDWR | O_TRUNC, share.base.raid_type, share.base.raid_chunks, @@ -487,9 +491,14 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, } else #endif - if ((dfile = my_create(buff,0,O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) - goto err; - + { + (void) fn_format(buff,name,"",MI_NAME_DEXT,2+4 + + (ci->data_file_name ? 0 : 32)); + if ((dfile= + my_create_with_symlink(ci->data_file_name, buff, + 0,O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) + goto err; + } errpos=3; } @@ -601,6 +610,8 @@ err: /* QQ: Tõnu should add a call to my_raid_delete() here */ VOID(fn_format(buff,name,"",MI_NAME_DEXT,2+4)); my_delete(buff,MYF(0)); + if (ci->data_file_name && strcmp(buff,ci->data_file_name)) + my_delete(ci->data_file_name,MYF(0)); } /* fall through */ case 1: @@ -609,6 +620,8 @@ err: { VOID(fn_format(buff,name,"",MI_NAME_IEXT,2+4)); my_delete(buff,MYF(0)); + if (ci->index_file_name && strcmp(buff,ci->index_file_name)) + my_delete(ci->index_file_name,MYF(0)); } } my_free((char*) rec_per_key_part, MYF(0)); -- cgit v1.2.1