List:Internals« Previous MessageNext Message »
From:Vadim Tkachenko Date:June 23 2005 11:13am
Subject:bk commit into 5.0-hp tree (vtkachenko:1.1999)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0-hp repository of vtkachenko. When vtkachenko 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.1999 05/06/23 11:13:15 vtkachenko@stripped +18 -0
  Merge melody.mysql.com:/users/vtkachenko/bk/HP/mysql-5.0.8-release
  into melody.mysql.com:/users/vtkachenko/bk/HP/mysql-5.0-hp

  BitKeeper/etc/logging_ok
    1.320 05/06/23 11:13:13 vtkachenko@stripped +1 -0
    Logging to logging@stripped accepted

  sql/sql_yacc.yy
    1.402 05/06/23 11:13:05 vtkachenko@stripped +0 -0
    Auto merged

  sql/sql_show.cc
    1.249 05/06/23 11:13:04 vtkachenko@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.436 05/06/23 11:13:04 vtkachenko@stripped +0 -0
    Auto merged

  sql/sql_lex.h
    1.186 05/06/23 11:13:03 vtkachenko@stripped +0 -0
    Auto merged

  sql/set_var.cc
    1.119 05/06/23 11:13:02 vtkachenko@stripped +0 -0
    Auto merged

  sql/mysqld.cc
    1.464 05/06/23 11:13:01 vtkachenko@stripped +0 -0
    Auto merged

  sql/mysql_priv.h
    1.305 05/06/23 11:13:01 vtkachenko@stripped +0 -0
    Auto merged

  sql/ha_myisam.cc
    1.155 05/06/23 11:13:00 vtkachenko@stripped +0 -0
    Auto merged

  sql/ha_innodb.h
    1.97 05/06/23 11:13:00 vtkachenko@stripped +0 -0
    Auto merged

  sql/ha_innodb.cc
    1.213 05/06/23 11:12:59 vtkachenko@stripped +0 -0
    Auto merged

  myisam/mi_open.c
    1.94 05/06/23 11:12:58 vtkachenko@stripped +0 -0
    Auto merged

  innobase/sync/sync0sync.c
    1.36 05/06/23 11:12:58 vtkachenko@stripped +0 -0
    Auto merged

  innobase/srv/srv0start.c
    1.83 05/06/23 11:12:58 vtkachenko@stripped +0 -0
    Auto merged

  innobase/os/os0sync.c
    1.26 05/06/23 11:12:57 vtkachenko@stripped +0 -0
    Auto merged

  innobase/include/sync0rw.ic
    1.11 05/06/23 11:12:56 vtkachenko@stripped +0 -0
    Auto merged

  innobase/buf/buf0buf.c
    1.50 05/06/23 11:12:55 vtkachenko@stripped +0 -0
    Auto merged

  configure.in
    1.320 05/06/23 11:12:54 vtkachenko@stripped +0 -0
    Auto merged

  BitKeeper/etc/logging_ok
    1.319 05/06/23 11:12:07 vtkachenko@stripped +0 -0
    auto-union

# 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:	vtkachenko
# Host:	melody.mysql.com
# Root:	/users/vtkachenko/bk/HP/mysql-5.0-hp/RESYNC

--- 1.319/configure.in	2005-06-22 13:29:16 +02:00
+++ 1.320/configure.in	2005-06-23 11:12:54 +02:00
@@ -1651,6 +1651,19 @@
   CXXFLAGS="$OPTIMIZE_CXXFLAGS -DDBUG_OFF $CXXFLAGS"
 fi
 
+if test "$with_debug" = "no"
+then
+  AC_ARG_WITH([timed-mutexes],
+              AC_HELP_STRING([--with-timed-mutexes], 
+              [compile with timed mutexes (default is enabled)]),
+              [with_timed_mutexes=$withval], [with_timed_mutexes=yes])
+fi
+
+if test "$with_timed_mutexes" = "yes"
+then
+  AC_DEFINE([TIMED_MUTEX], [1], [Define to 1 if you want to use timed mutexes])
+fi
+
 # Force static compilation to avoid linking problems/get more speed
 AC_ARG_WITH(mysqld-ldflags,
     [  --with-mysqld-ldflags   Extra linking arguments for mysqld],
@@ -1901,7 +1914,7 @@
   getcwd gethostbyaddr_r gethostbyname_r getpass getpassphrase getpwnam \
   getpwuid getrlimit getrusage getwd gmtime_r index initgroups isnan \
   localtime_r locking longjmp lrand48 madvise mallinfo memcpy memmove \
-  mkstemp mlockall perror poll pread pthread_attr_create mmap getpagesize \
+  mkstemp mlockall perror poll pread pthread_attr_create mmap mmap64 getpagesize \
   pthread_attr_getstacksize pthread_attr_setprio pthread_attr_setschedparam \
   pthread_attr_setstacksize pthread_condattr_create pthread_getsequence_np \
   pthread_key_delete pthread_rwlock_rdlock pthread_setprio \

--- 1.93/myisam/mi_open.c	2005-06-04 13:15:45 +02:00
+++ 1.94/myisam/mi_open.c	2005-06-23 11:12:58 +02:00
@@ -526,7 +526,7 @@
 				   share->base.max_key_length),
 		       &info.lastkey,share->base.max_key_length*3+1,
 		       &info.first_mbr_key, share->base.max_key_length,
-		       &info.filename,strlen(org_name)+1,
+		       &info.filename,strlen(name)+1,
 		       &info.rtree_recursion_state,have_rtree ? 1024 : 0,
 		       NullS))
     goto err;
@@ -535,7 +535,7 @@
   if (!have_rtree)
     info.rtree_recursion_state= NULL;
 
-  strmov(info.filename,org_name);
+  strmov(info.filename,name);
   memcpy(info.blobs,share->blobs,sizeof(MI_BLOB)*share->base.blobs);
   info.lastkey2=info.lastkey+share->base.max_key_length;
 

--- 1.154/sql/ha_myisam.cc	2005-06-10 07:18:41 +02:00
+++ 1.155/sql/ha_myisam.cc	2005-06-23 11:13:00 +02:00
@@ -1072,7 +1072,7 @@
   old_query_length= thd->query_length;
   pthread_mutex_lock(&LOCK_thread_count);
   thd->query= (char*) table->s->table_name;
-  thd->query_length= strlen(table->s->table_name);
+  thd->query_length= (uint32) strlen(table->s->table_name);
   pthread_mutex_unlock(&LOCK_thread_count);
 
   if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt))

--- 1.304/sql/mysql_priv.h	2005-06-14 21:12:40 +02:00
+++ 1.305/sql/mysql_priv.h	2005-06-23 11:13:01 +02:00
@@ -218,62 +218,75 @@
 #define TEST_CORE_ON_SIGNAL	256	/* Give core if signal */
 #define TEST_NO_STACKTRACE	512
 #define TEST_SIGINT		1024	/* Allow sigint on threads */
-#define TEST_SYNCHRONIZATION	2048	/* get server to do sleep in some 
-                                                                       places */
+#define TEST_SYNCHRONIZATION    2048    /* get server to do sleep in
+                                           some places */
 #endif
 
-/* 
+/*
    This is included in the server and in the client.
    Options for select set by the yacc parser (stored in lex->options).
-   None of the 32 defines below should have its value changed, or this will
-   break replication.
+
+   XXX:
+   log_event.h defines OPTIONS_WRITTEN_TO_BIN_LOG to specify what THD
+   options list are written into binlog. These options can NOT change their
+   values, or it will break replication between version.
+
+   context is encoded as following:
+   SELECT - SELECT_LEX_NODE::options
+   THD    - THD::options
+   intern - neither. used only as
+            func(..., select_node->options | thd->options | OPTION_XXX, ...)
+
+   TODO: separate three contexts above, move them to separate bitfields.
 */
 
