List:Commits« Previous MessageNext Message »
From:Elliot Murphy Date:January 27 2006 10:23pm
Subject:bk commit into 5.0 tree (elliot:1.2010)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of emurphy. When emurphy 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.2010 06/01/27 17:23:20 elliot@stripped +29 -0
  Merge mysql.com:/home/emurphy/src/mysql/bk-clean/mysql-4.1
  into  mysql.com:/home/emurphy/src/mysql/bk-clean/mysql-5.0-merge

  sql/sql_update.cc
    1.184 06/01/27 17:23:12 elliot@stripped +0 -1
    manual merge

  sql/sql_parse.cc
    1.524 06/01/27 17:23:12 elliot@stripped +19 -0
    manual merge

  sql/sql_class.cc
    1.226 06/01/27 17:23:12 elliot@stripped +285 -285
    manual merge

  sql/item_timefunc.cc
    1.101 06/01/27 17:23:12 elliot@stripped +0 -2
    manual merge

  sql/ha_heap.h
    1.39 06/01/27 17:23:12 elliot@stripped +0 -1
    manual merge

  sql/ha_heap.cc
    1.75 06/01/27 17:23:12 elliot@stripped +6 -7
    manual merge

  mysql-test/r/kill.result
    1.10 06/01/27 17:23:12 elliot@stripped +1 -13
    ignoring merge, will update from test files.

  mysql-test/r/heap_hash.result
    1.18 06/01/27 17:23:12 elliot@stripped +6 -10
    ignoring merge, will update from test files.

  mysql-test/r/heap.result
    1.43 06/01/27 17:23:12 elliot@stripped +1 -11
    ignoring merge, will update from test files.

  configure.in
    1.374 06/01/27 17:23:12 elliot@stripped +22 -10
    manual merge

  sql/sql_select.h
    1.105 06/01/27 16:30:51 elliot@stripped +0 -0
    Auto merged

  sql/sql_select.cc
    1.389 06/01/27 16:30:51 elliot@stripped +0 -0
    Auto merged

  sql/sql_base.cc
    1.325 06/01/27 16:30:50 elliot@stripped +0 -0
    Auto merged

  ndb/include/mgmapi/mgmapi_config_parameters.h
    1.20 06/01/27 16:30:50 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/update.test
    1.28 06/01/27 16:30:50 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/kill.test
    1.19 06/01/27 16:30:50 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/heap.test
    1.31 06/01/27 16:30:50 elliot@stripped +0 -0
    Auto merged

  mysql-test/t/date_formats.test
    1.15 06/01/27 16:30:50 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/update.result
    1.30 06/01/27 16:30:49 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/myisam.result
    1.72 06/01/27 16:30:49 elliot@stripped +0 -0
    Auto merged

  mysql-test/r/date_formats.result
    1.19 06/01/27 16:30:49 elliot@stripped +0 -0
    Auto merged

  heap/hp_create.c
    1.22 06/01/27 16:30:49 elliot@stripped +0 -0
    Auto merged

  BitKeeper/deleted/.del-rpl_multi_update4.test
    1.2 06/01/27 16:30:49 elliot@stripped +0 -0
    Delete: mysql-test/t/rpl_multi_update4.test

  BitKeeper/deleted/.del-disabled.def
    1.3 06/01/27 16:30:49 elliot@stripped +0 -0
    Auto merged

  BitKeeper/deleted/.del-rpl_multi_update4-slave.opt
    1.2 06/01/27 16:30:44 elliot@stripped +0 -0
    Delete: mysql-test/t/rpl_multi_update4-slave.opt

  BitKeeper/deleted/.del-rpl_ignore_table.test
    1.2 06/01/27 16:30:40 elliot@stripped +0 -0
    Delete: mysql-test/t/rpl_ignore_table.test

  BitKeeper/deleted/.del-rpl_ignore_table-slave.opt
    1.2 06/01/27 16:30:35 elliot@stripped +0 -0
    Delete: mysql-test/t/rpl_ignore_table-slave.opt

  BitKeeper/deleted/.del-rpl_multi_update4.result
    1.2 06/01/27 16:30:26 elliot@stripped +0 -0
    Delete: mysql-test/r/rpl_multi_update4.result

  BitKeeper/deleted/.del-rpl_ignore_table.result
    1.2 06/01/27 16:30:08 elliot@stripped +0 -0
    Delete: mysql-test/r/rpl_ignore_table.result

  BitKeeper/deleted/.del-disabled.def
    1.1.1.2 06/01/27 16:29:01 elliot@stripped +0 -0
    Merge rename: mysql-test/t/disabled.def -> BitKeeper/deleted/.del-disabled.def

# 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:	elliot
# Host:	xan.(none)
# Root:	/home/emurphy/src/mysql/bk-clean/mysql-5.0-merge/RESYNC

--- 1.373/configure.in	2006-01-18 07:14:58 -05:00
+++ 1.374/configure.in	2006-01-27 17:23:12 -05:00
@@ -349,23 +349,38 @@
 AC_SUBST(LD)
 AC_SUBST(INSTALL_SCRIPT)
 
