summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorgluh@eagle.(none) <>2007-10-23 18:51:43 +0500
committergluh@eagle.(none) <>2007-10-23 18:51:43 +0500
commit237383f0fecd267d702b92713d49b0f9b2c78746 (patch)
treed36465f86e78c442a44942849b7280eab8d10bf8 /myisam
parent9732efe7f8970626840cf64628ab75f83eee5523 (diff)
parentd0f53297f6acffecb75845fdc03df35c6956efbc (diff)
downloadmariadb-git-237383f0fecd267d702b92713d49b0f9b2c78746.tar.gz
Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into mysql.com:/home/gluh/MySQL/Merge/5.0-opt
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_write.c2
-rw-r--r--myisam/rt_index.c18
-rw-r--r--myisam/rt_mbr.c5
-rw-r--r--myisam/sort.c4
4 files changed, 12 insertions, 17 deletions
diff --git a/myisam/mi_write.c b/myisam/mi_write.c
index cc17d4c6165..967fbdc2330 100644
--- a/myisam/mi_write.c
+++ b/myisam/mi_write.c
@@ -975,7 +975,7 @@ int mi_init_bulk_insert(MI_INFO *info, ulong cache_size, ha_rows rows)
DBUG_RETURN(0);
if (rows && rows*total_keylength < cache_size)
- cache_size=rows;
+ cache_size= (ulong)rows;
else
cache_size/=total_keylength*16;
diff --git a/myisam/rt_index.c b/myisam/rt_index.c
index cf144839dd1..8ecb3688ad5 100644
--- a/myisam/rt_index.c
+++ b/myisam/rt_index.c
@@ -483,15 +483,16 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
uint key_length, uchar *page_buf, uint nod_flag)
{
double increase;
- double best_incr = DBL_MAX;
+ double best_incr;
double area;
double best_area;
- uchar *best_key;
+ uchar *best_key= NULL;
uchar *k = rt_PAGE_FIRST_KEY(page_buf, nod_flag);
uchar *last = rt_PAGE_END(page_buf);
LINT_INIT(best_area);
LINT_INIT(best_key);
+ LINT_INIT(best_incr);
for (; k < last; k = rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
{
@@ -500,22 +501,13 @@ static uchar *rtree_pick_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
&area)) == -1.0)
return NULL;
/* The following should be safe, even if we compare doubles */
- if (increase < best_incr)
+ if (!best_key || increase < best_incr ||
+ ((increase == best_incr) && (area < best_area)))
{
best_key = k;
best_area = area;
best_incr = increase;
}
- else
- {
- /* The following should be safe, even if we compare doubles */
- if ((increase == best_incr) && (area < best_area))
- {
- best_key = k;
- best_area = area;
- best_incr = increase;
- }
- }
}
return best_key;
}
diff --git a/myisam/rt_mbr.c b/myisam/rt_mbr.c
index 1855e24feb0..deca23bbec7 100644
--- a/myisam/rt_mbr.c
+++ b/myisam/rt_mbr.c
@@ -523,7 +523,10 @@ double rtree_overlapping_area(HA_KEYSEG *keyseg, uchar* a, uchar* b,
}
/*
-Calculates MBR_AREA(a+b) - MBR_AREA(a)
+ Calculates MBR_AREA(a+b) - MBR_AREA(a)
+ Note: when 'a' and 'b' objects are far from each other,
+ the area increase can be really big, so this function
+ can return 'inf' as a result.
*/
double rtree_area_increase(HA_KEYSEG *keyseg, uchar* a, uchar* b,
uint key_length, double *ab_area)
diff --git a/myisam/sort.c b/myisam/sort.c
index a3fab5025a8..839d46b4aee 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -141,7 +141,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
if ((records < UINT_MAX32) &&
((my_off_t) (records + 1) *
(sort_length + sizeof(char*)) <= (my_off_t) memavl))
- keys= records+1;
+ keys= (uint)records+1;
else
do
{
@@ -349,7 +349,7 @@ pthread_handler_t thr_find_all_keys(void *arg)
sort_keys= (uchar **) NULL;
memavl= max(sort_param->sortbuff_size, MIN_SORT_MEMORY);
- idx= sort_param->sort_info->max_records;
+ idx= (uint)sort_param->sort_info->max_records;
sort_length= sort_param->key_length;
maxbuffer= 1;