summaryrefslogtreecommitdiff
path: root/storage/maria/ma_rt_index.c
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/narttu.mysql.fi>2008-04-01 17:57:30 +0300
committerunknown <monty@mysql.com/narttu.mysql.fi>2008-04-01 17:57:30 +0300
commit3651e3285d11c42a77e332009155b96132e5ba6e (patch)
tree27698eaec5a94020dafa1c0870190cd4b1c5d7cf /storage/maria/ma_rt_index.c
parentc63e18f43c1054db92c798e54ba9520fc16ea607 (diff)
downloadmariadb-git-3651e3285d11c42a77e332009155b96132e5ba6e.tar.gz
Merge of changes in MyISAM since December 16 -> April 1
Fixes bugs: Bug#28837 MyISAM storage engine error (134) doing delete with self-join Bug#31277 myisamchk --unpack corrupts table Bug#4692 DISABLE/ENABLE KEYS waste a space Bug#31305 myisam tables crash when they are near capacity BitKeeper/etc/ignore: added unittest/tmp/* mysql-test/r/maria.result: Moved missing tests from myisam.test to maria.test mysql-test/t/maria.test: Moved missing tests from myisam.test to maria.test storage/maria/ha_maria.cc: Merge of changes in MyISAM since December 16 -> April 1 Fixes bug in self join (Bug#28837: MyISAM storage engine error (134) doing delete with self-join) storage/maria/ha_maria.h: Merge of changes in MyISAM since December 16 -> April 1 storage/maria/ma_blockrec.c: Merge of changes in MyISAM since December 16 -> April 1 Fixes bug in self join (Bug#28837: MyISAM storage engine error (134) doing delete with self-join) The problem is that we may be using a cached key page with old information. Versioning will fix this storage/maria/ma_check.c: Merge of changes in MyISAM since December 16 -> April 1 This fixes a problem with pack_reclength not beeing big enough (Bug #31277 myisamchk --unpack corrupts table) BUG#4692 - DISABLE/ENABLE KEYS waste a space storage/maria/ma_delete.c: Indentation fixes storage/maria/ma_dynrec.c: Merge of changes in MyISAM since December 16 -> April 1 Fixes Bug#31305 myisam tables crash when they are near capacity. (This uses a simpler fix than in MyISAM by remembering the length of the current row) storage/maria/ma_ft_boolean_search.c: Merge of all changes from myisam/ft_boolean_search.c (This file had not been kept up to date) storage/maria/ma_open.c: Merge of changes in MyISAM since December 16 -> April 1 Calculate default_rec_buff_size more exact to be sure it's always big enough storage/maria/ma_packrec.c: Merge of changes in MyISAM since December 16 -> April 1 Update default_rec_buff_size to be big enough to hold one packed row Related to Bug#31277 myisamchk --unpack corrupts table storage/maria/ma_rnext_same.c: Indentation fixes storage/maria/ma_rt_index.c: Merge of changes in MyISAM since December 16 -> April 1 storage/maria/ma_rt_mbr.c: Merge of changes in MyISAM since December 16 -> April 1 (Added comment) storage/maria/ma_search.c: Merge of changes in MyISAM since December 16 -> April 1 (Added comment) storage/maria/ma_sort.c: Merge of changes in MyISAM since December 16 -> April 1 storage/maria/ma_statrec.c: Indentation fixes storage/maria/ma_test2.c: Indentation fixes storage/maria/maria_chk.c: Indentation fixes storage/maria/maria_pack.c: Merge of changes in MyISAM since December 16 -> April 1
Diffstat (limited to 'storage/maria/ma_rt_index.c')
-rw-r--r--storage/maria/ma_rt_index.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/storage/maria/ma_rt_index.c b/storage/maria/ma_rt_index.c
index f9246eb1b55..fea8b7c2d29 100644
--- a/storage/maria/ma_rt_index.c
+++ b/storage/maria/ma_rt_index.c
@@ -461,15 +461,16 @@ static uchar *maria_rtree_pick_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
uint nod_flag)
{
double increase;
- double best_incr= DBL_MAX;
+ double best_incr;
double perimeter;
double best_perimeter;
- uchar *best_key;
+ uchar *best_key= NULL;
uchar *k= rt_PAGE_FIRST_KEY(page_buf, nod_flag);
uchar *last= rt_PAGE_END(info, page_buf);
LINT_INIT(best_perimeter);
LINT_INIT(best_key);
+ LINT_INIT(best_incr);
for (; k < last; k= rt_PAGE_NEXT_KEY(k, key_length, nod_flag))
{
@@ -514,22 +515,13 @@ static uchar *maria_rtree_pick_key(MARIA_HA *info, MARIA_KEYDEF *keyinfo,
&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;
}