List:Commits« Previous MessageNext Message »
From:ingo Date:September 22 2006 3:03pm
Subject:bk commit into 4.0 tree (istruewing:1.2193)
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of istruewing. When istruewing 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-09-22 15:03:50+02:00, istruewing@stripped +1 -0
  Merge chilla.local:/home/mydev/mysql-4.0--team
  into  chilla.local:/home/mydev/mysql-4.0-bug14400
  MERGE: 1.2182.1.2

  myisam/mi_rkey.c@stripped, 2006-09-22 15:03:50+02:00, istruewing@stripped +0 -13
    Bug#14400 - Query joins wrong rows from table which is subject of
                "concurrent insert"
    Manual merge
    MERGE: 1.14.1.2

# 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:	istruewing
# Host:	chilla.local
# Root:	/home/mydev/mysql-4.0-bug14400/RESYNC

--- 1.15/myisam/mi_rkey.c	2006-09-22 15:03:52 +02:00
+++ 1.16/myisam/mi_rkey.c	2006-09-22 15:03:52 +02:00
@@ -79,28 +79,42 @@ int mi_rkey(MI_INFO *info, byte *buf, in
 		  myisam_read_vec[search_flag], info->s->state.key_root[inx]))
   {
     /*
-      If we are searching for an exact key (including the data pointer)
-      and this was added by an concurrent insert,
-      then the result is "key not found".
+      If we searching for a partial key (or using >, >=, < or <=) and
+      the data is outside of the data file, we need to continue searching
+      for the first key inside the data file
     */
-    if ((search_flag == HA_READ_KEY_EXACT) &&
-        (info->lastpos >= info->state->data_file_length))
+    if (info->lastpos >= info->state->data_file_length &&
+        (search_flag != HA_READ_KEY_EXACT ||
+         last_used_keyseg != keyinfo->seg + keyinfo->keysegs))
     {
-      my_errno= HA_ERR_KEY_NOT_FOUND;
-      info->lastpos= HA_OFFSET_ERROR;
-    }
-    else while (info->lastpos >= info->state->data_file_length)
-    {
-      /*
-	Skip rows that are inserted by other threads since we got a lock
-	Note that this can only happen if we are not searching after an
-	exact key, because the keys are sorted according to position
-      */
-      if  (_mi_search_next(info, keyinfo, info->lastkey,
-			   info->lastkey_length,
-			   myisam_readnext_vec[search_flag],
-			   info->s->state.key_root[inx]))
-	break;
+      do
+      {
+        uint not_used;
+        /*
+          Skip rows that are inserted by other threads since we got a lock
+          Note that this can only happen if we are not searching after an
+          full length exact key, because the keys are sorted
+          according to position
+        */
+        if  (_mi_search_next(info, keyinfo, info->lastkey,
+                             info->lastkey_length,
+                             myisam_readnext_vec[search_flag],
+                             info->s->state.key_root[inx]))
+          break;
+        /*
+          Check that the found key does still match the search.
+          _mi_search_next() delivers the next key regardless of its
+          value.
+        */
+        if (search_flag == HA_READ_KEY_EXACT &&
+            _mi_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length,
+                        SEARCH_FIND, &not_used))
+        {
+          my_errno= HA_ERR_KEY_NOT_FOUND;
+          info->lastpos= HA_OFFSET_ERROR;
+          break;
+        }
+      } while (info->lastpos >= info->state->data_file_length);
     }
   }
 
Thread
bk commit into 4.0 tree (istruewing:1.2193)ingo22 Sep