-#define SELECT_DISTINCT		(1L << 0)
-#define SELECT_STRAIGHT_JOIN	(1L << 1)
-#define SELECT_DESCRIBE		(1L << 2)
-#define SELECT_SMALL_RESULT	(1L << 3)
-#define SELECT_BIG_RESULT	(1L << 4)
-#define OPTION_FOUND_ROWS	(1L << 5)
-#define OPTION_TO_QUERY_CACHE   (1L << 6)
-#define SELECT_NO_JOIN_CACHE	(1L << 7)       /* Intern */
-#define OPTION_BIG_TABLES       (1L << 8)       /* for SQL OPTION */
-#define OPTION_BIG_SELECTS      (1L << 9)       /* for SQL OPTION */
-#define OPTION_LOG_OFF          (1L << 10)
-#define OPTION_UPDATE_LOG       (1L << 11)      /* update log flag */
-#define TMP_TABLE_ALL_COLUMNS   (1L << 12)
-#define OPTION_WARNINGS         (1L << 13)
-#define OPTION_AUTO_IS_NULL     (1L << 14)
-#define OPTION_FOUND_COMMENT    (1L << 15)
-#define OPTION_SAFE_UPDATES     (1L << 16)
-#define OPTION_BUFFER_RESULT    (1L << 17)
-#define OPTION_BIN_LOG          (1L << 18)
-#define OPTION_NOT_AUTOCOMMIT   (1L << 19)
-#define OPTION_BEGIN            (1L << 20)
-#define OPTION_TABLE_LOCK       (1L << 21)
-#define OPTION_QUICK            (1L << 22)
-#define OPTION_QUOTE_SHOW_CREATE (1L << 23)
-#define OPTION_INTERNAL_SUBTRANSACTIONS (1L << 24)
+#define SELECT_DISTINCT         (1L << 0)       // SELECT, user
+#define SELECT_STRAIGHT_JOIN    (1L << 1)       // SELECT, user
+#define SELECT_DESCRIBE         (1L << 2)       // SELECT, user
+#define SELECT_SMALL_RESULT     (1L << 3)       // SELECT, user
+#define SELECT_BIG_RESULT       (1L << 4)       // SELECT, user
+#define OPTION_FOUND_ROWS       (1L << 5)       // SELECT, user
+#define OPTION_TO_QUERY_CACHE   (1L << 6)       // SELECT, user
+#define SELECT_NO_JOIN_CACHE    (1L << 7)       // intern
+#define OPTION_BIG_TABLES       (1L << 8)       // THD, user
+#define OPTION_BIG_SELECTS      (1L << 9)       // THD, user
+#define OPTION_LOG_OFF          (1L << 10)      // THD, user
+#define OPTION_UPDATE_LOG       (1L << 11)      // THD, user, unused
+#define TMP_TABLE_ALL_COLUMNS   (1L << 12)      // SELECT, intern
+#define OPTION_WARNINGS         (1L << 13)      // THD, user
+#define OPTION_AUTO_IS_NULL     (1L << 14)      // THD, user, binlog
+#define OPTION_FOUND_COMMENT    (1L << 15)      // SELECT, intern, parser
+#define OPTION_SAFE_UPDATES     (1L << 16)      // THD, user
+#define OPTION_BUFFER_RESULT    (1L << 17)      // SELECT, user
+#define OPTION_BIN_LOG          (1L << 18)      // THD, user
+#define OPTION_NOT_AUTOCOMMIT   (1L << 19)      // THD, user
+#define OPTION_BEGIN            (1L << 20)      // THD, intern
+#define OPTION_TABLE_LOCK       (1L << 21)      // THD, intern
+#define OPTION_QUICK            (1L << 22)      // SELECT (for DELETE)
+#define OPTION_QUOTE_SHOW_CREATE (1L << 23)     // THD, user
+
+/* Thr following is used to detect a conflict with DISTINCT
+   in the user query has requested */
+#define SELECT_ALL              (1L << 24)      // SELECT, user, parser
 
 /* Set if we are updating a non-transaction safe table */
-#define OPTION_STATUS_NO_TRANS_UPDATE   (1L << 25)
+#define OPTION_STATUS_NO_TRANS_UPDATE   (1L << 25) // THD, intern
 
 /* The following can be set when importing tables in a 'wrong order'
    to suppress foreign key checks */
-#define OPTION_NO_FOREIGN_KEY_CHECKS    (1L << 26)
+#define OPTION_NO_FOREIGN_KEY_CHECKS    (1L << 26) // THD, user, binlog
 /* The following speeds up inserts to InnoDB tables by suppressing unique
    key checks in some cases */
-#define OPTION_RELAXED_UNIQUE_CHECKS    (1L << 27)
-#define SELECT_NO_UNLOCK                (1L << 28)
-#define OPTION_SCHEMA_TABLE             (1L << 29)
+#define OPTION_RELAXED_UNIQUE_CHECKS    (1L << 27) // THD, user, binlog
+#define SELECT_NO_UNLOCK                (1L << 28) // SELECT, intern
+#define OPTION_SCHEMA_TABLE             (1L << 29) // SELECT, intern
 /* Flag set if setup_tables already done */
-#define OPTION_SETUP_TABLES_DONE        (1L << 30)
-/* Thr following is used to detect a conflict with DISTINCT
-   in the user query has requested */
-#define SELECT_ALL			(ULL(1) << 32)
+#define OPTION_SETUP_TABLES_DONE        (1L << 30) // intern
+/* If not set then the thread will ignore all warnings with level notes. */
+#define OPTION_SQL_NOTES                (1L << 31) // THD, user
 
-/* 
-  Maximum length of time zone name that we support 
+/*
+  Maximum length of time zone name that we support
   (Time zone name is char(64) in db). mysqlbinlog needs it.
 */
 #define MAX_TIME_ZONE_NAME_LENGTH 72
@@ -281,13 +294,10 @@
 /* The rest of the file is included in the server only */
 #ifndef MYSQL_CLIENT
 
-/* If not set then the thread will ignore all warnings with level notes. */
-#define OPTION_SQL_NOTES                (1L << 31)
-
 /* Bits for different SQL modes modes (including ANSI mode) */
-#define MODE_REAL_AS_FLOAT      	1
-#define MODE_PIPES_AS_CONCAT    	2
-#define MODE_ANSI_QUOTES        	4
+#define MODE_REAL_AS_FLOAT              1
+#define MODE_PIPES_AS_CONCAT            2
+#define MODE_ANSI_QUOTES                4
 #define MODE_IGNORE_SPACE		8
 #define MODE_NOT_USED			16
 #define MODE_ONLY_FULL_GROUP_BY		32
@@ -315,6 +325,7 @@
 #define MODE_TRADITIONAL		(MODE_ERROR_FOR_DIVISION_BY_ZERO*2)
 #define MODE_NO_AUTO_CREATE_USER	(MODE_TRADITIONAL*2)
 #define MODE_HIGH_NOT_PRECEDENCE	(MODE_NO_AUTO_CREATE_USER*2)
+#define MODE_NO_ENGINE_SUBSTITUTION     (MODE_HIGH_NOT_PRECEDENCE*2)
 /*
   Replication uses 8 bytes to store SQL_MODE in the binary log. The day you
   use strictly more than 64 bits by adding one more define above, you should
@@ -336,6 +347,8 @@
 #define UNCACHEABLE_SIDEEFFECT	4
 // forcing to save JOIN for explain
 #define UNCACHEABLE_EXPLAIN     8
+/* Don't evaluate subqueries in prepare even if they're not correlated */
+#define UNCACHEABLE_PREPARE    16
 
 #ifdef EXTRA_DEBUG
 /*
@@ -480,7 +493,7 @@
 			      TABLE_LIST *table_list);
 bool check_some_routine_access(THD *thd, const char *db, const char *name, bool is_proc);
 bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
-bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count);
+bool multi_delete_precheck(THD *thd, TABLE_LIST *tables);
 bool mysql_multi_update_prepare(THD *thd);
 bool mysql_multi_delete_prepare(THD *thd);
 bool mysql_insert_select_prepare(THD *thd);
@@ -547,8 +560,6 @@
 #define query_cache_invalidate_by_MyISAM_filename_ref NULL
 #endif /*HAVE_QUERY_CACHE*/
 
-#define prepare_execute(A) ((A)->command == COM_EXECUTE)
-
 bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
 bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
 bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
@@ -575,6 +586,7 @@
 bool mysql_new_select(LEX *lex, bool move_down);
 void create_select_for_variable(const char *var_name);
 void mysql_init_multi_delete(LEX *lex);
+bool multi_delete_set_locks_and_link_aux_tables(LEX *lex);
 void init_max_user_conn(void);
 void init_update_queries(void);
 void free_max_user_conn(void);
@@ -586,6 +598,7 @@
 bool do_command(THD *thd);
 bool dispatch_command(enum enum_server_command command, THD *thd,
 		      char* packet, uint packet_length);
+void log_slow_statement(THD *thd);
 bool check_dup(const char *db, const char *name, TABLE_LIST *tables);
 
 bool table_cache_init(void);
@@ -830,10 +843,10 @@
 void mysql_stmt_execute(THD *thd, char *packet, uint packet_length);
 void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name);
 void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length);
-void mysql_stmt_free(THD *thd, char *packet);
+void mysql_stmt_close(THD *thd, char *packet);
 void mysql_stmt_reset(THD *thd, char *packet);
 void mysql_stmt_get_longdata(THD *thd, char *pos, ulong packet_length);
-void reset_stmt_for_execute(THD *thd, LEX *lex);
+void reinit_stmt_before_use(THD *thd, LEX *lex);
 void init_stmt_after_parse(THD*, LEX*);
 
 /* sql_handler.cc */
@@ -883,8 +896,7 @@
                                List<String> *index_list);
 bool insert_fields(THD *thd,TABLE_LIST *tables,
 		   const char *db_name, const char *table_name,
-		   List_iterator<Item> *it, bool any_privileges,
-                   bool allocate_view_names);
+		   List_iterator<Item> *it, bool any_privileges);
 bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds,
 		  TABLE_LIST **leaves, bool select_insert);
 int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
@@ -1105,6 +1117,7 @@
 extern my_bool opt_readonly, lower_case_file_system;
 extern my_bool opt_enable_named_pipe, opt_sync_frm, opt_allow_suspicious_udfs;
 extern my_bool opt_secure_auth;
+extern my_bool opt_log_slow_admin_statements;
 extern my_bool sp_automatic_privileges, opt_noacl;
 extern my_bool opt_old_style_user_limits, trust_routine_creators;
 extern uint opt_crash_binlog_innodb;
@@ -1219,7 +1232,7 @@
 int readfrm(const char *name, const void** data, uint* length);
 int writefrm(const char* name, const void* data, uint len);
 int closefrm(TABLE *table);
-db_type get_table_type(const char *name);
+db_type get_table_type(THD *thd, const char *name);
 int read_string(File file, gptr *to, uint length);
 void free_blobs(TABLE *table);
 int set_zone(int nr,int min_zone,int max_zone);
