List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:October 2 2006 10:11am
Subject:bk commit into 5.1 tree (svoj:1.2337)
View as plain text  
Below is the list of changes that have just been committed into a local
5.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, 2006-10-02 15:11:08+05:00, svoj@april.(none) +10 -0
  Merge svojtovich@stripped:/home/bk/mysql-5.1
  into  mysql.com:/home/svoj/devel/mysql/merge/mysql-5.1-engines
  MERGE: 1.2300.50.12

  BitKeeper/etc/ignore@stripped, 2006-10-02 14:58:26+05:00, svoj@stripped +0 -0
    auto-union
    MERGE: 1.254.1.1

  mysql-test/r/myisam.result@stripped, 2006-10-02 14:58:34+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.92.1.1

  mysql-test/t/myisam.test@stripped, 2006-10-02 14:58:34+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.67.1.1

  sql/opt_range.cc@stripped, 2006-10-02 14:58:34+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.234.1.1

  sql/share/errmsg.txt@stripped, 2006-10-02 14:58:36+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.122.1.3

  sql/sql_insert.cc@stripped, 2006-10-02 15:11:00+05:00, svoj@april.(none) +1 -17
    Manual merge.
    MERGE: 1.223.1.3

  sql/sql_select.cc@stripped, 2006-10-02 14:58:35+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.440.2.1

  sql/table.cc@stripped, 2006-10-02 14:58:35+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.246.1.2

  storage/archive/ha_archive.cc@stripped, 2006-10-02 14:58:37+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.103.1.2

  storage/archive/ha_archive.h@stripped, 2006-10-02 14:58:37+05:00, svoj@april.(none) +0 -0
    Auto merged
    MERGE: 1.50.1.2

# 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:	svoj
# Host:	april.(none)
# Root:	/home/svoj/devel/mysql/merge/mysql-5.1-engines/RESYNC

--- 1.226/sql/sql_insert.cc	2006-10-02 15:11:15 +05:00
+++ 1.227/sql/sql_insert.cc	2006-10-02 15:11:15 +05:00
@@ -1334,13 +1334,16 @@ public:
   bool query_start_used, ignore, log_query;
   bool stmt_depends_on_first_successful_insert_id_in_prev_stmt;
   ulonglong first_successful_insert_id_in_prev_stmt;
+  ulonglong forced_insert_id;
+  ulong auto_increment_increment;
+  ulong auto_increment_offset;
   timestamp_auto_set_type timestamp_field_type;
   LEX_STRING query;
 
   delayed_row(LEX_STRING const query_arg, enum_duplicates dup_arg,
               bool ignore_arg, bool log_query_arg)
     : record(0), dup(dup_arg), ignore(ignore_arg), log_query(log_query_arg),
