List:Commits« Previous MessageNext Message »
From:pekka Date:May 25 2006 11:09am
Subject:bk commit into 5.0 tree (pekka:1.2146)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of pekka. When pekka 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
  1.2146 06/05/25 13:08:50 pekka@stripped +3 -0
  Merge mysql.com:/space/pekka/ndb/version/my50
  into  mysql.com:/space/pekka/ndb/version/my50-bug14509

  sql/ha_ndbcluster.cc
    1.248 06/05/25 13:08:31 pekka@stripped +0 -0
    Auto merged

  ndb/src/ndbapi/DictCache.hpp
    1.11 06/05/25 13:08:30 pekka@stripped +0 -0
    Auto merged

  ndb/src/ndbapi/DictCache.cpp
    1.17 06/05/25 13:08:30 pekka@stripped +0 -0
    Auto merged

# 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:	pekka
# Host:	orca.ndb.mysql.com
# Root:	/space/pekka/ndb/version/my50-bug14509/RESYNC

--- 1.16/ndb/src/ndbapi/DictCache.cpp	2006-05-08 15:16:52 +02:00
+++ 1.17/ndb/src/ndbapi/DictCache.cpp	2006-05-25 13:08:30 +02:00
@@ -302,6 +302,42 @@
   abort();
 }
 
+
+unsigned
+GlobalDictCache::get_size()
+{
+  NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
+  int sz = 0;
+  while(curr != 0){
+    sz += curr->theData->size();
+    curr = m_tableHash.getNext(curr);
+  }
+  return sz;
+}
+
+void
+GlobalDictCache::invalidate_all()
+{
+  DBUG_ENTER("GlobalDictCache::invalidate_all");
+  NdbElement_t<Vector<TableVersion> > * curr = m_tableHash.getNext(0);
+  while(curr != 0){
+    Vector<TableVersion> * vers = curr->theData;
+    if (vers->size())
+    {
+      TableVersion * ver = & vers->back();
+      ver->m_impl->m_status = NdbDictionary::Object::Invalid;
+      ver->m_status = DROPPED;
+      if (ver->m_refCount == 0)
+      {
+        delete ver->m_impl;
+        vers->erase(vers->size() - 1);
+      }
+    }
+    curr = m_tableHash.getNext(curr);
+  }
+  DBUG_VOID_RETURN;
+}
+
 void
 GlobalDictCache::release(NdbTableImpl * tab)
 {

--- 1.10/ndb/src/ndbapi/DictCache.hpp	2006-05-08 15:16:52 +02:00
+++ 1.11/ndb/src/ndbapi/DictCache.hpp	2006-05-25 13:08:30 +02:00
@@ -76,6 +76,9 @@
 
   void alter_table_rep(const char * name, 
 		       Uint32 tableId, Uint32 tableVersion, bool altered);
+
+  unsigned get_size();
+  void invalidate_all();
 public:
   enum Status {
     OK = 0,

--- 1.247/sql/ha_ndbcluster.cc	2006-05-15 20:29:44 +02:00
+++ 1.248/sql/ha_ndbcluster.cc	2006-05-25 13:08:31 +02:00
@@ -73,7 +73,6 @@
   HTON_NO_FLAGS
 };
 
-#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
 #define NDB_AUTO_INCREMENT_RETRIES 10
 
 #define NDB_INVALID_SCHEMA_OBJECT 241
@@ -2112,14 +2111,15 @@
   {
     // Table has hidden primary key
     Ndb *ndb= get_ndb();
-    Uint64 auto_value= NDB_FAILED_AUTO_INCREMENT;
+    int ret;
+    Uint64 auto_value;
     uint retries= NDB_AUTO_INCREMENT_RETRIES;
     do {
-      auto_value= ndb->getAutoIncrementValue((const NDBTAB *) m_table);
-    } while (auto_value == NDB_FAILED_AUTO_INCREMENT && 
+      ret= ndb->getAutoIncrementValue((const NDBTAB *) m_table, auto_value, 1);
+    } while (ret == -1 && 
              --retries &&
              ndb->getNdbError().status == NdbError::TemporaryError);
-    if (auto_value == NDB_FAILED_AUTO_INCREMENT)
+    if (ret == -1)
       ERR_RETURN(ndb->getNdbError());
     if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value))
       ERR_RETURN(op->getNdbError());
@@ -2197,11 +2197,11 @@
     Ndb *ndb= get_ndb();
     Uint64 next_val= (Uint64) table->next_number_field->val_int() + 1;
     DBUG_PRINT("info", 
-               ("Trying to set next auto increment value to %lu",
-                (ulong) next_val));
-    if (ndb->setAutoIncrementValue((const NDBTAB *) m_table, next_val, TRUE))
-      DBUG_PRINT("info", 
-                 ("Setting next auto increment value to %u", next_val));  
+               ("Trying to set next auto increment value to %llu",
+                (ulonglong) next_val));
+    if (ndb->setAutoIncrementValue((const NDBTAB *) m_table, next_val, TRUE)
+        == -1)
+      ERR_RETURN(ndb->getNdbError());
   }
   m_skip_auto_increment= TRUE;
 
@@ -3047,8 +3047,14 @@
     {
       Ndb *ndb= get_ndb();
       
-      auto_increment_value= 
-        ndb->readAutoIncrementValue((const NDBTAB *) m_table);
+      if (ndb->readAutoIncrementValue((const NDBTAB *) m_table,
+                                      auto_increment_value) == -1)
+      {
+        const NdbError err= ndb->getNdbError();
+        sql_print_error("Error %lu in readAutoIncrementValue(): %s",
+                        (ulong) err.code, err.message);
+        auto_increment_value= ~(Uint64)0;
+      }
     }
   }
   DBUG_VOID_RETURN;
@@ -4375,17 +4381,17 @@
            m_rows_to_insert - m_rows_inserted :
            ((m_rows_to_insert > m_autoincrement_prefetch) ?
             m_rows_to_insert : m_autoincrement_prefetch));
-  auto_value= NDB_FAILED_AUTO_INCREMENT;
+  int ret;
   uint retries= NDB_AUTO_INCREMENT_RETRIES;
   do {
-    auto_value=
-      (m_skip_auto_increment) ? 
-      ndb->readAutoIncrementValue((const NDBTAB *) m_table)
-      : ndb->getAutoIncrementValue((const NDBTAB *) m_table, cache_size);
-  } while (auto_value == NDB_FAILED_AUTO_INCREMENT && 
+    ret=
+      m_skip_auto_increment ? 
+      ndb->readAutoIncrementValue((const NDBTAB *) m_table, auto_value) :
+      ndb->getAutoIncrementValue((const NDBTAB *) m_table, auto_value, cache_size);
+  } while (ret == -1 && 
            --retries &&
            ndb->getNdbError().status == NdbError::TemporaryError);
-  if (auto_value == NDB_FAILED_AUTO_INCREMENT)
+  if (ret == -1)
   {
     const NdbError err= ndb->getNdbError();
     sql_print_error("Error %lu in ::get_auto_increment(): %s",
Thread
bk commit into 5.0 tree (pekka:1.2146)pekka25 May