@@ -1276,7 +1289,7 @@
 		     const char *newname);
 ulong next_io_size(ulong pos);
 void append_unescaped(String *res, const char *pos, uint length);
-int create_frm(char *name,uint reclength,uchar *fileinfo,
+int create_frm(THD *thd, char *name,uint reclength,uchar *fileinfo,
 	       HA_CREATE_INFO *create_info, uint keys);
 void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
 int rename_file_ext(const char * from,const char * to,const char * ext);

--- 1.463/sql/mysqld.cc	2005-06-10 07:18:43 +02:00
+++ 1.464/sql/mysqld.cc	2005-06-23 11:13:01 +02:00
@@ -229,6 +229,7 @@
   "NO_AUTO_VALUE_ON_ZERO", "NO_BACKSLASH_ESCAPES", "STRICT_TRANS_TABLES",
"STRICT_ALL_TABLES",
   "NO_ZERO_IN_DATE", "NO_ZERO_DATE", "ALLOW_INVALID_DATES", "ERROR_FOR_DIVISION_BY_ZERO",
   "TRADITIONAL", "NO_AUTO_CREATE_USER", "HIGH_NOT_PRECEDENCE",
+  "NO_ENGINE_SUBSTITUTION",
   NullS
 };
 TYPELIB sql_mode_typelib= { array_elements(sql_mode_names)-1,"",
@@ -326,6 +327,7 @@
 my_bool opt_readonly, use_temp_pool, relay_log_purge;
 my_bool opt_sync_frm, opt_allow_suspicious_udfs;
 my_bool opt_secure_auth= 0;
+my_bool opt_log_slow_admin_statements= 0;
 my_bool lower_case_file_system= 0;
 my_bool opt_large_pages= 0;
 my_bool opt_myisam_use_mmap= 0;
@@ -1277,19 +1279,6 @@
   int	arg=1;
   DBUG_ENTER("server_init");
 
-#ifdef	__WIN__
-  if (!opt_disable_networking)
-  {
-    WSADATA WsaData;
-    if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData))
-    {
-      /* errors are not read yet, so we use test here */
-      my_message(ER_WSAS_FAILED, "WSAStartup Failed", MYF(0));
-      unireg_abort(1);
-    }
-  }
-#endif /* __WIN__ */
-
   set_ports();
 
   if (mysqld_port != 0 && !opt_disable_networking && !opt_bootstrap)
@@ -3016,6 +3005,21 @@
   }
 #endif
 
+#ifdef	__WIN__
+/* Before performing any socket operation (like retrieving hostname */
+/* in init_common_variables we have to call WSAStartup              */
+  if (!opt_disable_networking)
+  {
+    WSADATA WsaData;
+    if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData))
+    {
+      /* errors are not read yet, so we use test here */
+      my_message(ER_WSAS_FAILED, "WSAStartup Failed", MYF(0));
+      unireg_abort(1);
+    }
+  }
+#endif /* __WIN__ */
+
   if (init_common_variables(MYSQL_CONFIG_NAME,
 			    argc, argv, load_default_groups))
     unireg_abort(1);				// Will do exit
@@ -3096,6 +3100,11 @@
     lower_case_table_names= 0;
   }
 
+  /* Reset table_alias_charset, now that lower_case_table_names is set. */
+  table_alias_charset= (lower_case_table_names ?
+			files_charset_info :
+			&my_charset_bin);
+
   select_thread=pthread_self();
   select_thread_in_use=1;
   init_ssl();
@@ -4328,7 +4337,8 @@
   OPT_AUTO_INCREMENT, OPT_AUTO_INCREMENT_OFFSET,
   OPT_ENABLE_LARGE_PAGES,
   OPT_TIMED_MUTEXES,
-  OPT_OLD_STYLE_USER_LIMITS
+  OPT_OLD_STYLE_USER_LIMITS,
+  OPT_LOG_SLOW_ADMIN_STATEMENTS
 };
 
 
@@ -4653,7 +4663,7 @@
    "Log some extra information to update log. Please note that this option is deprecated;
see --log-short-format option.", 
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"log-queries-not-using-indexes", OPT_LOG_QUERIES_NOT_USING_INDEXES,
-   "Log queries that are executed without benefit of any index.",
+   "Log queries that are executed without benefit of any index to the slow log if it is
open.",
    (gptr*) &opt_log_queries_not_using_indexes, (gptr*)
&opt_log_queries_not_using_indexes,
    0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"log-short-format", OPT_SHORT_LOG_FORMAT,
@@ -4664,8 +4674,13 @@
    "Tells the slave to log the updates from the slave thread to the binary log. You will
need to turn it on if you plan to daisy-chain the slaves.",
    (gptr*) &opt_log_slave_updates, (gptr*) &opt_log_slave_updates, 0, GET_BOOL,
    NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"log-slow-admin-statements", OPT_LOG_SLOW_ADMIN_STATEMENTS,
+   "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log
if it is open.",
+   (gptr*) &opt_log_slow_admin_statements,
+   (gptr*) &opt_log_slow_admin_statements,
+   0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"log-slow-queries", OPT_SLOW_QUERY_LOG,
-   "Log slow queries to this log file. Defaults logging to hostname-slow.log file.",
+    "Log slow queries to this log file. Defaults logging to hostname-slow.log file. Must
be enabled to activate other slow log options.",
    (gptr*) &opt_slow_logname, (gptr*) &opt_slow_logname, 0, GET_STR, OPT_ARG,
    0, 0, 0, 0, 0, 0},
   {"log-tc", OPT_LOG_TC,
@@ -5225,7 +5240,7 @@
   {"innodb_thread_concurrency", OPT_INNODB_THREAD_CONCURRENCY,
    "Helps in performance tuning in heavily concurrent environments.",
    (gptr*) &srv_thread_concurrency, (gptr*) &srv_thread_concurrency,
-   0, GET_LONG, REQUIRED_ARG, 8, 1, 1000, 0, 1, 0},
+   0, GET_LONG, REQUIRED_ARG, 20, 1, 1000, 0, 1, 0},
   {"innodb_thread_sleep_delay", OPT_INNODB_THREAD_SLEEP_DELAY,
    "Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0"
     " disable a sleep",
@@ -5718,6 +5733,12 @@
   {"Com_show_warnings",        (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_SHOW_WARNS]), SHOW_LONG_STATUS},
   {"Com_slave_start",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_SLAVE_START]), SHOW_LONG_STATUS},
   {"Com_slave_stop",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_SLAVE_STOP]), SHOW_LONG_STATUS},
+  {"Com_stmt_prepare",         (char*) offsetof(STATUS_VAR, com_stmt_prepare),
SHOW_LONG_STATUS},
+  {"Com_stmt_execute",         (char*) offsetof(STATUS_VAR, com_stmt_execute),
SHOW_LONG_STATUS},
+  {"Com_stmt_fetch",           (char*) offsetof(STATUS_VAR, com_stmt_fetch),
SHOW_LONG_STATUS},
+  {"Com_stmt_send_long_data",  (char*) offsetof(STATUS_VAR, com_stmt_send_long_data),
SHOW_LONG_STATUS},
+  {"Com_stmt_reset",           (char*) offsetof(STATUS_VAR, com_stmt_reset),
SHOW_LONG_STATUS},
+  {"Com_stmt_close",           (char*) offsetof(STATUS_VAR, com_stmt_close),
SHOW_LONG_STATUS},
   {"Com_truncate",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_TRUNCATE]),
SHOW_LONG_STATUS},
   {"Com_unlock_tables",	       (char*) offsetof(STATUS_VAR, com_stat[(uint)
SQLCOM_UNLOCK_TABLES]), SHOW_LONG_STATUS},
   {"Com_update",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_UPDATE]),
SHOW_LONG_STATUS},
@@ -6345,6 +6366,9 @@
   case (int) OPT_SLOW_QUERY_LOG:
     opt_slow_log=1;
     break;
+  case (int) OPT_LOG_SLOW_ADMIN_STATEMENTS:
+    opt_log_slow_admin_statements= 1;
+    break;
   case (int) OPT_SKIP_NEW:
     opt_specialflag|= SPECIAL_NO_NEW_FUNC;
     delay_key_write_options= (uint) DELAY_KEY_WRITE_NONE;
@@ -6733,6 +6757,9 @@
   if (opt_bdb)
     sql_print_warning("this binary does not contain BDB storage engine");
 #endif
