Stopwords (English only); fulltext keys now can be repaired

parent 9349bf7e
...@@ -45,6 +45,7 @@ my_config.h: ../config.h ...@@ -45,6 +45,7 @@ my_config.h: ../config.h
# This should be changed in the source and removed. # This should be changed in the source and removed.
my_global.h: global.h my_global.h: global.h
-$(RM) my_global.h
$(CP) global.h my_global.h $(CP) global.h my_global.h
# These files should not be included in distributions since they are # These files should not be included in distributions since they are
......
...@@ -40,6 +40,8 @@ typedef struct st_ft_doclist { ...@@ -40,6 +40,8 @@ typedef struct st_ft_doclist {
FT_DOC doc[1]; FT_DOC doc[1];
} FT_DOCLIST; } FT_DOCLIST;
extern const char *ft_precompiled_stopwords[];
int ft_init_stopwords(const char **); int ft_init_stopwords(const char **);
FT_DOCLIST * ft_init_search(void *, uint, byte *, uint, my_bool); FT_DOCLIST * ft_init_search(void *, uint, byte *, uint, my_bool);
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
...@@ -35,8 +35,6 @@ ...@@ -35,8 +35,6 @@
extern const MI_KEYSEG ft_keysegs[FT_SEGS]; extern const MI_KEYSEG ft_keysegs[FT_SEGS];
extern const char *ft_precompiled_stopwords[];
int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *); int _mi_ft_cmp(MI_INFO *, uint, const byte *, const byte *);
int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t); int _mi_ft_add(MI_INFO *, uint, byte *, const byte *, my_off_t);
int _mi_ft_del(MI_INFO *, uint, byte *, const byte *, my_off_t); int _mi_ft_del(MI_INFO *, uint, byte *, const byte *, my_off_t);
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
...@@ -1083,7 +1083,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1083,7 +1083,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
if (!(sort_info->record=(byte*) my_malloc((uint) share->base.pack_reclength, if (!(sort_info->record=(byte*) my_malloc((uint) share->base.pack_reclength,
MYF(0)))) MYF(0))))
{ {
mi_check_print_error(param,"Not Enough memory for extra record"); mi_check_print_error(param,"Not enough memory for extra record");
goto err; goto err;
} }
...@@ -1141,6 +1141,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info, ...@@ -1141,6 +1141,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
for (i=0 ; i < share->state.header.max_block_size ; i++) for (i=0 ; i < share->state.header.max_block_size ; i++)
share->state.key_del[i]= HA_OFFSET_ERROR; share->state.key_del[i]= HA_OFFSET_ERROR;
share->state.key_map= ((ulonglong)1L << share->base.keys)-1; /* Should I ? */
info->state->key_file_length=share->base.keystart; info->state->key_file_length=share->base.keystart;
lock_memory(param); /* Everything is alloced */ lock_memory(param); /* Everything is alloced */
...@@ -1271,8 +1273,15 @@ static int writekeys(register MI_INFO *info,byte *buff,my_off_t filepos) ...@@ -1271,8 +1273,15 @@ static int writekeys(register MI_INFO *info,byte *buff,my_off_t filepos)
{ {
if (((ulonglong) 1 << i) & info->s->state.key_map) if (((ulonglong) 1 << i) & info->s->state.key_map)
{ {
uint key_length=_mi_make_key(info,i,key,buff,filepos); if (info->s->keyinfo[i].flag & HA_FULLTEXT )
if (_mi_ck_write(info,i,key,key_length)) goto err; {
if (_mi_ft_add(info,i,(char*) key,buff,filepos)) goto err;
}
else
{
uint key_length=_mi_make_key(info,i,key,buff,filepos);
if (_mi_ck_write(info,i,key,key_length)) goto err;
}
} }
} }
DBUG_RETURN(0); DBUG_RETURN(0);
...@@ -1285,8 +1294,15 @@ static int writekeys(register MI_INFO *info,byte *buff,my_off_t filepos) ...@@ -1285,8 +1294,15 @@ static int writekeys(register MI_INFO *info,byte *buff,my_off_t filepos)
{ {
if (((ulonglong) 1 << i) & info->s->state.key_map) if (((ulonglong) 1 << i) & info->s->state.key_map)
{ {
uint key_length=_mi_make_key(info,i,key,buff,filepos); if (info->s->keyinfo[i].flag & HA_FULLTEXT)
if (_mi_ck_delete(info,i,key,key_length)) break; {
if (_mi_ft_del(info,i,(char*) key,buff,filepos)) break;
}
else
{
uint key_length=_mi_make_key(info,i,key,buff,filepos);
if (_mi_ck_delete(info,i,key,key_length)) break;
}
} }
} }
} }
...@@ -1919,8 +1935,17 @@ static int sort_key_read(SORT_INFO *sort_info, void *key) ...@@ -1919,8 +1935,17 @@ static int sort_key_read(SORT_INFO *sort_info, void *key)
"Found too many records; Can`t continue"); "Found too many records; Can`t continue");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
VOID(_mi_make_key(info,sort_info->key,key,sort_info->record, if (sort_info->keyinfo->flag & HA_FULLTEXT )
sort_info->filepos)); {
mi_check_print_error(sort_info->param,
"Can`t use repair_by_sort with FULLTEXT key");
DBUG_RETURN(1);
}
else
{
VOID(_mi_make_key(info,sort_info->key,key,sort_info->record,
sort_info->filepos));
}
DBUG_RETURN(sort_write_record(sort_info)); DBUG_RETURN(sort_write_record(sort_info));
} /* sort_key_read */ } /* sort_key_read */
...@@ -2984,7 +3009,7 @@ my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows) ...@@ -2984,7 +3009,7 @@ my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows)
return FALSE; /* Can't use sort */ return FALSE; /* Can't use sort */
for (i=0 ; i < share->base.keys ; i++,key++) for (i=0 ; i < share->base.keys ; i++,key++)
{ {
if (mi_too_big_key_for_sort(key,rows)) if (mi_too_big_key_for_sort(key,rows) || (key->flag & HA_FULLTEXT))
return FALSE; return FALSE;
} }
return TRUE; return TRUE;
......
...@@ -372,6 +372,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param) ...@@ -372,6 +372,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param)
param.table_name = table->table_name; param.table_name = table->table_name;
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;
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)));
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
...@@ -875,7 +875,7 @@ void end_thread(THD *thd, bool put_in_cache) ...@@ -875,7 +875,7 @@ void end_thread(THD *thd, bool put_in_cache)
(void) pthread_mutex_lock(&LOCK_thread_count); (void) pthread_mutex_lock(&LOCK_thread_count);
thread_count--; thread_count--;
delete thd; delete thd;
if (put_in_cache && cached_thread_count < thread_cache_size && if (put_in_cache && cached_thread_count < thread_cache_size &&
! abort_loop && !kill_cached_threads) ! abort_loop && !kill_cached_threads)
{ {
...@@ -1455,7 +1455,7 @@ int main(int argc, char **argv) ...@@ -1455,7 +1455,7 @@ int main(int argc, char **argv)
sql_print_error("Can't init databases"); sql_print_error("Can't init databases");
exit(1); exit(1);
} }
ft_init_stopwords(NULL); /* SerG */ ft_init_stopwords(ft_precompiled_stopwords); /* SerG */
#ifdef __WIN__ #ifdef __WIN__
#define MYSQL_ERR_FILE "mysql.err" #define MYSQL_ERR_FILE "mysql.err"
...@@ -1531,12 +1531,12 @@ int main(int argc, char **argv) ...@@ -1531,12 +1531,12 @@ int main(int argc, char **argv)
// slave thread // slave thread
if(master_host) if(master_host)
{ {
pthread_t hThread; pthread_t hThread;
if(pthread_create(&hThread, &connection_attrib, handle_slave, 0)) if(pthread_create(&hThread, &connection_attrib, handle_slave, 0))
sql_print_error("Warning: Can't create thread to handle slave"); sql_print_error("Warning: Can't create thread to handle slave");
} }
printf(ER(ER_READY),my_progname,server_version,""); printf(ER(ER_READY),my_progname,server_version,"");
fflush(stdout); fflush(stdout);
...@@ -2179,7 +2179,7 @@ static struct option long_options[] = ...@@ -2179,7 +2179,7 @@ static struct option long_options[] =
{"log-update", optional_argument, 0, (int) OPT_UPDATE_LOG}, {"log-update", optional_argument, 0, (int) OPT_UPDATE_LOG},
{"log-slow-queries", optional_argument, 0, (int) OPT_SLOW_QUERY_LOG}, {"log-slow-queries", optional_argument, 0, (int) OPT_SLOW_QUERY_LOG},
{"log-long-format", no_argument, 0, (int) OPT_LONG_FORMAT}, {"log-long-format", no_argument, 0, (int) OPT_LONG_FORMAT},
{"log-slave-updates", no_argument,0, (int) OPT_LOG_SLAVE_UPDATES}, {"log-slave-updates", no_argument,0, (int) OPT_LOG_SLAVE_UPDATES},
{"low-priority-updates", no_argument, 0, (int) OPT_LOW_PRIORITY_UPDATES}, {"low-priority-updates", no_argument, 0, (int) OPT_LOW_PRIORITY_UPDATES},
{"master-host", required_argument, 0, (int) OPT_MASTER_HOST}, {"master-host", required_argument, 0, (int) OPT_MASTER_HOST},
{"master-user", required_argument, 0, (int) OPT_MASTER_USER}, {"master-user", required_argument, 0, (int) OPT_MASTER_USER},
...@@ -2209,7 +2209,7 @@ static struct option long_options[] = ...@@ -2209,7 +2209,7 @@ static struct option long_options[] =
{"skip-show-database",no_argument,0, (int) OPT_SKIP_SHOW_DB}, {"skip-show-database",no_argument,0, (int) OPT_SKIP_SHOW_DB},
{"skip-networking", no_argument,0, (int) OPT_SKIP_NETWORKING}, {"skip-networking", no_argument,0, (int) OPT_SKIP_NETWORKING},
{"skip-thread-priority", no_argument,0,(int) OPT_SKIP_PRIOR}, {"skip-thread-priority", no_argument,0,(int) OPT_SKIP_PRIOR},
{"sql-bin-update-same", no_argument, 0, (int)OPT_SQL_BIN_UPDATE_SAME}, {"sql-bin-update-same", no_argument, 0, (int)OPT_SQL_BIN_UPDATE_SAME},
#include "sslopt-longopts.h" #include "sslopt-longopts.h"
#ifdef __WIN__ #ifdef __WIN__
{"standalone", no_argument,0, (int) OPT_STANDALONE}, {"standalone", no_argument,0, (int) OPT_STANDALONE},
...@@ -2393,7 +2393,7 @@ struct show_var_st status_vars[]= { ...@@ -2393,7 +2393,7 @@ struct show_var_st status_vars[]= {
{"Questions", (char*) 0, SHOW_QUESTION}, {"Questions", (char*) 0, SHOW_QUESTION},
{"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG}, {"Slow_launch_threads", (char*) &slow_launch_threads, SHOW_LONG},
{"Slow_queries", (char*) &long_query_count, SHOW_LONG}, {"Slow_queries", (char*) &long_query_count, SHOW_LONG},
{"Slave_running", (char*) &slave_running, SHOW_BOOL}, {"Slave_running", (char*) &slave_running, SHOW_BOOL},
{"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_CONST}, {"Threads_cached", (char*) &cached_thread_count, SHOW_LONG_CONST},
{"Threads_connected", (char*) &thread_count, SHOW_INT_CONST}, {"Threads_connected", (char*) &thread_count, SHOW_INT_CONST},
{"Threads_running", (char*) &thread_running, SHOW_INT_CONST}, {"Threads_running", (char*) &thread_running, SHOW_INT_CONST},
...@@ -2502,7 +2502,7 @@ static void usage(void) ...@@ -2502,7 +2502,7 @@ static void usage(void)
--bdb-tmpdir=directory Berkeley DB tempfile name\n\ --bdb-tmpdir=directory Berkeley DB tempfile name\n\
--skip-bdb Don't use berkeley db (will save memory)\n\ --skip-bdb Don't use berkeley db (will save memory)\n\
"); ");
#endif #endif
print_defaults("my",load_default_groups); print_defaults("my",load_default_groups);
puts(""); puts("");
...@@ -2687,39 +2687,39 @@ static void get_options(int argc,char **argv) ...@@ -2687,39 +2687,39 @@ static void get_options(int argc,char **argv)
break; break;
case (int) OPT_BIN_LOG: case (int) OPT_BIN_LOG:
opt_bin_log=1; opt_bin_log=1;
opt_bin_logname=optarg; opt_bin_logname=optarg;
break; break;
case (int) OPT_LOG_SLAVE_UPDATES: case (int) OPT_LOG_SLAVE_UPDATES:
opt_log_slave_updates = 1; opt_log_slave_updates = 1;
break; break;
case (int)OPT_REPLICATE_IGNORE_DB: case (int)OPT_REPLICATE_IGNORE_DB:
{ {
i_string *db = new i_string(optarg); i_string *db = new i_string(optarg);
replicate_ignore_db.push_back(db); replicate_ignore_db.push_back(db);
break; break;
} }
case (int)OPT_REPLICATE_DO_DB: case (int)OPT_REPLICATE_DO_DB:
{ {
i_string *db = new i_string(optarg); i_string *db = new i_string(optarg);
replicate_do_db.push_back(db); replicate_do_db.push_back(db);
break; break;
} }
case (int)OPT_BINLOG_IGNORE_DB: case (int)OPT_BINLOG_IGNORE_DB:
{ {
i_string *db = new i_string(optarg); i_string *db = new i_string(optarg);
binlog_ignore_db.push_back(db); binlog_ignore_db.push_back(db);
break; break;
} }
case (int)OPT_BINLOG_DO_DB: case (int)OPT_BINLOG_DO_DB:
{ {
i_string *db = new i_string(optarg); i_string *db = new i_string(optarg);
binlog_do_db.push_back(db); binlog_do_db.push_back(db);
break; break;
} }
case (int) OPT_SQL_BIN_UPDATE_SAME: case (int) OPT_SQL_BIN_UPDATE_SAME:
opt_sql_bin_update = 1; opt_sql_bin_update = 1;
break; break;
...@@ -2878,7 +2878,7 @@ static void get_options(int argc,char **argv) ...@@ -2878,7 +2878,7 @@ static void get_options(int argc,char **argv)
if (test_if_int(optarg,(uint) strlen(optarg))) if (test_if_int(optarg,(uint) strlen(optarg)))
berkeley_lock_scan_time=atoi(optarg); berkeley_lock_scan_time=atoi(optarg);
else else
{ {
fprintf(stderr,"Unknown lock type: %s\n",optarg); fprintf(stderr,"Unknown lock type: %s\n",optarg);
exit(1); exit(1);
} }
...@@ -3314,7 +3314,7 @@ static int get_service_parameters() ...@@ -3314,7 +3314,7 @@ static int get_service_parameters()
0 ) 0 )
{ {
SET_CHANGEABLE_VARVAL( "thread_concurrency" ); SET_CHANGEABLE_VARVAL( "thread_concurrency" );
} }
else else
{ {
TCHAR szErrorMsg [ 512 ]; TCHAR szErrorMsg [ 512 ];
...@@ -3341,7 +3341,7 @@ static int get_service_parameters() ...@@ -3341,7 +3341,7 @@ static int get_service_parameters()
static char *get_relative_path(const char *path) static char *get_relative_path(const char *path)
{ {
if (test_if_hard_path(path) && if (test_if_hard_path(path) &&
is_prefix(path,DEFAULT_MYSQL_HOME) && is_prefix(path,DEFAULT_MYSQL_HOME) &&
strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR)) strcmp(DEFAULT_MYSQL_HOME,FN_ROOTDIR))
{ {
path+=(uint) strlen(DEFAULT_MYSQL_HOME); path+=(uint) strlen(DEFAULT_MYSQL_HOME);
......
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