Commit f2f515e5 authored by monty@donna.mysql.com's avatar monty@donna.mysql.com
Browse files

Fix that REPAIR/ALTER TABLE use myisam_tempdir

parent 30bcd690
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@ extern "C" {
#define MI_NAME_IEXT	".MYI"
#define MI_NAME_DEXT	".MYD"
/* Max extra space to use when sorting keys */
#define MI_MAX_TEMP_LENGTH	1024L*1024L*1024L
#define MI_MAX_TEMP_LENGTH	256*1024L*1024L

#define mi_portable_sizeof_char_ptr 8

@@ -187,8 +187,9 @@ typedef struct st_columndef /* column information */

extern my_string myisam_log_filename;		/* Name of logfile */
extern uint myisam_block_size;
extern my_bool myisam_flush,myisam_delay_key_write,
       	       myisam_concurrent_insert;
extern my_bool myisam_flush,myisam_delay_key_write;
extern my_bool myisam_concurrent_insert;
extern my_off_t myisam_max_temp_length,myisam_max_extra_temp_length;

	/* Prototypes for myisam-functions */

@@ -376,7 +377,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
			  ulong);
int test_if_almost_full(MI_INFO *info);
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename);
void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows);
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows);
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows);

#ifdef	__cplusplus
+4 −3
Original line number Diff line number Diff line
@@ -2981,14 +2981,15 @@ ha_checksum mi_byte_checksum(const byte *buf, uint length)
static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows)
{
  return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
	  ((ulonglong) rows * key->maxlength > MAX_FILE_SIZE ||
	  ((ulonglong) rows * key->maxlength >
	   (ulonglong) myisam_max_temp_length ||
	   (ulonglong) rows * (key->maxlength - key->minlength) / 2 >
	   MI_MAX_TEMP_LENGTH ||
	   myisam_max_extra_temp_length ||
	   (rows == 0 && (key->maxlength / key->minlength) > 2)));
}


void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows)
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
{
  MYISAM_SHARE *share=info->s;
  uint i;
+3 −0
Original line number Diff line number Diff line
@@ -38,6 +38,9 @@ my_bool myisam_concurrent_insert=1;
#else
my_bool myisam_concurrent_insert=0;
#endif
my_off_t myisam_max_extra_temp_length= MI_MAX_TEMP_LENGTH;
my_off_t myisam_max_temp_length= MAX_FILE_SIZE;


/* read_vec[] is used for converting between P_READ_KEY.. and SEARCH_ */
/* Position is , == , >= , <= , > , < */
+1 −1
Original line number Diff line number Diff line
@@ -618,7 +618,7 @@ void mi_get_status(void* param);
void mi_update_status(void* param);
void mi_copy_status(void* to,void *from);
my_bool mi_check_status(void* param);
void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows);
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows);
int _mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
	     enum ha_rkey_function search_flag, bool raw_key);

+4 −3
Original line number Diff line number Diff line
@@ -346,11 +346,9 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
  *p = 0;
  fn_format(src_path, src_path, "", MI_NAME_DEXT, 4);

  MY_STAT stat_area;
  int error = 0;
  char* errmsg = "";
  
  
  if(my_copy(src_path, fn_format(dst_path, table->path, "",
				 MI_NAME_DEXT, 4), MYF(MY_WME)))
    {
@@ -453,6 +451,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
  param.tmpfile_createflag = O_RDWR | O_TRUNC;
  param.using_global_keycache = 1;
  param.thd=thd;
  param.tmpdir=mysql_tmpdir;
    
  VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
		     4+ (param.opt_follow_links ? 16 : 0)));
@@ -548,7 +547,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
void ha_myisam::deactivate_non_unique_index(ha_rows rows)
{
  if (!(specialflag & SPECIAL_SAFE_MODE))
    mi_dectivate_non_unique_index(file,rows);
    mi_disable_non_unique_index(file,rows);
}


@@ -569,6 +568,8 @@ bool ha_myisam::activate_all_index(THD *thd)
    param.myf_rw&= ~MY_WAIT_IF_FULL;
    param.sort_buffer_length=  myisam_sort_buffer_size;
    param.opt_rep_quick++;
    param.tmpdir=mysql_tmpdir;

    error=repair(thd,param,0) != HA_ADMIN_OK;
    thd->proc_info=save_proc_info;
  }
Loading