Commit 5a4aa474 authored by unknown's avatar unknown

Fix that REPAIR/ALTER TABLE use myisam_tempdir


include/myisam.h:
  Don't assume too big tempoary disks
myisam/mi_check.c:
  Don't assume too big tempoary disks
myisam/mi_static.c:
  Don't assume too big tempoary disks
myisam/myisamdef.h:
  Fix type
sql/ha_myisam.cc:
  Set myisamchk to use MySQL temporary disk space
sql/slave.cc:
  Fix parameters
sql/sql_lex.h:
  Added backup_dir
parent 8c6b365e
......@@ -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
......
......@@ -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;
......
......@@ -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 , == , >= , <= , > , < */
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -926,7 +926,8 @@ static void safe_connect(THD* thd, MYSQL* mysql, MASTER_INFO* mi)
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 {
uint yylineno,yytoklen; /* Simulate lex */
LEX_YYSTYPE yylval;
uchar *ptr,*tok_start,*tok_end,*end_of_query;
ha_rows select_limit,offset_limit;
char *length,*dec,*change,*name;
char *db,*db1,*table1,*db2,*table2; /* For outer join using .. */
char *backup_dir; /* For RESTORE/BACKUP */
String *wild;
sql_exchange *exchange;
ha_rows select_limit,offset_limit;
List<List_item> expr_list;
List<List_item> when_list;
......@@ -119,7 +121,6 @@ typedef struct st_lex {
Item *where,*having,*default_value;
CONVERT *convert_set;
LEX_USER *grant_user;
char *db,*db1,*table1,*db2,*table2; /* For outer join using .. */
gptr yacc_yyss,yacc_yyvs;
THD *thd;
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