List:Internals« Previous MessageNext Message »
From:monty Date:November 24 2005 3:08am
Subject:bk commit into 5.1 tree (monty:1.1966)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of monty. When monty 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.1966 05/11/24 04:08:07 monty@stripped +11 -0
  Merge mysql.com:/home/my/mysql-5.1
  into  mysql.com:/home/my/mysql-5.1-TDC

  sql/unireg.h
    1.45 05/11/24 04:08:03 monty@stripped +0 -0
    Auto merged

  sql/examples/ha_tina.h
    1.9 05/11/24 04:08:03 monty@stripped +0 -0
    Auto merged

  sql/examples/ha_tina.cc
    1.24 05/11/24 04:08:03 monty@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.487 05/11/24 04:08:02 monty@stripped +0 -0
    Auto merged

  sql/sql_insert.cc
    1.175 05/11/24 04:08:02 monty@stripped +0 -0
    Auto merged

  sql/sql_class.cc
    1.222 05/11/24 04:08:02 monty@stripped +0 -0
    Auto merged

  sql/sql_base.cc
    1.281 05/11/24 04:08:02 monty@stripped +0 -0
    Auto merged

  sql/sql_acl.cc
    1.163 05/11/24 04:08:02 monty@stripped +0 -0
    Auto merged

  sql/slave.cc
    1.259 05/11/24 04:08:02 monty@stripped +0 -0
    Auto merged

  sql/mysql_priv.h
    1.346 05/11/24 04:08:02 monty@stripped +0 -0
    Auto merged

  sql/ha_federated.cc
    1.44 05/11/24 04:08:01 monty@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:	monty
# Host:	narttu.mysql.fi
# Root:	/home/my/mysql-5.1-TDC/RESYNC

--- 1.345/sql/mysql_priv.h	2005-11-23 22:44:56 +02:00
+++ 1.346/sql/mysql_priv.h	2005-11-24 04:08:02 +02:00
@@ -101,6 +101,7 @@
 #define MAX_FIELDS_BEFORE_HASH	32
 #define USER_VARS_HASH_SIZE     16
 #define STACK_MIN_SIZE		8192	// Abort if less stack during eval.
+#define STACK_MIN_SIZE_FOR_OPEN 1024*80
 #define STACK_BUFF_ALLOC	256	// For stack overrun checks
 #ifndef MYSQLD_NET_RETRY_COUNT
 #define MYSQLD_NET_RETRY_COUNT  10	// Abort read after this many int.

--- 1.258/sql/slave.cc	2005-11-23 22:47:28 +02:00
+++ 1.259/sql/slave.cc	2005-11-24 04:08:02 +02:00
@@ -3070,6 +3070,7 @@
   THD_CHECK_SENTRY(thd);
 
   pthread_detach_this_thread();
+  thd->thread_stack= (char*) &thd; // remember where our stack is
   if (init_slave_thread(thd, SLAVE_THD_IO))
   {
     pthread_cond_broadcast(&mi->start_cond);
@@ -3078,7 +3079,6 @@
     goto err;
   }
   mi->io_thd = thd;
-  thd->thread_stack = (char*)&thd; // remember where our stack is
   pthread_mutex_lock(&LOCK_thread_count);
   threads.append(thd);
   pthread_mutex_unlock(&LOCK_thread_count);

--- 1.162/sql/sql_acl.cc	2005-11-23 22:47:28 +02:00
+++ 1.163/sql/sql_acl.cc	2005-11-24 04:08:02 +02:00
@@ -157,6 +157,7 @@
   */
   if (!(thd=new THD))
     DBUG_RETURN(1); /* purecov: inspected */
+  thd->thread_stack= (char*) &thd;
   thd->store_globals();
   /*
     It is safe to call acl_reload() since acl_* arrays and hashes which
@@ -3263,6 +3264,7 @@
 
   if (!(thd= new THD))
     DBUG_RETURN(1);				/* purecov: deadcode */
+  thd->thread_stack= (char*) &thd;
   thd->store_globals();
   return_val=  grant_reload(thd);
   delete thd;

--- 1.280/sql/sql_base.cc	2005-11-23 22:58:50 +02:00
+++ 1.281/sql/sql_base.cc	2005-11-24 04:08:02 +02:00
@@ -1693,7 +1693,7 @@
     *refresh=0;
 
   /* an open table operation needs a lot of the stack space */
