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

  storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
    1.60 06/05/25 13:48:53 pekka@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
    1.134 06/05/25 13:48:53 pekka@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/Ndb.cpp
    1.74 06/05/25 13:48:53 pekka@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/DictCache.hpp
    1.15 06/05/25 13:48:52 pekka@stripped +0 -0
    Auto merged

  storage/ndb/src/ndbapi/DictCache.cpp
    1.26 06/05/25 13:48:52 pekka@stripped +0 -0
    Auto merged

  storage/ndb/include/ndbapi/Ndb.hpp
    1.54 06/05/25 13:48:52 pekka@stripped +0 -0
    Auto merged

  sql/ha_ndbcluster.h
    1.135 06/05/25 13:48:52 pekka@stripped +0 -0
    Auto merged

  sql/ha_ndbcluster.cc
    1.308 06/05/25 13:48:52 pekka@stripped +0 -0
    Auto merged

  mysql-test/r/ndb_basic.result
    1.42 06/05/25 13:48:51 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/my51-bug14509/RESYNC

--- 1.41/mysql-test/r/ndb_basic.result	2006-05-15 10:50:25 +02:00
+++ 1.42/mysql-test/r/ndb_basic.result	2006-05-25 13:48:51 +02:00
@@ -642,30 +642,30 @@
 6	newval
 7	newval
 8	newval
-35	newval
-36	newval
-37	newval
-38	newval
-39	newval
-40	newval
-41	newval
-42	newval
-43	newval
-44	newval
-45	newval
-46	newval
-47	newval
-48	newval
-49	newval
-50	newval
-51	newval
-52	newval
-53	newval
-54	newval
-55	newval
-56	newval
-57	newval
-58	newval
+9	newval
+10	newval
+11	newval
+12	newval
+13	newval
+14	newval
+15	newval
+16	newval
+17	newval
+18	newval
+19	newval
+20	newval
+21	newval
+22	newval
+23	newval
+24	newval
+25	newval
+26	newval
+27	newval
+28	newval
+29	newval
+30	newval
+31	newval
+32	newval
 drop table t1;
 CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
 select * from t1;

--- 1.53/storage/ndb/include/ndbapi/Ndb.hpp	2006-05-25 12:00:34 +02:00
+++ 1.54/storage/ndb/include/ndbapi/Ndb.hpp	2006-05-25 13:48:52 +02:00
@@ -1263,6 +1263,7 @@
   
 
 #ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
+  int flushIncompleteEvents(Uint64 gci);
   NdbEventOperation *getEventOperation(NdbEventOperation* eventOp= 0);
   Uint64 getLatestGCI();
   void forceGCP();

--- 1.25/storage/ndb/src/ndbapi/DictCache.cpp	2006-05-17 08:34:41 +02:00
+++ 1.26/storage/ndb/src/ndbapi/DictCache.cpp	2006-05-25 13:48:52 +02:00
@@ -47,6 +47,7 @@
 {
   assert(! is_ndb_blob_table(table_impl));
   m_table_impl= table_impl;
+  m_tuple_id_range.reset();
 }
 
 Ndb_local_table_info::~Ndb_local_table_info()

--- 1.14/storage/ndb/src/ndbapi/DictCache.hpp	2006-05-25 12:00:34 +02:00
+++ 1.15/storage/ndb/src/ndbapi/DictCache.hpp	2006-05-25 13:48:52 +02:00
@@ -75,6 +75,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.73/storage/ndb/src/ndbapi/Ndb.cpp	2006-05-25 12:00:34 +02:00
+++ 1.74/storage/ndb/src/ndbapi/Ndb.cpp	2006-05-25 13:48:53 +02:00
@@ -1402,6 +1402,7 @@
 int Ndb::dropEventOperation(NdbEventOperation* tOp)
 {
   DBUG_ENTER("Ndb::dropEventOperation");
+  DBUG_PRINT("info", ("name: %s", tOp->getEvent()->getTable()->getName()));
   // remove it from list
   NdbEventOperationImpl *op=
     NdbEventBuffer::getEventOperationImpl(tOp);
@@ -1412,6 +1413,8 @@
   else
     theImpl->m_ev_op= op->m_next;
 
+  DBUG_PRINT("info", ("first: %s",
+                      theImpl->m_ev_op ? theImpl->m_ev_op->getEvent()->getTable()->getName() : "<empty>"));
   assert(theImpl->m_ev_op == 0 || theImpl->m_ev_op->m_prev == 0);
 
   theEventBuffer->dropEventOperation(tOp);
@@ -1434,6 +1437,12 @@
 Ndb::pollEvents(int aMillisecondNumber, Uint64 *latestGCI)
 {
   return theEventBuffer->pollEvents(aMillisecondNumber, latestGCI);
+}
+
+int
+Ndb::flushIncompleteEvents(Uint64 gci)
+{
+  return theEventBuffer->flushIncompleteEvents(gci);
 }
 
 NdbEventOperation *Ndb::nextEvent()

--- 1.133/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-05-19 16:17:35 +02:00
+++ 1.134/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-05-25 13:48:53 +02:00
@@ -1387,9 +1387,6 @@
     Ndb_local_table_info::create(impl, m_local_table_data_size);
   
   m_localHash.put(impl->m_internalName.c_str(), info);
-
-  m_ndb.theFirstTupleId[impl->getTableId()] = ~0;
-  m_ndb.theLastTupleId[impl->getTableId()]  = ~0;
 }
 
 int
