Below is the list of changes that have just been committed into a local
4.1 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2357 05/08/04 21:47:21 hf@deer.(none) +5 -0
Fix for bug #9645 (Corrupted spatial key)
mysql-test/t/gis-rtree.test
1.11 05/08/04 21:46:43 hf@deer.(none) +16 -0
testcase added
mysql-test/r/gis-rtree.result
1.11 05/08/04 21:46:43 hf@deer.(none) +14 -0
result fixed
myisam/rt_key.c
1.9 05/08/04 21:46:43 hf@deer.(none) +67 -0
_mi_rt_search implementation
myisam/rt_index.h
1.4 05/08/04 21:46:43 hf@deer.(none) +3 -0
_mi_rt_search declared
myisam/mi_open.c
1.86 05/08/04 21:46:43 hf@deer.(none) +5 -0
here we specify fucntions to handle rtree-keys
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: hf
# Host: deer.(none)
# Root: /home/hf/work/mysql-4.1.9645
--- 1.85/myisam/mi_open.c Tue Jun 21 20:18:49 2005
+++ 1.86/myisam/mi_open.c Thu Aug 4 21:46:43 2005
@@ -733,6 +733,11 @@
#ifdef HAVE_RTREE_KEYS
keyinfo->ck_insert = rtree_insert;
keyinfo->ck_delete = rtree_delete;
+ keyinfo->bin_search= _mi_rt_search;
+ keyinfo->get_key=_mi_get_static_key;
+ keyinfo->pack_key=_mi_calc_static_key_length;
+ keyinfo->store_key=_mi_store_static_key;
+ return;
#else
DBUG_ASSERT(0); /* mi_open should check it never happens */
#endif
--- 1.3/myisam/rt_index.h Wed Jun 2 19:13:52 2004
+++ 1.4/myisam/rt_index.h Thu Aug 4 21:46:43 2005
@@ -43,5 +43,8 @@
int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
uint key_length, my_off_t *new_page_offs);
+extern int _mi_rt_search(MI_INFO *info,MI_KEYDEF *keyinfo,uchar *page,
+ uchar *key,uint key_len,uint comp_flag,
+ uchar **ret_pos,uchar *buff, my_bool *was_last_key);
#endif /*HAVE_RTREE_KEYS*/
#endif /* _rt_index_h */
--- 1.8/myisam/rt_key.c Wed Jun 2 19:17:33 2004
+++ 1.9/myisam/rt_key.c Thu Aug 4 21:46:43 2005
@@ -97,4 +97,71 @@
return rtree_page_mbr(info, keyinfo->seg, info->buff, key, key_length);
}
+/*
+ Locate a key in a rtree-key page.
+
+ SYNOPSIS
+ _mi_rt_search()
+ info Open table information.
+ keyinfo Key definition information.
+ page Key page (beginning).
+ key Search key.
+ key_len Length to use from search key or USE_WHOLE_KEY
+ comp_flag Search flags like SEARCH_SAME etc.
+ ret_pos RETURN Position in key page behind this key.
+ buff RETURN Copy of previous or identical unpacked key.
+ last_key RETURN If key is last in page.
+
+ DESCRIPTION
+ Used instead of _mi_bin_search() when key is RTree.
+ Puts smaller or identical key in buff.
+ Key is searched sequentially.
+
+ RETURN
+ > 0 Key in 'buff' is smaller than search key.
+ 0 Key in 'buff' is identical to search key.
+ < 0 Not found.
+*/
+
+int _mi_rt_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
+ uchar *key, uint key_len, uint comp_flag, uchar **ret_pos,
+ uchar *buff, my_bool *last_key)
+{
+ int flag;
+ uint nod_flag,length,not_used;
+ uchar t_buff[MI_MAX_KEY_BUFF],*end;
+ DBUG_ENTER("_mi_seq_search");
+
+ LINT_INIT(flag); LINT_INIT(length);
+ end= page+mi_getint(page);
+ nod_flag=mi_test_if_nod(page);
+ page+=2+nod_flag;
+ *ret_pos=page;
+ t_buff[0]=0; /* Avoid bugs */
+ while (page < end)
+ {
+ length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,t_buff);
+ if (length == 0 || page > end)
+ {
+ my_errno=HA_ERR_CRASHED;
+ DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p",
+ length, page, end));
+ DBUG_RETURN(MI_FOUND_WRONG_KEY);
+ }
+ if (!(flag=ha_key_cmp(keyinfo->seg,t_buff,key,key_len,comp_flag,
+ ¬_used)))
+ break;
+#ifdef EXTRA_DEBUG
+ DBUG_PRINT("loop",("page: %p key: '%s' flag: %d", page, t_buff, flag));
+#endif
+ memcpy(buff,t_buff,length);
+ *ret_pos=page;
+ }
+ if (flag == 0)
+ memcpy(buff,t_buff,length); /* Result is first key */
+ *last_key= page == end;
+ DBUG_PRINT("exit",("flag: %d ret_pos: %p", flag, *ret_pos));
+ DBUG_RETURN(flag);
+} /* _mi_seq_search */
+
#endif /*HAVE_RTREE_KEYS*/
--- 1.10/mysql-test/r/gis-rtree.result Fri Dec 10 16:05:59 2004
+++ 1.11/mysql-test/r/gis-rtree.result Thu Aug 4 21:46:43 2005
@@ -804,3 +804,17 @@
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
ERROR HY000: Unknown error
drop table t1, t2;
+CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY
+`gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 (geometry) VALUES
+(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
+-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
+-18.6086111000 -66.9327777000))'));
+INSERT INTO t1 (geometry) VALUES
+(PolygonFromText('POLYGON((-65.7402776999 -96.6686111000, -65.7372222000
+-96.5516666000, -65.8502777000 -96.5461111000, -65.8527777000 -96.6627777000,
+-65.7402776999 -96.6686111000))'));
+check table t1 extended;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+drop table t1;
--- 1.10/mysql-test/t/gis-rtree.test Thu Jul 28 05:21:42 2005
+++ 1.11/mysql-test/t/gis-rtree.test Thu Aug 4 21:46:43 2005
@@ -173,4 +173,20 @@
INSERT INTO t2 SELECT GeomFromText(st) FROM t1;
drop table t1, t2;
+CREATE TABLE t1 (`geometry` geometry NOT NULL default '',SPATIAL KEY
+`gndx` (`geometry`(32))) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+INSERT INTO t1 (geometry) VALUES
+(PolygonFromText('POLYGON((-18.6086111000 -66.9327777000, -18.6055555000
+-66.8158332999, -18.7186111000 -66.8102777000, -18.7211111000 -66.9269443999,
+-18.6086111000 -66.9327777000))'));
+
+INSERT INTO t1 (geometry) VALUES
+(PolygonFromText('POLYGON((-65.7402776999 -96.6686111000, -65.7372222000
+-96.5516666000, -65.8502777000 -96.5461111000, -65.8527777000 -96.6627777000,
+-65.7402776999 -96.6686111000))'));
+check table t1 extended;
+
+drop table t1;
+
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (hf:1.2357) BUG#9645 | holyfoot | 4 Aug |