List:Commits« Previous MessageNext Message »
From:holyfoot Date:October 23 2006 11:50am
Subject:bk commit into 5.0 tree (holyfoot:1.2289)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf 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-23 16:50:01+05:00, holyfoot@stripped +10 -0
  Merge mysql.com:/home/hf/work/w3475/my41-w3475
  into  mysql.com:/home/hf/work/w3475/my50-w3475
  MERGE: 1.1616.2144.183

  client/mysqltest.c@stripped, 2006-10-23 16:49:06+05:00, holyfoot@stripped +9 -24
    merging
    MERGE: 1.92.21.2

  libmysql/libmysql.c@stripped, 2006-10-23 16:49:54+05:00, holyfoot@stripped +0 -1
    merging
    MERGE: 1.156.1.149

  mysql-test/t/flush.test@stripped, 2006-10-23 15:31:51+05:00, holyfoot@stripped +0 -0
    Auto merged
    MERGE: 1.14.1.4

  mysql-test/t/flush_block_commit.test@stripped, 2006-10-23 15:31:51+05:00, holyfoot@stripped +0 -0
    Auto merged
    MERGE: 1.5.1.4

  mysql-test/t/innodb-deadlock.test@stripped, 2006-10-23 15:31:51+05:00, holyfoot@stripped +0 -0
    Auto merged
    MERGE: 1.7.1.3

  mysql-test/t/innodb-lock.test@stripped, 2006-10-23 15:31:51+05:00, holyfoot@stripped +0 -0
    Auto merged
    MERGE: 1.7.1.4

  mysql-test/t/lock_multi.test@stripped, 2006-10-23 15:31:51+05:00, holyfoot@stripped +0 -0
    Auto merged
    MERGE: 1.8.1.4

  mysql-test/t/rename.test@stripped, 2006-10-23 15:31:51+05:00, holyfoot@stripped +0 -0
    Auto merged
    MERGE: 1.11.1.1

  mysql-test/t/show_check.test@stripped, 2006-10-23 15:31:51+05:00, holyfoot@stripped +0 -0
    Auto merged
    MERGE: 1.33.2.8

  mysql-test/t/status.test@stripped, 2006-10-23 15:31:51+05:00, holyfoot@stripped +0 -0
    Auto merged
    MERGE: 1.12.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:	holyfoot
# Host:	deer.(none)
# Root:	/home/hf/work/w3475/my50-w3475/RESYNC

--- 1.247/libmysql/libmysql.c	2006-10-23 16:50:08 +05:00
+++ 1.248/libmysql/libmysql.c	2006-10-23 16:50:08 +05:00
@@ -4769,14 +4769,6 @@ int STDCALL mysql_stmt_store_result(MYSQ
     DBUG_RETURN(1);
   }
 