-export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
+export CC CXX CFLAGS LD LDFLAGS AR
 
-if test "$GCC" = "yes"
+ndb_cxxflags_fix=
+if test "$GXX" = "yes"
 then
   # mysqld requires -fno-implicit-templates.
   # Disable exceptions as they seams to create problems with gcc and threads.
   # mysqld doesn't use run-time-type-checking, so we disable it.
   CXXFLAGS="$CXXFLAGS -fno-implicit-templates -fno-exceptions -fno-rtti"
-  AC_DEFINE([HAVE_EXPLICIT_TEMPLATE_INSTANTIATION],
-    [1], [Defined by configure. Use explicit template instantiation.])
-fi
 
-MYSQL_PROG_AR
+  # If you are using 'gcc' 3.0 (not g++) to compile C++ programs on Linux,
+  # we will gets some problems when linking static programs.
+  # The following code is used to fix this problem.
+
+  if echo $CXX | grep gcc > /dev/null 2>&1
+  then
+    AC_MSG_CHECKING([if CXX is gcc 3 or 4])
+    if $CXX -v 2>&1 | grep 'version [[34]]' > /dev/null 2>&1
+    then
+      AC_MSG_RESULT([yes])
+      AC_MSG_NOTICE([using MySQL tricks to avoid linking C++ code with C++ libraries])
+      CXXFLAGS="$CXXFLAGS -DUSE_MYSYS_NEW -DDEFINE_CXA_PURE_VIRTUAL"
+    else
+      AC_MSG_RESULT([no])
+    fi
+  fi
+fi
+export CC CXX CFLAGS LD LDFLAGS AR ARFLAGS
+  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_builddir)/libmysql/libmysql.ver"
 
 # libmysqlclient versioning when linked with GNU ld.
 if $LD --version 2>/dev/null|grep -q GNU; then
-  LD_VERSION_SCRIPT="-Wl,--version-script=\$(top_srcdir)/libmysql/libmysql.ver"
   AC_CONFIG_FILES(libmysql/libmysql.ver)
 fi
 AC_SUBST(LD_VERSION_SCRIPT)

--- 1.21/heap/hp_create.c	2005-10-27 13:04:31 -04:00
+++ 1.22/heap/hp_create.c	2006-01-27 16:30:49 -05:00
@@ -135,6 +135,7 @@
       DBUG_RETURN(1);
     }
     share->keydef= (HP_KEYDEF*) (share + 1);
+    share->key_stat_version= 1;
     keyseg= (HA_KEYSEG*) (share->keydef + keys);
     init_block(&share->block, reclength + 1, min_records, max_records);
 	/* Fix keys */

--- 1.74/sql/ha_heap.cc	2005-10-02 23:03:41 -04:00
+++ 1.75/sql/ha_heap.cc	2006-01-27 17:23:12 -05:00
@@ -104,7 +104,7 @@
       ha_heap::info(), which is always called before key statistics are
       used.
     */
-    key_stats_ok= FALSE;
+    key_stat_version= file->s->key_stat_version-1;
   }
   return (file ? 0 : 1);
 }
@@ -151,14 +151,21 @@
       continue;
     if (key->algorithm != HA_KEY_ALG_BTREE)
     {
-      ha_rows hash_buckets= file->s->keydef[i].hash_buckets;
-      key->rec_per_key[key->key_parts-1]= 
-        hash_buckets ? file->s->records/hash_buckets : 0;
+      if (key->flags & HA_NOSAME)
+        key->rec_per_key[key->key_parts-1]= 1;
+      else
+      {
+        ha_rows hash_buckets= file->s->keydef[i].hash_buckets;
+        uint no_records= hash_buckets ? file->s->records/hash_buckets : 2;
+        if (no_records < 2)
+          no_records= 2;
+        key->rec_per_key[key->key_parts-1]= no_records;
+      }
     }
   }
   records_changed= 0;
   /* At the end of update_key_stats() we can proudly claim they are OK. */
-  key_stats_ok= TRUE;
+  key_stat_version= file->s->key_stat_version;
 }
 
 
@@ -173,7 +180,13 @@
   res= heap_write(file,buf);
   if (!res && (++records_changed*HEAP_STATS_UPDATE_THRESHOLD > 
                file->s->records))
-    key_stats_ok= FALSE;
+  {
+    /*
+       We can perform this safely since only one writer at the time is
+       allowed on the table.
+    */
+    file->s->key_stat_version++;
+  }
   return res;
 }
 
@@ -186,7 +199,13 @@
   res= heap_update(file,old_data,new_data);
   if (!res && ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > 
               file->s->records)
-    key_stats_ok= FALSE;
+  {
+    /*
+       We can perform this safely since only one writer at the time is
+       allowed on the table.
+    */
+    file->s->key_stat_version++;
+  }
   return res;
 }
 
@@ -197,7 +216,13 @@
   res= heap_delete(file,buf);
   if (!res && table->s->tmp_table == NO_TMP_TABLE && 
       ++records_changed*HEAP_STATS_UPDATE_THRESHOLD > file->s->records)