@@ -2249,11 +2246,11 @@
     }
     if (autoIncrement) {
       // XXX unlikely race condition - t.m_id may no longer be same table
-      if (! m_ndb.setTupleIdInNdb(t.m_id, initialValue, false)) {
-        if (m_ndb.theError.code)
-          m_error.code = m_ndb.theError.code;
-        else
-          m_error.code = 4336;
+      // the tuple id range is not used on input
+      Ndb::TupleIdRange range;
+      if (m_ndb.setTupleIdInNdb(&t, range, initialValue, false) == -1) {
+        assert(m_ndb.theError.code != 0);
+        m_error.code = m_ndb.theError.code;
         delete t2;
         DBUG_RETURN(-1);
       }

--- 1.59/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-05-21 21:57:30 +02:00
+++ 1.60/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-05-25 13:48:53 +02:00
@@ -951,8 +951,6 @@
       if (info)
       {
         m_localHash.put(internalTableName.c_str(), info);
-        m_ndb.theFirstTupleId[tab->getTableId()] = ~0;
-        m_ndb.theLastTupleId[tab->getTableId()]  = ~0;
       }
     }
   }

--- 1.307/sql/ha_ndbcluster.cc	2006-05-19 15:44:36 +02:00
+++ 1.308/sql/ha_ndbcluster.cc	2006-05-25 13:48:52 +02:00
@@ -106,7 +106,6 @@
 
 }
 
-#define NDB_FAILED_AUTO_INCREMENT ~(Uint64)0
 #define NDB_AUTO_INCREMENT_RETRIES 10
 
 #define ERR_PRINT(err) \
@@ -2465,14 +2464,16 @@
   {
     // 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(m_table);
-    } while (auto_value == NDB_FAILED_AUTO_INCREMENT && 
+      Ndb_tuple_id_range_guard g(m_share);
+      ret= ndb->getAutoIncrementValue(m_table, g.range, 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_share->fields, (const byte*)&auto_value))
       ERR_RETURN(op->getNdbError());
@@ -2567,11 +2568,12 @@
     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(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));
+    Ndb_tuple_id_range_guard g(m_share);
+    if (ndb->setAutoIncrementValue(m_table, g.range, next_val, TRUE)
+        == -1)
+      ERR_RETURN(ndb->getNdbError());
   }
   m_skip_auto_increment= TRUE;
 
@@ -3542,9 +3544,16 @@
     if (m_table)
     {
       Ndb *ndb= get_ndb();
+      Ndb_tuple_id_range_guard g(m_share);
       
-      auto_increment_value= 
-        ndb->readAutoIncrementValue(m_table);
+      if (ndb->readAutoIncrementValue(m_table, g.range,
+                                      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;
@@ -5236,17 +5245,18 @@
            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(m_table)
-      : ndb->getAutoIncrementValue(m_table, cache_size);
-  } while (auto_value == NDB_FAILED_AUTO_INCREMENT && 
+    Ndb_tuple_id_range_guard g(m_share);
+    ret=
+      m_skip_auto_increment ? 
+      ndb->readAutoIncrementValue(m_table, g.range, auto_value) :
+      ndb->getAutoIncrementValue(m_table, g.range, 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",

--- 1.134/sql/ha_ndbcluster.h	2006-05-19 17:34:42 +02:00
+++ 1.135/sql/ha_ndbcluster.h	2006-05-25 13:48:52 +02:00
@@ -106,6 +106,7 @@
   ulonglong commit_count;
   char *db;
   char *table_name;
+  Ndb::TupleIdRange tuple_id_range;
 #ifdef HAVE_NDB_BINLOG
   uint32 flags;
   NdbEventOperation *op;
@@ -139,6 +140,19 @@
   pthread_mutex_unlock(&share->mutex);
 }
 
+struct Ndb_tuple_id_range_guard {
+  Ndb_tuple_id_range_guard(NDB_SHARE* _share) :
+    share(_share),
+    range(share->tuple_id_range) {
+    pthread_mutex_lock(&share->mutex);
+  }
+  ~Ndb_tuple_id_range_guard() {
+    pthread_mutex_unlock(&share->mutex);
+  }
+  NDB_SHARE* share;
+  Ndb::TupleIdRange& range;
+};
+
 #ifdef HAVE_NDB_BINLOG
 /* NDB_SHARE.flags */
 #define NSF_HIDDEN_PK 1 /* table has hidden primary key */
@@ -726,7 +740,6 @@
   int drop_indexes(Ndb *ndb, TABLE *tab);
   int add_index_handle(THD *thd, NdbDictionary::Dictionary *dict,
                        KEY *key_info, const char *index_name, uint index_no);
-  int initialize_autoincrement(const void *table);
   int get_metadata(const char* path);
   void release_metadata(THD *thd, Ndb *ndb);
   NDB_INDEX_TYPE get_index_type(uint idx_no) const;
Thread
bk commit into 5.1 tree (pekka:1.2187)pekka25 May