summaryrefslogtreecommitdiff
path: root/myisam/mi_check.c
diff options
context:
space:
mode:
authorunknown <hf@deer.(none)>2004-12-06 11:42:41 +0400
committerunknown <hf@deer.(none)>2004-12-06 11:42:41 +0400
commit88f1b90a700fcae4d918676e6e2148520655fa7b (patch)
treef99c98d3ae77989e0bd0c65b0d4cc4744bd8704b /myisam/mi_check.c
parent5fc09be9a36cdd98691ff109788c2c5b0a9a2c69 (diff)
downloadmariadb-git-88f1b90a700fcae4d918676e6e2148520655fa7b.tar.gz
Fix for bug #6755 (ALTER TABLE ENABLE KEYS corrupts spatial index)
myisam/mi_check.c: Spatial keys should not be filesort-ed. Specific function neede to insert key into spatial index mysql-test/r/gis-rtree.result: Appropriate test result mysql-test/t/gis-rtree.test: Test case
Diffstat (limited to 'myisam/mi_check.c')
-rw-r--r--myisam/mi_check.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index 2999482549c..f7e7ffd42f6 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -26,6 +26,7 @@
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
+#include "rt_index.h"
#ifndef USE_RAID
#define my_raid_create(A,B,C,D,E,F,G) my_create(A,B,C,G)
@@ -1465,6 +1466,12 @@ static int writekeys(MI_CHECK *param, register MI_INFO *info, byte *buff,
if (_mi_ft_add(info,i,(char*) key,buff,filepos))
goto err;
}
+ else if (info->s->keyinfo[i].flag & HA_SPATIAL)
+ {
+ uint key_length=_mi_make_key(info,i,key,buff,filepos);
+ if (rtree_insert(info, i, key, key_length))
+ goto err;
+ }
else
{
uint key_length=_mi_make_key(info,i,key,buff,filepos);
@@ -3987,7 +3994,8 @@ static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows)
key->seg->charset->mbmaxlen;
key_maxlength+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
}
- return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
+ return (key->flag & HA_SPATIAL) ||
+ (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
((ulonglong) rows * key_maxlength >
(ulonglong) myisam_max_temp_length));
}