MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:kgeorge Date:December 19 2006 1:04pm
Subject:bk commit into 5.0 tree (gkodinov:1.2349) BUG#23578
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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@stripped, 2006-12-19 15:04:26+02:00, gkodinov@stripped +3 -0
  Bug #23578: Corruption prevents Optimize table from working properly with a
  spatial index
   While executing OPTIMIZE TABLE on MyISAM tables the server re-creates the
   index file(s) in order to sort them physically by the key. This cannot be 
   done for R-tree indexes as it makes no sense.
   The server was not checking the type of the index and was accessing an 
   R-tree index as if it was a B-tree.
   Fixed by preventing sorting the index file if it contains an R-tree index.  
   

  myisam/mi_check.c@stripped, 2006-12-19 15:04:20+02:00, gkodinov@stripped +8 -0
    Bug #23578: Corruption prevents Optimize table from working properly with a
    spatial index
     - disable sorting the index file if it contains an R-tree index.

  mysql-test/r/gis-rtree.result@stripped, 2006-12-19 15:04:20+02:00, gkodinov@stripped +11 -0
    Bug #23578: Corruption prevents Optimize table from working properly with a
    spatial index
     - test case

  mysql-test/t/gis-rtree.test@stripped, 2006-12-19 15:04:21+02:00, gkodinov@stripped +17 -0
    Bug #23578: Corruption prevents Optimize table from working properly with a
    spatial index
     - test case

# 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:	gkodinov
# Host:	macbook.gmz
# Root:	/Users/kgeorge/mysql/work/B23578-5.0-opt

--- 1.147/myisam/mi_check.c	2006-10-09 20:50:59 +03:00
+++ 1.148/myisam/mi_check.c	2006-12-19 15:04:20 +02:00
@@ -1758,6 +1758,12 @@ int mi_sort_index(MI_CHECK *param, regis
   MI_STATE_INFO old_state;
   DBUG_ENTER("mi_sort_index");
 
+  /* cannot sort index files with R-tree indexes */
+  for (key= 0,keyinfo= &share->keyinfo[0]; key < share->base.keys ;
+       key++,keyinfo++)
+    if (keyinfo->key_alg == HA_KEY_ALG_RTREE)
+      return 0;
+
   if (!(param->testflag & T_SILENT))
     printf("- Sorting index for MyISAM-table '%s'\n",name);
 
@@ -1850,6 +1856,8 @@ static int sort_one_index(MI_CHECK *para
   char llbuff[22];
   DBUG_ENTER("sort_one_index");
 
+  /* cannot walk over R-tree indices */
+  DBUG_ASSERT(keyinfo->key_alg != HA_KEY_ALG_RTREE);
   new_page_pos=param->new_file_pos;
   param->new_file_pos+=keyinfo->block_length;
 

--- 1.22/mysql-test/r/gis-rtree.result	2006-11-07 07:41:04 +02:00
+++ 1.23/mysql-test/r/gis-rtree.result	2006-12-19 15:04:20 +02:00
@@ -881,3 +881,14 @@ ERROR 22003: Cannot get geometry object 
 INSERT INTO t1(foo) VALUES ('');
 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
 DROP TABLE t1;
+CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b));
+INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+OPTIMIZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	status	OK
+DROP TABLE t1;

--- 1.19/mysql-test/t/gis-rtree.test	2006-11-06 09:14:24 +02:00
+++ 1.20/mysql-test/t/gis-rtree.test	2006-12-19 15:04:21 +02:00
@@ -254,3 +254,20 @@ INSERT INTO t1() VALUES ();
 --error 1416
 INSERT INTO t1(foo) VALUES ('');
 DROP TABLE t1;
+
+#
+# Bug #23578: Corruption prevents Optimize table from working properly with a 
+#             spatial index
+#
+
+CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b));
+
+INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+
+OPTIMIZE TABLE t1;
+DROP TABLE t1;
Thread
bk commit into 5.0 tree (gkodinov:1.2349) BUG#23578kgeorge19 Dec