List:Commits« Previous MessageNext Message »
From:jonas Date:January 30 2008 11:58am
Subject:bk commit into 5.0 tree (jonas:1.2591) BUG#34160
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jonas.  When jonas 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, 2008-01-30 11:58:10+01:00, jonas@stripped +2 -0
  ndb - bug#34160
    make sure release of not added ptr does not corrupt hashtable

  ndb/src/kernel/vm/DLHashTable.hpp@stripped, 2008-01-30 11:58:09+01:00,
jonas@stripped +18 -4
    ndb - bug#34160
      make sure release of not added ptr does not corrupt hashtable

  ndb/src/kernel/vm/DLHashTable2.hpp@stripped, 2008-01-30 11:58:09+01:00,
jonas@stripped +18 -4
    ndb - bug#34160
      make sure release of not added ptr does not corrupt hashtable

diff -Nrup a/ndb/src/kernel/vm/DLHashTable.hpp b/ndb/src/kernel/vm/DLHashTable.hpp
--- a/ndb/src/kernel/vm/DLHashTable.hpp	2006-12-23 20:04:16 +01:00
+++ b/ndb/src/kernel/vm/DLHashTable.hpp	2008-01-30 11:58:09 +01:00
@@ -45,8 +45,8 @@ public:
   /**
    * Seize element from pool - return i
    *
-   * Note must be either added using <b>add</b> or released 
-   * using <b>release</b>
+   * Note *must* be added using <b>add</b> (even before hash.release)
+   *             or be released using pool
    */
   bool seize(Ptr<T> &);
 
@@ -374,7 +374,14 @@ DLHashTable<T>::remove(Ptr<T> & ptr){
     prevP->nextHash = next;
   } else {
     const Uint32 hv = ptr.p->hashValue() & mask;  
-    hashValues[hv] = next;
+    if (hashValues[hv] == ptr.i)
+    {
+      hashValues[hv] = next;
+    }
+    else
+    {
+      // Will add assert in 5.1
+    }
   }
   
   if(next != RNIL){
@@ -395,7 +402,14 @@ DLHashTable<T>::release(Ptr<T> & ptr){
     prevP->nextHash = next;
   } else {
     const Uint32 hv = ptr.p->hashValue() & mask;  
-    hashValues[hv] = next;
+    if (hashValues[hv] == ptr.i)
+    {
+      hashValues[hv] = next;
+    }
+    else
+    {
+      // Will add assert in 5.1
+    }
   }
   
   if(next != RNIL){
diff -Nrup a/ndb/src/kernel/vm/DLHashTable2.hpp b/ndb/src/kernel/vm/DLHashTable2.hpp
--- a/ndb/src/kernel/vm/DLHashTable2.hpp	2006-12-23 20:04:16 +01:00
+++ b/ndb/src/kernel/vm/DLHashTable2.hpp	2008-01-30 11:58:09 +01:00
@@ -43,8 +43,8 @@ public:
   /**
    * Seize element from pool - return i
    *
-   * Note must be either added using <b>add</b> or released 
-   * using <b>release</b>
+   * Note *must* be added using <b>add</b> (even before hash.release)
+   *             or be released using pool
    */
   bool seize(Ptr<T> &);
 
@@ -375,7 +375,14 @@ DLHashTable2<T, U>::remove(Ptr<T> & ptr)
     prevP->nextHash = next;
   } else {
     const Uint32 hv = ptr.p->hashValue() & mask;  
-    hashValues[hv] = next;
+    if (hashValues[hv] == ptr.i)
+    {
+      hashValues[hv] = next;
+    }
+    else
+    {
+      // Will add assert in 5.1
+    }
   }
   
   if(next != RNIL){
@@ -396,7 +403,14 @@ DLHashTable2<T, U>::release(Ptr<T> & ptr
     prevP->nextHash = next;
   } else {
     const Uint32 hv = ptr.p->hashValue() & mask;  
-    hashValues[hv] = next;
+    if (hashValues[hv] == ptr.i)
+    {
+      hashValues[hv] = next;
+    }
+    else
+    {
+      // Will add assert in 5.1
+    }
   }
   
   if(next != RNIL){
Thread
bk commit into 5.0 tree (jonas:1.2591) BUG#34160jonas30 Jan 2008