-      query(query_arg)
+      forced_insert_id(0), query(query_arg)
     {}
   ~delayed_row()
   {
@@ -1698,6 +1701,7 @@ write_delayed(THD *thd,TABLE *table, enu
 {
   delayed_row *row;
   delayed_insert *di=thd->di;
+  const Discrete_interval *forced_auto_inc;
   DBUG_ENTER("write_delayed");
   DBUG_PRINT("enter", ("query = '%s' length %u", query.str, query.length));
 
@@ -1747,6 +1751,17 @@ write_delayed(THD *thd,TABLE *table, enu
     thd->first_successful_insert_id_in_prev_stmt;
   row->timestamp_field_type=    table->timestamp_field_type;
 
+  /* Copy session variables. */
+  row->auto_increment_increment= thd->variables.auto_increment_increment;
+  row->auto_increment_offset=    thd->variables.auto_increment_offset;
+  /* Copy the next forced auto increment value, if any. */
+  if ((forced_auto_inc= thd->auto_inc_intervals_forced.get_next()))
+  {
+    row->forced_insert_id= forced_auto_inc->minimum();
+    DBUG_PRINT("delayed", ("transmitting auto_inc: %lu",
+                           (ulong) row->forced_insert_id));
+  }
+
   di->rows.push_back(row);
   di->stacked_inserts++;
   di->status=1;
@@ -1998,6 +2013,10 @@ pthread_handler_t handle_delayed_insert(
       MYSQL_LOCK *lock=thd->lock;
       thd->lock=0;
       pthread_mutex_unlock(&di->mutex);
+      /*
+        We need to release next_insert_id before unlocking. This is
+        enforced by handler::ha_external_lock().
+      */
       di->table->file->ha_release_auto_increment();
       mysql_unlock_tables(thd, lock);
       di->group_count=0;
@@ -2123,8 +2142,18 @@ bool delayed_insert::handle_inserts(void
       use values from the previous interval (of the previous rows).
     */
     bool log_query= (row->log_query && row->query.str != NULL);
+    DBUG_PRINT("delayed", ("query: '%s'  length: %u", row->query.str ?
+                           row->query.str : "[NULL]", row->query.length));
     if (log_query)
     {
+      /*
+        This is the first value of an INSERT statement.
+        It is the right place to clear a forced insert_id.
+        This is usually done after the last value of an INSERT statement,
+        but we won't know this in the insert delayed thread. But before
+        the first value is sufficiently equivalent to after the last
+        value of the previous statement.
+      */
       table->file->ha_release_auto_increment();
       thd.auto_inc_intervals_in_cur_stmt_for_binlog.empty();
     }
@@ -2134,6 +2163,17 @@ bool delayed_insert::handle_inserts(void
       row->stmt_depends_on_first_successful_insert_id_in_prev_stmt;
     table->timestamp_field_type= row->timestamp_field_type;
 
+    /* Copy the session variables. */
+    thd.variables.auto_increment_increment= row->auto_increment_increment;
+    thd.variables.auto_increment_offset=    row->auto_increment_offset;
+    /* Copy a forced insert_id, if any. */
+    if (row->forced_insert_id)
+    {
+      DBUG_PRINT("delayed", ("received auto_inc: %lu",
+                             (ulong) row->forced_insert_id));
+      thd.force_one_auto_inc_interval(row->forced_insert_id);
+    }
+
     info.ignore= row->ignore;
     info.handle_duplicates= row->dup;
     if (info.ignore ||
@@ -2211,6 +2251,7 @@ bool delayed_insert::handle_inserts(void
 	  /* This should never happen */
 	  table->file->print_error(error,MYF(0));
 	  sql_print_error("%s",thd.net.last_error);
+          DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed in loop"));
 	  goto err;
 	}
 	query_cache_invalidate3(&thd, table, 1);
@@ -2253,6 +2294,7 @@ bool delayed_insert::handle_inserts(void
   {						// This shouldn't happen
     table->file->print_error(error,MYF(0));
     sql_print_error("%s",thd.net.last_error);
+    DBUG_PRINT("error", ("HA_EXTRA_NO_CACHE failed after loop"));
     goto err;
   }
   query_cache_invalidate3(&thd, table, 1);
@@ -2260,13 +2302,16 @@ bool delayed_insert::handle_inserts(void
   DBUG_RETURN(0);
 
  err:
+  DBUG_EXECUTE("error", max_rows= 0;);
   /* Remove all not used rows */
   while ((row=rows.get()))
   {
     delete row;
     thread_safe_increment(delayed_insert_errors,&LOCK_delayed_status);
     stacked_inserts--;
+    DBUG_EXECUTE("error", max_rows++;);
   }
+  DBUG_PRINT("error", ("dropped %lu rows after an error", max_rows));
   thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status);
   pthread_mutex_lock(&mutex);
   DBUG_RETURN(1);

--- 1.247/sql/table.cc	2006-10-02 15:11:15 +05:00
+++ 1.248/sql/table.cc	2006-10-02 15:11:15 +05:00
@@ -2257,7 +2257,7 @@ char *get_field(MEM_ROOT *mem, Field *fi
 
 bool check_db_name(char *name)
 {
-  uint name_length= 0;  // name length in symbols
+  char *start= name;
   /* Used to catch empty names and names with end space */
   bool last_char_is_space= TRUE;
 
@@ -2277,15 +2277,13 @@ bool check_db_name(char *name)
         name += len;
         continue;
       }
-    name_length++;
     }
 #else
     last_char_is_space= *name==' ';
 #endif
-    name_length++;
     name++;
   }
-  return last_char_is_space || name_length > NAME_LEN;
+  return last_char_is_space || (uint) (name - start) > NAME_LEN;
 }
 
 

--- 1.128/sql/share/errmsg.txt	2006-10-02 15:11:15 +05:00
+++ 1.129/sql/share/errmsg.txt	2006-10-02 15:11:15 +05:00
@@ -3791,7 +3791,7 @@ ER_WRONG_MRG_TABLE  
         dan "Tabellerne i MERGE er ikke defineret ens"
         nla "Niet alle tabellen in de MERGE tabel hebben identieke gedefinities"
-        eng "All tables in the MERGE table are not identically defined"
+        eng "Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exists"
         ger "Nicht alle Tabellen in der MERGE-Tabelle sind gleich definiert"

--- 1.51/storage/archive/ha_archive.h	2006-10-02 15:11:15 +05:00
+++ 1.52/storage/archive/ha_archive.h	2006-10-02 15:11:15 +05:00
@@ -67,7 +67,7 @@ class ha_archive: public handler
   uint current_k_offset;
 
 public:
-  ha_archive(TABLE_SHARE *table_arg);
+  ha_archive(handlerton *hton, TABLE_SHARE *table_arg);
   ~ha_archive()
   {
   }
@@ -138,6 +138,4 @@ public:
   int check(THD* thd, HA_CHECK_OPT* check_opt);
   bool check_and_repair(THD *thd);
 };
-
-int archive_db_end(ha_panic_function type);
 
Thread
bk commit into 5.1 tree (svoj:1.2337)Sergey Vojtovich2 Oct