-    key_stats_ok= FALSE;
+  {
+    /*
+       We can perform this safely since only one writer at the time is
+       allowed on the table.
+    */
+    file->s->key_stat_version++;
+  }
   return res;
 }
 
@@ -324,7 +349,7 @@
     have to update the key statistics. Hoping that a table lock is now
     in place.
   */
-  if (! key_stats_ok)
+  if (key_stat_version != file->s->key_stat_version)
     update_key_stats();
 }
 
@@ -337,7 +362,13 @@
 {
   heap_clear(file);
   if (table->s->tmp_table == NO_TMP_TABLE)
-    key_stats_ok= FALSE;
+  {
+    /*
+       We can perform this safely since only one writer at the time is
+       allowed on the table.
+    */
+    file->s->key_stat_version++;
+  }
   return 0;
 }
 
@@ -496,10 +527,17 @@
       min_key->flag != HA_READ_KEY_EXACT ||
       max_key->flag != HA_READ_AFTER_KEY)
     return HA_POS_ERROR;			// Can only use exact keys
-
-  /* Assert that info() did run. We need current statistics here. */
-  DBUG_ASSERT(key_stats_ok);
-  return key->rec_per_key[key->key_parts-1];
+  else
+  {
+    if (records <= 1)
+      return records;
+    else
+    {
+      /* Assert that info() did run. We need current statistics here. */
+      DBUG_ASSERT(key_stat_version == file->s->key_stat_version);
+      return key->rec_per_key[key->key_parts-1];
+    }
+  }
 }
 
 

--- 1.38/sql/ha_heap.h	2005-08-05 16:19:44 -04:00
+++ 1.39/sql/ha_heap.h	2006-01-27 17:23:12 -05:00
@@ -29,7 +29,7 @@
   key_map btree_keys;
   /* number of records changed since last statistics update */
   uint    records_changed;
-  bool    key_stats_ok;
+  uint    key_stat_version;
 public:
   ha_heap(TABLE *table);
   ~ha_heap() {}