+  if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes) &&
+      !opt_slow_log)
+    sql_print_warning("options --log-slow-admin-statements and
--log-queries-not-using-indexes have no effect if --log-slow-queries is not set");
 
   /*
     Check that the default storage engine is actually available.
@@ -6802,9 +6829,6 @@
 
   /* Set global variables based on startup options */
   myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
-  table_alias_charset= (lower_case_table_names ?
-			files_charset_info :
-			&my_charset_bin);
 
   if (opt_short_log_format)
     opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
@@ -7056,7 +7080,7 @@
   Instantiate templates
 *****************************************************************************/
 
-#ifdef __GNUC__
+#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
 /* Used templates */
 template class I_List<THD>;
 template class I_List_iterator<THD>;

--- 1.185/sql/sql_lex.h	2005-06-21 16:18:23 +02:00
+++ 1.186/sql/sql_lex.h	2005-06-23 11:13:03 +02:00
@@ -53,7 +53,7 @@
 
   SQLCOM_SHOW_DATABASES, SQLCOM_SHOW_TABLES, SQLCOM_SHOW_FIELDS,
   SQLCOM_SHOW_KEYS, SQLCOM_SHOW_VARIABLES, SQLCOM_SHOW_LOGS, SQLCOM_SHOW_STATUS,
-  SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_MUTEX_STATUS,
+  SQLCOM_SHOW_INNODB_STATUS, SQLCOM_SHOW_MUTEX_STATUS, SQLCOM_SHOW_MUTEX_FLUSH,
   SQLCOM_SHOW_PROCESSLIST, SQLCOM_SHOW_MASTER_STAT, SQLCOM_SHOW_SLAVE_STAT,
   SQLCOM_SHOW_GRANTS, SQLCOM_SHOW_CREATE, SQLCOM_SHOW_CHARSETS,
   SQLCOM_SHOW_COLLATIONS, SQLCOM_SHOW_CREATE_DB, SQLCOM_SHOW_TABLE_STATUS,
@@ -782,7 +782,7 @@
   uint8 create_view_algorithm;
   uint8 create_view_check;
   bool drop_if_exists, drop_temporary, local_file, one_shot_set;
-  bool in_comment, ignore_space, verbose, no_write_to_binlog;
+  bool in_comment, ignore_space, verbose, flush, no_write_to_binlog;
   bool tx_chain, tx_release;
   /*
     Special JOIN::prepare mode: changing of query is prohibited.

--- 1.435/sql/sql_parse.cc	2005-06-14 21:12:40 +02:00
+++ 1.436/sql/sql_parse.cc	2005-06-23 11:13:04 +02:00
@@ -71,7 +71,6 @@
 static void refresh_status(void);
 static bool append_file_to_dir(THD *thd, const char **filename_ptr,
 			       const char *table_name);
-static void log_slow_query(THD *thd);
 
 const char *any_db="*any*";	// Special symbol for check_access
 
@@ -1508,10 +1507,10 @@
 
   thd->command=command;
   /*
-    Commands which will always take a long time should be marked with
-    this so that they will not get logged to the slow query log
+    Commands which always take a long time are logged into
+    the slow log only if opt_log_slow_admin_statements is set.
   */
-  thd->slow_command=FALSE;
+  thd->enable_slow_log= TRUE;
   thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
   thd->set_time();
   VOID(pthread_mutex_lock(&LOCK_thread_count));
@@ -1551,7 +1550,7 @@
     uint tbl_len= *(uchar*) (packet + db_len + 1);
 
     statistic_increment(thd->status_var.com_other, &LOCK_status);
-    thd->slow_command= TRUE;
+    thd->enable_slow_log= opt_log_slow_admin_statements;
     db= thd->alloc(db_len + tbl_len + 2);
     tbl_name= strmake(db, packet + 1, db_len)+1;
     strmake(tbl_name, packet + db_len + 2, tbl_len);
@@ -1635,32 +1634,32 @@
     }
     break;
   }
-  case COM_EXECUTE:
+  case COM_STMT_EXECUTE:
   {
     mysql_stmt_execute(thd, packet, packet_length);
     break;
   }
-  case COM_FETCH:
+  case COM_STMT_FETCH:
   {
     mysql_stmt_fetch(thd, packet, packet_length);
     break;
   }
-  case COM_LONG_DATA:
+  case COM_STMT_SEND_LONG_DATA:
   {
     mysql_stmt_get_longdata(thd, packet, packet_length);
     break;
   }
-  case COM_PREPARE:
+  case COM_STMT_PREPARE:
   {
     mysql_stmt_prepare(thd, packet, packet_length, 0);
     break;
   }
-  case COM_CLOSE_STMT:
+  case COM_STMT_CLOSE:
   {
-    mysql_stmt_free(thd, packet);
+    mysql_stmt_close(thd, packet);
     break;
   }
-  case COM_RESET_STMT:
+  case COM_STMT_RESET:
   {
     mysql_stmt_reset(thd, packet);
     break;
@@ -1689,7 +1688,7 @@
 #endif
       ulong length= (ulong)(packet_end-packet);
 
-      log_slow_query(thd);
+      log_slow_statement(thd);
 
       /* Remove garbage at start of query */
       while (my_isspace(thd->charset(), *packet) && length > 0)
@@ -1858,7 +1857,7 @@
       uint32 slave_server_id;
 
       statistic_increment(thd->status_var.com_other,&LOCK_status);
-      thd->slow_command = TRUE;
+      thd->enable_slow_log= opt_log_slow_admin_statements;
       if (check_global_access(thd, REPL_SLAVE_ACL))
 	break;
 
@@ -2043,7 +2042,7 @@
   if (thd->net.report_error)
     net_send_error(thd);
 
-  log_slow_query(thd);
+  log_slow_statement(thd);
 
   thd->proc_info="cleaning up";
   VOID(pthread_mutex_lock(&LOCK_thread_count)); // For process list
@@ -2059,13 +2058,16 @@
 }
 
 
-static void log_slow_query(THD *thd)
+void log_slow_statement(THD *thd)
 {
   time_t start_of_query=thd->start_time;
   thd->end_time();				// Set start time
 
-  /* If not reading from backup and if the query took too long */
-  if (!thd->slow_command && !thd->user_time) // do not log 'slow_command'
queries
+  /*
+    Do not log administrative statements unless the appropriate option is
+    set; do not log into slow log if reading from backup.
+  */
+  if (thd->enable_slow_log && !thd->user_time)
   {
     thd->proc_info="logging slow query";
 
@@ -2197,7 +2199,7 @@
 
 /*
   Read query from packet and store in thd->query
-  Used in COM_QUERY and COM_PREPARE
+  Used in COM_QUERY and COM_STMT_PREPARE
 
   DESCRIPTION
     Sets the following THD variables:
@@ -2499,7 +2501,7 @@
                           lex->prepared_stmt_name.str,
                           query_len, query_str));
     }
-    thd->command= COM_PREPARE;
+    thd->command= COM_STMT_PREPARE;
     if (!(res= mysql_stmt_prepare(thd, query_str, query_len + 1,
                                   &lex->prepared_stmt_name)))
       send_ok(thd, 0L, 0L, "Statement prepared");
@@ -2520,6 +2522,8 @@
     DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", 
                         lex->prepared_stmt_name.length,
                         lex->prepared_stmt_name.str));
+    /* We account deallocate in the same manner as mysql_stmt_close */
+    statistic_increment(thd->status_var.com_stmt_close, &LOCK_status);
     if ((stmt= thd->stmt_map.find_by_name(&lex->prepared_stmt_name)))
     {
       thd->stmt_map.erase(stmt);
@@ -2637,7 +2641,7 @@
 	check_table_access(thd, SELECT_ACL, all_tables, 0) ||
 	check_global_access(thd, FILE_ACL))
       goto error; /* purecov: inspected */
-    thd->slow_command=TRUE;
+    thd->enable_slow_log= opt_log_slow_admin_statements;
     res = mysql_backup_table(thd, first_table);
 
     break;
@@ -2649,7 +2653,7 @@
 	check_table_access(thd, INSERT_ACL, all_tables, 0) ||
 	check_global_access(thd, FILE_ACL))
       goto error; /* purecov: inspected */
-    thd->slow_command=TRUE;
+    thd->enable_slow_log= opt_log_slow_admin_statements;
     res = mysql_restore_table(thd, first_table);
     break;
   }
