List:Commits« Previous MessageNext Message »
From:Martin Skold Date:May 28 2007 1:23pm
Subject:bk commit into 5.0 tree (mskold:1.2503)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of marty. When marty 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-05-28 15:23:28+02:00, mskold@stripped +2 -0
  Merge mskold@stripped:/home/bk/mysql-5.0-ndb
  into  mysql.com:/windows/Linux_space/MySQL/mysql-5.0-ndb
  MERGE: 1.2469.10.1

  sql/ha_ndbcluster.cc@stripped, 2007-05-28 15:23:24+02:00, mskold@stripped +1 -2
    Merge
    MERGE: 1.311.1.4

  sql/handler.cc@stripped, 2007-05-28 14:39:46+02:00, mskold@stripped +0 -0
    Auto merged
    MERGE: 1.232.1.1

# 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:	mskold
# Host:	linux.site
# Root:	/windows/Linux_space/MySQL/mysql-5.0-ndb/RESYNC

--- 1.233/sql/handler.cc	2007-05-28 15:23:40 +02:00
+++ 1.234/sql/handler.cc	2007-05-28 15:23:40 +02:00
@@ -1598,6 +1598,8 @@ int handler::update_auto_increment()
   ulonglong nr;
   THD *thd= table->in_use;
   struct system_variables *variables= &thd->variables;
+  bool external_auto_increment= 
+       table->file->table_flags() & HA_EXTERNAL_AUTO_INCREMENT;
   DBUG_ENTER("handler::update_auto_increment");
 
   /*
@@ -1615,12 +1617,12 @@ int handler::update_auto_increment()
     adjust_next_insert_id_after_explicit_value(nr);
     DBUG_RETURN(0);
   }
-  if (!(nr= thd->next_insert_id))
+  if (external_auto_increment || !(nr= thd->next_insert_id))
   {
     if ((nr= get_auto_increment()) == ~(ulonglong) 0)
       DBUG_RETURN(HA_ERR_AUTOINC_READ_FAILED);  // Mark failure
 
-    if (variables->auto_increment_increment != 1)
+    if (!external_auto_increment && variables->auto_increment_increment != 1)
       nr= next_insert_id(nr-1, variables);
     /*
       Update next row based on the found value. This way we don't have to

--- 1.312/sql/ha_ndbcluster.cc	2007-05-28 15:23:40 +02:00
+++ 1.313/sql/ha_ndbcluster.cc	2007-05-28 15:23:40 +02:00
@@ -234,11 +234,6 @@ inline
 int execute_no_commit(ha_ndbcluster *h, NdbTransaction *trans,
 		      bool force_release)
 {
-#ifdef NOT_USED
-  int m_batch_execute= 0;
-  if (m_batch_execute)
-    return 0;
-#endif
   h->release_completed_operations(trans, force_release);
   return trans->execute(NdbTransaction::NoCommit,
                         NdbTransaction::AbortOnError,
@@ -248,11 +243,6 @@ int execute_no_commit(ha_ndbcluster *h, 
 inline
 int execute_commit(ha_ndbcluster *h, NdbTransaction *trans)
 {
-#ifdef NOT_USED
-  int m_batch_execute= 0;
-  if (m_batch_execute)
-    return 0;
-#endif
   return trans->execute(NdbTransaction::Commit,
                         NdbTransaction::AbortOnError,
                         h->m_force_send);
@@ -261,11 +251,6 @@ int execute_commit(ha_ndbcluster *h, Ndb
 inline
 int execute_commit(THD *thd, NdbTransaction *trans)
 {
-#ifdef NOT_USED
-  int m_batch_execute= 0;
-  if (m_batch_execute)
-    return 0;
-#endif
   return trans->execute(NdbTransaction::Commit,
                         NdbTransaction::AbortOnError,
                         thd->variables.ndb_force_send);
@@ -275,11 +260,6 @@ inline
 int execute_no_commit_ie(ha_ndbcluster *h, NdbTransaction *trans,
 			 bool force_release)
 {
-#ifdef NOT_USED
-  int m_batch_execute= 0;
-  if (m_batch_execute)
-    return 0;
-#endif
   h->release_completed_operations(trans, force_release);
   return trans->execute(NdbTransaction::NoCommit,
                         NdbTransaction::AO_IgnoreError,
@@ -2307,18 +2287,24 @@ int ha_ndbcluster::write_row(byte *recor
   {
     // Table has hidden primary key
     Ndb *ndb= get_ndb();
-    int ret;
     Uint64 auto_value;
     uint retries= NDB_AUTO_INCREMENT_RETRIES;
-
-    do {
-      ret= ndb->getAutoIncrementValue((const NDBTAB *) m_table, 
-                                      auto_value, 1);
-    } while (ret == -1 && 
-             --retries &&
-             ndb->getNdbError().status == NdbError::TemporaryError);
-    if (ret == -1)
-      ERR_RETURN(ndb->getNdbError());
+    int retry_sleep= 30; /* 30 milliseconds, transaction */
+    for (;;)
+    {
+      if (ndb->getAutoIncrementValue((const NDBTAB *) m_table,
+                                     auto_value, 1) == -1)
+      {
+        if (--retries &&
+            ndb->getNdbError().status == NdbError::TemporaryError);
+        {
+          my_sleep(retry_sleep);
+          continue;
+        }
+        ERR_RETURN(ndb->getNdbError());
+      }
+      break;
+    }
     if (set_hidden_key(op, table->s->fields, (const byte*)&auto_value))
       ERR_RETURN(op->getNdbError());
   } 
