Below is the list of changes that have just been committed into a local
4.1 repository of mydev. When mydev 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.2495 06/06/14 14:01:28 ingo@stripped +4 -0
Bug#17877 - Corrupted spatial index
CHECK TABLE could complain about a fully intact spatial index.
A wrong comparison operator was used for table checking.
The result was that it checked for non-matching spatial keys.
This succeeded if at least two different keys were present,
but failed if only the matching key was present.
Also it was not checked if the index entry points to the record
from which the key was generated.
I fixed the comparison operator and added the additional check.
mysql-test/t/gis-rtree.test
1.13 06/06/14 14:01:24 ingo@stripped +37 -0
Bug#17877 - Corrupted spatial index
The test case.
mysql-test/r/gis-rtree.result
1.13 06/06/14 14:01:24 ingo@stripped +34 -0
Bug#17877 - Corrupted spatial index
The test result.
myisam/mi_key.c
1.38 06/06/14 14:01:24 ingo@stripped +1 -1
Bug#17877 - Corrupted spatial index
Added a missing DBUG_RETURN.
myisam/mi_check.c
1.158 06/06/14 14:01:24 ingo@stripped +17 -2
Bug#17877 - Corrupted spatial index
Fixed the comparison operator for checking a spatial index.
Added a check if the index entry points at the record from
which the key was generated.
# 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: ingo
# Host: chilla.local
# Root: /home/mydev/mysql-4.1-aid
--- 1.157/myisam/mi_check.c 2006-04-29 19:38:37 +02:00
+++ 1.158/myisam/mi_check.c 2006-06-14 14:01:24 +02:00
@@ -1146,6 +1146,7 @@ int chk_data_link(MI_CHECK *param, MI_IN
{
if(!(keyinfo->flag & HA_FULLTEXT))
{
+ my_off_t key_rec_pos;
uint key_length=_mi_make_key(info,key,info->lastkey,record,
start_recpos);
if (extend)
@@ -1155,13 +1156,27 @@ int chk_data_link(MI_CHECK *param, MI_IN
*/
int search_result= (keyinfo->flag & HA_SPATIAL) ?
rtree_find_first(info, key, info->lastkey, key_length,
- SEARCH_SAME) :
+ MBR_EQUAL) :
_mi_search(info,keyinfo,info->lastkey,key_length,
SEARCH_SAME, info->s->state.key_root[key]);
if (search_result)
{
- mi_check_print_error(param,"Record at: %10s Can't find key for index: %2d",
+ mi_check_print_error(param,"Record at: %10s "
+ "Can't find key for index: %2d",
llstr(start_recpos,llbuff),key+1);
+ if (error++ > MAXERR || !(param->testflag & T_VERBOSE))
+ goto err2;
+ }
+ else if ((key_rec_pos=
+ _mi_dpos(info, 0, info->lastkey +
+ key_length + info->s->rec_reflength)) !=
+ start_recpos)
+ {
+ mi_check_print_error(param, "Record at: %10s "
+ "Key for index: %2d "
+ "points at wrong position: %s",
+ llstr(start_recpos, llbuff), key + 1,
+ llstr(key_rec_pos, llbuff2));
if (error++ > MAXERR || !(param->testflag & T_VERBOSE))
goto err2;
}
--- 1.37/myisam/mi_key.c 2006-03-10 15:03:00 +01:00
+++ 1.38/myisam/mi_key.c 2006-06-14 14:01:24 +02:00
@@ -54,7 +54,7 @@ uint _mi_make_key(register MI_INFO *info
TODO: nulls processing
*/
#ifdef HAVE_SPATIAL
- return sp_make_key(info,keynr,key,record,filepos);
+ DBUG_RETURN(sp_make_key(info,keynr,key,record,filepos));
#else
DBUG_ASSERT(0); /* mi_open should check that this never happens*/
#endif
--- 1.12/mysql-test/r/gis-rtree.result 2006-05-04 03:12:47 +02:00
+++ 1.13/mysql-test/r/gis-rtree.result 2006-06-14 14:01:24 +02:00
@@ -817,3 +817,37 @@ check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
+CREATE TABLE t1 (
+c1 geometry NOT NULL default '',
+SPATIAL KEY i1 (c1(32))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 (c1) VALUES (
+PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
+ -18.6055555000 -66.8158332999,
+ -18.7186111000 -66.8102777000,
+ -18.7211111000 -66.9269443999,
+ -18.6086111000 -66.9327777000))'));
+CHECK TABLE t1 EXTENDED;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+CREATE TABLE t1 (
+c1 geometry NOT NULL default '',
+SPATIAL KEY i1 (c1(32))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 (c1) 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 (c1) 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.12/mysql-test/t/gis-rtree.test 2006-05-12 18:26:46 +02:00
+++ 1.13/mysql-test/t/gis-rtree.test 2006-06-14 14:01:24 +02:00
@@ -188,4 +188,41 @@ check table t1 extended;
drop table t1;
+#
+# Bug#17877 - Corrupted spatial index
+#
+CREATE TABLE t1 (
+ c1 geometry NOT NULL default '',
+ SPATIAL KEY i1 (c1(32))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 (c1) VALUES (
+ PolygonFromText('POLYGON((-18.6086111000 -66.9327777000,
+ -18.6055555000 -66.8158332999,
+ -18.7186111000 -66.8102777000,
+ -18.7211111000 -66.9269443999,
+ -18.6086111000 -66.9327777000))'));
+# This showed a missing key.
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+#
+CREATE TABLE t1 (
+ c1 geometry NOT NULL default '',
+ SPATIAL KEY i1 (c1(32))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 (c1) 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 (c1) VALUES (
+ PolygonFromText('POLYGON((-65.7402776999 -96.6686111000,
+ -65.7372222000 -96.5516666000,
+ -65.8502777000 -96.5461111000,
+ -65.8527777000 -96.6627777000,
+ -65.7402776999 -96.6686111000))'));
+# This showed (and still shows) OK.
+CHECK TABLE t1 EXTENDED;
+DROP TABLE t1;
+
# End of 4.1 tests
| Thread |
|---|
| • bk commit into 4.1 tree (ingo:1.2495) BUG#17877 | ingo | 14 Jun |