summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <gluh@eagle.(none)>2007-10-23 18:51:43 +0500
committerunknown <gluh@eagle.(none)>2007-10-23 18:51:43 +0500
commit8479eb1db7d1c8ccfbaa62077c54b7f5af714324 (patch)
treed36465f86e78c442a44942849b7280eab8d10bf8 /myisam
parentfb9a562b1cc2b9048eff094bb7004fb3db0e7fd0 (diff)
parentc448d2ed5d2a7efd1f77b956f46d8f1e48b17350 (diff)
downloadmariadb-git-8479eb1db7d1c8ccfbaa62077c54b7f5af714324.tar.gz
Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into mysql.com:/home/gluh/MySQL/Merge/5.0-opt client/mysqldump.c: Auto merged include/config-win.h: Auto merged libmysql/libmysql.c: Auto merged myisam/sort.c: Auto merged mysql-test/r/func_sapdb.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/variables.test: Auto merged sql/field.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/item_func.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_timefunc.h: Auto merged sql/mysql_priv.h: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_yacc.yy: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/r/type_datetime.result: manual merge mysql-test/r/type_decimal.result: manual merge mysql-test/t/type_datetime.test: manual merge mysql-test/t/type_decimal.test: manual merge sql/item.cc: manual merge
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;