diff options
author | Georgi Kodinov <joro@sun.com> | 2010-03-08 12:39:57 +0200 |
---|---|---|
committer | Georgi Kodinov <joro@sun.com> | 2010-03-08 12:39:57 +0200 |
commit | 636058174a079bc8079eceaa7eaaf112bc0c6429 (patch) | |
tree | 66bd0abe89bd11ac0a0c60d757197d0d8d513605 /myisam | |
parent | 3bf394b41593cf4994be1f39b700696d2d4e8b4d (diff) | |
download | mariadb-git-636058174a079bc8079eceaa7eaaf112bc0c6429.tar.gz |
Backport of the fix for bug #51357 to 5.0-bugteam.:
Spatial indexes were not checking for out-of-record condition in
the handler next command when the previous command didn't found
rows.
Fixed by making the rtree index to check for end of rows condition
before re-using the key from the previous search.
Fixed another crash if the tree has changed since the last search.
Added a test case for the other error.
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/rt_index.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/myisam/rt_index.c b/myisam/rt_index.c index 494eccd38e4..7ac55bbb549 100644 --- a/myisam/rt_index.c +++ b/myisam/rt_index.c @@ -404,10 +404,16 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length) int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) { - my_off_t root; + my_off_t root= info->s->state.key_root[keynr]; MI_KEYDEF *keyinfo = info->s->keyinfo + keynr; - if (!info->buff_used) + if (root == HA_OFFSET_ERROR) + { + my_errno= HA_ERR_END_OF_FILE; + return -1; + } + + if (!info->buff_used && !info->page_changed) { uint k_len = keyinfo->keylength - info->s->base.rec_reflength; /* rt_PAGE_NEXT_KEY(info->int_keypos) */ @@ -428,16 +434,8 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) return 0; } - else - { - if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) - { - my_errno= HA_ERR_END_OF_FILE; - return -1; - } - - return rtree_get_req(info, keyinfo, key_length, root, 0); - } + + return rtree_get_req(info, keyinfo, key_length, root, 0); } |