3327 Tor Didriksen 2011-05-26 [merge]
empty merge trunk => opt-team
3326 Tor Didriksen 2011-05-26 [merge]
Automerge trunk => opt-team
added:
include/mysql/thread_pool_priv.h
mysql-test/include/not_threadpool.inc
mysql-test/r/status_bug17954.result
mysql-test/suite/innodb/r/innodb-bug12552164.result
mysql-test/suite/innodb/t/innodb-bug12552164.test
mysql-test/suite/rpl/t/rpl_typeconv-master.opt
mysql-test/t/status_bug17954.test
modified:
BUILD/SETUP.sh
BUILD/build_mccge.sh
client/mysql.cc
cmake/configure.pl
cmake/os/WindowsCache.cmake
include/my_compiler.h
include/my_sys.h
include/mysql/plugin_audit.h.pp
include/mysql/plugin_auth.h.pp
include/mysql/plugin_ftparser.h.pp
include/mysql/service_thd_wait.h
libmysqld/lib_sql.cc
mysql-test/collections/default.experimental
mysql-test/include/have_archive_plugin.inc
mysql-test/include/have_blackhole_plugin.inc
mysql-test/include/plugin.defs
mysql-test/include/range.inc
mysql-test/lib/mtr_misc.pl
mysql-test/mysql-test-run.pl
mysql-test/r/group_min_max.result
mysql-test/r/range_icp.result
mysql-test/r/range_icp_mrr.result
mysql-test/r/range_mrr.result
mysql-test/r/range_mrr_cost.result
mysql-test/r/range_none.result
mysql-test/r/status.result
mysql-test/suite/binlog/t/disabled.def
mysql-test/suite/federated/disabled.def
mysql-test/suite/innodb/r/innodb-index.result
mysql-test/suite/innodb/r/innodb.result
mysql-test/suite/innodb/r/innodb_mysql.result
mysql-test/suite/innodb/t/innodb-index.test
mysql-test/suite/innodb/t/innodb.test
mysql-test/suite/innodb/t/innodb_mysql.test
mysql-test/suite/parts/inc/partition_fail_t2.inc
mysql-test/suite/parts/r/partition_debug.result
mysql-test/suite/parts/r/partition_debug_innodb.result
mysql-test/suite/perfschema/t/no_threads.test
mysql-test/suite/perfschema/t/one_thread_per_con.test
mysql-test/suite/rpl/r/rpl_relayspace.result
mysql-test/suite/rpl/t/disabled.def
mysql-test/suite/rpl/t/rpl_relayspace.test
mysql-test/suite/sys_vars/t/all_vars.test
mysql-test/suite/sys_vars/t/disabled.def
mysql-test/suite/sys_vars/t/slow_launch_time_func.test
mysql-test/suite/sys_vars/t/thread_cache_size_func.test
mysql-test/suite/sys_vars/t/wait_timeout_func.test
mysql-test/t/disabled.def
mysql-test/t/information_schema.test
mysql-test/t/information_schema_db.test
mysql-test/t/kill.test
mysql-test/t/mysqlshow.test
mysql-test/t/named_pipe.test
mysql-test/t/no-threads.test
mysql-test/t/shm.test
mysql-test/t/status.test
mysys/my_sync.c
sql/debug_sync.cc
sql/debug_sync.h
sql/derror.cc
sql/events.cc
sql/field.cc
sql/ha_ndbcluster.cc
sql/ha_ndbcluster_binlog.cc
sql/ha_partition.cc
sql/handler.cc
sql/item_create.cc
sql/item_func.cc
sql/item_strfunc.cc
sql/log.cc
sql/log.h
sql/log_event.cc
sql/mdl.cc
sql/mysqld.cc
sql/mysqld.h
sql/opt_range.cc
sql/rpl_rli.cc
sql/rpl_slave.cc
sql/scheduler.cc
sql/scheduler.h
sql/set_var.cc
sql/sp_head.cc
sql/sp_head.h
sql/sql_acl.cc
sql/sql_base.cc
sql/sql_binlog.cc
sql/sql_class.cc
sql/sql_class.h
sql/sql_connect.cc
sql/sql_connect.h
sql/sql_cursor.h
sql/sql_insert.cc
sql/sql_parse.cc
sql/sql_partition.cc
sql/sql_partition_admin.cc
sql/sql_plugin.cc
sql/sql_prepare.cc
sql/sql_reload.cc
sql/sql_show.cc
sql/sql_table.cc
sql/sql_yacc.yy
sql/sys_vars.cc
sql/table.cc
sql/unireg.cc
storage/example/ha_example.cc
storage/innobase/buf/buf0buf.c
storage/innobase/buf/buf0flu.c
storage/innobase/dict/dict0crea.c
storage/innobase/fil/fil0fil.c
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/i_s.cc
storage/innobase/include/buf0buf.h
storage/innobase/include/lock0priv.h
storage/innobase/include/lock0priv.ic
storage/innobase/include/os0file.h
storage/innobase/include/os0file.ic
storage/innobase/include/page0page.h
storage/innobase/include/page0page.ic
storage/innobase/include/row0row.h
storage/innobase/include/row0row.ic
storage/innobase/include/trx0purge.h
storage/innobase/include/trx0rec.h
storage/innobase/include/trx0trx.h
storage/innobase/include/trx0types.h
storage/innobase/include/ut0ut.h
storage/innobase/lock/lock0lock.c
storage/innobase/log/log0recv.c
storage/innobase/os/os0file.c
storage/innobase/page/page0page.c
storage/innobase/que/que0que.c
storage/innobase/row/row0merge.c
storage/innobase/row/row0mysql.c
storage/innobase/row/row0row.c
storage/innobase/row/row0vers.c
storage/innobase/srv/srv0conc.c
storage/innobase/srv/srv0start.c
storage/innobase/trx/trx0purge.c
storage/innobase/trx/trx0rec.c
storage/innobase/ut/ut0ut.c
strings/ctype-uca.c
unittest/gunit/mdl-t.cc
unittest/gunit/mdl_mytap-t.cc
3325 Tor Didriksen 2011-05-26 [merge]
Automerge opt-backporting => opt-team
modified:
sql/item_subselect.cc
sql/sql_array.h
sql/sql_base.cc
sql/sql_select.cc
sql/sql_select.h
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh 2011-05-06 13:21:38 +0000
+++ b/BUILD/SETUP.sh 2011-05-25 10:45:37 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
-# Copyright (C) 2000, 2007 MySQL AB
+# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
@@ -250,7 +250,7 @@ gcov_compile_flags="$gcov_compile_flags
gcov_link_flags="-fprofile-arcs -ftest-coverage"
-gcov_configs="--disable-shared"
+gcov_configs="--with-gcov"
# gprof
=== modified file 'BUILD/build_mccge.sh'
--- a/BUILD/build_mccge.sh 2011-01-21 16:14:47 +0000
+++ b/BUILD/build_mccge.sh 2011-05-04 09:54:04 +0000
@@ -293,7 +293,8 @@ extended_usage()
version string suffix: [none]
All packages except Classic include support for user-defined
- partitioning.
+ partitioning. All packages include support for Performance
+ Schema.
If --with-debug is used, an additional "-debug" is appended to the
version string.
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2011-05-06 08:26:00 +0000
+++ b/client/mysql.cc 2011-05-18 14:36:45 +0000
@@ -3764,8 +3764,6 @@ com_tee(String *buffer __attribute__((un
{
char file_name[FN_REFLEN], *end, *param;
- if (status.batch)
- return 0;
while (my_isspace(charset_info,*line))
line++;
if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default
=== modified file 'cmake/configure.pl'
--- a/cmake/configure.pl 2010-11-12 01:40:51 +0000
+++ b/cmake/configure.pl 2011-05-25 10:45:37 +0000
@@ -195,6 +195,11 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." \"-DWITH_COMMENT=".substr($option,13)."\"";
next;
}
+ if ($option =~ /with-gcov/)
+ {
+ $cmakeargs = $cmakeargs." -DENABLE_GCOV=ON";
+ next;
+ }
$option = uc($option);
$option =~ s/-/_/g;
=== modified file 'cmake/os/WindowsCache.cmake'
--- a/cmake/os/WindowsCache.cmake 2011-04-30 05:36:44 +0000
+++ b/cmake/os/WindowsCache.cmake 2011-05-26 08:14:09 +0000
@@ -347,6 +347,7 @@ SET(SIGNAL_RETURN_TYPE_IS_VOID 1 CACHE I
SET(C_HAS_inline CACHE INTERNAL "")
SET(C_HAS___inline 1 CACHE INTERNAL "")
SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "")
+SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "")
SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "")
SET(HAVE_CXXABI_H CACHE INTERNAL "")
SET(HAVE_NDIR_H CACHE INTERNAL "")
=== modified file 'include/my_compiler.h'
--- a/include/my_compiler.h 2011-02-22 21:03:32 +0000
+++ b/include/my_compiler.h 2011-05-04 08:45:51 +0000
@@ -140,6 +140,14 @@ struct my_aligned_storage
#endif /* __cplusplus */
+# ifndef MY_ALIGNED
+/*
+ Make sure MY_ALIGNED can be used also on platforms where we don't
+ have a way of aligning data structures.
+*/
+#define MY_ALIGNED(size)
+#endif
+
#include <my_attribute.h>
#endif /* MY_COMPILER_INCLUDED */
=== modified file 'include/my_sys.h'
--- a/include/my_sys.h 2011-03-11 09:35:38 +0000
+++ b/include/my_sys.h 2011-05-21 09:30:35 +0000
@@ -483,7 +483,8 @@ typedef struct st_io_cache /* Used when
typedef int (*qsort2_cmp)(const void *, const void *, const void *);
-typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...);
+typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
+ ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
extern my_error_reporter my_charset_error_reporter;
@@ -625,6 +626,8 @@ extern FILE *my_freopen(const char *path
extern int my_fclose(FILE *fd,myf MyFlags);
extern File my_fileno(FILE *fd);
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
+extern void thr_set_sync_wait_callback(void (*before_sync)(void),
+ void (*after_sync)(void));
extern int my_sync(File fd, myf my_flags);
extern int my_sync_dir(const char *dir_name, myf my_flags);
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
=== modified file 'include/mysql/plugin_audit.h.pp'
--- a/include/mysql/plugin_audit.h.pp 2011-03-09 20:54:55 +0000
+++ b/include/mysql/plugin_audit.h.pp 2011-05-04 09:54:04 +0000
@@ -34,16 +34,23 @@ MYSQL_LEX_STRING *thd_make_lex_string(vo
int allocate_lex_string);
#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
- THD_WAIT_MUTEX= 1,
+ THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_TABLE_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, thd_wait_type);
+ void (*thd_wait_begin_func)(void*, int);
void (*thd_wait_end_func)(void*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, thd_wait_type wait_type);
+void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
=== modified file 'include/mysql/plugin_auth.h.pp'
--- a/include/mysql/plugin_auth.h.pp 2011-03-09 20:54:55 +0000
+++ b/include/mysql/plugin_auth.h.pp 2011-05-04 09:54:04 +0000
@@ -34,16 +34,23 @@ MYSQL_LEX_STRING *thd_make_lex_string(vo
int allocate_lex_string);
#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
- THD_WAIT_MUTEX= 1,
+ THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_TABLE_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, thd_wait_type);
+ void (*thd_wait_begin_func)(void*, int);
void (*thd_wait_end_func)(void*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, thd_wait_type wait_type);
+void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
=== modified file 'include/mysql/plugin_ftparser.h.pp'
--- a/include/mysql/plugin_ftparser.h.pp 2011-03-09 20:54:55 +0000
+++ b/include/mysql/plugin_ftparser.h.pp 2011-05-04 09:54:04 +0000
@@ -34,16 +34,23 @@ MYSQL_LEX_STRING *thd_make_lex_string(vo
int allocate_lex_string);
#include <mysql/service_thd_wait.h>
typedef enum _thd_wait_type_e {
- THD_WAIT_MUTEX= 1,
+ THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_TABLE_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(void*, thd_wait_type);
+ void (*thd_wait_begin_func)(void*, int);
void (*thd_wait_end_func)(void*);
} *thd_wait_service;
-void thd_wait_begin(void* thd, thd_wait_type wait_type);
+void thd_wait_begin(void* thd, int wait_type);
void thd_wait_end(void* thd);
#include <mysql/service_thread_scheduler.h>
struct scheduler_functions;
=== modified file 'include/mysql/service_thd_wait.h'
--- a/include/mysql/service_thd_wait.h 2010-06-07 14:01:39 +0000
+++ b/include/mysql/service_thd_wait.h 2011-03-04 12:12:31 +0000
@@ -50,15 +50,35 @@
extern "C" {
#endif
+/*
+ One should only report wait events that could potentially block for a
+ long time. A mutex wait is too short of an event to report. The reason
+ is that an event which is reported leads to a new thread starts
+ executing a query and this has a negative impact of usage of CPU caches
+ and thus the expected gain of starting a new thread must be higher than
+ the expected cost of lost performance due to starting a new thread.
+
+ Good examples of events that should be reported are waiting for row locks
+ that could easily be for many milliseconds or even seconds and the same
+ holds true for global read locks, table locks and other meta data locks.
+ Another event of interest is going to sleep for an extended time.
+*/
typedef enum _thd_wait_type_e {
- THD_WAIT_MUTEX= 1,
+ THD_WAIT_SLEEP= 1,
THD_WAIT_DISKIO= 2,
- THD_WAIT_ROW_TABLE_LOCK= 3,
- THD_WAIT_GLOBAL_LOCK= 4
+ THD_WAIT_ROW_LOCK= 3,
+ THD_WAIT_GLOBAL_LOCK= 4,
+ THD_WAIT_META_DATA_LOCK= 5,
+ THD_WAIT_TABLE_LOCK= 6,
+ THD_WAIT_USER_LOCK= 7,
+ THD_WAIT_BINLOG= 8,
+ THD_WAIT_GROUP_COMMIT= 9,
+ THD_WAIT_SYNC= 10,
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
- void (*thd_wait_begin_func)(MYSQL_THD, thd_wait_type);
+ void (*thd_wait_begin_func)(MYSQL_THD, int);
void (*thd_wait_end_func)(MYSQL_THD);
} *thd_wait_service;
@@ -70,7 +90,7 @@ extern struct thd_wait_service_st {
#else
-void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type);
+void thd_wait_begin(MYSQL_THD thd, int wait_type);
void thd_wait_end(MYSQL_THD thd);
#endif
=== added file 'include/mysql/thread_pool_priv.h'
--- a/include/mysql/thread_pool_priv.h 1970-01-01 00:00:00 +0000
+++ b/include/mysql/thread_pool_priv.h 2011-05-25 10:17:27 +0000
@@ -0,0 +1,121 @@
+/*
+ Copyright (C) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef THREAD_POOL_PRIV_INCLUDED
+#define THREAD_POOL_PRIV_INCLUDED
+
+/*
+ The thread pool requires access to some MySQL server error codes, this is
+ accessed from mysqld_error.h.
+ We need access to the struct that defines the thread pool plugin interface
+ which is accessed through scheduler.h.
+ All accesses to THD variables and functions are defined in this header file.
+ A thread pool can also use DEBUG_SYNC and must thus include
+ debug_sync.h
+ To handle definitions of Information Schema plugins it is also required
+ to include sql_profile.h and table.h.
+*/
+#include <mysqld_error.h> /* To get ER_ERROR_ON_READ */
+#define MYSQL_SERVER 1
+#include <scheduler.h>
+#include <debug_sync.h>
+#include <sql_profile.h>
+#include <table.h>
+
+/* Needed to get access to scheduler variables */
+void* thd_get_scheduler_data(THD *thd);
+void thd_set_scheduler_data(THD *thd, void *data);
+PSI_thread* thd_get_psi(THD *thd);
+void thd_set_psi(THD *thd, PSI_thread *psi);
+
+/* Interface to THD variables and functions */
+void thd_set_killed(THD *thd);
+void thd_clear_errors(THD *thd);
+void thd_set_thread_stack(THD *thd, char *stack_start);
+void thd_lock_thread_count(THD *thd);
+void thd_unlock_thread_count(THD *thd);
+void thd_close_connection(THD *thd);
+THD *thd_get_current_thd();
+void thd_new_connection_setup(THD *thd, char *stack_start);
+void thd_lock_data(THD *thd);
+void thd_unlock_data(THD *thd);
+bool thd_is_transaction_active(THD *thd);
+int thd_connection_has_data(THD *thd);
+void thd_set_net_read_write(THD *thd, uint val);
+void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
+my_socket thd_get_fd(THD *thd);
+
+/* Print to the MySQL error log */
+void sql_print_error(const char *format, ...);
+
+/* Store a table record */
+bool schema_table_store_record(THD *thd, TABLE *table);
+
+/*
+ The thread pool must be able to execute statements using the connection
+ state in THD object. This is the main objective of the thread pool to
+ schedule the start of these commands.
+*/
+bool do_command(THD *thd);
+
+/*
+ The thread pool requires an interface to the connection logic in the
+ MySQL Server since the thread pool will maintain the event logic on
+ the TCP connection of the MySQL Server. Thus new connections, dropped
+ connections will be discovered by the thread pool and it needs to
+ ensure that the proper MySQL Server logic attached to these events is
+ executed.
+*/
+/* Initialise a new connection handler thread */
+bool init_new_connection_handler_thread();
+/* Set up connection thread before use as execution thread */
+bool setup_connection_thread_globals(THD *thd);
+/* Prepare connection as part of connection set-up */
+bool thd_prepare_connection(THD *thd);
+/* Release auditing before executing statement */
+void mysql_audit_release(THD *thd);
+/* Check if connection is still alive */
+bool thd_is_connection_alive(THD *thd);
+/* Close connection with possible error code */
+void close_connection(THD *thd, uint errcode);
+/* End the connection before closing it */
+void end_connection(THD *thd);
+/* Cleanup the THD object */
+void thd_cleanup(THD *thd);
+/* Decrement connection counter */
+void dec_connection_count();
+/* Destroy THD object */
+void delete_thd(THD *thd);
+
+/*
+ thread_created is maintained by thread pool when activated since
+ user threads are created by the thread pool (and also special
+ threads to maintain the thread pool). This is done through
+ inc_thread_created.
+
+ max_connections is needed to calculate the maximum number of threads
+ that is allowed to be started by the thread pool. The method
+ get_max_connections() gets reference to this variable.
+
+ connection_attrib is the thread attributes for connection threads,
+ the method get_connection_attrib provides a reference to these
+ attributes.
+*/
+void inc_thread_created(void);
+ulong get_max_connections(void);
+pthread_attr_t *get_connection_attrib(void);
+#endif
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc 2011-03-09 20:54:55 +0000
+++ b/libmysqld/lib_sql.cc 2011-05-24 09:21:24 +0000
@@ -50,6 +50,24 @@ extern "C" void unireg_clear(int exit_co
DBUG_VOID_RETURN;
}
+/*
+ Wrapper error handler for embedded server to call client/server error
+ handler based on whether thread is in client/server context
+*/
+
+static void embedded_error_handler(uint error, const char *str, myf MyFlags)
+{
+ DBUG_ENTER("embedded_error_handler");
+
+ /*
+ If current_thd is NULL, it means restore_global has been called and
+ thread is in client context, then call client error handler else call
+ server error handler.
+ */
+ DBUG_RETURN(current_thd ? my_message_sql(error, str, MyFlags):
+ my_message_stderr(error, str, MyFlags));
+}
+
/*
Reads error information from the MYSQL_DATA and puts
@@ -106,7 +124,8 @@ emb_advanced_command(MYSQL *mysql, enum
if (mysql->status != MYSQL_STATUS_READY)
{
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
- return 1;
+ result= 1;
+ goto end;
}
/* Clear result variables */
@@ -147,6 +166,9 @@ emb_advanced_command(MYSQL *mysql, enum
#if defined(ENABLED_PROFILING)
thd->profiling.finish_current_query();
#endif
+
+end:
+ thd->restore_globals();
return result;
}
@@ -555,7 +577,10 @@ int init_embedded_server(int argc, char
return 1;
}
- error_handler_hook = my_message_sql;
+ /*
+ set error_handler_hook to embedded_error_handler wrapper.
+ */
+ error_handler_hook= embedded_error_handler;
acl_error= 0;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental 2011-05-16 18:46:22 +0000
+++ b/mysql-test/collections/default.experimental 2011-05-25 11:36:16 +0000
@@ -2,35 +2,34 @@
# in alphabetical order. This also helps with merge conflict resolution.
binlog.binlog_multi_engine # joro : NDB tests marked as experimental as agreed with bochklin
-binlog.binlog_bug23533 # skozlov: BUG#12371924
funcs_1.charset_collation_1 # depends on compile-time decisions
-main.func_math @freebsd # Bug#43020 2010-05-04 alik main.func_math fails on FreeBSD in PB2
-main.gis-rtree @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
-main.lock_multi_bug38499 # Bug#47448 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
-main.mysqlslap @windows # Bug#54024 2010-08-10 alik mysqlslap fails sporadically starting from Dahlia
-main.outfile_loaddata @solaris # Bug#46895 2010-01-20 alik Test "outfile_loaddata" fails (reproducible)
-main.signal_demo3 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-main.sp @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-main.subquery_sj_none @solaris # Bug#47791 2011-01-28 anitha Several test cases fail on Solaris with error Thread stack overrun
-main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
-main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
+main.func_math @freebsd # Bug#11751977 2010-05-04 alik main.func_math fails on FreeBSD in PB2
+main.gis-rtree @freebsd # Bug#11749418 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
+main.lock_multi_bug38499 # Bug#11755645 2009-09-19 alik main.lock_multi_bug38499 times out sporadically
+main.mysqlslap @windows # Bug#11761520 2010-08-10 alik mysqlslap fails sporadically starting from Dahlia
+main.signal_demo3 @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+main.sp @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+main.subquery_sj_none @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+main.log_tables-big # Bug#11756699 2010-11-15 mattiasj report already exists
+main.type_float @freebsd # Bug#11749418 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
+main.wait_timeout @solaris # Bug#11758972 2010-04-26 alik wait_timeout fails on OpenSolaris
rpl.rpl_checksum # BUG#12370830 2011-04-18 sven rpl_checksum failed on pb2 (server crash)
rpl.rpl_cross_version # BUG#12416611 2011-05-02 sven fails sporadically on pb2, valgrind errors
-rpl.rpl_delayed_slave # BUG#57514 rpl_delayed_slave fails sporadically in pb
+rpl.rpl_delayed_slave # BUG#11764654 rpl_delayed_slave fails sporadically in pb
+rpl.rpl_innodb_bug28430 # Bug#11754425
rpl.rpl_heartbeat_basic # BUG#12403008 2011-04-27 sven fails sporadically
-rpl.rpl_innodb_bug28430 # Bug#46029
rpl.rpl_row_ignorable_event # BUG#12416768 2011-05-02 sven fails sporadically on pb2, result mistmatch in output from mysqlbinlog
-rpl.rpl_row_sp011 @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-rpl.rpl_seconds_behind_master # BUG#58053 2010-11-24 luis fails sporadically on pb2
+rpl.rpl_row_sp011 @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+rpl.rpl_seconds_behind_master # BUG#11765124 2010-11-24 luis fails sporadically on pb2
rpl.rpl_show_slave_hosts # BUG#12416700 2011-05-02 sven fails sporadically
rpl.rpl_show_slave_running # BUG#12346048 2011-04-11 sven fails sporadically on pb2
-sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
-sys_vars.plugin_dir_basic # Bug#52223 2010-11-24 alik Test "plugin_dir_basic" does not support RPM build (test) directory structure
-sys_vars.wait_timeout_func # Bug#41255 2010-04-26 alik wait_timeout_func fails
+sys_vars.max_sp_recursion_depth_func @solaris # Bug#11755949 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
+sys_vars.plugin_dir_basic # Bug#11759877 2010-11-24 alik Test "plugin_dir_basic" does not support RPM build (test) directory structure
+sys_vars.wait_timeout_func # Bug#11750645 2010-04-26 alik wait_timeout_func fails
# BUG #59055 : All ndb tests should be removed from the repository
# Leaving the sys_vars tests for now. sys_vars.all_vars.test fails on removing ndb tests
@@ -40,7 +39,6 @@ sys_vars.ndb_log_updated_only_basic
sys_vars.rpl_init_slave_func # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5
rpl_bhs.* # skozlov : WL#5139 - rpl_bhs suite generated "on-the-fly" at testing moment from rpl suite
-main.gis-rtree # svoj: due to BUG#38965
-main.type_float # svoj: due to BUG#38965
-main.type_newdecimal # svoj: due to BUG#38965
-
+main.gis-rtree # svoj: due to BUG#11749418
+main.type_float # svoj: due to BUG#11749418
+main.type_newdecimal # svoj: due to BUG#11749418
=== modified file 'mysql-test/include/have_archive_plugin.inc'
--- a/mysql-test/include/have_archive_plugin.inc 2010-04-27 08:29:51 +0000
+++ b/mysql-test/include/have_archive_plugin.inc 2011-05-04 09:54:04 +0000
@@ -1,5 +1,10 @@
+disable_query_log;
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%archive%'`)
{
--skip archive plugin not available
}
+if (`SELECT @@plugin_dir != '$ARCHIVE_PLUGIN_DIR'`) {
+ --skip Archive plugin requires that --plugin-dir is set to the archive plugin dir (either the .opt file does not contain \$ARCHIVE_PLUGIN_OPT or another plugin is in use)
+}
+enable_query_log;
\ No newline at end of file
=== modified file 'mysql-test/include/have_blackhole_plugin.inc'
--- a/mysql-test/include/have_blackhole_plugin.inc 2010-04-27 08:29:51 +0000
+++ b/mysql-test/include/have_blackhole_plugin.inc 2011-05-04 09:54:04 +0000
@@ -1,5 +1,11 @@
+disable_query_log;
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%blackhole%'`)
{
--skip blackhole plugin not available;
}
+if (`SELECT @@plugin_dir != '$BLACKHOLE_PLUGIN_DIR'`) {
+ --skip Blackhole plugin requires that --plugin-dir is set to the blackhole plugin dir (either the .opt file does not contain \$BLACKHOLE_PLUGIN_OPT or another plugin is in use)
+}
+enable_query_log;
+
=== added file 'mysql-test/include/not_threadpool.inc'
--- a/mysql-test/include/not_threadpool.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/not_threadpool.inc 2011-01-14 08:28:23 +0000
@@ -0,0 +1,5 @@
+if (`SELECT count(*) FROM information_schema.GLOBAL_VARIABLES WHERE
+ VARIABLE_NAME = 'THREAD_HANDLING' AND
+ VARIABLE_VALUE = 'loaded-dynamically'`){
+ skip Test requires: 'not_threadpool';
+}
=== modified file 'mysql-test/include/plugin.defs'
--- a/mysql-test/include/plugin.defs 2011-01-31 15:32:57 +0000
+++ b/mysql-test/include/plugin.defs 2011-02-10 17:15:19 +0000
@@ -39,3 +39,4 @@ ha_archive storage/archive AR
ha_blackhole storage/blackhole BLACKHOLE_PLUGIN
ha_federated storage/federated FEDERATED_PLUGIN
mypluglib plugin/fulltext SIMPLE_PARSER
+thread_pool plugin/thread_pool THREADPOOL_PLUGIN thread_pool,TP_THREAD_STATE,TP_THREAD_GROUP_STATE,TP_THREAD_GROUP_STATS
=== modified file 'mysql-test/include/range.inc'
--- a/mysql-test/include/range.inc 2011-02-01 12:47:39 +0000
+++ b/mysql-test/include/range.inc 2011-05-19 12:03:55 +0000
@@ -1471,3 +1471,35 @@ INSERT INTO t2 VALUES (1, 1, 2);
EXPLAIN SELECT * FROM t2 WHERE a = 1 AND b >= 2 AND c >= 2;
DROP TABLE t1, t2;
+
+--echo #
+--echo # BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER
+--echo # AWAY QUALIFYING ROWS
+--echo #
+
+CREATE TABLE t10(
+ K INT NOT NULL AUTO_INCREMENT,
+ I INT, J INT,
+ PRIMARY KEY(K),
+ KEY(I,J)
+);
+INSERT INTO t10(I,J) VALUES (6,1),(6,2),(6,3),(6,4),(6,5),
+ (6,6),(6,7),(6,8),(6,9),(6,0);
+
+CREATE TABLE t100 LIKE t10;
+INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y;
+
+# Insert offending value:
+INSERT INTO t100(I,J) VALUES(8,26);
+
+let $query= SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+
+#Verify that 'range' access will be used
+--echo
+--eval EXPLAIN $query
+
+# Only row 101,8,26 should be returned
+--echo
+--eval $query
+
+DROP TABLE t10,t100;
=== modified file 'mysql-test/lib/mtr_misc.pl'
--- a/mysql-test/lib/mtr_misc.pl 2011-04-07 08:39:10 +0000
+++ b/mysql-test/lib/mtr_misc.pl 2011-05-25 10:45:37 +0000
@@ -31,6 +31,7 @@ sub mtr_script_exists(@);
sub mtr_file_exists(@);
sub mtr_exe_exists(@);
sub mtr_exe_maybe_exists(@);
+sub mtr_compress_file($);
sub mtr_milli_sleep($);
sub start_timer($);
sub has_expired($);
@@ -199,6 +200,40 @@ sub mtr_exe_exists (@) {
}
}
+#
+# Try to compress file using tools that might be available.
+# If zip/gzip is not available, just silently ignore.
+#
+
+sub mtr_compress_file ($) {
+ my ($filename)= @_;
+
+ mtr_error ("File to compress not found: $filename") unless -f $filename;
+
+ my $did_compress= 0;
+
+ if (IS_WINDOWS)
+ {
+ # Capture stderr
+ my $ziperr= `zip $filename.zip $filename 2>&1`;
+ if ($?) {
+ print "$ziperr\n" if $ziperr !~ /recognized as an internal or external/;
+ } else {
+ unlink($filename);
+ $did_compress=1;
+ }
+ }
+ else
+ {
+ my $gzres= system("gzip $filename");
+ $did_compress= ! $gzres;
+ if ($gzres && $gzres != -1) {
+ mtr_error ("Error: have gzip but it fails to compress core file");
+ }
+ }
+ mtr_print("Compressed file $filename") if $did_compress;
+}
+
sub mtr_milli_sleep ($) {
die "usage: mtr_milli_sleep(milliseconds)" unless @_ == 1;
=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl 2011-05-12 13:49:50 +0000
+++ b/mysql-test/mysql-test-run.pl 2011-05-25 14:48:51 +0000
@@ -264,7 +264,6 @@ my $opt_shutdown_timeout= $ENV{MTR_SHUTD
my $opt_start_timeout = $ENV{MTR_START_TIMEOUT} || 180; # seconds
sub suite_timeout { return $opt_suite_timeout * 60; };
-sub check_timeout { return $opt_testcase_timeout * 6; };
my $opt_wait_all;
my $opt_user_args;
@@ -300,6 +299,8 @@ sub testcase_timeout ($) {
return $opt_testcase_timeout * 60;
}
+sub check_timeout ($) { return testcase_timeout($_[0]) / 10; }
+
our $opt_warnings= 1;
our $opt_include_ndbcluster= 0;
@@ -658,6 +659,8 @@ sub run_test_server ($$$) {
mtr_report(" - deleting it, already saved",
"$opt_max_save_core");
unlink("$core_file");
+ } else {
+ mtr_compress_file($core_file) unless @opt_cases;
}
++$num_saved_cores;
}
@@ -3415,7 +3418,7 @@ sub check_testcase($$)
# Return immediately if no check proceess was started
return 0 unless ( keys %started );
- my $timeout= start_timer(check_timeout());
+ my $timeout= start_timer(check_timeout($tinfo));
while (1){
my $result;
@@ -3487,7 +3490,7 @@ test case was executed:\n";
}
elsif ( $proc->{timeout} ) {
$tinfo->{comment}.= "Timeout for 'check-testcase' expired after "
- .check_timeout()." seconds";
+ .check_timeout($tinfo)." seconds";
$result= 4;
}
else {
@@ -3577,7 +3580,7 @@ sub run_on_all($$)
# Return immediately if no check proceess was started
return 0 unless ( keys %started );
- my $timeout= start_timer(check_timeout());
+ my $timeout= start_timer(check_timeout($tinfo));
while (1){
my $result;
@@ -3608,7 +3611,7 @@ sub run_on_all($$)
}
elsif ($proc->{timeout}) {
$tinfo->{comment}.= "Timeout for '$run' expired after "
- .check_timeout()." seconds";
+ .check_timeout($tinfo)." seconds";
}
else {
# Unknown process returned, most likley a crash, abort everything
@@ -4333,7 +4336,7 @@ sub check_warnings ($) {
# Return immediately if no check proceess was started
return 0 unless ( keys %started );
- my $timeout= start_timer(check_timeout());
+ my $timeout= start_timer(check_timeout($tinfo));
while (1){
my $result= 0;
@@ -4385,7 +4388,7 @@ sub check_warnings ($) {
}
elsif ( $proc->{timeout} ) {
$tinfo->{comment}.= "Timeout for 'check warnings' expired after "
- .check_timeout()." seconds";
+ .check_timeout($tinfo)." seconds";
$result= 4;
}
else {
=== modified file 'mysql-test/r/group_min_max.result'
--- a/mysql-test/r/group_min_max.result 2011-05-26 05:50:01 +0000
+++ b/mysql-test/r/group_min_max.result 2011-05-26 09:28:17 +0000
@@ -876,10 +876,10 @@ id select_type table type possible_keys
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
explain select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
+1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range NULL idx_t1_1 163 NULL 17 Using where; Using index for group-by
@@ -924,7 +924,7 @@ id select_type table type possible_keys
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
explain select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
+1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by
explain select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by
=== modified file 'mysql-test/r/range_icp.result'
--- a/mysql-test/r/range_icp.result 2011-02-01 12:47:39 +0000
+++ b/mysql-test/r/range_icp.result 2011-05-19 12:03:55 +0000
@@ -1849,4 +1849,28 @@ EXPLAIN SELECT * FROM t2 WHERE a = 1 AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref k,l,m,n l 5 const 69 Using index condition; Using where
DROP TABLE t1, t2;
+#
+# BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER
+# AWAY QUALIFYING ROWS
+#
+CREATE TABLE t10(
+K INT NOT NULL AUTO_INCREMENT,
+I INT, J INT,
+PRIMARY KEY(K),
+KEY(I,J)
+);
+INSERT INTO t10(I,J) VALUES (6,1),(6,2),(6,3),(6,4),(6,5),
+(6,6),(6,7),(6,8),(6,9),(6,0);
+CREATE TABLE t100 LIKE t10;
+INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y;
+INSERT INTO t100(I,J) VALUES(8,26);
+
+EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t100 range I I 10 NULL 4 Using index condition
+
+SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+K I J
+101 8 26
+DROP TABLE t10,t100;
set optimizer_switch=default;
=== modified file 'mysql-test/r/range_icp_mrr.result'
--- a/mysql-test/r/range_icp_mrr.result 2011-02-01 12:47:39 +0000
+++ b/mysql-test/r/range_icp_mrr.result 2011-05-19 12:03:55 +0000
@@ -1849,4 +1849,28 @@ EXPLAIN SELECT * FROM t2 WHERE a = 1 AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref k,l,m,n l 5 const 69 Using index condition; Using where
DROP TABLE t1, t2;
+#
+# BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER
+# AWAY QUALIFYING ROWS
+#
+CREATE TABLE t10(
+K INT NOT NULL AUTO_INCREMENT,
+I INT, J INT,
+PRIMARY KEY(K),
+KEY(I,J)
+);
+INSERT INTO t10(I,J) VALUES (6,1),(6,2),(6,3),(6,4),(6,5),
+(6,6),(6,7),(6,8),(6,9),(6,0);
+CREATE TABLE t100 LIKE t10;
+INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y;
+INSERT INTO t100(I,J) VALUES(8,26);
+
+EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t100 range I I 10 NULL 4 Using index condition; Using MRR
+
+SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+K I J
+101 8 26
+DROP TABLE t10,t100;
set optimizer_switch=default;
=== modified file 'mysql-test/r/range_mrr.result'
--- a/mysql-test/r/range_mrr.result 2011-02-01 12:47:39 +0000
+++ b/mysql-test/r/range_mrr.result 2011-05-19 12:03:55 +0000
@@ -1849,4 +1849,28 @@ EXPLAIN SELECT * FROM t2 WHERE a = 1 AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref k,l,m,n l 5 const 69 Using where
DROP TABLE t1, t2;
+#
+# BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER
+# AWAY QUALIFYING ROWS
+#
+CREATE TABLE t10(
+K INT NOT NULL AUTO_INCREMENT,
+I INT, J INT,
+PRIMARY KEY(K),
+KEY(I,J)
+);
+INSERT INTO t10(I,J) VALUES (6,1),(6,2),(6,3),(6,4),(6,5),
+(6,6),(6,7),(6,8),(6,9),(6,0);
+CREATE TABLE t100 LIKE t10;
+INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y;
+INSERT INTO t100(I,J) VALUES(8,26);
+
+EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t100 range I I 10 NULL 4 Using where; Using MRR
+
+SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+K I J
+101 8 26
+DROP TABLE t10,t100;
set optimizer_switch=default;
=== modified file 'mysql-test/r/range_mrr_cost.result'
--- a/mysql-test/r/range_mrr_cost.result 2011-02-01 12:47:39 +0000
+++ b/mysql-test/r/range_mrr_cost.result 2011-05-19 12:03:55 +0000
@@ -1849,4 +1849,28 @@ EXPLAIN SELECT * FROM t2 WHERE a = 1 AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref k,l,m,n l 5 const 69 Using where
DROP TABLE t1, t2;
+#
+# BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER
+# AWAY QUALIFYING ROWS
+#
+CREATE TABLE t10(
+K INT NOT NULL AUTO_INCREMENT,
+I INT, J INT,
+PRIMARY KEY(K),
+KEY(I,J)
+);
+INSERT INTO t10(I,J) VALUES (6,1),(6,2),(6,3),(6,4),(6,5),
+(6,6),(6,7),(6,8),(6,9),(6,0);
+CREATE TABLE t100 LIKE t10;
+INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y;
+INSERT INTO t100(I,J) VALUES(8,26);
+
+EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t100 range I I 10 NULL 4 Using where
+
+SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+K I J
+101 8 26
+DROP TABLE t10,t100;
set optimizer_switch=default;
=== modified file 'mysql-test/r/range_none.result'
--- a/mysql-test/r/range_none.result 2011-02-01 12:47:39 +0000
+++ b/mysql-test/r/range_none.result 2011-05-19 12:03:55 +0000
@@ -1848,4 +1848,28 @@ EXPLAIN SELECT * FROM t2 WHERE a = 1 AND
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref k,l,m,n l 5 const 69 Using where
DROP TABLE t1, t2;
+#
+# BUG#11765831: 'RANGE ACCESS' MAY INCORRECTLY FILTER
+# AWAY QUALIFYING ROWS
+#
+CREATE TABLE t10(
+K INT NOT NULL AUTO_INCREMENT,
+I INT, J INT,
+PRIMARY KEY(K),
+KEY(I,J)
+);
+INSERT INTO t10(I,J) VALUES (6,1),(6,2),(6,3),(6,4),(6,5),
+(6,6),(6,7),(6,8),(6,9),(6,0);
+CREATE TABLE t100 LIKE t10;
+INSERT INTO t100(I,J) SELECT X.I, X.K+(10*Y.K) FROM t10 AS X,t10 AS Y;
+INSERT INTO t100(I,J) VALUES(8,26);
+
+EXPLAIN SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t100 range I I 10 NULL 4 Using where
+
+SELECT * FROM t100 WHERE I <> 6 OR (I <> 8 AND J = 5);
+K I J
+101 8 26
+DROP TABLE t10,t100;
set optimizer_switch=default;
=== modified file 'mysql-test/r/status.result'
--- a/mysql-test/r/status.result 2011-02-22 14:24:33 +0000
+++ b/mysql-test/r/status.result 2011-05-04 09:54:04 +0000
@@ -238,11 +238,5 @@ SELECT 9;
9
DROP PROCEDURE p1;
DROP FUNCTION f1;
-DROP VIEW IF EXISTS v1;
-CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
-SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
-SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
-NAME
-DROP VIEW v1;
set @@global.concurrent_insert= @old_concurrent_insert;
SET GLOBAL log_output = @old_log_output;
=== added file 'mysql-test/r/status_bug17954.result'
--- a/mysql-test/r/status_bug17954.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/status_bug17954.result 2011-01-14 08:28:23 +0000
@@ -0,0 +1,13 @@
+set @old_concurrent_insert= @@global.concurrent_insert;
+set @@global.concurrent_insert= 0;
+SET @old_log_output = @@global.log_output;
+SET GLOBAL LOG_OUTPUT = 'FILE';
+flush status;
+DROP VIEW IF EXISTS v1;
+CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
+SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
+NAME
+DROP VIEW v1;
+set @@global.concurrent_insert= @old_concurrent_insert;
+SET GLOBAL log_output = @old_log_output;
=== modified file 'mysql-test/suite/binlog/t/disabled.def'
--- a/mysql-test/suite/binlog/t/disabled.def 2011-03-24 14:41:41 +0000
+++ b/mysql-test/suite/binlog/t/disabled.def 2011-05-24 06:42:00 +0000
@@ -9,5 +9,5 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-binlog_truncate_innodb : BUG#57291 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
-binlog_spurious_ddl_errors : BUG#54195 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled
+binlog_truncate_innodb : BUG#11764459 2010-10-20 anitha Originally disabled due to BUG#42643. Product bug fixed, but test changes needed
+binlog_spurious_ddl_errors : BUG#11761680 2010-06-03 alik binlog_spurious_ddl_errors.test fails, thus disabled
=== modified file 'mysql-test/suite/federated/disabled.def'
--- a/mysql-test/suite/federated/disabled.def 2007-12-12 17:19:24 +0000
+++ b/mysql-test/suite/federated/disabled.def 2011-05-24 06:40:38 +0000
@@ -9,4 +9,4 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-federated_transactions : Bug#29523 Transactions do not work
+federated_transactions : Bug#11746899 Transactions do not work
=== added file 'mysql-test/suite/innodb/r/innodb-bug12552164.result'
--- a/mysql-test/suite/innodb/r/innodb-bug12552164.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb-bug12552164.result 2011-05-19 09:19:12 +0000
@@ -0,0 +1,57 @@
+CREATE TABLE worklog5743 (col_1_CHAR CHAR(255) , col_2_CHAR CHAR(255) ,
+PRIMARY KEY (col_1_CHAR)) engine = innodb;
+INSERT INTO worklog5743 VALUES(repeat("a", 200) , repeat("o", 200));
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+col_1_CHAR = repeat("a", 200) col_2_CHAR = repeat("o", 200)
+1 1
+"In connection 1"
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+col_1_CHAR = repeat("a", 200) col_2_CHAR = repeat("o", 200)
+1 1
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+"In connection 2"
+START TRANSACTION;
+INSERT INTO worklog5743 VALUES(repeat("b", 200) , repeat("o", 200));
+UPDATE worklog5743 SET col_1_CHAR = repeat("d", 200) WHERE col_1_CHAR =
+repeat("a", 200) AND col_2_CHAR = repeat("o", 200);
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+col_1_CHAR = repeat("a", 200) col_2_CHAR = repeat("o", 200)
+0 1
+0 1
+"In connection 1"
+SELECT col_1_CHAR = repeat("b", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+col_1_CHAR = repeat("b", 200) col_2_CHAR = repeat("o", 200)
+0 1
+START TRANSACTION;
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+col_1_CHAR = repeat("a", 200) col_2_CHAR = repeat("o", 200)
+1 1
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+"In connection 2"
+COMMIT;
+SELECT sleep(5);
+sleep(5)
+0
+"In connection 1"
+SELECT col_1_CHAR = repeat("b", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+col_1_CHAR = repeat("b", 200) col_2_CHAR = repeat("o", 200)
+0 1
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+col_1_CHAR = repeat("a", 200) col_2_CHAR = repeat("o", 200)
+1 1
+SELECT COUNT(*) FROM worklog5743;
+COUNT(*)
+1
+COMMIT;
+DROP TABLE worklog5743;
=== modified file 'mysql-test/suite/innodb/r/innodb-index.result'
--- a/mysql-test/suite/innodb/r/innodb-index.result 2010-10-07 11:57:34 +0000
+++ b/mysql-test/suite/innodb/r/innodb-index.result 2011-05-19 12:43:26 +0000
@@ -434,7 +434,6 @@ t3 CREATE TABLE `t3` (
KEY `c` (`c`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t2 drop index b, add index (b);
-ERROR 42000: Incorrect index name 'b'
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
@@ -445,8 +444,8 @@ t2 CREATE TABLE `t2` (
`e` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `dc` (`d`,`c`),
- KEY `b` (`b`),
KEY `c` (`c`),
+ KEY `b` (`b`),
CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`b`) ON DELETE CASCADE,
CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`c`) REFERENCES `t3` (`c`),
CONSTRAINT `t2_ibfk_3` FOREIGN KEY (`d`) REFERENCES `t4` (`d`)
=== modified file 'mysql-test/suite/innodb/r/innodb.result'
--- a/mysql-test/suite/innodb/r/innodb.result 2011-02-21 02:57:30 +0000
+++ b/mysql-test/suite/innodb/r/innodb.result 2011-05-19 12:43:26 +0000
@@ -704,7 +704,6 @@ select count(*) from t1 where cat_code='
count(*)
0
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
-ERROR 42000: Incorrect index name 'sca_pic'
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
select count(*) from t1 where sca_code='PD' and sca_pic is null;
@@ -1673,7 +1672,7 @@ variable_value - @innodb_rows_deleted_or
71
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
variable_value - @innodb_rows_inserted_orig
-1066
+1069
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
variable_value - @innodb_rows_updated_orig
866
=== modified file 'mysql-test/suite/innodb/r/innodb_mysql.result'
--- a/mysql-test/suite/innodb/r/innodb_mysql.result 2011-05-26 05:50:01 +0000
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result 2011-05-26 09:28:17 +0000
@@ -2843,4 +2843,14 @@ Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
DROP TABLE t1;
+#
+# Bug#11762345 54927: DROPPING AND ADDING AN INDEX IN ONE
+# COMMAND CAN FAIL IN INNODB PLUGIN 1.0
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (id int, a int, b int, PRIMARY KEY (id),
+INDEX a (a)) ENGINE=innodb;
+ALTER TABLE t1 DROP INDEX a, ADD INDEX a (b, a);
+ALTER TABLE t1 DROP INDEX a, ADD INDEX (a, b);
+DROP TABLE t1;
End of 6.0 tests
=== added file 'mysql-test/suite/innodb/t/innodb-bug12552164.test'
--- a/mysql-test/suite/innodb/t/innodb-bug12552164.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb-bug12552164.test 2011-05-19 09:19:12 +0000
@@ -0,0 +1,50 @@
+CREATE TABLE worklog5743 (col_1_CHAR CHAR(255) , col_2_CHAR CHAR(255) ,
+PRIMARY KEY (col_1_CHAR)) engine = innodb;
+INSERT INTO worklog5743 VALUES(repeat("a", 200) , repeat("o", 200));
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+
+--echo "In connection 1"
+--connect (con1,localhost,root,,)
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+SELECT COUNT(*) FROM worklog5743;
+
+
+--echo "In connection 2"
+--connect (con2,localhost,root,,)
+START TRANSACTION;
+INSERT INTO worklog5743 VALUES(repeat("b", 200) , repeat("o", 200));
+UPDATE worklog5743 SET col_1_CHAR = repeat("d", 200) WHERE col_1_CHAR =
+repeat("a", 200) AND col_2_CHAR = repeat("o", 200);
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+
+
+--echo "In connection 1"
+--connection con1
+SELECT col_1_CHAR = repeat("b", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+
+START TRANSACTION;
+
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+SELECT COUNT(*) FROM worklog5743;
+
+--echo "In connection 2"
+--connection con2
+COMMIT;
+SELECT sleep(5);
+
+--echo "In connection 1"
+--connection con1
+SELECT col_1_CHAR = repeat("b", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+SELECT col_1_CHAR = repeat("a", 200) , col_2_CHAR = repeat("o", 200) FROM
+worklog5743;
+SELECT COUNT(*) FROM worklog5743;
+COMMIT;
+
+--connection default
+DROP TABLE worklog5743;
=== modified file 'mysql-test/suite/innodb/t/innodb-index.test'
--- a/mysql-test/suite/innodb/t/innodb-index.test 2010-07-16 21:00:50 +0000
+++ b/mysql-test/suite/innodb/t/innodb-index.test 2011-05-19 12:43:26 +0000
@@ -131,8 +131,6 @@ show create table t4;
--error ER_CANT_CREATE_TABLE
alter table t3 add constraint dc foreign key (a) references t1(a);
show create table t3;
-# this should be fixed by MySQL (see Bug #51451)
---error ER_WRONG_NAME_FOR_INDEX
alter table t2 drop index b, add index (b);
show create table t2;
--error ER_ROW_IS_REFERENCED_2
=== modified file 'mysql-test/suite/innodb/t/innodb.test'
--- a/mysql-test/suite/innodb/t/innodb.test 2011-02-21 02:57:30 +0000
+++ b/mysql-test/suite/innodb/t/innodb.test 2011-05-19 12:43:26 +0000
@@ -452,8 +452,6 @@ alter table t1 add index sca_pic (cat_co
select count(*) from t1 where sca_code='PD' and sca_pic is null;
select count(*) from t1 where cat_code='E';
-# this should be fixed by MySQL (see Bug #51451)
---error ER_WRONG_NAME_FOR_INDEX
alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
alter table t1 drop index sca_pic;
alter table t1 add index (sca_pic, cat_code);
=== modified file 'mysql-test/suite/innodb/t/innodb_mysql.test'
--- a/mysql-test/suite/innodb/t/innodb_mysql.test 2011-01-17 16:27:07 +0000
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test 2011-05-19 12:43:26 +0000
@@ -1007,4 +1007,23 @@ OPTIMIZE TABLE t1;
DROP TABLE t1;
+--echo #
+--echo # Bug#11762345 54927: DROPPING AND ADDING AN INDEX IN ONE
+--echo # COMMAND CAN FAIL IN INNODB PLUGIN 1.0
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (id int, a int, b int, PRIMARY KEY (id),
+ INDEX a (a)) ENGINE=innodb;
+
+ALTER TABLE t1 DROP INDEX a, ADD INDEX a (b, a);
+# This used to fail
+ALTER TABLE t1 DROP INDEX a, ADD INDEX (a, b);
+
+DROP TABLE t1;
+
+
--echo End of 6.0 tests
=== modified file 'mysql-test/suite/parts/inc/partition_fail_t2.inc'
--- a/mysql-test/suite/parts/inc/partition_fail_t2.inc 2010-06-21 14:45:59 +0000
+++ b/mysql-test/suite/parts/inc/partition_fail_t2.inc 2011-05-21 08:25:33 +0000
@@ -15,7 +15,7 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1;
# accept all errors
--disable_abort_on_error
---replace_regex /#sqlx-[0-9a-f_]*/#sqlx-nnnn_nnnn/i /errno: [0-9-]*/errno: n/
+--replace_regex /#sqlx-[0-9a-f_]*/#sqlx-nnnn_nnnn/i
--eval $fail_statement
--enable_abort_on_error
--echo # State after failure
=== modified file 'mysql-test/suite/parts/r/partition_debug.result'
--- a/mysql-test/suite/parts/r/partition_debug.result 2010-05-19 20:10:44 +0000
+++ b/mysql-test/suite/parts/r/partition_debug.result 2011-05-21 08:25:33 +0000
@@ -1268,7 +1268,7 @@ a b
3 Original from partition p0
4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
-ERROR HY000: Error on rename of './test/t2' to './test/#sqlx-nnnn_nnnn' (errno: n)
+ERROR HY000: Error on rename of './test/t2' to './test/#sqlx-nnnn_nnnn' (errno: 0)
# State after failure
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1472,7 +1472,7 @@ a b
3 Original from partition p0
4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
-ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: n)
+ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: 0)
# State after failure
t1#P#p0.MYD
t1#P#p0.MYI
@@ -1676,7 +1676,7 @@ a b
3 Original from partition p0
4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
-ERROR HY000: Error on rename of './test/#sqlx-nnnn_nnnn' to './test/t1#P#p0' (errno: n)
+ERROR HY000: Error on rename of './test/#sqlx-nnnn_nnnn' to './test/t1#P#p0' (errno: 0)
# State after failure
t1#P#p0.MYD
t1#P#p0.MYI
=== modified file 'mysql-test/suite/parts/r/partition_debug_innodb.result'
--- a/mysql-test/suite/parts/r/partition_debug_innodb.result 2010-10-01 16:11:50 +0000
+++ b/mysql-test/suite/parts/r/partition_debug_innodb.result 2011-05-21 08:25:33 +0000
@@ -7000,7 +7000,7 @@ a b
3 Original from partition p0
4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
-ERROR HY000: Error on rename of './test/t2' to './test/#sqlx-nnnn_nnnn' (errno: n)
+ERROR HY000: Error on rename of './test/t2' to './test/#sqlx-nnnn_nnnn' (errno: 0)
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
@@ -7196,7 +7196,7 @@ a b
3 Original from partition p0
4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
-ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: n)
+ERROR HY000: Error on rename of './test/t1#P#p0' to './test/t2' (errno: 0)
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
@@ -7392,7 +7392,7 @@ a b
3 Original from partition p0
4 Original from partition p0
ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
-ERROR HY000: Error on rename of './test/#sqlx-nnnn_nnnn' to './test/t1#P#p0' (errno: n)
+ERROR HY000: Error on rename of './test/#sqlx-nnnn_nnnn' to './test/t1#P#p0' (errno: 0)
# State after failure
t1#P#p0.ibd
t1#P#p1.ibd
=== modified file 'mysql-test/suite/perfschema/t/no_threads.test'
--- a/mysql-test/suite/perfschema/t/no_threads.test 2010-11-09 08:16:50 +0000
+++ b/mysql-test/suite/perfschema/t/no_threads.test 2011-05-04 09:54:04 +0000
@@ -17,6 +17,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
+--source include/not_threadpool.inc
# Setup : in this main thread
=== modified file 'mysql-test/suite/perfschema/t/one_thread_per_con.test'
--- a/mysql-test/suite/perfschema/t/one_thread_per_con.test 2010-11-08 19:35:17 +0000
+++ b/mysql-test/suite/perfschema/t/one_thread_per_con.test 2011-05-04 09:54:04 +0000
@@ -17,6 +17,7 @@
--source include/not_embedded.inc
--source include/have_perfschema.inc
+--source include/not_threadpool.inc
# Setup
=== modified file 'mysql-test/suite/rpl/r/rpl_relayspace.result'
--- a/mysql-test/suite/rpl/r/rpl_relayspace.result 2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/r/rpl_relayspace.result 2011-05-19 15:47:05 +0000
@@ -1,7 +1,6 @@
include/master-slave.inc
[connection master]
-stop slave;
-include/wait_for_slave_to_stop.inc
+include/stop_slave.inc
create table t1 (a int);
drop table t1;
create table t1 (a int);
@@ -9,10 +8,8 @@ drop table t1;
reset slave;
start slave io_thread;
include/wait_for_slave_param.inc [Slave_IO_State]
-stop slave io_thread;
+include/stop_slave_io.inc
reset slave;
-start slave;
-select master_pos_wait('master-bin.001',200,6)=-1;
-master_pos_wait('master-bin.001',200,6)=-1
-0
+include/start_slave.inc
+include/assert.inc [Assert that master_pos_wait does not timeout nor it returns NULL]
include/rpl_end.inc
=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def 2011-02-15 12:12:30 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def 2011-05-24 06:42:00 +0000
@@ -10,8 +10,8 @@
#
##############################################################################
-rpl_row_create_table : Bug#51574 2010-02-27 andrei failed different way than earlier with bug#45576
-rpl_spec_variables : BUG#47661 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
-rpl_delayed_slave : Bug#57514 2010-11-09 andrei rpl_delayed_slave fails sporadically in pb
-rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
-rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
+rpl_row_create_table : Bug#11759274 2010-02-27 andrei failed different way than earlier with bug#45576
+rpl_spec_variables : BUG#11755836 2009-10-27 jasonh rpl_spec_variables fails on PB2 hpux
+rpl_delayed_slave : Bug#11764654 2010-11-09 andrei rpl_delayed_slave fails sporadically in pb
+rpl_row_until : BUG#12359942 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
+rpl_stm_until : BUG#12359942 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
=== modified file 'mysql-test/suite/rpl/t/rpl_relayspace.test'
--- a/mysql-test/suite/rpl/t/rpl_relayspace.test 2010-12-19 17:15:12 +0000
+++ b/mysql-test/suite/rpl/t/rpl_relayspace.test 2011-05-19 15:47:05 +0000
@@ -2,9 +2,9 @@
# to force the deadlock after one event.
source include/master-slave.inc;
+--let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1)
connection slave;
-stop slave;
---source include/wait_for_slave_to_stop.inc
+--source include/stop_slave.inc
connection master;
# This will generate a master's binlog > 10 bytes
create table t1 (a int);
@@ -20,20 +20,33 @@ let $slave_param_value= Waiting for the
source include/wait_for_slave_param.inc;
# A bug caused the I/O thread to refuse stopping.
-stop slave io_thread;
+--source include/stop_slave_io.inc
reset slave;
-start slave;
-# The I/O thread stops filling the relay log when
-# it's >10b. And the SQL thread cannot purge this relay log
-# as purge is done only when the SQL thread switches to another
-# relay log, which does not exist here.
-# So we should have a deadlock.
-# if it is not resolved automatically we'll detect
-# it with master_pos_wait that waits for farther than 1Ob;
-# it will timeout after 10 seconds;
-# also the slave will probably not cooperate to shutdown
-# (as 2 threads are locked)
-select master_pos_wait('master-bin.001',200,6)=-1;
+--source include/start_slave.inc
+
+# The I/O thread stops filling the relay log when it's >10b. And the
+# SQL thread cannot purge this relay log as purge is done only when
+# the SQL thread switches to another relay log, which does not exist
+# here. So we should have a deadlock. If it is not resolved
+# automatically we'll detect it with master_pos_wait that waits for
+# farther than 1Ob; it will timeout after 300 seconds (which is inline
+# with the default used for sync_slave_with_master and will protect us
+# against slow test envs); also the slave will probably not cooperate
+# to shutdown (as 2 threads are locked)
+--let $outcome= `SELECT MASTER_POS_WAIT('$master_log_file',200,300) AS mpw;`
+
+# master_pos_wait returns:
+#
+# * >= 0, the number of events the slave had to wait to advance to the
+# position
+#
+# * -1, if there was a timeout
+#
+# * NULL, if an error occurred, or the SQL thread was not started,
+# slave master info is not initialized, the arguments are incorrect
+--let $assert_text= Assert that master_pos_wait does not timeout nor it returns NULL
+--let $assert_cond= $outcome IS NOT NULL AND $outcome <> -1
+--source include/assert.inc
# End of 4.1 tests
--source include/rpl_end.inc
=== added file 'mysql-test/suite/rpl/t/rpl_typeconv-master.opt'
--- a/mysql-test/suite/rpl/t/rpl_typeconv-master.opt 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_typeconv-master.opt 2011-05-25 14:39:39 +0000
@@ -0,0 +1 @@
+--testcase-timeout=40
=== modified file 'mysql-test/suite/sys_vars/t/all_vars.test'
--- a/mysql-test/suite/sys_vars/t/all_vars.test 2010-12-08 15:30:01 +0000
+++ b/mysql-test/suite/sys_vars/t/all_vars.test 2011-05-04 09:54:04 +0000
@@ -14,6 +14,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--source include/not_embedded.inc
+--source include/not_threadpool.inc
# 2010-01-28 OBN Added support to load 'innodb' and 'semisync' if possible.
# As we need to have there variables loaded if the components exist but do
=== modified file 'mysql-test/suite/sys_vars/t/disabled.def'
--- a/mysql-test/suite/sys_vars/t/disabled.def 2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/t/disabled.def 2011-05-23 11:33:41 +0000
@@ -9,9 +9,9 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-query_cache_size_basic_32 : Bug#36747: Allocating a large query cache is not deterministic
-query_cache_size_basic_64 : Bug#36747: Allocating a large query cache is not deterministic
-transaction_prealloc_size_basic_32 : Bug#36747
-transaction_prealloc_size_basic_64 : Bug#36747
-#thread_cache_size_func : Bug#40575: 2008-11-07 joro main.thread_cache_size_func fails in pushbuild when run with pool of threads
+query_cache_size_basic_32 : Bug#11748572: Allocating a large query cache is not deterministic
+query_cache_size_basic_64 : Bug#11748572: Allocating a large query cache is not deterministic
+transaction_prealloc_size_basic_32 : Bug#11748572
+transaction_prealloc_size_basic_64 : Bug#11748572
+#thread_cache_size_func : Bug#11750172: 2008-11-07 joro main.thread_cache_size_func fails in pushbuild when run with pool of threads
=== modified file 'mysql-test/suite/sys_vars/t/slow_launch_time_func.test'
--- a/mysql-test/suite/sys_vars/t/slow_launch_time_func.test 2010-11-17 10:16:13 +0000
+++ b/mysql-test/suite/sys_vars/t/slow_launch_time_func.test 2011-01-14 08:28:23 +0000
@@ -31,6 +31,7 @@
#
--source include/not_embedded.inc
+--source include/not_threadpool.inc
SET @global_slow_launch_time = @@GLOBAL.slow_launch_time;
=== modified file 'mysql-test/suite/sys_vars/t/thread_cache_size_func.test'
--- a/mysql-test/suite/sys_vars/t/thread_cache_size_func.test 2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/thread_cache_size_func.test 2011-01-14 08:28:23 +0000
@@ -28,6 +28,7 @@
#
--source include/not_embedded.inc
+--source include/not_threadpool.inc
SET @global_thread_cache_size = @@GLOBAL.thread_cache_size;
=== modified file 'mysql-test/suite/sys_vars/t/wait_timeout_func.test'
--- a/mysql-test/suite/sys_vars/t/wait_timeout_func.test 2009-03-20 17:11:22 +0000
+++ b/mysql-test/suite/sys_vars/t/wait_timeout_func.test 2011-01-14 08:28:23 +0000
@@ -22,6 +22,7 @@
###############################################################################
--source include/not_embedded.inc
+--source include/not_threadpool.inc
SET @start_value= @@global.wait_timeout;
=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def 2011-03-11 09:58:45 +0000
+++ b/mysql-test/t/disabled.def 2011-05-25 14:10:40 +0000
@@ -9,11 +9,10 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
-lowercase_table3 : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX
-query_cache_28249 : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
-log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists
-read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists
-sum_distinct-big : Bug#56927 2010-11-15 mattiasj was not tested
-alter_table-big : Bug#37248 2010-11-15 mattiasj was not tested
-create-big : Bug#37248 2010-11-15 mattiasj was not tested
+lowercase_table3 : Bug#11762269 2010-06-30 alik main.lowercase_table3 on Mac OSX
+read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
+sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested
+alter_table-big : Bug#11748731 2010-11-15 mattiasj was not tested
+create-big : Bug#11748731 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
+main.query_cache_28249 : Bug#12584161 2009-03-25 main.query_cache_28249 fails sporadically
=== modified file 'mysql-test/t/information_schema.test'
--- a/mysql-test/t/information_schema.test 2011-03-11 18:53:12 +0000
+++ b/mysql-test/t/information_schema.test 2011-05-04 09:54:04 +0000
@@ -1,6 +1,9 @@
# This test uses grants, which can't get tested for embedded server
-- source include/not_embedded.inc
+#Don't run this test when thread_pool active
+--source include/not_threadpool.inc
+
# check that CSV engine was compiled in, as the result of the test depends
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
=== modified file 'mysql-test/t/information_schema_db.test'
--- a/mysql-test/t/information_schema_db.test 2009-10-23 11:22:21 +0000
+++ b/mysql-test/t/information_schema_db.test 2010-11-19 13:43:13 +0000
@@ -2,6 +2,9 @@
# in the embedded server by default). So skip the test in embedded-server mode.
-- source include/not_embedded.inc
+#Don't run this test when thread_pool active
+--source include/not_threadpool.inc
+
-- source include/testdb_only.inc
--disable_warnings
=== modified file 'mysql-test/t/kill.test'
--- a/mysql-test/t/kill.test 2010-11-18 16:34:56 +0000
+++ b/mysql-test/t/kill.test 2011-05-04 09:54:04 +0000
@@ -9,6 +9,7 @@
-- source include/not_embedded.inc
-- source include/have_debug_sync.inc
+-- source include/not_threadpool.inc
--disable_warnings
SET DEBUG_SYNC = 'RESET';
=== modified file 'mysql-test/t/mysqlshow.test'
--- a/mysql-test/t/mysqlshow.test 2010-09-30 10:28:49 +0000
+++ b/mysql-test/t/mysqlshow.test 2011-05-04 09:54:04 +0000
@@ -2,6 +2,8 @@
-- source include/not_embedded.inc
# Test lists tables in Information_schema, and InnoDB adds some
-- source include/have_innodb.inc
+# Don't test when thread_pool active
+--source include/not_threadpool.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,test1,test2;
=== modified file 'mysql-test/t/named_pipe.test'
--- a/mysql-test/t/named_pipe.test 2010-11-17 10:16:13 +0000
+++ b/mysql-test/t/named_pipe.test 2011-01-14 08:46:53 +0000
@@ -3,6 +3,9 @@
# other platforms
--source include/windows.inc
+# thread pool causes different results
+-- source include/not_threadpool.inc
+
# Only run this test if named pipe is avaliable
let $nmp= query_get_value("SHOW VARIABLES LIKE 'named_pipe'", Value, 1);
if ($nmp != ON){
=== modified file 'mysql-test/t/no-threads.test'
--- a/mysql-test/t/no-threads.test 2007-12-11 22:30:42 +0000
+++ b/mysql-test/t/no-threads.test 2010-11-19 13:43:13 +0000
@@ -1,3 +1,4 @@
+--source include/not_threadpool.inc
#
# Test the --thread-handler=no-threads option
#
=== modified file 'mysql-test/t/shm.test'
--- a/mysql-test/t/shm.test 2010-11-17 10:16:13 +0000
+++ b/mysql-test/t/shm.test 2011-01-14 08:46:53 +0000
@@ -2,6 +2,9 @@
# to optimize things we skip this test on all other platforms
--source include/windows.inc
+# thread pool causes different results
+-- source include/not_threadpool.inc
+
# Only run this test if shared memory is avaliable
let $shm= query_get_value("SHOW VARIABLES LIKE 'shared_memory'", Value, 1);
if ($shm != ON){
=== modified file 'mysql-test/t/status.test'
--- a/mysql-test/t/status.test 2010-08-06 11:29:37 +0000
+++ b/mysql-test/t/status.test 2011-01-14 08:36:24 +0000
@@ -354,21 +354,6 @@ DROP FUNCTION f1;
# End of 5.1 tests
-#
-# Bug#17954 Threads_connected > Threads_created
-#
-
---disable_warnings
-DROP VIEW IF EXISTS v1;
---enable_warnings
-
-CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
-
-SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
-SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
-
-DROP VIEW v1;
-
# Restore global concurrent_insert value. Keep in the end of the test file.
--connection default
set @@global.concurrent_insert= @old_concurrent_insert;
=== added file 'mysql-test/t/status_bug17954.test'
--- a/mysql-test/t/status_bug17954.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/status_bug17954.test 2011-01-14 08:36:24 +0000
@@ -0,0 +1,54 @@
+# This test requires that --log-output includes 'table', and the general
+# log is on
+
+# embedded server causes different stat
+-- source include/not_embedded.inc
+
+# thread pool causes different results
+-- source include/not_threadpool.inc
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+
+# Disable concurrent inserts to avoid sporadic test failures as it might
+# affect the the value of variables used throughout the test case.
+set @old_concurrent_insert= @@global.concurrent_insert;
+set @@global.concurrent_insert= 0;
+
+# Disable logging to table, since this will also cause table locking and unlocking, which will
+# show up in SHOW STATUS and may cause sporadic failures
+
+SET @old_log_output = @@global.log_output;
+SET GLOBAL LOG_OUTPUT = 'FILE';
+
+# PS causes different statistics
+--disable_ps_protocol
+
+flush status;
+
+#
+# Bug#17954 Threads_connected > Threads_created
+#
+
+--disable_warnings
+DROP VIEW IF EXISTS v1;
+--enable_warnings
+
+CREATE VIEW v1 AS SELECT VARIABLE_NAME AS NAME, CONVERT(VARIABLE_VALUE, UNSIGNED) AS VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+
+SELECT VALUE INTO @tc FROM v1 WHERE NAME = 'Threads_connected';
+SELECT NAME FROM v1 WHERE NAME = 'Threads_created' AND VALUE < @tc;
+#SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS where variable_name like '%thread%';
+#SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS;
+#SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES;
+
+DROP VIEW v1;
+
+# Restore global concurrent_insert value. Keep in the end of the test file.
+--connection default
+set @@global.concurrent_insert= @old_concurrent_insert;
+SET GLOBAL log_output = @old_log_output;
+
+# Wait till we reached the initial number of concurrent sessions
+--source include/wait_until_count_sessions.inc
+
=== modified file 'mysys/my_sync.c'
--- a/mysys/my_sync.c 2010-10-19 17:05:25 +0000
+++ b/mysys/my_sync.c 2011-03-04 11:42:20 +0000
@@ -17,6 +17,16 @@
#include "mysys_err.h"
#include <errno.h>
+static void (*before_sync_wait)(void)= 0;
+static void (*after_sync_wait)(void)= 0;
+
+void thr_set_sync_wait_callback(void (*before_wait)(void),
+ void (*after_wait)(void))
+{
+ before_sync_wait= before_wait;
+ after_sync_wait= after_wait;
+}
+
/*
Sync data in file to disk
@@ -46,6 +56,8 @@ int my_sync(File fd, myf my_flags)
DBUG_ENTER("my_sync");
DBUG_PRINT("my",("Fd: %d my_flags: %d", fd, my_flags));
+ if (before_sync_wait)
+ (*before_sync_wait)();
do
{
#if defined(F_FULLFSYNC)
@@ -75,6 +87,8 @@ int my_sync(File fd, myf my_flags)
int er= errno;
if (!(my_errno= er))
my_errno= -1; /* Unknown error */
+ if (after_sync_wait)
+ (*after_sync_wait)();
if ((my_flags & MY_IGNORE_BADFD) &&
(er == EBADF || er == EINVAL || er == EROFS))
{
@@ -84,6 +98,11 @@ int my_sync(File fd, myf my_flags)
else if (my_flags & MY_WME)
my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno);
}
+ else
+ {
+ if (after_sync_wait)
+ (*after_sync_wait)();
+ }
DBUG_RETURN(res);
} /* my_sync */
=== modified file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc 2011-04-19 03:29:06 +0000
+++ b/sql/debug_sync.cc 2011-05-04 09:54:04 +0000
@@ -1742,11 +1742,20 @@ static void debug_sync_execute(THD *thd,
We don't use enter_cond()/exit_cond(). They do not save old
mutex and cond. This would prohibit the use of DEBUG_SYNC
between other places of enter_cond() and exit_cond().
+
+ We need to check for existence of thd->mysys_var to also make
+ it possible to use DEBUG_SYNC framework in scheduler when this
+ variable has been set to NULL.
*/
- old_mutex= thd->mysys_var->current_mutex;
- old_cond= thd->mysys_var->current_cond;
- thd->mysys_var->current_mutex= &debug_sync_global.ds_mutex;
- thd->mysys_var->current_cond= &debug_sync_global.ds_cond;
+ if (thd->mysys_var)
+ {
+ old_mutex= thd->mysys_var->current_mutex;
+ old_cond= thd->mysys_var->current_cond;
+ thd->mysys_var->current_mutex= &debug_sync_global.ds_mutex;
+ thd->mysys_var->current_cond= &debug_sync_global.ds_cond;
+ }
+ else
+ old_mutex= NULL;
set_timespec(abstime, action->timeout);
DBUG_EXECUTE("debug_sync_exec", {
@@ -1801,11 +1810,16 @@ static void debug_sync_execute(THD *thd,
is locked. (See comment in THD::exit_cond().)
*/
mysql_mutex_unlock(&debug_sync_global.ds_mutex);
- mysql_mutex_lock(&thd->mysys_var->mutex);
- thd->mysys_var->current_mutex= old_mutex;
- thd->mysys_var->current_cond= old_cond;
- thd_proc_info(thd, old_proc_info);
- mysql_mutex_unlock(&thd->mysys_var->mutex);
+ if (old_mutex)
+ {
+ mysql_mutex_lock(&thd->mysys_var->mutex);
+ thd->mysys_var->current_mutex= old_mutex;
+ thd->mysys_var->current_cond= old_cond;
+ thd_proc_info(thd, old_proc_info);
+ mysql_mutex_unlock(&thd->mysys_var->mutex);
+ }
+ else
+ thd_proc_info(thd, old_proc_info);
}
else
{
=== modified file 'sql/debug_sync.h'
--- a/sql/debug_sync.h 2011-03-22 11:44:40 +0000
+++ b/sql/debug_sync.h 2011-05-04 09:54:04 +0000
@@ -35,7 +35,7 @@ class THD;
} while (0)
/* Command line option --debug-sync-timeout. See mysqld.cc. */
-extern uint opt_debug_sync_timeout;
+extern MYSQL_PLUGIN_IMPORT uint opt_debug_sync_timeout;
/* Default WAIT_FOR timeout if command line option is given without argument. */
#define DEBUG_SYNC_DEFAULT_WAIT_TIMEOUT 300
=== modified file 'sql/derror.cc'
--- a/sql/derror.cc 2010-09-08 07:09:13 +0000
+++ b/sql/derror.cc 2011-05-21 08:25:33 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -108,7 +108,6 @@ bool read_texts(const char *file_name, c
char lang_path[FN_REFLEN];
uchar *buff;
uchar head[32],*pos;
- const char *errmsg;
DBUG_ENTER("read_texts");
LINT_INIT(buff);
@@ -185,18 +184,9 @@ Check that the above file is the right v
DBUG_RETURN(0);
err:
- switch (funktpos) {
- case 2:
- errmsg= "Not enough memory for messagefile '%s'";
- break;
- case 1:
- errmsg= "Can't read from messagefile '%s'";
- break;
- default:
- errmsg= "Can't find messagefile '%s'";
- break;
- }
- sql_print_error(errmsg, name);
+ sql_print_error((funktpos == 2) ? "Not enough memory for messagefile '%s'" :
+ ((funktpos == 1) ? "Can't read from messagefile '%s'" :
+ "Can't find messagefile '%s'"), name);
if (file != FERR)
(void) mysql_file_close(file, MYF(MY_WME));
DBUG_RETURN(1);
=== modified file 'sql/events.cc'
--- a/sql/events.cc 2011-04-19 03:29:06 +0000
+++ b/sql/events.cc 2011-05-21 08:25:33 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -445,7 +445,7 @@ Events::update_event(THD *thd, Event_par
!sortcmp_lex_string(parse_data->name, *new_name,
system_charset_info))
{
- my_error(ER_EVENT_SAME_NAME, MYF(0), parse_data->name.str);
+ my_error(ER_EVENT_SAME_NAME, MYF(0));
DBUG_RETURN(TRUE);
}
=== modified file 'sql/field.cc'
--- a/sql/field.cc 2011-05-12 12:50:11 +0000
+++ b/sql/field.cc 2011-05-21 08:25:33 +0000
@@ -9296,7 +9296,7 @@ bool Create_field::init(THD *thd, char *
if (decimals >= NOT_FIXED_DEC)
{
my_error(ER_TOO_BIG_SCALE, MYF(0), decimals, fld_name,
- NOT_FIXED_DEC-1);
+ static_cast<ulong>(NOT_FIXED_DEC - 1));
DBUG_RETURN(TRUE);
}
@@ -9366,8 +9366,8 @@ bool Create_field::init(THD *thd, char *
my_decimal_trim(&length, &decimals);
if (length > DECIMAL_MAX_PRECISION)
{
- my_error(ER_TOO_BIG_PRECISION, MYF(0), length, fld_name,
- DECIMAL_MAX_PRECISION);
+ my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<int>(length),
+ fld_name, static_cast<ulong>(DECIMAL_MAX_PRECISION));
DBUG_RETURN(TRUE);
}
if (length < decimals)
@@ -9591,7 +9591,7 @@ bool Create_field::init(THD *thd, char *
if (length > MAX_BIT_FIELD_LENGTH)
{
my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), fld_name,
- MAX_BIT_FIELD_LENGTH);
+ static_cast<ulong>(MAX_BIT_FIELD_LENGTH));
DBUG_RETURN(TRUE);
}
pack_length= (length + 7) / 8;
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2011-05-26 05:50:01 +0000
+++ b/sql/ha_ndbcluster.cc 2011-05-26 09:28:17 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -8699,7 +8699,7 @@ NDB_SHARE *ndbcluster_get_share(const ch
DBUG_PRINT("error", ("get_share: failed to alloc share"));
if (!have_lock)
mysql_mutex_unlock(&ndbcluster_mutex);
- my_error(ER_OUTOFMEMORY, MYF(0), sizeof(*share));
+ my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(*share)));
DBUG_RETURN(0);
}
}
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-01-05 05:21:07 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-05-21 08:25:33 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1224,12 +1224,14 @@ ndbcluster_update_slock(THD *thd,
}
if (ndb_error)
+ {
+ char buf[1024];
+ my_snprintf(buf, sizeof(buf), "Could not release lock on '%s.%s'",
+ db, table_name);
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
- ndb_error->code,
- ndb_error->message,
- "Could not release lock on '%s.%s'",
- db, table_name);
+ ndb_error->code, ndb_error->message, buf);
+ }
if (trans)
ndb->closeTransaction(trans);
ndb->setDatabaseName(save_db);
=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc 2011-05-16 11:32:07 +0000
+++ b/sql/ha_partition.cc 2011-05-21 08:25:33 +0000
@@ -1136,6 +1136,10 @@ static int handle_opt_part(THD *thd, HA_
static bool print_admin_msg(THD* thd, const char* msg_type,
const char* db_name, const char* table_name,
const char* op_name, const char *fmt, ...)
+ ATTRIBUTE_FORMAT(printf, 6, 7);
+static bool print_admin_msg(THD* thd, const char* msg_type,
+ const char* db_name, const char* table_name,
+ const char* op_name, const char *fmt, ...)
{
va_list args;
Protocol *protocol= thd->protocol;
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2011-05-26 05:50:01 +0000
+++ b/sql/handler.cc 2011-05-26 09:28:17 +0000
@@ -287,7 +287,7 @@ handler *get_ha_partition(partition_info
}
else
{
- my_error(ER_OUTOFMEMORY, MYF(0), sizeof(ha_partition));
+ my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(ha_partition)));
}
DBUG_RETURN(((handler*) partition));
}
@@ -1645,7 +1645,8 @@ int ha_recover(HASH *commit_list)
}
if (!info.list)
{
- sql_print_error(ER(ER_OUTOFMEMORY), info.len*sizeof(XID));
+ sql_print_error(ER(ER_OUTOFMEMORY),
+ static_cast<int>(info.len*sizeof(XID)));
DBUG_RETURN(1);
}
=== modified file 'sql/item_create.cc'
--- a/sql/item_create.cc 2011-05-03 13:03:00 +0000
+++ b/sql/item_create.cc 2011-05-21 08:25:33 +0000
@@ -5733,8 +5733,8 @@ create_func_cast(THD *thd, Item *a, Cast
decoded_size= strtoul(c_len, NULL, 10);
if (errno != 0)
{
- my_error(ER_TOO_BIG_PRECISION, MYF(0), c_len, a->name,
- DECIMAL_MAX_PRECISION);
+ my_error(ER_TOO_BIG_PRECISION, MYF(0), INT_MAX, a->name,
+ static_cast<ulong>(DECIMAL_MAX_PRECISION));
return NULL;
}
len= decoded_size;
@@ -5747,8 +5747,8 @@ create_func_cast(THD *thd, Item *a, Cast
decoded_size= strtoul(c_dec, NULL, 10);
if ((errno != 0) || (decoded_size > UINT_MAX))
{
- my_error(ER_TOO_BIG_SCALE, MYF(0), c_dec, a->name,
- DECIMAL_MAX_SCALE);
+ my_error(ER_TOO_BIG_SCALE, MYF(0), INT_MAX, a->name,
+ static_cast<ulong>(DECIMAL_MAX_SCALE));
return NULL;
}
dec= decoded_size;
@@ -5761,14 +5761,14 @@ create_func_cast(THD *thd, Item *a, Cast
}
if (len > DECIMAL_MAX_PRECISION)
{
- my_error(ER_TOO_BIG_PRECISION, MYF(0), len, a->name,
- DECIMAL_MAX_PRECISION);
+ my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<int>(len), a->name,
+ static_cast<ulong>(DECIMAL_MAX_PRECISION));
return 0;
}
if (dec > DECIMAL_MAX_SCALE)
{
my_error(ER_TOO_BIG_SCALE, MYF(0), dec, a->name,
- DECIMAL_MAX_SCALE);
+ static_cast<ulong>(DECIMAL_MAX_SCALE));
return 0;
}
res= new (thd->mem_root) Item_decimal_typecast(a, len, dec);
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2011-05-10 13:37:37 +0000
+++ b/sql/item_func.cc 2011-05-21 09:31:19 +0000
@@ -47,6 +47,8 @@
#include "sp.h"
#include "set_var.h"
#include "debug_sync.h"
+#include <mysql/plugin.h>
+#include <mysql/service_thd_wait.h>
#ifdef NO_EMBEDDED_ACCESS_CHECKS
#define sp_restore_security_context(A,B) while (0) {}
@@ -1107,7 +1109,7 @@ err:
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DATA_OUT_OF_RANGE,
ER(ER_WARN_DATA_OUT_OF_RANGE),
- name, 1);
+ name, 1L);
return dec;
}
@@ -3165,7 +3167,7 @@ udf_handler::fix_fields(THD *thd, Item_r
if (!tmp_udf)
{
- my_error(ER_CANT_FIND_UDF, MYF(0), u_d->name.str, errno);
+ my_error(ER_CANT_FIND_UDF, MYF(0), u_d->name.str);
DBUG_RETURN(TRUE);
}
u_d=tmp_udf;
@@ -3899,6 +3901,7 @@ longlong Item_func_get_lock::val_int()
timed_cond.set_timeout(timeout * ULL(1000000000));
error= 0;
+ thd_wait_begin(thd, THD_WAIT_USER_LOCK);
while (ull->locked && !thd->killed)
{
DBUG_PRINT("info", ("waiting on lock"));
@@ -3910,6 +3913,7 @@ longlong Item_func_get_lock::val_int()
}
error= 0;
}
+ thd_wait_end(thd);
if (ull->locked)
{
@@ -4126,6 +4130,7 @@ longlong Item_func_sleep::val_int()
thd->mysys_var->current_cond= &cond;
error= 0;
+ thd_wait_begin(thd, THD_WAIT_SLEEP);
while (!thd->killed)
{
error= timed_cond.wait(&cond, &LOCK_user_locks);
@@ -4133,6 +4138,7 @@ longlong Item_func_sleep::val_int()
break;
error= 0;
}
+ thd_wait_end(thd);
mysql_mutex_unlock(&LOCK_user_locks);
mysql_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc 2011-05-06 13:32:53 +0000
+++ b/sql/item_strfunc.cc 2011-05-21 08:25:33 +0000
@@ -3814,7 +3814,8 @@ String *Item_func_uncompress::val_str(St
push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TOO_BIG_FOR_UNCOMPRESS,
ER(ER_TOO_BIG_FOR_UNCOMPRESS),
- current_thd->variables.max_allowed_packet);
+ static_cast<int>(current_thd->variables.
+ max_allowed_packet));
goto err;
}
if (buffer.realloc((uint32)new_size))
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2011-05-12 15:02:29 +0000
+++ b/sql/log.cc 2011-05-12 18:44:56 +0000
@@ -2485,7 +2485,7 @@ int TC_LOG_MMAP::open(const char *opt_na
{
pg->next=pg+1;
pg->waiters=0;
- pg->state=POOL;
+ pg->state=PS_POOL;
mysql_mutex_init(key_PAGE_lock, &pg->lock, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_PAGE_cond, &pg->cond, 0);
pg->start=(my_xid *)(data + i*tc_log_page_size);
@@ -2659,7 +2659,7 @@ int TC_LOG_MMAP::log_xid(THD *thd, my_xi
cookie= (ulong)((uchar *)p->ptr - data); // can never be zero
*p->ptr++= xid;
p->free--;
- p->state= DIRTY;
+ p->state= PS_DIRTY;
/* to sync or not to sync - this is the question */
mysql_mutex_unlock(&LOCK_active);
@@ -2671,13 +2671,13 @@ int TC_LOG_MMAP::log_xid(THD *thd, my_xi
p->waiters++;
/*
note - it must be while (), not do ... while () here
- as p->state may be not DIRTY when we come here
+ as p->state may be not PS_DIRTY when we come here
*/
- while (p->state == DIRTY && syncing)
+ while (p->state == PS_DIRTY && syncing)
mysql_cond_wait(&p->cond, &LOCK_sync);
p->waiters--;
- err= p->state == ERROR;
- if (p->state != DIRTY) // page was synced
+ err= p->state == PS_ERROR;
+ if (p->state != PS_DIRTY) // page was synced
{
if (p->waiters == 0)
mysql_cond_signal(&COND_pool); // in case somebody's waiting
@@ -2715,7 +2715,7 @@ int TC_LOG_MMAP::sync()
pool_last->next=syncing;
pool_last=syncing;
syncing->next=0;
- syncing->state= err ? ERROR : POOL;
+ syncing->state= err ? PS_ERROR : PS_POOL;
mysql_cond_broadcast(&syncing->cond); // signal "sync done"
mysql_cond_signal(&COND_pool); // in case somebody's waiting
mysql_mutex_unlock(&LOCK_pool);
=== modified file 'sql/log.h'
--- a/sql/log.h 2011-03-10 10:08:09 +0000
+++ b/sql/log.h 2011-05-21 09:31:19 +0000
@@ -51,9 +51,9 @@ class TC_LOG_MMAP: public TC_LOG
{
public: // only to keep Sun Forte on sol9x86 happy
typedef enum {
- POOL, // page is in pool
- ERROR, // last sync failed
- DIRTY // new xids added since last sync
+ PS_POOL, // page is in pool
+ PS_ERROR, // last sync failed
+ PS_DIRTY // new xids added since last sync
} PAGE_STATE;
private:
@@ -473,7 +473,7 @@ void sql_print_warning(const char *forma
void sql_print_information(const char *format, ...)
ATTRIBUTE_FORMAT(printf, 1, 2);
typedef void (*sql_print_message_func)(const char *format, ...)
- ATTRIBUTE_FORMAT(printf, 1, 2);
+ ATTRIBUTE_FORMAT_FPTR(printf, 1, 2);
extern sql_print_message_func sql_print_message_handlers[];
int error_log_print(enum loglevel level, const char *format,
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2011-05-16 11:10:48 +0000
+++ b/sql/log_event.cc 2011-05-23 23:34:47 +0000
@@ -8797,6 +8797,7 @@ int Table_map_log_event::do_apply_event(
m_field_metadata, m_field_metadata_size,
m_null_bits, m_flags);
table_list->m_tabledef_valid= TRUE;
+ table_list->m_conv_table= NULL;
table_list->open_type= OT_BASE_ONLY;
/*
=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc 2011-04-19 03:29:06 +0000
+++ b/sql/mdl.cc 2011-05-13 12:39:59 +0000
@@ -18,6 +18,8 @@
#include "debug_sync.h"
#include <hash.h>
#include <mysqld_error.h>
+#include <mysql/plugin.h>
+#include <mysql/service_thd_wait.h>
#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_key key_MDL_map_mutex;
@@ -970,10 +972,14 @@ MDL_wait::timed_wait(MDL_context_owner *
old_msg= owner->enter_cond(&m_COND_wait_status, &m_LOCK_wait_status,
wait_state_name);
+ thd_wait_begin(NULL, THD_WAIT_META_DATA_LOCK);
while (!m_wait_status && !owner->is_killed() &&
wait_result != ETIMEDOUT && wait_result != ETIME)
+ {
wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status,
abs_timeout);
+ }
+ thd_wait_end(NULL);
if (m_wait_status == EMPTY)
{
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2011-05-13 13:59:55 +0000
+++ b/sql/mysqld.cc 2011-05-25 10:18:08 +0000
@@ -417,7 +417,7 @@ my_bool opt_super_large_pages= 0;
my_bool opt_myisam_use_mmap= 0;
uint opt_large_page_size= 0;
#if defined(ENABLED_DEBUG_SYNC)
-uint opt_debug_sync_timeout= 0;
+MYSQL_PLUGIN_IMPORT uint opt_debug_sync_timeout= 0;
#endif /* defined(ENABLED_DEBUG_SYNC) */
my_bool opt_old_style_user_limits= 0, trust_function_creators= 0;
/*
@@ -2020,6 +2020,49 @@ extern "C" sig_handler end_thread_signal
/*
+ Cleanup THD object
+
+ SYNOPSIS
+ thd_cleanup()
+ thd Thread handler
+*/
+
+void thd_cleanup(THD *thd)
+{
+ thd->cleanup();
+}
+
+/*
+ Decrease number of connections
+
+ SYNOPSIS
+ dec_connection_count()
+*/
+
+void dec_connection_count()
+{
+ mysql_mutex_lock(&LOCK_connection_count);
+ --connection_count;
+ mysql_mutex_unlock(&LOCK_connection_count);
+}
+
+
+/*
+ Delete the THD object and decrease number of threads
+
+ SYNOPSIS
+ delete_thd()
+ thd Thread handler
+*/
+
+void delete_thd(THD *thd)
+{
+ thread_count--;
+ delete thd;
+}
+
+
+/*
Unlink thd from global list of available connections and free thd
SYNOPSIS
@@ -2034,15 +2077,11 @@ void unlink_thd(THD *thd)
{
DBUG_ENTER("unlink_thd");
DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
- thd->cleanup();
-
- mysql_mutex_lock(&LOCK_connection_count);
- --connection_count;
- mysql_mutex_unlock(&LOCK_connection_count);
+ thd_cleanup(thd);
+ dec_connection_count();
mysql_mutex_lock(&LOCK_thread_count);
- thread_count--;
- delete thd;
+ delete_thd(thd);
DBUG_VOID_RETURN;
}
@@ -5250,6 +5289,14 @@ static bool read_init_file(char *file_na
}
+/**
+ Increment number of created threads
+*/
+void inc_thread_created(void)
+{
+ thread_created++;
+}
+
#ifndef EMBEDDED_LIBRARY
/*
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2011-05-13 13:59:55 +0000
+++ b/sql/mysqld.h 2011-05-19 09:11:38 +0000
@@ -231,6 +231,10 @@ extern char err_shared_dir[];
extern TYPELIB thread_handling_typelib;
extern my_decimal decimal_zero;
+/*
+ THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,
+ using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
+*/
extern pthread_key(MEM_ROOT**,THR_MALLOC);
#ifdef HAVE_PSI_INTERFACE
@@ -632,6 +636,10 @@ get_thread_running()
extern "C" THD *_current_thd_noinline();
#define _current_thd() _current_thd_noinline()
#else
+/*
+ THR_THD is a key which will be used to set/get THD* for a thread,
+ using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
+*/
extern pthread_key(THD*, THR_THD);
inline THD *_current_thd(void)
{
=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc 2011-05-26 05:50:01 +0000
+++ b/sql/opt_range.cc 2011-05-26 09:28:17 +0000
@@ -7069,11 +7069,53 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *
This is the case ("cmp>=0" means that tmp.max >= key2.min):
key2: [----]
tmp: [------------*****]
+ */
+
+ if (!tmp->next_key_part)
+ {
+ /*
+ tmp->next_key_part is empty: cut the range that is covered
+ by tmp from key2.
+ Reason: (key2->next_key_part OR tmp->next_key_part) will be
+ empty and therefore equal to tmp->next_key_part. Thus, this
+ part of the key2 range is completely covered by tmp.
+ */
+ if (tmp->cmp_max_to_max(key2) >= 0)
+ {
+ /*
+ tmp covers the entire range in key2.
+ key2: [----]
+ tmp: [-----------------]
+ Move on to next range in key2
+ */
+ key2->increment_use_count(-1); // Free not used tree
+ key2=key2->next;
+ continue;
+ }
+ else
+ {
+ /*
+ This is the case:
+ key2: [-------]
+ tmp: [---------]
+
+ Result:
+ key2: [---]
+ tmp: [---------]
+ */
+ key2->copy_max_to_min(tmp);
+ continue;
+ }
+ }
+
+ /*
The ranges are overlapping but have not been merged because
- next_key_part of tmp and key2 are different
+ next_key_part of tmp and key2 differ.
+ key2: [----]
+ tmp: [------------*****]
- Result:
+ Split tmp in two where key2 starts:
key2: [----]
key1: [--------][--*****]
^ ^
@@ -7082,7 +7124,7 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *
SEL_ARG *new_arg=tmp->clone_first(key2);
if (!new_arg)
return 0; // OOM
- if ((new_arg->next_key_part= key1->next_key_part))
+ if ((new_arg->next_key_part= tmp->next_key_part))
new_arg->increment_use_count(key1->use_count+1);
tmp->copy_min_to_min(key2);
key1=key1->insert(new_arg);
@@ -7191,12 +7233,21 @@ key_or(RANGE_OPT_PARAM *param, SEL_ARG *
^ ^
new_arg tmp
Steps:
+ 0) If tmp->next_key_part is empty: do nothing. Reason:
+ (key2_cpy->next_key_part OR tmp->next_key_part) will be
+ empty and therefore equal to tmp->next_key_part. Thus,
+ the range in key2_cpy is completely covered by tmp
1) Make new_arg with range [tmp.min, key2_cpy.max].
new_arg->next_key_part is OR between next_key_part
of tmp and key2_cpy
2) Make tmp the range [key2.max, tmp.max]
3) Insert new_arg into key1
*/
+ if (!tmp->next_key_part) // Step 0
+ {
+ key2_cpy.increment_use_count(-1); // Free not used tree
+ break;
+ }
SEL_ARG *new_arg=tmp->clone_last(&key2_cpy);
if (!new_arg)
return 0; // OOM
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2011-05-13 13:59:55 +0000
+++ b/sql/rpl_rli.cc 2011-05-23 23:34:47 +0000
@@ -27,6 +27,8 @@
#include "transaction.h"
#include "sql_parse.h" // end_trans, ROLLBACK
#include "rpl_slave.h"
+#include <mysql/plugin.h>
+#include <mysql/service_thd_wait.h>
/*
Please every time you add a new field to the relay log info, update
@@ -534,6 +536,7 @@ int Relay_log_info::wait_for_pos(THD* th
We are going to mysql_cond_(timed)wait(); if the SQL thread stops it
will wake us up.
*/
+ thd_wait_begin(thd, THD_WAIT_BINLOG);
if (timeout > 0)
{
/*
@@ -551,6 +554,7 @@ int Relay_log_info::wait_for_pos(THD* th
}
else
mysql_cond_wait(&data_cond, &data_lock);
+ thd_wait_end(thd);
DBUG_PRINT("info",("Got signal of master update or timed out"));
if (error == ETIMEDOUT || error == ETIME)
{
@@ -980,6 +984,16 @@ void Relay_log_info::clear_tables_to_loc
tables_to_lock->m_tabledef.table_def::~table_def();
tables_to_lock->m_tabledef_valid= FALSE;
}
+
+ /*
+ If blob fields were used during conversion of field values
+ from the master table into the slave table, then we need to
+ free the memory used temporarily to store their values before
+ copying into the slave's table.
+ */
+ if (tables_to_lock->m_conv_table)
+ free_blobs(tables_to_lock->m_conv_table);
+
tables_to_lock=
static_cast<RPL_TABLE_LIST*>(tables_to_lock->next_global);
tables_to_lock_count--;
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2011-05-16 14:30:54 +0000
+++ b/sql/rpl_slave.cc 2011-05-21 08:25:33 +0000
@@ -5864,7 +5864,7 @@ bool change_master(THD* thd, Master_info
get_dynamic(&lex_mi->repl_ignore_server_ids, (uchar*) &s_id, i);
if (s_id == ::server_id && replicate_same_server_id)
{
- my_error(ER_SLAVE_IGNORE_SERVER_IDS, MYF(0), s_id);
+ my_error(ER_SLAVE_IGNORE_SERVER_IDS, MYF(0), static_cast<int>(s_id));
ret= TRUE;
goto err;
}
=== modified file 'sql/scheduler.cc'
--- a/sql/scheduler.cc 2011-03-22 11:44:40 +0000
+++ b/sql/scheduler.cc 2011-05-04 09:54:04 +0000
@@ -76,14 +76,26 @@ scheduler_functions *thread_scheduler= N
*/
/**@{*/
-static void scheduler_wait_begin(void) {
+extern "C"
+{
+static void scheduler_wait_lock_begin(void) {
MYSQL_CALLBACK(thread_scheduler,
- thd_wait_begin, (current_thd, THD_WAIT_ROW_TABLE_LOCK));
+ thd_wait_begin, (current_thd, THD_WAIT_TABLE_LOCK));
}
-static void scheduler_wait_end(void) {
+static void scheduler_wait_lock_end(void) {
MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (current_thd));
}
+
+static void scheduler_wait_sync_begin(void) {
+ MYSQL_CALLBACK(thread_scheduler,
+ thd_wait_begin, (current_thd, THD_WAIT_TABLE_LOCK));
+}
+
+static void scheduler_wait_sync_end(void) {
+ MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (current_thd));
+}
+};
/**@}*/
/**
@@ -94,7 +106,10 @@ static void scheduler_wait_end(void) {
mysqld.cc, so this init function will always be called.
*/
static void scheduler_init() {
- thr_set_lock_wait_callback(scheduler_wait_begin, scheduler_wait_end);
+ thr_set_lock_wait_callback(scheduler_wait_lock_begin,
+ scheduler_wait_lock_end);
+ thr_set_sync_wait_callback(scheduler_wait_sync_begin,
+ scheduler_wait_sync_end);
}
/*
@@ -133,10 +148,6 @@ void one_thread_scheduler()
thd_scheduler::thd_scheduler()
: m_psi(NULL), data(NULL)
{
-#ifndef DBUG_OFF
- dbug_explain[0]= '\0';
- set_explain= FALSE;
-#endif
}
=== modified file 'sql/scheduler.h'
--- a/sql/scheduler.h 2011-03-22 11:44:40 +0000
+++ b/sql/scheduler.h 2011-05-04 09:54:04 +0000
@@ -68,11 +68,6 @@ enum scheduler_types
void one_thread_per_connection_scheduler();
void one_thread_scheduler();
-enum pool_command_op
-{
- NOT_IN_USE_OP= 0, NORMAL_OP= 1, CONNECT_OP, KILL_OP, DIE_OP
-};
-
/*
To be used for pool-of-threads (implemeneted differently on various OSs)
*/
@@ -93,15 +88,15 @@ public:
void *data; /* scheduler-specific data structure */
-# ifndef DBUG_OFF
- char dbug_explain[512];
- bool set_explain;
-# endif
-
thd_scheduler();
~thd_scheduler();
};
+void *thd_get_scheduler_data(THD *thd);
+void thd_set_scheduler_data(THD *thd, void *data);
+PSI_thread* thd_get_psi(THD *thd);
+void thd_set_psi(THD *thd, PSI_thread *psi);
+
extern scheduler_functions *thread_scheduler;
#endif
=== modified file 'sql/set_var.cc'
--- a/sql/set_var.cc 2011-03-25 14:35:13 +0000
+++ b/sql/set_var.cc 2011-05-21 08:25:33 +0000
@@ -113,7 +113,8 @@ void sys_var_end()
sys_var constructor
@param chain variables are linked into chain for mysql_add_sys_var_chain()
- @param name_arg the name of the variable. @sa my_option::name
+ @param name_arg the name of the variable. Must be 0-terminated and exist
+ for the liftime of the sys_var object. @sa my_option::name
@param comment shown in mysqld --help, @sa my_option::comment
@param flags_arg or'ed flag_enum values
@param off offset of the global variable value from the
@@ -158,8 +159,8 @@ sys_var::sys_var(sys_var_chain *chain, c
*/
DBUG_ASSERT(parse_flag == PARSE_NORMAL || getopt_id <= 0 || getopt_id >= 255);
- name.str= name_arg;
- name.length= strlen(name_arg);
+ name.str= name_arg; // ER_NO_DEFAULT relies on 0-termination of name_arg
+ name.length= strlen(name_arg); // and so does this.
DBUG_ASSERT(name.length <= NAME_CHAR_LEN);
bzero(&option, sizeof(option));
=== modified file 'sql/sp_head.cc'
--- a/sql/sp_head.cc 2011-05-12 17:29:19 +0000
+++ b/sql/sp_head.cc 2011-05-21 09:31:19 +0000
@@ -547,7 +547,7 @@ sp_head::operator delete(void *ptr, size
sp_head::sp_head()
- :Query_arena(&main_mem_root, INITIALIZED_FOR_SP),
+ :Query_arena(&main_mem_root, STMT_INITIALIZED_FOR_SP),
m_flags(0),
m_sp_cache_version(0),
unsafe_flags(0),
@@ -1063,7 +1063,7 @@ void sp_head::recursion_level_error(THD
if (m_type == TYPE_ENUM_PROCEDURE)
{
my_error(ER_SP_RECURSION_LIMIT, MYF(0),
- thd->variables.max_sp_recursion_depth,
+ static_cast<int>(thd->variables.max_sp_recursion_depth),
m_name.str);
}
else
@@ -1205,7 +1205,7 @@ sp_head::execute(THD *thd, bool merge_da
Query_arena *old_arena;
/* per-instruction arena */
MEM_ROOT execute_mem_root;
- Query_arena execute_arena(&execute_mem_root, INITIALIZED_FOR_SP),
+ Query_arena execute_arena(&execute_mem_root, STMT_INITIALIZED_FOR_SP),
backup_arena;
query_id_t old_query_id;
TABLE *old_derived_tables;
@@ -1486,7 +1486,7 @@ sp_head::execute(THD *thd, bool merge_da
thd->m_reprepare_observer= save_reprepare_observer;
thd->stmt_arena= old_arena;
- state= EXECUTED;
+ state= STMT_EXECUTED;
/*
Restore the caller's original warning information area:
@@ -1644,7 +1644,7 @@ sp_head::execute_trigger(THD *thd,
sp_rcontext *nctx = NULL;
bool err_status= FALSE;
MEM_ROOT call_mem_root;
- Query_arena call_arena(&call_mem_root, Query_arena::INITIALIZED_FOR_SP);
+ Query_arena call_arena(&call_mem_root, Query_arena::STMT_INITIALIZED_FOR_SP);
Query_arena backup_arena;
DBUG_ENTER("sp_head::execute_trigger");
@@ -1785,7 +1785,7 @@ sp_head::execute_function(THD *thd, Item
String binlog_buf(buf, sizeof(buf), &my_charset_bin);
bool err_status= FALSE;
MEM_ROOT call_mem_root;
- Query_arena call_arena(&call_mem_root, Query_arena::INITIALIZED_FOR_SP);
+ Query_arena call_arena(&call_mem_root, Query_arena::STMT_INITIALIZED_FOR_SP);
Query_arena backup_arena;
DBUG_ENTER("sp_head::execute_function");
DBUG_PRINT("info", ("function %s", m_name.str));
@@ -2542,7 +2542,7 @@ sp_head::restore_thd_mem_root(THD *thd)
DBUG_ENTER("sp_head::restore_thd_mem_root");
Item *flist= free_list; // The old list
set_query_arena(thd); // Get new free_list and mem_root
- state= INITIALIZED_FOR_SP;
+ state= STMT_INITIALIZED_FOR_SP;
DBUG_PRINT("info", ("mem_root 0x%lx returned from thd mem root 0x%lx",
(ulong) &mem_root, (ulong) &thd->mem_root));
@@ -3007,7 +3007,7 @@ sp_lex_keeper::reset_lex_and_exec_core(T
(thd->stmt_da->sql_errno() != ER_CANT_REOPEN_TABLE &&
thd->stmt_da->sql_errno() != ER_NO_SUCH_TABLE &&
thd->stmt_da->sql_errno() != ER_UPDATE_TABLE_USED))
- thd->stmt_arena->state= Query_arena::EXECUTED;
+ thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
/*
Merge here with the saved parent's values
=== modified file 'sql/sp_head.h'
--- a/sql/sp_head.h 2011-03-22 11:44:40 +0000
+++ b/sql/sp_head.h 2011-05-04 09:54:04 +0000
@@ -556,7 +556,7 @@ public:
/// Should give each a name or type code for debugging purposes?
sp_instr(uint ip, sp_pcontext *ctx)
- :Query_arena(0, INITIALIZED_FOR_SP), marked(0), m_ip(ip), m_ctx(ctx)
+ :Query_arena(0, STMT_INITIALIZED_FOR_SP), marked(0), m_ip(ip), m_ctx(ctx)
{}
virtual ~sp_instr()
=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc 2011-05-16 08:52:10 +0000
+++ b/sql/sql_acl.cc 2011-05-21 08:25:33 +0000
@@ -2275,13 +2275,12 @@ static int replace_user_table(THD *thd,
*/
else if (!password_len && !combo.plugin.length && no_auto_create)
{
- my_error(ER_PASSWORD_NO_MATCH, MYF(0), combo.user.str, combo.host.str);
+ my_error(ER_PASSWORD_NO_MATCH, MYF(0));
goto end;
}
else if (!can_create_user)
{
- my_error(ER_CANT_CREATE_USER_WITH_GRANT, MYF(0),
- thd->security_ctx->user, thd->security_ctx->host_or_ip);
+ my_error(ER_CANT_CREATE_USER_WITH_GRANT, MYF(0));
goto end;
}
else if (combo.plugin.str[0])
@@ -2309,8 +2308,8 @@ static int replace_user_table(THD *thd,
/* what == 'N' means revoke */
if (combo.plugin.length && what != 'N')
{
- my_error(ER_GRANT_PLUGIN_USER_EXISTS, MYF(0), combo.user.length,
- combo.user.str);
+ my_error(ER_GRANT_PLUGIN_USER_EXISTS, MYF(0),
+ static_cast<int>(combo.user.length), combo.user.str);
goto end;
}
if (combo.password.str) // If password given
@@ -8982,7 +8981,7 @@ err:
if (mpvio->status == MPVIO_EXT::FAILURE)
{
inc_host_errors(mpvio->ip);
- my_error(ER_HANDSHAKE_ERROR, MYF(0), mpvio->auth_info.host_or_ip);
+ my_error(ER_HANDSHAKE_ERROR, MYF(0));
}
DBUG_RETURN(-1);
}
@@ -9578,7 +9577,7 @@ static int native_password_authenticate(
}
inc_host_errors(mpvio->ip);
- my_error(ER_HANDSHAKE_ERROR, MYF(0), mpvio->auth_info.host_or_ip);
+ my_error(ER_HANDSHAKE_ERROR, MYF(0));
DBUG_RETURN(CR_ERROR);
}
@@ -9632,7 +9631,7 @@ static int old_password_authenticate(MYS
}
inc_host_errors(mpvio->ip);
- my_error(ER_HANDSHAKE_ERROR, MYF(0), mpvio->auth_info.host_or_ip);
+ my_error(ER_HANDSHAKE_ERROR, MYF(0));
return CR_ERROR;
}
=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc 2011-05-19 17:52:35 +0000
+++ b/sql/sql_base.cc 2011-05-26 09:28:17 +0000
@@ -3849,7 +3849,7 @@ static bool auto_repair_table(THD *thd,
{
/* Give right error message */
thd->clear_error();
- my_error(ER_NOT_KEYFILE, MYF(0), share->table_name.str, my_errno);
+ my_error(ER_NOT_KEYFILE, MYF(0), share->table_name.str);
sql_print_error("Couldn't repair table: %s.%s", share->db.str,
share->table_name.str);
if (entry->file)
@@ -8199,7 +8199,7 @@ bool setup_tables(THD *thd, Name_resolut
}
if (tablenr > MAX_TABLES)
{
- my_error(ER_TOO_MANY_TABLES,MYF(0),MAX_TABLES);
+ my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast<int>(MAX_TABLES));
DBUG_RETURN(1);
}
for (table_list= tables;
=== modified file 'sql/sql_binlog.cc'
--- a/sql/sql_binlog.cc 2011-03-23 23:28:49 +0000
+++ b/sql/sql_binlog.cc 2011-05-21 08:25:33 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -301,7 +301,7 @@ void mysql_client_binlog_statement(THD*
TODO: Maybe a better error message since the BINLOG statement
now contains several events.
*/
- my_error(ER_UNKNOWN_ERROR, MYF(0), "Error executing BINLOG statement");
+ my_error(ER_UNKNOWN_ERROR, MYF(0));
goto end;
}
}
=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc 2011-05-12 17:29:19 +0000
+++ b/sql/sql_class.cc 2011-05-24 09:21:24 +0000
@@ -198,6 +198,252 @@ bool foreign_key_prefix(Key *a, Key *b)
** Thread specific functions
****************************************************************************/
+/**
+ Get reference to scheduler data object
+
+ @param thd THD object
+
+ @retval Scheduler data object on THD
+*/
+void *thd_get_scheduler_data(THD *thd)
+{
+ return thd->scheduler.data;
+}
+
+/**
+ Set reference to Scheduler data object for THD object
+
+ @param thd THD object
+ @param psi Scheduler data object to set on THD
+*/
+void thd_set_scheduler_data(THD *thd, void *data)
+{
+ thd->scheduler.data= data;
+}
+
+/**
+ Get reference to Performance Schema object for THD object
+
+ @param thd THD object
+
+ @retval Performance schema object for thread on THD
+*/
+PSI_thread *thd_get_psi(THD *thd)
+{
+ return thd->scheduler.m_psi;
+}
+
+/**
+ Set reference to Performance Schema object for THD object
+
+ @param thd THD object
+ @param psi Performance schema object for thread
+*/
+void thd_set_psi(THD *thd, PSI_thread *psi)
+{
+ thd->scheduler.m_psi= psi;
+}
+
+/**
+ Set the state on connection to killed
+
+ @param thd THD object
+*/
+void thd_set_killed(THD *thd)
+{
+ thd->killed= THD::KILL_CONNECTION;
+}
+
+/**
+ Clear errors from the previous THD
+
+ @param thd THD object
+*/
+void thd_clear_errors(THD *thd)
+{
+ my_errno= 0;
+ thd->mysys_var->abort= 0;
+}
+
+/**
+ Set thread stack in THD object
+
+ @param thd Thread object
+ @param stack_start Start of stack to set in THD object
+*/
+void thd_set_thread_stack(THD *thd, char *stack_start)
+{
+ thd->thread_stack= stack_start;
+}
+
+/**
+ Lock connection data for the set of connections this connection
+ belongs to
+
+ @param thd THD object
+*/
+void thd_lock_thread_count(THD *)
+{
+ mysql_mutex_lock(&LOCK_thread_count);
+}
+
+/**
+ Lock connection data for the set of connections this connection
+ belongs to
+
+ @param thd THD object
+*/
+void thd_unlock_thread_count(THD *)
+{
+ mysql_cond_broadcast(&COND_thread_count);
+ mysql_mutex_unlock(&LOCK_thread_count);
+}
+
+/**
+ Close the socket used by this connection
+
+ @param thd THD object
+*/
+void thd_close_connection(THD *thd)
+{
+ if (thd->net.vio)
+ vio_close(thd->net.vio);
+}
+
+/**
+ Get current THD object from thread local data
+
+ @retval The THD object for the thread, NULL if not connection thread
+*/
+THD *thd_get_current_thd()
+{
+ return current_thd;
+}
+
+/**
+ Set up various THD data for a new connection
+
+ thd_new_connection_setup
+
+ @param thd THD object
+ @param stack_start Start of stack for connection
+*/
+void thd_new_connection_setup(THD *thd, char *stack_start)
+{
+#ifdef HAVE_PSI_INTERFACE
+ if (PSI_server)
+ thd_set_psi(thd,
+ PSI_server->new_thread(key_thread_one_connection,
+ thd,
+ thd_get_thread_id((MYSQL_THD)thd)));
+#endif
+ thd->set_time();
+ thd->prior_thr_create_utime= thd->thr_create_utime= thd->start_utime=
+ my_micro_time();
+ threads.append(thd);
+ thd_unlock_thread_count(thd);
+ DBUG_PRINT("info", ("init new connection. thd: 0x%lx fd: %d",
+ (ulong)thd, thd->net.vio->sd));
+ thd_set_thread_stack(thd, stack_start);
+}
+
+/**
+ Lock data that needs protection in THD object
+
+ @param thd THD object
+*/
+void thd_lock_data(THD *thd)
+{
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+}
+
+/**
+ Unlock data that needs protection in THD object
+
+ @param thd THD object
+*/
+void thd_unlock_data(THD *thd)
+{
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
+}
+
+/**
+ Support method to check if connection has already started transcaction
+
+ @param client_cntx Low level client context
+
+ @retval TRUE if connection already started transaction
+*/
+bool thd_is_transaction_active(THD *thd)
+{
+ return thd->transaction.is_active();
+}
+
+/**
+ Check if there is buffered data on the socket representing the connection
+
+ @param thd THD object
+*/
+int thd_connection_has_data(THD *thd)
+{
+ Vio *vio= thd->net.vio;
+ return vio->has_data(vio);
+}
+
+/**
+ Set reading/writing on socket, used by SHOW PROCESSLIST
+
+ @param thd THD object
+ @param val Value to set it to (0 or 1)
+*/
+void thd_set_net_read_write(THD *thd, uint val)
+{
+ thd->net.reading_or_writing= val;
+}
+
+/**
+ Set reference to mysys variable in THD object
+
+ @param thd THD object
+ @param mysys_var Reference to set
+*/
+void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var)
+{
+ thd->set_mysys_var(mysys_var);
+}
+
+/**
+ Get socket file descriptor for this connection
+
+ @param thd THD object
+
+ @retval Socket of the connection
+*/
+my_socket thd_get_fd(THD *thd)
+{
+ return thd->net.vio->sd;
+}
+
+/**
+ Get thread attributes for connection threads
+
+ @retval Reference to thread attribute for connection threads
+*/
+pthread_attr_t *get_connection_attrib(void)
+{
+ return &connection_attrib;
+}
+
+/**
+ Get max number of connections
+
+ @retval Max number of connections for MySQL Server
+*/
+ulong get_max_connections(void)
+{
+ return max_connections;
+}
+
/*
The following functions form part of the C plugin API
*/
@@ -479,7 +725,7 @@ bool Drop_table_error_handler::handle_co
THD::THD(bool enable_plugins)
- :Statement(&main_lex, &main_mem_root, CONVENTIONAL_EXECUTION,
+ :Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,
/* statement id */ 0),
rli_fake(0),
user_time(0), in_sub_stmt(0),
@@ -1382,6 +1628,25 @@ bool THD::store_globals()
return 0;
}
+/*
+ Remove the thread specific info (THD and mem_root pointer) stored during
+ store_global call for this thread.
+*/
+bool THD::restore_globals()
+{
+ /*
+ Assert that thread_stack is initialized: it's necessary to be able
+ to track stack overrun.
+ */
+ DBUG_ASSERT(thread_stack);
+
+ /* Undocking the thread specific data. */
+ my_pthread_setspecific_ptr(THR_THD, NULL);
+ my_pthread_setspecific_ptr(THR_MALLOC, NULL);
+
+ return 0;
+}
+
/*
Cleanup after query.
@@ -2225,7 +2490,7 @@ bool select_export::send_data(List<Item>
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"string", printable_buff,
- item->name, row_count);
+ item->name, static_cast<long>(row_count));
}
else if (from_end_pos < res->ptr() + res->length())
{
@@ -2234,7 +2499,7 @@ bool select_export::send_data(List<Item>
*/
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
WARN_DATA_TRUNCATED, ER(WARN_DATA_TRUNCATED),
- item->full_name(), row_count);
+ item->full_name(), static_cast<long>(row_count));
}
cvt_str.length(bytes);
res= &cvt_str;
@@ -3332,7 +3597,7 @@ extern "C" void thd_pool_wait_end(MYSQL_
thd_wait_end MUST be called immediately after waking up again.
*/
-extern "C" void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type)
+extern "C" void thd_wait_begin(MYSQL_THD thd, int wait_type)
{
MYSQL_CALLBACK(thread_scheduler, thd_wait_begin, (thd, wait_type));
}
@@ -3348,7 +3613,7 @@ extern "C" void thd_wait_end(MYSQL_THD t
MYSQL_CALLBACK(thread_scheduler, thd_wait_end, (thd));
}
#else
-extern "C" void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type)
+extern "C" void thd_wait_begin(MYSQL_THD thd, int wait_type)
{
/* do NOTHING for the embedded library */
return;
=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h 2011-05-12 17:29:19 +0000
+++ b/sql/sql_class.h 2011-05-24 09:21:24 +0000
@@ -665,14 +665,14 @@ public:
/*
The states relfects three diffrent life cycles for three
different types of statements:
- Prepared statement: INITIALIZED -> PREPARED -> EXECUTED.
- Stored procedure: INITIALIZED_FOR_SP -> EXECUTED.
- Other statements: CONVENTIONAL_EXECUTION never changes.
+ Prepared statement: STMT_INITIALIZED -> STMT_PREPARED -> STMT_EXECUTED.
+ Stored procedure: STMT_INITIALIZED_FOR_SP -> STMT_EXECUTED.
+ Other statements: STMT_CONVENTIONAL_EXECUTION never changes.
*/
enum enum_state
{
- INITIALIZED= 0, INITIALIZED_FOR_SP= 1, PREPARED= 2,
- CONVENTIONAL_EXECUTION= 3, EXECUTED= 4, ERROR= -1
+ STMT_INITIALIZED= 0, STMT_INITIALIZED_FOR_SP= 1, STMT_PREPARED= 2,
+ STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4, STMT_ERROR= -1
};
enum_state state;
@@ -695,13 +695,13 @@ public:
virtual Type type() const;
virtual ~Query_arena() {};
- inline bool is_stmt_prepare() const { return state == INITIALIZED; }
+ inline bool is_stmt_prepare() const { return state == STMT_INITIALIZED; }
inline bool is_stmt_prepare_or_first_sp_execute() const
- { return (int)state < (int)PREPARED; }
+ { return (int)state < (int)STMT_PREPARED; }
inline bool is_stmt_prepare_or_first_stmt_execute() const
- { return (int)state <= (int)PREPARED; }
+ { return (int)state <= (int)STMT_PREPARED; }
inline bool is_conventional() const
- { return state == CONVENTIONAL_EXECUTION; }
+ { return state == STMT_CONVENTIONAL_EXECUTION; }
inline void* alloc(size_t size) { return alloc_root(mem_root,size); }
inline void* calloc(size_t size)
@@ -2521,6 +2521,7 @@ public:
void cleanup(void);
void cleanup_after_query();
bool store_globals();
+ bool restore_globals();
#ifdef SIGNAL_WITH_VIO_CLOSE
inline void set_active_vio(Vio* vio)
{
=== modified file 'sql/sql_connect.cc'
--- a/sql/sql_connect.cc 2011-04-15 09:33:58 +0000
+++ b/sql/sql_connect.cc 2011-05-21 09:31:19 +0000
@@ -463,7 +463,7 @@ static int check_connection(THD *thd)
if (vio_peer_addr(net->vio, ip, &thd->peer_port, NI_MAXHOST))
{
- my_error(ER_BAD_HOST_ERROR, MYF(0), thd->main_security_ctx.host_or_ip);
+ my_error(ER_BAD_HOST_ERROR, MYF(0));
return 1;
}
if (!(thd->main_security_ctx.ip= my_strdup(ip,MYF(MY_WME))))
@@ -474,7 +474,7 @@ static int check_connection(THD *thd)
if (ip_to_hostname(&net->vio->remote, thd->main_security_ctx.ip,
&thd->main_security_ctx.host, &connect_errors))
{
- my_error(ER_BAD_HOST_ERROR, MYF(0), ip);
+ my_error(ER_BAD_HOST_ERROR, MYF(0));
return 1;
}
@@ -705,6 +705,32 @@ pthread_handler_t handle_one_connection(
return 0;
}
+bool thd_prepare_connection(THD *thd)
+{
+ bool rc;
+ lex_start(thd);
+ rc= login_connection(thd);
+ MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT(thd);
+ if (rc)
+ return rc;
+
+ MYSQL_CONNECTION_START(thd->thread_id, &thd->security_ctx->priv_user[0],
+ (char *) thd->security_ctx->host_or_ip);
+
+ prepare_new_connection_state(thd);
+ return FALSE;
+}
+
+bool thd_is_connection_alive(THD *thd)
+{
+ NET *net= &thd->net;
+ if (!net->error &&
+ net->vio != 0 &&
+ !(thd->killed == THD::KILL_CONNECTION))
+ return TRUE;
+ return FALSE;
+}
+
void do_handle_one_connection(THD *thd_arg)
{
THD *thd= thd_arg;
@@ -747,22 +773,13 @@ void do_handle_one_connection(THD *thd_a
for (;;)
{
- NET *net= &thd->net;
bool rc;
- lex_start(thd);
- rc= login_connection(thd);
- MYSQL_AUDIT_NOTIFY_CONNECTION_CONNECT(thd);
+ rc= thd_prepare_connection(thd);
if (rc)
goto end_thread;
- MYSQL_CONNECTION_START(thd->thread_id, &thd->security_ctx->priv_user[0],
- (char *) thd->security_ctx->host_or_ip);
-
- prepare_new_connection_state(thd);
-
- while (!net->error && net->vio != 0 &&
- !(thd->killed == THD::KILL_CONNECTION))
+ while (thd_is_connection_alive(thd))
{
mysql_audit_release(thd);
if (do_command(thd))
=== modified file 'sql/sql_connect.h'
--- a/sql/sql_connect.h 2011-02-18 09:56:51 +0000
+++ b/sql/sql_connect.h 2011-05-04 09:54:04 +0000
@@ -35,6 +35,8 @@ void time_out_user_resource_limits(THD *
void decrease_user_connections(USER_CONN *uc);
bool thd_init_client_charset(THD *thd, uint cs_number);
bool setup_connection_thread_globals(THD *thd);
+bool thd_prepare_connection(THD *thd);
+bool thd_is_connection_alive(THD *thd);
int check_user(THD *thd, enum enum_server_command command,
const char *passwd, uint passwd_len, const char *db,
=== modified file 'sql/sql_cursor.h'
--- a/sql/sql_cursor.h 2011-03-22 11:44:40 +0000
+++ b/sql/sql_cursor.h 2011-05-04 09:54:04 +0000
@@ -42,7 +42,7 @@ protected:
select_result *result;
public:
Server_side_cursor(MEM_ROOT *mem_root_arg, select_result *result_arg)
- :Query_arena(mem_root_arg, INITIALIZED), result(result_arg)
+ :Query_arena(mem_root_arg, STMT_INITIALIZED), result(result_arg)
{}
virtual bool is_open() const= 0;
=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc 2011-05-12 17:29:19 +0000
+++ b/sql/sql_insert.cc 2011-05-21 08:25:33 +0000
@@ -3932,7 +3932,7 @@ select_create::prepare(List<Item> &value
if (table->s->fields < values.elements)
{
- my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1);
+ my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), 1L);
DBUG_RETURN(-1);
}
=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc 2011-05-12 17:29:19 +0000
+++ b/sql/sql_parse.cc 2011-05-21 08:25:33 +0000
@@ -3576,8 +3576,7 @@ end_with_restore_list:
hostname_requires_resolving(user->host.str))
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_HOSTNAME_WONT_WORK,
- ER(ER_WARN_HOSTNAME_WONT_WORK),
- user->host.str);
+ ER(ER_WARN_HOSTNAME_WONT_WORK));
// Are we trying to change a password of another user
DBUG_ASSERT(user->host.str != 0);
@@ -5470,7 +5469,7 @@ mysql_new_select(LEX *lex, bool move_dow
lex->nest_level++;
if (lex->nest_level > (int) MAX_SELECT_NESTING)
{
- my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT,MYF(0),MAX_SELECT_NESTING);
+ my_error(ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT, MYF(0));
DBUG_RETURN(1);
}
select_lex->nest_level= lex->nest_level;
=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc 2011-05-06 13:21:38 +0000
+++ b/sql/sql_partition.cc 2011-05-21 08:25:33 +0000
@@ -7143,7 +7143,7 @@ void set_key_field_ptr(KEY *key_info, co
void mem_alloc_error(size_t size)
{
- my_error(ER_OUTOFMEMORY, MYF(0), size);
+ my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(size));
}
#ifdef WITH_PARTITION_STORAGE_ENGINE
=== modified file 'sql/sql_partition_admin.cc'
--- a/sql/sql_partition_admin.cc 2011-05-04 07:51:15 +0000
+++ b/sql/sql_partition_admin.cc 2011-05-21 08:25:33 +0000
@@ -361,14 +361,14 @@ static bool exchange_name_with_ddl_log(T
/* call rename table from table to tmp-name */
DBUG_EXECUTE_IF("exchange_partition_fail_3",
my_error(ER_ERROR_ON_RENAME, MYF(0),
- name, tmp_name);
+ name, tmp_name, 0);
error_set= TRUE;
goto err_rename;);
DBUG_EXECUTE_IF("exchange_partition_abort_3", abort(););
if (file->ha_rename_table(name, tmp_name))
{
my_error(ER_ERROR_ON_RENAME, MYF(0),
- name, tmp_name);
+ name, tmp_name, my_errno);
error_set= TRUE;
goto err_rename;
}
@@ -380,14 +380,14 @@ static bool exchange_name_with_ddl_log(T
/* call rename table from partition to table */
DBUG_EXECUTE_IF("exchange_partition_fail_5",
my_error(ER_ERROR_ON_RENAME, MYF(0),
- from_name, name);
+ from_name, name, 0);
error_set= TRUE;
goto err_rename;);
DBUG_EXECUTE_IF("exchange_partition_abort_5", abort(););
if (file->ha_rename_table(from_name, name))
{
my_error(ER_ERROR_ON_RENAME, MYF(0),
- from_name, name);
+ from_name, name, my_errno);
error_set= TRUE;
goto err_rename;
}
@@ -399,14 +399,14 @@ static bool exchange_name_with_ddl_log(T
/* call rename table from tmp-nam to partition */
DBUG_EXECUTE_IF("exchange_partition_fail_7",
my_error(ER_ERROR_ON_RENAME, MYF(0),
- tmp_name, from_name);
+ tmp_name, from_name, 0);
error_set= TRUE;
goto err_rename;);
DBUG_EXECUTE_IF("exchange_partition_abort_7", abort(););
if (file->ha_rename_table(tmp_name, from_name))
{
my_error(ER_ERROR_ON_RENAME, MYF(0),
- tmp_name, from_name);
+ tmp_name, from_name, my_errno);
error_set= TRUE;
goto err_rename;
}
=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc 2011-04-19 03:29:06 +0000
+++ b/sql/sql_plugin.cc 2011-05-21 08:25:33 +0000
@@ -548,7 +548,8 @@ static st_plugin_dl *plugin_dl_add(const
if (!cur)
{
free_plugin_mem(&plugin_dl);
- report_error(report, ER_OUTOFMEMORY, plugin_dl.dl.length);
+ report_error(report, ER_OUTOFMEMORY,
+ static_cast<int>(plugin_dl.dl.length));
DBUG_RETURN(0);
}
/*
@@ -570,7 +571,8 @@ static st_plugin_dl *plugin_dl_add(const
if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0))))
{
free_plugin_mem(&plugin_dl);
- report_error(report, ER_OUTOFMEMORY, plugin_dl.dl.length);
+ report_error(report, ER_OUTOFMEMORY,
+ static_cast<int>(plugin_dl.dl.length));
DBUG_RETURN(0);
}
plugin_dl.dl.length= copy_and_convert(plugin_dl.dl.str, plugin_dl.dl.length,
@@ -581,7 +583,8 @@ static st_plugin_dl *plugin_dl_add(const
if (! (tmp= plugin_dl_insert_or_reuse(&plugin_dl)))
{
free_plugin_mem(&plugin_dl);
- report_error(report, ER_OUTOFMEMORY, sizeof(struct st_plugin_dl));
+ report_error(report, ER_OUTOFMEMORY,
+ static_cast<int>(sizeof(struct st_plugin_dl)));
DBUG_RETURN(0);
}
DBUG_RETURN(tmp);
=== modified file 'sql/sql_prepare.cc'
--- a/sql/sql_prepare.cc 2011-05-04 07:51:15 +0000
+++ b/sql/sql_prepare.cc 2011-05-21 09:31:19 +0000
@@ -1462,7 +1462,7 @@ static int mysql_test_select(Prepared_st
if (!lex->result && !(lex->result= new (stmt->mem_root) select_send))
{
- my_error(ER_OUTOFMEMORY, MYF(0), sizeof(select_send));
+ my_error(ER_OUTOFMEMORY, MYF(0), static_cast<int>(sizeof(select_send)));
goto error;
}
@@ -2552,7 +2552,7 @@ void mysqld_stmt_execute(THD *thd, char
if (!(stmt= find_prepared_statement(thd, stmt_id)))
{
char llbuf[22];
- my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
+ my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
llstr(stmt_id, llbuf), "mysqld_stmt_execute");
DBUG_VOID_RETURN;
}
@@ -2606,7 +2606,7 @@ void mysql_sql_stmt_execute(THD *thd)
if (!(stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
{
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0),
- name->length, name->str, "EXECUTE");
+ static_cast<int>(name->length), name->str, "EXECUTE");
DBUG_VOID_RETURN;
}
@@ -2648,7 +2648,7 @@ void mysqld_stmt_fetch(THD *thd, char *p
if (!(stmt= find_prepared_statement(thd, stmt_id)))
{
char llbuf[22];
- my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
+ my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
llstr(stmt_id, llbuf), "mysqld_stmt_fetch");
DBUG_VOID_RETURN;
}
@@ -2708,7 +2708,7 @@ void mysqld_stmt_reset(THD *thd, char *p
if (!(stmt= find_prepared_statement(thd, stmt_id)))
{
char llbuf[22];
- my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), sizeof(llbuf),
+ my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), static_cast<int>(sizeof(llbuf)),
llstr(stmt_id, llbuf), "mysqld_stmt_reset");
DBUG_VOID_RETURN;
}
@@ -2721,7 +2721,7 @@ void mysqld_stmt_reset(THD *thd, char *p
*/
reset_stmt_params(stmt);
- stmt->state= Query_arena::PREPARED;
+ stmt->state= Query_arena::STMT_PREPARED;
general_log_print(thd, thd->get_command(), NullS);
@@ -2783,7 +2783,7 @@ void mysql_sql_stmt_close(THD *thd)
if (! (stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0),
- name->length, name->str, "DEALLOCATE PREPARE");
+ static_cast<int>(name->length), name->str, "DEALLOCATE PREPARE");
else if (stmt->is_in_use())
my_error(ER_PS_NO_RECURSION, MYF(0));
else
@@ -2840,7 +2840,7 @@ void mysql_stmt_get_longdata(THD *thd, c
if (param_number >= stmt->param_count)
{
/* Error will be sent in execute call */
- stmt->state= Query_arena::ERROR;
+ stmt->state= Query_arena::STMT_ERROR;
stmt->last_errno= ER_WRONG_ARGUMENTS;
sprintf(stmt->last_error, ER(ER_WRONG_ARGUMENTS),
"mysqld_stmt_send_long_data");
@@ -2864,7 +2864,7 @@ void mysql_stmt_get_longdata(THD *thd, c
#endif
if (thd->stmt_da->is_error())
{
- stmt->state= Query_arena::ERROR;
+ stmt->state= Query_arena::STMT_ERROR;
stmt->last_errno= thd->stmt_da->sql_errno();
strncpy(stmt->last_error, thd->stmt_da->message(), MYSQL_ERRMSG_SIZE);
}
@@ -3023,7 +3023,7 @@ end:
Prepared_statement::Prepared_statement(THD *thd_arg)
:Statement(NULL, &main_mem_root,
- INITIALIZED, ++thd_arg->statement_id_counter),
+ STMT_INITIALIZED, ++thd_arg->statement_id_counter),
thd(thd_arg),
result(thd_arg),
param_array(0),
@@ -3296,7 +3296,7 @@ bool Prepared_statement::prepare(const c
{
setup_set_params();
lex->context_analysis_only&= ~CONTEXT_ANALYSIS_ONLY_PREPARE;
- state= Query_arena::PREPARED;
+ state= Query_arena::STMT_PREPARED;
flags&= ~ (uint) IS_IN_USE;
/*
@@ -3414,7 +3414,7 @@ Prepared_statement::execute_loop(String
int reprepare_attempt= 0;
/* Check if we got an error when sending long data */
- if (state == Query_arena::ERROR)
+ if (state == Query_arena::STMT_ERROR)
{
my_message(last_errno, last_error, MYF(0));
return TRUE;
@@ -3477,7 +3477,7 @@ Prepared_statement::execute_server_runna
Item_change_list save_change_list;
thd->change_list.move_elements_to(&save_change_list);
- state= CONVENTIONAL_EXECUTION;
+ state= STMT_CONVENTIONAL_EXECUTION;
if (!(lex= new (mem_root) st_lex_local))
return TRUE;
@@ -3816,8 +3816,8 @@ bool Prepared_statement::execute(String
thd->set_statement(&stmt_backup);
thd->stmt_arena= old_stmt_arena;
- if (state == Query_arena::PREPARED)
- state= Query_arena::EXECUTED;
+ if (state == Query_arena::STMT_PREPARED)
+ state= Query_arena::STMT_EXECUTED;
if (error == 0 && this->lex->sql_command == SQLCOM_CALL)
{
=== modified file 'sql/sql_reload.cc'
--- a/sql/sql_reload.cc 2011-03-07 09:23:36 +0000
+++ b/sql/sql_reload.cc 2011-05-21 08:25:33 +0000
@@ -87,7 +87,7 @@ bool reload_acl_and_cache(THD *thd, unsi
When an error is returned, my_message may have not been called and
the client will hang waiting for a response.
*/
- my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH PRIVILEGES failed");
+ my_error(ER_UNKNOWN_ERROR, MYF(0));
}
}
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc 2011-05-04 07:51:15 +0000
+++ b/sql/sql_show.cc 2011-05-25 16:48:28 +0000
@@ -2408,12 +2408,11 @@ bool schema_table_store_record(THD *thd,
}
-int make_table_list(THD *thd, SELECT_LEX *sel,
- LEX_STRING *db_name, LEX_STRING *table_name)
+static int make_table_list(THD *thd, SELECT_LEX *sel,
+ LEX_STRING *db_name, LEX_STRING *table_name)
{
Table_ident *table_ident;
table_ident= new Table_ident(thd, *db_name, *table_name, 1);
- sel->init_query();
if (!sel->add_table_to_list(thd, table_ident, 0, 0, TL_READ, MDL_SHARED_READ))
return 1;
return 0;
@@ -2983,98 +2982,196 @@ make_table_name_list(THD *thd, List<LEX_
/**
- @brief Fill I_S table for SHOW COLUMNS|INDEX commands
+ Fill I_S table with data obtained by performing full-blown table open.
- @param[in] thd thread handler
- @param[in] tables TABLE_LIST for I_S table
- @param[in] schema_table pointer to I_S structure
- @param[in] can_deadlock Indicates that deadlocks are possible
- due to metadata locks, so to avoid
- them we should not wait in case if
- conflicting lock is present.
- @param[in] open_tables_state_backup pointer to Open_tables_backup object
- which is used to save|restore original
- status of variables related to
- open tables state
+ @param thd Thread handler.
+ @param is_show_fields_or_keys Indicates whether it is a legacy SHOW
+ COLUMNS or SHOW KEYS statement.
+ @param table TABLE object for I_S table to be filled.
+ @param schema_table I_S table description structure.
+ @param orig_db_name Database name.
+ @param orig_table_name Table name.
+ @param open_tables_state_backup Open_tables_state object which is used
+ to save/restore original status of
+ variables related to open tables state.
+ @param can_deadlock Indicates that deadlocks are possible
+ due to metadata locks, so to avoid
+ them we should not wait in case if
+ conflicting lock is present.
- @return Operation status
- @retval 0 success
- @retval 1 error
+ @retval FALSE - Success.
+ @retval TRUE - Failure.
*/
+static bool
+fill_schema_table_by_open(THD *thd, bool is_show_fields_or_keys,
+ TABLE *table, ST_SCHEMA_TABLE *schema_table,
+ LEX_STRING *orig_db_name,
+ LEX_STRING *orig_table_name,
+ Open_tables_backup *open_tables_state_backup,
+ bool can_deadlock)
+{
+ Query_arena i_s_arena(thd->mem_root,
+ Query_arena::STMT_CONVENTIONAL_EXECUTION),
+ backup_arena, *old_arena;
+ LEX *old_lex= thd->lex, temp_lex, *lex;
+ LEX_STRING db_name, table_name;
+ TABLE_LIST *table_list;
+ bool result= true;
-static int
-fill_schema_show_cols_or_idxs(THD *thd, TABLE_LIST *tables,
- ST_SCHEMA_TABLE *schema_table,
- bool can_deadlock,
- Open_tables_backup *open_tables_state_backup)
-{
- LEX *lex= thd->lex;
- bool res;
- LEX_STRING tmp_lex_string, tmp_lex_string1, *db_name, *table_name;
- enum_sql_command save_sql_command= lex->sql_command;
- TABLE_LIST *show_table_list= tables->schema_select_lex->table_list.first;
- TABLE *table= tables->table;
- int error= 1;
- DBUG_ENTER("fill_schema_show");
+ DBUG_ENTER("fill_schema_table_by_open");
+ /*
+ When a view is opened its structures are allocated on a permanent
+ statement arena and linked into the LEX tree for the current statement
+ (this happens even in cases when view is handled through TEMPTABLE
+ algorithm).
+
+ To prevent this process from unnecessary hogging of memory in the permanent
+ arena of our I_S query and to avoid damaging its LEX we use temporary
+ arena and LEX for table/view opening.
+
+ Use temporary arena instead of statement permanent arena. Also make
+ it active arena and save original one for successive restoring.
+ */
+ old_arena= thd->stmt_arena;
+ thd->stmt_arena= &i_s_arena;
+ thd->set_n_backup_active_arena(&i_s_arena, &backup_arena);
+
+ /* Prepare temporary LEX. */
+ thd->lex= lex= &temp_lex;
+ lex_start(thd);
+
+ /* Disable constant subquery evaluation as we won't be locking tables. */
+ lex->context_analysis_only= CONTEXT_ANALYSIS_ONLY_VIEW;
- lex->all_selects_list= tables->schema_select_lex;
/*
- Restore thd->temporary_tables to be able to process
- temporary tables(only for 'show index' & 'show columns').
- This should be changed when processing of temporary tables for
- I_S tables will be done.
+ Some of process_table() functions rely on wildcard being passed from
+ old LEX (or at least being initialized).
*/
- thd->temporary_tables= open_tables_state_backup->temporary_tables;
+ lex->wild= old_lex->wild;
+
+ /*
+ Since make_table_list() might change database and table name passed
+ to it we create copies of orig_db_name and orig_table_name here.
+ These copies are used for make_table_list() while unaltered values
+ are passed to process_table() functions.
+ */
+ if (!thd->make_lex_string(&db_name, orig_db_name->str,
+ orig_db_name->length, FALSE) ||
+ !thd->make_lex_string(&table_name, orig_table_name->str,
+ orig_table_name->length, FALSE))
+ goto end;
+
+ /*
+ Create table list element for table to be open. Link it with the
+ temporary LEX. The latter is required to correctly open views and
+ produce table describing their structure.
+ */
+ if (make_table_list(thd, &lex->select_lex, &db_name, &table_name))
+ goto end;
+
+ table_list= lex->select_lex.table_list.first;
+
+ if (is_show_fields_or_keys)
+ {
+ /*
+ Restore thd->temporary_tables to be able to process
+ temporary tables (only for 'show index' & 'show columns').
+ This should be changed when processing of temporary tables for
+ I_S tables will be done.
+ */
+ thd->temporary_tables= open_tables_state_backup->temporary_tables;
+ }
+ else
+ {
+ /*
+ Apply optimization flags for table opening which are relevant for
+ this I_S table. We can't do this for SHOW COLUMNS/KEYS because of
+ backward compatibility.
+ */
+ table_list->i_s_requested_object= schema_table->i_s_requested_object;
+ }
+
/*
Let us set fake sql_command so views won't try to merge
themselves into main statement. If we don't do this,
SELECT * from information_schema.xxxx will cause problems.
- SQLCOM_SHOW_FIELDS is used because it satisfies 'only_view_structure()'
+ SQLCOM_SHOW_FIELDS is used because it satisfies
+ 'only_view_structure()'.
*/
lex->sql_command= SQLCOM_SHOW_FIELDS;
- res= open_temporary_tables(thd, show_table_list);
+ result= open_temporary_tables(thd, table_list);
- if (!res)
+ if (!result)
{
- res= open_normal_and_derived_tables(thd, show_table_list,
- (MYSQL_OPEN_IGNORE_FLUSH |
- MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
- (can_deadlock ?
- MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)));
+ result= open_normal_and_derived_tables(thd, table_list,
+ (MYSQL_OPEN_IGNORE_FLUSH |
+ MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
+ (can_deadlock ?
+ MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)));
}
-
- lex->sql_command= save_sql_command;
+ /*
+ Restore old value of sql_command back as it is being looked at in
+ process_table() function.
+ */
+ lex->sql_command= old_lex->sql_command;
DEBUG_SYNC(thd, "after_open_table_ignore_flush");
/*
- get_all_tables() returns 1 on failure and 0 on success thus
- return only these and not the result code of ::process_table()
+ XXX: show_table_list has a flag i_is_requested,
+ and when it's set, open_normal_and_derived_tables()
+ can return an error without setting an error message
+ in THD, which is a hack. This is why we have to
+ check for res, then for thd->is_error() and only then
+ for thd->main_da.sql_errno().
- We should use show_table_list->alias instead of
- show_table_list->table_name because table_name
- could be changed during opening of I_S tables. It's safe
- to use alias because alias contains original table name
- in this case(this part of code is used only for
- 'show columns' & 'show statistics' commands).
+ Again we don't do this for SHOW COLUMNS/KEYS because
+ of backward compatibility.
*/
- table_name= thd->make_lex_string(&tmp_lex_string1, show_table_list->alias,
- strlen(show_table_list->alias), FALSE);
- if (!show_table_list->view)
- db_name= thd->make_lex_string(&tmp_lex_string, show_table_list->db,
- show_table_list->db_length, FALSE);
- else
- db_name= &show_table_list->view_db;
-
-
- error= test(schema_table->process_table(thd, show_table_list,
- table, res, db_name,
- table_name));
- thd->temporary_tables= 0;
- close_tables_for_reopen(thd, &show_table_list,
- open_tables_state_backup->mdl_system_tables_svp);
- DBUG_RETURN(error);
+ if (!is_show_fields_or_keys && result && thd->is_error() &&
+ thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
+ {
+ /*
+ Hide error for a non-existing table.
+ For example, this error can occur when we use a where condition
+ with a db name and table, but the table does not exist.
+ */
+ result= false;
+ thd->clear_error();
+ }
+ else
+ {
+ result= schema_table->process_table(thd, table_list,
+ table, result,
+ orig_db_name,
+ orig_table_name);
+ }
+
+
+end:
+ lex->unit.cleanup();
+
+ /* Restore original LEX value, statement's arena and THD arena values. */
+ lex_end(thd->lex);
+
+ if (i_s_arena.free_list)
+ i_s_arena.free_items();
+
+ /*
+ For safety reset list of open temporary tables before closing
+ all tables open within this Open_tables_state.
+ */
+ thd->temporary_tables= NULL;
+ close_thread_tables(thd);
+ thd->mdl_context.rollback_to_savepoint(open_tables_state_backup->mdl_system_tables_svp);
+
+ thd->lex= old_lex;
+
+ thd->stmt_arena= old_arena;
+ thd->restore_active_arena(&i_s_arena, &backup_arena);
+
+ DBUG_RETURN(result);
}
@@ -3485,10 +3582,8 @@ int get_all_tables(THD *thd, TABLE_LIST
{
LEX *lex= thd->lex;
TABLE *table= tables->table;
- SELECT_LEX *old_all_select_lex= lex->all_selects_list;
SELECT_LEX *lsel= tables->schema_select_lex;
ST_SCHEMA_TABLE *schema_table= tables->schema_table;
- SELECT_LEX sel;
LOOKUP_FIELD_VALUES lookup_field_vals;
LEX_STRING *db_name, *table_name;
bool with_i_schema;
@@ -3496,11 +3591,8 @@ int get_all_tables(THD *thd, TABLE_LIST
List<LEX_STRING> db_names;
List_iterator_fast<LEX_STRING> it(db_names);
Item *partial_cond= 0;
- uint derived_tables= lex->derived_tables;
int error= 1;
Open_tables_backup open_tables_state_backup;
- uint8 save_context_analysis_only= lex->context_analysis_only;
- Query_tables_list query_tables_list_backup;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *sctx= thd->security_ctx;
#endif
@@ -3519,15 +3611,6 @@ int get_all_tables(THD *thd, TABLE_LIST
*/
can_deadlock= thd->mdl_context.has_locks();
- lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW;
- lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
- /*
- Restore Query_tables_list::sql_command value, which was reset
- above, as ST_SCHEMA_TABLE::process_table() functions often rely
- that this value reflects which SHOW statement is executed.
- */
- lex->sql_command= query_tables_list_backup.sql_command;
-
/*
We should not introduce deadlocks even if we already have some
tables open and locked, since we won't lock tables which we will
@@ -3547,9 +3630,19 @@ int get_all_tables(THD *thd, TABLE_LIST
*/
if (lsel && lsel->table_list.first)
{
- error= fill_schema_show_cols_or_idxs(thd, tables, schema_table,
- can_deadlock,
- &open_tables_state_backup);
+ LEX_STRING db_name, table_name;
+
+ db_name.str= lsel->table_list.first->db;
+ db_name.length= lsel->table_list.first->db_length;
+
+ table_name.str= lsel->table_list.first->table_name;
+ table_name.length= lsel->table_list.first->table_name_length;
+
+ error= fill_schema_table_by_open(thd, TRUE,
+ table, schema_table,
+ &db_name, &table_name,
+ &open_tables_state_backup,
+ can_deadlock);
goto err;
}
@@ -3603,12 +3696,6 @@ int get_all_tables(THD *thd, TABLE_LIST
it.rewind(); /* To get access to new elements in basis list */
while ((db_name= it++))
{
- LEX_STRING orig_db_name;
-
- /* db_name can be changed in make_table_list() func */
- if (!thd->make_lex_string(&orig_db_name, db_name->str,
- db_name->length, FALSE))
- goto err;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (!(check_access(thd, SELECT_ACL, db_name->str,
&thd->col_access, NULL, 0, 1) ||
@@ -3686,66 +3773,13 @@ int get_all_tables(THD *thd, TABLE_LIST
continue;
}
- int res;
- LEX_STRING tmp_lex_string;
- /*
- Set the parent lex of 'sel' because it is needed by
- sel.init_query() which is called inside make_table_list.
- */
- sel.parent_lex= lex;
- if (make_table_list(thd, &sel, db_name, table_name))
- goto err;
- TABLE_LIST *show_table_list= sel.table_list.first;
- lex->all_selects_list= &sel;
- lex->derived_tables= 0;
- lex->sql_command= SQLCOM_SHOW_FIELDS;
- show_table_list->i_s_requested_object=
- schema_table->i_s_requested_object;
DEBUG_SYNC(thd, "before_open_in_get_all_tables");
- res= open_normal_and_derived_tables(thd, show_table_list,
- (MYSQL_OPEN_IGNORE_FLUSH |
- MYSQL_OPEN_FORCE_SHARED_HIGH_PRIO_MDL |
- (can_deadlock ? MYSQL_OPEN_FAIL_ON_MDL_CONFLICT : 0)));
- lex->sql_command= query_tables_list_backup.sql_command;
- /*
- XXX: show_table_list has a flag i_is_requested,
- and when it's set, open_normal_and_derived_tables()
- can return an error without setting an error message
- in THD, which is a hack. This is why we have to
- check for res, then for thd->is_error() only then
- for thd->stmt_da->sql_errno().
- */
- if (res && thd->is_error() &&
- thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
- {
- /*
- Hide error for not existing table.
- This error can occur for example when we use
- where condition with db name and table name and this
- table does not exist.
- */
- res= 0;
- thd->clear_error();
- }
- else
- {
- /*
- We should use show_table_list->alias instead of
- show_table_list->table_name because table_name
- could be changed during opening of I_S tables. It's safe
- to use alias because alias contains original table name
- in this case.
- */
- thd->make_lex_string(&tmp_lex_string, show_table_list->alias,
- strlen(show_table_list->alias), FALSE);
- res= schema_table->process_table(thd, show_table_list, table,
- res, &orig_db_name,
- &tmp_lex_string);
- close_tables_for_reopen(thd, &show_table_list,
- open_tables_state_backup.mdl_system_tables_svp);
- }
- DBUG_ASSERT(!lex->query_tables_own_last);
- if (res)
+
+ if (fill_schema_table_by_open(thd, FALSE,
+ table, schema_table,
+ db_name, table_name,
+ &open_tables_state_backup,
+ can_deadlock))
goto err;
}
}
@@ -3761,10 +3795,7 @@ int get_all_tables(THD *thd, TABLE_LIST
error= 0;
err:
thd->restore_backup_open_tables_state(&open_tables_state_backup);
- lex->restore_backup_query_tables_list(&query_tables_list_backup);
- lex->derived_tables= derived_tables;
- lex->all_selects_list= old_all_select_lex;
- lex->context_analysis_only= save_context_analysis_only;
+
DBUG_RETURN(error);
}
=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc 2011-05-12 17:29:19 +0000
+++ b/sql/sql_table.cc 2011-05-21 09:30:35 +0000
@@ -2812,7 +2812,8 @@ int prepare_create_field(Create_field *s
MAX_FIELD_CHARLENGTH)
{
my_printf_error(ER_TOO_BIG_FIELDLENGTH, ER(ER_TOO_BIG_FIELDLENGTH),
- MYF(0), sql_field->field_name, MAX_FIELD_CHARLENGTH);
+ MYF(0), sql_field->field_name,
+ static_cast<ulong>(MAX_FIELD_CHARLENGTH));
DBUG_RETURN(1);
}
}
@@ -3808,12 +3809,12 @@ mysql_prepare_create_table(THD *thd, HA_
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
{
my_error(ER_TOO_LONG_INDEX_COMMENT, MYF(0),
- key_info->name, (uint) INDEX_COMMENT_MAXLEN);
+ key_info->name, static_cast<ulong>(INDEX_COMMENT_MAXLEN));
DBUG_RETURN(-1);
}
char warn_buff[MYSQL_ERRMSG_SIZE];
my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_INDEX_COMMENT),
- key_info->name, (uint) INDEX_COMMENT_MAXLEN);
+ key_info->name, static_cast<ulong>(INDEX_COMMENT_MAXLEN));
/* do not push duplicate warnings */
if (!check_duplicate_warning(thd, warn_buff, strlen(warn_buff)))
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -3941,7 +3942,8 @@ static bool prepare_blob_field(THD *thd,
MODE_STRICT_ALL_TABLES)))
{
my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), sql_field->field_name,
- MAX_FIELD_VARCHARLENGTH / sql_field->charset->mbmaxlen);
+ static_cast<ulong>(MAX_FIELD_VARCHARLENGTH /
+ sql_field->charset->mbmaxlen));
DBUG_RETURN(1);
}
sql_field->sql_type= MYSQL_TYPE_BLOB;
@@ -4973,41 +4975,48 @@ err:
/**
@brief Check if both DROP and CREATE are present for an index in ALTER TABLE
-
- @details Checks if any index is being modified (present as both DROP INDEX
- and ADD INDEX) in the current ALTER TABLE statement. Needed for disabling
+
+ @details Checks if any index is being modified (present as both DROP INDEX
+ and ADD INDEX) in the current ALTER TABLE statement. Needed for disabling
in-place ALTER TABLE.
-
- @param table The table being altered
- @param alter_info The ALTER TABLE structure
- @return presence of index being altered
+
+ @param table The table being altered.
+ @param key_info_buffer Array of KEY structs for new indexes.
+ @param index_drop_buffer Array of offsets into table->key_info for indexes
+ to be dropped.
+ @param index_drop_count Number of indexes to be dropped.
+ @param index_add_buffer Array of offsets into key_info_buffer representing
+ new indexes.
+ @param index_add_count Number of indexes to add.
+ @return presence of index being both dropped and added
@retval FALSE No such index
@retval TRUE Have at least 1 index modified
*/
static bool
-is_index_maintenance_unique (TABLE *table, Alter_info *alter_info)
+is_index_maintenance_unique (const TABLE *table, const KEY *key_info_buffer,
+ const uint *index_drop_buffer,
+ uint index_drop_count,
+ const uint *index_add_buffer, uint index_add_count)
{
- List_iterator<Key> key_it(alter_info->key_list);
- List_iterator<Alter_drop> drop_it(alter_info->drop_list);
- Key *key;
-
- while ((key= key_it++))
- {
- if (key->name.str)
- {
- Alter_drop *drop;
-
- drop_it.rewind();
- while ((drop= drop_it++))
- {
- if (drop->type == Alter_drop::KEY &&
- !my_strcasecmp(system_charset_info, key->name.str, drop->name))
- return TRUE;
- }
+ const KEY *add_key;
+ const KEY *drop_key;
+ const uint *idx_add_p;
+ const uint *idx_drop_p;
+
+ for (idx_add_p= index_add_buffer;
+ idx_add_p < index_add_buffer + index_add_count; idx_add_p++)
+ {
+ add_key= key_info_buffer + *idx_add_p;
+ for (idx_drop_p= index_drop_buffer;
+ idx_drop_p < index_drop_buffer + index_drop_count; idx_drop_p++)
+ {
+ drop_key= table->key_info + *idx_drop_p;
+ if (!my_strcasecmp(system_charset_info, add_key->name, drop_key->name))
+ return true;
}
}
- return FALSE;
+ return false;
}
@@ -6298,15 +6307,9 @@ bool mysql_alter_table(THD *thd,char *ne
*/
new_db_type= create_info->db_type;
- if (is_index_maintenance_unique (table, alter_info))
- need_copy_table= ALTER_TABLE_DATA_CHANGED;
-
if (mysql_prepare_alter_table(thd, table, create_info, alter_info))
goto err;
- if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
- need_copy_table= alter_info->change_level;
-
set_table_default_charset(thd, create_info, db);
if (thd->variables.old_alter_table
@@ -6318,6 +6321,8 @@ bool mysql_alter_table(THD *thd,char *ne
need_copy_table= ALTER_TABLE_DATA_CHANGED;
else
{
+ need_copy_table= alter_info->change_level;
+
Alter_table_change_level need_copy_table_res;
/* Check how much the tables differ. */
if (mysql_compare_tables(table, alter_info,
@@ -6328,16 +6333,24 @@ bool mysql_alter_table(THD *thd,char *ne
&index_add_buffer, &index_add_count,
&candidate_key_count, FALSE))
goto err;
-
+
DBUG_EXECUTE_IF("alter_table_only_metadata_change", {
if (need_copy_table_res != ALTER_TABLE_METADATA_ONLY)
goto err; });
DBUG_EXECUTE_IF("alter_table_only_index_change", {
if (need_copy_table_res != ALTER_TABLE_INDEX_CHANGED)
goto err; });
-
+
if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
need_copy_table= need_copy_table_res;
+
+ if (need_copy_table == ALTER_TABLE_INDEX_CHANGED)
+ {
+ if (is_index_maintenance_unique(table, key_info_buffer,
+ index_drop_buffer, index_drop_count,
+ index_add_buffer, index_add_count))
+ need_copy_table= ALTER_TABLE_DATA_CHANGED;
+ }
}
/*
=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy 2011-05-12 05:52:39 +0000
+++ b/sql/sql_yacc.yy 2011-05-21 08:25:33 +0000
@@ -1929,7 +1929,7 @@ master_def:
if ($3 > MASTER_DELAY_MAX)
{
my_error(ER_MASTER_DELAY_VALUE_OUT_OF_RANGE, MYF(0),
- $3, MASTER_DELAY_MAX);
+ static_cast<uint>($3), MASTER_DELAY_MAX);
}
else
Lex->mi.sql_delay = $3;
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2011-05-12 17:29:19 +0000
+++ b/sql/sys_vars.cc 2011-05-21 08:25:33 +0000
@@ -912,7 +912,7 @@ static bool event_scheduler_update(sys_v
: Events::stop();
mysql_mutex_lock(&LOCK_global_system_variables);
if (ret)
- my_error(ER_EVENT_SET_VAR_ERROR, MYF(0));
+ my_error(ER_EVENT_SET_VAR_ERROR, MYF(0), 0);
return ret;
}
@@ -2728,7 +2728,7 @@ static bool update_last_insert_id(THD *t
{
if (!var->value)
{
- my_error(ER_NO_DEFAULT, MYF(0), var->var->name);
+ my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
thd->first_successful_insert_id_in_prev_stmt=
@@ -2777,7 +2777,7 @@ static bool update_insert_id(THD *thd, s
{
if (!var->value)
{
- my_error(ER_NO_DEFAULT, MYF(0), var->var->name);
+ my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
thd->force_one_auto_inc_interval(var->save_result.ulonglong_value);
@@ -2800,7 +2800,7 @@ static bool update_rand_seed1(THD *thd,
{
if (!var->value)
{
- my_error(ER_NO_DEFAULT, MYF(0), var->var->name);
+ my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
thd->rand.seed1= (ulong) var->save_result.ulonglong_value;
@@ -2822,7 +2822,7 @@ static bool update_rand_seed2(THD *thd,
{
if (!var->value)
{
- my_error(ER_NO_DEFAULT, MYF(0), var->var->name);
+ my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str);
return true;
}
thd->rand.seed2= (ulong) var->save_result.ulonglong_value;
=== modified file 'sql/table.cc'
--- a/sql/table.cc 2011-05-04 07:51:15 +0000
+++ b/sql/table.cc 2011-05-23 23:34:47 +0000
@@ -2026,7 +2026,8 @@ int open_table_from_share(THD *thd, TABL
Query_arena *backup_stmt_arena_ptr= thd->stmt_arena;
Query_arena backup_arena;
- Query_arena part_func_arena(&outparam->mem_root, Query_arena::INITIALIZED);
+ Query_arena part_func_arena(&outparam->mem_root,
+ Query_arena::STMT_INITIALIZED);
thd->set_n_backup_active_arena(&part_func_arena, &backup_arena);
thd->stmt_arena= &part_func_arena;
bool tmp;
@@ -2224,7 +2225,15 @@ void free_blobs(register TABLE *table)
for (ptr= table->s->blob_field, end=ptr + table->s->blob_fields ;
ptr != end ;
ptr++)
- ((Field_blob*) table->field[*ptr])->free();
+ {
+ /*
+ Reduced TABLE objects which are used by row-based replication for
+ type conversion might have some fields missing. Skip freeing BLOB
+ buffers for such missing fields.
+ */
+ if (table->field[*ptr])
+ ((Field_blob*) table->field[*ptr])->free();
+ }
}
@@ -2458,7 +2467,7 @@ void open_table_error(TABLE_SHARE *share
default: /* Better wrong error than none */
case 4:
strxmov(buff, share->normalized_path.str, reg_ext, NullS);
- my_error(ER_NOT_FORM_FILE, errortype, buff, 0);
+ my_error(ER_NOT_FORM_FILE, errortype, buff);
break;
}
DBUG_VOID_RETURN;
@@ -3047,7 +3056,8 @@ Table_check_intact::check(TABLE *table,
report_error(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE,
ER(ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE),
table->alias, table_def->count, table->s->fields,
- table->s->mysql_version, MYSQL_VERSION_ID);
+ static_cast<int>(table->s->mysql_version),
+ MYSQL_VERSION_ID);
DBUG_RETURN(TRUE);
}
else if (MYSQL_VERSION_ID == table->s->mysql_version)
=== modified file 'sql/unireg.cc'
--- a/sql/unireg.cc 2011-03-25 13:28:19 +0000
+++ b/sql/unireg.cc 2011-05-21 08:25:33 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -230,13 +230,13 @@ bool mysql_create_frm(THD *thd, const ch
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
{
my_error(ER_TOO_LONG_TABLE_COMMENT, MYF(0),
- real_table_name, (uint) TABLE_COMMENT_MAXLEN);
+ real_table_name, static_cast<ulong>(TABLE_COMMENT_MAXLEN));
my_free(screen_buff);
DBUG_RETURN(1);
}
char warn_buff[MYSQL_ERRMSG_SIZE];
my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_TABLE_COMMENT),
- real_table_name, (uint) TABLE_COMMENT_MAXLEN);
+ real_table_name, static_cast<ulong>(TABLE_COMMENT_MAXLEN));
/* do not push duplicate warnings */
if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff)))
push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -737,13 +737,14 @@ static bool pack_header(uchar *forminfo,
if ((current_thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | MODE_STRICT_ALL_TABLES)))
{
- my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0),
- field->field_name, (uint) COLUMN_COMMENT_MAXLEN);
+ my_error(ER_TOO_LONG_FIELD_COMMENT, MYF(0), field->field_name,
+ static_cast<ulong>(COLUMN_COMMENT_MAXLEN));
DBUG_RETURN(1);
}
char warn_buff[MYSQL_ERRMSG_SIZE];
my_snprintf(warn_buff, sizeof(warn_buff), ER(ER_TOO_LONG_FIELD_COMMENT),
- field->field_name, (uint) COLUMN_COMMENT_MAXLEN);
+ field->field_name,
+ static_cast<ulong>(COLUMN_COMMENT_MAXLEN));
/* do not push duplicate warnings */
if (!check_duplicate_warning(current_thd, warn_buff, strlen(warn_buff)))
push_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN,
@@ -831,7 +832,7 @@ static bool pack_header(uchar *forminfo,
if (reclength > (ulong) file->max_record_length())
{
- my_error(ER_TOO_BIG_ROWSIZE, MYF(0), (uint) file->max_record_length());
+ my_error(ER_TOO_BIG_ROWSIZE, MYF(0), static_cast<long>(file->max_record_length()));
DBUG_RETURN(1);
}
/* Hack to avoid bugs with small static rows in MySQL */
=== modified file 'storage/example/ha_example.cc'
--- a/storage/example/ha_example.cc 2011-04-19 03:29:06 +0000
+++ b/storage/example/ha_example.cc 2011-05-21 08:25:33 +0000
@@ -977,7 +977,7 @@ static int show_func_example(MYSQL_THD t
var->type= SHOW_CHAR;
var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes
my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE,
- "enum_var is %u, ulong_var is %lu, %.6b", // %b is MySQL extension
+ "enum_var is %lu, ulong_var is %lu, %.6b", // %b is MySQL extension
srv_enum_var, srv_ulong_var, "really");
return 0;
}
=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c 2011-04-13 08:34:16 +0000
+++ b/storage/innobase/buf/buf0buf.c 2011-05-24 08:42:51 +0000
@@ -5136,25 +5136,18 @@ buf_get_latched_pages_number(void)
#endif /* UNIV_DEBUG */
/*********************************************************************//**
-Returns the number of pending buf pool ios.
-@return number of pending I/O operations */
+Returns the number of pending buf pool read ios.
+@return number of pending read I/O operations */
UNIV_INTERN
ulint
-buf_get_n_pending_ios(void)
-/*=======================*/
+buf_get_n_pending_read_ios(void)
+/*============================*/
{
ulint i;
ulint pend_ios = 0;
for (i = 0; i < srv_buf_pool_instances; i++) {
- buf_pool_t* buf_pool;
-
- buf_pool = buf_pool_from_array(i);
-
- pend_ios +=
- buf_pool->n_pend_reads
- + buf_pool->n_flush[BUF_FLUSH_LRU]
- + buf_pool->n_flush[BUF_FLUSH_LIST];
+ pend_ios += buf_pool_from_array(i)->n_pend_reads;
}
return(pend_ios);
=== modified file 'storage/innobase/buf/buf0flu.c'
--- a/storage/innobase/buf/buf0flu.c 2011-04-05 11:12:48 +0000
+++ b/storage/innobase/buf/buf0flu.c 2011-05-12 13:54:33 +0000
@@ -2393,8 +2393,10 @@ buf_flush_page_cleaner_thread(
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
/* The page_cleaner skips sleep if the server is
- idle and there is work to do. */
+ idle and there are no pending IOs in the buffer pool
+ and there is work to do. */
if (srv_check_activity(last_activity)
+ || buf_get_n_pending_read_ios()
|| n_flushed == 0) {
page_cleaner_sleep_if_needed(next_loop_time);
}
=== modified file 'storage/innobase/dict/dict0crea.c'
--- a/storage/innobase/dict/dict0crea.c 2011-04-27 21:49:19 +0000
+++ b/storage/innobase/dict/dict0crea.c 2011-05-09 08:48:47 +0000
@@ -677,9 +677,9 @@ dict_create_index_tree_step(
/* printf("Created a new index tree in space %lu root page %lu\n",
index->space, index->page_no); */
- page_rec_write_index_page_no(btr_pcur_get_rec(&pcur),
- DICT_SYS_INDEXES_PAGE_NO_FIELD,
- node->page_no, &mtr);
+ page_rec_write_field(btr_pcur_get_rec(&pcur),
+ DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ node->page_no, &mtr);
btr_pcur_close(&pcur);
mtr_commit(&mtr);
@@ -749,9 +749,8 @@ dict_drop_index_tree(
root_page_no); */
btr_free_root(space, zip_size, root_page_no, mtr);
- page_rec_write_index_page_no(rec,
- DICT_SYS_INDEXES_PAGE_NO_FIELD,
- FIL_NULL, mtr);
+ page_rec_write_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ FIL_NULL, mtr);
}
/*******************************************************************//**
@@ -854,8 +853,8 @@ create:
in SYS_INDEXES, so that the database will not get into an
inconsistent state in case it crashes between the mtr_commit()
below and the following mtr_commit() call. */
- page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
- FIL_NULL, mtr);
+ page_rec_write_field(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
+ FIL_NULL, mtr);
/* We will need to commit the mini-transaction in order to avoid
deadlocks in the btr_create() call, because otherwise we would
=== modified file 'storage/innobase/fil/fil0fil.c'
--- a/storage/innobase/fil/fil0fil.c 2011-04-27 21:49:19 +0000
+++ b/storage/innobase/fil/fil0fil.c 2011-05-22 20:19:06 +0000
@@ -154,6 +154,9 @@ struct fil_node_struct {
/*!< count of pending flushes on this file;
closing of the file is not allowed if
this is > 0 */
+ ibool being_extended;
+ /*!< TRUE if the node is currently
+ being extended. */
ib_int64_t modification_counter;/*!< when we write to the file we
increment this by one */
ib_int64_t flush_counter;/*!< up to what
@@ -612,21 +615,15 @@ fil_node_create(
mutex_enter(&fil_system->mutex);
- node = mem_alloc(sizeof(fil_node_t));
+ node = mem_zalloc(sizeof(fil_node_t));
node->name = mem_strdup(name);
- node->open = FALSE;
ut_a(!is_raw || srv_start_raw_disk_in_use);
node->is_raw_disk = is_raw;
node->size = size;
node->magic_n = FIL_NODE_MAGIC_N;
- node->n_pending = 0;
- node->n_pending_flushes = 0;
-
- node->modification_counter = 0;
- node->flush_counter = 0;
space = fil_space_get_by_id(id);
@@ -671,9 +668,7 @@ fil_node_open_file(
fil_system_t* system, /*!< in: tablespace memory cache */
fil_space_t* space) /*!< in: space */
{
- ib_int64_t size_bytes;
- ulint size_low;
- ulint size_high;
+ os_offset_t size_bytes;
ibool ret;
ibool success;
byte* buf2;
@@ -711,10 +706,8 @@ fil_node_open_file(
ut_a(0);
}
- os_file_get_size(node->handle, &size_low, &size_high);
-
- size_bytes = (((ib_int64_t)size_high) << 32)
- + (ib_int64_t)size_low;
+ size_bytes = os_file_get_size(node->handle);
+ ut_a(size_bytes != (os_offset_t) -1);
#ifdef UNIV_HOTBACKUP
if (space->id == 0) {
node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
@@ -729,11 +722,10 @@ fil_node_open_file(
fprintf(stderr,
"InnoDB: Error: the size of single-table"
" tablespace file %s\n"
- "InnoDB: is only %lu %lu,"
+ "InnoDB: is only %llu,"
" should be at least %lu!\n",
node->name,
- (ulong) size_high,
- (ulong) size_low,
+ size_bytes,
(ulong) (FIL_IBD_FILE_INITIAL_SIZE
* UNIV_PAGE_SIZE));
@@ -747,8 +739,7 @@ fil_node_open_file(
set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
- success = os_file_read(node->handle, page, 0, 0,
- UNIV_PAGE_SIZE);
+ success = os_file_read(node->handle, page, 0, UNIV_PAGE_SIZE);
space_id = fsp_header_get_space_id(page);
flags = fsp_header_get_flags(page);
@@ -860,7 +851,9 @@ fil_node_close_file(
ut_a(node->open);
ut_a(node->n_pending == 0);
ut_a(node->n_pending_flushes == 0);
- ut_a(node->modification_counter == node->flush_counter);
+ ut_a(!node->being_extended);
+ ut_a(node->modification_counter == node->flush_counter
+ || srv_fast_shutdown == 2);
ret = os_file_close(node->handle);
ut_a(ret);
@@ -899,32 +892,37 @@ fil_try_to_close_file_in_LRU(
ut_ad(mutex_own(&fil_system->mutex));
- node = UT_LIST_GET_LAST(fil_system->LRU);
-
if (print_info) {
fprintf(stderr,
"InnoDB: fil_sys open file LRU len %lu\n",
(ulong) UT_LIST_GET_LEN(fil_system->LRU));
}
- while (node != NULL) {
+ for (node = UT_LIST_GET_LAST(fil_system->LRU);
+ node != NULL;
+ node = UT_LIST_GET_PREV(LRU, node)) {
+
if (node->modification_counter == node->flush_counter
- && node->n_pending_flushes == 0) {
+ && node->n_pending_flushes == 0
+ && !node->being_extended) {
fil_node_close_file(node, fil_system);
return(TRUE);
}
- if (print_info && node->n_pending_flushes > 0) {
+ if (!print_info) {
+ continue;
+ }
+
+ if (node->n_pending_flushes > 0) {
fputs("InnoDB: cannot close file ", stderr);
ut_print_filename(stderr, node->name);
fprintf(stderr, ", because n_pending_flushes %lu\n",
(ulong) node->n_pending_flushes);
}
- if (print_info
- && node->modification_counter != node->flush_counter) {
+ if (node->modification_counter != node->flush_counter) {
fputs("InnoDB: cannot close file ", stderr);
ut_print_filename(stderr, node->name);
fprintf(stderr,
@@ -933,7 +931,11 @@ fil_try_to_close_file_in_LRU(
(long) node->flush_counter);
}
- node = UT_LIST_GET_PREV(LRU, node);
+ if (node->being_extended) {
+ fputs("InnoDB: cannot close file ", stderr);
+ ut_print_filename(stderr, node->name);
+ fprintf(stderr, ", because it is being extended\n");
+ }
}
return(FALSE);
@@ -1072,6 +1074,7 @@ fil_node_free(
ut_ad(mutex_own(&(system->mutex)));
ut_a(node->magic_n == FIL_NODE_MAGIC_N);
ut_a(node->n_pending == 0);
+ ut_a(!node->being_extended);
if (node->open) {
/* We fool the assertion in fil_node_close_file() to think
@@ -1829,7 +1832,7 @@ fil_read_flushed_lsn_and_arch_log_no(
/* Align the memory for a possible read from a raw device */
buf = ut_align(buf2, UNIV_PAGE_SIZE);
- os_file_read(data_file, buf, 0, 0, UNIV_PAGE_SIZE);
+ os_file_read(data_file, buf, 0, UNIV_PAGE_SIZE);
flushed_lsn = mach_read_from_8(buf + FIL_PAGE_FILE_FLUSH_LSN);
@@ -2278,7 +2281,8 @@ try_again:
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
node = UT_LIST_GET_FIRST(space->chain);
- if (space->n_pending_flushes > 0 || node->n_pending > 0) {
+ if (space->n_pending_flushes > 0 || node->n_pending > 0
+ || node->being_extended) {
if (count > 1000) {
ut_print_timestamp(stderr);
fputs(" InnoDB: Warning: trying to"
@@ -2287,6 +2291,7 @@ try_again:
fprintf(stderr, ",\n"
"InnoDB: but there are %lu flushes"
" and %lu pending i/o's on it\n"
+ "InnoDB: Or it is being extended\n"
"InnoDB: Loop %lu.\n",
(ulong) space->n_pending_flushes,
(ulong) node->n_pending,
@@ -2585,8 +2590,10 @@ retry:
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
node = UT_LIST_GET_FIRST(space->chain);
- if (node->n_pending > 0 || node->n_pending_flushes > 0) {
- /* There are pending i/o's or flushes, sleep for a while and
+ if (node->n_pending > 0 || node->n_pending_flushes > 0
+ || node->being_extended) {
+ /* There are pending i/o's or flushes or the file is
+ currently being extended, sleep for a while and
retry */
mutex_exit(&fil_system->mutex);
@@ -2748,7 +2755,7 @@ fil_create_new_single_table_tablespace(
return(DB_ERROR);
}
- ret = os_file_set_size(path, file, size * UNIV_PAGE_SIZE, 0);
+ ret = os_file_set_size(path, file, size * UNIV_PAGE_SIZE);
if (!ret) {
err = DB_OUT_OF_FILE_SPACE;
@@ -2783,7 +2790,7 @@ error_exit2:
if (!(flags & DICT_TF_ZSSIZE_MASK)) {
buf_flush_init_for_writing(page, NULL, 0);
- ret = os_file_write(path, file, page, 0, 0, UNIV_PAGE_SIZE);
+ ret = os_file_write(path, file, page, 0, UNIV_PAGE_SIZE);
} else {
page_zip_des_t page_zip;
ulint zip_size;
@@ -2800,7 +2807,7 @@ error_exit2:
page_zip.m_end = page_zip.m_nonempty =
page_zip.n_blobs = 0;
buf_flush_init_for_writing(page, &page_zip, 0);
- ret = os_file_write(path, file, page_zip.data, 0, 0, zip_size);
+ ret = os_file_write(path, file, page_zip.data, 0, zip_size);
}
ut_free(buf2);
@@ -2883,8 +2890,8 @@ fil_reset_too_high_lsns(
byte* buf2;
lsn_t flush_lsn;
ulint space_id;
- ib_int64_t file_size;
- ib_int64_t offset;
+ os_offset_t file_size;
+ os_offset_t offset;
ulint zip_size;
ibool success;
page_zip_des_t page_zip;
@@ -2916,7 +2923,7 @@ fil_reset_too_high_lsns(
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
- success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
+ success = os_file_read(file, page, 0, UNIV_PAGE_SIZE);
if (!success) {
goto func_exit;
@@ -2960,13 +2967,12 @@ fil_reset_too_high_lsns(
/* Loop through all the pages in the tablespace and reset the lsn and
the page checksum if necessary */
- file_size = os_file_get_size_as_iblonglong(file);
+ file_size = os_file_get_size(file);
+ ut_a(file_size != (os_offset_t) -1);
for (offset = 0; offset < file_size;
offset += zip_size ? zip_size : UNIV_PAGE_SIZE) {
- success = os_file_read(file, page,
- (ulint)(offset & 0xFFFFFFFFUL),
- (ulint)(offset >> 32),
+ success = os_file_read(file, page, offset,
zip_size ? zip_size : UNIV_PAGE_SIZE);
if (!success) {
@@ -2981,16 +2987,13 @@ fil_reset_too_high_lsns(
page, &page_zip, current_lsn);
success = os_file_write(
filepath, file, page_zip.data,
- (ulint) offset & 0xFFFFFFFFUL,
- (ulint) (offset >> 32), zip_size);
+ offset, zip_size);
} else {
buf_flush_init_for_writing(
page, NULL, current_lsn);
success = os_file_write(
filepath, file, page,
- (ulint)(offset & 0xFFFFFFFFUL),
- (ulint)(offset >> 32),
- UNIV_PAGE_SIZE);
+ offset, UNIV_PAGE_SIZE);
}
if (!success) {
@@ -3007,7 +3010,7 @@ fil_reset_too_high_lsns(
}
/* We now update the flush_lsn stamp at the start of the file */
- success = os_file_read(file, page, 0, 0,
+ success = os_file_read(file, page, 0,
zip_size ? zip_size : UNIV_PAGE_SIZE);
if (!success) {
@@ -3016,7 +3019,7 @@ fil_reset_too_high_lsns(
mach_write_to_8(page + FIL_PAGE_FILE_FLUSH_LSN, current_lsn);
- success = os_file_write(filepath, file, page, 0, 0,
+ success = os_file_write(filepath, file, page, 0,
zip_size ? zip_size : UNIV_PAGE_SIZE);
if (!success) {
@@ -3116,7 +3119,7 @@ fil_open_single_table_tablespace(
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
- success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
+ success = os_file_read(file, page, 0, UNIV_PAGE_SIZE);
/* We have to read the tablespace id and flags from the file. */
@@ -3207,9 +3210,7 @@ fil_load_single_table_tablespace(
byte* page;
ulint space_id;
ulint flags;
- ulint size_low;
- ulint size_high;
- ib_int64_t size;
+ os_offset_t size;
#ifdef UNIV_HOTBACKUP
fil_space_t* space;
#endif
@@ -3277,9 +3278,9 @@ fil_load_single_table_tablespace(
exit(1);
}
- success = os_file_get_size(file, &size_low, &size_high);
+ size = os_file_get_size(file);
- if (!success) {
+ if (UNIV_UNLIKELY(size == (os_offset_t) -1)) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
@@ -3330,16 +3331,14 @@ fil_load_single_table_tablespace(
/* Every .ibd file is created >= 4 pages in size. Smaller files
cannot be ok. */
- size = (((ib_int64_t)size_high) << 32) + (ib_int64_t)size_low;
#ifndef UNIV_HOTBACKUP
if (size < FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
fprintf(stderr,
"InnoDB: Error: the size of single-table tablespace"
" file %s\n"
- "InnoDB: is only %lu %lu, should be at least %lu!",
+ "InnoDB: is only %llu, should be at least %lu!",
filepath,
- (ulong) size_high,
- (ulong) size_low, (ulong) (4 * UNIV_PAGE_SIZE));
+ size, (ulong) (4 * UNIV_PAGE_SIZE));
os_file_close(file);
mem_free(filepath);
@@ -3353,7 +3352,7 @@ fil_load_single_table_tablespace(
page = ut_align(buf2, UNIV_PAGE_SIZE);
if (size >= FIL_IBD_FILE_INITIAL_SIZE * UNIV_PAGE_SIZE) {
- success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE);
+ success = os_file_read(file, page, 0, UNIV_PAGE_SIZE);
/* We have to read the tablespace id from the file */
@@ -3897,10 +3896,13 @@ fil_extend_space_to_desired_size(
ulint buf_size;
ulint start_page_no;
ulint file_start_page_no;
- ulint offset_high;
- ulint offset_low;
ulint page_size;
- ibool success = TRUE;
+ ulint pages_added;
+ ibool success;
+
+retry:
+ pages_added = 0;
+ success = TRUE;
fil_mutex_enter_and_prepare_for_io(space_id);
@@ -3924,8 +3926,28 @@ fil_extend_space_to_desired_size(
node = UT_LIST_GET_LAST(space->chain);
+ if (!node->being_extended) {
+ /* Mark this node as undergoing extension. This flag
+ is used by other threads to wait for the extension
+ opereation to finish. */
+ node->being_extended = TRUE;
+ } else {
+ /* Another thread is currently extending the file. Wait
+ for it to finish.
+ It'd have been better to use event driven mechanism but
+ the entire module is peppered with polling stuff. */
+ mutex_exit(&fil_system->mutex);
+ os_thread_sleep(100000);
+ goto retry;
+ }
+
fil_node_prepare_for_io(node, fil_system, space);
+ /* At this point it is safe to release fil_system mutex. No
+ other thread can rename, delete or close the file because
+ we have set the node->being_extended flag. */
+ mutex_exit(&fil_system->mutex);
+
start_page_no = space->size;
file_start_page_no = space->size - node->size;
@@ -3937,50 +3959,53 @@ fil_extend_space_to_desired_size(
memset(buf, 0, buf_size);
while (start_page_no < size_after_extend) {
- ulint n_pages = ut_min(buf_size / page_size,
- size_after_extend - start_page_no);
+ ulint n_pages
+ = ut_min(buf_size / page_size,
+ size_after_extend - start_page_no);
- offset_high = (start_page_no - file_start_page_no)
- / (4096 * ((1024 * 1024) / page_size));
- offset_low = ((start_page_no - file_start_page_no)
- % (4096 * ((1024 * 1024) / page_size)))
+ os_offset_t offset
+ = ((os_offset_t) (start_page_no - file_start_page_no))
* page_size;
#ifdef UNIV_HOTBACKUP
success = os_file_write(node->name, node->handle, buf,
- offset_low, offset_high,
- page_size * n_pages);
+ offset, page_size * n_pages);
#else
success = os_aio(OS_FILE_WRITE, OS_AIO_SYNC,
node->name, node->handle, buf,
- offset_low, offset_high,
- page_size * n_pages,
+ offset, page_size * n_pages,
NULL, NULL);
#endif
if (success) {
- node->size += n_pages;
- space->size += n_pages;
-
os_has_said_disk_full = FALSE;
} else {
/* Let us measure the size of the file to determine
how much we were able to extend it */
+ os_offset_t size;
- n_pages = ((ulint)
- (os_file_get_size_as_iblonglong(
- node->handle)
- / page_size)) - node->size;
+ size = os_file_get_size(node->handle);
+ ut_a(size != (os_offset_t) -1);
- node->size += n_pages;
- space->size += n_pages;
+ n_pages = ((ulint) (size / page_size))
+ - node->size - pages_added;
+ pages_added += n_pages;
break;
}
start_page_no += n_pages;
+ pages_added += n_pages;
}
mem_free(buf2);
+ mutex_enter(&fil_system->mutex);
+
+ ut_a(node->being_extended);
+
+ space->size += pages_added;
+ node->size += pages_added;
+ node->being_extended = FALSE;
+
fil_node_complete_io(node, fil_system, OS_FILE_WRITE);
*actual_size = space->size;
@@ -4190,7 +4215,6 @@ fil_node_prepare_for_io(
if (node->open == FALSE) {
/* File is closed: open it */
ut_a(node->n_pending == 0);
-
fil_node_open_file(node, system, space);
}
@@ -4312,11 +4336,10 @@ fil_io(
ulint mode;
fil_space_t* space;
fil_node_t* node;
- ulint offset_high;
- ulint offset_low;
ibool ret;
ulint is_log;
ulint wake_later;
+ os_offset_t offset;
is_log = type & OS_FILE_LOG;
type = type & ~OS_FILE_LOG;
@@ -4434,9 +4457,8 @@ fil_io(
/* Calculate the low 32 bits and the high 32 bits of the file offset */
if (!zip_size) {
- offset_high = (block_offset >> (32 - UNIV_PAGE_SIZE_SHIFT));
- offset_low = ((block_offset << UNIV_PAGE_SIZE_SHIFT)
- & 0xFFFFFFFFUL) + byte_offset;
+ offset = ((os_offset_t) block_offset << UNIV_PAGE_SIZE_SHIFT)
+ + byte_offset;
ut_a(node->size - block_offset
>= ((byte_offset + len + (UNIV_PAGE_SIZE - 1))
@@ -4451,8 +4473,7 @@ fil_io(
case 16384: zip_size_shift = 14; break;
default: ut_error;
}
- offset_high = block_offset >> (32 - zip_size_shift);
- offset_low = (block_offset << zip_size_shift & 0xFFFFFFFFUL)
+ offset = ((os_offset_t) block_offset << zip_size_shift)
+ byte_offset;
ut_a(node->size - block_offset
>= (len + (zip_size - 1)) / zip_size);
@@ -4466,16 +4487,15 @@ fil_io(
#ifdef UNIV_HOTBACKUP
/* In ibbackup do normal i/o, not aio */
if (type == OS_FILE_READ) {
- ret = os_file_read(node->handle, buf, offset_low, offset_high,
- len);
+ ret = os_file_read(node->handle, buf, offset, len);
} else {
ret = os_file_write(node->name, node->handle, buf,
- offset_low, offset_high, len);
+ offset, len);
}
#else
/* Queue the aio request */
ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
- offset_low, offset_high, len, node, message);
+ offset, len, node, message);
#endif
ut_a(ret);
@@ -4784,6 +4804,7 @@ fil_validate(void)
while (fil_node != NULL) {
ut_a(fil_node->n_pending == 0);
+ ut_a(!fil_node->being_extended);
ut_a(fil_node->open);
ut_a(fil_node->space->purpose == FIL_TABLESPACE);
ut_a(fil_node->space->id != 0);
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc 2011-05-10 13:37:37 +0000
+++ b/storage/innobase/handler/ha_innodb.cc 2011-05-22 20:17:42 +0000
@@ -12099,9 +12099,9 @@ static MYSQL_SYSVAR_ULONG(purge_threads,
static MYSQL_SYSVAR_ULONG(sync_array_size, srv_sync_array_size,
PLUGIN_VAR_OPCMDARG,
- "Size of the mutex/lock wait array. Default is 32.",
+ "Size of the mutex/lock wait array.",
NULL, NULL,
- 32, /* Default setting */
+ 1, /* Default setting */
1, /* Minimum value */
1024, 0); /* Maximum value */
=== modified file 'storage/innobase/handler/i_s.cc'
--- a/storage/innobase/handler/i_s.cc 2011-05-16 14:30:54 +0000
+++ b/storage/innobase/handler/i_s.cc 2011-05-25 13:43:30 +0000
@@ -3347,7 +3347,7 @@ i_s_innodb_buffer_page_get_info(
page_info->space_id = buf_page_get_space(bpage);
- page_info->page_num = buf_page_get_page_no(bpage);;
+ page_info->page_num = buf_page_get_page_no(bpage);
page_info->flush_type = bpage->flush_type;
@@ -4272,7 +4272,7 @@ i_s_sys_tables_fill_table(
i_s_dict_fill_sys_tables(thd, table_rec, tables->table);
} else {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_CANT_FIND_SYSTEM_REC,
+ ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
@@ -4554,7 +4554,7 @@ i_s_sys_tables_fill_table_stats(
tables->table);
} else {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_CANT_FIND_SYSTEM_REC,
+ ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
@@ -4793,7 +4793,7 @@ i_s_sys_indexes_fill_table(
/* Process each record in the table */
while (rec) {
- const char* err_msg;;
+ const char* err_msg;
table_id_t table_id;
dict_index_t index_rec;
@@ -4810,7 +4810,7 @@ i_s_sys_indexes_fill_table(
tables->table);
} else {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_CANT_FIND_SYSTEM_REC,
+ ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
@@ -5045,7 +5045,7 @@ i_s_sys_columns_fill_table(
tables->table);
} else {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_CANT_FIND_SYSTEM_REC,
+ ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
@@ -5252,7 +5252,7 @@ i_s_sys_fields_fill_table(
last_id = index_id;
} else {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_CANT_FIND_SYSTEM_REC,
+ ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
@@ -5473,7 +5473,7 @@ i_s_sys_foreign_fill_table(
tables->table);
} else {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_CANT_FIND_SYSTEM_REC,
+ ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
@@ -5687,7 +5687,7 @@ i_s_sys_foreign_cols_fill_table(
tables->table);
} else {
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
- ER_CANT_FIND_SYSTEM_REC,
+ ER_CANT_FIND_SYSTEM_REC, "%s",
err_msg);
}
=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h 2011-04-13 08:22:11 +0000
+++ b/storage/innobase/include/buf0buf.h 2011-05-24 08:42:51 +0000
@@ -700,12 +700,12 @@ buf_get_latched_pages_number(void);
/*==============================*/
#endif /* UNIV_DEBUG */
/*********************************************************************//**
-Returns the number of pending buf pool ios.
-@return number of pending I/O operations */
+Returns the number of pending buf pool read ios.
+@return number of pending read I/O operations */
UNIV_INTERN
ulint
-buf_get_n_pending_ios(void);
-/*=======================*/
+buf_get_n_pending_read_ios(void);
+/*============================*/
/*********************************************************************//**
Prints info of the buffer i/o. */
UNIV_INTERN
=== modified file 'storage/innobase/include/lock0priv.h'
--- a/storage/innobase/include/lock0priv.h 2011-01-18 21:14:22 +0000
+++ b/storage/innobase/include/lock0priv.h 2011-05-24 12:05:57 +0000
@@ -118,9 +118,10 @@ UNIV_INLINE
trx_id_t
lock_clust_rec_some_has_impl(
/*=========================*/
- const rec_t* rec, /*!< in: user record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets); /*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec, /*!< in: user record */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ __attribute__((nonnull, warn_unused_result));
#ifndef UNIV_NONINL
#include "lock0priv.ic"
=== modified file 'storage/innobase/include/lock0priv.ic'
--- a/storage/innobase/include/lock0priv.ic 2010-09-09 17:40:13 +0000
+++ b/storage/innobase/include/lock0priv.ic 2011-05-24 12:05:57 +0000
@@ -54,9 +54,9 @@ UNIV_INLINE
trx_id_t
lock_clust_rec_some_has_impl(
/*=========================*/
- const rec_t* rec, /*!< in: user record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec, /*!< in: user record */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ut_ad(dict_index_is_clust(index));
ut_ad(page_rec_is_user_rec(rec));
=== modified file 'storage/innobase/include/os0file.h'
--- a/storage/innobase/include/os0file.h 2011-04-13 08:34:16 +0000
+++ b/storage/innobase/include/os0file.h 2011-05-17 11:42:10 +0000
@@ -74,6 +74,8 @@ extern ulint os_n_pending_writes;
#endif
+/** File offset in bytes */
+typedef ib_uint64_t os_offset_t;
#ifdef __WIN__
/** File handle */
# define os_file_t HANDLE
@@ -276,24 +278,20 @@ The wrapper functions have the prefix of
# define os_file_close(file) \
pfs_os_file_close_func(file, __FILE__, __LINE__)
-# define os_aio(type, mode, name, file, buf, offset, offset_high, \
+# define os_aio(type, mode, name, file, buf, offset, \
n, message1, message2) \
pfs_os_aio_func(type, mode, name, file, buf, offset, \
- offset_high, n, message1, message2, \
- __FILE__, __LINE__)
+ n, message1, message2, __FILE__, __LINE__)
-# define os_file_read(file, buf, offset, offset_high, n) \
- pfs_os_file_read_func(file, buf, offset, offset_high, n, \
- __FILE__, __LINE__)
-
-# define os_file_read_no_error_handling(file, buf, offset, \
- offset_high, n) \
- pfs_os_file_read_no_error_handling_func(file, buf, offset, \
- offset_high, n, \
+# define os_file_read(file, buf, offset, n) \
+ pfs_os_file_read_func(file, buf, offset, n, __FILE__, __LINE__)
+
+# define os_file_read_no_error_handling(file, buf, offset, n) \
+ pfs_os_file_read_no_error_handling_func(file, buf, offset, n, \
__FILE__, __LINE__)
-# define os_file_write(name, file, buf, offset, offset_high, n) \
- pfs_os_file_write_func(name, file, buf, offset, offset_high, \
+# define os_file_write(name, file, buf, offset, n) \
+ pfs_os_file_write_func(name, file, buf, offset, \
n, __FILE__, __LINE__)
# define os_file_flush(file) \
@@ -318,20 +316,18 @@ to original un-instrumented file I/O API
# define os_file_close(file) os_file_close_func(file)
-# define os_aio(type, mode, name, file, buf, offset, offset_high, \
- n, message1, message2) \
- os_aio_func(type, mode, name, file, buf, offset, offset_high, n,\
+# define os_aio(type, mode, name, file, buf, offset, n, message1, message2) \
+ os_aio_func(type, mode, name, file, buf, offset, n, \
message1, message2)
-# define os_file_read(file, buf, offset, offset_high, n) \
- os_file_read_func(file, buf, offset, offset_high, n)
+# define os_file_read(file, buf, offset, n) \
+ os_file_read_func(file, buf, offset, n)
-# define os_file_read_no_error_handling(file, buf, offset, \
- offset_high, n) \
- os_file_read_no_error_handling_func(file, buf, offset, offset_high, n)
+# define os_file_read_no_error_handling(file, buf, offset, n) \
+ os_file_read_no_error_handling_func(file, buf, offset, n)
-# define os_file_write(name, file, buf, offset, offset_high, n) \
- os_file_write_func(name, file, buf, offset, offset_high, n)
+# define os_file_write(name, file, buf, offset, n) \
+ os_file_write_func(name, file, buf, offset, n)
# define os_file_flush(file) os_file_flush_func(file)
@@ -687,10 +683,7 @@ pfs_os_file_read_func(
/*==================*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read */
ulint n, /*!< in: number of bytes to read */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
@@ -708,10 +701,7 @@ pfs_os_file_read_no_error_handling_func(
/*====================================*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read */
ulint n, /*!< in: number of bytes to read */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
@@ -733,10 +723,7 @@ pfs_os_aio_func(
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read or from which
to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read or write */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read or write */
ulint n, /*!< in: number of bytes to read or write */
fil_node_t* message1,/*!< in: message for the aio handler
(can be used to identify a completed
@@ -762,10 +749,7 @@ pfs_os_file_write_func(
null-terminated string */
os_file_t file, /*!< in: handle to a file */
const void* buf, /*!< in: buffer from which to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to write */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to write */
ulint n, /*!< in: number of bytes to write */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
@@ -814,23 +798,13 @@ os_file_close_no_error_handling(
#endif /* UNIV_HOTBACKUP */
/***********************************************************************//**
Gets a file size.
-@return TRUE if success */
+@return file size, or (os_offset_t) -1 on failure */
UNIV_INTERN
-ibool
+os_offset_t
os_file_get_size(
/*=============*/
- os_file_t file, /*!< in: handle to a file */
- ulint* size, /*!< out: least significant 32 bits of file
- size */
- ulint* size_high);/*!< out: most significant 32 bits of size */
-/***********************************************************************//**
-Gets file size as a 64-bit integer ib_int64_t.
-@return size in bytes, -1 if error */
-UNIV_INTERN
-ib_int64_t
-os_file_get_size_as_iblonglong(
-/*===========================*/
- os_file_t file); /*!< in: handle to a file */
+ os_file_t file) /*!< in: handle to a file */
+ __attribute__((warn_unused_result));
/***********************************************************************//**
Write the specified number of zeros to a newly created file.
@return TRUE if success */
@@ -841,9 +815,8 @@ os_file_set_size(
const char* name, /*!< in: name of the file or path as a
null-terminated string */
os_file_t file, /*!< in: handle to a file */
- ulint size, /*!< in: least significant 32 bits of file
- size */
- ulint size_high);/*!< in: most significant 32 bits of size */
+ os_offset_t size) /*!< in: file size */
+ __attribute__((nonnull, warn_unused_result));
/***********************************************************************//**
Truncates a file at its current position.
@return TRUE if success */
@@ -883,10 +856,7 @@ os_file_read_func(
/*==============*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read */
ulint n); /*!< in: number of bytes to read */
/*******************************************************************//**
Rewind file to its start, read at most size - 1 bytes from it to str, and
@@ -911,10 +881,7 @@ os_file_read_no_error_handling_func(
/*================================*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read */
ulint n); /*!< in: number of bytes to read */
/*******************************************************************//**
@@ -930,10 +897,7 @@ os_file_write_func(
null-terminated string */
os_file_t file, /*!< in: handle to a file */
const void* buf, /*!< in: buffer from which to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to write */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to write */
ulint n); /*!< in: number of bytes to write */
/*******************************************************************//**
Check the existence and type of the given file.
@@ -1037,10 +1001,7 @@ os_aio_func(
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read or from which
to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read or write */
- ulint offset_high, /*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read or write */
ulint n, /*!< in: number of bytes to read or write */
fil_node_t* message1,/*!< in: message for the aio handler
(can be used to identify a completed
=== modified file 'storage/innobase/include/os0file.ic'
--- a/storage/innobase/include/os0file.ic 2010-07-14 16:23:21 +0000
+++ b/storage/innobase/include/os0file.ic 2011-05-17 11:42:10 +0000
@@ -216,10 +216,7 @@ pfs_os_aio_func(
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read or from which
to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read or write */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read or write */
ulint n, /*!< in: number of bytes to read or write */
fil_node_t* message1,/*!< in: message for the aio handler
(can be used to identify a completed
@@ -243,7 +240,7 @@ pfs_os_aio_func(
: PSI_FILE_READ,
src_file, src_line);
- result = os_aio_func(type, mode, name, file, buf, offset, offset_high,
+ result = os_aio_func(type, mode, name, file, buf, offset,
n, message1, message2);
register_pfs_file_io_end(locker, n);
@@ -263,10 +260,7 @@ pfs_os_file_read_func(
/*==================*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read */
ulint n, /*!< in: number of bytes to read */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
@@ -278,7 +272,7 @@ pfs_os_file_read_func(
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
src_file, src_line);
- result = os_file_read_func(file, buf, offset, offset_high, n);
+ result = os_file_read_func(file, buf, offset, n);
register_pfs_file_io_end(locker, n);
@@ -299,10 +293,7 @@ pfs_os_file_read_no_error_handling_func(
/*====================================*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read */
ulint n, /*!< in: number of bytes to read */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
@@ -314,8 +305,7 @@ pfs_os_file_read_no_error_handling_func(
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
src_file, src_line);
- result = os_file_read_no_error_handling_func(file, buf, offset,
- offset_high, n);
+ result = os_file_read_no_error_handling_func(file, buf, offset, n);
register_pfs_file_io_end(locker, n);
@@ -336,10 +326,7 @@ pfs_os_file_write_func(
null-terminated string */
os_file_t file, /*!< in: handle to a file */
const void* buf, /*!< in: buffer from which to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to write */
- ulint offset_high,/*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to write */
ulint n, /*!< in: number of bytes to write */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
@@ -351,7 +338,7 @@ pfs_os_file_write_func(
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE,
src_file, src_line);
- result = os_file_write_func(name, file, buf, offset, offset_high, n);
+ result = os_file_write_func(name, file, buf, offset, n);
register_pfs_file_io_end(locker, n);
=== modified file 'storage/innobase/include/page0page.h'
--- a/storage/innobase/include/page0page.h 2011-03-22 12:34:16 +0000
+++ b/storage/innobase/include/page0page.h 2011-05-09 08:48:47 +0000
@@ -619,17 +619,16 @@ page_rec_find_owner_rec(
/*====================*/
rec_t* rec); /*!< in: the physical record */
/***********************************************************************//**
-This is a low-level operation which is used in a database index creation
-to update the page number of a created B-tree to a data dictionary
-record. */
-UNIV_INTERN
+Write a 32-bit field in a data dictionary record. */
+UNIV_INLINE
void
-page_rec_write_index_page_no(
-/*=========================*/
- rec_t* rec, /*!< in: record to update */
+page_rec_write_field(
+/*=================*/
+ rec_t* rec, /*!< in/out: record to update */
ulint i, /*!< in: index of the field to update */
ulint page_no,/*!< in: value to write */
- mtr_t* mtr); /*!< in: mtr */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+ __attribute__((nonnull));
/************************************************************//**
Returns the maximum combined size of records which can be inserted on top
of record heap.
=== modified file 'storage/innobase/include/page0page.ic'
--- a/storage/innobase/include/page0page.ic 2010-07-29 10:44:35 +0000
+++ b/storage/innobase/include/page0page.ic 2011-05-09 08:48:47 +0000
@@ -959,6 +959,27 @@ page_get_free_space_of_empty(
- 2 * PAGE_DIR_SLOT_SIZE));
}
+/***********************************************************************//**
+Write a 32-bit field in a data dictionary record. */
+UNIV_INLINE
+void
+page_rec_write_field(
+/*=================*/
+ rec_t* rec, /*!< in/out: record to update */
+ ulint i, /*!< in: index of the field to update */
+ ulint val, /*!< in: value to write */
+ mtr_t* mtr) /*!< in/out: mini-transaction */
+{
+ byte* data;
+ ulint len;
+
+ data = rec_get_nth_field_old(rec, i, &len);
+
+ ut_ad(len == 4);
+
+ mlog_write_ulint(data, val, MLOG_4BYTES, mtr);
+}
+
/************************************************************//**
Each user record on a page, and also the deleted user records in the heap
takes its size plus the fraction of the dir cell size /
=== modified file 'storage/innobase/include/row0row.h'
--- a/storage/innobase/include/row0row.h 2010-10-21 03:54:20 +0000
+++ b/storage/innobase/include/row0row.h 2011-05-24 12:05:57 +0000
@@ -41,13 +41,24 @@ Created 4/20/1996 Heikki Tuuri
Gets the offset of the trx id field, in bytes relative to the origin of
a clustered index record.
@return offset of DATA_TRX_ID */
-UNIV_INTERN
+UNIV_INLINE
ulint
-row_get_trx_id_offset(
-/*==================*/
- const rec_t* rec, /*!< in: record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets);/*!< in: rec_get_offsets(rec, index) */
+row_get_trx_id_offset_func(
+/*=======================*/
+#ifdef UNIV_DEBUG
+ const rec_t* rec, /*!< in: record */
+#endif /* UNIV_DEBUG */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ __attribute__((nonnull, warn_unused_result));
+#ifdef UNIV_DEBUG
+# define row_get_trx_id_offset(rec, index, offsets) \
+ row_get_trx_id_offset_func(rec, index, offsets)
+#else /* UNIV_DEBUG */
+# define row_get_trx_id_offset(rec, index, offsets) \
+ row_get_trx_id_offset_func(index, offsets)
+#endif /* UNIV_DEBUG */
+
/*********************************************************************//**
Reads the trx id field from a clustered index record.
@return value of the field */
@@ -55,9 +66,10 @@ UNIV_INLINE
trx_id_t
row_get_rec_trx_id(
/*===============*/
- const rec_t* rec, /*!< in: record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets);/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec, /*!< in: record */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ __attribute__((nonnull, warn_unused_result));
/*********************************************************************//**
Reads the roll pointer field from a clustered index record.
@return value of the field */
=== modified file 'storage/innobase/include/row0row.ic'
--- a/storage/innobase/include/row0row.ic 2010-07-16 21:00:50 +0000
+++ b/storage/innobase/include/row0row.ic 2011-05-24 12:05:57 +0000
@@ -28,15 +28,45 @@ Created 4/20/1996 Heikki Tuuri
#include "trx0undo.h"
/*********************************************************************//**
+Gets the offset of trx id field, in bytes relative to the origin of
+a clustered index record.
+@return offset of DATA_TRX_ID */
+UNIV_INLINE
+ulint
+row_get_trx_id_offset_func(
+/*=======================*/
+#ifdef UNIV_DEBUG
+ const rec_t* rec, /*!< in: record */
+#endif /* UNIV_DEBUG */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+{
+ ulint pos;
+ ulint offset;
+ ulint len;
+
+ ut_ad(dict_index_is_clust(index));
+ ut_ad(rec_offs_validate(rec, index, offsets));
+
+ pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
+
+ offset = rec_get_nth_field_offs(offsets, pos, &len);
+
+ ut_ad(len == DATA_TRX_ID_LEN);
+
+ return(offset);
+}
+
+/*********************************************************************//**
Reads the trx id field from a clustered index record.
@return value of the field */
UNIV_INLINE
trx_id_t
row_get_rec_trx_id(
/*===============*/
- const rec_t* rec, /*!< in: record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec, /*!< in: record */
+ const dict_index_t* index, /*!< in: clustered index */
+ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
{
ulint offset;
=== modified file 'storage/innobase/include/trx0purge.h'
--- a/storage/innobase/include/trx0purge.h 2011-04-28 07:33:49 +0000
+++ b/storage/innobase/include/trx0purge.h 2011-05-18 12:16:34 +0000
@@ -52,17 +52,6 @@ trx_purge_get_log_from_hist(
/*========================*/
fil_addr_t node_addr); /*!< in: file address of the history
list node of the log */
-/*****************************************************************//**
-Checks if trx_id is >= purge_view: then it is guaranteed that its update
-undo log still exists in the system.
-@return TRUE if is sure that it is preserved, also if the function
-returns FALSE, it is possible that the undo log still exists in the
-system */
-UNIV_INTERN
-ibool
-trx_purge_update_undo_must_exist(
-/*=============================*/
- trx_id_t trx_id);/*!< in: transaction id */
/********************************************************************//**
Creates the global purge system control structure and inits the history
mutex. */
@@ -115,9 +104,9 @@ struct trx_purge_struct{
sess_t* sess; /*!< System session running the purge
query */
trx_t* trx; /*!< System transaction running the
- purge query: this trx is not in the
- trx list of the trx system and it
- never ends */
+ purge query: this trx is not in the
+ trx list of the trx system and it
+ never ends */
que_t* query; /*!< The query graph which will do the
parallelized purge operation */
rw_lock_t latch; /*!< The latch protecting the purge
@@ -129,7 +118,7 @@ struct trx_purge_struct{
read_view_t* view; /*!< The purge will not remove undo logs
which are >= this view (purge view) */
ulint n_submitted; /*!< Count of total tasks submitted
- to the task queue */
+ to the task queue */
ulint n_executing; /*!< Count of currently executing purge
worker threads */
ulint n_completed; /*!< Count of total tasks completed */
@@ -146,7 +135,7 @@ struct trx_purge_struct{
invariant in trx0purge.c */
purge_iter_t limit; /* The 'purge pointer' which advances
during a purge, and which is used in
- history list truncation */
+ history list truncation */
/*-----------------------------*/
ibool next_stored; /*!< TRUE if the info of the next record
to purge is stored below: if yes, then
=== modified file 'storage/innobase/include/trx0rec.h'
--- a/storage/innobase/include/trx0rec.h 2011-04-28 07:33:49 +0000
+++ b/storage/innobase/include/trx0rec.h 2011-05-04 11:29:29 +0000
@@ -240,10 +240,10 @@ trx_undo_get_undo_rec_low(
roll_ptr_t roll_ptr, /*!< in: roll pointer to record */
mem_heap_t* heap); /*!< in: memory heap where copied */
/*******************************************************************//**
-Build a previous version of a clustered index record. This function checks
-that the caller has a latch on the index page of the clustered index record
-and an s-latch on the purge_view. This guarantees that the stack of versions
-is locked.
+Build a previous version of a clustered index record. The caller must
+hold a latch on the index page of the clustered index record, to
+guarantee that the stack of versions is locked all the way down to the
+purge_sys->view.
@return DB_SUCCESS, or DB_MISSING_HISTORY if the previous version is
earlier than purge_view, which means that it may have been removed */
UNIV_INTERN
=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h 2011-04-14 07:10:14 +0000
+++ b/storage/innobase/include/trx0trx.h 2011-05-11 00:39:50 +0000
@@ -455,10 +455,10 @@ struct trx_lock_struct {
wait_lock==NULL */
ib_uint64_t deadlock_mark; /*!< A mark field that is initialized
to and checked against lock_mark_counter
- by lock_deadlock_recursive(). */
+ by lock_deadlock_recursive(). */
ibool was_chosen_as_deadlock_victim;
/*!< when the transaction decides to
- wait for a lock, it sets this to FALSE;
+ wait for a lock, it sets this to FALSE;
if another transaction chooses this
transaction as a victim in deadlock
resolution, it sets this to TRUE.
@@ -468,7 +468,7 @@ struct trx_lock_struct {
que_thr_t* wait_thr; /*!< query thread belonging to this
trx that is in QUE_THR_LOCK_WAIT
- state. For threads suspended in a
+ state. For threads suspended in a
lock wait, this is protected by
lock_sys->mutex. Otherwise, this may
only be modified by the thread that is
@@ -537,7 +537,7 @@ struct trx_struct{
ulint magic_n;
mutex_t mutex; /*!< Mutex protecting the fields
- state and lock
+ state and lock
(except some fields of lock, which
are protected by lock_sys->mutex) */
@@ -584,13 +584,13 @@ struct trx_struct{
set this FALSE */
/*------------------------------*/
/* MySQL has a transaction coordinator to coordinate two phase
- commit between multiple storage engines and the binary log. When
- an engine participates in a transaction, it's responsible for
- registering itself using the trans_register_ha() API. */
+ commit between multiple storage engines and the binary log. When
+ an engine participates in a transaction, it's responsible for
+ registering itself using the trans_register_ha() API. */
unsigned is_registered:1;/* This flag is set to 1 after the
- transaction has been registered with
- the coordinator using the XA API, and
- is set to 0 after commit or rollback. */
+ transaction has been registered with
+ the coordinator using the XA API, and
+ is set to 0 after commit or rollback. */
unsigned owns_prepare_mutex:1;/* 1 if owns prepare mutex, if
this is set to 1 then registered should
also be set to 1. This is used in the
@@ -616,10 +616,10 @@ struct trx_struct{
mutex. */
ulint must_flush_log_later;/*!< this flag is set to TRUE in
trx_commit() if flush_log_later was
- TRUE, and there were modifications by
- the transaction; in that case we must
- flush the log in
- trx_commit_complete_for_mysql() */
+ TRUE, and there were modifications by
+ the transaction; in that case we must
+ flush the log in
+ trx_commit_complete_for_mysql() */
ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
ulint has_search_latch;
/*!< TRUE if this trx has latched the
=== modified file 'storage/innobase/include/trx0types.h'
--- a/storage/innobase/include/trx0types.h 2011-01-18 10:55:35 +0000
+++ b/storage/innobase/include/trx0types.h 2011-05-11 04:51:01 +0000
@@ -39,8 +39,8 @@ the terminating NUL character. */
enum trx_que_enum {
TRX_QUE_RUNNING, /*!< transaction is running */
TRX_QUE_LOCK_WAIT, /*!< transaction is waiting for
- a lock */
- TRX_QUE_ROLLING_BACK, /*!< transaction is rolling back */
+ a lock */
+ TRX_QUE_ROLLING_BACK, /*!< transaction is rolling back */
TRX_QUE_COMMITTING /*!< transaction is committing */
};
=== modified file 'storage/innobase/include/ut0ut.h'
--- a/storage/innobase/include/ut0ut.h 2011-04-06 06:35:25 +0000
+++ b/storage/innobase/include/ut0ut.h 2011-05-17 11:42:10 +0000
@@ -98,16 +98,6 @@ do { \
#define UT_MIN(a, b) ((a) < (b) ? (a) : (b))
#define UT_MAX(a, b) ((a) > (b) ? (a) : (b))
-/********************************************************//**
-Gets the high 32 bits in a ulint. That is makes a shift >> 32,
-but since there seem to be compiler bugs in both gcc and Visual C++,
-we do this by a special conversion.
-@return a >> 32 */
-UNIV_INTERN
-ulint
-ut_get_high32(
-/*==========*/
- ulint a); /*!< in: ulint */
/******************************************************//**
Calculates the minimum of two ulints.
@return minimum */
=== modified file 'storage/innobase/lock/lock0lock.c'
--- a/storage/innobase/lock/lock0lock.c 2011-04-21 22:15:39 +0000
+++ b/storage/innobase/lock/lock0lock.c 2011-05-24 20:22:08 +0000
@@ -368,13 +368,8 @@ static
ibool
lock_rec_validate_page(
/*===================*/
- ibool locked_lock_trx_sys, /*!< in: if the caller holds
- both the lock mutex and
- trx_sys_t->lock. */
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size
- in bytes or 0 for uncompressed pages */
- ulint page_no); /*!< in: page number */
+ const buf_block_t* block) /*!< in: buffer block */
+ __attribute__((nonnull, warn_unused_result));
#endif /* UNIV_DEBUG */
/* The lock system */
@@ -1135,10 +1130,10 @@ lock_rec_reset_nth_bit(
Gets the first or next record lock on a page.
@return next lock, NULL if none exists */
UNIV_INLINE
-lock_t*
-lock_rec_get_next_on_page(
-/*======================*/
- lock_t* lock) /*!< in: a record lock */
+const lock_t*
+lock_rec_get_next_on_page_const(
+/*============================*/
+ const lock_t* lock) /*!< in: a record lock */
{
ulint space;
ulint page_no;
@@ -1171,12 +1166,12 @@ lock_rec_get_next_on_page(
Gets the first or next record lock on a page.
@return next lock, NULL if none exists */
UNIV_INLINE
-const lock_t*
-lock_rec_get_next_on_page_const(
-/*============================*/
- const lock_t* lock) /*!< in: a record lock */
+lock_t*
+lock_rec_get_next_on_page(
+/*======================*/
+ lock_t* lock) /*!< in: a record lock */
{
- return(lock_rec_get_next_on_page((lock_t*) lock));
+ return((lock_t*) lock_rec_get_next_on_page_const(lock));
}
/*********************************************************************//**
@@ -2780,10 +2775,7 @@ lock_move_reorganize_page(
mem_heap_free(heap);
#ifdef UNIV_DEBUG_LOCK_VALIDATE
- ut_ad(lock_rec_validate_page(FALSE,
- buf_block_get_space(block),
- buf_block_get_zip_size(block),
- buf_block_get_page_no(block)));
+ ut_ad(lock_rec_validate_page(block));
#endif
}
@@ -2871,14 +2863,8 @@ lock_move_rec_list_end(
lock_mutex_exit();
#ifdef UNIV_DEBUG_LOCK_VALIDATE
- ut_ad(lock_rec_validate_page(FALSE,
- buf_block_get_space(block),
- buf_block_get_zip_size(block),
- buf_block_get_page_no(block)));
- ut_ad(lock_rec_validate_page(FALSE,
- buf_block_get_space(new_block),
- buf_block_get_zip_size(block),
- buf_block_get_page_no(new_block)));
+ ut_ad(lock_rec_validate_page(block));
+ ut_ad(lock_rec_validate_page(new_block));
#endif
}
@@ -2987,10 +2973,7 @@ lock_move_rec_list_start(
lock_mutex_exit();
#ifdef UNIV_DEBUG_LOCK_VALIDATE
- ut_ad(lock_rec_validate_page(FALSE,
- buf_block_get_space(block),
- buf_block_get_zip_size(block),
- buf_block_get_page_no(block)));
+ ut_ad(lock_rec_validate_page(block));
#endif
}
@@ -4075,17 +4058,18 @@ Checks if other transactions have an inc
the lock queue.
@return lock or NULL */
UNIV_INLINE
-lock_t*
+const lock_t*
lock_table_other_has_incompatible(
/*==============================*/
- trx_t* trx, /*!< in: transaction, or NULL if all
- transactions should be included */
- ulint wait, /*!< in: LOCK_WAIT if also waiting locks are
- taken into account, or 0 if not */
- dict_table_t* table, /*!< in: table */
- enum lock_mode mode) /*!< in: lock mode */
+ const trx_t* trx, /*!< in: transaction, or NULL if all
+ transactions should be included */
+ ulint wait, /*!< in: LOCK_WAIT if also
+ waiting locks are taken into
+ account, or 0 if not */
+ const dict_table_t* table, /*!< in: table */
+ enum lock_mode mode) /*!< in: lock mode */
{
- lock_t* lock;
+ const lock_t* lock;
ut_ad(lock_mutex_own());
@@ -4121,7 +4105,7 @@ lock_table(
{
trx_t* trx;
ulint err;
- lock_t* lock;
+ const lock_t* lock;
ut_ad(table && thr);
@@ -5080,9 +5064,9 @@ static
ibool
lock_table_queue_validate(
/*======================*/
- dict_table_t* table) /*!< in: table */
+ const dict_table_t* table) /*!< in: table */
{
- lock_t* lock;
+ const lock_t* lock;
ut_ad(lock_mutex_own());
#ifdef UNIV_SYNC_DEBUG
@@ -5128,7 +5112,7 @@ lock_rec_queue_validate(
trx_sys_t->lock. */
const buf_block_t* block, /*!< in: buffer block containing rec */
const rec_t* rec, /*!< in: record to look at */
- dict_index_t* index, /*!< in: index, or NULL if not known */
+ const dict_index_t* index, /*!< in: index, or NULL if not known */
const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
{
const trx_t* impl_trx;
@@ -5239,60 +5223,38 @@ static
ibool
lock_rec_validate_page(
/*===================*/
- ibool locked_lock_trx_sys, /*!< in: if the caller holds
- both the lock mutex and
- trx_sys_t->lock. */
- ulint space, /*!< in: space id */
- ulint zip_size, /*!< in: compressed page size
- in bytes or 0 for uncompressed pages */
- ulint page_no) /*!< in: page number */
+ const buf_block_t* block) /*!< in: buffer block */
{
- dict_index_t* index;
- buf_block_t* block;
- const page_t* page;
const lock_t* lock;
const rec_t* rec;
ulint nth_lock = 0;
ulint nth_bit = 0;
ulint i;
- mtr_t mtr;
mem_heap_t* heap = NULL;
ulint offsets_[REC_OFFS_NORMAL_SIZE];
ulint* offsets = offsets_;
rec_offs_init(offsets_);
- /* This is to preserve latching order. */
- if (locked_lock_trx_sys) {
- lock_mutex_exit();
- rw_lock_s_unlock(&trx_sys->lock);
- }
-
ut_ad(!lock_mutex_own());
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_SHARED));
ut_ad(!rw_lock_own(&trx_sys->lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
- mtr_start(&mtr);
-
- ut_ad(zip_size != ULINT_UNDEFINED);
- block = buf_page_get(space, zip_size, page_no, RW_X_LATCH, &mtr);
- buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
-
- page = block->frame;
-
- /* Either way we need to (re)acquire the mutexes. */
lock_mutex_enter();
-
rw_lock_s_lock(&trx_sys->lock);
-
loop:
- lock = lock_rec_get_first_on_page_addr(space, page_no);
+ lock = lock_rec_get_first_on_page_addr(buf_block_get_space(block),
+ buf_block_get_page_no(block));
if (!lock) {
goto function_exit;
}
+#if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
+ ut_a(!block->page.file_page_was_freed);
+#endif
+
for (i = 0; i < nth_lock; i++) {
lock = lock_rec_get_next_on_page_const(lock);
@@ -5315,15 +5277,14 @@ loop:
if (i == 1 || lock_rec_get_nth_bit(lock, i)) {
- index = lock->index;
- rec = page_find_rec_with_heap_no(page, i);
+ rec = page_find_rec_with_heap_no(block->frame, i);
ut_a(rec);
- offsets = rec_get_offsets(rec, index, offsets,
+ offsets = rec_get_offsets(rec, lock->index, offsets,
ULINT_UNDEFINED, &heap);
#if 0
fprintf(stderr,
- "Validating %lu %lu\n",
- (ulong) space, (ulong) page_no);
+ "Validating %u %u\n",
+ block->page.space, block->page.offset);
#endif
/* If this thread is holding the file space
latch (fil_space_t::latch), the following
@@ -5331,7 +5292,7 @@ loop:
cause a deadlock of threads. */
lock_rec_queue_validate(
- TRUE, block, rec, index, offsets);
+ TRUE, block, rec, lock->index, offsets);
nth_bit = i + 1;
@@ -5345,13 +5306,8 @@ loop:
goto loop;
function_exit:
-
- mtr_commit(&mtr);
-
- if (!locked_lock_trx_sys) {
- lock_mutex_exit();
- rw_lock_s_unlock(&trx_sys->lock);
- }
+ lock_mutex_exit();
+ rw_lock_s_unlock(&trx_sys->lock);
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
@@ -5369,8 +5325,6 @@ lock_validate(void)
{
const lock_t* lock;
const trx_t* trx;
- ulint space;
- ulint page_no;
ulint i;
lock_mutex_enter();
@@ -5396,9 +5350,13 @@ lock_validate(void)
}
for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
- ib_uint64_t limit = 0;
+ ulint space;
+ ulint page_no;
+ ib_uint64_t limit = 0;
for (;;) {
+ mtr_t mtr;
+ buf_block_t* block;
for (lock = HASH_GET_FIRST(lock_sys->rec_hash, i);
lock != NULL;
@@ -5419,11 +5377,30 @@ lock_validate(void)
break;
}
- lock_rec_validate_page(
- TRUE, space,
- fil_space_get_zip_size(space), page_no);
+ lock_mutex_exit();
+ rw_lock_s_unlock(&trx_sys->lock);
+
+ /* The lock and the block that it is referring
+ to may be freed at this point. We pass
+ BUF_GET_POSSIBLY_FREED to skip a debug check.
+ If the lock exists in lock_rec_validate_page()
+ we assert !block->page.file_page_was_freed. */
- limit = ut_ull_create(space, page_no + 1);
+ mtr_start(&mtr);
+ block = buf_page_get_gen(
+ space, fil_space_get_zip_size(space),
+ page_no, RW_X_LATCH, NULL,
+ BUF_GET_POSSIBLY_FREED,
+ __FILE__, __LINE__, &mtr);
+ buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK);
+
+ ut_ad(lock_rec_validate_page(block));
+ mtr_commit(&mtr);
+
+ limit++;
+
+ lock_mutex_enter();
+ rw_lock_s_lock(&trx_sys->lock);
}
}
=== modified file 'storage/innobase/log/log0recv.c'
--- a/storage/innobase/log/log0recv.c 2011-04-21 09:24:45 +0000
+++ b/storage/innobase/log/log0recv.c 2011-05-17 11:42:10 +0000
@@ -3443,19 +3443,15 @@ recv_reset_log_files_for_backup(
}
fprintf(stderr,
- "Setting log file size to %lu %lu\n",
- (ulong) ut_get_high32(log_file_size),
- (ulong) log_file_size & 0xFFFFFFFFUL);
-
- success = os_file_set_size(name, log_file,
- log_file_size & 0xFFFFFFFFUL,
- ut_get_high32(log_file_size));
+ "Setting log file size to %llu\n",
+ log_file_size);
+
+ success = os_file_set_size(name, log_file, log_file_size);
if (!success) {
fprintf(stderr,
- "InnoDB: Cannot set %s size to %lu %lu\n",
- name, (ulong) ut_get_high32(log_file_size),
- (ulong) (log_file_size & 0xFFFFFFFFUL));
+ "InnoDB: Cannot set %s size to %llu\n",
+ name, log_file_size);
exit(1);
}
@@ -3509,9 +3505,8 @@ log_group_recover_from_archive_file(
ulint len;
ibool ret;
byte* buf;
- ulint read_offset;
- ulint file_size;
- ulint file_size_high;
+ os_offset_t read_offset;
+ os_offset_t file_size;
int input_char;
char name[10000];
@@ -3553,10 +3548,8 @@ ask_again:
}
}
- ret = os_file_get_size(file_handle, &file_size, &file_size_high);
- ut_a(ret);
-
- ut_a(file_size_high == 0);
+ file_size = os_file_get_size(file_handle);
+ ut_a(file_size != (os_offset_t) -1);
fprintf(stderr, "InnoDB: Opened archived log file %s\n", name);
=== modified file 'storage/innobase/os/os0file.c'
--- a/storage/innobase/os/os0file.c 2011-04-21 09:24:45 +0000
+++ b/storage/innobase/os/os0file.c 2011-05-18 10:05:38 +0000
@@ -168,9 +168,7 @@ struct os_aio_slot_struct{
write */
byte* buf; /*!< buffer used in i/o */
ulint type; /*!< OS_FILE_READ or OS_FILE_WRITE */
- ulint offset; /*!< 32 low bits of file offset in
- bytes */
- ulint offset_high; /*!< 32 high bits of file offset */
+ os_offset_t offset; /*!< file offset in bytes */
os_file_t file; /*!< file where to read or write */
const char* name; /*!< file name or path */
ibool io_already_done;/*!< used only in simulated aio:
@@ -1863,76 +1861,33 @@ os_file_close_no_error_handling(
/***********************************************************************//**
Gets a file size.
-@return TRUE if success */
+@return file size, or (os_offset_t) -1 on failure */
UNIV_INTERN
-ibool
+os_offset_t
os_file_get_size(
/*=============*/
- os_file_t file, /*!< in: handle to a file */
- ulint* size, /*!< out: least significant 32 bits of file
- size */
- ulint* size_high)/*!< out: most significant 32 bits of size */
+ os_file_t file) /*!< in: handle to a file */
{
#ifdef __WIN__
- DWORD high;
- DWORD low;
+ os_offset_t offset;
+ DWORD high;
+ DWORD low;
low = GetFileSize(file, &high);
if ((low == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) {
- return(FALSE);
+ return((os_offset_t) -1);
}
- *size = low;
- *size_high = high;
+ offset = (os_offset_t) low | ((os_offset_t) high << 32);
- return(TRUE);
+ return(offset);
#else
- off_t offs;
-
- offs = lseek(file, 0, SEEK_END);
-
- if (offs == ((off_t)-1)) {
-
- return(FALSE);
- }
-
- if (sizeof(off_t) > 4) {
- *size = (ulint)(offs & 0xFFFFFFFFUL);
- *size_high = (ulint)(offs >> 32);
- } else {
- *size = (ulint) offs;
- *size_high = 0;
- }
-
- return(TRUE);
+ return((os_offset_t) lseek(file, 0, SEEK_END));
#endif
}
/***********************************************************************//**
-Gets file size as a 64-bit integer ib_int64_t.
-@return size in bytes, -1 if error */
-UNIV_INTERN
-ib_int64_t
-os_file_get_size_as_iblonglong(
-/*===========================*/
- os_file_t file) /*!< in: handle to a file */
-{
- ulint size;
- ulint size_high;
- ibool success;
-
- success = os_file_get_size(file, &size, &size_high);
-
- if (!success) {
-
- return(-1);
- }
-
- return((((ib_int64_t)size_high) << 32) + (ib_int64_t)size);
-}
-
-/***********************************************************************//**
Write the specified number of zeros to a newly created file.
@return TRUE if success */
UNIV_INTERN
@@ -1942,24 +1897,18 @@ os_file_set_size(
const char* name, /*!< in: name of the file or path as a
null-terminated string */
os_file_t file, /*!< in: handle to a file */
- ulint size, /*!< in: least significant 32 bits of file
- size */
- ulint size_high)/*!< in: most significant 32 bits of size */
+ os_offset_t size) /*!< in: file size */
{
- ib_int64_t current_size;
- ib_int64_t desired_size;
+ os_offset_t current_size;
ibool ret;
byte* buf;
byte* buf2;
ulint buf_size;
- ut_a(size == (size & 0xFFFFFFFF));
-
current_size = 0;
- desired_size = (ib_int64_t)size + (((ib_int64_t)size_high) << 32);
/* Write up to 1 megabyte at a time. */
- buf_size = ut_min(64, (ulint) (desired_size / UNIV_PAGE_SIZE))
+ buf_size = ut_min(64, (ulint) (size / UNIV_PAGE_SIZE))
* UNIV_PAGE_SIZE;
buf2 = ut_malloc(buf_size + UNIV_PAGE_SIZE);
@@ -1969,42 +1918,39 @@ os_file_set_size(
/* Write buffer full of zeros */
memset(buf, 0, buf_size);
- if (desired_size >= (ib_int64_t)(100 * 1024 * 1024)) {
+ if (size >= (os_offset_t) 100 << 20) {
fprintf(stderr, "InnoDB: Progress in MB:");
}
- while (current_size < desired_size) {
+ while (current_size < size) {
ulint n_bytes;
- if (desired_size - current_size < (ib_int64_t) buf_size) {
- n_bytes = (ulint) (desired_size - current_size);
+ if (size - current_size < (os_offset_t) buf_size) {
+ n_bytes = (ulint) (size - current_size);
} else {
n_bytes = buf_size;
}
- ret = os_file_write(name, file, buf,
- (ulint)(current_size & 0xFFFFFFFF),
- (ulint)(current_size >> 32),
- n_bytes);
+ ret = os_file_write(name, file, buf, current_size, n_bytes);
if (!ret) {
ut_free(buf2);
goto error_handling;
}
/* Print about progress for each 100 MB written */
- if ((ib_int64_t) (current_size + n_bytes) / (ib_int64_t)(100 * 1024 * 1024)
- != current_size / (ib_int64_t)(100 * 1024 * 1024)) {
+ if ((current_size + n_bytes) / (100 << 20)
+ != current_size / (100 << 20)) {
fprintf(stderr, " %lu00",
(ulong) ((current_size + n_bytes)
- / (ib_int64_t)(100 * 1024 * 1024)));
+ / (100 << 20)));
}
current_size += n_bytes;
}
- if (desired_size >= (ib_int64_t)(100 * 1024 * 1024)) {
+ if (size >= (os_offset_t) 100 << 20) {
fprintf(stderr, "\n");
}
@@ -2190,35 +2136,28 @@ os_file_flush_func(
/*******************************************************************//**
Does a synchronous read operation in Posix.
@return number of bytes read, -1 if error */
-static
+static __attribute__((nonnull, warn_unused_result))
ssize_t
os_file_pread(
/*==========*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
ulint n, /*!< in: number of bytes to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset from where to read */
- ulint offset_high) /*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset) /*!< in: file offset from where to read */
{
off_t offs;
#if defined(HAVE_PREAD) && !defined(HAVE_BROKEN_PREAD)
ssize_t n_bytes;
#endif /* HAVE_PREAD && !HAVE_BROKEN_PREAD */
- ut_a((offset & 0xFFFFFFFFUL) == offset);
+ ut_ad(n);
/* If off_t is > 4 bytes in size, then we assume we can pass a
64-bit address */
+ offs = (off_t) offset;
- if (sizeof(off_t) > 4) {
- offs = (off_t)offset + (((off_t)offset_high) << 32);
-
- } else {
- offs = (off_t)offset;
-
- if (offset_high > 0) {
+ if (sizeof(off_t) <= 4) {
+ if (UNIV_UNLIKELY(offset != (os_offset_t) offs)) {
fprintf(stderr,
"InnoDB: Error: file read at offset > 4 GB\n");
}
@@ -2287,32 +2226,26 @@ os_file_pread(
/*******************************************************************//**
Does a synchronous write operation in Posix.
@return number of bytes written, -1 if error */
-static
+static __attribute__((nonnull, warn_unused_result))
ssize_t
os_file_pwrite(
/*===========*/
os_file_t file, /*!< in: handle to a file */
const void* buf, /*!< in: buffer from where to write */
ulint n, /*!< in: number of bytes to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to write */
- ulint offset_high) /*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset) /*!< in: file offset where to write */
{
ssize_t ret;
off_t offs;
- ut_a((offset & 0xFFFFFFFFUL) == offset);
+ ut_ad(n);
/* If off_t is > 4 bytes in size, then we assume we can pass a
64-bit address */
+ offs = (off_t) offset;
- if (sizeof(off_t) > 4) {
- offs = (off_t)offset + (((off_t)offset_high) << 32);
- } else {
- offs = (off_t)offset;
-
- if (offset_high > 0) {
+ if (sizeof(off_t) <= 4) {
+ if (UNIV_UNLIKELY(offset != (os_offset_t) offs)) {
fprintf(stderr,
"InnoDB: Error: file write"
" at offset > 4 GB\n");
@@ -2419,10 +2352,7 @@ os_file_read_func(
/*==============*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read */
- ulint offset_high, /*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read */
ulint n) /*!< in: number of bytes to read */
{
#ifdef __WIN__
@@ -2438,7 +2368,6 @@ os_file_read_func(
/* On 64-bit Windows, ulint is 64 bits. But offset and n should be
no more than 32 bits. */
- ut_a((offset & 0xFFFFFFFFUL) == offset);
ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_reads++;
@@ -2449,8 +2378,8 @@ try_again:
ut_ad(buf);
ut_ad(n > 0);
- low = (DWORD) offset;
- high = (DWORD) offset_high;
+ low = (DWORD) offset & 0xFFFFFFFF;
+ high = (DWORD) (offset >> 32);
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads++;
@@ -2501,7 +2430,7 @@ try_again:
os_bytes_read_since_printout += n;
try_again:
- ret = os_file_pread(file, buf, n, offset, offset_high);
+ ret = os_file_pread(file, buf, n, offset);
if ((ulint)ret == n) {
@@ -2509,10 +2438,9 @@ try_again:
}
fprintf(stderr,
- "InnoDB: Error: tried to read %lu bytes at offset %lu %lu.\n"
+ "InnoDB: Error: tried to read %lu bytes at offset %llu.\n"
"InnoDB: Was only able to read %ld.\n",
- (ulong)n, (ulong)offset_high,
- (ulong)offset, (long)ret);
+ (ulong)n, offset, (long)ret);
#endif /* __WIN__ */
#ifdef __WIN__
error_handling:
@@ -2551,10 +2479,7 @@ os_file_read_no_error_handling_func(
/*================================*/
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read */
- ulint offset_high, /*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read */
ulint n) /*!< in: number of bytes to read */
{
#ifdef __WIN__
@@ -2570,7 +2495,6 @@ os_file_read_no_error_handling_func(
/* On 64-bit Windows, ulint is 64 bits. But offset and n should be
no more than 32 bits. */
- ut_a((offset & 0xFFFFFFFFUL) == offset);
ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_reads++;
@@ -2581,8 +2505,8 @@ try_again:
ut_ad(buf);
ut_ad(n > 0);
- low = (DWORD) offset;
- high = (DWORD) offset_high;
+ low = (DWORD) offset & 0xFFFFFFFF;
+ high = (DWORD) (offset >> 32);
os_mutex_enter(os_file_count_mutex);
os_n_pending_reads++;
@@ -2633,7 +2557,7 @@ try_again:
os_bytes_read_since_printout += n;
try_again:
- ret = os_file_pread(file, buf, n, offset, offset_high);
+ ret = os_file_pread(file, buf, n, offset);
if ((ulint)ret == n) {
@@ -2688,10 +2612,7 @@ os_file_write_func(
null-terminated string */
os_file_t file, /*!< in: handle to a file */
const void* buf, /*!< in: buffer from which to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to write */
- ulint offset_high, /*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to write */
ulint n) /*!< in: number of bytes to write */
{
#ifdef __WIN__
@@ -2708,7 +2629,6 @@ os_file_write_func(
/* On 64-bit Windows, ulint is 64 bits. But offset and n should be
no more than 32 bits. */
- ut_a((offset & 0xFFFFFFFFUL) == offset);
ut_a((n & 0xFFFFFFFFUL) == n);
os_n_file_writes++;
@@ -2717,8 +2637,8 @@ os_file_write_func(
ut_ad(buf);
ut_ad(n > 0);
retry:
- low = (DWORD) offset;
- high = (DWORD) offset_high;
+ low = (DWORD) offset & 0xFFFFFFFF;
+ high = (DWORD) (offset >> 32);
os_mutex_enter(os_file_count_mutex);
os_n_pending_writes++;
@@ -2750,14 +2670,13 @@ retry:
fprintf(stderr,
" InnoDB: Error: File pointer positioning to"
" file %s failed at\n"
- "InnoDB: offset %lu %lu. Operating system"
+ "InnoDB: offset %llu. Operating system"
" error number %lu.\n"
"InnoDB: Some operating system error numbers"
" are described at\n"
"InnoDB: "
REFMAN "operating-system-error-codes.html\n",
- name, (ulong) offset_high, (ulong) offset,
- (ulong) GetLastError());
+ name, offset, (ulong) GetLastError());
return(FALSE);
}
@@ -2808,7 +2727,7 @@ retry:
fprintf(stderr,
" InnoDB: Error: Write to file %s failed"
- " at offset %lu %lu.\n"
+ " at offset %llu.\n"
"InnoDB: %lu bytes should have been written,"
" only %lu were written.\n"
"InnoDB: Operating system error number %lu.\n"
@@ -2816,7 +2735,7 @@ retry:
" support files of this size.\n"
"InnoDB: Check also that the disk is not full"
" or a disk quota exceeded.\n",
- name, (ulong) offset_high, (ulong) offset,
+ name, offset,
(ulong) n, (ulong) len, (ulong) err);
if (strerror((int)err) != NULL) {
@@ -2838,7 +2757,7 @@ retry:
#else
ssize_t ret;
- ret = os_file_pwrite(file, buf, n, offset, offset_high);
+ ret = os_file_pwrite(file, buf, n, offset);
if ((ulint)ret == n) {
@@ -2851,7 +2770,7 @@ retry:
fprintf(stderr,
" InnoDB: Error: Write to file %s failed"
- " at offset %lu %lu.\n"
+ " at offset %llu.\n"
"InnoDB: %lu bytes should have been written,"
" only %ld were written.\n"
"InnoDB: Operating system error number %lu.\n"
@@ -2859,7 +2778,7 @@ retry:
" support files of this size.\n"
"InnoDB: Check also that the disk is not full"
" or a disk quota exceeded.\n",
- name, offset_high, offset, n, (long int)ret,
+ name, offset, n, (long int)ret,
(ulint)errno);
if (strerror(errno) != NULL) {
fprintf(stderr,
@@ -3654,10 +3573,7 @@ os_aio_array_reserve_slot(
null-terminated string */
void* buf, /*!< in: buffer where to read or from which
to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset */
- ulint offset_high, /*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset */
ulint len) /*!< in: length of the block to read or write */
{
os_aio_slot_t* slot = NULL;
@@ -3745,13 +3661,12 @@ found:
slot->type = type;
slot->buf = buf;
slot->offset = offset;
- slot->offset_high = offset_high;
slot->io_already_done = FALSE;
#ifdef WIN_ASYNC_IO
control = &(slot->control);
- control->Offset = (DWORD)offset;
- control->OffsetHigh = (DWORD)offset_high;
+ control->Offset = (DWORD) offset & 0xFFFFFFFF;
+ control->OffsetHigh = (DWORD) (offset >> 32);
ResetEvent(slot->handle);
#elif defined(LINUX_NATIVE_AIO)
@@ -3763,14 +3678,10 @@ found:
/* Check if we are dealing with 64 bit arch.
If not then make sure that offset fits in 32 bits. */
- if (sizeof(aio_offset) == 8) {
- aio_offset = offset_high;
- aio_offset <<= 32;
- aio_offset += offset;
- } else {
- ut_a(offset_high == 0);
- aio_offset = offset;
- }
+ aio_offset = (off_t) offset;
+
+ ut_a(sizeof(aio_offset) >= sizeof(offset)
+ || ((os_offset_t) aio_offset) == offset);
iocb = &slot->control;
@@ -3785,7 +3696,6 @@ found:
slot->n_bytes = 0;
slot->ret = 0;
/*fprintf(stderr, "Filled up Linux native iocb.\n");*/
-
skip_native_aio:
#endif /* LINUX_NATIVE_AIO */
@@ -4021,10 +3931,7 @@ os_aio_func(
os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read or from which
to write */
- ulint offset, /*!< in: least significant 32 bits of file
- offset where to read or write */
- ulint offset_high, /*!< in: most significant 32 bits of
- offset */
+ os_offset_t offset, /*!< in: file offset where to read or write */
ulint n, /*!< in: number of bytes to read or write */
fil_node_t* message1,/*!< in: message for the aio handler
(can be used to identify a completed
@@ -4071,16 +3978,21 @@ os_aio_func(
Windows async i/o, Windows does not allow us to use
ordinary synchronous os_file_read etc. on the same file,
therefore we have built a special mechanism for synchronous
- wait in the Windows case. */
+ wait in the Windows case.
+ Also note that the Performance Schema instrumentation has
+ been performed by current os_aio_func()'s wrapper function
+ pfs_os_aio_func(). So we would no longer need to call
+ Performance Schema instrumented os_file_read() and
+ os_file_write(). Instead, we should use os_file_read_func()
+ and os_file_write_func() */
if (type == OS_FILE_READ) {
- return(os_file_read(file, buf, offset,
- offset_high, n));
+ return(os_file_read_func(file, buf, offset, n));
}
ut_a(type == OS_FILE_WRITE);
- return(os_file_write(name, file, buf, offset, offset_high, n));
+ return(os_file_write_func(name, file, buf, offset, n));
}
try_again:
@@ -4116,7 +4028,7 @@ try_again:
}
slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
- name, buf, offset, offset_high, n);
+ name, buf, offset, n);
if (type == OS_FILE_READ) {
if (srv_use_native_aio) {
os_n_file_reads++;
@@ -4666,7 +4578,7 @@ os_aio_simulated_handle(
ulint n_consecutive;
ulint total_len;
ulint offs;
- ulint lowest_offset;
+ os_offset_t lowest_offset;
ulint biggest_age;
ulint age;
byte* combined_buf;
@@ -4753,7 +4665,7 @@ restart:
then pick the one at the lowest offset. */
biggest_age = 0;
- lowest_offset = ULINT_MAX;
+ lowest_offset = IB_UINT64_MAX;
for (i = 0; i < n; i++) {
slot = os_aio_array_get_nth_slot(array, i + segment * n);
@@ -4782,7 +4694,7 @@ restart:
lowest offset in the array (we ignore the high 32 bits of the
offset in these heuristics) */
- lowest_offset = ULINT_MAX;
+ lowest_offset = IB_UINT64_MAX;
for (i = 0; i < n; i++) {
slot = os_aio_array_get_nth_slot(array,
@@ -4822,9 +4734,6 @@ consecutive_loop:
if (slot2->reserved && slot2 != slot
&& slot2->offset == slot->offset + slot->len
- /* check that sum does not wrap over */
- && slot->offset + slot->len > slot->offset
- && slot2->offset_high == slot->offset_high
&& slot2->type == slot->type
&& slot2->file == slot->file) {
@@ -4891,20 +4800,18 @@ consecutive_loop:
if (os_aio_print_debug) {
fprintf(stderr,
- "InnoDB: doing i/o of type %lu at offset %lu %lu,"
+ "InnoDB: doing i/o of type %lu at offset %llu,"
" length %lu\n",
- (ulong) slot->type, (ulong) slot->offset_high,
- (ulong) slot->offset, (ulong) total_len);
+ (ulong) slot->type, slot->offset, (ulong) total_len);
}
/* Do the i/o with ordinary, synchronous i/o functions: */
if (slot->type == OS_FILE_WRITE) {
ret = os_file_write(slot->name, slot->file, combined_buf,
- slot->offset, slot->offset_high,
- total_len);
+ slot->offset, total_len);
} else {
ret = os_file_read(slot->file, combined_buf,
- slot->offset, slot->offset_high, total_len);
+ slot->offset, total_len);
}
ut_a(ret);
=== modified file 'storage/innobase/page/page0page.c'
--- a/storage/innobase/page/page0page.c 2011-03-22 12:34:16 +0000
+++ b/storage/innobase/page/page0page.c 2011-05-09 08:48:47 +0000
@@ -1253,28 +1253,6 @@ page_move_rec_list_start(
return(TRUE);
}
-
-/***********************************************************************//**
-This is a low-level operation which is used in a database index creation
-to update the page number of a created B-tree to a data dictionary record. */
-UNIV_INTERN
-void
-page_rec_write_index_page_no(
-/*=========================*/
- rec_t* rec, /*!< in: record to update */
- ulint i, /*!< in: index of the field to update */
- ulint page_no,/*!< in: value to write */
- mtr_t* mtr) /*!< in: mtr */
-{
- byte* data;
- ulint len;
-
- data = rec_get_nth_field_old(rec, i, &len);
-
- ut_ad(len == 4);
-
- mlog_write_ulint(data, page_no, MLOG_4BYTES, mtr);
-}
#endif /* !UNIV_HOTBACKUP */
/**************************************************************//**
=== modified file 'storage/innobase/que/que0que.c'
--- a/storage/innobase/que/que0que.c 2011-04-12 07:53:47 +0000
+++ b/storage/innobase/que/que0que.c 2011-05-25 13:43:30 +0000
@@ -703,7 +703,7 @@ que_thr_stop(
que_thr_t* thr) /*!< in: query thread */
{
que_t* graph;
- trx_t* trx = thr_get_trx(thr);;
+ trx_t* trx = thr_get_trx(thr);
graph = thr->graph;
=== modified file 'storage/innobase/row/row0merge.c'
--- a/storage/innobase/row/row0merge.c 2011-04-05 11:12:48 +0000
+++ b/storage/innobase/row/row0merge.c 2011-05-22 20:17:42 +0000
@@ -701,7 +701,7 @@ row_merge_read(
elements */
row_merge_block_t* buf) /*!< out: data */
{
- ib_uint64_t ofs = ((ib_uint64_t) offset) * sizeof *buf;
+ os_offset_t ofs = ((os_offset_t) offset) * sizeof *buf;
ibool success;
#ifdef UNIV_DEBUG
@@ -712,9 +712,7 @@ row_merge_read(
#endif /* UNIV_DEBUG */
success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
- (ulint) (ofs & 0xFFFFFFFF),
- (ulint) (ofs >> 32),
- sizeof *buf);
+ ofs, sizeof *buf);
#ifdef POSIX_FADV_DONTNEED
/* Each block is read exactly once. Free up the file cache. */
posix_fadvise(fd, ofs, sizeof *buf, POSIX_FADV_DONTNEED);
@@ -742,13 +740,10 @@ row_merge_write(
const void* buf) /*!< in: data */
{
size_t buf_len = sizeof(row_merge_block_t);
- ib_uint64_t ofs = buf_len * (ib_uint64_t) offset;
+ os_offset_t ofs = buf_len * (os_offset_t) offset;
ibool ret;
- ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf,
- (ulint) (ofs & 0xFFFFFFFF),
- (ulint) (ofs >> 32),
- buf_len);
+ ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf, ofs, buf_len);
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c 2011-04-27 21:49:19 +0000
+++ b/storage/innobase/row/row0mysql.c 2011-05-22 20:19:06 +0000
@@ -2966,7 +2966,7 @@ row_truncate_table_for_mysql(
rec = btr_pcur_get_rec(&pcur);
if (root_page_no != FIL_NULL) {
- page_rec_write_index_page_no(
+ page_rec_write_field(
rec, DICT_SYS_INDEXES_PAGE_NO_FIELD,
root_page_no, &mtr);
/* We will need to commit and restart the
=== modified file 'storage/innobase/row/row0row.c'
--- a/storage/innobase/row/row0row.c 2011-04-27 21:49:19 +0000
+++ b/storage/innobase/row/row0row.c 2011-05-24 12:05:57 +0000
@@ -47,35 +47,6 @@ Created 4/20/1996 Heikki Tuuri
#include "read0read.h"
#include "ut0mem.h"
-/*********************************************************************//**
-Gets the offset of trx id field, in bytes relative to the origin of
-a clustered index record.
-@return offset of DATA_TRX_ID */
-UNIV_INTERN
-ulint
-row_get_trx_id_offset(
-/*==================*/
- const rec_t* rec __attribute__((unused)),
- /*!< in: record */
- dict_index_t* index, /*!< in: clustered index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
-{
- ulint pos;
- ulint offset;
- ulint len;
-
- ut_ad(dict_index_is_clust(index));
- ut_ad(rec_offs_validate(rec, index, offsets));
-
- pos = dict_index_get_sys_col_pos(index, DATA_TRX_ID);
-
- offset = rec_get_nth_field_offs(offsets, pos, &len);
-
- ut_ad(len == DATA_TRX_ID_LEN);
-
- return(offset);
-}
-
/*****************************************************************//**
When an insert or purge to a table is performed, this function builds
the entry to be inserted into or purged from an index on the table.
=== modified file 'storage/innobase/row/row0vers.c'
--- a/storage/innobase/row/row0vers.c 2011-01-25 10:51:35 +0000
+++ b/storage/innobase/row/row0vers.c 2011-05-04 11:29:29 +0000
@@ -113,8 +113,6 @@ row_vers_impl_x_locked_low(
modify rec, and does not necessarily have an implicit x-lock
on rec. */
- mtr_s_lock(&purge_sys->latch, mtr);
-
for (version = clust_rec;; version = prev_version) {
ulint err;
row_ext_t* ext;
@@ -189,9 +187,9 @@ row_vers_impl_x_locked_low(
would require rec to be in a different state. */
/* The previous version of clust_rec must be
- accessible, because clust_rec was not a fresh insert
- and we are holding purge_sys->latch. There is no
- guarantee that the transaction is still active. */
+ accessible, because clust_rec was not a fresh insert.
+ There is no guarantee that the transaction is still
+ active. */
ut_ad(err == DB_SUCCESS);
@@ -285,8 +283,10 @@ row_vers_impl_x_locked(
/* Search for the clustered index record. The latch on the
page of clust_rec locks the top of the stack of versions. The
- bottom of the version stack will be locked by
- purge_sys->latch. */
+ bottom of the version stack is not locked; oldest versions may
+ disappear by the fact that transactions may be committed and
+ collected by the purge. This is not a problem, because we are
+ only interested in active transactions. */
clust_rec = row_get_clust_rec(
BTR_SEARCH_LEAF, rec, index, &clust_index, &mtr);
@@ -334,15 +334,7 @@ row_vers_must_preserve_del_marked(
mtr_s_lock(&(purge_sys->latch), mtr);
- if (trx_purge_update_undo_must_exist(trx_id)) {
-
- /* A purge operation is not yet allowed to remove this
- delete marked record */
-
- return(TRUE);
- }
-
- return(FALSE);
+ return(!read_view_sees_trx_id(purge_sys->view, trx_id));
}
/*****************************************************************//**
@@ -382,7 +374,6 @@ row_vers_old_has_index_entry(
#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
- mtr_s_lock(&(purge_sys->latch), mtr);
clust_index = dict_table_get_first_index(index->table);
@@ -395,7 +386,11 @@ row_vers_old_has_index_entry(
if (also_curr && !rec_get_deleted_flag(rec, comp)) {
row_ext_t* ext;
- /* The stack of versions is locked by mtr.
+ /* The top of the stack of versions is locked by the
+ mtr holding a latch on the page containing the
+ clustered index record. The bottom of the stack is
+ locked by the fact that the purge_sys->view must
+ 'overtake' any read view of an active transaction.
Thus, it is safe to fetch the prefixes for
externally stored columns. */
row = row_build(ROW_COPY_POINTERS, clust_index,
@@ -535,7 +530,6 @@ row_vers_build_for_consistent_read(
ut_ad(!read_view_sees_trx_id(view, trx_id));
- rw_lock_s_lock(&(purge_sys->latch));
version = rec;
for (;;) {
@@ -615,7 +609,6 @@ row_vers_build_for_consistent_read(
}/* for (;;) */
mem_heap_free(heap);
- rw_lock_s_unlock(&(purge_sys->latch));
return(err);
}
@@ -661,12 +654,6 @@ row_vers_build_for_semi_consistent_read(
ut_ad(rec_offs_validate(rec, index, *offsets));
- rw_lock_s_lock(&(purge_sys->latch));
- /* The S-latch on purge_sys prevents the purge view from
- changing. Thus, if we have an uncommitted transaction at
- this point, then purge cannot remove its undo log even if
- the transaction could commit now. */
-
version = rec;
for (;;) {
@@ -759,7 +746,6 @@ row_vers_build_for_semi_consistent_read(
if (heap) {
mem_heap_free(heap);
}
- rw_lock_s_unlock(&(purge_sys->latch));
return(err);
}
=== modified file 'storage/innobase/srv/srv0conc.c'
--- a/storage/innobase/srv/srv0conc.c 2011-04-18 02:17:16 +0000
+++ b/storage/innobase/srv/srv0conc.c 2011-05-13 12:47:07 +0000
@@ -293,7 +293,7 @@ retry:
#endif /* UNIV_SYNC_DEBUG */
trx->op_info = "waiting in InnoDB queue";
- thd_wait_begin(trx->mysql_thd, THD_WAIT_ROW_TABLE_LOCK);
+ thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK);
os_event_wait(slot->event);
thd_wait_end(trx->mysql_thd);
=== modified file 'storage/innobase/srv/srv0start.c'
--- a/storage/innobase/srv/srv0start.c 2011-04-19 04:17:07 +0000
+++ b/storage/innobase/srv/srv0start.c 2011-05-26 06:29:48 +0000
@@ -520,32 +520,6 @@ srv_normalize_path_for_win(
#ifndef UNIV_HOTBACKUP
/*********************************************************************//**
-Calculates the low 32 bits when a file size which is given as a number
-database pages is converted to the number of bytes.
-@return low 32 bytes of file size when expressed in bytes */
-static
-ulint
-srv_calc_low32(
-/*===========*/
- ib_uint64_t file_size) /*!< in: file size in database pages */
-{
- return((ulint) (0xFFFFFFFFUL & (file_size << UNIV_PAGE_SIZE_SHIFT)));
-}
-
-/*********************************************************************//**
-Calculates the high 32 bits when a file size which is given as a number
-of database pages is converted to the number of bytes.
-@return high 32 bytes of file size when expressed in bytes */
-static
-ulint
-srv_calc_high32(
-/*============*/
- ib_uint64_t file_size) /*!< in: file size in database pages */
-{
- return((ulint) (file_size >> (32 - UNIV_PAGE_SIZE_SHIFT)));
-}
-
-/*********************************************************************//**
Creates or opens the log files and closes them.
@return DB_SUCCESS or error code */
static
@@ -562,11 +536,10 @@ open_or_create_log_file(
ulint k, /*!< in: log group number */
ulint i) /*!< in: log file number in group */
{
- ibool ret;
- ulint size;
- ulint size_high;
- char name[10000];
- ulint dirnamelen;
+ ibool ret;
+ os_offset_t size;
+ char name[10000];
+ ulint dirnamelen;
UT_NOT_USED(create_new_db);
@@ -614,20 +587,20 @@ open_or_create_log_file(
return(DB_ERROR);
}
- ret = os_file_get_size(files[i], &size, &size_high);
- ut_a(ret);
+ size = os_file_get_size(files[i]);
+ ut_a(size != (os_offset_t) -1);
- if (size != srv_calc_low32(srv_log_file_size)
- || size_high != srv_calc_high32(srv_log_file_size)) {
+ if (UNIV_UNLIKELY(size != (os_offset_t) srv_log_file_size
+ << UNIV_PAGE_SIZE_SHIFT)) {
fprintf(stderr,
"InnoDB: Error: log file %s is"
- " of different size %lu %lu bytes\n"
+ " of different size %llu bytes\n"
"InnoDB: than specified in the .cnf"
- " file %lu %lu bytes!\n",
- name, (ulong) size_high, (ulong) size,
- (ulong) srv_calc_high32(srv_log_file_size),
- (ulong) srv_calc_low32(srv_log_file_size));
+ " file %llu bytes!\n",
+ name, size,
+ (os_offset_t) srv_log_file_size
+ << UNIV_PAGE_SIZE_SHIFT);
return(DB_ERROR);
}
@@ -654,8 +627,8 @@ open_or_create_log_file(
" full: wait...\n");
ret = os_file_set_size(name, files[i],
- srv_calc_low32(srv_log_file_size),
- srv_calc_high32(srv_log_file_size));
+ (os_offset_t) srv_log_file_size
+ << UNIV_PAGE_SIZE_SHIFT);
if (!ret) {
fprintf(stderr,
"InnoDB: Error in creating %s:"
@@ -731,14 +704,13 @@ open_or_create_data_files(
ulint* sum_of_new_sizes)/*!< out: sum of sizes of the
new files added */
{
- ibool ret;
- ulint i;
- ibool one_opened = FALSE;
- ibool one_created = FALSE;
- ulint size;
- ulint size_high;
- ulint rounded_size_pages;
- char name[10000];
+ ibool ret;
+ ulint i;
+ ibool one_opened = FALSE;
+ ibool one_created = FALSE;
+ os_offset_t size;
+ ulint rounded_size_pages;
+ char name[10000];
if (srv_n_data_files >= 1000) {
fprintf(stderr, "InnoDB: can only have < 1000 data files\n"
@@ -864,13 +836,12 @@ open_or_create_data_files(
goto skip_size_check;
}
- ret = os_file_get_size(files[i], &size, &size_high);
- ut_a(ret);
+ size = os_file_get_size(files[i]);
+ ut_a(size != (os_offset_t) -1);
/* Round size downward to megabytes */
- rounded_size_pages
- = (size / (1024 * 1024) + 4096 * size_high)
- << (20 - UNIV_PAGE_SIZE_SHIFT);
+ rounded_size_pages = (ulint)
+ (size >> UNIV_PAGE_SIZE_SHIFT);
if (i == srv_n_data_files - 1
&& srv_auto_extend_last_data_file) {
@@ -959,8 +930,8 @@ skip_size_check:
ret = os_file_set_size(
name, files[i],
- srv_calc_low32(srv_data_file_sizes[i]),
- srv_calc_high32(srv_data_file_sizes[i]));
+ (os_offset_t) srv_data_file_sizes[i]
+ << UNIV_PAGE_SIZE_SHIFT);
if (!ret) {
fprintf(stderr,
@@ -970,8 +941,7 @@ skip_size_check:
return(DB_ERROR);
}
- *sum_of_new_sizes = *sum_of_new_sizes
- + srv_data_file_sizes[i];
+ *sum_of_new_sizes += srv_data_file_sizes[i];
}
ret = os_file_close(files[i]);
@@ -1464,7 +1434,7 @@ innobase_start_or_create_for_mysql(void)
if (sum_of_new_sizes < 10485760 / UNIV_PAGE_SIZE) {
ut_print_timestamp(stderr);
fprintf(stderr,
- " InnoDB: Error: tablespace size must be"
+ " InnoDB: Error: tablesapce size must be"
" at least 10 MB\n");
return(DB_ERROR);
=== modified file 'storage/innobase/trx/trx0purge.c'
--- a/storage/innobase/trx/trx0purge.c 2011-04-28 07:33:49 +0000
+++ b/storage/innobase/trx/trx0purge.c 2011-05-19 09:19:12 +0000
@@ -80,25 +80,6 @@ trx_purge_fetch_next_rec(
handled */
mem_heap_t* heap); /*!< in: memory heap where copied */
-/*****************************************************************//**
-Checks if trx_id is >= purge_view: then it is guaranteed that its update
-undo log still exists in the system.
-@return TRUE if is sure that it is preserved, also if the function
-returns FALSE, it is possible that the undo log still exists in the
-system */
-UNIV_INTERN
-ibool
-trx_purge_update_undo_must_exist(
-/*=============================*/
- trx_id_t trx_id) /*!< in: transaction id */
-{
-#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
-
- return(!read_view_sees_trx_id(purge_sys->view, trx_id));
-}
-
/****************************************************************//**
Builds a purge 'query' graph. The actual purge is performed by executing
this query graph.
@@ -837,6 +818,7 @@ trx_purge_get_next_rec(
mtr_t mtr;
ut_ad(purge_sys->next_stored);
+ ut_ad(purge_sys->iter.trx_no < purge_sys->view->low_limit_no);
space = purge_sys->rseg->space;
zip_size = purge_sys->rseg->zip_size;
@@ -954,9 +936,6 @@ trx_purge_fetch_next_rec(
handled */
mem_heap_t* heap) /*!< in: memory heap where copied */
{
- const read_view_t* view = purge_sys->view;
- const purge_iter_t iter = purge_sys->iter;
-
if (!purge_sys->next_stored) {
trx_purge_choose_next_log();
@@ -972,7 +951,7 @@ trx_purge_fetch_next_rec(
}
}
- if (iter.trx_no >= view->low_limit_no) {
+ if (purge_sys->iter.trx_no >= purge_sys->view->low_limit_no) {
return(NULL);
}
@@ -984,8 +963,6 @@ trx_purge_fetch_next_rec(
FALSE, purge_sys->rseg->id,
purge_sys->page_no, purge_sys->offset);
- ut_ad(iter.trx_no < view->low_limit_no);
-
/* The following call will advance the stored values of the
purge iterator. */
=== modified file 'storage/innobase/trx/trx0rec.c'
--- a/storage/innobase/trx/trx0rec.c 2011-05-02 16:18:01 +0000
+++ b/storage/innobase/trx/trx0rec.c 2011-05-04 11:29:29 +0000
@@ -36,6 +36,7 @@ Created 3/26/1996 Heikki Tuuri
#ifndef UNIV_HOTBACKUP
#include "dict0dict.h"
#include "ut0mem.h"
+#include "read0read.h"
#include "row0ext.h"
#include "row0upd.h"
#include "que0que.h"
@@ -1383,11 +1384,13 @@ trx_undo_get_undo_rec(
trx_undo_rec_t** undo_rec, /*!< out, own: copy of the record */
mem_heap_t* heap) /*!< in: memory heap where copied */
{
-#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
-#endif /* UNIV_SYNC_DEBUG */
+ ibool missing_history;
+
+ rw_lock_s_lock(&purge_sys->latch);
+ missing_history = read_view_sees_trx_id(purge_sys->view, trx_id);
+ rw_lock_s_unlock(&purge_sys->latch);
- if (!trx_purge_update_undo_must_exist(trx_id)) {
+ if (UNIV_UNLIKELY(missing_history)) {
/* It may be that the necessary undo log has already been
deleted */
@@ -1407,10 +1410,10 @@ trx_undo_get_undo_rec(
#endif /* UNIV_DEBUG */
/*******************************************************************//**
-Build a previous version of a clustered index record. This function checks
-that the caller has a latch on the index page of the clustered index record
-and an s-latch on the purge_view. This guarantees that the stack of versions
-is locked all the way down to the purge_view.
+Build a previous version of a clustered index record. The caller must
+hold a latch on the index page of the clustered index record, to
+guarantee that the stack of versions is locked all the way down to the
+purge_sys->view.
@return DB_SUCCESS, or DB_MISSING_HISTORY if the previous version is
earlier than purge_view, which means that it may have been removed */
UNIV_INTERN
@@ -1451,7 +1454,7 @@ trx_undo_prev_version_build(
byte* buf;
ulint err;
#ifdef UNIV_SYNC_DEBUG
- ut_ad(rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
+ ut_ad(!rw_lock_own(&purge_sys->latch, RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
ut_ad(mtr_memo_contains_page(index_mtr, index_rec, MTR_MEMO_PAGE_S_FIX)
|| mtr_memo_contains_page(index_mtr, index_rec,
=== modified file 'storage/innobase/ut/ut0ut.c'
--- a/storage/innobase/ut/ut0ut.c 2011-04-27 21:49:19 +0000
+++ b/storage/innobase/ut/ut0ut.c 2011-05-17 11:42:10 +0000
@@ -93,26 +93,6 @@ reimplement this function. */
#define ut_gettimeofday gettimeofday
#endif
-/********************************************************//**
-Gets the high 32 bits in a ulint. That is makes a shift >> 32,
-but since there seem to be compiler bugs in both gcc and Visual C++,
-we do this by a special conversion.
-@return a >> 32 */
-UNIV_INTERN
-ulint
-ut_get_high32(
-/*==========*/
- ulint a) /*!< in: ulint */
-{
- ib_int64_t i;
-
- i = (ib_int64_t)a;
-
- i = i >> 32;
-
- return((ulint)i);
-}
-
/**********************************************************//**
Returns system time. We do not specify the format of the time returned:
the only way to manipulate it is to use the function ut_difftime.
=== modified file 'strings/ctype-uca.c'
--- a/strings/ctype-uca.c 2011-03-09 20:54:55 +0000
+++ b/strings/ctype-uca.c 2011-05-21 08:25:33 +0000
@@ -21974,7 +21974,7 @@ create_tailoring(CHARSET_INFO *cs, MY_CH
{
my_snprintf(loader->error, sizeof(loader->error),
"Can't reset before "
- "a primary ignorable character U+%04X", r->base[0]);
+ "a primary ignorable character U+%04lX", r->base[0]);
rc= 1;
goto ex;
}
=== modified file 'unittest/gunit/mdl-t.cc'
--- a/unittest/gunit/mdl-t.cc 2011-01-27 15:31:18 +0000
+++ b/unittest/gunit/mdl-t.cc 2011-05-19 09:47:59 +0000
@@ -40,6 +40,18 @@ mysql_mutex_t LOCK_open;
uint opt_debug_sync_timeout= 0;
/*
+ Mock thd_wait_begin/end functions
+*/
+
+extern "C" void thd_wait_begin(MYSQL_THD thd, int wait_type)
+{
+}
+
+extern "C" void thd_wait_end(MYSQL_THD thd)
+{
+}
+
+/*
A mock error handler.
*/
static uint expected_error= 0;
=== modified file 'unittest/gunit/mdl_mytap-t.cc'
--- a/unittest/gunit/mdl_mytap-t.cc 2011-01-27 15:31:18 +0000
+++ b/unittest/gunit/mdl_mytap-t.cc 2011-05-19 09:47:59 +0000
@@ -93,6 +93,17 @@ do { \
EXPECT_TRUE(1 == 0)
+/*
+ Mock thd_wait_begin/end functions
+*/
+
+extern "C" void thd_wait_begin(MYSQL_THD thd, int wait_type)
+{
+}
+
+extern "C" void thd_wait_end(MYSQL_THD thd)
+{
+}
/*
A mock error handler.
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (tor.didriksen:3325 to 3327) | Tor Didriksen | 26 May |