diff options
Diffstat (limited to 'storage/myisam')
-rw-r--r-- | storage/myisam/NEWS | 2 | ||||
-rw-r--r-- | storage/myisam/ft_boolean_search.c | 8 | ||||
-rw-r--r-- | storage/myisam/ft_nlq_search.c | 2 | ||||
-rw-r--r-- | storage/myisam/ft_parser.c | 2 | ||||
-rw-r--r-- | storage/myisam/ft_stopwords.c | 2 | ||||
-rw-r--r-- | storage/myisam/ft_update.c | 6 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.cc | 9 | ||||
-rw-r--r-- | storage/myisam/mi_check.c | 2 | ||||
-rw-r--r-- | storage/myisam/mi_unique.c | 8 | ||||
-rw-r--r-- | storage/myisam/mi_write.c | 2 | ||||
-rw-r--r-- | storage/myisam/sort.c | 31 |
11 files changed, 39 insertions, 35 deletions
diff --git a/storage/myisam/NEWS b/storage/myisam/NEWS index bb1f141610b..a564110bffb 100644 --- a/storage/myisam/NEWS +++ b/storage/myisam/NEWS @@ -62,5 +62,5 @@ New features compared to NISAM: Interface changes compared to NISAM: - mi_create() - - keyinfo->seg must be allocated explicitely. + - keyinfo->seg must be allocated explicitly. - One must put number of key segments in keyinfo diff --git a/storage/myisam/ft_boolean_search.c b/storage/myisam/ft_boolean_search.c index 766f8411ca1..4480a67ebd7 100644 --- a/storage/myisam/ft_boolean_search.c +++ b/storage/myisam/ft_boolean_search.c @@ -163,7 +163,7 @@ static int FTB_WORD_cmp_list(CHARSET_INFO *cs, FTB_WORD **a, FTB_WORD **b) { /* ORDER BY word, ndepth */ int i= ha_compare_text(cs, (uchar*) (*a)->word + 1, (*a)->len - 1, - (uchar*) (*b)->word + 1, (*b)->len - 1, 0, 0); + (uchar*) (*b)->word + 1, (*b)->len - 1, 0); if (!i) i= CMP_NUM((*a)->ndepth, (*b)->ndepth); return i; @@ -417,7 +417,7 @@ static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) info->lastkey_length-extra-1, (uchar*) ftbw->word+1, ftbw->len-1, - (my_bool) (ftbw->flags & FTB_FLAG_TRUNC),0); + (my_bool) (ftbw->flags & FTB_FLAG_TRUNC)); } if (r) /* not found */ @@ -914,7 +914,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param, ftbw= ftb->list[c]; if (ha_compare_text(ftb->charset, (uchar*)word, len, (uchar*)ftbw->word+1, ftbw->len-1, - (my_bool) (ftbw->flags & FTB_FLAG_TRUNC), 0) < 0) + (my_bool) (ftbw->flags & FTB_FLAG_TRUNC)) < 0) b= c; else a= c; @@ -941,7 +941,7 @@ static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param, ftbw= ftb->list[c]; if (ha_compare_text(ftb->charset, (uchar*)word, len, (uchar*)ftbw->word + 1,ftbw->len - 1, - (my_bool)(ftbw->flags & FTB_FLAG_TRUNC), 0)) + (my_bool)(ftbw->flags & FTB_FLAG_TRUNC))) { if (ftb->with_scan & FTB_FLAG_TRUNC) continue; diff --git a/storage/myisam/ft_nlq_search.c b/storage/myisam/ft_nlq_search.c index 9524b6f1833..d9a9a03919e 100644 --- a/storage/myisam/ft_nlq_search.c +++ b/storage/myisam/ft_nlq_search.c @@ -114,7 +114,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio) if (keylen && ha_compare_text(aio->charset,info->lastkey+1, - info->lastkey_length-extra-1, keybuff+1,keylen-1,0,0)) + info->lastkey_length-extra-1, keybuff+1,keylen-1,0)) break; if (subkeys.i < 0) diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c index 5612b4bec14..c8d99b68e8a 100644 --- a/storage/myisam/ft_parser.c +++ b/storage/myisam/ft_parser.c @@ -32,7 +32,7 @@ typedef struct st_my_ft_parser_param static int FT_WORD_cmp(CHARSET_INFO* cs, FT_WORD *w1, FT_WORD *w2) { return ha_compare_text(cs, (uchar*) w1->pos, w1->len, - (uchar*) w2->pos, w2->len, 0, 0); + (uchar*) w2->pos, w2->len, 0); } static int walk_and_copy(FT_WORD *word,uint32 count,FT_DOCSTAT *docstat) diff --git a/storage/myisam/ft_stopwords.c b/storage/myisam/ft_stopwords.c index 7b2d520a65a..3bf31bf3d66 100644 --- a/storage/myisam/ft_stopwords.c +++ b/storage/myisam/ft_stopwords.c @@ -35,7 +35,7 @@ static int FT_STOPWORD_cmp(void* cmp_arg __attribute__((unused)), { return ha_compare_text(ft_stopword_cs, (uchar *)w1->pos,w1->len, - (uchar *)w2->pos,w2->len,0,0); + (uchar *)w2->pos,w2->len,0); } static void FT_STOPWORD_free(FT_STOPWORD *w, TREE_FREE action, diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c index 19144ff01fb..8f437476121 100644 --- a/storage/myisam/ft_update.c +++ b/storage/myisam/ft_update.c @@ -83,7 +83,7 @@ uint _mi_ft_segiterator(register FT_SEG_ITERATOR *ftsi) if (ftsi->seg->flag & HA_BLOB_PART) { ftsi->len=_mi_calc_blob_length(ftsi->seg->bit_start,ftsi->pos); - memcpy(&ftsi->pos, ftsi->pos+ftsi->seg->bit_start, sizeof(char*)); + memcpy((char**) &ftsi->pos, ftsi->pos+ftsi->seg->bit_start, sizeof(char*)); DBUG_RETURN(1); } ftsi->len=ftsi->seg->length; @@ -180,7 +180,7 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const uchar *rec1, const uchar *rec2) if ((ftsi1.pos != ftsi2.pos) && (!ftsi1.pos || !ftsi2.pos || ha_compare_text(cs, (uchar*) ftsi1.pos,ftsi1.len, - (uchar*) ftsi2.pos,ftsi2.len,0,0))) + (uchar*) ftsi2.pos,ftsi2.len,0))) DBUG_RETURN(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT); } DBUG_RETURN(GEE_THEY_ARE_ABSOLUTELY_IDENTICAL); @@ -209,7 +209,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, uchar *keybuf, while(old_word->pos && new_word->pos) { cmp= ha_compare_text(cs, (uchar*) old_word->pos,old_word->len, - (uchar*) new_word->pos,new_word->len,0,0); + (uchar*) new_word->pos,new_word->len,0); cmp2= cmp ? 0 : (fabs(old_word->weight - new_word->weight) > 1.e-5); if (cmp < 0 || cmp2) diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 72bc4c0c7fe..9df1ec832a8 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -166,8 +166,8 @@ static void mi_check_print_msg(HA_CHECK *param, const char* msg_type, name); /* TODO: switch from protocol to push_warning here. The main reason we didn't - it yet is parallel repair. Due to following trace: - mi_check_print_msg/push_warning/sql_alloc/my_pthread_getspecific_ptr. + it yet is parallel repair, which threads have no THD object accessible via + current_thd. Also we likely need to lock mutex here (in both cases with protocol and push_warning). @@ -637,7 +637,7 @@ void _mi_report_crashed(MI_INFO *file, const char *message, char buf[1024]; mysql_mutex_lock(&file->s->intern_lock); if ((cur_thd= (THD*) file->in_use.data)) - sql_print_error("Got an error from thread_id=%lu, %s:%d", cur_thd->thread_id, + sql_print_error("Got an error from thread_id=%lld, %s:%d", cur_thd->thread_id, sfile, sline); else sql_print_error("Got an error from unknown thread, %s:%d", sfile, sline); @@ -758,7 +758,8 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked) /* Set external_ref, mainly for temporary tables */ file->external_ref= (void*) table; // For mi_killed() - if (!table->s->tmp_table) /* No need to perform a check for tmp table */ + /* No need to perform a check for tmp table or if it's already checked */ + if (!table->s->tmp_table && file->s->reopen == 1) { if ((my_errno= table2myisam(table, &keyinfo, &recinfo, &recs))) { diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index bab0ad2b6a4..57ac5bdca97 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -3939,7 +3939,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a) if (ha_compare_text(sort_param->seg->charset, ((uchar *)a)+1,a_len-1, - (uchar*) ft_buf->lastkey+1,val_off-1, 0, 0)==0) + (uchar*) ft_buf->lastkey+1,val_off-1, 0)==0) { if (!ft_buf->buf) /* store in second-level tree */ { diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index cdf3e618275..dae453beaec 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -112,7 +112,7 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record) else if (keyseg->flag & HA_BLOB_PART) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); - memcpy(&pos, pos+keyseg->bit_start, sizeof(char*)); + memcpy((char**) &pos, pos+keyseg->bit_start, sizeof(char*)); if (!length || length > tmp_length) length=tmp_length; /* The whole blob */ } @@ -207,14 +207,14 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, set_if_smaller(a_length, keyseg->length); set_if_smaller(b_length, keyseg->length); } - memcpy(&pos_a, pos_a+keyseg->bit_start, sizeof(char*)); - memcpy(&pos_b, pos_b+keyseg->bit_start, sizeof(char*)); + memcpy((char**) &pos_a, pos_a+keyseg->bit_start, sizeof(char*)); + memcpy((char**) &pos_b, pos_b+keyseg->bit_start, sizeof(char*)); } if (type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_VARTEXT1 || type == HA_KEYTYPE_VARTEXT2) { if (ha_compare_text(keyseg->charset, (uchar *) pos_a, a_length, - (uchar *) pos_b, b_length, 0, 1)) + (uchar *) pos_b, b_length, 0)) return 1; } else diff --git a/storage/myisam/mi_write.c b/storage/myisam/mi_write.c index ff96ee8751b..ff12f335af1 100644 --- a/storage/myisam/mi_write.c +++ b/storage/myisam/mi_write.c @@ -543,7 +543,7 @@ int _mi_insert(register MI_INFO *info, register MI_KEYDEF *keyinfo, get_key_length(alen,a); DBUG_ASSERT(info->ft1_to_ft2==0); if (alen == blen && - ha_compare_text(keyinfo->seg->charset, a, alen, b, blen, 0, 0)==0) + ha_compare_text(keyinfo->seg->charset, a, alen, b, blen, 0)==0) { /* yup. converting */ info->ft1_to_ft2=(DYNAMIC_ARRAY *) diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index f9838d4dcb5..d411272c273 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -191,8 +191,9 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, while ((maxbuffer= (uint) (records/(keys-1)+1)) != maxbuffer_org); } - if ((sort_keys=(uchar **)my_malloc(keys*(sort_length+sizeof(char*))+ - HA_FT_MAXBYTELEN, MYF(0)))) + if ((sort_keys= ((uchar **) + my_malloc((size_t) (keys*(sort_length+sizeof(char*))+ + HA_FT_MAXBYTELEN), MYF(0))))) { if (my_init_dynamic_array(&buffpek, sizeof(BUFFPEK), maxbuffer, MY_MIN(maxbuffer/2, 1000), MYF(0))) @@ -407,9 +408,9 @@ static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param) } while ((maxbuffer= (uint) (idx/(keys-1)+1)) != maxbuffer_org); } - if ((sort_keys= (uchar**) my_malloc(keys * (sort_length + sizeof(char*)) + + if ((sort_keys= (uchar**) my_malloc((size_t)(keys * (sort_length + sizeof(char*)) + ((sort_param->keyinfo->flag & HA_FULLTEXT) ? - HA_FT_MAXBYTELEN : 0), MYF(0)))) + HA_FT_MAXBYTELEN : 0)), MYF(0)))) { if (my_init_dynamic_array(&sort_param->buffpek, sizeof(BUFFPEK), maxbuffer, MY_MIN(maxbuffer / 2, 1000), MYF(0))) @@ -608,7 +609,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) length=param->sort_buffer_length; while (length >= MIN_SORT_BUFFER) { - if ((mergebuf= my_malloc(length, MYF(0)))) + if ((mergebuf= my_malloc((size_t) length, MYF(0)))) break; length=length*3/4; } @@ -700,8 +701,8 @@ static int write_keys(MI_SORT_PARAM *info, register uchar **sort_keys, if (!buffpek) DBUG_RETURN(1); /* Out of memory */ - my_qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp, - info); + my_qsort2((uchar*) sort_keys,(size_t) count, sizeof(uchar*), + (qsort2_cmp) info->key_cmp, info); if (!my_b_inited(tempfile) && open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", DISK_BUFFER_SIZE, info->sort_info->param->myf_rw)) @@ -746,8 +747,8 @@ static int write_keys_varlen(MI_SORT_PARAM *info, if (!buffpek) DBUG_RETURN(1); /* Out of memory */ - my_qsort2((uchar*) sort_keys,count,sizeof(uchar*),(qsort2_cmp) info->key_cmp, - info); + my_qsort2((uchar*) sort_keys, (size_t) count, sizeof(uchar*), + (qsort2_cmp) info->key_cmp, info); if (!my_b_inited(tempfile) && open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST", DISK_BUFFER_SIZE, info->sort_info->param->myf_rw)) @@ -870,10 +871,12 @@ static my_off_t read_to_buffer(IO_CACHE *fromfile, BUFFPEK *buffpek, register ha_keys count; my_off_t length; - if ((count= (ha_keys) MY_MIN((ha_rows) buffpek->max_keys,buffpek->count))) + if ((count= (ha_keys) MY_MIN((ha_rows) buffpek->max_keys, + (ha_rows) buffpek->count))) { if (my_b_pread(fromfile, (uchar*) buffpek->base, - (length= sort_length * count), buffpek->file_pos)) + (length= (my_off_t) (sort_length * count)), + buffpek->file_pos)) return(HA_OFFSET_ERROR); buffpek->key=buffpek->base; buffpek->file_pos+= length; /* New filepos */ @@ -938,7 +941,7 @@ static int write_merge_key(MI_SORT_PARAM *info __attribute__((unused)), IO_CACHE *to_file, uchar *key, uint sort_length, ha_keys count) { - return my_b_write(to_file, key, ((size_t) sort_length) * count); + return my_b_write(to_file, key, (size_t) (sort_length * count)); } /* @@ -998,7 +1001,7 @@ merge_buffers(MI_SORT_PARAM *info, ha_keys keys, IO_CACHE *from_file, if (to_file) { if (info->write_key(info,to_file,(uchar*) buffpek->key, - (uint) sort_length,1)) + sort_length, 1)) { error=1; goto err; /* purecov: inspected */ } @@ -1021,7 +1024,7 @@ merge_buffers(MI_SORT_PARAM *info, ha_keys keys, IO_CACHE *from_file, if (!(read_length= info->read_to_buffer(from_file,buffpek,sort_length))) { uchar *base= buffpek->base; - uint max_keys=buffpek->max_keys; + ha_keys max_keys=buffpek->max_keys; queue_remove_top(&queue); |