Commit 866a8278 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Added support for symlinked tables.

myisamchk: Don't force a repair if the only problem was that the
open count wasn't correct.
Added missing error messages.
parent 762f423d
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -110,10 +110,7 @@ extern int NEAR my_errno; /* Last error in mysys */

	/* root_alloc flags */
#define MY_KEEP_PREALLOC	1
#define MY_MARK_BLOCKS_FREE     2 /* do not my_free() blocks,
				     just move used into free list
				     and mark all blocks as fully free
				  */
#define MY_MARK_BLOCKS_FREE     2  /* move used to free list and reuse them */
  
	/* defines when allocating data */

+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \
			mf_pack.lo my_messnc.lo mf_dirname.lo mf_fn_ext.lo\
			mf_wcomp.lo typelib.lo safemalloc.lo my_alloc.lo \
			mf_format.lo mf_path.lo mf_unixpath.lo my_fopen.lo \
			my_fstream.lo \
			my_symlink.lo my_fstream.lo \
			mf_loadpath.lo my_pthread.lo my_thr_init.lo \
			thr_mutex.lo mulalloc.lo string.lo default.lo \
			my_compress.lo array.lo my_once.lo list.lo my_net.lo \
+25 −10
Original line number Diff line number Diff line
@@ -1130,7 +1130,10 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,

  if (!rep_quick)
  {
    if ((new_file=my_raid_create(fn_format(param->temp_filename,name,"",
    /* Get real path for data file */
    fn_format(param->temp_filename,name,"", MI_NAME_DEXT,2+4+32);
    if ((new_file=my_raid_create(fn_format(param->temp_filename,
					   param->temp_filename,"",
					   DATA_TMP_EXT,
					   2+4),
				 0,param->tmpfile_createflag,
@@ -1476,8 +1479,10 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
  if (!(param->testflag & T_SILENT))
    printf("- Sorting index for MyISAM-table '%s'\n",name);

  if ((new_file=my_create(fn_format(param->temp_filename,name,"",
				    INDEX_TMP_EXT,2+4),
  /* Get real path for index file */
  fn_format(param->temp_filename,name,"", MI_NAME_IEXT,2+4+32);
  if ((new_file=my_create(fn_format(param->temp_filename,param->temp_filename,
				    "", INDEX_TMP_EXT,2+4),
			  0,param->tmpfile_createflag,MYF(0))) <= 0)
  {
    mi_check_print_error(param,"Can't create new tempfile: '%s'",
@@ -1618,9 +1623,14 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
} /* sort_one_index */


	/* Change to use new file */
	/* Copy stats from old file to new file, deletes orginal and */
	/* changes new file name to old file name */
	/*
	  Let temporary file replace old file.
	  This assumes that the new file was created in the same
	  directory as given by realpath(filename).
	  This will ensure that any symlinks that are used will still work.
	  Copy stats from old file to new file, deletes orignal and
	  changes new file name to old file name
	*/

int change_to_newfile(const char * filename, const char * old_ext,
		      const char * new_ext,
@@ -1635,8 +1645,10 @@ int change_to_newfile(const char * filename, const char * old_ext,
			 raid_chunks,
			 MYF(MY_WME | MY_LINK_WARNING | MyFlags));
#endif
  return my_redel(fn_format(old_filename,filename,"",old_ext,2+4),
		  fn_format(new_filename,filename,"",new_ext,2+4),
  /* Get real path to filename */
  (void) fn_format(old_filename,filename,"",old_ext,2+4+32);
  return my_redel(old_filename,
		  fn_format(new_filename,old_filename,"",new_ext,2+4),
		  MYF(MY_WME | MY_LINK_WARNING | MyFlags));
} /* change_to_newfile */

@@ -1753,7 +1765,10 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
  }
  if (!rep_quick)
  {
    if ((new_file=my_raid_create(fn_format(param->temp_filename,name,"",
    /* Get real path for data file */
    fn_format(param->temp_filename,name,"", MI_NAME_DEXT,2+4+32);
    if ((new_file=my_raid_create(fn_format(param->temp_filename,
					   param->temp_filename, "",
					   DATA_TMP_EXT,
					   2+4),
				 0,param->tmpfile_createflag,
+2 −2
Original line number Diff line number Diff line
@@ -50,12 +50,12 @@ int mi_delete_table(const char *name)
#endif /* USE_RAID */

  fn_format(from,name,"",MI_NAME_IEXT,4);
  if (my_delete(from, MYF(MY_WME)))
  if (my_delete_with_symlink(from, MYF(MY_WME)))
    DBUG_RETURN(my_errno);
  fn_format(from,name,"",MI_NAME_DEXT,4);
#ifdef USE_RAID
  if (raid_type)
    DBUG_RETURN(my_raid_delete(from, raid_chunks, MYF(MY_WME)) ? my_errno : 0);
#endif
  DBUG_RETURN(my_delete(from, MYF(MY_WME)) ? my_errno : 0);
  DBUG_RETURN(my_delete_with_symlink(from, MYF(MY_WME)) ? my_errno : 0);
}
+3 −3
Original line number Diff line number Diff line
@@ -132,10 +132,10 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
    }
    /* Don't call realpath() if the name can't be a link */
    if (strcmp(name_buff, org_name))
      my_readlink(index_name, org_name, MYF(0));
      (void) my_readlink(index_name, org_name, MYF(0));
    else
      strmov(index_name, org_name);
    fn_format(data_name,org_name,"",MI_NAME_DEXT,4+16);
      (void) strmov(index_name, org_name);
    (void) fn_format(data_name,org_name,"",MI_NAME_DEXT,2+4+16);

    info_length=mi_uint2korr(share->state.header.header_length);
    base_pos=mi_uint2korr(share->state.header.base_pos);
Loading