summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-10-25 02:27:40 +0300
committerunknown <monty@mysql.com>2005-10-25 02:27:40 +0300
commit8d6634c9e0c43b2d4ed2b0cc9f90b66c850855ab (patch)
tree56b86b67bce65a21ff4ffd27cd2dd139b110b622 /myisam
parent3c02a0534d4b5450b2a5126bbf84428595c4a803 (diff)
downloadmariadb-git-8d6634c9e0c43b2d4ed2b0cc9f90b66c850855ab.tar.gz
Added more tests for new UPDATE ... ORDER BY ... LIMIT optimization
heap/_check.c: Change arguments to ha_key_cmp heap/hp_create.c: Change arguments to ha_key_cmp include/my_base.h: Remove SEARCH_RETURN_B_POS and instead always send an array to ha_key_cmp() as last argument myisam/mi_check.c: Change arguments to ha_key_cmp myisam/mi_rnext_same.c: Change arguments to ha_key_cmp myisam/mi_search.c: Change arguments to ha_key_cmp myisam/mi_write.c: Change arguments to ha_key_cmp myisammrg/myrg_queue.c: Change arguments to ha_key_cmp mysys/my_handler.c: Remove SEARCH_RETURN_B_POS and instead always send an array to ha_key_cmp() as last argument (This removes an if in a loop at the expensive of an int on the stack) sql/records.cc: Simplify new rr_index() code Create common error handling function for rr_() functions. Remove loop from rr_index() as handler::index_next() can never return HA_ERR_RECORD_DELETED sql/sql_load.cc: Simplify sql/sql_update.cc: Simplify code Fixed bug when one is updating an index column that could be used with ORDER BY sql/structs.h: Removed not needed structure element
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_check.c36
-rw-r--r--myisam/mi_rnext_same.c4
-rw-r--r--myisam/mi_search.c18
-rw-r--r--myisam/mi_write.c6
4 files changed, 32 insertions, 32 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 75f25f1361a..ef384c4bcc6 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -619,6 +619,7 @@ int mi_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull,
{
uint diffs[2];
uint first_null_seg, kp;
+ HA_KEYSEG *seg;
/*
Find the first keypart where values are different or either of them is
@@ -629,9 +630,8 @@ int mi_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull,
value in prev_key.
*/
ha_key_cmp(keyseg, prev_key, last_key, USE_WHOLE_KEY,
- SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL | SEARCH_RETURN_B_POS,
- diffs);
- HA_KEYSEG *seg= keyseg + diffs[0] - 1;
+ SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL, diffs);
+ seg= keyseg + diffs[0] - 1;
/* Find first NULL in last_key */
first_null_seg= ha_find_null(seg, last_key + diffs[1]) - keyseg;
@@ -658,7 +658,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
uchar key[MI_MAX_POSSIBLE_KEY_BUFF],*temp_buff,*keypos,*old_keypos,*endpos;
my_off_t next_page,record;
char llbuff[22];
- uint diff_pos;
+ uint diff_pos[2];
DBUG_ENTER("chk_index");
DBUG_DUMP("buff",(byte*) buff,mi_getint(buff));
@@ -716,7 +716,7 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
}
if ((*keys)++ &&
(flag=ha_key_cmp(keyinfo->seg,info->lastkey,key,key_length,
- comp_flag, &diff_pos)) >=0)
+ comp_flag, diff_pos)) >=0)
{
DBUG_DUMP("old",(byte*) info->lastkey, info->lastkey_length);
DBUG_DUMP("new",(byte*) key, key_length);
@@ -735,14 +735,14 @@ static int chk_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
if (param->stats_method == MI_STATS_METHOD_NULLS_NOT_EQUAL)
ha_key_cmp(keyinfo->seg,info->lastkey,key,USE_WHOLE_KEY,
SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL,
- &diff_pos);
+ diff_pos);
else if (param->stats_method == MI_STATS_METHOD_IGNORE_NULLS)
{
- diff_pos= mi_collect_stats_nonulls_next(keyinfo->seg,
+ diff_pos[0]= mi_collect_stats_nonulls_next(keyinfo->seg,
param->notnull_count,
info->lastkey, key);
}
- param->unique_count[diff_pos-1]++;
+ param->unique_count[diff_pos[0]-1]++;
}
else
{
@@ -3340,15 +3340,15 @@ int sort_write_record(MI_SORT_PARAM *sort_param)
static int sort_key_cmp(MI_SORT_PARAM *sort_param, const void *a,
const void *b)
{
- uint not_used;
+ uint not_used[2];
return (ha_key_cmp(sort_param->seg, *((uchar**) a), *((uchar**) b),
- USE_WHOLE_KEY, SEARCH_SAME,&not_used));
+ USE_WHOLE_KEY, SEARCH_SAME, not_used));
} /* sort_key_cmp */
static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
{
- uint diff_pos;
+ uint diff_pos[2];
char llbuff[22],llbuff2[22];
SORT_INFO *sort_info=sort_param->sort_info;
MI_CHECK *param= sort_info->param;
@@ -3358,19 +3358,19 @@ static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
{
cmp=ha_key_cmp(sort_param->seg,sort_info->key_block->lastkey,
(uchar*) a, USE_WHOLE_KEY,SEARCH_FIND | SEARCH_UPDATE,
- &diff_pos);
+ diff_pos);
if (param->stats_method == MI_STATS_METHOD_NULLS_NOT_EQUAL)
ha_key_cmp(sort_param->seg,sort_info->key_block->lastkey,
(uchar*) a, USE_WHOLE_KEY,
- SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL, &diff_pos);
+ SEARCH_FIND | SEARCH_NULL_ARE_NOT_EQUAL, diff_pos);
else if (param->stats_method == MI_STATS_METHOD_IGNORE_NULLS)
{
- diff_pos= mi_collect_stats_nonulls_next(sort_param->seg,
- sort_param->notnull,
- sort_info->key_block->lastkey,
- (uchar*)a);
+ diff_pos[0]= mi_collect_stats_nonulls_next(sort_param->seg,
+ sort_param->notnull,
+ sort_info->key_block->lastkey,
+ (uchar*)a);
}
- sort_param->unique[diff_pos-1]++;
+ sort_param->unique[diff_pos[0]-1]++;
}
else
{
diff --git a/myisam/mi_rnext_same.c b/myisam/mi_rnext_same.c
index 4d770258a72..92692d0517f 100644
--- a/myisam/mi_rnext_same.c
+++ b/myisam/mi_rnext_same.c
@@ -28,7 +28,7 @@
int mi_rnext_same(MI_INFO *info, byte *buf)
{
int error;
- uint inx,not_used;
+ uint inx,not_used[2];
MI_KEYDEF *keyinfo;
DBUG_ENTER("mi_rnext_same");
@@ -69,7 +69,7 @@ int mi_rnext_same(MI_INFO *info, byte *buf)
info->s->state.key_root[inx])))
break;
if (ha_key_cmp(keyinfo->seg, info->lastkey, info->lastkey2,
- info->last_rkey_length, SEARCH_FIND, &not_used))
+ info->last_rkey_length, SEARCH_FIND, not_used))
{
error=1;
my_errno=HA_ERR_END_OF_FILE;
diff --git a/myisam/mi_search.c b/myisam/mi_search.c
index 4ea2480889e..9321f5b87d5 100644
--- a/myisam/mi_search.c
+++ b/myisam/mi_search.c
@@ -128,13 +128,13 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
if ((nextflag & (SEARCH_SMALLER | SEARCH_LAST)) && flag != 0)
{
- uint not_used;
+ uint not_used[2];
if (_mi_get_prev_key(info,keyinfo, buff, info->lastkey, keypos,
&info->lastkey_length))
goto err;
if (!(nextflag & SEARCH_SMALLER) &&
ha_key_cmp(keyinfo->seg, info->lastkey, key, key_len, SEARCH_FIND,
- &not_used))
+ not_used))
{
my_errno=HA_ERR_KEY_NOT_FOUND; /* Didn't find key */
goto err;
@@ -178,7 +178,7 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
{
reg4 int start,mid,end,save_end;
int flag;
- uint totlength,nod_flag,not_used;
+ uint totlength,nod_flag,not_used[2];
DBUG_ENTER("_mi_bin_search");
LINT_INIT(flag);
@@ -192,7 +192,7 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
{
mid= (start+end)/2;
if ((flag=ha_key_cmp(keyinfo->seg,page+(uint) mid*totlength,key,key_len,
- comp_flag,&not_used))
+ comp_flag, not_used))
>= 0)
end=mid;
else
@@ -200,7 +200,7 @@ int _mi_bin_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
}
if (mid != start)
flag=ha_key_cmp(keyinfo->seg,page+(uint) start*totlength,key,key_len,
- comp_flag,&not_used);
+ comp_flag, not_used);
if (flag < 0)
start++; /* point at next, bigger key */
*ret_pos=page+(uint) start*totlength;
@@ -241,7 +241,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
uchar *buff, my_bool *last_key)
{
int flag;
- uint nod_flag,length,not_used;
+ uint nod_flag,length,not_used[2];
uchar t_buff[MI_MAX_KEY_BUFF],*end;
DBUG_ENTER("_mi_seq_search");
@@ -262,7 +262,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
DBUG_RETURN(MI_FOUND_WRONG_KEY);
}
if ((flag=ha_key_cmp(keyinfo->seg,t_buff,key,key_len,comp_flag,
- &not_used)) >= 0)
+ not_used)) >= 0)
break;
#ifdef EXTRA_DEBUG
DBUG_PRINT("loop",("page: %lx key: '%s' flag: %d", (long) page, t_buff,
@@ -503,9 +503,9 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
cmp_rest:
if (key_len_left>0)
{
- uint not_used;
+ uint not_used[2];
if ((flag = ha_key_cmp(keyinfo->seg+1,vseg,
- k,key_len_left,nextflag,&not_used)) >= 0)
+ k, key_len_left, nextflag, not_used)) >= 0)
break;
}
else
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index cd9e73fba22..52455320515 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -885,10 +885,10 @@ int _mi_ck_write_tree(register MI_INFO *info, uint keynr, uchar *key,
static int keys_compare(bulk_insert_param *param, uchar *key1, uchar *key2)
{
- uint not_used;
+ uint not_used[2];
return ha_key_cmp(param->info->s->keyinfo[param->keynr].seg,
- key1, key2, USE_WHOLE_KEY, SEARCH_SAME,
- &not_used);
+ key1, key2, USE_WHOLE_KEY, SEARCH_SAME,
+ not_used);
}