@@ -2791,6 +2795,20 @@
 
   case SQLCOM_CREATE_TABLE:
   {
+    /* If CREATE TABLE of non-temporary table, do implicit commit */
+    if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
+    {
+      if (end_active_trans(thd))
+      {
+	res= -1;
+	break;
+      }
+    }
+    else 
+    {
+      /* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
+      thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
+    }
     DBUG_ASSERT(first_table == all_tables && first_table != 0);
     bool link_to_local;
     // Skip first table, which is the table we are creating
@@ -2933,7 +2951,7 @@
     DBUG_ASSERT(first_table == all_tables && first_table != 0);
     if (check_one_table_access(thd, INDEX_ACL, all_tables))
       goto error; /* purecov: inspected */
-    thd->slow_command=TRUE;
+    thd->enable_slow_log= opt_log_slow_admin_statements;
     if (end_active_trans(thd))
       goto error;
     else
@@ -3022,7 +3040,7 @@
 	goto error;
       else
       {
-        thd->slow_command=TRUE;
+        thd->enable_slow_log= opt_log_slow_admin_statements;
 	res= mysql_alter_table(thd, select_lex->db, lex->name,
 			       &lex->create_info,
 			       first_table, lex->create_list,
@@ -3121,7 +3139,7 @@
     if (check_db_used(thd, all_tables) ||
 	check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
       goto error; /* purecov: inspected */
-    thd->slow_command=TRUE;
+    thd->enable_slow_log= opt_log_slow_admin_statements;
     res= mysql_repair_table(thd, first_table, &lex->check_opt);
     /* ! we write after unlocking the table */
     if (!res && !lex->no_write_to_binlog)
@@ -3141,7 +3159,7 @@
     if (check_db_used(thd, all_tables) ||
 	check_table_access(thd, SELECT_ACL | EXTRA_ACL , all_tables, 0))
       goto error; /* purecov: inspected */
-    thd->slow_command=TRUE;
+    thd->enable_slow_log= opt_log_slow_admin_statements;
     res = mysql_check_table(thd, first_table, &lex->check_opt);
     break;
   }
@@ -3151,7 +3169,7 @@
     if (check_db_used(thd, all_tables) ||
 	check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
       goto error; /* purecov: inspected */
-    thd->slow_command=TRUE;
+    thd->enable_slow_log= opt_log_slow_admin_statements;
     res = mysql_analyze_table(thd, first_table, &lex->check_opt);
     /* ! we write after unlocking the table */
     if (!res && !lex->no_write_to_binlog)
@@ -3172,7 +3190,7 @@
     if (check_db_used(thd, all_tables) ||
 	check_table_access(thd, SELECT_ACL | INSERT_ACL, all_tables, 0))
       goto error; /* purecov: inspected */
-    thd->slow_command=TRUE;
+    thd->enable_slow_log= opt_log_slow_admin_statements;
     res= (specialflag & (SPECIAL_SAFE_MODE | SPECIAL_NO_NEW_FUNC)) ?
       mysql_recreate_table(thd, first_table, 1) :
       mysql_optimize_table(thd, first_table, &lex->check_opt);
@@ -3285,6 +3303,11 @@
     break;
   }
   case SQLCOM_TRUNCATE:
+    if (end_active_trans(thd))
+    {
+      res= -1;
+      break;
+    }
     DBUG_ASSERT(first_table == all_tables && first_table != 0);
     if (check_one_table_access(thd, DELETE_ACL, all_tables))
       goto error;
@@ -3318,10 +3341,9 @@
     DBUG_ASSERT(first_table == all_tables && first_table != 0);
     TABLE_LIST *aux_tables=
       (TABLE_LIST *)thd->lex->auxilliary_table_list.first;
-    uint table_count;
     multi_delete *result;
 
-    if ((res= multi_delete_precheck(thd, all_tables, &table_count)))
+    if ((res= multi_delete_precheck(thd, all_tables)))
       break;
 
     /* condition will be TRUE on SP re-excuting */
@@ -3338,7 +3360,7 @@
       goto error;
 
     if (!thd->is_fatal_error && (result= new multi_delete(thd,aux_tables,
-							  table_count)))
+							  lex->table_count)))
     {
       res= mysql_select(thd, &select_lex->ref_pointer_array,
 			select_lex->get_table_list(),
@@ -3379,6 +3401,9 @@
       */
       if (thd->slave_thread)
 	lex->drop_if_exists= 1;
+
+      /* So that DROP TEMPORARY TABLE gets to binlog at commit/rollback */
+      thd->options|= OPTION_STATUS_NO_TRANS_UPDATE;
     }
     res= mysql_rm_table(thd, first_table, lex->drop_if_exists,
 			lex->drop_temporary);
@@ -3517,6 +3542,11 @@
     break;
   case SQLCOM_CREATE_DB:
   {
+    if (end_active_trans(thd))
+    {
+      res= -1;
+      break;
+    }
     char *alias;
     if (!(alias=thd->strdup(lex->name)) || check_db_name(lex->name))
     {
@@ -3547,6 +3577,11 @@
   }
   case SQLCOM_DROP_DB:
   {
+    if (end_active_trans(thd))
+    {
+      res= -1;
+      break;
+    }
     if (check_db_name(lex->name))
     {
       my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
@@ -5196,26 +5231,28 @@
 mysql_new_select(LEX *lex, bool move_down)
 {
   SELECT_LEX *select_lex;
-  THD *thd;
+  THD *thd= lex->thd;
   DBUG_ENTER("mysql_new_select");
 
-  if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX()))
+  if (!(select_lex= new (thd->mem_root) SELECT_LEX()))
     DBUG_RETURN(1);
-  select_lex->select_number= ++lex->thd->select_number;
+  select_lex->select_number= ++thd->select_number;
   select_lex->init_query();
   select_lex->init_select();
   select_lex->parent_lex= lex;
+  if (thd->current_arena->is_stmt_prepare())
+    select_lex->uncacheable|= UNCACHEABLE_PREPARE;
   if (move_down)
   {
     SELECT_LEX_UNIT *unit;
     lex->subqueries= TRUE;
     /* first select_lex of subselect or derived table */
-    if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT()))
+    if (!(unit= new (thd->mem_root) SELECT_LEX_UNIT()))
       DBUG_RETURN(1);
 
     unit->init_query();
     unit->init_select();
-    unit->thd= lex->thd;
+    unit->thd= thd;
     unit->include_down(lex->current_select);
     unit->link_next= 0;
     unit->link_prev= 0;
@@ -5239,7 +5276,7 @@
 	as far as we included SELECT_LEX for UNION unit should have
 	fake SELECT_LEX for UNION processing
       */
-      if (!(fake= unit->fake_select_lex= new(lex->thd->mem_root) SELECT_LEX()))
+      if (!(fake= unit->fake_select_lex= new (thd->mem_root) SELECT_LEX()))
         DBUG_RETURN(1);
       fake->include_standalone(unit,
 			       (SELECT_LEX_NODE**)&unit->fake_select_lex);
@@ -6826,23 +6863,19 @@
     multi_delete_precheck()
     thd			Thread handler
     tables		Global/local table list
-    table_count		Pointer to table counter
 
   RETURN VALUE
     FALSE OK
     TRUE  error
 */
 
-bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count)
+bool multi_delete_precheck(THD *thd, TABLE_LIST *tables)
 {
   SELECT_LEX *select_lex= &thd->lex->select_lex;
   TABLE_LIST *aux_tables=
     (TABLE_LIST *)thd->lex->auxilliary_table_list.first;
-  TABLE_LIST *target_tbl;
   DBUG_ENTER("multi_delete_precheck");
 
-  *table_count= 0;
-
   /* sql_yacc guarantees that tables and aux_tables are not zero */
   DBUG_ASSERT(aux_tables != 0);
   if (check_db_used(thd, tables) || check_db_used(thd,aux_tables) ||
@@ -6855,9 +6888,35 @@
                ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0));
     DBUG_RETURN(TRUE);
   }
-  for (target_tbl= aux_tables; target_tbl; target_tbl= target_tbl->next_local)
+  DBUG_RETURN(FALSE);
+}
+
+
+/*
+  Link tables in auxilary table list of multi-delete with corresponding
+  elements in main table list, and set proper locks for them.
+
+  SYNOPSIS
+    multi_delete_set_locks_and_link_aux_tables()
+      lex - pointer to LEX representing multi-delete
+
+  RETURN VALUE
+    FALSE - success
+    TRUE  - error
+*/
+
+bool multi_delete_set_locks_and_link_aux_tables(LEX *lex)
+{
+  TABLE_LIST *tables= (TABLE_LIST*)lex->select_lex.table_list.first;
+  TABLE_LIST *target_tbl;
+  DBUG_ENTER("multi_delete_set_locks_and_link_aux_tables");
+
+  lex->table_count= 0;
+
+  for (target_tbl= (TABLE_LIST *)lex->auxilliary_table_list.first;
+       target_tbl; target_tbl= target_tbl->next_local)
   {
-    (*table_count)++;
+    lex->table_count++;
     /* All tables in aux_tables must be found in FROM PART */
     TABLE_LIST *walk;
     for (walk= tables; walk; walk= walk->next_local)
@@ -6875,14 +6934,6 @@
     }
     walk->lock_type= target_tbl->lock_type;
     target_tbl->correspondent_table= walk;	// Remember corresponding table
-    
-    /* in case of subselects, we need to set lock_type in
-     * corresponding table in list of all tables */
-    if (walk->correspondent_table)
-    {
-      target_tbl->correspondent_table= walk->correspondent_table;
-      walk->correspondent_table->lock_type= walk->lock_type;
-    }
   }
   DBUG_RETURN(FALSE);
 }

--- 1.248/sql/sql_show.cc	2005-06-14 21:12:40 +02:00
+++ 1.249/sql/sql_show.cc	2005-06-23 11:13:04 +02:00
@@ -348,7 +348,7 @@
                       table_list->table_name));
 
   /* Only one table for now, but VIEW can involve several tables */
-  if (open_and_lock_tables(thd, table_list))
+  if (open_normal_and_derived_tables(thd, table_list))
   {
     DBUG_RETURN(TRUE);
   }
@@ -448,25 +448,32 @@
     DBUG_RETURN(TRUE);
   }
 #endif
-
-  (void) sprintf(path,"%s/%s",mysql_data_home, dbname);
-  length=unpack_dirname(path,path);		// Convert if not unix
-  found_libchar= 0;
-  if (length && path[length-1] == FN_LIBCHAR)
+  if (!my_strcasecmp(system_charset_info, dbname,
+                     information_schema_name.str))
   {
-    found_libchar= 1;
-    path[length-1]=0;				// remove ending '\'
+    dbname= information_schema_name.str;
+    create.default_table_charset= system_charset_info;
   }
-  if (access(path,F_OK))
+  else
   {
-    my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
-    DBUG_RETURN(TRUE);
+    (void) sprintf(path,"%s/%s",mysql_data_home, dbname);
+    length=unpack_dirname(path,path);		// Convert if not unix
+    found_libchar= 0;
+    if (length && path[length-1] == FN_LIBCHAR)
+    {
+      found_libchar= 1;
+      path[length-1]=0;				// remove ending '\'
+    }
+    if (access(path,F_OK))
+    {
+      my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
+      DBUG_RETURN(TRUE);
+    }
+    if (found_libchar)
+      path[length-1]= FN_LIBCHAR;
+    strmov(path+length, MY_DB_OPT_FILE);
+    load_db_opt(thd, path, &create);
   }
