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

Fix that REPAIR/ALTER TABLE use myisam_tempdir

parent 30bcd690
...@@ -44,7 +44,7 @@ extern "C" { ...@@ -44,7 +44,7 @@ extern "C" {
#define MI_NAME_IEXT ".MYI" #define MI_NAME_IEXT ".MYI"
#define MI_NAME_DEXT ".MYD" #define MI_NAME_DEXT ".MYD"
/* Max extra space to use when sorting keys */ /* 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 #define mi_portable_sizeof_char_ptr 8
...@@ -187,8 +187,9 @@ typedef struct st_columndef /* column information */ ...@@ -187,8 +187,9 @@ typedef struct st_columndef /* column information */
extern my_string myisam_log_filename; /* Name of logfile */ extern my_string myisam_log_filename; /* Name of logfile */
extern uint myisam_block_size; extern uint myisam_block_size;
extern my_bool myisam_flush,myisam_delay_key_write, extern my_bool myisam_flush,myisam_delay_key_write;
myisam_concurrent_insert; extern my_bool myisam_concurrent_insert;
extern my_off_t myisam_max_temp_length,myisam_max_extra_temp_length;
/* Prototypes for myisam-functions */ /* Prototypes for myisam-functions */
...@@ -376,7 +377,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ...@@ -376,7 +377,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
ulong); ulong);
int test_if_almost_full(MI_INFO *info); int test_if_almost_full(MI_INFO *info);
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename); 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); my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows);
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -2981,14 +2981,15 @@ ha_checksum mi_byte_checksum(const byte *buf, uint length) ...@@ -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) 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) && 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 > (ulonglong) rows * (key->maxlength - key->minlength) / 2 >
MI_MAX_TEMP_LENGTH || myisam_max_extra_temp_length ||
(rows == 0 && (key->maxlength / key->minlength) > 2))); (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; MYISAM_SHARE *share=info->s;
uint i; uint i;
......
...@@ -38,6 +38,9 @@ my_bool myisam_concurrent_insert=1; ...@@ -38,6 +38,9 @@ my_bool myisam_concurrent_insert=1;
#else #else
my_bool myisam_concurrent_insert=0; my_bool myisam_concurrent_insert=0;
#endif #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_ */ /* read_vec[] is used for converting between P_READ_KEY.. and SEARCH_ */
/* Position is , == , >= , <= , > , < */ /* Position is , == , >= , <= , > , < */
......
...@@ -618,7 +618,7 @@ void mi_get_status(void* param); ...@@ -618,7 +618,7 @@ void mi_get_status(void* param);
void mi_update_status(void* param); void mi_update_status(void* param);
void mi_copy_status(void* to,void *from); void mi_copy_status(void* to,void *from);
my_bool mi_check_status(void* param); 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, 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); enum ha_rkey_function search_flag, bool raw_key);
......
...@@ -346,11 +346,9 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt) ...@@ -346,11 +346,9 @@ int ha_myisam::restore(THD* thd, HA_CHECK_OPT *check_opt)
*p = 0; *p = 0;
fn_format(src_path, src_path, "", MI_NAME_DEXT, 4); fn_format(src_path, src_path, "", MI_NAME_DEXT, 4);
MY_STAT stat_area;
int error = 0; int error = 0;
char* errmsg = ""; char* errmsg = "";
if(my_copy(src_path, fn_format(dst_path, table->path, "", if(my_copy(src_path, fn_format(dst_path, table->path, "",
MI_NAME_DEXT, 4), MYF(MY_WME))) MI_NAME_DEXT, 4), MYF(MY_WME)))
{ {
...@@ -453,6 +451,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize) ...@@ -453,6 +451,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
param.tmpfile_createflag = O_RDWR | O_TRUNC; param.tmpfile_createflag = O_RDWR | O_TRUNC;
param.using_global_keycache = 1; param.using_global_keycache = 1;
param.thd=thd; param.thd=thd;
param.tmpdir=mysql_tmpdir;
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT, VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
4+ (param.opt_follow_links ? 16 : 0))); 4+ (param.opt_follow_links ? 16 : 0)));
...@@ -548,7 +547,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize) ...@@ -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) void ha_myisam::deactivate_non_unique_index(ha_rows rows)
{ {
if (!(specialflag & SPECIAL_SAFE_MODE)) 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) ...@@ -569,6 +568,8 @@ bool ha_myisam::activate_all_index(THD *thd)
param.myf_rw&= ~MY_WAIT_IF_FULL; param.myf_rw&= ~MY_WAIT_IF_FULL;
param.sort_buffer_length= myisam_sort_buffer_size; param.sort_buffer_length= myisam_sort_buffer_size;
param.opt_rep_quick++; param.opt_rep_quick++;
param.tmpdir=mysql_tmpdir;
error=repair(thd,param,0) != HA_ADMIN_OK; error=repair(thd,param,0) != HA_ADMIN_OK;
thd->proc_info=save_proc_info; thd->proc_info=save_proc_info;
} }
......
...@@ -926,7 +926,8 @@ static void safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi) ...@@ -926,7 +926,8 @@ static void safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
safe_sleep(thd, mi->connect_retry); safe_sleep(thd, mi->connect_retry);
} }
mysql_log.write(COM_CONNECT_OUT, "%s@%s:%d", mi->user, mi->host, mi->port); mysql_log.write(thd, COM_CONNECT_OUT, "%s@%s:%d",
mi->user, mi->host, mi->port);
} }
......
...@@ -93,10 +93,12 @@ typedef struct st_lex { ...@@ -93,10 +93,12 @@ typedef struct st_lex {
uint yylineno,yytoklen; /* Simulate lex */ uint yylineno,yytoklen; /* Simulate lex */
LEX_YYSTYPE yylval; LEX_YYSTYPE yylval;
uchar *ptr,*tok_start,*tok_end,*end_of_query; uchar *ptr,*tok_start,*tok_end,*end_of_query;
ha_rows select_limit,offset_limit;
char *length,*dec,*change,*name; char *length,*dec,*change,*name;
char *db,*db1,*table1,*db2,*table2; /* For outer join using .. */
char *backup_dir; /* For RESTORE/BACKUP */
String *wild; String *wild;
sql_exchange *exchange; sql_exchange *exchange;
ha_rows select_limit,offset_limit;
List<List_item> expr_list; List<List_item> expr_list;
List<List_item> when_list; List<List_item> when_list;
...@@ -119,7 +121,6 @@ typedef struct st_lex { ...@@ -119,7 +121,6 @@ typedef struct st_lex {
Item *where,*having,*default_value; Item *where,*having,*default_value;
CONVERT *convert_set; CONVERT *convert_set;
LEX_USER *grant_user; LEX_USER *grant_user;
char *db,*db1,*table1,*db2,*table2; /* For outer join using .. */
gptr yacc_yyss,yacc_yyvs; gptr yacc_yyss,yacc_yyvs;
THD *thd; THD *thd;
udf_func udf; udf_func udf;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment