List:Internals« Previous MessageNext Message »
From:jonas Date:September 7 2005 2:59pm
Subject:bk commit into 5.1 tree (jonas:1.1993)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas 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.1993 05/09/07 14:59:38 jonas@eel.(none) +13 -0
  Merge eel.(none):/home/jonas/src/mysql-5.1-push
  into  eel.(none):/home/jonas/src/mysql-5.1-ndb-dd

  storage/ndb/tools/restore/consumer_restore.cpp
    1.20 05/09/07 14:59:32 jonas@eel.(none) +0 -0
    Auto merged

  storage/ndb/tools/ndb_condig.cpp
    1.9 05/09/07 14:59:32 jonas@eel.(none) +0 -0
    Auto merged

  storage/ndb/src/mgmsrv/ConfigInfo.cpp
    1.68 05/09/07 14:59:32 jonas@eel.(none) +0 -0
    Auto merged

  storage/ndb/src/kernel/error/ErrorReporter.cpp
    1.13 05/09/07 14:59:32 jonas@eel.(none) +0 -0
    Auto merged

  storage/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
    1.26 05/09/07 14:59:32 jonas@eel.(none) +0 -0
    Auto merged

  sql/sql_yacc.yy
    1.374 05/09/07 14:59:31 jonas@eel.(none) +0 -0
    Auto merged

  sql/sql_select.cc
    1.330 05/09/07 14:59:31 jonas@eel.(none) +0 -0
    Auto merged

  sql/sql_parse.cc
    1.435 05/09/07 14:59:31 jonas@eel.(none) +0 -0
    Auto merged

  sql/sql_cache.cc
    1.83 05/09/07 14:59:31 jonas@eel.(none) +0 -0
    Auto merged

  sql/mysqld.cc
    1.457 05/09/07 14:59:30 jonas@eel.(none) +0 -0
    Auto merged

  sql/mysql_priv.h
    1.301 05/09/07 14:59:30 jonas@eel.(none) +0 -0
    Auto merged

  sql/ha_federated.cc
    1.30 05/09/07 14:59:30 jonas@eel.(none) +0 -0
    Auto merged

  configure.in
    1.272 05/09/07 14:59:30 jonas@eel.(none) +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:	jonas
# Host:	eel.(none)
# Root:	/home/jonas/src/mysql-5.1-ndb-dd/RESYNC

--- 1.300/sql/mysql_priv.h	2005-09-06 12:58:29 +02:00
+++ 1.301/sql/mysql_priv.h	2005-09-07 14:59:30 +02:00
@@ -552,6 +552,7 @@
 #define query_cache_store_query(A, B) query_cache.store_query(A, B)
 #define query_cache_destroy() query_cache.destroy()
 #define query_cache_result_size_limit(A) query_cache.result_size_limit(A)
+#define query_cache_init() query_cache.init()
 #define query_cache_resize(A) query_cache.resize(A)
 #define query_cache_set_min_res_unit(A) query_cache.set_min_res_unit(A)
 #define query_cache_invalidate3(A, B, C) query_cache.invalidate(A, B, C)
@@ -565,6 +566,7 @@
 #define query_cache_store_query(A, B)
 #define query_cache_destroy()
 #define query_cache_result_size_limit(A)
+#define query_cache_init()
 #define query_cache_resize(A)
 #define query_cache_set_min_res_unit(A)
 #define query_cache_invalidate3(A, B, C)
@@ -1176,6 +1178,7 @@
 extern bool using_update_log, opt_large_files, server_id_supplied;
 extern bool opt_log, opt_update_log, opt_bin_log, opt_slow_log, opt_error_log;
 extern bool opt_disable_networking, opt_skip_show_db;
+extern bool opt_character_set_client_handshake;
 extern bool volatile abort_loop, shutdown_in_progress, grant_option;
 extern bool mysql_proc_table_exists;
 extern uint volatile thread_count, thread_running, global_read_lock;

--- 1.456/sql/mysqld.cc	2005-09-06 12:58:29 +02:00
+++ 1.457/sql/mysqld.cc	2005-09-07 14:59:30 +02:00
@@ -339,6 +339,7 @@
 bool opt_log, opt_update_log, opt_bin_log, opt_slow_log;
 bool opt_error_log= IF_WIN(1,0);
 bool opt_disable_networking=0, opt_skip_show_db=0;
+bool opt_character_set_client_handshake= 1;
 bool server_id_supplied = 0;
 bool opt_endinfo,using_udf_functions, locked_in_memory;
 bool opt_using_transactions, using_update_log;
@@ -2783,6 +2784,7 @@
 
   query_cache_result_size_limit(query_cache_limit);
   query_cache_set_min_res_unit(query_cache_min_res_unit);