--- 1.225/sql/sql_class.cc	2006-01-10 11:56:16 -05:00
+++ 1.226/sql/sql_class.cc	2006-01-27 17:23:12 -05:00
@@ -1816,291 +1816,294 @@
 
 void TMP_TABLE_PARAM::init()
 {
+  DBUG_ENTER("TMP_TABLE_PARAM::init");
+  DBUG_PRINT("enter", ("this: 0x%lx", (ulong)this));
   field_count= sum_func_count= func_count= hidden_field_count= 0;
   group_parts= group_length= group_null_parts= 0;
   quick_group= 1;
-  table_charset= 0;
-  precomputed_group_by= 0;
-}
-
-
-void thd_increment_bytes_sent(ulong length)
-{
-  THD *thd=current_thd;
-  if (likely(thd != 0))
-  { /* current_thd==0 when close_connection() calls net_send_error() */
-    thd->status_var.bytes_sent+= length;
-  }
-}
-
-
-void thd_increment_bytes_received(ulong length)
-{
-  current_thd->status_var.bytes_received+= length;
-}
-
-
-void thd_increment_net_big_packet_count(ulong length)
-{
-  current_thd->status_var.net_big_packet_count+= length;
-}
-
-
-void THD::set_status_var_init()
-{
-  bzero((char*) &status_var, sizeof(status_var));
-}
-
-
-void Security_context::init()
-{
-  host= user= priv_user= ip= 0;
-  host_or_ip= "connecting host";
-#ifndef NO_EMBEDDED_ACCESS_CHECKS
-  db_access= NO_ACCESS;
-#endif
-}
-
-
-void Security_context::destroy()
-{
-  // If not pointer to constant
-  if (host != my_localhost)
-    safeFree(host);
-  if (user != delayed_user)
-    safeFree(user);
-  safeFree(ip);
-}
-
-
-void Security_context::skip_grants()
-{
-  /* privileges for the user are unknown everything is allowed */
-  host_or_ip= (char *)"";
-  master_access= ~NO_ACCESS;
-  priv_user= (char *)"";
-  *priv_host= '\0';
-}
-
-
-/****************************************************************************
-  Handling of open and locked tables states.
-
-  This is used when we want to open/lock (and then close) some tables when
-  we already have a set of tables open and locked. We use these methods for
-  access to mysql.proc table to find definitions of stored routines.
-****************************************************************************/
-
-void THD::reset_n_backup_open_tables_state(Open_tables_state *backup)
-{
-  DBUG_ENTER("reset_n_backup_open_tables_state");
-  backup->set_open_tables_state(this);
-  reset_open_tables_state();
-  DBUG_VOID_RETURN;
-}
-
-
-void THD::restore_backup_open_tables_state(Open_tables_state *backup)
-{
-  DBUG_ENTER("restore_backup_open_tables_state");
-  /*
-    Before we will throw away current open tables state we want
-    to be sure that it was properly cleaned up.
-  */
-  DBUG_ASSERT(open_tables == 0 && temporary_tables == 0 &&
-              handler_tables == 0 && derived_tables == 0 &&
-              lock == 0 && locked_tables == 0 &&
-              prelocked_mode == NON_PRELOCKED);
-  set_open_tables_state(backup);
-  DBUG_VOID_RETURN;
-}
-
-
-
-/****************************************************************************
-  Handling of statement states in functions and triggers.
-
-  This is used to ensure that the function/trigger gets a clean state
-  to work with and does not cause any side effects of the calling statement.
-
-  It also allows most stored functions and triggers to replicate even
-  if they are used items that would normally be stored in the binary
-  replication (like last_insert_id() etc...)
-
-  The following things is done
-  - Disable binary logging for the duration of the statement
-  - Disable multi-result-sets for the duration of the statement
-  - Value of last_insert_id() is reset and restored
-  - Value set by 'SET INSERT_ID=#' is reset and restored
-  - Value for found_rows() is reset and restored
-  - examined_row_count is added to the total
-  - cuted_fields is added to the total
-  - new savepoint level is created and destroyed
-
-  NOTES:
-    Seed for random() is saved for the first! usage of RAND()
-    We reset examined_row_count and cuted_fields and add these to the
-    result to ensure that if we have a bug that would reset these within
-    a function, we are not loosing any rows from the main statement.
-****************************************************************************/
-
-void THD::reset_sub_statement_state(Sub_statement_state *backup,
-                                    uint new_state)
-{
-  backup->options=         options;
-  backup->in_sub_stmt=     in_sub_stmt;
-  backup->no_send_ok=      net.no_send_ok;
-  backup->enable_slow_log= enable_slow_log;
-  backup->last_insert_id=  last_insert_id;
-  backup->next_insert_id=  next_insert_id;
-  backup->insert_id_used=  insert_id_used;
-  backup->clear_next_insert_id= clear_next_insert_id;
-  backup->limit_found_rows= limit_found_rows;
-  backup->examined_row_count= examined_row_count;
-  backup->sent_row_count=   sent_row_count;
-  backup->cuted_fields=     cuted_fields;
-  backup->client_capabilities= client_capabilities;
-  backup->savepoints= transaction.savepoints;
-
-  if (!lex->requires_prelocking() || is_update_query(lex->sql_command))
-    options&= ~OPTION_BIN_LOG;
-  /* Disable result sets */
-  client_capabilities &= ~CLIENT_MULTI_RESULTS;
-  in_sub_stmt|= new_state;
-  last_insert_id= 0;
-  next_insert_id= 0;
-  insert_id_used= 0;
-  examined_row_count= 0;
-  sent_row_count= 0;
-  cuted_fields= 0;
-  transaction.savepoints= 0;
-
-#ifndef EMBEDDED_LIBRARY
-  /* Surpress OK packets in case if we will execute statements */
-  net.no_send_ok= TRUE;
-#endif
-}
-
-
-void THD::restore_sub_statement_state(Sub_statement_state *backup)
-{
-  /*
-    To save resources we want to release savepoints which were created
-    during execution of function or trigger before leaving their savepoint
-    level. It is enough to release first savepoint set on this level since
-    all later savepoints will be released automatically.
-  */
-  if (transaction.savepoints)
-  {
-    SAVEPOINT *sv;
-    for (sv= transaction.savepoints; sv->prev; sv= sv->prev)
-    {}
-    /* ha_release_savepoint() never returns error. */
-    (void)ha_release_savepoint(this, sv);
-  }
-  transaction.savepoints= backup->savepoints;
-  options=          backup->options;
-  in_sub_stmt=      backup->in_sub_stmt;
-  net.no_send_ok=   backup->no_send_ok;
-  enable_slow_log=  backup->enable_slow_log;
-  last_insert_id=   backup->last_insert_id;
-  next_insert_id=   backup->next_insert_id;
-  insert_id_used=   backup->insert_id_used;
-  clear_next_insert_id= backup->clear_next_insert_id;
-  limit_found_rows= backup->limit_found_rows;
-  sent_row_count=   backup->sent_row_count;
-  client_capabilities= backup->client_capabilities;
-
-  /*
-    The following is added to the old values as we are interested in the
-    total complexity of the query
-  */
-  examined_row_count+= backup->examined_row_count;
-  cuted_fields+=       backup->cuted_fields;
-}
-
-
-/***************************************************************************
-  Handling of XA id cacheing
-***************************************************************************/
-
-pthread_mutex_t LOCK_xid_cache;
-HASH xid_cache;
-
-static byte *xid_get_hash_key(const byte *ptr,uint *length,
-                                  my_bool not_used __attribute__((unused)))
-{
-  *length=((XID_STATE*)ptr)->xid.key_length();
-  return ((XID_STATE*)ptr)->xid.key();
-}
-
-static void xid_free_hash (void *ptr)
-{
-  if (!((XID_STATE*)ptr)->in_thd)
-    my_free((gptr)ptr, MYF(0));
-}
-
-bool xid_cache_init()
-{
-  pthread_mutex_init(&LOCK_xid_cache, MY_MUTEX_INIT_FAST);
-  return hash_init(&xid_cache, &my_charset_bin, 100, 0, 0,
-                   xid_get_hash_key, xid_free_hash, 0) != 0;
-}
-
-void xid_cache_free()
-{
-  if (hash_inited(&xid_cache))
-  {
-    hash_free(&xid_cache);
-    pthread_mutex_destroy(&LOCK_xid_cache);
-  }
-}
-
-XID_STATE *xid_cache_search(XID *xid)
-{
-  pthread_mutex_lock(&LOCK_xid_cache);
-  XID_STATE *res=(XID_STATE *)hash_search(&xid_cache, xid->key(), xid->key_length());
-  pthread_mutex_unlock(&LOCK_xid_cache);
-  return res;
-}
-
-
-bool xid_cache_insert(XID *xid, enum xa_states xa_state)
-{
-  XID_STATE *xs;
-  my_bool res;
-  pthread_mutex_lock(&LOCK_xid_cache);
-  if (hash_search(&xid_cache, xid->key(), xid->key_length()))
-    res=0;
-  else if (!(xs=(XID_STATE *)my_malloc(sizeof(*xs), MYF(MY_WME))))
-    res=1;
-  else
-  {
-    xs->xa_state=xa_state;
-    xs->xid.set(xid);
-    xs->in_thd=0;
-    res=my_hash_insert(&xid_cache, (byte*)xs);
-  }
-  pthread_mutex_unlock(&LOCK_xid_cache);
-  return res;
-}
-
-
-bool xid_cache_insert(XID_STATE *xid_state)
-{
-  pthread_mutex_lock(&LOCK_xid_cache);
-  DBUG_ASSERT(hash_search(&xid_cache, xid_state->xid.key(),
-                          xid_state->xid.key_length())==0);
-  my_bool res=my_hash_insert(&xid_cache, (byte*)xid_state);
-  pthread_mutex_unlock(&LOCK_xid_cache);
-  return res;
-}
-
-
-void xid_cache_delete(XID_STATE *xid_state)
-{
-  pthread_mutex_lock(&LOCK_xid_cache);
-  hash_delete(&xid_cache, (byte *)xid_state);
-  pthread_mutex_unlock(&LOCK_xid_cache);
-}
+0;
+up_by= 0;
+N;
+
+
+
+t_bytes_sent(ulong length)
+
+t_thd;
+!= 0))
+d==0 when close_connection() calls net_send_error() */
+ar.bytes_sent+= length;
+
+
+
+
+t_bytes_received(ulong length)
+
+atus_var.bytes_received+= length;
+
+
+
+t_net_big_packet_count(ulong length)
+
+atus_var.net_big_packet_count+= length;
+
+
+
+tus_var_init()
+
+status_var, sizeof(status_var));
+
+
+
+text::init()
+
+v_user= ip= 0;
+nnecting host";
+ED_ACCESS_CHECKS
+CCESS;
+
+
+
+
+text::destroy()
+
+er to constant
+localhost)
+);
+ayed_user)
+);
+
+
+
+
+text::skip_grants()
+
+or the user are unknown everything is allowed */
+ar *)"";
+~NO_ACCESS;
+r *)"";
+';
+
+
+
+************************************************************
+n and locked tables states.
+
+en we want to open/lock (and then close) some tables when
+ a set of tables open and locked. We use these methods for
+.proc table to find definitions of stored routines.
+***********************************************************/
+
+_backup_open_tables_state(Open_tables_state *backup)
+
+et_n_backup_open_tables_state");
+n_tables_state(this);
+es_state();
+N;
+
+
+
+_backup_open_tables_state(Open_tables_state *backup)
+
+tore_backup_open_tables_state");
+
+l throw away current open tables state we want
+at it was properly cleaned up.
+
+n_tables == 0 && temporary_tables == 0 &&
+dler_tables == 0 && derived_tables == 0 &&
+k == 0 && locked_tables == 0 &&
+locked_mode == NON_PRELOCKED);
+_state(backup);
+N;
+
+
+
+
+************************************************************
+tement states in functions and triggers.
+
+ ensure that the function/trigger gets a clean state
+d does not cause any side effects of the calling statement.
+
+most stored functions and triggers to replicate even
+d items that would normally be stored in the binary
+ke last_insert_id() etc...)
+
+hings is done
+y logging for the duration of the statement
+-result-sets for the duration of the statement
+_insert_id() is reset and restored
+'SET INSERT_ID=#' is reset and restored
+nd_rows() is reset and restored
+count is added to the total
+is added to the total
+ level is created and destroyed
+
+
+om() is saved for the first! usage of RAND()
+ined_row_count and cuted_fields and add these to the
+ure that if we have a bug that would reset these within
+e are not loosing any rows from the main statement.
+***********************************************************/
+
+ub_statement_state(Sub_statement_state *backup,
+                   uint new_state)
+
+=         options;
+stmt=     in_sub_stmt;
+_ok=      net.no_send_ok;
+slow_log= enable_slow_log;
+sert_id=  last_insert_id;
+sert_id=  next_insert_id;
+id_used=  insert_id_used;
+ext_insert_id= clear_next_insert_id;
+ound_rows= limit_found_rows;
+d_row_count= examined_row_count;
+w_count=   sent_row_count;
+ields=     cuted_fields;
+capabilities= client_capabilities;
+nts= transaction.savepoints;
+
+res_prelocking() || is_update_query(lex->sql_command))
+TION_BIN_LOG;
+lt sets */
+ties &= ~CLIENT_MULTI_RESULTS;
+ew_state;
+ 0;
+ 0;
+ 0;
+unt= 0;
+ 0;
+;
+epoints= 0;
+
+LIBRARY
+packets in case if we will execute statements */
+ TRUE;
+
+
+
+
+_sub_statement_state(Sub_statement_state *backup)
+
+
+rces we want to release savepoints which were created
+ion of function or trigger before leaving their savepoint
+enough to release first savepoint set on this level since
+epoints will be released automatically.
+
+.savepoints)
+
+;
+saction.savepoints; sv->prev; sv= sv->prev)
+
+_savepoint() never returns error. */
+ase_savepoint(this, sv);
+
+epoints= backup->savepoints;
+   backup->options;
+   backup->in_sub_stmt;
+   backup->no_send_ok;
+=  backup->enable_slow_log;
+   backup->last_insert_id;
+   backup->next_insert_id;
+   backup->insert_id_used;
+rt_id= backup->clear_next_insert_id;
+s= backup->limit_found_rows;
+   backup->sent_row_count;
+ties= backup->client_capabilities;
+
+
+ is added to the old values as we are interested in the
+ity of the query
+
+unt+= backup->examined_row_count;
+      backup->cuted_fields;
+
+
+
+***********************************************************
+id cacheing
+**********************************************************/
+
+OCK_xid_cache;
+
+
+get_hash_key(const byte *ptr,uint *length,
+                 my_bool not_used __attribute__((unused)))
+
+TATE*)ptr)->xid.key_length();
+ATE*)ptr)->xid.key();
+
+
+ree_hash (void *ptr)
+
+E*)ptr)->in_thd)
+)ptr, MYF(0));
+
+
+it()
+
+nit(&LOCK_xid_cache, MY_MUTEX_INIT_FAST);
+t(&xid_cache, &my_charset_bin, 100, 0, 0,
+  xid_get_hash_key, xid_free_hash, 0) != 0;
+
+
+ee()
+
+(&xid_cache))
+
+d_cache);
+_destroy(&LOCK_xid_cache);
+
+
+
+che_search(XID *xid)
+
+ock(&LOCK_xid_cache);
+(XID_STATE *)hash_search(&xid_cache, xid->key(), xid->key_length());
+nlock(&LOCK_xid_cache);
+
+
+
+
+sert(XID *xid, enum xa_states xa_state)
+
+
+
+ock(&LOCK_xid_cache);
+(&xid_cache, xid->key(), xid->key_length()))
+
+XID_STATE *)my_malloc(sizeof(*xs), MYF(MY_WME))))
+
+
+
+xa_state;
+id);
+
+nsert(&xid_cache, (byte*)xs);
+
+nlock(&LOCK_xid_cache);
+
+
+
+
+sert(XID_STATE *xid_state)
+
+ock(&LOCK_xid_cache);
+h_search(&xid_cache, xid_state->xid.key(),
+         xid_state->xid.key_length())==0);
+hash_insert(&xid_cache, (byte*)xid_state);
+nlock(&LOCK_xid_cache);
+
+
+
+
+lete(XID_STATE *xid_state)
+
+ock(&LOCK_xid_cache);
+d_cache, (byte *)xid_state);
+nlock(&LOCK_xid_cache);
+
 

