List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:July 5 2007 8:45am
Subject:bk commit into 4.1 tree (svoj:1.2670) BUG#27564
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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, 2007-07-05 11:45:14+05:00, svoj@stripped +1 -0
  BUG#27564 - Valgrind: UDF does not cleanup correctly
  
  Dropping an user defined function may cause server crash in
  case this function is still in use by another thread.
  
  The problem was that our hash implementation didn't update
  hash link list properly when hash_update() was called.

  mysys/hash.c@stripped, 2007-07-05 11:45:13+05:00, svoj@stripped +19 -0
    The following requirement wasn't met by hash_update() function
    causing corruption of hash links list:
    
    After a record was unlinked from the old chain during update, it
    holds random position. By the chance this position is equal to
    position for the first element in the new chain. That means
    updated record is the only record in the new chain.

diff -Nrup a/mysys/hash.c b/mysys/hash.c
--- a/mysys/hash.c	2006-01-04 18:35:16 +04:00
+++ b/mysys/hash.c	2007-07-05 11:45:13 +05:00
@@ -572,6 +572,25 @@ my_bool hash_update(HASH *hash,byte *rec
     previous->next=pos->next;		/* unlink pos */
 
   /* Move data to correct position */
+  if (new_index == empty)
+  {
+    /*
+      At this point record is unlinked from the old chain, thus it holds
+      random position. By the chance this position is equal to position
+      for the first element in the new chain. That means updated record
+      is the only record in the new chain.
+    */
+    if (empty != idx)
+    {
+      /*
+        Record was moved while unlinking it from the old chain.
+        Copy data to a new position.
+      */
+      data[empty]= org_link;
+    }
+    data[empty].next= NO_RECORD;
+    DBUG_RETURN(0);
+  }
   pos=data+new_index;
   new_pos_index=hash_rec_mask(hash,pos,blength,records);
   if (new_index != new_pos_index)
Thread
bk commit into 4.1 tree (svoj:1.2670) BUG#27564Sergey Vojtovich5 Jul