-  if (found_libchar)
-    path[length-1]= FN_LIBCHAR;
-  strmov(path+length, MY_DB_OPT_FILE);
-  load_db_opt(thd, path, &create);
-
   List<Item> field_list;
   field_list.push_back(new Item_empty_string("Database",NAME_LEN));
   field_list.push_back(new Item_empty_string("Create Database",1024));
@@ -540,8 +547,7 @@
   DBUG_ENTER("mysqld_list_fields");
   DBUG_PRINT("enter",("table: %s",table_list->table_name));
 
-  table_list->lock_type= TL_UNLOCK;
-  if (open_and_lock_tables(thd, table_list))
+  if (open_normal_and_derived_tables(thd, table_list))
     DBUG_VOID_RETURN;
   table= table_list->table;
 
@@ -1096,7 +1102,7 @@
   char *query;
 };
 
-#ifdef __GNUC__
+#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
 template class I_List<thread_info>;
 #endif
 
@@ -2022,7 +2028,7 @@
     bool res;
 
     lex->all_selects_list= lsel;
-    res= open_and_lock_tables(thd, show_table_list);
+    res= open_normal_and_derived_tables(thd, show_table_list);
     if (schema_table->process_table(thd, show_table_list,
                                     table, res, show_table_list->db,
                                     show_table_list->alias))
@@ -2127,7 +2133,7 @@
             show_table_list->lock_type= lock_type;
             lex->all_selects_list= &sel;
             lex->derived_tables= 0;
-            res= open_and_lock_tables(thd, show_table_list);
+            res= open_normal_and_derived_tables(thd, show_table_list);
             if (schema_table->process_table(thd, show_table_list, table,
                                             res, base_name,
                                             show_table_list->alias))
@@ -2723,6 +2729,7 @@
     restore_record(table, s->default_values);
     if (!wild || !wild[0] || !wild_compare(sp_name, wild, 0))
     {
+      int enum_idx= proc_table->field[5]->val_int();
       table->field[3]->store(sp_name, strlen(sp_name), cs);
       get_field(thd->mem_root, proc_table->field[3], &tmp_string);
       table->field[0]->store(tmp_string.ptr(), tmp_string.length(), cs);
@@ -2744,10 +2751,8 @@
       table->field[10]->store("SQL", 3, cs);
       get_field(thd->mem_root, proc_table->field[6], &tmp_string);
       table->field[11]->store(tmp_string.ptr(), tmp_string.length(), cs);
-      if (proc_table->field[5]->val_int() == SP_CONTAINS_SQL)
-      {
-        table->field[12]->store("CONTAINS SQL", 12 , cs);
-      }
+      table->field[12]->store(sp_data_access_name[enum_idx].str, 
+                              sp_data_access_name[enum_idx].length , cs);
       get_field(thd->mem_root, proc_table->field[7], &tmp_string);
       table->field[14]->store(tmp_string.ptr(), tmp_string.length(), cs);
       bzero((char *)&time, sizeof(time));
@@ -3951,7 +3956,7 @@
 };
 
 
-#ifdef __GNUC__
+#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
 template class List_iterator_fast<char>;
 template class List<char>;
 #endif

--- 1.401/sql/sql_yacc.yy	2005-06-22 23:02:41 +02:00
+++ 1.402/sql/sql_yacc.yy	2005-06-23 11:13:05 +02:00
@@ -6372,6 +6372,8 @@
           { Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS; WARN_DEPRECATED("SHOW INNODB
STATUS", "SHOW ENGINE INNODB STATUS"); }
         | MUTEX_SYM STATUS_SYM
           { Lex->sql_command = SQLCOM_SHOW_MUTEX_STATUS; }
+	| MUTEX_SYM FLUSH_SYM
+	  { Lex->sql_command = SQLCOM_SHOW_MUTEX_FLUSH;  }	
 	| opt_full PROCESSLIST_SYM
 	  { Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
         | opt_var_type  VARIABLES wild_and_where

--- 1.318/BitKeeper/etc/logging_ok	2005-06-10 07:16:34 +02:00
+++ 1.320/BitKeeper/etc/logging_ok	2005-06-23 11:13:13 +02:00
@@ -197,11 +197,13 @@
 mysqldev@stripped
 mysqldev@stripped
 ndbdev@stripped
+ndbdev@stripped
 ndbdev@stripped
 ndbdev@stripped
 ndbdev@shark.
 nick@stripped
 nick@stripped
+obarnir@stripped
 papa@stripped
 patg@krsna.
 patg@stripped
@@ -295,6 +297,7 @@
 venu@stripped
 vtkachenko@stripped
 vtkachenko@stripped
+vtkachenko@stripped
 vtkachenko@stripped
 vva@stripped
 vva@genie.(none)

--- 1.49/innobase/buf/buf0buf.c	2005-06-22 11:21:08 +02:00
+++ 1.50/innobase/buf/buf0buf.c	2005-06-23 11:12:55 +02:00
@@ -1234,11 +1234,11 @@
 		fix_type = MTR_MEMO_BUF_FIX;
 	} else if (rw_latch == RW_S_LATCH) {
 
-		rw_lock_s_lock_func(&(block->lock), 0, file, line);
+		rw_lock_s_lock(&(block->lock));
 
 		fix_type = MTR_MEMO_PAGE_S_FIX;
 	} else {
-		rw_lock_x_lock_func(&(block->lock), 0, file, line);
+		rw_lock_x_lock(&(block->lock));
 
 		fix_type = MTR_MEMO_PAGE_X_FIX;
 	}

--- 1.10/innobase/include/sync0rw.ic	2005-04-22 12:58:43 +02:00
+++ 1.11/innobase/include/sync0rw.ic	2005-06-23 11:12:56 +02:00
@@ -224,9 +224,10 @@
 	ulint		pass,	/* in: pass value; != 0, if the lock will
 				be passed to another thread to unlock */
 	const char*	file_name,/* in: file name where lock requested */
-	ulint		line)	/* in: line where requested */
+	ulint		line, char *lock_name)	/* in: line where requested */
 {
-	/* NOTE: As we do not know the thread ids for threads which have
+
+  /* NOTE: As we do not know the thread ids for threads which have
 	s-locked a latch, and s-lockers will be served only after waiting
 	x-lock requests have been fulfilled, then if this thread already
 	owns an s-lock here, it may end up in a deadlock with another thread
@@ -241,6 +242,12 @@
 	ut_ad(!rw_lock_own(lock, RW_LOCK_SHARED)); /* see NOTE above */
 #endif /* UNIV_SYNC_DEBUG */
 
+/*  fprintf(stderr,
+"Thread %lu S_LOCK at %s cfile %s cline %lu \n",
+  (ulong) os_thread_pf(os_thread_get_curr_id()), lock_name,
+  file_name, line);
+*/
+  lock->ls_count++;
 	mutex_enter(rw_lock_get_mutex(lock));
 
 	if (UNIV_LIKELY(rw_lock_s_lock_low(lock, pass, file_name, line))) {
@@ -251,8 +258,10 @@
 		/* Did not succeed, try spin wait */
 		mutex_exit(rw_lock_get_mutex(lock));
 
+
 		rw_lock_s_lock_spin(lock, pass, file_name, line);
 
+
 		return;
 	}
 }
@@ -352,7 +361,7 @@
 	,ulint		pass	/* in: pass value; != 0, if the lock may have
 				been passed to another thread to unlock */
 #endif
-	)
+	, char* lock_name)
 {
 	mutex_t*	mutex	= &(lock->mutex);
 	ibool		sg 	= FALSE;
@@ -390,6 +399,10 @@
 #ifdef UNIV_SYNC_PERF_STAT
 	rw_s_exit_count++;
 #endif
+/*  fprintf(stderr,
+"Thread %lu S_LOCK unlock at %s \n",
+  (ulong) os_thread_pf(os_thread_get_curr_id()), lock_name);
+*/
 }
 
 /**********************************************************************
@@ -429,9 +442,13 @@
 	,ulint		pass	/* in: pass value; != 0, if the lock may have
 				been passed to another thread to unlock */
 #endif
-	)
+	, char* lock_name)
 {
 	ibool	sg 	= FALSE;
+  ib_longlong lstart_time = 0, lfinish_time; /* for timing os_wait */
+  ulint ltime_diff;
+  ulint sec;
+  ulint ms;
 
         /* Acquire the mutex protecting the rw-lock fields */
 	mutex_enter(&(lock->mutex));
@@ -458,7 +475,13 @@
 	       	sg = TRUE;
 		rw_lock_set_waiters(lock, 0);
 	}
-	
+
+  ut_usectime(&sec, &ms);
+  lfinish_time= (ib_longlong)sec * 1000000 + ms;
+
+  ltime_diff= (ulint) (lfinish_time - lock->lx_start_work_time);
+  lock->lxwork_time += ltime_diff;
+
 	mutex_exit(&(lock->mutex));
 
 	if (UNIV_UNLIKELY(sg)) {
@@ -470,6 +493,10 @@
 #ifdef UNIV_SYNC_PERF_STAT
 	rw_x_exit_count++;
 #endif
+  /*fprintf(stderr,
+"Thread %lu X_LOCK unlock at %s \n",
+  (ulong) os_thread_pf(os_thread_get_curr_id()), lock_name);
+*/
 }
 
 /**********************************************************************

--- 1.25/innobase/os/os0sync.c	2005-05-12 20:12:08 +02:00
+++ 1.26/innobase/os/os0sync.c	2005-06-23 11:12:57 +02:00
@@ -121,7 +121,7 @@
 	event->handle = CreateEvent(NULL,/* No security attributes */
 			TRUE,		/* Manual reset */
 			FALSE,		/* Initial state nonsignaled */