--- 1.523/sql/sql_parse.cc	2006-01-23 11:03:03 -05:00
+++ 1.524/sql/sql_parse.cc	2006-01-27 17:23:12 -05:00
@@ -3228,6 +3228,35 @@
     DBUG_ASSERT(first_table == all_tables && first_table != 0);
     /* if we switched from normal update, rights are checked */
     if (result != 2)
+    if ((res= multi_update_precheck(thd, tables)))
+      break;
+
+    res= mysql_multi_update_lock(thd, tables, &select_lex->item_list,
+                                 select_lex);
+#ifdef HAVE_REPLICATION
+    /* Check slave filtering rules */
+    if (thd->slave_thread)
+      if (all_tables_not_ok(thd,tables))
+      {
+        if (res!= 0)
+        {
+          res= 0;             /* don't care of prev failure  */
+          thd->clear_error(); /* filters are of highest prior */
+        }
+	/* we warn the slave SQL thread */
+	my_error(ER_SLAVE_IGNORED_TABLE, MYF(0));
+	break;
+      }
+#endif /* HAVE_REPLICATION */
+    if (res)
+      break;
+    
+    res= mysql_multi_update(thd,tables,
+			    &select_lex->item_list,
+			    &lex->value_list,
+			    select_lex->where,
+			    select_lex->options,
+			    lex->duplicates, lex->ignore, unit, select_lex);
     {
       if ((res= multi_update_precheck(thd, all_tables)))
         break;

--- 1.388/sql/sql_select.cc	2006-01-24 07:48:13 -05:00
+++ 1.389/sql/sql_select.cc	2006-01-27 16:30:51 -05:00
@@ -6015,6 +6015,20 @@
       problems in free_elements() as some of the elements are then deleted.
     */
     tmp_table_param.copy_funcs.empty();
+    /*
+      If we have tmp_join and 'this' JOIN is not tmp_join and
+      tmp_table_param.copy_field's  of them are equal then we have to remove
+      pointer to  tmp_table_param.copy_field from tmp_join, because it qill
+      be removed in tmp_table_param.cleanup().
+    */
+    if (tmp_join &&
+        tmp_join != this &&
+        tmp_join->tmp_table_param.copy_field ==
+        tmp_table_param.copy_field)
+    {
+      tmp_join->tmp_table_param.copy_field=
+        tmp_join->tmp_table_param.save_copy_field= 0;
+    }
     tmp_table_param.cleanup();
   }
   DBUG_VOID_RETURN;

