List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:December 26 2006 12:54pm
Subject:bk commit into 5.0 tree (svoj:1.2352) BUG#25048
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of svoj. When svoj 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-26 15:54:50+04:00, svoj@stripped +3 -0
  BUG#25048 - ERROR 126 : Incorrect key file for table '.XXXX.MYI'; try to
              repair it
  
  Multi-table delete that is optimized with QUICK_RANGE reports table
  corruption.
  
  DELETE statement must not use KEYREAD optimization, and sets
  table->no_keyread to 1. This was ignored in QUICK_RANGE optimization.
  
  With this fix QUICK_RANGE optimization honors table->no_keyread
  value and does not enable KEYREAD when it is requested.

  mysql-test/r/index_merge_ror.result@stripped, 2006-12-26 15:53:43+04:00, svoj@stripped
+11 -0
    A test case for bug#25048.

  mysql-test/t/index_merge_ror.test@stripped, 2006-12-26 15:53:43+04:00, svoj@stripped
+15 -0
    A test case for bug#25048.

  sql/opt_range.cc@stripped, 2006-12-26 15:53:43+04:00, svoj@stripped +17 -6
    Do not use key read when head->no_keyread is set.

# 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:	svoj
# Host:	june.mysql.com
# Root:	/home/svoj/devel/mysql/BUG25048/mysql-5.0-engines

--- 1.234/sql/opt_range.cc	2006-12-01 16:02:50 +04:00
+++ 1.235/sql/opt_range.cc	2006-12-26 15:53:43 +04:00
@@ -875,7 +875,11 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT(
     if (file) 
     {
       range_end();
-      file->extra(HA_EXTRA_NO_KEYREAD);
+      if (head->key_read)
+      {
+        head->key_read= 0;
+        file->extra(HA_EXTRA_NO_KEYREAD);
+      }
       if (free_file)
       {
         DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file,
@@ -1017,8 +1021,12 @@ int QUICK_RANGE_SELECT::init_ror_merged_
   if (reuse_handler)
   {
     DBUG_PRINT("info", ("Reusing handler %p", file));
-    if (file->extra(HA_EXTRA_KEYREAD) ||
-        file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) ||
+    if (!head->no_keyread)
+    {
+      head->key_read= 1;
+      file->extra(HA_EXTRA_KEYREAD);
+    }
+    if (file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) ||
         init() || reset())
     {
       DBUG_RETURN(1);
@@ -1041,9 +1049,12 @@ int QUICK_RANGE_SELECT::init_ror_merged_
   }
   if (file->external_lock(thd, F_RDLCK))
     goto failure;
-
-  if (file->extra(HA_EXTRA_KEYREAD) ||
-      file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) ||
+  if (!head->no_keyread)
+  {
+    head->key_read= 1;
+    file->extra(HA_EXTRA_KEYREAD);
+  }
+  if (file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) ||
       init() || reset())
   {
     file->external_lock(thd, F_UNLCK);

--- 1.8/mysql-test/r/index_merge_ror.result	2005-10-17 20:08:50 +05:00
+++ 1.9/mysql-test/r/index_merge_ror.result	2006-12-26 15:53:43 +04:00
@@ -194,3 +194,14 @@ explain select a from t2 where a='ab';
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	ref	a	a	6	const	1	Using where
 drop table t2;
+CREATE TABLE t1(c1 INT, c2 INT DEFAULT 0, c3 CHAR(255) DEFAULT '',
+KEY(c1), KEY(c2), KEY(c3));
+INSERT INTO t1(c1) VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0);
+INSERT INTO t1 VALUES(0,0,0);
+CREATE TABLE t2(c1 int);
+INSERT INTO t2 VALUES(1);
+DELETE t1 FROM t1,t2 WHERE t1.c1=0 AND t1.c2=0;
+SELECT * FROM t1;
+c1	c2	c3
+DROP TABLE t1,t2;

--- 1.8/mysql-test/t/index_merge_ror.test	2005-10-17 20:08:54 +05:00
+++ 1.9/mysql-test/t/index_merge_ror.test	2006-12-26 15:53:43 +04:00
@@ -250,3 +250,18 @@ select count(a) from t2 ignore index(a,b
 insert into t2 values ('ab', 'ab', 'uh', 'oh');
 explain select a from t2 where a='ab';
 drop table t2;
+
+#
+# BUG#25048 - ERROR 126 : Incorrect key file for table '.XXXX.MYI'; try to
+#             repair it
+#
+CREATE TABLE t1(c1 INT, c2 INT DEFAULT 0, c3 CHAR(255) DEFAULT '',
+KEY(c1), KEY(c2), KEY(c3));
+INSERT INTO t1(c1) VALUES(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),
+(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0),(0);
+INSERT INTO t1 VALUES(0,0,0);
+CREATE TABLE t2(c1 int);
+INSERT INTO t2 VALUES(1);
+DELETE t1 FROM t1,t2 WHERE t1.c1=0 AND t1.c2=0;
+SELECT * FROM t1;
+DROP TABLE t1,t2;
Thread
bk commit into 5.0 tree (svoj:1.2352) BUG#25048Sergey Vojtovich26 Dec