-  if (check_stack_overrun(thd, 8 * STACK_MIN_SIZE, (char *)&alias))
+  if (check_stack_overrun(thd, STACK_MIN_SIZE_FOR_OPEN, (char *)&alias))
     return 0;
 
   if (thd->killed)

--- 1.221/sql/sql_class.cc	2005-11-23 22:47:29 +02:00
+++ 1.222/sql/sql_class.cc	2005-11-24 04:08:02 +02:00
@@ -517,6 +517,12 @@
 
 bool THD::store_globals()
 {
+  /*
+    Assert that thread_stack is initialized: it's necessary to be able
+    to track stack overrun.
+  */
+  DBUG_ASSERT(this->thread_stack);
+
   if (my_pthread_setspecific_ptr(THR_THD,  this) ||
       my_pthread_setspecific_ptr(THR_MALLOC, &mem_root))
     return 1;

--- 1.174/sql/sql_insert.cc	2005-11-23 22:44:57 +02:00
+++ 1.175/sql/sql_insert.cc	2005-11-24 04:08:02 +02:00
@@ -1733,6 +1733,7 @@
 #endif
 
   DBUG_ENTER("handle_delayed_insert");
+  thd->thread_stack= (char*) &thd;
   if (init_thr_lock() || thd->store_globals())
   {
     thd->fatal_error();

--- 1.486/sql/sql_parse.cc	2005-11-23 22:47:29 +02:00
+++ 1.487/sql/sql_parse.cc	2005-11-24 04:08:02 +02:00
@@ -1091,6 +1091,7 @@
   VOID(sigemptyset(&set));			// Get mask in use
   VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
 #endif
+  thd->thread_stack= (char*) &thd;
   if (thd->store_globals())
   {
     close_connection(thd, ER_OUT_OF_RESOURCES, 1);
@@ -1104,7 +1105,6 @@
     int error;
     NET *net= &thd->net;
     Security_context *sctx= thd->security_ctx;
-    thd->thread_stack= (char*) &thd;
     net->no_send_error= 0;
 
     if ((error=check_connection(thd)))
@@ -1195,6 +1195,7 @@
   char *buff;
 
   /* The following must be called before DBUG_ENTER */
+  thd->thread_stack= (char*) &thd;
   if (my_thread_init() || thd->store_globals())
   {
 #ifndef EMBEDDED_LIBRARY
@@ -5287,6 +5288,7 @@
 			 char *buf __attribute__((unused)))
 {
   long stack_used;
+  DBUG_ASSERT(thd == current_thd);
   if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >=
       (long) (thread_stack - margin))
   {
@@ -6740,7 +6742,10 @@
       allocate temporary THD for execution of acl_reload()/grant_reload().
     */
     if (!thd && (thd= (tmp_thd= new THD)))
+    {
+      thd->thread_stack= (char*) &tmp_thd;
       thd->store_globals();
+    }
     if (thd)
     {
       (void)acl_reload(thd);

--- 1.44/sql/unireg.h	2005-11-23 22:44:57 +02:00
+++ 1.45/sql/unireg.h	2005-11-24 04:08:03 +02:00
@@ -46,8 +46,8 @@
 
 #define ERRMAPP 1				/* Errormap f|r my_error */
 #define LIBLEN FN_REFLEN-FN_LEN			/* Max l{ngd p} dev */
-#define MAX_DBKEY_LENGTH (FN_LEN*2+1+1+4+4)     /* extra 4+4 bytes for slave tmp
-						 * tables */
+/* extra 4+4 bytes for slave tmp tables */
+#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
 #define MAX_ALIAS_NAME 256
 #define MAX_FIELD_NAME 34			/* Max colum name length +2 */
 #define MAX_SYS_VAR_LENGTH 32

--- 1.23/sql/examples/ha_tina.cc	2005-11-23 22:44:54 +02:00
+++ 1.24/sql/examples/ha_tina.cc	2005-11-24 04:08:03 +02:00
@@ -298,7 +298,7 @@
     They are not probably completely right.
   */
   current_position(0), next_position(0), chain_alloced(0),
-  chain_size(DEFAULT_CHAIN_LENGTH)
+  chain_size(DEFAULT_CHAIN_LENGTH), records_is_known(0)
 {
   /* Set our original buffers from pre-allocated memory */
   buffer.set(byte_buffer, IO_SIZE, system_charset_info);
@@ -535,6 +535,7 @@
   */
   if (get_mmap(share, 0) > 0)
     DBUG_RETURN(-1);
+  records++;
   DBUG_RETURN(0);
 }
 
@@ -701,6 +702,7 @@
 
   current_position= next_position= 0;
   records= 0;
+  records_is_known= 0;
   chain_ptr= chain;
 #ifdef HAVE_MADVISE
   if (scan)
@@ -782,7 +784,7 @@
 {
   DBUG_ENTER("ha_tina::info");
   /* This is a lie, but you don't want the optimizer to see zero or 1 */
-  if (records < 2)
+  if (!records_is_known && records < 2) 
     records= 2;
   DBUG_VOID_RETURN;
 }
@@ -819,6 +821,8 @@
 {
   DBUG_ENTER("ha_tina::rnd_end");
 
+  records_is_known= 1;
+
   /* First position will be truncate position, second will be increment */
   if ((chain_ptr - chain)  > 0)
   {
@@ -863,18 +867,24 @@
   DBUG_RETURN(0);
 }
 
-/*
-  Truncate table and others of its ilk call this.
+
+/* 
+  DELETE without WHERE calls this
 */
+
 int ha_tina::delete_all_rows()
 {
   DBUG_ENTER("ha_tina::delete_all_rows");
 
+  if (!records_is_known)
+    return (my_errno=HA_ERR_WRONG_COMMAND);
+
   int rc= my_chsize(share->data_file, 0, 0, MYF(MY_WME));
 
   if (get_mmap(share, 0) > 0)
     DBUG_RETURN(-1);
 
+  records=0;
   DBUG_RETURN(rc);
 }
 

--- 1.8/sql/examples/ha_tina.h	2005-11-23 22:44:54 +02:00
+++ 1.9/sql/examples/ha_tina.h	2005-11-24 04:08:03 +02:00
@@ -53,6 +53,7 @@
   tina_set *chain_ptr;
   byte chain_alloced;
   uint32 chain_size;
+  bool records_is_known;
 
 public:
   ha_tina(TABLE_SHARE *table_arg);

--- 1.43/sql/ha_federated.cc	2005-11-23 22:47:26 +02:00
+++ 1.44/sql/ha_federated.cc	2005-11-24 04:08:01 +02:00
@@ -483,8 +483,7 @@
     table, and if so, does the foreign table exist.
 */
 
-static int check_foreign_data_source(
-                                     FEDERATED_SHARE *share,
+static int check_foreign_data_source(FEDERATED_SHARE *share,
                                      bool table_create_flag)
 {
   char escaped_table_name[NAME_LEN*2];
@@ -510,15 +509,17 @@
                           share->port,
                           share->socket, 0))
   {
-      /*
-        we want the correct error message, but it to return
-        ER_CANT_CREATE_FEDERATED_TABLE if called by ::create
-      */
-    error_code= table_create_flag?
-      ER_CANT_CREATE_FEDERATED_TABLE : ER_CONNECT_TO_FOREIGN_DATA_SOURCE;
+    /*
+      we want the correct error message, but it to return
+      ER_CANT_CREATE_FEDERATED_TABLE if called by ::create
+    */
+    error_code= (table_create_flag ?
+                 ER_CANT_CREATE_FEDERATED_TABLE :
+                 ER_CONNECT_TO_FOREIGN_DATA_SOURCE);
 
     my_sprintf(error_buffer,
-               (error_buffer, " database %s username %s hostname %s",
+               (error_buffer,
+                "database: '%s'  username: '%s'  hostname: '%s'",
                 share->database, share->username, share->hostname));
 
     my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), error_buffer);
@@ -559,8 +560,8 @@
     {
       error_code= table_create_flag ?
         ER_CANT_CREATE_FEDERATED_TABLE : ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST;
-      my_sprintf(error_buffer, (error_buffer, ": %d : %s",
-                mysql_errno(mysql), mysql_error(mysql)));
+      my_sprintf(error_buffer, (error_buffer, "error: %d  '%s'",
+                                mysql_errno(mysql), mysql_error(mysql)));
 
       my_error(error_code, MYF(0), error_buffer);
       goto error;
@@ -2026,7 +2027,7 @@
   }
   if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length()))
   {
-    my_sprintf(error_buffer, (error_buffer, ": %d : %s",
+    my_sprintf(error_buffer, (error_buffer, "error: %d '%s'",
                               mysql_errno(mysql), mysql_error(mysql)));
     retval= ER_QUERY_ON_FOREIGN_DATA_SOURCE;
     goto error;
Thread
bk commit into 5.1 tree (monty:1.1966)monty24 Nov