--- 1.104/sql/sql_select.h	2005-12-07 09:01:08 -05:00
+++ 1.105/sql/sql_select.h	2006-01-27 16:30:51 -05:00
@@ -285,7 +285,14 @@
   {
     init(thd_arg, fields_arg, select_options_arg, result_arg);
   }
-  
+
+  JOIN(JOIN &join)
+    :fields_list(join.fields_list)
+  {
+    init(join.thd, join.fields_list, join.select_options,
+         join.result);
+  }
+
   void init(THD *thd_arg, List<Item> &fields_arg, ulonglong select_options_arg,
        select_result *result_arg)
   {
@@ -332,7 +339,7 @@
     all_fields= fields_arg;
     fields_list= fields_arg;
     bzero((char*) &keyuse,sizeof(keyuse));
-    tmp_table_param.copy_field=0;
+    tmp_table_param.init();
     tmp_table_param.end_write_records= HA_POS_ERROR;
     rollup.state= ROLLUP::STATE_NONE;
   }

--- 1.183/sql/sql_update.cc	2005-12-28 09:20:17 -05:00
+++ 1.184/sql/sql_update.cc	2006-01-27 17:23:12 -05:00
@@ -308,7 +308,6 @@
       SORT_FIELD  *sortorder;
       ha_rows examined_rows;
 