-  if (result->data)
-  {
-    free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
-    result->data= NULL;
-    result->rows= 0;
-    stmt->data_cursor= NULL;
-  }
-
   if (stmt->update_max_length && !stmt->bind_result_done)
   {
     /*

--- 1.10/mysql-test/t/flush_block_commit.test	2006-10-23 16:50:08 +05:00
+++ 1.11/mysql-test/t/flush_block_commit.test	2006-10-23 16:50:08 +05:00
@@ -3,9 +3,6 @@
 # We verify that we did not introduce a deadlock.
 # This is intended to mimick how mysqldump and innobackup work.
 
-# This test doesn't work with the embedded server
--- source include/not_embedded.inc
-
 # And it requires InnoDB
 -- source include/have_innodb.inc
 

--- 1.12/mysql-test/t/innodb-lock.test	2006-10-23 16:50:08 +05:00
+++ 1.13/mysql-test/t/innodb-lock.test	2006-10-23 16:50:08 +05:00
@@ -1,6 +1,4 @@
 -- source include/have_innodb.inc
-# Can't test this with embedded server
--- source include/not_embedded.inc
 
 #
 # Check and select innodb lock type

--- 1.13/mysql-test/t/rename.test	2006-10-23 16:50:08 +05:00
+++ 1.14/mysql-test/t/rename.test	2006-10-23 16:50:08 +05:00
@@ -2,10 +2,6 @@
 # Test of rename table
 #
 
-# Test requires concurrent connections, which can't be tested on embedded
-# server
--- source include/not_embedded.inc
-
 --disable_warnings
 drop table if exists t0,t1,t2,t3,t4;
 # Clear up from other tests (to ensure that SHOW TABLES below is right)

--- 1.58/mysql-test/t/show_check.test	2006-10-23 16:50:08 +05:00
+++ 1.59/mysql-test/t/show_check.test	2006-10-23 16:50:08 +05:00
@@ -1,5 +1,4 @@
-# Requires use of multiple simultaneous connections, not supported with
-# embedded server testing
+# Uses GRANT commands that usually disabled in embedded server
 -- source include/not_embedded.inc
 
 #

--- 1.17/mysql-test/t/lock_multi.test	2006-10-23 16:50:08 +05:00
+++ 1.18/mysql-test/t/lock_multi.test	2006-10-23 16:50:08 +05:00
@@ -1,11 +1,3 @@
-# This test doesn't work with the embedded version as this code
-# assumes that one query is running while we are doing queries on
-# a second connection.
-# This would work if mysqltest run would be threaded and handle each
-# connection in a separate thread.
-#
--- source include/not_embedded.inc
-
 --disable_warnings
 drop table if exists t1,t2;
 --enable_warnings

--- 1.11/mysql-test/t/innodb-deadlock.test	2006-10-23 16:50:08 +05:00
+++ 1.12/mysql-test/t/innodb-deadlock.test	2006-10-23 16:50:08 +05:00
@@ -1,6 +1,4 @@
 -- source include/have_innodb.inc
-# Can't test this with embedded server
--- source include/not_embedded.inc
 
 connect (con1,localhost,root,,);
 connect (con2,localhost,root,,);

--- 1.243/client/mysqltest.c	2006-10-23 16:50:08 +05:00
+++ 1.244/client/mysqltest.c	2006-10-23 16:50:08 +05:00
@@ -23,6 +23,7 @@
  *   Matt Wagner  <matt@stripped>
  *   Monty
  *   Jani
+ *   Holyfoot
  **/
 
 /**********************************************************************
@@ -243,6 +244,12 @@ struct connection
   MYSQL* util_mysql;
   char *name;
   MYSQL_STMT* stmt;
+
+  const char *cur_query;
+  int cur_query_len;
+  pthread_mutex_t mutex;
+  pthread_cond_t cond;
+  int query_done;
 };
 
 typedef struct
@@ -480,6 +487,58 @@ static void handle_error(const char *que
 			 const char *err_sqlstate, DYNAMIC_STRING *ds);
 static void handle_no_error(struct st_query *q);
 
+
+#ifdef EMBEDDED_LIBRARY
+/*
+  send_one_query executes query in separate thread what is
+  necessary in embedded library to run 'send' in proper way.
+  This implementation doesn't handle errors returned
+  by mysql_send_query. It's technically possible, though
+  i don't see where it is needed.
+*/
+pthread_handler_decl(send_one_query, arg)
+{
+  struct connection *cn= (struct connection*)arg;
+
+  mysql_thread_init();
+  VOID(mysql_send_query(&cn->mysql, cn->cur_query, cn->cur_query_len));
+
+  mysql_thread_end();
+  pthread_mutex_lock(&cn->mutex);
+  cn->query_done= 1;
+  VOID(pthread_cond_signal(&cn->cond));
+  pthread_mutex_unlock(&cn->mutex);
+  pthread_exit(0);
+  return 0;
+}
+
+static int do_send_query(struct connection *cn, const char *q, int q_len,
+                         int flags)
+{
+  pthread_t tid;
+
+  if (flags & QUERY_REAP)
+    return mysql_send_query(&cn->mysql, q, q_len);
+
+  if (pthread_mutex_init(&cn->mutex, NULL) ||
+      pthread_cond_init(&cn->cond, NULL))
+    die("Error in the thread library");
+
+  cn->cur_query= q;
+  cn->cur_query_len= q_len;
+  cn->query_done= 0;
+  if (pthread_create(&tid, NULL, send_one_query, (void*)cn))
+    die("Cannot start new thread for query");
+
+  return 0;
+}
+
+#else /*EMBEDDED_LIBRARY*/
+
+#define do_send_query(cn,q,q_len,flags) mysql_send_query(&cn->mysql, q, q_len)
+
+#endif /*EMBEDDED_LIBRARY*/
+
 static void do_eval(DYNAMIC_STRING* query_eval, const char *query,
                     my_bool pass_through_escape_chars)
 {
@@ -2038,7 +2097,7 @@ int close_connection(struct st_query *q)
 #ifndef EMBEDDED_LIBRARY
       if (q->type == Q_DIRTY_CLOSE)
       {
-	if (con->mysql.net.vio)
+	while (con->mysql.net.vio)
 	{
 	  vio_delete(con->mysql.net.vio);
 	  con->mysql.net.vio = 0;
@@ -3578,7 +3637,6 @@ static int append_warnings(DYNAMIC_STRIN
 }
 
 
-
 /*
   Run query using MySQL C API
 
@@ -3595,11 +3653,12 @@ static int append_warnings(DYNAMIC_STRIN
   error - function will not return
 */
 
-static void run_query_normal(MYSQL *mysql, struct st_query *command,
+static void run_query_normal(struct connection *cn, struct st_query *command,
 			     int flags, char *query, int query_len,
 			     DYNAMIC_STRING *ds, DYNAMIC_STRING *ds_warnings)
 {
   MYSQL_RES *res= 0;
+  MYSQL *mysql= &cn->mysql;
   int err= 0, counter= 0;
   DBUG_ENTER("run_query_normal");
   DBUG_PRINT("enter",("flags: %d", flags));
@@ -3610,13 +3669,26 @@ static void run_query_normal(MYSQL *mysq
     /*
        Send the query
      */
-    if (mysql_send_query(mysql, query, query_len))
+    if (do_send_query(cn, query, query_len, flags))
     {
       handle_error(query, command, mysql_errno(mysql), mysql_error(mysql),
 		   mysql_sqlstate(mysql), ds);
       goto end;
     }
   }
+#ifdef EMBEDDED_LIBRARY
+  /*
+   Here we handle 'reap' command, so we need to check if the
+   query's thread was finished and probably wait
+  */
+  else if (flags & QUERY_REAP)
+  {
+    pthread_mutex_lock(&cn->mutex);
+    if (!cn->query_done)
+      pthread_cond_wait(&cn->cond, &cn->mutex);
+    pthread_mutex_unlock(&cn->mutex);
+  }
+#endif /*EMBEDDED_LIBRARY*/
 
   if (!(flags & QUERY_REAP))
     DBUG_VOID_RETURN;
@@ -3867,10 +3939,11 @@ static void handle_no_error(struct st_qu
   error - function will not return
 */
 
-static void run_query_stmt(MYSQL *mysql, struct st_query *command,
+static void run_query_stmt(struct connection *cn, struct st_query *command,
 			   char *query, int query_len, DYNAMIC_STRING *ds,
 			   DYNAMIC_STRING *ds_warnings)
 {
+  MYSQL *mysql= &cn->mysql;
   MYSQL_RES *res= NULL;     /* Note that here 'res' is meta data result set */
   MYSQL_STMT *stmt;
   DYNAMIC_STRING ds_prepare_warnings;
@@ -4740,7 +4813,7 @@ int main(int argc, char **argv)
 	  q->require_file=require_file;
 	  save_file[0]=0;
 	}
-	run_query(&cur_con->mysql, q, QUERY_REAP|QUERY_SEND);
+	run_query(cur_con, q, QUERY_REAP|QUERY_SEND);
 	display_result_vertically= old_display_result_vertically;
         q->last_argument= q->end;
         query_executed= 1;
@@ -4775,7 +4848,7 @@ int main(int argc, char **argv)
         {
           q->query= q->first_argument;
         }
-	run_query(&cur_con->mysql, q, flags);
+	run_query(cur_con, q, flags);
 	query_executed= 1;
         q->last_argument= q->end;
 	break;
@@ -4796,7 +4869,7 @@ int main(int argc, char **argv)
 	  query and read the result some time later when reap instruction
 	  is given on this connection.
 	 */
-	run_query(&cur_con->mysql, q, QUERY_SEND);
+	run_query(cur_con, q, QUERY_SEND);
 	query_executed= 1;
         q->last_argument= q->end;
 	break;

--- 1.20/mysql-test/t/flush.test	2006-10-23 16:50:08 +05:00
+++ 1.21/mysql-test/t/flush.test	2006-10-23 16:50:08 +05:00
@@ -1,11 +1,3 @@
-# This test doesn't work with the embedded version as this code
-# assumes that one query is running while we are doing queries on
-# a second connection.
-# This would work if mysqltest run would be threaded and handle each
-# connection in a separate thread.
-#
--- source include/not_embedded.inc
-
 connect (con1,localhost,root,,);
 connect (con2,localhost,root,,);
 connection con1;

--- 1.15/mysql-test/t/status.test	2006-10-23 16:50:08 +05:00
+++ 1.16/mysql-test/t/status.test	2006-10-23 16:50:08 +05:00
@@ -1,10 +1,3 @@
-# This test doesn't work with the embedded version as this code
-# assumes that one query is running while we are doing queries on
-# a second connection.
-# This would work if mysqltest run would be threaded and handle each
-# connection in a separate thread.
-#
---source include/not_embedded.inc
 # PS causes different statistics
 --disable_ps_protocol
 
Thread
bk commit into 5.0 tree (holyfoot:1.2289)holyfoot23 Oct