+  query_cache_init();
   query_cache_resize(query_cache_size);
   randominit(&sql_rand,(ulong) start_time,(ulong) start_time/2);
   reset_floating_point_exceptions();
@@ -4423,6 +4425,7 @@
   OPT_EXPIRE_LOGS_DAYS,
   OPT_GROUP_CONCAT_MAX_LEN,
   OPT_DEFAULT_COLLATION,
+  OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
   OPT_INIT_CONNECT,
   OPT_INIT_SLAVE,
   OPT_SECURE_AUTH,
@@ -4524,6 +4527,11 @@
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"bootstrap", OPT_BOOTSTRAP, "Used by mysql installation scripts.", 0, 0, 0,
    GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"character-set-client-handshake", OPT_CHARACTER_SET_CLIENT_HANDSHAKE,
+   "Don't use client side character set value sent during handshake.",
+   (gptr*) &opt_character_set_client_handshake,
+   (gptr*) &opt_character_set_client_handshake,
+    0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
   {"character-set-server", 'C', "Set the default character set.",
    (gptr*) &default_character_set_name, (gptr*) &default_character_set_name,
    0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },

--- 1.82/sql/sql_cache.cc	2005-08-27 07:49:55 +02:00
+++ 1.83/sql/sql_cache.cc	2005-09-07 14:59:31 +02:00
@@ -573,13 +573,18 @@
 {
   DBUG_ENTER("query_cache_insert");
 
-#ifndef DBUG_OFF
-  // Check if we have called query_cache.wreck() (which disables the cache)
-  if (query_cache.query_cache_size == 0)
+  STRUCT_LOCK(&query_cache.structure_guard_mutex);
+  /*
+    It is very unlikely that following condition is TRUE (it is possible
+    only if other thread is resizing cache), so we check it only after guard
+    mutex lock
+  */
+  if (unlikely(query_cache.query_cache_size == 0))
+  {
+    STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
     DBUG_VOID_RETURN;
-#endif
+  }
 
-  STRUCT_LOCK(&query_cache.structure_guard_mutex);
   Query_cache_block *query_block = ((Query_cache_block*)
 				    net->query_cache_query);
   if (query_block)
@@ -623,14 +628,20 @@
 {
   DBUG_ENTER("query_cache_abort");
 
-#ifndef DBUG_OFF
-  // Check if we have called query_cache.wreck() (which disables the cache)
-  if (query_cache.query_cache_size == 0)
-    DBUG_VOID_RETURN;
-#endif
   if (net->query_cache_query != 0)	// Quick check on unlocked structure
   {
     STRUCT_LOCK(&query_cache.structure_guard_mutex);
+    /*
+      It is very unlikely that following condition is TRUE (it is possible
+      only if other thread is resizing cache), so we check it only after guard
+      mutex lock
+    */
+    if (unlikely(query_cache.query_cache_size == 0))
+    {
+      STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
+      DBUG_VOID_RETURN;
+    }
+
     Query_cache_block *query_block = ((Query_cache_block*)
 				       net->query_cache_query);
     if (query_block)			// Test if changed by other thread
@@ -652,11 +663,6 @@
 {
   DBUG_ENTER("query_cache_end_of_result");
 
-#ifndef DBUG_OFF
-  // Check if we have called query_cache.wreck() (which disables the cache)
-  if (query_cache.query_cache_size == 0) DBUG_VOID_RETURN;
-#endif
-
   if (thd->net.query_cache_query != 0)	// Quick check on unlocked structure
   {
 #ifdef EMBEDDED_LIBRARY
@@ -664,6 +670,17 @@
 		       emb_count_querycache_size(thd));
 #endif
     STRUCT_LOCK(&query_cache.structure_guard_mutex);
+    /*
+      It is very unlikely that following condition is TRUE (it is possible
+      only if other thread is resizing cache), so we check it only after guard
+      mutex lock
+    */
+    if (unlikely(query_cache.query_cache_size == 0))
+    {
+      STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
+      DBUG_VOID_RETURN;
+    }
+
     Query_cache_block *query_block = ((Query_cache_block*)
 				      thd->net.query_cache_query);
     if (query_block)
@@ -743,9 +760,14 @@
   DBUG_ENTER("Query_cache::resize");
   DBUG_PRINT("qcache", ("from %lu to %lu",query_cache_size,
 			query_cache_size_arg));
-  free_cache(0);
+  DBUG_ASSERT(initialized);
+  STRUCT_LOCK(&structure_guard_mutex);
+  if (query_cache_size > 0)
+    free_cache();
   query_cache_size= query_cache_size_arg;
-  DBUG_RETURN(::query_cache_size= init_cache());
+  ::query_cache_size= init_cache();
+  STRUCT_UNLOCK(&structure_guard_mutex);
+  DBUG_RETURN(::query_cache_size);
 }
 
 
@@ -1438,7 +1460,7 @@
   }
   else
   {
-    free_cache(1);
+    free_cache();
     pthread_mutex_destroy(&structure_guard_mutex);
     initialized = 0;
   }
@@ -1467,8 +1489,6 @@
   int align;
 
   DBUG_ENTER("Query_cache::init_cache");
-  if (!initialized)
-    init();
   approx_additional_data_size = (sizeof(Query_cache) +
 				 sizeof(gptr)*(def_query_hash_size+
 					       def_table_hash_size));
@@ -1526,14 +1546,9 @@
     goto err;
   query_cache_size -= additional_data_size;
 
-  STRUCT_LOCK(&structure_guard_mutex);
-
-  if (!(cache = (byte *)
-	 my_malloc_lock(query_cache_size+additional_data_size, MYF(0))))
-  {
-    STRUCT_UNLOCK(&structure_guard_mutex);
+  if (!(cache= (byte *)
+        my_malloc_lock(query_cache_size+additional_data_size, MYF(0))))
     goto err;
-  }
 
   DBUG_PRINT("qcache", ("cache length %lu, min unit %lu, %u bins",
 		      query_cache_size, min_allocation_unit, mem_bin_num));
@@ -1629,7 +1644,6 @@
 
   queries_in_cache = 0;
   queries_blocks = 0;
-  STRUCT_UNLOCK(&structure_guard_mutex);
   DBUG_RETURN(query_cache_size +
 	      additional_data_size + approx_additional_data_size);
 
@@ -1645,6 +1659,7 @@
 {
   DBUG_ENTER("Query_cache::make_disabled");
   query_cache_size= 0;
+  queries_blocks= 0;
   free_memory= 0;
   bins= 0;
   steps= 0;
@@ -1656,14 +1671,11 @@
 }
 
 
-void Query_cache::free_cache(my_bool destruction)
+void Query_cache::free_cache()
 {
   DBUG_ENTER("Query_cache::free_cache");
   if (query_cache_size > 0)
   {
-    if (!destruction)
-      STRUCT_LOCK(&structure_guard_mutex);
-
     flush_cache();
 #ifndef DBUG_OFF
     if (bins[0].free_blocks == 0)
@@ -1685,8 +1697,6 @@
     make_disabled();
     hash_free(&queries);
     hash_free(&tables);
-    if (!destruction)
-      STRUCT_UNLOCK(&structure_guard_mutex);
   }
   DBUG_VOID_RETURN;
 }
@@ -2401,7 +2411,19 @@
   }
 
   if (!under_guard)
+  {
     STRUCT_LOCK(&structure_guard_mutex);
+    /*
+      It is very unlikely that following condition is TRUE (it is possible
+      only if other thread is resizing cache), so we check it only after
+      guard mutex lock
+    */
+    if (unlikely(query_cache.query_cache_size == 0))
+    {
+      STRUCT_UNLOCK(&structure_guard_mutex);
+      DBUG_RETURN(0);
+    }
+  }
 
   /* Free old queries until we have enough memory to store this block */
   Query_cache_block *block;
@@ -2947,6 +2969,17 @@
 {
   DBUG_ENTER("Query_cache::pack_cache");
   STRUCT_LOCK(&structure_guard_mutex);
+  /*
+    It is very unlikely that following condition is TRUE (it is possible
+    only if other thread is resizing cache), so we check it only after
+    guard mutex lock
+  */
+  if (unlikely(query_cache_size == 0))
+  {
+    STRUCT_UNLOCK(&structure_guard_mutex);
+    DBUG_VOID_RETURN;
+  }
+
   DBUG_EXECUTE("check_querycache",query_cache.check_integrity(1););
 
   byte *border = 0;
@@ -3256,6 +3289,7 @@
   STRUCT_LOCK(&structure_guard_mutex);
   if (queries_blocks != 0)
   {
+    DBUG_ASSERT(query_cache_size > 0);
     Query_cache_block *block = queries_blocks;
     do
     {
@@ -3552,7 +3586,19 @@
     DBUG_RETURN(0);
   }
   if (!not_locked)
+  {
     STRUCT_LOCK(&structure_guard_mutex);
+    /*
+      It is very unlikely that following condition is TRUE (it is possible
+      only if other thread is resizing cache), so we check it only after
+      guard mutex lock
+    */
+    if (unlikely(query_cache_size == 0))
+    {
+      STRUCT_UNLOCK(&query_cache.structure_guard_mutex);
+      DBUG_RETURN(0);
+    }
+  }
 
   if (hash_check(&queries))
   {

--- 1.434/sql/sql_parse.cc	2005-09-06 12:58:29 +02:00
+++ 1.435/sql/sql_parse.cc	2005-09-07 14:59:31 +02:00
@@ -879,11 +879,13 @@
     DBUG_PRINT("info", ("client_character_set: %d", (uint) net->read_pos[8]));
     /*
       Use server character set and collation if
+      - opt_character_set_client_handshake is not set
       - client has not specified a character set
       - client character set is the same as the servers
       - client character set doesn't exists in server
     */
-    if (!(thd->variables.character_set_client=
+    if (!opt_character_set_client_handshake ||
+        !(thd->variables.character_set_client=
 	  get_charset((uint) net->read_pos[8], MYF(0))) ||
 	!my_strcasecmp(&my_charset_latin1,
 		       global_system_variables.character_set_client->name,

--- 1.329/sql/sql_select.cc	2005-09-06 12:58:30 +02:00
+++ 1.330/sql/sql_select.cc	2005-09-07 14:59:31 +02:00
@@ -8069,12 +8069,17 @@
                         bool table_cant_handle_bit_fields,
                         uint convert_blob_length)
 {
+  Item::Type orig_type;
+  Item *orig_item;
+
   if (type != Item::FIELD_ITEM &&
       item->real_item()->type() == Item::FIELD_ITEM &&
       (item->type() != Item::REF_ITEM ||
        !((Item_ref *) item)->depended_from))
   {
+    orig_item= item;
     item= item->real_item();
+    orig_type= type;
     type= Item::FIELD_ITEM;
   }
   switch (type) {
@@ -8090,29 +8095,34 @@
   case Item::DEFAULT_VALUE_ITEM:
   {
     Item_field *field= (Item_field*) item;
+    bool orig_modify= modify_item;
+    Field *result;
+    if (orig_type == Item::REF_ITEM)
+      modify_item= 0;
     /*
       If item have to be able to store NULLs but underlaid field can't do it,
       create_tmp_field_from_field() can't be used for tmp field creation.
     */
     if (field->maybe_null && !field->field->maybe_null())
     {
-      Field *res= create_tmp_field_from_item(thd, item, table, NULL,
+      result= create_tmp_field_from_item(thd, item, table, NULL,
                                        modify_item, convert_blob_length);
       *from_field= field->field;
-      if (res && modify_item)
-        ((Item_field*)item)->result_field= res;
-      return res;
-    }
-
-    if (table_cant_handle_bit_fields && 
-        field->field->type() == FIELD_TYPE_BIT)
-      return create_tmp_field_from_item(thd, item, table, copy_func,
+      if (result && modify_item)
+        ((Item_field*)item)->result_field= result;
+    } 
+    else if (table_cant_handle_bit_fields && field->field->type() ==
FIELD_TYPE_BIT)
+      result= create_tmp_field_from_item(thd, item, table, copy_func,
                                         modify_item, convert_blob_length);
-    return create_tmp_field_from_field(thd, (*from_field= field->field),
+    else
+      result= create_tmp_field_from_field(thd, (*from_field= field->field),
                                        item->name, table,
                                        modify_item ? (Item_field*) item :
                                        NULL,
                                        convert_blob_length);
+    if (orig_type == Item::REF_ITEM && orig_modify)
+      ((Item_ref*)orig_item)->set_result_field(result);
+    return result;
   }
   /* Fall through */
   case Item::FUNC_ITEM:

--- 1.373/sql/sql_yacc.yy	2005-09-06 12:58:30 +02:00
+++ 1.374/sql/sql_yacc.yy	2005-09-07 14:59:31 +02:00
@@ -4825,6 +4825,11 @@
 	OPTIMIZE opt_no_write_to_binlog table_or_tables
 	{
 	   LEX *lex=Lex;
+	   if (lex->sphead)
+	   {
+	     my_error(ER_SP_BADSTATEMENT, MYF(0), "OPTIMIZE TABLE");
+	     YYABORT;
+	   }
 	   lex->sql_command = SQLCOM_OPTIMIZE;
            lex->no_write_to_binlog= $2;
 	   lex->check_opt.init();

--- 1.29/sql/ha_federated.cc	2005-08-09 09:49:30 +02:00
+++ 1.30/sql/ha_federated.cc	2005-09-07 14:59:30 +02:00
@@ -1935,6 +1935,8 @@
   {
     int error_code= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
     char error_buffer[FEDERATED_QUERY_BUFFER_SIZE];
+    my_sprintf(error_buffer, (error_buffer, ": %d : %s",
+              mysql_errno(mysql), mysql_error(mysql)));
     my_error(error_code, MYF(0), error_buffer);
     DBUG_RETURN(error_code);
   }
Thread
bk commit into 5.1 tree (jonas:1.1993)jonas7 Sep