-      used_index= MAX_KEY;                   // For call to init_read_record()
       table->sort.io_cache = (IO_CACHE *) my_malloc(sizeof(IO_CACHE),
 						    MYF(MY_FAE | MY_ZEROFILL));
       if (!(sortorder=make_unireg_sortorder(order, &length)) ||
@@ -339,6 +338,16 @@
       if (open_cached_file(&tempfile, mysql_tmpdir,TEMP_PREFIX,
 			   DISK_BUFFER_SIZE, MYF(MY_WME)))
 	goto err;
+      /*
+        When we get here, we have one of the following options:
+        A. used_index == MAX_KEY
+           This means we should use full table scan, and start it with
+           init_read_record call
+        B. used_index != MAX_KEY
+           B.1 quick select is used, start the scan with init_read_record
+           B.2 quick select is not used, this is full index scan (with LIMIT)
+               Full index scan must be started with init_read_record_idx
+      */
       
       /* If quick select is used, initialize it before retrieving rows. */
       if (select && select->quick && select->quick->reset())

--- 1.18/mysql-test/r/date_formats.result	2005-10-27 13:04:31 -04:00
+++ 1.19/mysql-test/r/date_formats.result	2006-01-27 16:30:49 -05:00
@@ -503,3 +503,12 @@
 02	February
 01	January
 drop table t1;
+select str_to_date( 1, NULL );
+str_to_date( 1, NULL )
+NULL
+select str_to_date( NULL, 1 );
+str_to_date( NULL, 1 )
+NULL
+select str_to_date( 1, IF(1=1,NULL,NULL) );
+str_to_date( 1, IF(1=1,NULL,NULL) )
+NULL

--- 1.14/mysql-test/t/date_formats.test	2005-10-27 13:04:32 -04:00
+++ 1.15/mysql-test/t/date_formats.test	2006-01-27 16:30:50 -05:00
@@ -269,4 +269,11 @@
 insert into t1 (f1) values ("2005-02-01");
 select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
 drop table t1;
+
+#
+# Bug #15828
+#
+select str_to_date( 1, NULL );
+select str_to_date( NULL, 1 );
+select str_to_date( 1, IF(1=1,NULL,NULL) );
 # End of 4.1 tests

--- 1.19/ndb/include/mgmapi/mgmapi_config_parameters.h	2005-10-12 08:17:28 -04:00
+++ 1.20/ndb/include/mgmapi/mgmapi_config_parameters.h	2006-01-27 16:30:50 -05:00
@@ -85,6 +85,11 @@
 #define CFG_DB_BACKUP_DATADIR         158
 
 #define CFG_DB_MAX_OPEN_FILES         159
+#define CFG_DB_DISK_PAGE_BUFFER_MEMORY 160 /* used from 5.1 */
+#define CFG_DB_STRING_MEMORY          161 /* used from 5.1 */
+#define CFG_DB_INITIAL_OPEN_FILES     162 /* used from 5.1 */
+
+#define CFG_DB_DATA_MEM_2             199 /* used in special build in 5.1 */
 
 #define CFG_NODE_ARBIT_RANK           200
 #define CFG_NODE_ARBIT_DELAY          201

--- 1.29/mysql-test/r/update.result	2005-12-02 11:32:56 -05:00
+++ 1.30/mysql-test/r/update.result	2006-01-27 16:30:49 -05:00
@@ -358,3 +358,22 @@
 affected rows: 3
 info: Rows matched: 3  Changed: 3  Warnings: 0
 drop table t1,t2;
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
+insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
+flush status;
+update t2 set a=3 where a=2;
+show status like 'handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	1
+Handler_read_next	1
+Handler_read_prev	0
+Handler_read_rnd	1
+Handler_read_rnd_next	0
+drop table t1, t2;
+create table t1(f1 int, `*f2` int);
+insert into t1 values (1,1);
+update t1 set `*f2`=1;
+drop table t1;

--- 1.30/mysql-test/t/heap.test	2005-08-09 04:21:41 -04:00
+++ 1.31/mysql-test/t/heap.test	2006-01-27 16:30:50 -05:00
@@ -436,6 +436,17 @@
 insert into t1 values ("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
 drop table t1;
 
+#
+# Bug 12796: Record doesn't show when selecting through index
+#
+CREATE TABLE t1 (a int, key(a)) engine=heap;
+insert delayed into t1 values (0);
+delete from t1;
+select * from t1;
+insert delayed into t1 values (0), (1);
+select * from t1 where a = 0;
+drop table t1;
+
 # End of 4.1 tests
 
 #

--- 1.27/mysql-test/t/update.test	2005-12-02 11:32:56 -05:00
+++ 1.28/mysql-test/t/update.test	2006-01-27 16:30:50 -05:00
@@ -287,4 +287,23 @@
 update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
 --disable_info
 drop table t1,t2;
+
+
+# BUG#15935
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, filler1 char(200), filler2 char(200), key(a));
+insert into t2 select A.a + 10*B.a, 'filler','filler' from t1 A, t1 B;
+flush status;
+update t2 set a=3 where a=2;
+show status like 'handler_read%';
+drop table t1, t2;
+
+#
+# Bug #16510 Updating field named like '*name' caused server crash
+#
+create table t1(f1 int, `*f2` int);
+insert into t1 values (1,1);
+update t1 set `*f2`=1;
+drop table t1;
 # End of 4.1 tests

--- 1.71/mysql-test/r/myisam.result	2005-11-16 04:13:05 -05:00
+++ 1.72/mysql-test/r/myisam.result	2006-01-27 16:30:49 -05:00
@@ -567,7 +567,7 @@
 Note	1031	Table storage engine for 't1' doesn't have this option
 show keys from t1;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	1	a	1	a	NULL	1000	NULL	NULL	YES	HASH	
+t1	1	a	1	a	NULL	500	NULL	NULL	YES	HASH	
 drop table t1,t2;
 create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
 insert into t1 values (null,''), (null,'');

--- 1.18/mysql-test/t/kill.test	2006-01-05 17:47:40 -05:00
+++ 1.19/mysql-test/t/kill.test	2006-01-27 16:30:50 -05:00
@@ -12,7 +12,7 @@
 #remember id of con1
 connection con1;
 --disable_warnings
-drop table if exists t1;
+drop table if exists t1, t2, t3;
 --enable_warnings
 
 --disable_reconnect
@@ -46,6 +46,53 @@
 connection con2;
 select 4;
 drop table t1;
+
+disconnect con2;
+connection default;
+#
+# BUG#14851: killing long running subquery processed via a temporary table.
+#
+create table t1 (id int primary key);
+create table t2 (id int unsigned not null);
+
+connect (conn1, localhost, root,,);
+connection conn1;
+
+-- disable_result_log
+-- disable_query_log
+let $1 = 4096;
+while ($1)
+{
+  eval insert into t1 values ($1);
+  dec $1;
+}
+-- enable_query_log
+-- enable_result_log
+
+insert into t2 select id from t1;
+
+create table t3 (kill_id int);
+insert into t3 values(connection_id());
+
+-- disable_result_log
+send select id from t1 where id in (select distinct id from t2);
+-- enable_result_log
+
+connect (conn2, localhost, root,,);
+connection conn2;
+select ((@id := kill_id) - kill_id) from t3;
+-- sleep 1
+kill @id;
+
+connection conn1;
+-- error 1053
+reap;
+
+disconnect conn1;
+disconnect conn2;
+connection default;
+
+drop table t1, t2, t3;
 
 # End of 4.1 tests
 
Thread
bk commit into 5.0 tree (elliot:1.2010)Elliot Murphy27 Jan