-			name);
+			(LPCTSTR) name);
 	if (!event->handle) {
 	        fprintf(stderr,
 "InnoDB: Could not create a Windows event semaphore; Windows error %lu\n",
@@ -177,7 +177,7 @@
 	event->handle = CreateEvent(NULL,/* No security attributes */
 			FALSE,		/* Auto-reset */
 			FALSE,		/* Initial state nonsignaled */
-			name);
+			(LPCTSTR) name);
 
 	if (!event->handle) {
 	        fprintf(stderr,
@@ -440,7 +440,7 @@
 
 	mutex = CreateMutex(NULL,	/* No security attributes */
 			FALSE,		/* Initial state: no owner */
-			name);
+			(LPCTSTR) name);
 	ut_a(mutex);
 #else
 	os_fast_mutex_t*	mutex;

--- 1.82/innobase/srv/srv0start.c	2005-06-10 07:18:40 +02:00
+++ 1.83/innobase/srv/srv0start.c	2005-06-23 11:12:58 +02:00
@@ -1040,7 +1040,9 @@
 
 	srv_start_has_been_called = TRUE;
 
+#ifdef UNIV_DEBUG
 	log_do_write = TRUE;
+#endif /* UNIV_DEBUG */
 /*	yydebug = TRUE; */
 
 	srv_is_being_started = TRUE;
@@ -1554,8 +1556,9 @@
 
 	os_thread_create(&srv_master_thread, NULL, thread_ids + 1 +
 							SRV_MAX_N_IO_THREADS);
+#ifdef UNIV_DEBUG
 	/* buf_debug_prints = TRUE; */
-
+#endif /* UNIV_DEBUG */
 	sum_of_data_file_sizes = 0;
 	
 	for (i = 0; i < srv_n_data_files; i++) {

--- 1.35/innobase/sync/sync0sync.c	2005-05-12 20:12:08 +02:00
+++ 1.36/innobase/sync/sync0sync.c	2005-06-23 11:12:58 +02:00
@@ -1136,8 +1136,12 @@
 	} else if (level == SYNC_DICT_HEADER) {
 		ut_a(sync_thread_levels_g(array, SYNC_DICT_HEADER));
 	} else if (level == SYNC_DICT) {
+#ifdef UNIV_DEBUG
 		ut_a(buf_debug_prints
 		     || sync_thread_levels_g(array, SYNC_DICT));
+#else /* UNIV_DEBUG */
+		ut_a(sync_thread_levels_g(array, SYNC_DICT));
+#endif /* UNIV_DEBUG */
 	} else {
 		ut_error;
 	}

--- 1.212/sql/ha_innodb.cc	2005-06-14 21:12:39 +02:00
+++ 1.213/sql/ha_innodb.cc	2005-06-23 11:12:59 +02:00
@@ -146,8 +146,7 @@
      innobase_buffer_pool_awe_mem_mb,
      innobase_buffer_pool_size, innobase_additional_mem_pool_size,
      innobase_file_io_threads,  innobase_lock_wait_timeout,
-     innobase_thread_concurrency, innobase_force_recovery,
-     innobase_open_files;
+     innobase_force_recovery, innobase_open_files;
 
 /* The default values for the following char* start-up parameters
 are determined in innobase_init below: */
@@ -327,7 +326,7 @@
 /*=========================*/
 	trx_t*	trx)	/* in: transaction handle */
 {
-	if (srv_thread_concurrency >= 500) {
+	if (UNIV_LIKELY(srv_thread_concurrency >= 20)) {
 
 		return;
 	}
@@ -344,7 +343,7 @@
 /*========================*/
 	trx_t*	trx)	/* in: transaction handle */
 {
-	if (srv_thread_concurrency >= 500) {
+	if (UNIV_LIKELY(srv_thread_concurrency >= 20)) {
 
 		return;
 	}
@@ -564,7 +563,7 @@
         thd = (const THD*) input_thd;
 
   	fprintf(f, "MySQL thread id %lu, query id %lu",
-		thd->thread_id, thd->query_id);
+		thd->thread_id, (ulong) thd->query_id);
 	if (thd->host) {
 		putc(' ', f);
 		fputs(thd->host, f);
@@ -1041,7 +1040,19 @@
 		return(EOF);
 	}
 	return(get_quote_char_for_identifier((THD*) trx->mysql_thd,
-						name, namelen));
+						name, (int) namelen));
+}
+
+/**************************************************************************
+Determines if the currently running transaction has been interrupted. */
+extern "C"
+ibool
+trx_is_interrupted(
+/*===============*/
+			/* out: TRUE if interrupted */
+	trx_t*	trx)	/* in: transaction */
+{
+	return(trx && trx->mysql_thd && ((THD*)
trx->mysql_thd)->killed);
 }
 
 /**************************************************************************
@@ -1302,8 +1313,8 @@
 
 	data_mysql_default_charset_coll = (ulint)default_charset_info->number;
 
-	data_mysql_latin1_swedish_charset_coll =
-					(ulint)my_charset_latin1.number;
+	ut_a(DATA_MYSQL_LATIN1_SWEDISH_CHARSET_COLL ==
+					my_charset_latin1.number);
 
 	/* Store the latin1_swedish_ci character ordering table to InnoDB. For
 	non-latin1_swedish_ci charsets we use the MySQL comparison functions,
@@ -1794,7 +1805,7 @@
                         fprintf(stderr,
 "InnoDB: This transaction needs it to be sent up to\n"
 "InnoDB: file %s, position %lu\n", trx->repl_wait_binlog_name,
-                                        (uint)trx->repl_wait_binlog_pos);
+                                        (ulong)trx->repl_wait_binlog_pos);
 
                         innobase_repl_state = 0;
 
@@ -2022,7 +2033,7 @@
 
         longlong2str((ulonglong)savepoint, name, 36);
 
-        error = trx_rollback_to_savepoint_for_mysql(trx, name,
+        error = (int) trx_rollback_to_savepoint_for_mysql(trx, name,
 						&mysql_binlog_cache_pos);
 	DBUG_RETURN(convert_error_code_to_mysql(error, NULL));
 }
@@ -2051,7 +2062,7 @@
 
         longlong2str((ulonglong)savepoint, name, 36);
 
-	error = trx_release_savepoint_for_mysql(trx, name);
+	error = (int) trx_release_savepoint_for_mysql(trx, name);
 
 	DBUG_RETURN(convert_error_code_to_mysql(error, NULL));
 }
@@ -2092,7 +2103,7 @@
         char name[64];
         longlong2str((ulonglong)savepoint,name,36);
 
-        error = trx_savepoint_for_mysql(trx, name, (ib_longlong)0);
+        error = (int) trx_savepoint_for_mysql(trx, name, (ib_longlong)0);
 
 	DBUG_RETURN(convert_error_code_to_mysql(error, NULL));
 }
@@ -2663,7 +2674,7 @@
 			/* out: value */
 	const mysql_byte*	buf)	/* in: from where to read */
 {
-	return((ulint)(buf[0]) + 256 * ((ulint)(buf[1])));
+	return (uint) ((ulint)(buf[0]) + 256 * ((ulint)(buf[1])));
 }
 
 /***********************************************************************
@@ -2867,6 +2878,8 @@
 	ibool		fetch_all_in_key	= FALSE;
 	ibool		fetch_primary_key_cols	= FALSE;
 	ulint		i;
+	/* byte offset of the end of last requested column */
+	ulint		mysql_prefix_len	= 0;
 
 	if (prebuilt->select_lock_type == LOCK_X) {
 		/* We always retrieve the whole clustered index record if we
@@ -2987,6 +3000,11 @@
 					get_field_offset(table, field);
 
 		templ->mysql_col_len = (ulint) field->pack_length();
+		if (mysql_prefix_len < templ->mysql_col_offset
+				+ templ->mysql_col_len) {
+			mysql_prefix_len = templ->mysql_col_offset
+				+ templ->mysql_col_len;
+		}
 		templ->type = index->table->cols[i].type.mtype;
 		templ->mysql_type = (ulint)field->type();
 
@@ -3009,6 +3027,7 @@
 	}
 
 	prebuilt->n_template = n_requested_fields;
+	prebuilt->mysql_prefix_len = mysql_prefix_len;
 
 	if (index != clust_index && prebuilt->need_to_access_clustered) {
 		/* Change rec_field_no's to correspond to the clustered index
@@ -3080,7 +3099,7 @@
 		being blocked by a MySQL table lock TL_WRITE_ALLOW_READ. */
 
 		dict_table_t*	src_table;
-		ibool		mode;
+		ulint		mode;
 
 		num_write_row = 0;
 
@@ -3743,7 +3762,7 @@
 		match_mode = ROW_SEL_EXACT_PREFIX;
 	}
 
-	last_match_mode = match_mode;
+	last_match_mode = (uint) match_mode;
 
 	innodb_srv_conc_enter_innodb(prebuilt->trx);
 
@@ -3763,7 +3782,7 @@
 		error = HA_ERR_KEY_NOT_FOUND;
 		table->status = STATUS_NOT_FOUND;
 	} else {
-		error = convert_error_code_to_mysql(ret, user_thd);
+		error = convert_error_code_to_mysql((int) ret, user_thd);
 		table->status = STATUS_NOT_FOUND;
 	}
 