@@ -2461,7 +2447,8 @@ int ha_ndbcluster::update_row(const byte
    * If IGNORE the ignore constraint violations on primary and unique keys,
    * but check that it is not part of INSERT ... ON DUPLICATE KEY UPDATE
    */
-  if (m_ignore_dup_key && thd->lex->sql_command == SQLCOM_UPDATE)
+  if (m_ignore_dup_key && (thd->lex->sql_command == SQLCOM_UPDATE ||
+                           thd->lex->sql_command == SQLCOM_UPDATE_MULTI))
   {
     int peek_res= peek_indexed_rows(new_data, pk_update);
     
@@ -4857,23 +4844,27 @@ ulonglong ha_ndbcluster::get_auto_increm
            m_rows_to_insert - m_rows_inserted :
            ((m_rows_to_insert > m_autoincrement_prefetch) ?
             m_rows_to_insert : m_autoincrement_prefetch));
-  int ret;
   uint retries= NDB_AUTO_INCREMENT_RETRIES;
-  do {
-    ret=
-      m_skip_auto_increment ? 
-      ndb->readAutoIncrementValue((const NDBTAB *) m_table, auto_value) :
-      ndb->getAutoIncrementValue((const NDBTAB *) m_table, 
-				 auto_value, cache_size, step, start);
-  } while (ret == -1 && 
-           --retries &&
-           ndb->getNdbError().status == NdbError::TemporaryError);
-  if (ret == -1)
-  {
-    const NdbError err= ndb->getNdbError();
-    sql_print_error("Error %lu in ::get_auto_increment(): %s",
-                    (ulong) err.code, err.message);
-    DBUG_RETURN(~(ulonglong) 0);
+  int retry_sleep= 30; /* 30 milliseconds, transaction */
+  for (;;)
+  {
+    if (m_skip_auto_increment &&
+        ndb->readAutoIncrementValue((const NDBTAB *) m_table, auto_value) ||
+        ndb->getAutoIncrementValue((const NDBTAB *) m_table,
+                                   auto_value, cache_size, step, start))
+    {
+      if (--retries &&
+          ndb->getNdbError().status == NdbError::TemporaryError);
+      {
+        my_sleep(retry_sleep);
+        continue;
+      }
+      const NdbError err= ndb->getNdbError();
+      sql_print_error("Error %lu in ::get_auto_increment(): %s",
+                      (ulong) err.code, err.message);
+      DBUG_RETURN(~(ulonglong) 0);
+    }
+    break;
   }
   DBUG_RETURN((longlong)auto_value);
 }
@@ -5015,27 +5006,36 @@ int ha_ndbcluster::open(const char *name
   set_dbname(name);
   set_tabname(name);
   
-  if (check_ndb_connection()) {
-    free_share(m_share); m_share= 0;
-    DBUG_RETURN(HA_ERR_NO_CONNECTION);
+  if ((res= check_ndb_connection()) || 
+      (res= get_metadata(name)))
+  {
+    free_share(m_share);
+    m_share= 0;
+    DBUG_RETURN(res);
   }
-  
-  res= get_metadata(name);
-  if (!res)
+  while (1)
   {
     Ndb *ndb= get_ndb();
     if (ndb->setDatabaseName(m_dbname))
     {
-      ERR_RETURN(ndb->getNdbError());
+      res= ndb_to_mysql_error(&ndb->getNdbError());
+      break;
     }
     struct Ndb_statistics stat;
     res= ndb_get_table_statistics(NULL, false, ndb, m_tabname, &stat);
     records= stat.row_count;
     if(!res)
       res= info(HA_STATUS_CONST);
+    break;
   }
-
-  DBUG_RETURN(res);
+  if (res)
+  {
+    free_share(m_share);
+    m_share= 0;
+    release_metadata();
+    DBUG_RETURN(res);
+  }
+  DBUG_RETURN(0);
 }
 
 
Thread
bk commit into 5.0 tree (mskold:1.2503)Martin Skold28 May