@@ -3915,7 +3934,7 @@
 		error = HA_ERR_END_OF_FILE;
 		table->status = STATUS_NOT_FOUND;
 	} else {
-		error = convert_error_code_to_mysql(ret, user_thd);
+		error = convert_error_code_to_mysql((int) ret, user_thd);
 		table->status = STATUS_NOT_FOUND;
 	}
 
@@ -4864,7 +4883,7 @@
 	}
 
 	ptr++;
-	namebuf = my_malloc(len + 2, MYF(0));
+	namebuf = my_malloc((uint) len + 2, MYF(0));
 
 	memcpy(namebuf, ptr, len);
 	namebuf[len] = '/';
@@ -5430,7 +5449,7 @@
 				info on foreign keys */
         const char*	comment)/* in: table comment defined by user */
 {
-	uint	length			= strlen(comment);
+	uint	length			= (uint) strlen(comment);
 	char*				str;
 	row_prebuilt_t*	prebuilt	= (row_prebuilt_t*)innobase_prebuilt;
 
@@ -5482,7 +5501,7 @@
 				*pos++ = ' ';
 			}
 			rewind(file);
-			flen = fread(pos, 1, flen, file);
+			flen = (uint) fread(pos, 1, flen, file);
 			pos[flen] = 0;
 		}
 
@@ -5545,7 +5564,7 @@
 
 		if (str) {
 			rewind(file);
-			flen = fread(str, 1, flen, file);
+			flen = (uint) fread(str, 1, flen, file);
 			str[flen] = 0;
 		}
 
@@ -5585,8 +5604,8 @@
     while (tmp_buff[i] != '/')
       i++;
     tmp_buff+= i + 1;
-    f_key_info.forein_id= make_lex_string(thd, 0,
-                                          tmp_buff, strlen(tmp_buff), 1);
+    f_key_info.forein_id= make_lex_string(thd, 0, tmp_buff,
+                                          (uint) strlen(tmp_buff), 1);
     tmp_buff= foreign->referenced_table_name;
     i= 0;
     while (tmp_buff[i] != '/')
@@ -5594,16 +5613,16 @@
     f_key_info.referenced_db= make_lex_string(thd, 0,
                                               tmp_buff, i, 1);
     tmp_buff+= i + 1;
-    f_key_info.referenced_table= make_lex_string(thd, 0,
-                                               tmp_buff, strlen(tmp_buff), 1);
+    f_key_info.referenced_table= make_lex_string(thd, 0, tmp_buff, 
+                                               (uint) strlen(tmp_buff), 1);
 
     for (i= 0;;)
     {
       tmp_buff= foreign->foreign_col_names[i];
-      name= make_lex_string(thd, name, tmp_buff, strlen(tmp_buff), 1);
+      name= make_lex_string(thd, name, tmp_buff, (uint) strlen(tmp_buff), 1);
       f_key_info.foreign_fields.push_back(name);
       tmp_buff= foreign->referenced_col_names[i];
-      name= make_lex_string(thd, name, tmp_buff, strlen(tmp_buff), 1);
+      name= make_lex_string(thd, name, tmp_buff, (uint) strlen(tmp_buff), 1);
       f_key_info.referenced_fields.push_back(name);
       if (++i >= foreign->n_fields)
         break;
@@ -5991,12 +6010,12 @@
 
 				ulint	error;
 				error = row_lock_table_for_mysql(prebuilt,
-							NULL, LOCK_TABLE_EXP);
+							NULL, 0);
 
 				if (error != DB_SUCCESS) {
 					error = convert_error_code_to_mysql(
-						error, user_thd);
-					DBUG_RETURN(error);
+						(int) error, user_thd);
+					DBUG_RETURN((int) error);
 				}
 			}
 
@@ -6011,9 +6030,6 @@
 	trx->n_mysql_tables_in_use--;
 	prebuilt->mysql_has_locked = FALSE;
 
-	if (trx->n_lock_table_exp) {
-		row_unlock_tables_for_mysql(trx);
-	}
 
 	/* If the MySQL lock count drops to zero we know that the current SQL
 	statement has ended */
@@ -6055,7 +6071,7 @@
 int
 ha_innobase::transactional_table_lock(
 /*==================================*/
-			        /* out: 0 */
+			        /* out: error code */
 	THD*	thd,		/* in: handle to the user thread */
 	int 	lock_type)	/* in: lock type */
 {
@@ -6119,12 +6135,11 @@
 	if (thd->in_lock_tables && thd->variables.innodb_table_locks) {
 		ulint	error = DB_SUCCESS;
 
-		error = row_lock_table_for_mysql(prebuilt,NULL,
-						LOCK_TABLE_TRANSACTIONAL);
+		error = row_lock_table_for_mysql(prebuilt, NULL, 0);
 
 		if (error != DB_SUCCESS) {
-			error = convert_error_code_to_mysql(error, user_thd);
-			DBUG_RETURN(error);
+			error = convert_error_code_to_mysql((int) error, user_thd);
+			DBUG_RETURN((int) error);
 		}
 
 		if (thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) {
@@ -6214,22 +6229,22 @@
 	rewind(srv_monitor_file);
 	if (flen < MAX_STATUS_SIZE) {
 		/* Display the entire output. */
-		flen = fread(str, 1, flen, srv_monitor_file);
+		flen = (long) fread(str, 1, flen, srv_monitor_file);
 	} else if (trx_list_end < (ulint) flen
 			&& trx_list_start < trx_list_end
 			&& trx_list_start + (flen - trx_list_end)
 			< MAX_STATUS_SIZE - sizeof truncated_msg - 1) {
 		/* Omit the beginning of the list of active transactions. */
-		long	len = fread(str, 1, trx_list_start, srv_monitor_file);
+		long len = (long) fread(str, 1, trx_list_start, srv_monitor_file);
 		memcpy(str + len, truncated_msg, sizeof truncated_msg - 1);
 		len += sizeof truncated_msg - 1;
 		usable_len = (MAX_STATUS_SIZE - 1) - len;
 		fseek(srv_monitor_file, flen - usable_len, SEEK_SET);
-		len += fread(str + len, 1, usable_len, srv_monitor_file);
+		len += (long) fread(str + len, 1, usable_len, srv_monitor_file);
 		flen = len;
 	} else {
 		/* Omit the end of the output. */
-		flen = fread(str, 1, MAX_STATUS_SIZE - 1, srv_monitor_file);
+		flen = (long) fread(str, 1, MAX_STATUS_SIZE - 1, srv_monitor_file);
 	}
 
 	mutex_exit_noninline(&srv_monitor_file_mutex);
@@ -6912,7 +6927,7 @@
 	ulint n_chars;		/* number of characters in prefix */
 	CHARSET_INFO* charset;	/* charset used in the field */
 
-	charset = get_charset(charset_id, MYF(MY_WME));
+	charset = get_charset((uint) charset_id, MYF(MY_WME));
 
 	ut_ad(charset);
 	ut_ad(charset->mbmaxlen);
@@ -6946,7 +6961,7 @@
 		whole string. */
 
 		char_length = my_charpos(charset, str,
-						str + data_len, n_chars);
+						str + data_len, (int) n_chars);
 		if (char_length > data_len) {
 			char_length = data_len;
 		}		
@@ -7069,7 +7084,7 @@
 
                 ut_ad(trx->active_trans);
 
-		error = trx_prepare_for_mysql(trx);
+		error = (int) trx_prepare_for_mysql(trx);
 	} else {
 	        /* We just mark the SQL statement ended and do not do a
 		transaction prepare */

--- 1.96/sql/ha_innodb.h	2005-06-14 21:12:40 +02:00
+++ 1.97/sql/ha_innodb.h	2005-06-23 11:13:00 +02:00
@@ -218,7 +218,7 @@
 extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size;
 extern long innobase_buffer_pool_awe_mem_mb;
 extern long innobase_file_io_threads, innobase_lock_wait_timeout;
-extern long innobase_force_recovery, innobase_thread_concurrency;
+extern long innobase_force_recovery;
 extern long innobase_open_files;
 extern char *innobase_data_home_dir, *innobase_data_file_path;
 extern char *innobase_log_group_home_dir, *innobase_log_arch_dir;

--- 1.118/sql/set_var.cc	2005-06-10 07:18:43 +02:00
+++ 1.119/sql/set_var.cc	2005-06-23 11:13:02 +02:00
@@ -1619,7 +1619,10 @@
   if (var->value->result_type() == STRING_RESULT)
   {
     if (!(res= var->value->val_str(&str)))
+    {
+      strmake(buff, "NULL", 4);
       goto err;
+    }
     var->save_result.ulong_value= ((ulong)
 				   find_set(enum_names, res->c_ptr(),
 					    res->length(),
@@ -3131,7 +3134,7 @@
     if (!(res=var->value->val_str(&str)) ||
 	!(var->save_result.ulong_value=
           (ulong) (db_type= ha_resolve_by_name(res->ptr(), res->length()))) ||
-        ha_checktype(db_type) != db_type)
+        ha_checktype(thd, db_type, 1, 0) != db_type)
     {
       value= res ? res->c_ptr() : "NULL";
       goto err;
@@ -3406,7 +3409,7 @@
   Used templates
 ****************************************************************************/
 
-#ifdef __GNUC__
+#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
 template class List<set_var_base>;
 template class List_iterator_fast<set_var_base>;
 template class I_List_iterator<NAMED_LIST>;
Thread
bk commit into 5.0-hp tree (vtkachenko:1.1999)Vadim Tkachenko23 Jun