summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/client_priv.h2
-rw-r--r--client/mysqlcheck.c13
-rw-r--r--client/mysqldump.c596
-rw-r--r--client/mysqltest.c8
-rw-r--r--extra/yassl/README8
-rw-r--r--extra/yassl/include/buffer.hpp3
-rw-r--r--extra/yassl/include/crypto_wrapper.hpp6
-rw-r--r--extra/yassl/include/lock.hpp2
-rw-r--r--extra/yassl/include/openssl/ssl.h18
-rw-r--r--extra/yassl/include/socket_wrapper.hpp10
-rw-r--r--extra/yassl/include/yassl.hpp2
-rw-r--r--extra/yassl/include/yassl_imp.hpp17
-rw-r--r--extra/yassl/include/yassl_int.hpp1
-rw-r--r--extra/yassl/src/crypto_wrapper.cpp2
-rw-r--r--extra/yassl/src/ssl.cpp5
-rw-r--r--extra/yassl/taocrypt/README13
-rw-r--r--extra/yassl/taocrypt/benchmark/benchmark.cpp32
-rw-r--r--extra/yassl/taocrypt/include/algebra.hpp3
-rw-r--r--extra/yassl/taocrypt/include/des.hpp1
-rw-r--r--extra/yassl/taocrypt/include/hash.hpp36
-rw-r--r--extra/yassl/taocrypt/include/hmac.hpp4
-rw-r--r--extra/yassl/taocrypt/include/misc.hpp19
-rw-r--r--extra/yassl/taocrypt/include/modarith.hpp4
-rw-r--r--extra/yassl/taocrypt/include/modes.hpp4
-rw-r--r--extra/yassl/taocrypt/include/rsa.hpp34
-rw-r--r--extra/yassl/taocrypt/include/sha.hpp97
-rw-r--r--extra/yassl/taocrypt/include/type_traits.hpp6
-rw-r--r--extra/yassl/taocrypt/include/types.hpp3
-rw-r--r--extra/yassl/taocrypt/mySTL/algorithm.hpp2
-rw-r--r--extra/yassl/taocrypt/mySTL/list.hpp16
-rw-r--r--extra/yassl/taocrypt/src/aes.cpp11
-rw-r--r--extra/yassl/taocrypt/src/algebra.cpp6
-rw-r--r--extra/yassl/taocrypt/src/asn.cpp8
-rw-r--r--extra/yassl/taocrypt/src/hash.cpp85
-rw-r--r--extra/yassl/taocrypt/src/integer.cpp2
-rw-r--r--extra/yassl/taocrypt/src/sha.cpp410
-rw-r--r--extra/yassl/taocrypt/test/test.cpp261
-rw-r--r--extra/yassl/testsuite/testsuite.cpp19
-rw-r--r--include/my_time.h2
-rw-r--r--include/mysql.h2
-rw-r--r--include/violite.h3
-rw-r--r--mysql-test/include/gis_generic.inc71
-rw-r--r--mysql-test/lib/mtr_cases.pl11
-rw-r--r--mysql-test/lib/mtr_process.pl45
-rwxr-xr-xmysql-test/mysql-test-run.pl111
-rw-r--r--mysql-test/r/archive_gis.result88
-rw-r--r--mysql-test/r/crash_commit_before.result1
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/date_formats.result61
-rw-r--r--mysql-test/r/func_group.result9
-rw-r--r--mysql-test/r/func_str.result9
-rw-r--r--mysql-test/r/gis.result88
-rw-r--r--mysql-test/r/information_schema.result2
-rw-r--r--mysql-test/r/innodb.result18
-rw-r--r--mysql-test/r/innodb_gis.result88
-rw-r--r--mysql-test/r/log_tables-big.result29
-rw-r--r--mysql-test/r/mysqlbinlog.result14
-rw-r--r--mysql-test/r/mysqldump.result89
-rw-r--r--mysql-test/r/ndb_gis.result180
-rw-r--r--mysql-test/r/openssl_1.result2
-rw-r--r--mysql-test/r/rpl_000015.result14
-rw-r--r--mysql-test/r/rpl_change_master.result8
-rw-r--r--mysql-test/r/rpl_deadlock_innodb.result3
-rw-r--r--mysql-test/r/rpl_empty_master_crash.result2
-rw-r--r--mysql-test/r/rpl_extraCol_innodb.result8
-rw-r--r--mysql-test/r/rpl_extraCol_myisam.result8
-rw-r--r--mysql-test/r/rpl_flushlog_loop.result1
-rw-r--r--mysql-test/r/rpl_ignore_table.result108
-rw-r--r--mysql-test/r/rpl_incident.result2
-rw-r--r--mysql-test/r/rpl_known_bugs_detection.result2
-rw-r--r--mysql-test/r/rpl_loaddata.result12
-rw-r--r--mysql-test/r/rpl_log_pos.result16
-rw-r--r--mysql-test/r/rpl_ndb_basic.result1
-rw-r--r--mysql-test/r/rpl_ndb_extraCol.result8
-rw-r--r--mysql-test/r/rpl_ndb_idempotent.result12
-rw-r--r--mysql-test/r/rpl_ndb_log.result4
-rw-r--r--mysql-test/r/rpl_ndb_sync.result4
-rw-r--r--mysql-test/r/rpl_openssl.result31
-rw-r--r--mysql-test/r/rpl_rbr_to_sbr.result1
-rw-r--r--mysql-test/r/rpl_redirect.result2
-rw-r--r--mysql-test/r/rpl_replicate_do.result4
-rw-r--r--mysql-test/r/rpl_rotate_logs.result12
-rw-r--r--mysql-test/r/rpl_row_inexist_tbl.result1
-rw-r--r--mysql-test/r/rpl_row_log.result4
-rw-r--r--mysql-test/r/rpl_row_log_innodb.result4
-rw-r--r--mysql-test/r/rpl_row_max_relay_size.result6
-rw-r--r--mysql-test/r/rpl_row_reset_slave.result16
-rw-r--r--mysql-test/r/rpl_row_tabledefs_2myisam.result6
-rw-r--r--mysql-test/r/rpl_row_tabledefs_3innodb.result6
-rw-r--r--mysql-test/r/rpl_row_until.result16
-rw-r--r--mysql-test/r/rpl_server_id1.result4
-rw-r--r--mysql-test/r/rpl_server_id2.result4
-rw-r--r--mysql-test/r/rpl_slave_status.result1
-rw-r--r--mysql-test/r/rpl_ssl.result5
-rw-r--r--mysql-test/r/rpl_ssl1.result146
-rw-r--r--mysql-test/r/rpl_stm_log.result4
-rw-r--r--mysql-test/r/rpl_stm_max_relay_size.result6
-rw-r--r--mysql-test/r/rpl_stm_reset_slave.result16
-rw-r--r--mysql-test/r/rpl_stm_until.result4
-rw-r--r--mysql-test/r/sp-code.result2
-rw-r--r--mysql-test/r/strict.result55
-rw-r--r--mysql-test/r/type_date.result2
-rw-r--r--mysql-test/r/type_datetime.result4
-rw-r--r--mysql-test/r/type_year.result12
-rw-r--r--mysql-test/r/udf.result2
-rw-r--r--mysql-test/t/crash_commit_before.test3
-rw-r--r--mysql-test/t/create.test5
-rw-r--r--mysql-test/t/func_group.test11
-rw-r--r--mysql-test/t/func_str.test4
-rw-r--r--mysql-test/t/gis.test70
-rw-r--r--mysql-test/t/innodb.test29
-rw-r--r--mysql-test/t/log_state.test1
-rw-r--r--mysql-test/t/log_tables-big-master.opt1
-rw-r--r--mysql-test/t/log_tables-big.test35
-rw-r--r--mysql-test/t/mysqlbinlog.test4
-rw-r--r--mysql-test/t/mysqldump.test68
-rw-r--r--mysql-test/t/openssl_1.test9
-rw-r--r--mysql-test/t/rpl_ignore_table.test110
-rw-r--r--mysql-test/t/rpl_packet.test6
-rw-r--r--mysql-test/t/rpl_ssl.test9
-rw-r--r--mysql-test/t/rpl_ssl1.test (renamed from mysql-test/t/rpl_openssl.test)36
-rw-r--r--mysql-test/t/sp.test12
-rw-r--r--mysql-test/t/ssl_des-master.opt1
-rw-r--r--mysql-test/t/strict.test58
-rw-r--r--mysql-test/t/type_year.test10
-rw-r--r--mysys/mf_tempfile.c132
-rw-r--r--mysys/my_malloc.c2
-rw-r--r--mysys/my_pthread.c2
-rw-r--r--mysys/my_static.c5
-rw-r--r--mysys/my_static.h4
-rw-r--r--mysys/safemalloc.c4
-rwxr-xr-xscripts/make_win_bin_dist1
-rw-r--r--scripts/mysql_install_db.sh28
-rw-r--r--sql-common/client.c4
-rw-r--r--sql-common/my_time.c7
-rw-r--r--sql/field.cc363
-rw-r--r--sql/field.h7
-rw-r--r--sql/item.h11
-rw-r--r--sql/item_create.cc14
-rw-r--r--sql/item_create.h3
-rw-r--r--sql/item_func.cc9
-rw-r--r--sql/item_strfunc.cc2
-rw-r--r--sql/item_sum.cc32
-rw-r--r--sql/lex.h1
-rw-r--r--sql/log.cc113
-rw-r--r--sql/log_event.cc27
-rw-r--r--sql/mysqld.cc12
-rw-r--r--sql/repl_failsafe.cc4
-rw-r--r--sql/rpl_mi.cc72
-rw-r--r--sql/rpl_mi.h1
-rw-r--r--sql/slave.cc9
-rw-r--r--sql/sp.cc2
-rw-r--r--sql/sp_head.h6
-rw-r--r--sql/spatial.h43
-rw-r--r--sql/sql_lex.h12
-rw-r--r--sql/sql_repl.cc8
-rw-r--r--sql/sql_show.cc9
-rw-r--r--sql/sql_yacc.yy15
-rw-r--r--sql/time.cc5
-rw-r--r--storage/innobase/Makefile.am2
-rw-r--r--storage/innobase/buf/buf0buf.c7
-rw-r--r--storage/innobase/buf/buf0flu.c9
-rw-r--r--storage/innobase/buf/buf0lru.c17
-rw-r--r--storage/innobase/dict/dict0boot.c2
-rw-r--r--storage/innobase/dict/dict0crea.c20
-rw-r--r--storage/innobase/dict/dict0dict.c72
-rw-r--r--storage/innobase/dict/dict0load.c22
-rw-r--r--storage/innobase/fil/fil0fil.c17
-rw-r--r--storage/innobase/fsp/fsp0fsp.c21
-rw-r--r--storage/innobase/ha/ha0ha.c11
-rw-r--r--storage/innobase/handler/ha_innodb.cc565
-rw-r--r--storage/innobase/handler/ha_innodb.h117
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.c15
-rw-r--r--storage/innobase/include/buf0buf.ic11
-rw-r--r--storage/innobase/include/buf0flu.ic2
-rw-r--r--storage/innobase/include/dict0dict.ic6
-rw-r--r--storage/innobase/include/ha0ha.ic8
-rw-r--r--storage/innobase/include/lock0lock.ic2
-rw-r--r--storage/innobase/include/log0log.ic4
-rw-r--r--storage/innobase/include/mem0mem.h11
-rw-r--r--storage/innobase/include/mem0mem.ic35
-rw-r--r--storage/innobase/include/rem0rec.ic3
-rw-r--r--storage/innobase/include/sync0rw.ic3
-rw-r--r--storage/innobase/include/sync0sync.h43
-rw-r--r--storage/innobase/include/sync0sync.ic51
-rw-r--r--storage/innobase/include/trx0sys.ic20
-rw-r--r--storage/innobase/include/trx0trx.h13
-rw-r--r--storage/innobase/include/univ.i12
-rw-r--r--storage/innobase/include/ut0lst.h3
-rw-r--r--storage/innobase/lock/lock0lock.c121
-rw-r--r--storage/innobase/log/log0log.c56
-rw-r--r--storage/innobase/log/log0recv.c11
-rw-r--r--storage/innobase/mem/mem0pool.c2
-rw-r--r--storage/innobase/os/os0file.c6
-rw-r--r--storage/innobase/pars/pars0pars.c3
-rw-r--r--storage/innobase/que/que0que.c15
-rw-r--r--storage/innobase/read/read0read.c10
-rw-r--r--storage/innobase/row/row0mysql.c12
-rw-r--r--storage/innobase/row/row0undo.c14
-rw-r--r--storage/innobase/row/row0vers.c2
-rw-r--r--storage/innobase/srv/srv0que.c3
-rw-r--r--storage/innobase/srv/srv0srv.c16
-rw-r--r--storage/innobase/sync/sync0rw.c9
-rw-r--r--storage/innobase/sync/sync0sync.c56
-rw-r--r--storage/innobase/thr/thr0loc.c2
-rw-r--r--storage/innobase/trx/trx0purge.c21
-rw-r--r--storage/innobase/trx/trx0roll.c14
-rw-r--r--storage/innobase/trx/trx0rseg.c4
-rw-r--r--storage/innobase/trx/trx0sys.c6
-rw-r--r--storage/innobase/trx/trx0trx.c45
-rw-r--r--storage/innobase/trx/trx0undo.c34
-rw-r--r--storage/innobase/usr/usr0sess.c8
-rw-r--r--storage/innobase/ut/ut0ut.c59
-rw-r--r--vio/viosslfactories.c8
214 files changed, 4081 insertions, 2314 deletions
diff --git a/client/client_priv.h b/client/client_priv.h
index 4dbf3f7895b..9a678eb7d2a 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -67,5 +67,5 @@ enum options_client
OPT_SLAP_POST_QUERY,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT, OPT_SERVER_ID,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
- OPT_DEBUG_INFO, OPT_COLUMN_TYPES
+ OPT_DEBUG_INFO, OPT_COLUMN_TYPES, OPT_WRITE_BINLOG
};
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 1a9d07804b4..2f5d435d0a5 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -34,7 +34,8 @@ static my_bool opt_alldbs = 0, opt_check_only_changed = 0, opt_extended = 0,
opt_medium_check = 0, opt_quick = 0, opt_all_in_1 = 0,
opt_silent = 0, opt_auto_repair = 0, ignore_errors = 0,
tty_password= 0, opt_frm= 0, info_flag= 0,
- opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0;
+ opt_fix_table_names= 0, opt_fix_db_names= 0, opt_upgrade= 0,
+ opt_write_binlog= 1;
static uint verbose = 0, opt_mysql_port=0;
static my_string opt_mysql_unix_port = 0;
static char *opt_password = 0, *current_user = 0,
@@ -123,6 +124,10 @@ static struct my_option my_long_options[] =
{"medium-check", 'm',
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"write-binlog", OPT_WRITE_BINLOG,
+ "Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Enabled by default; use --skip-write-binlog when commands should not be sent to replication slaves.",
+ (gptr*) &opt_write_binlog, (gptr*) &opt_write_binlog, 0, GET_BOOL, NO_ARG,
+ 1, 0, 0, 0, 0, 0},
{"optimize", 'o', "Optimize table.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0,
0, 0},
{"password", 'p',
@@ -598,16 +603,16 @@ static int handle_request_for_tables(char *tables, uint length)
if (opt_upgrade) end = strmov(end, " FOR UPGRADE");
break;
case DO_REPAIR:
- op = "REPAIR";
+ op= (opt_write_binlog) ? "REPAIR" : "REPAIR NO_WRITE_TO_BINLOG";
if (opt_quick) end = strmov(end, " QUICK");
if (opt_extended) end = strmov(end, " EXTENDED");
if (opt_frm) end = strmov(end, " USE_FRM");
break;
case DO_ANALYZE:
- op = "ANALYZE";
+ op= (opt_write_binlog) ? "ANALYZE" : "ANALYZE NO_WRITE_TO_BINLOG";
break;
case DO_OPTIMIZE:
- op = "OPTIMIZE";
+ op= (opt_write_binlog) ? "OPTIMIZE" : "OPTIMIZE NO_WRITE_TO_BINLOG";
break;
case DO_UPGRADE:
return fix_object_name("TABLE", tables);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index c86a2fc385f..1faeb0d6e0f 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -77,13 +77,13 @@
#define IGNORE_DATA 0x01 /* don't dump data for this table */
#define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */
-static char *add_load_option(char *ptr, const char *object,
- const char *statement);
+static void add_load_option(DYNAMIC_STRING *str, const char *option,
+ const char *option_value);
static ulong find_set(TYPELIB *lib, const char *x, uint length,
char **err_pos, uint *err_len);
static char *alloc_query_str(ulong size);
-static char *field_escape(char *to,const char *from,uint length);
+static void field_escape(DYNAMIC_STRING* in, const char *from);
static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0,
quick= 1, extended_insert= 1,
lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0,
@@ -125,6 +125,19 @@ FILE *md_result_file= 0;
static char *shared_memory_base_name=0;
#endif
static uint opt_protocol= 0;
+
+/*
+Dynamic_string wrapper functions. In this file use these
+wrappers, they will terminate the process if there is
+an allocation failure.
+*/
+static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
+ uint init_alloc, uint alloc_increment);
+static void dynstr_append_checked(DYNAMIC_STRING* dest, const char* src);
+static void dynstr_set_checked(DYNAMIC_STRING *str, const char *init_str);
+static void dynstr_append_mem_checked(DYNAMIC_STRING *str, const char *append,
+ uint length);
+static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size);
/*
Constant for detection of default value of default_charset.
If default_charset is equal to mysql_universal_client_charset, then
@@ -436,7 +449,9 @@ static struct my_option my_long_options[] =
static const char *load_default_groups[]= { "mysqldump","client",0 };
-static void safe_exit(int error);
+static void maybe_exit(int error);
+static void die(int error, const char* reason, ...);
+static void maybe_die(int error, const char* reason, ...);
static void write_header(FILE *sql_file, char *db_name);
static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row,
const char *prefix,const char *name,
@@ -495,11 +510,7 @@ static void verbose_msg(const char *fmt, ...)
void check_io(FILE *file)
{
if (ferror(file))
- {
- fprintf(stderr, "%s: Got errno %d on write\n", my_progname, errno);
- ignore_errors= 0; /* We can't ignore this error */
- safe_exit(EX_EOF);
- }
+ die(EX_EOF, "Got errno %d on write", errno);
}
static void print_version(void)
@@ -887,12 +898,74 @@ static int get_options(int *argc, char ***argv)
static void DB_error(MYSQL *mysql_arg, const char *when)
{
DBUG_ENTER("DB_error");
- fprintf(stderr, "%s: Got error: %d: %s %s\n", my_progname,
+ maybe_die(EX_MYSQLERR, "Got error: %d: %s %s",
mysql_errno(mysql_arg), mysql_error(mysql_arg), when);
- fflush(stderr);
- safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN;
-} /* DB_error */
+}
+
+
+
+/*
+ Prints out an error message and kills the process.
+
+ SYNOPSIS
+ die()
+ error_num - process return value
+ fmt_reason - a format string for use by my_vsnprintf.
+ ... - variable arguments for above fmt_reason string
+
+ DESCRIPTION
+ This call prints out the formatted error message to stderr and then
+ terminates the process.
+*/
+static void die(int error_num, const char* fmt_reason, ...)
+{
+ char buffer[1000];
+ va_list args;
+ va_start(args,fmt_reason);
+ my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args);
+ va_end(args);
+
+ fprintf(stderr, "%s: %s\n", my_progname, buffer);
+ fflush(stderr);
+
+ ignore_errors= 0; /* force the exit */
+ maybe_exit(error_num);
+}
+
+
+/*
+ Prints out an error message and maybe kills the process.
+
+ SYNOPSIS
+ maybe_die()
+ error_num - process return value
+ fmt_reason - a format string for use by my_vsnprintf.
+ ... - variable arguments for above fmt_reason string
+
+ DESCRIPTION
+ This call prints out the formatted error message to stderr and then
+ terminates the process, unless the --force command line option is used.
+
+ This call should be used for non-fatal errors (such as database
+ errors) that the code may still be able to continue to the next unit
+ of work.
+
+*/
+static void maybe_die(int error_num, const char* fmt_reason, ...)
+{
+ char buffer[1000];
+ va_list args;
+ va_start(args,fmt_reason);
+ my_vsnprintf(buffer, sizeof(buffer), fmt_reason, args);
+ va_end(args);
+
+ fprintf(stderr, "%s: %s\n", my_progname, buffer);
+ fflush(stderr);
+
+ maybe_exit(error_num);
+}
+
/*
@@ -917,10 +990,8 @@ static int mysql_query_with_error_report(MYSQL *mysql_con, MYSQL_RES **res,
if (mysql_query(mysql_con, query) ||
(res && !((*res)= mysql_store_result(mysql_con))))
{
- fprintf(stderr, "%s: Couldn't execute '%s': %s (%d)\n",
- my_progname, query,
- mysql_error(mysql_con), mysql_errno(mysql_con));
- safe_exit(EX_MYSQLERR);
+ maybe_die(EX_MYSQLERR, "Couldn't execute '%s': %s (%d)",
+ query, mysql_error(mysql_con), mysql_errno(mysql_con));
return 1;
}
return 0;
@@ -965,7 +1036,7 @@ static void free_resources()
}
-static void safe_exit(int error)
+static void maybe_exit(int error)
{
if (!first_error)
first_error= error;
@@ -1025,10 +1096,7 @@ static int connect_to_db(char *host, char *user,char *passwd)
my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */",
compatible_mode_normal_str);
if (mysql_query_with_error_report(mysql, 0, buff))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
- }
/*
set time_zone to UTC to allow dumping date types between servers with
different time zone settings
@@ -1037,10 +1105,7 @@ static int connect_to_db(char *host, char *user,char *passwd)
{
my_snprintf(buff, sizeof(buff), "/*!40103 SET TIME_ZONE='+00:00' */");
if (mysql_query_with_error_report(mysql, 0, buff))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
- }
}
DBUG_RETURN(0);
} /* connect_to_db */
@@ -1061,10 +1126,8 @@ static void unescape(FILE *file,char *pos,uint length)
char *tmp;
DBUG_ENTER("unescape");
if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME))))
- {
- ignore_errors=0; /* Fatal error */
- safe_exit(EX_MYSQLERR); /* Force exit */
- }
+ die(EX_MYSQLERR, "Couldn't allocate memory");
+
mysql_real_escape_string(&mysql_connection, tmp, pos, length);
fputc('\'', file);
fputs(tmp, file);
@@ -1423,10 +1486,7 @@ static uint dump_events_for_db(char *db)
mysql_query(mysql, "LOCK TABLES mysql.event READ");
if (mysql_query_with_error_report(mysql, &event_list_res, "show events"))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
- }
strcpy(delimiter, ";");
if (mysql_num_rows(event_list_res) > 0)
@@ -1468,11 +1528,11 @@ static uint dump_events_for_db(char *db)
fprintf(sql_file, "/*!50106 %s */ %s\n", row[3], delimiter);
}
} /* end of event printing */
+ mysql_free_result(event_res);
+
} /* end of list of events */
fprintf(sql_file, "DELIMITER ;\n");
fprintf(sql_file, "/*!50106 SET TIME_ZONE= @save_time_zone */ ;\n");
-
- mysql_free_result(event_res);
}
mysql_free_result(event_list_res);
@@ -1639,8 +1699,9 @@ static uint dump_routines_for_db(char *db)
my_free(query_str, MYF(MY_ALLOW_ZERO_PTR));
}
} /* end of routine printing */
+ mysql_free_result(routine_res);
+
} /* end of list of routines */
- mysql_free_result(routine_res);
}
mysql_free_result(routine_list_res);
} /* end of for i (0 .. 1) */
@@ -1701,11 +1762,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (!insert_pat_inited)
{
insert_pat_inited= 1;
- if (init_dynamic_string(&insert_pat, "", 1024, 1024))
- safe_exit(EX_MYSQLERR);
+ init_dynamic_string_checked(&insert_pat, "", 1024, 1024);
}
else
- dynstr_set(&insert_pat, "");
+ dynstr_set_checked(&insert_pat, "");
}
insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " :
@@ -1737,18 +1797,13 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_snprintf(buff, sizeof(buff), "show create table %s", result_table);
if (mysql_query_with_error_report(mysql, 0, buff))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
- }
if (path)
{
if (!(sql_file= open_sql_file_for_table(table)))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
- }
+
write_header(sql_file, db);
}
if (!opt_xml && opt_comments)
@@ -1812,7 +1867,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_free(scv_buff, MYF(MY_ALLOW_ZERO_PTR));
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
else
@@ -1875,7 +1929,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
if (path)
my_fclose(sql_file, MYF(MY_WME));
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
@@ -1888,21 +1941,21 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (write_data)
{
if (opt_replace_into)
- dynstr_append_mem(&insert_pat, "REPLACE ", 8);
+ dynstr_append_checked(&insert_pat, "REPLACE ");
else
- dynstr_append_mem(&insert_pat, "INSERT ", 7);
- dynstr_append(&insert_pat, insert_option);
- dynstr_append_mem(&insert_pat, "INTO ", 5);
- dynstr_append(&insert_pat, opt_quoted_table);
+ dynstr_append_checked(&insert_pat, "INSERT ");
+ dynstr_append_checked(&insert_pat, insert_option);
+ dynstr_append_checked(&insert_pat, "INTO ");
+ dynstr_append_checked(&insert_pat, opt_quoted_table);
if (complete_insert)
{
- dynstr_append_mem(&insert_pat, " (", 2);
+ dynstr_append_checked(&insert_pat, " (");
}
else
{
- dynstr_append_mem(&insert_pat, " VALUES ", 8);
+ dynstr_append_checked(&insert_pat, " VALUES ");
if (!extended_insert)
- dynstr_append_mem(&insert_pat, "(", 1);
+ dynstr_append_checked(&insert_pat, "(");
}
}
@@ -1912,10 +1965,10 @@ static uint get_table_structure(char *table, char *db, char *table_type,
{
if (init)
{
- dynstr_append_mem(&insert_pat, ", ", 2);
+ dynstr_append_checked(&insert_pat, ", ");
}
init=1;
- dynstr_append(&insert_pat,
+ dynstr_append_checked(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0));
}
}
@@ -1930,10 +1983,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_snprintf(query_buff, sizeof(query_buff), "show fields from %s",
result_table);
if (mysql_query_with_error_report(mysql, &result, query_buff))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
- }
/* Make an sql-file, if path was given iow. option -T was given */
if (!opt_no_create_info)
@@ -1941,10 +1991,7 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (path)
{
if (!(sql_file= open_sql_file_for_table(table)))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
- }
write_header(sql_file, db);
}
if (!opt_xml && opt_comments)
@@ -1963,19 +2010,19 @@ static uint get_table_structure(char *table, char *db, char *table_type,
if (write_data)
{
if (opt_replace_into)
- dynstr_append_mem(&insert_pat, "REPLACE ", 8);
+ dynstr_append_checked(&insert_pat, "REPLACE ");
else
- dynstr_append_mem(&insert_pat, "INSERT ", 7);
- dynstr_append(&insert_pat, insert_option);
- dynstr_append_mem(&insert_pat, "INTO ", 5);
- dynstr_append(&insert_pat, result_table);
- if (opt_complete_insert)
- dynstr_append_mem(&insert_pat, " (", 2);
+ dynstr_append_checked(&insert_pat, "INSERT ");
+ dynstr_append_checked(&insert_pat, insert_option);
+ dynstr_append_checked(&insert_pat, "INTO ");
+ dynstr_append_checked(&insert_pat, result_table);
+ if (complete_insert)
+ dynstr_append_checked(&insert_pat, " (");
else
{
- dynstr_append_mem(&insert_pat, " VALUES ", 8);
+ dynstr_append_checked(&insert_pat, " VALUES ");
if (!extended_insert)
- dynstr_append_mem(&insert_pat, "(", 1);
+ dynstr_append_checked(&insert_pat, "(");
}
}
@@ -1990,11 +2037,11 @@ static uint get_table_structure(char *table, char *db, char *table_type,
check_io(sql_file);
}
if (complete_insert)
- dynstr_append_mem(&insert_pat, ", ", 2);
+ dynstr_append_checked(&insert_pat, ", ");
}
init=1;
- if (opt_complete_insert)
- dynstr_append(&insert_pat,
+ if (complete_insert)
+ dynstr_append_checked(&insert_pat,
quote_name(row[SHOW_FIELDNAME], name_buff, 0));
if (!opt_no_create_info)
{
@@ -2044,7 +2091,6 @@ static uint get_table_structure(char *table, char *db, char *table_type,
my_progname, result_table, mysql_error(mysql));
if (path)
my_fclose(sql_file, MYF(MY_WME));
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
}
@@ -2152,11 +2198,11 @@ continue_xml:
check_io(sql_file);
}
}
- if (opt_complete_insert)
+ if (complete_insert)
{
- dynstr_append_mem(&insert_pat, ") VALUES ", 9);
+ dynstr_append_checked(&insert_pat, ") VALUES ");
if (!extended_insert)
- dynstr_append_mem(&insert_pat, "(", 1);
+ dynstr_append_checked(&insert_pat, "(");
}
if (sql_file != md_result_file)
{
@@ -2203,7 +2249,6 @@ static void dump_triggers_for_table(char *table,
{
if (path)
my_fclose(sql_file, MYF(MY_WME));
- safe_exit(EX_MYSQLERR);
DBUG_VOID_RETURN;
}
if (mysql_num_rows(result))
@@ -2262,24 +2307,28 @@ DELIMITER ;;\n");
DBUG_VOID_RETURN;
}
-static char *add_load_option(char *ptr,const char *object,
- const char *statement)
+static void add_load_option(DYNAMIC_STRING *str, const char *option,
+ const char *option_value)
{
- if (object)
+ if (!option_value)
{
- /* Don't escape hex constants */
- if (object[0] == '0' && (object[1] == 'x' || object[1] == 'X'))
- ptr= strxmov(ptr," ",statement," ",object,NullS);
- else
- {
- /* char constant; escape */
- ptr= strxmov(ptr," ",statement," '",NullS);
- ptr= field_escape(ptr,object,(uint) strlen(object));
- *ptr++= '\'';
- }
+ /* Null value means we don't add this option. */
+ return;
}
- return ptr;
-} /* add_load_option */
+
+ dynstr_append_checked(str, option);
+
+ if (strncmp(option_value, "0x", sizeof("0x")-1) == 0)
+ {
+ /* It's a hex constant, don't escape */
+ dynstr_append_checked(str, option_value);
+ }
+ else
+ {
+ /* char constant; escape */
+ field_escape(str, option_value);
+ }
+}
/*
@@ -2289,28 +2338,36 @@ static char *add_load_option(char *ptr,const char *object,
syntax errors from the SQL parser.
*/
-static char *field_escape(char *to,const char *from,uint length)
+static void field_escape(DYNAMIC_STRING* in, const char *from)
{
- const char *end;
- uint end_backslashes=0;
+ uint end_backslashes= 0;
- for (end= from+length; from != end; from++)
+ dynstr_append_checked(in, "'");
+
+ while (*from)
{
- *to++= *from;
+ dynstr_append_mem_checked(in, from, 1);
+
if (*from == '\\')
end_backslashes^=1; /* find odd number of backslashes */
else
{
if (*from == '\'' && !end_backslashes)
- *to++= *from; /* We want a duplicate of "'" for MySQL */
+ {
+ /* We want a duplicate of "'" for MySQL */
+ dynstr_append_checked(in, "\'");
+ }
end_backslashes=0;
}
+ from++;
}
/* Add missing backslashes if user has specified odd number of backs.*/
if (end_backslashes)
- *to++= '\\';
- return to;
-} /* field_escape */
+ dynstr_append_checked(in, "\\");
+
+ dynstr_append_checked(in, "'");
+}
+
static char *alloc_query_str(ulong size)
@@ -2318,10 +2375,8 @@ static char *alloc_query_str(ulong size)
char *query;
if (!(query= (char*) my_malloc(size, MYF(MY_WME))))
- {
- ignore_errors= 0; /* Fatal error */
- safe_exit(EX_MYSQLERR); /* Force exit */
- }
+ die(EX_MYSQLERR, "Couldn't allocate a query string.");
+
return query;
}
@@ -2341,13 +2396,14 @@ static char *alloc_query_str(ulong size)
void
*/
+
static void dump_table(char *table, char *db)
{
char ignore_flag;
- char query_buf[QUERY_LENGTH], *end, buff[256],table_buff[NAME_LEN+3];
+ char buf[200], table_buff[NAME_LEN+3];
+ DYNAMIC_STRING query_string;
char table_type[NAME_LEN];
char *result_table, table_buff2[NAME_LEN*2+3], *opt_quoted_table;
- char *query= query_buf;
int error= 0;
ulong rownr, row_break, total_length, init_length;
uint num_fields;
@@ -2401,44 +2457,69 @@ static void dump_table(char *table, char *db)
opt_quoted_table= quote_name(table, table_buff2, 0);
verbose_msg("-- Sending SELECT query...\n");
+
+ init_dynamic_string_checked(&query_string, "", 1024, 1024);
+
if (path)
{
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
- convert_dirname(tmp_path,path,NullS);
+
+ if (strlen(path) >= FN_REFLEN)
+ {
+ /*
+ This check is made because the some the file functions below
+ have FN_REFLEN sized stack allocated buffers and will cause
+ a crash even if the input destination buffer is large enough
+ to hold the output.
+ */
+ die(EX_USAGE, "Input filename or options too long: %s", path);
+ }
+
+ /*
+ Convert the path to native os format
+ and resolve to the full filepath.
+ */
+ convert_dirname(tmp_path,path,NullS);
my_load_path(tmp_path, tmp_path, NULL);
- fn_format(filename, table, tmp_path, ".txt", 4);
- my_delete(filename, MYF(0)); /* 'INTO OUTFILE' doesn't work, if
- filename wasn't deleted */
+ fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
+
+ /* Must delete the file that 'INTO OUTFILE' will write to */
+ my_delete(filename, MYF(0));
+
+ /* convert to a unix path name to stick into the query */
to_unix_path(filename);
- my_snprintf(query, QUERY_LENGTH,
- "SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '%s'",
- filename);
- end= strend(query);
+
+ /* now build the query string */
+
+ dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '");
+ dynstr_append_checked(&query_string, filename);
+ dynstr_append_checked(&query_string, "'");
if (fields_terminated || enclosed || opt_enclosed || escaped)
- end= strmov(end, " FIELDS");
- end= add_load_option(end, fields_terminated, " TERMINATED BY");
- end= add_load_option(end, enclosed, " ENCLOSED BY");
- end= add_load_option(end, opt_enclosed, " OPTIONALLY ENCLOSED BY");
- end= add_load_option(end, escaped, " ESCAPED BY");
- end= add_load_option(end, lines_terminated, " LINES TERMINATED BY");
- *end= '\0';
-
- my_snprintf(buff, sizeof(buff), " FROM %s", result_table);
- end= strmov(end,buff);
- if (where || order_by)
+ dynstr_append_checked(&query_string, " FIELDS");
+
+ add_load_option(&query_string, " TERMINATED BY ", fields_terminated);
+ add_load_option(&query_string, " ENCLOSED BY ", enclosed);
+ add_load_option(&query_string, " OPTIONALLY ENCLOSED BY ", opt_enclosed);
+ add_load_option(&query_string, " ESCAPED BY ", escaped);
+ add_load_option(&query_string, " LINES TERMINATED BY ", lines_terminated);
+
+ dynstr_append_checked(&query_string, " FROM ");
+ dynstr_append_checked(&query_string, result_table);
+
+ if (where)
+ {
+ dynstr_append_checked(&query_string, " WHERE ");
+ dynstr_append_checked(&query_string, where);
+ }
+
+ if (order_by)
{
- query= alloc_query_str((ulong) ((end - query) + 1 +
- (where ? strlen(where) + 7 : 0) +
- (order_by ? strlen(order_by) + 10 : 0)));
- end= strmov(query, query_buf);
-
- if (where)
- end= strxmov(end, " WHERE ", where, NullS);
- if (order_by)
- end= strxmov(end, " ORDER BY ", order_by, NullS);
+ dynstr_append_checked(&query_string, " ORDER BY ");
+ dynstr_append_checked(&query_string, order_by);
}
- if (mysql_real_query(mysql, query, (uint) (end - query)))
+
+ if (mysql_real_query(mysql, query_string.str, query_string.length))
{
DB_error(mysql, "when executing 'SELECT INTO OUTFILE'");
DBUG_VOID_RETURN;
@@ -2452,41 +2533,38 @@ static void dump_table(char *table, char *db)
result_table);
check_io(md_result_file);
}
- my_snprintf(query, QUERY_LENGTH,
- "SELECT /*!40001 SQL_NO_CACHE */ * FROM %s",
- result_table);
- if (where || order_by)
- {
- query= alloc_query_str((ulong) (strlen(query) + 1 +
- (where ? strlen(where) + 7 : 0) +
- (order_by ? strlen(order_by) + 10 : 0)));
- end= strmov(query, query_buf);
+
+ dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
+ dynstr_append_checked(&query_string, result_table);
- if (where)
+ if (where)
+ {
+ if (!opt_xml && opt_comments)
{
- if (!opt_xml && opt_comments)
- {
- fprintf(md_result_file, "-- WHERE: %s\n", where);
- check_io(md_result_file);
- }
- end= strxmov(end, " WHERE ", where, NullS);
+ fprintf(md_result_file, "-- WHERE: %s\n", where);
+ check_io(md_result_file);
}
- if (order_by)
+
+ dynstr_append_checked(&query_string, " WHERE ");
+ dynstr_append_checked(&query_string, where);
+ }
+ if (order_by)
+ {
+ if (!opt_xml && opt_comments)
{
- if (!opt_xml && opt_comments)
- {
- fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
- check_io(md_result_file);
- }
- end= strxmov(end, " ORDER BY ", order_by, NullS);
+ fprintf(md_result_file, "-- ORDER BY: %s\n", order_by);
+ check_io(md_result_file);
}
+ dynstr_append_checked(&query_string, " ORDER BY ");
+ dynstr_append_checked(&query_string, order_by);
}
+
if (!opt_xml && !opt_compact)
{
fputs("\n", md_result_file);
check_io(md_result_file);
}
- if (mysql_query_with_error_report(mysql, 0, query))
+ if (mysql_query_with_error_report(mysql, 0, query_string.str))
{
DB_error(mysql, "when retrieving data from server");
goto err;
@@ -2560,14 +2638,9 @@ static void dump_table(char *table, char *db)
ulong length= lengths[i];
if (!(field= mysql_fetch_field(res)))
- {
- my_snprintf(query, QUERY_LENGTH,
- "%s: Not enough fields from table %s! Aborting.\n",
- my_progname, result_table);
- fputs(query,stderr);
- error= EX_CONSCHECK;
- goto err;
- }
+ die(EX_CONSCHECK,
+ "Not enough fields from table %s! Aborting.\n",
+ result_table);
/*
63 is my_charset_bin. If charsetnr is not 63,
@@ -2586,9 +2659,9 @@ static void dump_table(char *table, char *db)
if (extended_insert && !opt_xml)
{
if (i == 0)
- dynstr_set(&extended_row,"(");
+ dynstr_set_checked(&extended_row,"(");
else
- dynstr_append(&extended_row,",");
+ dynstr_append_checked(&extended_row,",");
if (row[i])
{
@@ -2603,15 +2676,10 @@ static void dump_table(char *table, char *db)
- In non-HEX mode we need up to 2 bytes per character,
plus 2 bytes for leading and trailing '\'' characters.
*/
- if (dynstr_realloc(&extended_row,length * 2+2))
- {
- fputs("Aborting dump (out of memory)",stderr);
- error= EX_EOM;
- goto err;
- }
+ dynstr_realloc_checked(&extended_row,length * 2+2);
if (opt_hex_blob && is_blob)
{
- dynstr_append(&extended_row, "0x");
+ dynstr_append_checked(&extended_row, "0x");
extended_row.length+= mysql_hex_string(extended_row.str +
extended_row.length,
row[i], length);
@@ -2619,13 +2687,13 @@ static void dump_table(char *table, char *db)
}
else
{
- dynstr_append(&extended_row,"'");
+ dynstr_append_checked(&extended_row,"'");
extended_row.length +=
mysql_real_escape_string(&mysql_connection,
&extended_row.str[extended_row.length],
row[i],length);
extended_row.str[extended_row.length]='\0';
- dynstr_append(&extended_row,"'");
+ dynstr_append_checked(&extended_row,"'");
}
}
else
@@ -2634,30 +2702,26 @@ static void dump_table(char *table, char *db)
char *ptr= row[i];
if (my_isalpha(charset_info, *ptr) || (*ptr == '-' &&
my_isalpha(charset_info, ptr[1])))
- dynstr_append(&extended_row, "NULL");
+ dynstr_append_checked(&extended_row, "NULL");
else
{
if (field->type == MYSQL_TYPE_DECIMAL)
{
/* add " signs around */
- dynstr_append(&extended_row, "'");
- dynstr_append(&extended_row, ptr);
- dynstr_append(&extended_row, "'");
+ dynstr_append_checked(&extended_row, "'");
+ dynstr_append_checked(&extended_row, ptr);
+ dynstr_append_checked(&extended_row, "'");
}
else
- dynstr_append(&extended_row, ptr);
+ dynstr_append_checked(&extended_row, ptr);
}
}
}
else
- dynstr_append(&extended_row,"''");
- }
- else if (dynstr_append(&extended_row,"NULL"))
- {
- fputs("Aborting dump (out of memory)",stderr);
- error= EX_EOM;
- goto err;
+ dynstr_append_checked(&extended_row,"''");
}
+ else
+ dynstr_append_checked(&extended_row,"NULL");
}
else
{
@@ -2743,7 +2807,7 @@ static void dump_table(char *table, char *db)
if (extended_insert)
{
ulong row_length;
- dynstr_append(&extended_row,")");
+ dynstr_append_checked(&extended_row,")");
row_length= 2 + extended_row.length;
if (total_length + row_length < opt_net_buffer_length)
{
@@ -2779,14 +2843,14 @@ static void dump_table(char *table, char *db)
check_io(md_result_file);
if (mysql_errno(mysql))
{
- my_snprintf(query, QUERY_LENGTH,
+ my_snprintf(buf, sizeof(buf),
"%s: Error %d: %s when dumping table %s at row: %ld\n",
my_progname,
mysql_errno(mysql),
mysql_error(mysql),
result_table,
rownr);
- fputs(query,stderr);
+ fputs(buf,stderr);
error= EX_CONSCHECK;
goto err;
}
@@ -2809,15 +2873,13 @@ static void dump_table(char *table, char *db)
check_io(md_result_file);
}
mysql_free_result(res);
- if (query != query_buf)
- my_free(query, MYF(MY_ALLOW_ZERO_PTR));
+ dynstr_free(&query_string);
}
DBUG_VOID_RETURN;
err:
- if (query != query_buf)
- my_free(query, MYF(MY_ALLOW_ZERO_PTR));
- safe_exit(error);
+ dynstr_free(&query_string);
+ maybe_exit(error);
DBUG_VOID_RETURN;
} /* dump_table */
@@ -2864,25 +2926,25 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables)
mysql_real_escape_string(mysql, name_buff, db, strlen(db));
- init_dynamic_string(&where, " AND TABLESPACE_NAME IN ("
+ init_dynamic_string_checked(&where, " AND TABLESPACE_NAME IN ("
"SELECT DISTINCT TABLESPACE_NAME FROM"
" INFORMATION_SCHEMA.PARTITIONS"
" WHERE"
" TABLE_SCHEMA='", 256, 1024);
- dynstr_append(&where, name_buff);
- dynstr_append(&where, "' AND TABLE_NAME IN (");
+ dynstr_append_checked(&where, name_buff);
+ dynstr_append_checked(&where, "' AND TABLE_NAME IN (");
for (i=0 ; i<tables ; i++)
{
mysql_real_escape_string(mysql, name_buff,
table_names[i], strlen(table_names[i]));
- dynstr_append(&where, "'");
- dynstr_append(&where, name_buff);
- dynstr_append(&where, "',");
+ dynstr_append_checked(&where, "'");
+ dynstr_append_checked(&where, name_buff);
+ dynstr_append_checked(&where, "',");
}
dynstr_trunc(&where, 1);
- dynstr_append(&where,"))");
+ dynstr_append_checked(&where,"))");
DBUG_PRINT("info",("Dump TS for Tables where: %s",where.str));
r= dump_tablespaces(where.str);
@@ -2896,7 +2958,7 @@ static int dump_tablespaces_for_databases(char** databases)
int r;
int i;
- init_dynamic_string(&where, " AND TABLESPACE_NAME IN ("
+ init_dynamic_string_checked(&where, " AND TABLESPACE_NAME IN ("
"SELECT DISTINCT TABLESPACE_NAME FROM"
" INFORMATION_SCHEMA.PARTITIONS"
" WHERE"
@@ -2907,12 +2969,12 @@ static int dump_tablespaces_for_databases(char** databases)
char db_name_buff[NAME_LEN*2+3];
mysql_real_escape_string(mysql, db_name_buff,
databases[i], strlen(databases[i]));
- dynstr_append(&where, "'");
- dynstr_append(&where, db_name_buff);
- dynstr_append(&where, "',");
+ dynstr_append_checked(&where, "'");
+ dynstr_append_checked(&where, db_name_buff);
+ dynstr_append_checked(&where, "',");
}
dynstr_trunc(&where, 1);
- dynstr_append(&where,"))");
+ dynstr_append_checked(&where,"))");
DBUG_PRINT("info",("Dump TS for DBs where: %s",where.str));
r= dump_tablespaces(where.str);
@@ -2934,7 +2996,7 @@ static int dump_tablespaces(char* ts_where)
char *ubs;
char *endsemi;
- init_dynamic_string(&sqlbuf,
+ init_dynamic_string_checked(&sqlbuf,
"SELECT LOGFILE_GROUP_NAME,"
" FILE_NAME,"
" TOTAL_EXTENTS,"
@@ -2947,16 +3009,16 @@ static int dump_tablespaces(char* ts_where)
256, 1024);
if(ts_where)
{
- dynstr_append(&sqlbuf,
+ dynstr_append_checked(&sqlbuf,
" AND LOGFILE_GROUP_NAME IN ("
"SELECT DISTINCT LOGFILE_GROUP_NAME"
" FROM INFORMATION_SCHEMA.FILES"
" WHERE FILE_TYPE = 'DATAFILE'"
);
- dynstr_append(&sqlbuf, ts_where);
- dynstr_append(&sqlbuf, ")");
+ dynstr_append_checked(&sqlbuf, ts_where);
+ dynstr_append_checked(&sqlbuf, ")");
}
- dynstr_append(&sqlbuf,
+ dynstr_append_checked(&sqlbuf,
" GROUP BY LOGFILE_GROUP_NAME, FILE_NAME"
", ENGINE"
" ORDER BY LOGFILE_GROUP_NAME");
@@ -3029,7 +3091,7 @@ static int dump_tablespaces(char* ts_where)
}
}
dynstr_free(&sqlbuf);
- init_dynamic_string(&sqlbuf,
+ init_dynamic_string_checked(&sqlbuf,
"SELECT DISTINCT TABLESPACE_NAME,"
" FILE_NAME,"
" LOGFILE_GROUP_NAME,"
@@ -3041,9 +3103,9 @@ static int dump_tablespaces(char* ts_where)
256, 1024);
if(ts_where)
- dynstr_append(&sqlbuf, ts_where);
+ dynstr_append_checked(&sqlbuf, ts_where);
- dynstr_append(&sqlbuf, " ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME");
+ dynstr_append_checked(&sqlbuf, " ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME");
if (mysql_query_with_error_report(mysql, &tableres, sqlbuf.str))
return 1;
@@ -3254,8 +3316,8 @@ static int init_dumping(char *database, int init_func(char*))
check_io(md_result_file);
}
}
- if (extended_insert && init_dynamic_string(&extended_row, "", 1024, 1024))
- exit(EX_EOM);
+ if (extended_insert)
+ init_dynamic_string_checked(&extended_row, "", 1024, 1024);
return 0;
} /* init_dumping */
@@ -3288,11 +3350,11 @@ static int dump_all_tables_in_db(char *database)
if (lock_tables)
{
DYNAMIC_STRING query;
- init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
+ init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)) ; numrows++)
{
- dynstr_append(&query, quote_name(table, table_buff, 1));
- dynstr_append(&query, " READ /*!32311 LOCAL */,");
+ dynstr_append_checked(&query, quote_name(table, table_buff, 1));
+ dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
}
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES");
@@ -3371,11 +3433,11 @@ static my_bool dump_all_views_in_db(char *database)
if (lock_tables)
{
DYNAMIC_STRING query;
- init_dynamic_string(&query, "LOCK TABLES ", 256, 1024);
+ init_dynamic_string_checked(&query, "LOCK TABLES ", 256, 1024);
for (numrows= 0 ; (table= getTableName(1)); numrows++)
{
- dynstr_append(&query, quote_name(table, table_buff, 1));
- dynstr_append(&query, " READ /*!32311 LOCAL */,");
+ dynstr_append_checked(&query, quote_name(table, table_buff, 1));
+ dynstr_append_checked(&query, " READ /*!32311 LOCAL */,");
}
if (numrows && mysql_real_query(mysql, query.str, query.length-1))
DB_error(mysql, "when using LOCK TABLES");
@@ -3427,9 +3489,7 @@ static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root)
quote_for_like(old_table_name, show_name_buff));
if (mysql_query_with_error_report(mysql, 0, query))
- {
- safe_exit(EX_MYSQLERR);
- }
+ return NullS;
if ((table_res= mysql_store_result(mysql)))
{
@@ -3465,9 +3525,9 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
init_alloc_root(&root, 8192, 0);
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
- exit(EX_EOM);
+ die(EX_EOM, "alloc_root failure.");
- init_dynamic_string(&lock_tables_query, "LOCK TABLES ", 256, 1024);
+ init_dynamic_string_checked(&lock_tables_query, "LOCK TABLES ", 256, 1024);
for (; tables > 0 ; tables-- , table_names++)
{
/* the table name passed on commandline may be wrong case */
@@ -3476,16 +3536,14 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
/* Add found table name to lock_tables_query */
if (lock_tables)
{
- dynstr_append(&lock_tables_query, quote_name(*pos, table_buff, 1));
- dynstr_append(&lock_tables_query, " READ /*!32311 LOCAL */,");
+ dynstr_append_checked(&lock_tables_query, quote_name(*pos, table_buff, 1));
+ dynstr_append_checked(&lock_tables_query, " READ /*!32311 LOCAL */,");
}
pos++;
}
else
{
- my_printf_error(0,"Couldn't find table: \"%s\"\n", MYF(0),
- *table_names);
- safe_exit(EX_ILLEGAL_TABLE);
+ maybe_die(EX_ILLEGAL_TABLE, "Couldn't find table: \"%s\"", *table_names);
/* We shall countinue here, if --force was given */
}
}
@@ -3737,7 +3795,7 @@ char check_if_ignore_table(const char *table_name, char *table_type)
{
char result= IGNORE_NONE;
char buff[FN_REFLEN+80], show_name_buff[FN_REFLEN];
- MYSQL_RES *res;
+ MYSQL_RES *res= NULL;
MYSQL_ROW row;
DBUG_ENTER("check_if_ignore_table");
@@ -3906,12 +3964,12 @@ static int replace(DYNAMIC_STRING *ds_str,
const char *start= strstr(ds_str->str, search_str);
if (!start)
return 1;
- init_dynamic_string(&ds_tmp, "",
+ init_dynamic_string_checked(&ds_tmp, "",
ds_str->length + replace_len, 256);
- dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
- dynstr_append_mem(&ds_tmp, replace_str, replace_len);
- dynstr_append(&ds_tmp, start + search_len);
- dynstr_set(ds_str, ds_tmp.str);
+ dynstr_append_mem_checked(&ds_tmp, ds_str->str, start - ds_str->str);
+ dynstr_append_mem_checked(&ds_tmp, replace_str, replace_len);
+ dynstr_append_checked(&ds_tmp, start + search_len);
+ dynstr_set_checked(ds_str, ds_tmp.str);
dynstr_free(&ds_tmp);
return 0;
}
@@ -3957,10 +4015,7 @@ static my_bool get_view_structure(char *table, char* db)
my_snprintf(query, sizeof(query), "SHOW CREATE TABLE %s", result_table);
if (mysql_query_with_error_report(mysql, &table_res, query))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
- }
/* Check if this is a view */
field= mysql_fetch_field_direct(table_res, 0);
@@ -3974,10 +4029,8 @@ static my_bool get_view_structure(char *table, char* db)
if (path)
{
if (!(sql_file= open_sql_file_for_table(table)))
- {
- safe_exit(EX_MYSQLERR);
DBUG_RETURN(1);
- }
+
write_header(sql_file, db);
}
@@ -4023,14 +4076,14 @@ static my_bool get_view_structure(char *table, char* db)
/* Save the result of SHOW CREATE TABLE in ds_view */
row= mysql_fetch_row(table_res);
lengths= mysql_fetch_lengths(table_res);
- init_dynamic_string(&ds_view, row[1], lengths[1] + 1, 1024);
+ init_dynamic_string_checked(&ds_view, row[1], lengths[1] + 1, 1024);
mysql_free_result(table_res);
/* Get the result from "select ... information_schema" */
if (!(table_res= mysql_store_result(mysql)) ||
!(row= mysql_fetch_row(table_res)))
{
- safe_exit(EX_MYSQLERR);
+ DB_error(mysql, "when trying to save the result of SHOW CREATE TABLE in ds_view.");
DBUG_RETURN(1);
}
@@ -4102,6 +4155,45 @@ static my_bool get_view_structure(char *table, char* db)
DBUG_RETURN(0);
}
+/*
+ The following functions are wrappers for the dynamic string functions
+ and if they fail, the wrappers will terminate the current process.
+*/
+
+#define DYNAMIC_STR_ERROR_MSG "Couldn't perform DYNAMIC_STRING operation"
+
+static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
+ uint init_alloc, uint alloc_increment)
+{
+ if (init_dynamic_string(str, init_str, init_alloc, alloc_increment))
+ die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
+}
+
+static void dynstr_append_checked(DYNAMIC_STRING* dest, const char* src)
+{
+ if (dynstr_append(dest, src))
+ die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
+}
+
+static void dynstr_set_checked(DYNAMIC_STRING *str, const char *init_str)
+{
+ if (dynstr_set(str, init_str))
+ die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
+}
+
+static void dynstr_append_mem_checked(DYNAMIC_STRING *str, const char *append,
+ uint length)
+{
+ if (dynstr_append_mem(str, append, length))
+ die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
+}
+
+static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size)
+{
+ if (dynstr_realloc(str, additional_size))
+ die(EX_MYSQLERR, DYNAMIC_STR_ERROR_MSG);
+}
+
int main(int argc, char **argv)
{
diff --git a/client/mysqltest.c b/client/mysqltest.c
index bb6cc037b84..e4eb06953e2 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -3540,7 +3540,7 @@ void do_connect(struct st_command *command)
opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000
/* Turn on ssl_verify_server_cert only if host is "localhost" */
- opt_ssl_verify_server_cert= !strcmp(ds_connection_name.str, "localhost");
+ opt_ssl_verify_server_cert= !strcmp(ds_host.str, "localhost");
mysql_options(&next_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert);
#endif
@@ -6012,15 +6012,13 @@ int main(int argc, char **argv)
#ifdef HAVE_OPENSSL
-#if MYSQL_VERSION_ID >= 50000
- opt_ssl_verify_server_cert= TRUE; /* Always on in mysqltest */
-#endif
-
if (opt_use_ssl)
{
mysql_ssl_set(&cur_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher);
#if MYSQL_VERSION_ID >= 50000
+ /* Turn on ssl_verify_server_cert only if host is "localhost" */
+ opt_ssl_verify_server_cert= opt_host && !strcmp(opt_host, "localhost");
mysql_options(&cur_con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert);
#endif
diff --git a/extra/yassl/README b/extra/yassl/README
index 32d97a1e873..6c4d101efc0 100644
--- a/extra/yassl/README
+++ b/extra/yassl/README
@@ -1,3 +1,11 @@
+*****************yaSSL Release notes, version 1.6.0 (2/22/07)
+
+ This release of yaSSL contains bug fixes, portability enhancements, and
+ better X509 support.
+
+See normal build instructions below under 1.0.6.
+See libcurl build instructions below under 1.3.0 and note in 1.5.8.
+
*****************yaSSL Release notes, version 1.5.8 (1/10/07)
This release of yaSSL contains bug fixes, portability enhancements, and
diff --git a/extra/yassl/include/buffer.hpp b/extra/yassl/include/buffer.hpp
index 3fe12f38f57..a51bca9a630 100644
--- a/extra/yassl/include/buffer.hpp
+++ b/extra/yassl/include/buffer.hpp
@@ -49,13 +49,11 @@ const uint AUTO = 0xFEEDBEEF;
// Checking Policy should implement a check function that tests whether the
// index is within the size limit of the array
struct Check {
- Check() {}
void check(uint i, uint limit);
};
struct NoCheck {
- NoCheck() {}
void check(uint, uint);
};
@@ -193,7 +191,6 @@ inline void checked_delete(T* p)
// sets pointer to zero so safe for std conatiners
struct del_ptr_zero
{
- del_ptr_zero() {}
template <typename T>
void operator()(T*& p) const
{
diff --git a/extra/yassl/include/crypto_wrapper.hpp b/extra/yassl/include/crypto_wrapper.hpp
index 9e4eb582368..07b5925265a 100644
--- a/extra/yassl/include/crypto_wrapper.hpp
+++ b/extra/yassl/include/crypto_wrapper.hpp
@@ -42,7 +42,6 @@ namespace yaSSL {
// Digest policy should implement a get_digest, update, and get sizes for pad
// and digest
struct Digest : public virtual_base {
- Digest() {}
virtual void get_digest(byte*) = 0;
virtual void get_digest(byte*, const byte*, unsigned int) = 0;
virtual void update(const byte*, unsigned int) = 0;
@@ -54,7 +53,6 @@ struct Digest : public virtual_base {
// For use with NULL Digests
struct NO_MAC : public Digest {
- NO_MAC() {}
void get_digest(byte*);
void get_digest(byte*, const byte*, unsigned int);
void update(const byte*, unsigned int);
@@ -179,7 +177,6 @@ private:
// BulkCipher policy should implement encrypt, decrypt, get block size,
// and set keys for encrypt and decrypt
struct BulkCipher : public virtual_base {
- BulkCipher() {}
virtual void encrypt(byte*, const byte*, unsigned int) = 0;
virtual void decrypt(byte*, const byte*, unsigned int) = 0;
virtual void set_encryptKey(const byte*, const byte* = 0) = 0;
@@ -193,7 +190,6 @@ struct BulkCipher : public virtual_base {
// For use with NULL Ciphers
struct NO_Cipher : public BulkCipher {
- NO_Cipher() {}
void encrypt(byte*, const byte*, unsigned int) {}
void decrypt(byte*, const byte*, unsigned int) {}
void set_encryptKey(const byte*, const byte*) {}
@@ -315,14 +311,12 @@ struct Auth : public virtual_base {
virtual bool verify(const byte*, unsigned int, const byte*,
unsigned int) = 0;
virtual uint get_signatureLength() const = 0;
- Auth() {}
virtual ~Auth() {}
};
// For use with NULL Authentication schemes
struct NO_Auth : public Auth {
- NO_Auth() {}
void sign(byte*, const byte*, unsigned int, const RandomPool&) {}
bool verify(const byte*, unsigned int, const byte*, unsigned int)
{ return true; }
diff --git a/extra/yassl/include/lock.hpp b/extra/yassl/include/lock.hpp
index b961ec3e478..0525943e45d 100644
--- a/extra/yassl/include/lock.hpp
+++ b/extra/yassl/include/lock.hpp
@@ -28,7 +28,7 @@ namespace yaSSL {
#ifdef MULTI_THREADED
- #if defined(_WIN32) || defined(_WIN64)
+ #ifdef _WIN32
#include <windows.h>
class Mutex {
diff --git a/extra/yassl/include/openssl/ssl.h b/extra/yassl/include/openssl/ssl.h
index 14384f632e1..7dd33e3fcad 100644
--- a/extra/yassl/include/openssl/ssl.h
+++ b/extra/yassl/include/openssl/ssl.h
@@ -33,14 +33,9 @@
#include "opensslv.h" /* for version number */
#include "rsa.h"
-#define YASSL_VERSION "1.5.8"
-#if defined(_WIN32) || defined(_WIN64)
- #include <winsock2.h>
- typedef SOCKET socket_t;
-#else
- typedef int socket_t;
-#endif
+#define YASSL_VERSION "1.6.5"
+
#if defined(__cplusplus)
extern "C" {
@@ -195,10 +190,17 @@ enum { /* ERR Constants */
EVP_R_BAD_DECRYPT = 2
};
+/*
+ Allow type used by SSL_set_fd to be changed, default to int
+ in order to be compatible with OpenSSL
+ */
+#ifndef YASSL_SOCKET_T_DEFINED
+typedef int YASSL_SOCKET_T;
+#endif
SSL_CTX* SSL_CTX_new(SSL_METHOD*);
SSL* SSL_new(SSL_CTX*);
-int SSL_set_fd (SSL*, socket_t);
+int SSL_set_fd (SSL*, YASSL_SOCKET_T);
int SSL_connect(SSL*);
int SSL_write(SSL*, const void*, int);
int SSL_read(SSL*, void*, int);
diff --git a/extra/yassl/include/socket_wrapper.hpp b/extra/yassl/include/socket_wrapper.hpp
index 60c00d5e6c3..308704c2af0 100644
--- a/extra/yassl/include/socket_wrapper.hpp
+++ b/extra/yassl/include/socket_wrapper.hpp
@@ -28,8 +28,9 @@
#include <assert.h>
-#include "openssl/ssl.h" /* for socket_t */
-#if !defined(_WIN32) && !defined(_WIN64)
+#ifdef _WIN32
+ #include <winsock2.h>
+#else
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -43,7 +44,10 @@ namespace yaSSL {
typedef unsigned int uint;
-#if !defined( _WIN32) && !defined(_WIN64)
+#ifdef _WIN32
+ typedef SOCKET socket_t;
+#else
+ typedef int socket_t;
const socket_t INVALID_SOCKET = -1;
const int SD_RECEIVE = 0;
const int SD_SEND = 1;
diff --git a/extra/yassl/include/yassl.hpp b/extra/yassl/include/yassl.hpp
index b8190c484f7..29e0a5d94ec 100644
--- a/extra/yassl/include/yassl.hpp
+++ b/extra/yassl/include/yassl.hpp
@@ -28,7 +28,7 @@
namespace yaSSL {
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
typedef unsigned int SOCKET_T;
#else
typedef int SOCKET_T;
diff --git a/extra/yassl/include/yassl_imp.hpp b/extra/yassl/include/yassl_imp.hpp
index a94b03bacbf..f6434443cb0 100644
--- a/extra/yassl/include/yassl_imp.hpp
+++ b/extra/yassl/include/yassl_imp.hpp
@@ -64,7 +64,6 @@ struct RecordLayerHeader {
// base for all messages
struct Message : public virtual_base {
- Message() {}
virtual input_buffer& set(input_buffer&) =0;
virtual output_buffer& get(output_buffer&) const =0;
@@ -178,7 +177,6 @@ private:
class HandShakeBase : public virtual_base {
int length_;
public:
- HandShakeBase() {}
int get_length() const;
void set_length(int);
@@ -196,7 +194,6 @@ public:
struct HelloRequest : public HandShakeBase {
- HelloRequest() {}
input_buffer& set(input_buffer& in);
output_buffer& get(output_buffer& out) const;
@@ -330,7 +327,6 @@ private:
struct ServerKeyBase : public virtual_base {
- ServerKeyBase() {}
virtual ~ServerKeyBase() {}
virtual void build(SSL&) {}
virtual void read(SSL&, input_buffer&) {}
@@ -341,21 +337,15 @@ struct ServerKeyBase : public virtual_base {
// Server random number for FORTEZZA KEA
struct Fortezza_Server : public ServerKeyBase {
- Fortezza_Server() {}
opaque r_s_[FORTEZZA_MAX];
};
struct SignatureBase : public virtual_base {
- SignatureBase() {}
virtual ~SignatureBase() {}
};
-struct anonymous_sa : public SignatureBase
-{
-public:
- anonymous_sa() {}
-};
+struct anonymous_sa : public SignatureBase {};
struct Hashes {
@@ -365,13 +355,11 @@ struct Hashes {
struct rsa_sa : public SignatureBase {
- rsa_sa() {}
Hashes hashes_;
};
struct dsa_sa : public SignatureBase {
- dsa_sa() {}
uint8 sha_[SHA_LEN];
};
@@ -399,7 +387,6 @@ private:
// Server's RSA exchange
struct RSA_Server : public ServerKeyBase {
- RSA_Server() {}
ServerRSAParams params_;
opaque* signature_; // signed rsa_sa hashes
};
@@ -474,7 +461,6 @@ struct PreMasterSecret {
struct ClientKeyBase : public virtual_base {
- ClientKeyBase() {}
virtual ~ClientKeyBase() {}
virtual void build(SSL&) {}
virtual void read(SSL&, input_buffer&) {}
@@ -505,7 +491,6 @@ private:
// Fortezza Key Parameters from page 29
// hard code lengths cause only used here
struct FortezzaKeys : public ClientKeyBase {
- FortezzaKeys() {}
opaque y_c_ [128]; // client's Yc, public value
opaque r_c_ [128]; // client's Rc
opaque y_signature_ [40]; // DSS signed public key
diff --git a/extra/yassl/include/yassl_int.hpp b/extra/yassl/include/yassl_int.hpp
index d75d2200b3c..94cb85c3300 100644
--- a/extra/yassl/include/yassl_int.hpp
+++ b/extra/yassl/include/yassl_int.hpp
@@ -228,7 +228,6 @@ struct BIGNUM {
TaoCrypt::Integer), we need to explicitly state the namespace
here to let gcc 2.96 deduce the correct type.
*/
- BIGNUM() {}
yaSSL::Integer int_;
void assign(const byte* b, uint s) { int_.assign(b,s); }
};
diff --git a/extra/yassl/src/crypto_wrapper.cpp b/extra/yassl/src/crypto_wrapper.cpp
index 0291faab301..28d7f1b5693 100644
--- a/extra/yassl/src/crypto_wrapper.cpp
+++ b/extra/yassl/src/crypto_wrapper.cpp
@@ -550,7 +550,6 @@ void RandomPool::Fill(opaque* dst, uint sz) const
// Implementation of DSS Authentication
struct DSS::DSSImpl {
- DSSImpl() {}
void SetPublic (const byte*, unsigned int);
void SetPrivate(const byte*, unsigned int);
TaoCrypt::DSA_PublicKey publicKey_;
@@ -623,7 +622,6 @@ bool DSS::verify(const byte* sha_digest, unsigned int /* shaSz */,
// Implementation of RSA key interface
struct RSA::RSAImpl {
- RSAImpl() {}
void SetPublic (const byte*, unsigned int);
void SetPrivate(const byte*, unsigned int);
TaoCrypt::RSA_PublicKey publicKey_;
diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp
index c1d9ac81919..86dfa1c6ebd 100644
--- a/extra/yassl/src/ssl.cpp
+++ b/extra/yassl/src/ssl.cpp
@@ -39,7 +39,6 @@
#include "coding.hpp" // HexDecoder
#include "helpers.hpp" // for placement new hack
#include <stdio.h>
-#include <assert.h>
#ifdef _WIN32
#include <windows.h> // FindFirstFile etc..
@@ -233,7 +232,7 @@ void SSL_free(SSL* ssl)
}
-int SSL_set_fd(SSL* ssl, socket_t fd)
+int SSL_set_fd(SSL* ssl, YASSL_SOCKET_T fd)
{
ssl->useSocket().set_fd(fd);
return SSL_SUCCESS;
@@ -954,7 +953,7 @@ void ERR_print_errors_fp(FILE* /*fp*/)
char* ERR_error_string(unsigned long errNumber, char* buffer)
{
- static char* msg = (char*) "Please supply a buffer for error string";
+ static char* msg = (char*)"Please supply a buffer for error string";
if (buffer) {
SetErrorString(YasslError(errNumber), buffer);
diff --git a/extra/yassl/taocrypt/README b/extra/yassl/taocrypt/README
index 34e1744492e..0a7ff301786 100644
--- a/extra/yassl/taocrypt/README
+++ b/extra/yassl/taocrypt/README
@@ -1,4 +1,15 @@
-TaoCrypt release 0.9.0 09/18/2006
+TaoCrypt release 0.9.2 02/5/2007
+
+
+This release includes bug fixes, portability enhancements, and some
+optimiations.
+
+See 0.9.0 for build instructions.
+
+
+
+
+******************TaoCrypt release 0.9.0 09/18/2006
This is the first release of TaoCrypt, it was previously only included with
yaSSL. TaoCrypt is highly portable and fast, its features include:
diff --git a/extra/yassl/taocrypt/benchmark/benchmark.cpp b/extra/yassl/taocrypt/benchmark/benchmark.cpp
index dd9d1b1ff0d..bb725a90187 100644
--- a/extra/yassl/taocrypt/benchmark/benchmark.cpp
+++ b/extra/yassl/taocrypt/benchmark/benchmark.cpp
@@ -65,7 +65,7 @@ int main(int argc, char** argv)
const int megs = 5; // how much to test
-const byte global_key[] =
+const byte key[] =
{
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
@@ -81,19 +81,19 @@ const byte iv[] =
};
-byte global_plain [1024*1024];
-byte global_cipher[1024*1024];
+byte plain [1024*1024];
+byte cipher[1024*1024];
void bench_des()
{
DES_EDE3_CBC_Encryption enc;
- enc.SetKey(global_key, 16, iv);
+ enc.SetKey(key, 16, iv);
double start = current_time();
for(int i = 0; i < megs; i++)
- enc.Process(global_plain, global_cipher, sizeof(global_plain));
+ enc.Process(plain, cipher, sizeof(plain));
double total = current_time() - start;
@@ -107,12 +107,12 @@ void bench_des()
void bench_aes(bool show)
{
AES_CBC_Encryption enc;
- enc.SetKey(global_key, 16, iv);
+ enc.SetKey(key, 16, iv);
double start = current_time();
for(int i = 0; i < megs; i++)
- enc.Process(global_plain, global_cipher, sizeof(global_plain));
+ enc.Process(plain, cipher, sizeof(plain));
double total = current_time() - start;
@@ -127,12 +127,12 @@ void bench_aes(bool show)
void bench_twofish()
{
Twofish_CBC_Encryption enc;
- enc.SetKey(global_key, 16, iv);
+ enc.SetKey(key, 16, iv);
double start = current_time();
for(int i = 0; i < megs; i++)
- enc.Process(global_plain, global_cipher, sizeof(global_plain));
+ enc.Process(plain, cipher, sizeof(plain));
double total = current_time() - start;
@@ -147,12 +147,12 @@ void bench_twofish()
void bench_blowfish()
{
Blowfish_CBC_Encryption enc;
- enc.SetKey(global_key, 16, iv);
+ enc.SetKey(key, 16, iv);
double start = current_time();
for(int i = 0; i < megs; i++)
- enc.Process(global_plain, global_cipher, sizeof(global_plain));
+ enc.Process(plain, cipher, sizeof(plain));
double total = current_time() - start;
@@ -166,12 +166,12 @@ void bench_blowfish()
void bench_arc4()
{
ARC4 enc;
- enc.SetKey(global_key, 16);
+ enc.SetKey(key, 16);
double start = current_time();
for(int i = 0; i < megs; i++)
- enc.Process(global_cipher, global_plain, sizeof(global_plain));
+ enc.Process(cipher, plain, sizeof(plain));
double total = current_time() - start;
@@ -191,7 +191,7 @@ void bench_md5()
for(int i = 0; i < megs; i++)
- hash.Update(global_plain, sizeof(global_plain));
+ hash.Update(plain, sizeof(plain));
hash.Final(digest);
@@ -213,7 +213,7 @@ void bench_sha()
for(int i = 0; i < megs; i++)
- hash.Update(global_plain, sizeof(global_plain));
+ hash.Update(plain, sizeof(plain));
hash.Final(digest);
@@ -241,7 +241,7 @@ void bench_ripemd()
for(int i = 0; i < megs; i++)
- hash.Update(global_plain, sizeof(global_plain));
+ hash.Update(plain, sizeof(plain));
hash.Final(digest);
diff --git a/extra/yassl/taocrypt/include/algebra.hpp b/extra/yassl/taocrypt/include/algebra.hpp
index 9a6b5344c0d..298ef115a4a 100644
--- a/extra/yassl/taocrypt/include/algebra.hpp
+++ b/extra/yassl/taocrypt/include/algebra.hpp
@@ -40,7 +40,6 @@ class TAOCRYPT_NO_VTABLE AbstractGroup : public virtual_base
public:
typedef Integer Element;
- AbstractGroup() {}
virtual ~AbstractGroup() {}
virtual bool Equal(const Element &a, const Element &b) const =0;
@@ -95,7 +94,6 @@ private:
class MultiplicativeGroupT : public AbstractGroup
{
public:
- MultiplicativeGroupT() {}
const AbstractRing& GetRing() const
{return *m_pRing;}
@@ -147,7 +145,6 @@ class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain
: public AbstractRing
{
public:
- AbstractEuclideanDomain() {}
typedef Integer Element;
virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a,
diff --git a/extra/yassl/taocrypt/include/des.hpp b/extra/yassl/taocrypt/include/des.hpp
index 9082f8ab57d..f99a289392f 100644
--- a/extra/yassl/taocrypt/include/des.hpp
+++ b/extra/yassl/taocrypt/include/des.hpp
@@ -41,7 +41,6 @@ enum { DES_BLOCK_SIZE = 8, DES_KEY_SIZE = 32 };
class BasicDES {
public:
- BasicDES() {}
void SetKey(const byte*, word32, CipherDir dir);
void RawProcessBlock(word32&, word32&) const;
protected:
diff --git a/extra/yassl/taocrypt/include/hash.hpp b/extra/yassl/taocrypt/include/hash.hpp
index 71072bd3e74..fa5f6c04720 100644
--- a/extra/yassl/taocrypt/include/hash.hpp
+++ b/extra/yassl/taocrypt/include/hash.hpp
@@ -31,7 +31,6 @@ namespace TaoCrypt {
// HASH
class HASH : public virtual_base {
public:
- HASH() {}
virtual ~HASH() {}
virtual void Update(const byte*, word32) = 0;
@@ -58,8 +57,7 @@ public:
word32 GetBitCountLo() const { return loLen_ << 3; }
word32 GetBitCountHi() const { return (loLen_ >> (8*sizeof(loLen_) - 3)) +
(hiLen_ << 3); }
-
- enum { MaxDigestSz = 5, MaxBufferSz = 64 };
+ enum { MaxDigestSz = 8, MaxBufferSz = 64 };
protected:
typedef word32 HashLengthType;
word32 buffLen_; // in bytes
@@ -74,6 +72,38 @@ protected:
};
+#ifdef WORD64_AVAILABLE
+
+// 64-bit HASH with Transform
+class HASH64withTransform : public HASH {
+public:
+ HASH64withTransform(word32 digSz, word32 buffSz);
+ virtual ~HASH64withTransform() {}
+ virtual ByteOrder getByteOrder() const = 0;
+ virtual word32 getPadSize() const = 0;
+
+ virtual void Update(const byte*, word32);
+ virtual void Final(byte*);
+
+ word32 GetBitCountLo() const { return loLen_ << 3; }
+ word32 GetBitCountHi() const { return (loLen_ >> (8*sizeof(loLen_) - 3)) +
+ (hiLen_ << 3); }
+ enum { MaxDigestSz = 8, MaxBufferSz = 128 };
+protected:
+ typedef word32 HashLengthType;
+ word32 buffLen_; // in bytes
+ HashLengthType loLen_; // length in bytes
+ HashLengthType hiLen_; // length in bytes
+ word64 digest_[MaxDigestSz];
+ word64 buffer_[MaxBufferSz / sizeof(word64)];
+
+ virtual void Transform() = 0;
+
+ void AddLength(word32);
+};
+
+#endif // WORD64_AVAILABLE
+
} // namespace
diff --git a/extra/yassl/taocrypt/include/hmac.hpp b/extra/yassl/taocrypt/include/hmac.hpp
index ccd54c05cb1..1d486514e06 100644
--- a/extra/yassl/taocrypt/include/hmac.hpp
+++ b/extra/yassl/taocrypt/include/hmac.hpp
@@ -109,11 +109,11 @@ void HMAC<T>::KeyInnerHash()
// Update
template <class T>
-void HMAC<T>::Update(const byte* msg_arg, word32 length)
+void HMAC<T>::Update(const byte* msg, word32 length)
{
if (!innerHashKeyed_)
KeyInnerHash();
- mac_.Update(msg_arg, length);
+ mac_.Update(msg, length);
}
diff --git a/extra/yassl/taocrypt/include/misc.hpp b/extra/yassl/taocrypt/include/misc.hpp
index 224589e0640..96648a39aa1 100644
--- a/extra/yassl/taocrypt/include/misc.hpp
+++ b/extra/yassl/taocrypt/include/misc.hpp
@@ -464,6 +464,25 @@ inline word32 ByteReverse(word32 value)
}
+#ifdef WORD64_AVAILABLE
+
+inline word64 ByteReverse(word64 value)
+{
+#ifdef TAOCRYPT_SLOW_WORD64
+ return (word64(ByteReverse(word32(value))) << 32) |
+ ByteReverse(word32(value>>32));
+#else
+ value = ((value & W64LIT(0xFF00FF00FF00FF00)) >> 8) |
+ ((value & W64LIT(0x00FF00FF00FF00FF)) << 8);
+ value = ((value & W64LIT(0xFFFF0000FFFF0000)) >> 16) |
+ ((value & W64LIT(0x0000FFFF0000FFFF)) << 16);
+ return rotlFixed(value, 32U);
+#endif
+}
+
+#endif // WORD64_AVAILABLE
+
+
template <typename T>
inline void ByteReverse(T* out, const T* in, word32 byteCount)
{
diff --git a/extra/yassl/taocrypt/include/modarith.hpp b/extra/yassl/taocrypt/include/modarith.hpp
index f42a4397d48..501a8129b90 100644
--- a/extra/yassl/taocrypt/include/modarith.hpp
+++ b/extra/yassl/taocrypt/include/modarith.hpp
@@ -37,8 +37,8 @@ public:
typedef int RandomizationParameter;
typedef Integer Element;
- ModularArithmetic(const Integer &modulus_arg = Integer::One())
- : modulus(modulus_arg), result((word)0, modulus_arg.reg_.size()) {}
+ ModularArithmetic(const Integer &modulus = Integer::One())
+ : modulus(modulus), result((word)0, modulus.reg_.size()) {}
ModularArithmetic(const ModularArithmetic &ma)
: AbstractRing(),
diff --git a/extra/yassl/taocrypt/include/modes.hpp b/extra/yassl/taocrypt/include/modes.hpp
index 36618a8f5ed..d1ebce7568b 100644
--- a/extra/yassl/taocrypt/include/modes.hpp
+++ b/extra/yassl/taocrypt/include/modes.hpp
@@ -42,8 +42,8 @@ public:
{ cipher_.Process(c, p, sz); }
void SetKey(const byte* k, word32 sz)
{ cipher_.SetKey(k, sz, DIR); }
- void SetKey(const byte* k, word32 sz, const byte* iv_arg)
- { cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv_arg); }
+ void SetKey(const byte* k, word32 sz, const byte* iv)
+ { cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv); }
private:
T cipher_;
diff --git a/extra/yassl/taocrypt/include/rsa.hpp b/extra/yassl/taocrypt/include/rsa.hpp
index 454b0ef33a7..c895ab6fd34 100644
--- a/extra/yassl/taocrypt/include/rsa.hpp
+++ b/extra/yassl/taocrypt/include/rsa.hpp
@@ -131,7 +131,6 @@ private:
// block type 2 padding
class RSA_BlockType2 {
public:
- RSA_BlockType2() {}
void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const;
@@ -141,7 +140,6 @@ public:
// block type 1 padding
class RSA_BlockType1 {
public:
- RSA_BlockType1() {}
void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const;
@@ -176,27 +174,25 @@ public:
// Public Encrypt
template<class Pad>
-void RSA_Encryptor<Pad>::Encrypt(const byte* plain_arg, word32 sz,
- byte* cipher_arg,
- RandomNumberGenerator& rng_arg)
+void RSA_Encryptor<Pad>::Encrypt(const byte* plain, word32 sz, byte* cipher,
+ RandomNumberGenerator& rng)
{
PK_Lengths lengths(key_.GetModulus());
assert(sz <= lengths.FixedMaxPlaintextLength());
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
- padding_.Pad(plain_arg, sz, paddedBlock.get_buffer(),
- lengths.PaddedBlockBitLength(), rng_arg);
+ padding_.Pad(plain, sz, paddedBlock.get_buffer(),
+ lengths.PaddedBlockBitLength(), rng);
key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())).
- Encode(cipher_arg, lengths.FixedCiphertextLength());
+ Encode(cipher, lengths.FixedCiphertextLength());
}
// Private Decrypt
template<class Pad>
-word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz,
- byte* plain_arg,
- RandomNumberGenerator& rng_arg)
+word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
+ RandomNumberGenerator& rng)
{
PK_Lengths lengths(key_.GetModulus());
assert(sz == lengths.FixedCiphertextLength());
@@ -205,29 +201,29 @@ word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz,
return 0;
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
- Integer x = key_.CalculateInverse(rng_arg, Integer(cipher_arg,
+ Integer x = key_.CalculateInverse(rng, Integer(cipher,
lengths.FixedCiphertextLength()).Ref());
if (x.ByteCount() > paddedBlock.size())
x = Integer::Zero(); // don't return false, prevents timing attack
x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
return padding_.UnPad(paddedBlock.get_buffer(),
- lengths.PaddedBlockBitLength(), plain_arg);
+ lengths.PaddedBlockBitLength(), plain);
}
// Private SSL type (block 1) Encrypt
template<class Pad>
void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig,
- RandomNumberGenerator& rng_arg)
+ RandomNumberGenerator& rng)
{
RSA_PublicKey inverse;
inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent());
RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type
- enc.Encrypt(message, sz, sig, rng_arg);
+ enc.Encrypt(message, sz, sig, rng);
}
-word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain_arg);
+word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain);
// Public SSL type (block 1) Decrypt
@@ -235,11 +231,11 @@ template<class Pad>
bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
const byte* sig)
{
- ByteBlock local_plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
- if (SSL_Decrypt(key_, sig, local_plain.get_buffer()) != sz)
+ ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
+ if (SSL_Decrypt(key_, sig, plain.get_buffer()) != sz)
return false; // not right justified or bad padding
- if ( (memcmp(local_plain.get_buffer(), message, sz)) == 0)
+ if ( (memcmp(plain.get_buffer(), message, sz)) == 0)
return true;
return false;
}
diff --git a/extra/yassl/taocrypt/include/sha.hpp b/extra/yassl/taocrypt/include/sha.hpp
index c501d3ad306..c0b4368121b 100644
--- a/extra/yassl/taocrypt/include/sha.hpp
+++ b/extra/yassl/taocrypt/include/sha.hpp
@@ -64,6 +64,103 @@ inline void swap(SHA& a, SHA& b)
a.Swap(b);
}
+// SHA-256 digest
+class SHA256 : public HASHwithTransform {
+public:
+ enum { BLOCK_SIZE = 64, DIGEST_SIZE = 32, PAD_SIZE = 56,
+ TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes
+ SHA256() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE)
+ { Init(); }
+ ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
+ word32 getBlockSize() const { return BLOCK_SIZE; }
+ word32 getDigestSize() const { return DIGEST_SIZE; }
+ word32 getPadSize() const { return PAD_SIZE; }
+
+ void Init();
+
+ SHA256(const SHA256&);
+ SHA256& operator= (const SHA256&);
+
+ void Swap(SHA256&);
+private:
+ void Transform();
+};
+
+
+// SHA-224 digest
+class SHA224 : public HASHwithTransform {
+public:
+ enum { BLOCK_SIZE = 64, DIGEST_SIZE = 28, PAD_SIZE = 56,
+ TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes
+ SHA224() : HASHwithTransform(SHA256::DIGEST_SIZE /sizeof(word32),BLOCK_SIZE)
+ { Init(); }
+ ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
+ word32 getBlockSize() const { return BLOCK_SIZE; }
+ word32 getDigestSize() const { return DIGEST_SIZE; }
+ word32 getPadSize() const { return PAD_SIZE; }
+
+ void Init();
+
+ SHA224(const SHA224&);
+ SHA224& operator= (const SHA224&);
+
+ void Swap(SHA224&);
+private:
+ void Transform();
+};
+
+
+#ifdef WORD64_AVAILABLE
+
+// SHA-512 digest
+class SHA512 : public HASH64withTransform {
+public:
+ enum { BLOCK_SIZE = 128, DIGEST_SIZE = 64, PAD_SIZE = 112,
+ TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes
+ SHA512() : HASH64withTransform(DIGEST_SIZE / sizeof(word64), BLOCK_SIZE)
+ { Init(); }
+ ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
+ word32 getBlockSize() const { return BLOCK_SIZE; }
+ word32 getDigestSize() const { return DIGEST_SIZE; }
+ word32 getPadSize() const { return PAD_SIZE; }
+
+ void Init();
+
+ SHA512(const SHA512&);
+ SHA512& operator= (const SHA512&);
+
+ void Swap(SHA512&);
+private:
+ void Transform();
+};
+
+
+// SHA-384 digest
+class SHA384 : public HASH64withTransform {
+public:
+ enum { BLOCK_SIZE = 128, DIGEST_SIZE = 48, PAD_SIZE = 112,
+ TAO_BYTE_ORDER = BigEndianOrder}; // in Bytes
+ SHA384() : HASH64withTransform(SHA512::DIGEST_SIZE/ sizeof(word64),
+ BLOCK_SIZE)
+ { Init(); }
+ ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
+ word32 getBlockSize() const { return BLOCK_SIZE; }
+ word32 getDigestSize() const { return DIGEST_SIZE; }
+ word32 getPadSize() const { return PAD_SIZE; }
+
+ void Init();
+
+ SHA384(const SHA384&);
+ SHA384& operator= (const SHA384&);
+
+ void Swap(SHA384&);
+private:
+ void Transform();
+};
+
+#endif // WORD64_AVAILABLE
+
+
} // namespace
diff --git a/extra/yassl/taocrypt/include/type_traits.hpp b/extra/yassl/taocrypt/include/type_traits.hpp
index ce21a2eaa63..0dd5e4e5c50 100644
--- a/extra/yassl/taocrypt/include/type_traits.hpp
+++ b/extra/yassl/taocrypt/include/type_traits.hpp
@@ -62,11 +62,7 @@ MK_FUNDAMENTAL_TYPE(unsigned long)
MK_FUNDAMENTAL_TYPE(float)
MK_FUNDAMENTAL_TYPE( double)
-
-#ifdef LONG_DOUBLE_IS_DISTINCT_TYPE
-// Don't define by default as this gives warnings on power mac
- MK_FUNDAMENTAL_TYPE(long double)
-#endif
+MK_FUNDAMENTAL_TYPE(long double)
#if defined(WORD64_AVAILABLE) && defined(WORD64_IS_DISTINCT_TYPE)
MK_FUNDAMENTAL_TYPE(word64)
diff --git a/extra/yassl/taocrypt/include/types.hpp b/extra/yassl/taocrypt/include/types.hpp
index c817572d265..3efdcdfbccb 100644
--- a/extra/yassl/taocrypt/include/types.hpp
+++ b/extra/yassl/taocrypt/include/types.hpp
@@ -46,13 +46,16 @@ typedef unsigned int word32;
#define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE
typedef unsigned __int64 word64;
+ #define W64LIT(x) x##ui64
#elif SIZEOF_LONG == 8
#define WORD64_AVAILABLE
typedef unsigned long word64;
+ #define W64LIT(x) x##LL
#elif SIZEOF_LONG_LONG == 8
#define WORD64_AVAILABLE
#define WORD64_IS_DISTINCT_TYPE
typedef unsigned long long word64;
+ #define W64LIT(x) x##LL
#endif
diff --git a/extra/yassl/taocrypt/mySTL/algorithm.hpp b/extra/yassl/taocrypt/mySTL/algorithm.hpp
index f6a29cf4bdb..d8bc29a0bb9 100644
--- a/extra/yassl/taocrypt/mySTL/algorithm.hpp
+++ b/extra/yassl/taocrypt/mySTL/algorithm.hpp
@@ -27,8 +27,6 @@
namespace mySTL {
-#undef max
-#undef min
template<typename T>
inline const T& max(const T& a, const T&b)
diff --git a/extra/yassl/taocrypt/mySTL/list.hpp b/extra/yassl/taocrypt/mySTL/list.hpp
index 98a4589a354..6a081cba5ad 100644
--- a/extra/yassl/taocrypt/mySTL/list.hpp
+++ b/extra/yassl/taocrypt/mySTL/list.hpp
@@ -231,7 +231,7 @@ void list<T>::push_front(T t)
template<typename T>
void list<T>::pop_front()
{
- node* local_front = head_;
+ node* front = head_;
if (head_ == 0)
return;
@@ -241,8 +241,8 @@ void list<T>::pop_front()
head_ = head_->next_;
head_->prev_ = 0;
}
- destroy(local_front);
- FreeMemory(local_front);
+ destroy(front);
+ FreeMemory(front);
--sz_;
}
@@ -303,13 +303,13 @@ T list<T>::back() const
template<typename T>
typename list<T>::node* list<T>::look_up(T t)
{
- node* local_list = head_;
+ node* list = head_;
- if (local_list == 0) return 0;
+ if (list == 0) return 0;
- for (; local_list; local_list = local_list->next_)
- if (local_list->value_ == t)
- return local_list;
+ for (; list; list = list->next_)
+ if (list->value_ == t)
+ return list;
return 0;
}
diff --git a/extra/yassl/taocrypt/src/aes.cpp b/extra/yassl/taocrypt/src/aes.cpp
index 4f87bf3778a..b2b42d3dcf0 100644
--- a/extra/yassl/taocrypt/src/aes.cpp
+++ b/extra/yassl/taocrypt/src/aes.cpp
@@ -90,14 +90,13 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
rounds_ = keylen/4 + 6;
word32 temp, *rk = key_;
+ unsigned int i=0;
GetUserKey(BigEndianOrder, rk, keylen/4, userKey, keylen);
switch(keylen)
{
case 16:
- {
- unsigned int i=0;
while (true)
{
temp = rk[3];
@@ -115,10 +114,8 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
rk += 4;
}
break;
- }
+
case 24:
- {
- unsigned int i=0;
while (true) // for (;;) here triggers a bug in VC60 SP4 w/ Pro Pack
{
temp = rk[ 5];
@@ -139,10 +136,7 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
}
break;
- }
case 32:
- {
- unsigned int i=0;
while (true)
{
temp = rk[ 7];
@@ -171,7 +165,6 @@ void AES::SetKey(const byte* userKey, word32 keylen, CipherDir /*dummy*/)
}
break;
}
- }
if (dir_ == DECRYPTION)
{
diff --git a/extra/yassl/taocrypt/src/algebra.cpp b/extra/yassl/taocrypt/src/algebra.cpp
index d797d0d4108..cb597c41552 100644
--- a/extra/yassl/taocrypt/src/algebra.cpp
+++ b/extra/yassl/taocrypt/src/algebra.cpp
@@ -186,10 +186,10 @@ Integer AbstractGroup::CascadeScalarMultiply(const Element &x,
struct WindowSlider
{
- WindowSlider(const Integer &exp_arg, bool fastNegate_arg,
+ WindowSlider(const Integer &exp, bool fastNegate,
unsigned int windowSizeIn=0)
- : exp(exp_arg), windowModulus(Integer::One()), windowSize(windowSizeIn),
- windowBegin(0), fastNegate(fastNegate_arg), firstTime(true),
+ : exp(exp), windowModulus(Integer::One()), windowSize(windowSizeIn),
+ windowBegin(0), fastNegate(fastNegate), firstTime(true),
finished(false)
{
if (windowSize == 0)
diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp
index 5bc865a4ba7..a06ab658c7b 100644
--- a/extra/yassl/taocrypt/src/asn.cpp
+++ b/extra/yassl/taocrypt/src/asn.cpp
@@ -737,17 +737,17 @@ void CertDecoder::GetName(NameType nt)
email = true;
source_.advance(oidSz + 1);
- word32 length2 = GetLength(source_);
+ word32 length = GetLength(source_);
if (email) {
memcpy(&ptr[idx], "/emailAddress=", 14);
idx += 14;
- memcpy(&ptr[idx], source_.get_current(), length2);
- idx += length2;
+ memcpy(&ptr[idx], source_.get_current(), length);
+ idx += length;
}
- source_.advance(length2);
+ source_.advance(length);
}
}
ptr[idx++] = 0;
diff --git a/extra/yassl/taocrypt/src/hash.cpp b/extra/yassl/taocrypt/src/hash.cpp
index 66598177631..c51dc42a909 100644
--- a/extra/yassl/taocrypt/src/hash.cpp
+++ b/extra/yassl/taocrypt/src/hash.cpp
@@ -108,4 +108,89 @@ void HASHwithTransform::Final(byte* hash)
Init(); // reset state
}
+
+#ifdef WORD64_AVAILABLE
+
+HASH64withTransform::HASH64withTransform(word32 digSz, word32 buffSz)
+{
+ assert(digSz <= MaxDigestSz);
+ assert(buffSz <= MaxBufferSz);
+}
+
+
+void HASH64withTransform::AddLength(word32 len)
+{
+ HashLengthType tmp = loLen_;
+ if ( (loLen_ += len) < tmp)
+ hiLen_++; // carry low to high
+ hiLen_ += SafeRightShift<8*sizeof(HashLengthType)>(len);
+}
+
+
+// Update digest with data of size len, do in blocks
+void HASH64withTransform::Update(const byte* data, word32 len)
+{
+ // do block size increments
+ word32 blockSz = getBlockSize();
+ byte* local = reinterpret_cast<byte*>(buffer_);
+
+ while (len) {
+ word32 add = min(len, blockSz - buffLen_);
+ memcpy(&local[buffLen_], data, add);
+
+ buffLen_ += add;
+ data += add;
+ len -= add;
+
+ if (buffLen_ == blockSz) {
+ ByteReverseIf(buffer_, buffer_, blockSz, getByteOrder());
+ Transform();
+ AddLength(blockSz);
+ buffLen_ = 0;
+ }
+ }
+}
+
+
+// Final process, place digest in hash
+void HASH64withTransform::Final(byte* hash)
+{
+ word32 blockSz = getBlockSize();
+ word32 digestSz = getDigestSize();
+ word32 padSz = getPadSize();
+ ByteOrder order = getByteOrder();
+
+ AddLength(buffLen_); // before adding pads
+ HashLengthType preLoLen = GetBitCountLo();
+ HashLengthType preHiLen = GetBitCountHi();
+ byte* local = reinterpret_cast<byte*>(buffer_);
+
+ local[buffLen_++] = 0x80; // add 1
+
+ // pad with zeros
+ if (buffLen_ > padSz) {
+ memset(&local[buffLen_], 0, blockSz - buffLen_);
+ buffLen_ += blockSz - buffLen_;
+
+ ByteReverseIf(buffer_, buffer_, blockSz, order);
+ Transform();
+ buffLen_ = 0;
+ }
+ memset(&local[buffLen_], 0, padSz - buffLen_);
+
+ ByteReverseIf(buffer_, buffer_, padSz, order);
+
+ buffer_[blockSz / sizeof(word64) - 2] = order ? preHiLen : preLoLen;
+ buffer_[blockSz / sizeof(word64) - 1] = order ? preLoLen : preHiLen;
+
+ Transform();
+ ByteReverseIf(digest_, digest_, digestSz, order);
+ memcpy(hash, digest_, digestSz);
+
+ Init(); // reset state
+}
+
+#endif // WORD64_AVAILABLE
+
+
} // namespace
diff --git a/extra/yassl/taocrypt/src/integer.cpp b/extra/yassl/taocrypt/src/integer.cpp
index 84255aa8544..85733b88aa9 100644
--- a/extra/yassl/taocrypt/src/integer.cpp
+++ b/extra/yassl/taocrypt/src/integer.cpp
@@ -3390,7 +3390,7 @@ void Integer::DivideByPowerOf2(Integer &r, Integer &q, const Integer &a,
CopyWords(r.reg_.get_buffer(), a.reg_.get_buffer(), wordCount);
SetWords(r.reg_+wordCount, 0, r.reg_.size()-wordCount);
if (n % WORD_BITS != 0)
- r.reg_[wordCount-1] %= ((word) 1 << (n % WORD_BITS));
+ r.reg_[wordCount-1] %= (word(1) << (n % WORD_BITS));
}
else
{
diff --git a/extra/yassl/taocrypt/src/sha.cpp b/extra/yassl/taocrypt/src/sha.cpp
index 9713940529a..ef165a342ad 100644
--- a/extra/yassl/taocrypt/src/sha.cpp
+++ b/extra/yassl/taocrypt/src/sha.cpp
@@ -69,6 +69,77 @@ void SHA::Init()
hiLen_ = 0;
}
+void SHA256::Init()
+{
+ digest_[0] = 0x6A09E667L;
+ digest_[1] = 0xBB67AE85L;
+ digest_[2] = 0x3C6EF372L;
+ digest_[3] = 0xA54FF53AL;
+ digest_[4] = 0x510E527FL;
+ digest_[5] = 0x9B05688CL;
+ digest_[6] = 0x1F83D9ABL;
+ digest_[7] = 0x5BE0CD19L;
+
+ buffLen_ = 0;
+ loLen_ = 0;
+ hiLen_ = 0;
+}
+
+
+void SHA224::Init()
+{
+ digest_[0] = 0xc1059ed8;
+ digest_[1] = 0x367cd507;
+ digest_[2] = 0x3070dd17;
+ digest_[3] = 0xf70e5939;
+ digest_[4] = 0xffc00b31;
+ digest_[5] = 0x68581511;
+ digest_[6] = 0x64f98fa7;
+ digest_[7] = 0xbefa4fa4;
+
+ buffLen_ = 0;
+ loLen_ = 0;
+ hiLen_ = 0;
+}
+
+
+#ifdef WORD64_AVAILABLE
+
+void SHA512::Init()
+{
+ digest_[0] = W64LIT(0x6a09e667f3bcc908);
+ digest_[1] = W64LIT(0xbb67ae8584caa73b);
+ digest_[2] = W64LIT(0x3c6ef372fe94f82b);
+ digest_[3] = W64LIT(0xa54ff53a5f1d36f1);
+ digest_[4] = W64LIT(0x510e527fade682d1);
+ digest_[5] = W64LIT(0x9b05688c2b3e6c1f);
+ digest_[6] = W64LIT(0x1f83d9abfb41bd6b);
+ digest_[7] = W64LIT(0x5be0cd19137e2179);
+
+ buffLen_ = 0;
+ loLen_ = 0;
+ hiLen_ = 0;
+}
+
+
+void SHA384::Init()
+{
+ digest_[0] = W64LIT(0xcbbb9d5dc1059ed8);
+ digest_[1] = W64LIT(0x629a292a367cd507);
+ digest_[2] = W64LIT(0x9159015a3070dd17);
+ digest_[3] = W64LIT(0x152fecd8f70e5939);
+ digest_[4] = W64LIT(0x67332667ffc00b31);
+ digest_[5] = W64LIT(0x8eb44a8768581511);
+ digest_[6] = W64LIT(0xdb0c2e0d64f98fa7);
+ digest_[7] = W64LIT(0x47b5481dbefa4fa4);
+
+ buffLen_ = 0;
+ loLen_ = 0;
+ hiLen_ = 0;
+}
+
+#endif // WORD64_AVAILABLE
+
SHA::SHA(const SHA& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32),
BLOCK_SIZE)
@@ -81,6 +152,59 @@ SHA::SHA(const SHA& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32),
memcpy(buffer_, that.buffer_, BLOCK_SIZE);
}
+
+SHA256::SHA256(const SHA256& that) : HASHwithTransform(DIGEST_SIZE /
+ sizeof(word32), BLOCK_SIZE)
+{
+ buffLen_ = that.buffLen_;
+ loLen_ = that.loLen_;
+ hiLen_ = that.hiLen_;
+
+ memcpy(digest_, that.digest_, DIGEST_SIZE);
+ memcpy(buffer_, that.buffer_, BLOCK_SIZE);
+}
+
+
+SHA224::SHA224(const SHA224& that) : HASHwithTransform(SHA256::DIGEST_SIZE /
+ sizeof(word32), BLOCK_SIZE)
+{
+ buffLen_ = that.buffLen_;
+ loLen_ = that.loLen_;
+ hiLen_ = that.hiLen_;
+
+ memcpy(digest_, that.digest_, DIGEST_SIZE);
+ memcpy(buffer_, that.buffer_, BLOCK_SIZE);
+}
+
+
+#ifdef WORD64_AVAILABLE
+
+SHA512::SHA512(const SHA512& that) : HASH64withTransform(DIGEST_SIZE /
+ sizeof(word64), BLOCK_SIZE)
+{
+ buffLen_ = that.buffLen_;
+ loLen_ = that.loLen_;
+ hiLen_ = that.hiLen_;
+
+ memcpy(digest_, that.digest_, DIGEST_SIZE);
+ memcpy(buffer_, that.buffer_, BLOCK_SIZE);
+}
+
+
+SHA384::SHA384(const SHA384& that) : HASH64withTransform(SHA512::DIGEST_SIZE /
+ sizeof(word64), BLOCK_SIZE)
+{
+ buffLen_ = that.buffLen_;
+ loLen_ = that.loLen_;
+ hiLen_ = that.hiLen_;
+
+ memcpy(digest_, that.digest_, DIGEST_SIZE);
+ memcpy(buffer_, that.buffer_, BLOCK_SIZE);
+}
+
+#endif // WORD64_AVAILABLE
+
+
SHA& SHA::operator= (const SHA& that)
{
SHA tmp(that);
@@ -90,6 +214,46 @@ SHA& SHA::operator= (const SHA& that)
}
+SHA256& SHA256::operator= (const SHA256& that)
+{
+ SHA256 tmp(that);
+ Swap(tmp);
+
+ return *this;
+}
+
+
+SHA224& SHA224::operator= (const SHA224& that)
+{
+ SHA224 tmp(that);
+ Swap(tmp);
+
+ return *this;
+}
+
+
+#ifdef WORD64_AVAILABLE
+
+SHA512& SHA512::operator= (const SHA512& that)
+{
+ SHA512 tmp(that);
+ Swap(tmp);
+
+ return *this;
+}
+
+
+SHA384& SHA384::operator= (const SHA384& that)
+{
+ SHA384 tmp(that);
+ Swap(tmp);
+
+ return *this;
+}
+
+#endif // WORD64_AVAILABLE
+
+
void SHA::Swap(SHA& other)
{
STL::swap(loLen_, other.loLen_);
@@ -101,6 +265,53 @@ void SHA::Swap(SHA& other)
}
+void SHA256::Swap(SHA256& other)
+{
+ STL::swap(loLen_, other.loLen_);
+ STL::swap(hiLen_, other.hiLen_);
+ STL::swap(buffLen_, other.buffLen_);
+
+ memcpy(digest_, other.digest_, DIGEST_SIZE);
+ memcpy(buffer_, other.buffer_, BLOCK_SIZE);
+}
+
+
+void SHA224::Swap(SHA224& other)
+{
+ STL::swap(loLen_, other.loLen_);
+ STL::swap(hiLen_, other.hiLen_);
+ STL::swap(buffLen_, other.buffLen_);
+
+ memcpy(digest_, other.digest_, DIGEST_SIZE);
+ memcpy(buffer_, other.buffer_, BLOCK_SIZE);
+}
+
+
+#ifdef WORD64_AVAILABLE
+
+void SHA512::Swap(SHA512& other)
+{
+ STL::swap(loLen_, other.loLen_);
+ STL::swap(hiLen_, other.hiLen_);
+ STL::swap(buffLen_, other.buffLen_);
+
+ memcpy(digest_, other.digest_, DIGEST_SIZE);
+ memcpy(buffer_, other.buffer_, BLOCK_SIZE);
+}
+
+
+void SHA384::Swap(SHA384& other)
+{
+ STL::swap(loLen_, other.loLen_);
+ STL::swap(hiLen_, other.hiLen_);
+ STL::swap(buffLen_, other.buffLen_);
+
+ memcpy(digest_, other.digest_, DIGEST_SIZE);
+ memcpy(buffer_, other.buffer_, BLOCK_SIZE);
+}
+
+#endif // WORD64_AVIALABLE
+
#ifdef DO_SHA_ASM
@@ -203,6 +414,205 @@ void SHA::Transform()
}
+#define blk2(i) (W[i&15]+=s1(W[(i-2)&15])+W[(i-7)&15]+s0(W[(i-15)&15]))
+
+#define Ch(x,y,z) (z^(x&(y^z)))
+#define Maj(x,y,z) ((x&y)|(z&(x|y)))
+
+#define a(i) T[(0-i)&7]
+#define b(i) T[(1-i)&7]
+#define c(i) T[(2-i)&7]
+#define d(i) T[(3-i)&7]
+#define e(i) T[(4-i)&7]
+#define f(i) T[(5-i)&7]
+#define g(i) T[(6-i)&7]
+#define h(i) T[(7-i)&7]
+
+#define R(i) h(i)+=S1(e(i))+Ch(e(i),f(i),g(i))+K[i+j]+(j?blk2(i):blk0(i));\
+ d(i)+=h(i);h(i)+=S0(a(i))+Maj(a(i),b(i),c(i))
+
+// for SHA256
+#define S0(x) (rotrFixed(x,2)^rotrFixed(x,13)^rotrFixed(x,22))
+#define S1(x) (rotrFixed(x,6)^rotrFixed(x,11)^rotrFixed(x,25))
+#define s0(x) (rotrFixed(x,7)^rotrFixed(x,18)^(x>>3))
+#define s1(x) (rotrFixed(x,17)^rotrFixed(x,19)^(x>>10))
+
+
+static const word32 K256[64] = {
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+ 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+ 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
+ 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
+ 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
+ 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
+ 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
+ 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+};
+
+
+static void Transform256(word32* digest_, word32* buffer_)
+{
+ const word32* K = K256;
+
+ word32 W[16];
+ word32 T[8];
+
+ // Copy digest to working vars
+ memcpy(T, digest_, sizeof(T));
+
+ // 64 operations, partially loop unrolled
+ for (unsigned int j = 0; j < 64; j += 16) {
+ R( 0); R( 1); R( 2); R( 3);
+ R( 4); R( 5); R( 6); R( 7);
+ R( 8); R( 9); R(10); R(11);
+ R(12); R(13); R(14); R(15);
+ }
+
+ // Add the working vars back into digest
+ digest_[0] += a(0);
+ digest_[1] += b(0);
+ digest_[2] += c(0);
+ digest_[3] += d(0);
+ digest_[4] += e(0);
+ digest_[5] += f(0);
+ digest_[6] += g(0);
+ digest_[7] += h(0);
+
+ // Wipe variables
+ memset(W, 0, sizeof(W));
+ memset(T, 0, sizeof(T));
+}
+
+
+// undef for 256
+#undef S0
+#undef S1
+#undef s0
+#undef s1
+
+
+void SHA256::Transform()
+{
+ Transform256(digest_, buffer_);
+}
+
+
+void SHA224::Transform()
+{
+ Transform256(digest_, buffer_);
+}
+
+
+#ifdef WORD64_AVAILABLE
+
+static const word64 K512[80] = {
+ W64LIT(0x428a2f98d728ae22), W64LIT(0x7137449123ef65cd),
+ W64LIT(0xb5c0fbcfec4d3b2f), W64LIT(0xe9b5dba58189dbbc),
+ W64LIT(0x3956c25bf348b538), W64LIT(0x59f111f1b605d019),
+ W64LIT(0x923f82a4af194f9b), W64LIT(0xab1c5ed5da6d8118),
+ W64LIT(0xd807aa98a3030242), W64LIT(0x12835b0145706fbe),
+ W64LIT(0x243185be4ee4b28c), W64LIT(0x550c7dc3d5ffb4e2),
+ W64LIT(0x72be5d74f27b896f), W64LIT(0x80deb1fe3b1696b1),
+ W64LIT(0x9bdc06a725c71235), W64LIT(0xc19bf174cf692694),
+ W64LIT(0xe49b69c19ef14ad2), W64LIT(0xefbe4786384f25e3),
+ W64LIT(0x0fc19dc68b8cd5b5), W64LIT(0x240ca1cc77ac9c65),
+ W64LIT(0x2de92c6f592b0275), W64LIT(0x4a7484aa6ea6e483),
+ W64LIT(0x5cb0a9dcbd41fbd4), W64LIT(0x76f988da831153b5),
+ W64LIT(0x983e5152ee66dfab), W64LIT(0xa831c66d2db43210),
+ W64LIT(0xb00327c898fb213f), W64LIT(0xbf597fc7beef0ee4),
+ W64LIT(0xc6e00bf33da88fc2), W64LIT(0xd5a79147930aa725),
+ W64LIT(0x06ca6351e003826f), W64LIT(0x142929670a0e6e70),
+ W64LIT(0x27b70a8546d22ffc), W64LIT(0x2e1b21385c26c926),
+ W64LIT(0x4d2c6dfc5ac42aed), W64LIT(0x53380d139d95b3df),
+ W64LIT(0x650a73548baf63de), W64LIT(0x766a0abb3c77b2a8),
+ W64LIT(0x81c2c92e47edaee6), W64LIT(0x92722c851482353b),
+ W64LIT(0xa2bfe8a14cf10364), W64LIT(0xa81a664bbc423001),
+ W64LIT(0xc24b8b70d0f89791), W64LIT(0xc76c51a30654be30),
+ W64LIT(0xd192e819d6ef5218), W64LIT(0xd69906245565a910),
+ W64LIT(0xf40e35855771202a), W64LIT(0x106aa07032bbd1b8),
+ W64LIT(0x19a4c116b8d2d0c8), W64LIT(0x1e376c085141ab53),
+ W64LIT(0x2748774cdf8eeb99), W64LIT(0x34b0bcb5e19b48a8),
+ W64LIT(0x391c0cb3c5c95a63), W64LIT(0x4ed8aa4ae3418acb),
+ W64LIT(0x5b9cca4f7763e373), W64LIT(0x682e6ff3d6b2b8a3),
+ W64LIT(0x748f82ee5defb2fc), W64LIT(0x78a5636f43172f60),
+ W64LIT(0x84c87814a1f0ab72), W64LIT(0x8cc702081a6439ec),
+ W64LIT(0x90befffa23631e28), W64LIT(0xa4506cebde82bde9),
+ W64LIT(0xbef9a3f7b2c67915), W64LIT(0xc67178f2e372532b),
+ W64LIT(0xca273eceea26619c), W64LIT(0xd186b8c721c0c207),
+ W64LIT(0xeada7dd6cde0eb1e), W64LIT(0xf57d4f7fee6ed178),
+ W64LIT(0x06f067aa72176fba), W64LIT(0x0a637dc5a2c898a6),
+ W64LIT(0x113f9804bef90dae), W64LIT(0x1b710b35131c471b),
+ W64LIT(0x28db77f523047d84), W64LIT(0x32caab7b40c72493),
+ W64LIT(0x3c9ebe0a15c9bebc), W64LIT(0x431d67c49c100d4c),
+ W64LIT(0x4cc5d4becb3e42b6), W64LIT(0x597f299cfc657e2a),
+ W64LIT(0x5fcb6fab3ad6faec), W64LIT(0x6c44198c4a475817)
+};
+
+
+// for SHA512
+#define S0(x) (rotrFixed(x,28)^rotrFixed(x,34)^rotrFixed(x,39))
+#define S1(x) (rotrFixed(x,14)^rotrFixed(x,18)^rotrFixed(x,41))
+#define s0(x) (rotrFixed(x,1)^rotrFixed(x,8)^(x>>7))
+#define s1(x) (rotrFixed(x,19)^rotrFixed(x,61)^(x>>6))
+
+
+static void Transform512(word64* digest_, word64* buffer_)
+{
+ const word64* K = K512;
+
+ word64 W[16];
+ word64 T[8];
+
+ // Copy digest to working vars
+ memcpy(T, digest_, sizeof(T));
+
+ // 64 operations, partially loop unrolled
+ for (unsigned int j = 0; j < 80; j += 16) {
+ R( 0); R( 1); R( 2); R( 3);
+ R( 4); R( 5); R( 6); R( 7);
+ R( 8); R( 9); R(10); R(11);
+ R(12); R(13); R(14); R(15);
+ }
+
+ // Add the working vars back into digest
+
+ digest_[0] += a(0);
+ digest_[1] += b(0);
+ digest_[2] += c(0);
+ digest_[3] += d(0);
+ digest_[4] += e(0);
+ digest_[5] += f(0);
+ digest_[6] += g(0);
+ digest_[7] += h(0);
+
+ // Wipe variables
+ memset(W, 0, sizeof(W));
+ memset(T, 0, sizeof(T));
+}
+
+
+void SHA512::Transform()
+{
+ Transform512(digest_, buffer_);
+}
+
+
+void SHA384::Transform()
+{
+ Transform512(digest_, buffer_);
+}
+
+#endif // WORD64_AVIALABLE
+
+
#ifdef DO_SHA_ASM
// f1(x,y,z) (z^(x &(y^z)))
diff --git a/extra/yassl/taocrypt/test/test.cpp b/extra/yassl/taocrypt/test/test.cpp
index c0d7aa50f18..0af278404ab 100644
--- a/extra/yassl/taocrypt/test/test.cpp
+++ b/extra/yassl/taocrypt/test/test.cpp
@@ -29,6 +29,12 @@
using TaoCrypt::byte;
using TaoCrypt::word32;
using TaoCrypt::SHA;
+using TaoCrypt::SHA256;
+using TaoCrypt::SHA224;
+#ifdef WORD64_AVAILABLE
+ using TaoCrypt::SHA512;
+ using TaoCrypt::SHA384;
+#endif
using TaoCrypt::MD5;
using TaoCrypt::MD2;
using TaoCrypt::MD4;
@@ -88,8 +94,13 @@ struct testVector {
output_((byte*)out), inLen_(strlen(in)), outLen_(strlen(out)) {}
};
-void file_test(int, char**);
int sha_test();
+int sha256_test();
+#ifdef WORD64_AVAILABLE
+ int sha512_test();
+ int sha384_test();
+#endif
+int sha224_test();
int md5_test();
int md2_test();
int md4_test();
@@ -139,20 +150,20 @@ const byte msgTmp[] = { // "now is the time for all " w/o trailing 0
0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
};
-byte* global_msg = 0; // for block cipher input
-byte* global_plain = 0; // for cipher decrypt comparison
-byte* global_cipher = 0; // block output
+byte* msg = 0; // for block cipher input
+byte* plain = 0; // for cipher decrypt comparison
+byte* cipher = 0; // block output
void taocrypt_test(void* args)
{
((func_args*)args)->return_code = -1; // error state
- global_msg = NEW_TC byte[24];
- global_plain = NEW_TC byte[24];
- global_cipher = NEW_TC byte[24];
+ msg = NEW_TC byte[24];
+ plain = NEW_TC byte[24];
+ cipher = NEW_TC byte[24];
- memcpy(global_msg, msgTmp, 24);
+ memcpy(msg, msgTmp, 24);
int ret = 0;
if ( (ret = sha_test()) )
@@ -160,6 +171,30 @@ void taocrypt_test(void* args)
else
printf( "SHA test passed!\n");
+ if ( (ret = sha256_test()) )
+ err_sys("SHA-256 test failed!\n", ret);
+ else
+ printf( "SHA-256 test passed!\n");
+
+ if ( (ret = sha224_test()) )
+ err_sys("SHA-224 test failed!\n", ret);
+ else
+ printf( "SHA-224 test passed!\n");
+
+#ifdef WORD64_AVAILABLE
+
+ if ( (ret = sha512_test()) )
+ err_sys("SHA-512 test failed!\n", ret);
+ else
+ printf( "SHA-512 test passed!\n");
+
+ if ( (ret = sha384_test()) )
+ err_sys("SHA-384 test failed!\n", ret);
+ else
+ printf( "SHA-384 test passed!\n");
+
+#endif
+
if ( (ret = md5_test()) )
err_sys("MD5 test failed!\n", ret);
else
@@ -237,9 +272,9 @@ void taocrypt_test(void* args)
printf( "PKCS12 test passed!\n");
*/
- tcArrayDelete(global_cipher);
- tcArrayDelete(global_plain);
- tcArrayDelete(global_msg);
+ tcArrayDelete(cipher);
+ tcArrayDelete(plain);
+ tcArrayDelete(msg);
((func_args*)args)->return_code = ret;
}
@@ -264,7 +299,7 @@ void taocrypt_test(void* args)
#endif // NO_MAIN_DRIVER
-void file_test(char* file, byte* check)
+void file_test(const char* file, byte* check)
{
FILE* f;
int i(0);
@@ -328,6 +363,136 @@ int sha_test()
}
+int sha256_test()
+{
+ SHA256 sha;
+ byte hash[SHA256::DIGEST_SIZE];
+
+ testVector test_sha[] =
+ {
+ testVector("abc",
+ "\xBA\x78\x16\xBF\x8F\x01\xCF\xEA\x41\x41\x40\xDE\x5D\xAE\x22"
+ "\x23\xB0\x03\x61\xA3\x96\x17\x7A\x9C\xB4\x10\xFF\x61\xF2\x00"
+ "\x15\xAD"),
+ testVector("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+ "\x24\x8D\x6A\x61\xD2\x06\x38\xB8\xE5\xC0\x26\x93\x0C\x3E\x60"
+ "\x39\xA3\x3C\xE4\x59\x64\xFF\x21\x67\xF6\xEC\xED\xD4\x19\xDB"
+ "\x06\xC1")
+ };
+
+ int times( sizeof(test_sha) / sizeof(testVector) );
+ for (int i = 0; i < times; ++i) {
+ sha.Update(test_sha[i].input_, test_sha[i].inLen_);
+ sha.Final(hash);
+
+ if (memcmp(hash, test_sha[i].output_, SHA256::DIGEST_SIZE) != 0)
+ return -1 - i;
+ }
+
+ return 0;
+}
+
+
+#ifdef WORD64_AVAILABLE
+
+int sha512_test()
+{
+ SHA512 sha;
+ byte hash[SHA512::DIGEST_SIZE];
+
+ testVector test_sha[] =
+ {
+ testVector("abc",
+ "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41"
+ "\x31\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55"
+ "\xd3\x9a\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3"
+ "\xfe\xeb\xbd\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f"
+ "\xa5\x4c\xa4\x9f"),
+ testVector("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
+ "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
+ "\x8e\x95\x9b\x75\xda\xe3\x13\xda\x8c\xf4\xf7\x28\x14\xfc\x14"
+ "\x3f\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1\x72\x99\xae\xad\xb6\x88"
+ "\x90\x18\x50\x1d\x28\x9e\x49\x00\xf7\xe4\x33\x1b\x99\xde\xc4"
+ "\xb5\x43\x3a\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b"
+ "\x87\x4b\xe9\x09")
+ };
+
+ int times( sizeof(test_sha) / sizeof(testVector) );
+ for (int i = 0; i < times; ++i) {
+ sha.Update(test_sha[i].input_, test_sha[i].inLen_);
+ sha.Final(hash);
+
+ if (memcmp(hash, test_sha[i].output_, SHA512::DIGEST_SIZE) != 0)
+ return -1 - i;
+ }
+
+ return 0;
+}
+
+
+int sha384_test()
+{
+ SHA384 sha;
+ byte hash[SHA384::DIGEST_SIZE];
+
+ testVector test_sha[] =
+ {
+ testVector("abc",
+ "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b\xb5\xa0\x3d\x69\x9a\xc6\x50"
+ "\x07\x27\x2c\x32\xab\x0e\xde\xd1\x63\x1a\x8b\x60\x5a\x43\xff"
+ "\x5b\xed\x80\x86\x07\x2b\xa1\xe7\xcc\x23\x58\xba\xec\xa1\x34"
+ "\xc8\x25\xa7"),
+ testVector("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
+ "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
+ "\x09\x33\x0c\x33\xf7\x11\x47\xe8\x3d\x19\x2f\xc7\x82\xcd\x1b"
+ "\x47\x53\x11\x1b\x17\x3b\x3b\x05\xd2\x2f\xa0\x80\x86\xe3\xb0"
+ "\xf7\x12\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9\x66\xc3\xe9\xfa\x91"
+ "\x74\x60\x39")
+ };
+
+ int times( sizeof(test_sha) / sizeof(testVector) );
+ for (int i = 0; i < times; ++i) {
+ sha.Update(test_sha[i].input_, test_sha[i].inLen_);
+ sha.Final(hash);
+
+ if (memcmp(hash, test_sha[i].output_, SHA384::DIGEST_SIZE) != 0)
+ return -1 - i;
+ }
+
+ return 0;
+}
+
+#endif // WORD64_AVAILABLE
+
+
+int sha224_test()
+{
+ SHA224 sha;
+ byte hash[SHA224::DIGEST_SIZE];
+
+ testVector test_sha[] =
+ {
+ testVector("abc",
+ "\x23\x09\x7d\x22\x34\x05\xd8\x22\x86\x42\xa4\x77\xbd\xa2\x55"
+ "\xb3\x2a\xad\xbc\xe4\xbd\xa0\xb3\xf7\xe3\x6c\x9d\xa7"),
+ testVector("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
+ "\x75\x38\x8b\x16\x51\x27\x76\xcc\x5d\xba\x5d\xa1\xfd\x89\x01"
+ "\x50\xb0\xc6\x45\x5c\xb4\xf5\x8b\x19\x52\x52\x25\x25")
+ };
+
+ int times( sizeof(test_sha) / sizeof(testVector) );
+ for (int i = 0; i < times; ++i) {
+ sha.Update(test_sha[i].input_, test_sha[i].inLen_);
+ sha.Final(hash);
+
+ if (memcmp(hash, test_sha[i].output_, SHA224::DIGEST_SIZE) != 0)
+ return -1 - i;
+ }
+
+ return 0;
+}
+
+
int md5_test()
{
MD5 md5;
@@ -606,11 +771,11 @@ int des_test()
const byte iv[] = { 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef };
enc.SetKey(key, sizeof(key));
- enc.Process(global_cipher, global_msg, sz);
+ enc.Process(cipher, msg, sz);
dec.SetKey(key, sizeof(key));
- dec.Process(global_plain, global_cipher, sz);
+ dec.Process(plain, cipher, sz);
- if (memcmp(global_plain, global_msg, sz))
+ if (memcmp(plain, msg, sz))
return -50;
const byte verify1[] =
@@ -620,7 +785,7 @@ int des_test()
0x89,0x3d,0x51,0xec,0x4b,0x56,0x3b,0x53
};
- if (memcmp(global_cipher, verify1, sz))
+ if (memcmp(cipher, verify1, sz))
return -51;
// CBC mode
@@ -628,11 +793,11 @@ int des_test()
DES_CBC_Decryption dec2;
enc2.SetKey(key, sizeof(key), iv);
- enc2.Process(global_cipher, global_msg, sz);
+ enc2.Process(cipher, msg, sz);
dec2.SetKey(key, sizeof(key), iv);
- dec2.Process(global_plain, global_cipher, sz);
+ dec2.Process(plain, cipher, sz);
- if (memcmp(global_plain, global_msg, sz))
+ if (memcmp(plain, msg, sz))
return -52;
const byte verify2[] =
@@ -642,7 +807,7 @@ int des_test()
0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
};
- if (memcmp(global_cipher, verify2, sz))
+ if (memcmp(cipher, verify2, sz))
return -53;
// EDE3 CBC mode
@@ -664,11 +829,11 @@ int des_test()
};
enc3.SetKey(key3, sizeof(key3), iv3);
- enc3.Process(global_cipher, global_msg, sz);
+ enc3.Process(cipher, msg, sz);
dec3.SetKey(key3, sizeof(key3), iv3);
- dec3.Process(global_plain, global_cipher, sz);
+ dec3.Process(plain, cipher, sz);
- if (memcmp(global_plain, global_msg, sz))
+ if (memcmp(plain, msg, sz))
return -54;
const byte verify3[] =
@@ -678,7 +843,7 @@ int des_test()
0x18,0xbc,0xbb,0x6d,0xd2,0xb1,0x16,0xda
};
- if (memcmp(global_cipher, verify3, sz))
+ if (memcmp(cipher, verify3, sz))
return -55;
return 0;
@@ -697,10 +862,10 @@ int aes_test()
enc.SetKey(key, bs, iv);
dec.SetKey(key, bs, iv);
- enc.Process(global_cipher, global_msg, bs);
- dec.Process(global_plain, global_cipher, bs);
+ enc.Process(cipher, msg, bs);
+ dec.Process(plain, cipher, bs);
- if (memcmp(global_plain, global_msg, bs))
+ if (memcmp(plain, msg, bs))
return -60;
const byte verify[] =
@@ -709,7 +874,7 @@ int aes_test()
0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
};
- if (memcmp(global_cipher, verify, bs))
+ if (memcmp(cipher, verify, bs))
return -61;
AES_ECB_Encryption enc2;
@@ -718,10 +883,10 @@ int aes_test()
enc2.SetKey(key, bs, iv);
dec2.SetKey(key, bs, iv);
- enc2.Process(global_cipher, global_msg, bs);
- dec2.Process(global_plain, global_cipher, bs);
+ enc2.Process(cipher, msg, bs);
+ dec2.Process(plain, cipher, bs);
- if (memcmp(global_plain, global_msg, bs))
+ if (memcmp(plain, msg, bs))
return -62;
const byte verify2[] =
@@ -730,7 +895,7 @@ int aes_test()
0xc8,0x8c,0x33,0x3b,0xb5,0x8f,0x85,0xd1
};
- if (memcmp(global_cipher, verify2, bs))
+ if (memcmp(cipher, verify2, bs))
return -63;
return 0;
@@ -749,10 +914,10 @@ int twofish_test()
enc.SetKey(key, bs, iv);
dec.SetKey(key, bs, iv);
- enc.Process(global_cipher, global_msg, bs);
- dec.Process(global_plain, global_cipher, bs);
+ enc.Process(cipher, msg, bs);
+ dec.Process(plain, cipher, bs);
- if (memcmp(global_plain, global_msg, bs))
+ if (memcmp(plain, msg, bs))
return -60;
const byte verify[] =
@@ -761,7 +926,7 @@ int twofish_test()
0x21,0x03,0x58,0x79,0x5F,0x02,0x27,0x2C
};
- if (memcmp(global_cipher, verify, bs))
+ if (memcmp(cipher, verify, bs))
return -61;
Twofish_ECB_Encryption enc2;
@@ -770,10 +935,10 @@ int twofish_test()
enc2.SetKey(key, bs, iv);
dec2.SetKey(key, bs, iv);
- enc2.Process(global_cipher, global_msg, bs);
- dec2.Process(global_plain, global_cipher, bs);
+ enc2.Process(cipher, msg, bs);
+ dec2.Process(plain, cipher, bs);
- if (memcmp(global_plain, global_msg, bs))
+ if (memcmp(plain, msg, bs))
return -62;
const byte verify2[] =
@@ -782,7 +947,7 @@ int twofish_test()
0xC4,0xCD,0x6B,0x91,0x14,0xC5,0x3A,0x09
};
- if (memcmp(global_cipher, verify2, bs))
+ if (memcmp(cipher, verify2, bs))
return -63;
return 0;
@@ -801,10 +966,10 @@ int blowfish_test()
enc.SetKey(key, 16, iv);
dec.SetKey(key, 16, iv);
- enc.Process(global_cipher, global_msg, bs * 2);
- dec.Process(global_plain, global_cipher, bs * 2);
+ enc.Process(cipher, msg, bs * 2);
+ dec.Process(plain, cipher, bs * 2);
- if (memcmp(global_plain, global_msg, bs))
+ if (memcmp(plain, msg, bs))
return -60;
const byte verify[] =
@@ -813,7 +978,7 @@ int blowfish_test()
0xBC,0xD9,0x08,0xC4,0x94,0x6C,0x89,0xA3
};
- if (memcmp(global_cipher, verify, bs))
+ if (memcmp(cipher, verify, bs))
return -61;
Blowfish_ECB_Encryption enc2;
@@ -822,10 +987,10 @@ int blowfish_test()
enc2.SetKey(key, 16, iv);
dec2.SetKey(key, 16, iv);
- enc2.Process(global_cipher, global_msg, bs * 2);
- dec2.Process(global_plain, global_cipher, bs * 2);
+ enc2.Process(cipher, msg, bs * 2);
+ dec2.Process(plain, cipher, bs * 2);
- if (memcmp(global_plain, global_msg, bs))
+ if (memcmp(plain, msg, bs))
return -62;
const byte verify2[] =
@@ -834,7 +999,7 @@ int blowfish_test()
0x8F,0xCE,0x39,0x32,0xDE,0xD7,0xBC,0x5B
};
- if (memcmp(global_cipher, verify2, bs))
+ if (memcmp(cipher, verify2, bs))
return -63;
return 0;
diff --git a/extra/yassl/testsuite/testsuite.cpp b/extra/yassl/testsuite/testsuite.cpp
index 06e75153341..3cd832ebb03 100644
--- a/extra/yassl/testsuite/testsuite.cpp
+++ b/extra/yassl/testsuite/testsuite.cpp
@@ -7,7 +7,7 @@
typedef unsigned char byte;
void taocrypt_test(void*);
-void file_test(char*, byte*);
+void file_test(const char*, byte*);
void client_test(void*);
void echoclient_test(void*);
@@ -86,8 +86,8 @@ int main(int argc, char** argv)
// input output compare
byte input[TaoCrypt::MD5::DIGEST_SIZE];
byte output[TaoCrypt::MD5::DIGEST_SIZE];
- file_test((char*) "input", input);
- file_test((char*) "output", output);
+ file_test("input", input);
+ file_test("output", output);
assert(memcmp(input, output, sizeof(input)) == 0);
printf("\nAll tests passed!\n");
@@ -141,17 +141,16 @@ int test_openSSL_des()
/* test des encrypt/decrypt */
char data[] = "this is my data ";
int dataSz = strlen(data);
- DES_key_schedule local_key[3];
+ DES_key_schedule key[3];
byte iv[8];
EVP_BytesToKey(EVP_des_ede3_cbc(), EVP_md5(), NULL, (byte*)data, dataSz, 1,
- (byte*)local_key, iv);
+ (byte*)key, iv);
byte cipher[16];
- DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz,
- &local_key[0], &local_key[1],
- &local_key[2], &iv, true);
+ DES_ede3_cbc_encrypt((byte*)data, cipher, dataSz, &key[0], &key[1],
+ &key[2], &iv, true);
byte plain[16];
- DES_ede3_cbc_encrypt(cipher, plain, 16, &local_key[0], &local_key[1],
- &local_key[2], &iv, false);
+ DES_ede3_cbc_encrypt(cipher, plain, 16, &key[0], &key[1], &key[2],
+ &iv, false);
return 0;
}
diff --git a/include/my_time.h b/include/my_time.h
index d96c5822069..6aa25487cf1 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -72,6 +72,8 @@ typedef long my_time_t;
#define TIME_MAX_SECOND 59
#define TIME_MAX_VALUE (TIME_MAX_HOUR*10000 + TIME_MAX_MINUTE*100 + \
TIME_MAX_SECOND)
+#define TIME_MAX_VALUE_SECONDS (TIME_MAX_HOUR * 3600L + \
+ TIME_MAX_MINUTE * 60L + TIME_MAX_SECOND)
my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
ulong flags, int *was_cut);
diff --git a/include/mysql.h b/include/mysql.h
index f76ae10ca16..33bdf80ef73 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -525,7 +525,7 @@ MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
- const char *arg);
+ const void *arg);
void STDCALL mysql_free_result(MYSQL_RES *result);
void STDCALL mysql_data_seek(MYSQL_RES *result,
my_ulonglong offset);
diff --git a/include/violite.h b/include/violite.h
index 2647342ed65..04365213ec0 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -102,6 +102,9 @@ void vio_timeout(Vio *vio,uint which, uint timeout);
#define HEADER_DES_LOCL_H dummy_something
#define YASSL_MYSQL_COMPATIBLE
#define YASSL_PREFIX
+/* Set yaSSL to use same type as MySQL do for socket handles */
+typedef my_socket YASSL_SOCKET_T;
+#define YASSL_SOCKET_T_DEFINED
#include <openssl/ssl.h>
#include <openssl/err.h>
diff --git a/mysql-test/include/gis_generic.inc b/mysql-test/include/gis_generic.inc
index e3b716953c3..e4fee4448c1 100644
--- a/mysql-test/include/gis_generic.inc
+++ b/mysql-test/include/gis_generic.inc
@@ -178,4 +178,73 @@ insert into t1 (fl) values (pointfromtext('point(1,1)'));
drop table t1;
-# End of 5.0 tests
+--echo End of 4.1 tests
+
+
+#
+# Bug#24563: MBROverlaps does not seem to function propertly
+# Bug#54888: MBROverlaps missing in 5.1?
+#
+
+# Test all MBR* functions and their non-MBR-prefixed aliases,
+# using shifted squares to verify the spatial relations.
+
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+
+# Overlaps needs a few more tests, with point and line dimensions
+
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/lib/mtr_cases.pl b/mysql-test/lib/mtr_cases.pl
index 22290a88d39..28c78fbffeb 100644
--- a/mysql-test/lib/mtr_cases.pl
+++ b/mysql-test/lib/mtr_cases.pl
@@ -498,6 +498,17 @@ sub collect_one_test_case($$$$$$$) {
{
mtr_options_from_test_file($tinfo,"$testdir/${tname}.test");
+ if ( defined $::used_default_engine )
+ {
+ # Different default engine is used
+ # tag test to require that engine
+ $tinfo->{'ndb_test'}= 1
+ if ( $::used_default_engine =~ /^ndb/i );
+
+ $tinfo->{'innodb_test'}= 1
+ if ( $::used_default_engine =~ /^innodb/i );
+ }
+
if ( $tinfo->{'big_test'} and ! $::opt_big_test )
{
$tinfo->{'skip'}= 1;
diff --git a/mysql-test/lib/mtr_process.pl b/mysql-test/lib/mtr_process.pl
index 690ca8313dd..53bf37bcc83 100644
--- a/mysql-test/lib/mtr_process.pl
+++ b/mysql-test/lib/mtr_process.pl
@@ -38,8 +38,8 @@ sub mtr_kill_processes ($);
sub mtr_ping_with_timeout($);
sub mtr_ping_port ($);
-# static in C
-sub spawn_impl ($$$$$$$$);
+# Local function
+sub spawn_impl ($$$$$$$);
##############################################################################
#
@@ -47,18 +47,16 @@ sub spawn_impl ($$$$$$$$);
#
##############################################################################
-# This function try to mimic the C version used in "netware/mysql_test_run.c"
-
sub mtr_run ($$$$$$;$) {
my $path= shift;
my $arg_list_t= shift;
my $input= shift;
my $output= shift;
my $error= shift;
- my $pid_file= shift;
+ my $pid_file= shift; # Not used
my $spawn_opts= shift;
- return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,$pid_file,
+ return spawn_impl($path,$arg_list_t,'run',$input,$output,$error,
$spawn_opts);
}
@@ -68,10 +66,10 @@ sub mtr_run_test ($$$$$$;$) {
my $input= shift;
my $output= shift;
my $error= shift;
- my $pid_file= shift;
+ my $pid_file= shift; # Not used
my $spawn_opts= shift;
- return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,$pid_file,
+ return spawn_impl($path,$arg_list_t,'test',$input,$output,$error,
$spawn_opts);
}
@@ -81,28 +79,22 @@ sub mtr_spawn ($$$$$$;$) {
my $input= shift;
my $output= shift;
my $error= shift;
- my $pid_file= shift;
+ my $pid_file= shift; # Not used
my $spawn_opts= shift;
- return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,$pid_file,
+ return spawn_impl($path,$arg_list_t,'spawn',$input,$output,$error,
$spawn_opts);
}
-##############################################################################
-#
-# If $join is set, we return the error code, else we return the PID
-#
-##############################################################################
-sub spawn_impl ($$$$$$$$) {
+sub spawn_impl ($$$$$$$) {
my $path= shift;
my $arg_list_t= shift;
my $mode= shift;
my $input= shift;
my $output= shift;
my $error= shift;
- my $pid_file= shift; # FIXME
my $spawn_opts= shift;
if ( $::opt_script_debug )
@@ -155,10 +147,6 @@ sub spawn_impl ($$$$$$$$) {
else
{
# Child, redirect output and exec
- # FIXME I tried POSIX::setsid() here to detach and, I hoped,
- # avoid zombies. But everything went wild, somehow the parent
- # became a deamon as well, and was hard to kill ;-)
- # Need to catch SIGCHLD and do waitpid or something instead......
$SIG{INT}= 'DEFAULT'; # Parent do some stuff, we don't
@@ -196,7 +184,15 @@ sub spawn_impl ($$$$$$$$) {
}
else
{
- if ( ! open(STDERR,$log_file_open_mode,$error) )
+ if ( $::glob_win32_perl )
+ {
+ # Don't redirect stdout on ActiveState perl since this is
+ # just another thread in the same process.
+ # Should be fixed so that the thread that is created with fork
+ # executes the exe in another process and wait's for it to return.
+ # In the meanwhile, we get all the output from mysqld's to screen
+ }
+ elsif ( ! open(STDERR,$log_file_open_mode,$error) )
{
mtr_child_error("can't redirect STDERR to \"$error\": $!");
}
@@ -259,9 +255,7 @@ sub spawn_parent_impl {
# We do blocking waitpid() until we get the return from the
# "mysqltest" call. But if a mysqld process dies that we
# started, we take this as an error, and kill mysqltest.
- #
- # FIXME is this as it should be? Can't mysqld terminate
- # normally from running a test case?
+
my $exit_value= -1;
my $saved_exit_value;
@@ -450,7 +444,6 @@ sub mtr_kill_leftovers () {
# We scan the "var/run/" directory for other process id's to kill
- # FIXME $path_run_dir or something
my $rundir= "$::opt_vardir/run";
mtr_debug("Processing PID files in directory '$rundir'...");
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 43ed90534d4..46938ea7cde 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -305,6 +305,7 @@ our $path_sql_dir;
our @data_dir_lst;
our $used_binlog_format;
+our $used_default_engine;
our $debug_compiled_binaries;
our $glob_tot_real_time= 0;
@@ -520,7 +521,7 @@ sub command_line_setup () {
'compress' => \$opt_compress,
'bench' => \$opt_bench,
'small-bench' => \$opt_small_bench,
- 'with-ndbcluster' => \$opt_with_ndbcluster,
+ 'with-ndbcluster|ndb' => \$opt_with_ndbcluster,
'vs-config' => \$opt_vs_config,
# Control what test suites or cases to run
@@ -777,6 +778,26 @@ sub command_line_setup () {
mtr_report("Using binlog format '$used_binlog_format'");
}
+
+ # --------------------------------------------------------------------------
+ # Find out default storage engine being used(if any)
+ # --------------------------------------------------------------------------
+ if ( $opt_with_ndbcluster )
+ {
+ # --ndb or --with-ndbcluster turns on --default-storage-engine=ndbcluster
+ push(@opt_extra_mysqld_opt, "--default-storage-engine=ndbcluster");
+ }
+
+ foreach my $arg ( @opt_extra_mysqld_opt )
+ {
+ if ( $arg =~ /default-storage-engine=(\S+)/ )
+ {
+ $used_default_engine= $1;
+ }
+ }
+ mtr_report("Using default engine '$used_default_engine'")
+ if defined $used_default_engine;
+
# --------------------------------------------------------------------------
# Check if we should speed up tests by trying to run on tmpfs
# --------------------------------------------------------------------------
@@ -849,20 +870,22 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Check im suport
# --------------------------------------------------------------------------
- if (!$opt_extern)
+ if ($opt_extern)
{
- if ( $mysql_version_id < 50000 ) {
- # Instance manager is not supported until 5.0
- $opt_skip_im= 1;
-
- }
-
- if ( $glob_win32 ) {
- mtr_report("Disable Instance manager - not supported on Windows");
- $opt_skip_im= 1;
- }
-
+ mtr_report("Disable instance manager when running with extern mysqld");
+ $opt_skip_im= 1;
}
+ elsif ( $mysql_version_id < 50000 )
+ {
+ # Instance manager is not supported until 5.0
+ $opt_skip_im= 1;
+ }
+ elsif ( $glob_win32 )
+ {
+ mtr_report("Disable Instance manager - testing not supported on Windows");
+ $opt_skip_im= 1;
+ }
+
# --------------------------------------------------------------------------
# Record flag
# --------------------------------------------------------------------------
@@ -900,10 +923,6 @@ sub command_line_setup () {
# --------------------------------------------------------------------------
# Ndb cluster flags
# --------------------------------------------------------------------------
- if ( $opt_with_ndbcluster and !$opt_bench)
- {
- mtr_error("Can only use --with-ndbcluster together with --bench");
- }
if ( $opt_ndbconnectstring )
{
@@ -1056,8 +1075,6 @@ sub command_line_setup () {
# socket path names.
$sockdir = tempdir(CLEANUP => 0) if ( length($sockdir) > 80 );
- # Put this into a hash, will be a C struct
-
$master->[0]=
{
pid => 0,
@@ -1065,7 +1082,6 @@ sub command_line_setup () {
idx => 0,
path_myddir => "$opt_vardir/master-data",
path_myerr => "$opt_vardir/log/master.err",
- path_mylog => "$opt_vardir/log/master.log",
path_pid => "$opt_vardir/run/master.pid",
path_sock => "$sockdir/master.sock",
port => $opt_master_myport,
@@ -1081,7 +1097,6 @@ sub command_line_setup () {
idx => 1,
path_myddir => "$opt_vardir/master1-data",
path_myerr => "$opt_vardir/log/master1.err",
- path_mylog => "$opt_vardir/log/master1.log",
path_pid => "$opt_vardir/run/master1.pid",
path_sock => "$sockdir/master1.sock",
port => $opt_master_myport + 1,
@@ -1097,7 +1112,6 @@ sub command_line_setup () {
idx => 0,
path_myddir => "$opt_vardir/slave-data",
path_myerr => "$opt_vardir/log/slave.err",
- path_mylog => "$opt_vardir/log/slave.log",
path_pid => "$opt_vardir/run/slave.pid",
path_sock => "$sockdir/slave.sock",
port => $opt_slave_myport,
@@ -1114,7 +1128,6 @@ sub command_line_setup () {
idx => 1,
path_myddir => "$opt_vardir/slave1-data",
path_myerr => "$opt_vardir/log/slave1.err",
- path_mylog => "$opt_vardir/log/slave1.log",
path_pid => "$opt_vardir/run/slave1.pid",
path_sock => "$sockdir/slave1.sock",
port => $opt_slave_myport + 1,
@@ -1130,7 +1143,6 @@ sub command_line_setup () {
idx => 2,
path_myddir => "$opt_vardir/slave2-data",
path_myerr => "$opt_vardir/log/slave2.err",
- path_mylog => "$opt_vardir/log/slave2.log",
path_pid => "$opt_vardir/run/slave2.pid",
path_sock => "$sockdir/slave2.sock",
port => $opt_slave_myport + 2,
@@ -1334,7 +1346,7 @@ sub collect_mysqld_features () {
#
# Execute "mysqld --no-defaults --help --verbose" to get a
- # of all features and settings
+ # list of all features and settings
#
my $list= `$exe_mysqld --no-defaults --verbose --help`;
@@ -1398,6 +1410,40 @@ sub collect_mysqld_features () {
}
+sub run_query($$) {
+ my ($mysqld, $query)= @_;
+
+ my $args;
+ mtr_init_args(\$args);
+
+ mtr_add_arg($args, "--no-defaults");
+ mtr_add_arg($args, "--user=%s", $opt_user);
+ mtr_add_arg($args, "--port=%d", $mysqld->{'port'});
+ mtr_add_arg($args, "--socket=%s", $mysqld->{'path_sock'});
+ mtr_add_arg($args, "--silent"); # Tab separated output
+ mtr_add_arg($args, "-e '%s'", $query);
+
+ my $cmd= "$exe_mysql " . join(' ', @$args);
+ mtr_verbose("cmd: $cmd");
+ return `$cmd`;
+}
+
+
+sub collect_mysqld_features_from_running_server ()
+{
+ my $list= run_query($master->[0], "use mysql; SHOW VARIABLES");
+
+ foreach my $line (split('\n', $list))
+ {
+ # Put variables into hash
+ if ( $line =~ /^([\S]+)[ \t]+(.*?)\r?$/ )
+ {
+ print "$1=\"$2\"\n";
+ $mysqld_variables{$1}= $2;
+ }
+ }
+}
+
sub executable_setup_im () {
# Look for instance manager binary - mysqlmanager
@@ -1933,7 +1979,7 @@ sub environment_setup () {
# ----------------------------------------------------
my $cmdline_mysqlbinlog=
mtr_native_path($exe_mysqlbinlog) .
- " --no-defaults --disable-force-if-open --debug-info --local-load=$opt_tmpdir";
+ " --no-defaults --disable-force-if-open --debug-info";
if ( !$opt_extern && $mysql_version_id >= 50000 )
{
$cmdline_mysqlbinlog .=" --character-sets-dir=$path_charsetsdir";
@@ -2802,10 +2848,7 @@ sub initialize_servers () {
}
else
{
- if ($opt_verbose)
- {
- mtr_report("No need to create '$opt_vardir' it already exists");
- }
+ mtr_verbose("No need to create '$opt_vardir' it already exists");
}
}
else
@@ -3712,8 +3755,10 @@ sub mysqld_arguments ($$$$) {
mtr_add_arg($args, "%s--log-output=table,file", $prefix);
}
- mtr_add_arg($args, "%s--log=%s", $prefix, $mysqld->{'path_mylog'});
-
+ my $log_base_path= "$opt_vardir/log/$mysqld->{'type'}$sidx";
+ mtr_add_arg($args, "%s--log=%s.log", $prefix, $log_base_path);
+ mtr_add_arg($args,
+ "%s--log-slow-queries=%s-slow.log", $prefix, $log_base_path);
# Check if "extra_opt" contains --skip-log-bin
my $skip_binlog= grep(/^--skip-log-bin/, @$extra_opt);
@@ -5016,7 +5061,7 @@ Options to control what engine/variation to run
skip-ssl Dont start server with support for ssl connections
bench Run the benchmark suite
small-bench Run the benchmarks with --small-tests --small-tables
- with-ndbcluster Use cluster as default table type for benchmark
+ ndb|with-ndbcluster Use cluster as default table type
vs-config Visual Studio configuration used to create executables
(default: MTR_VS_CONFIG environment variable)
diff --git a/mysql-test/r/archive_gis.result b/mysql-test/r/archive_gis.result
index 210140ea11b..6f8175bd609 100644
--- a/mysql-test/r/archive_gis.result
+++ b/mysql-test/r/archive_gis.result
@@ -393,7 +393,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
-120 121 0 0 0 0 0 0 1 0
+120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second,
@@ -460,3 +460,89 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/crash_commit_before.result b/mysql-test/r/crash_commit_before.result
index 8eba584c539..34fb3284bae 100644
--- a/mysql-test/r/crash_commit_before.result
+++ b/mysql-test/r/crash_commit_before.result
@@ -11,3 +11,4 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * FROM t1;
a
+DROP TABLE t1;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 53892b219eb..7f48e2c9ecd 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -784,6 +784,7 @@ t1 CREATE TABLE `t1` (
drop table t1;
create table t1 (upgrade int);
drop table t1;
+End of 5.0 tests
CREATE TABLE t1 (a int, b int);
insert into t1 values (1,1),(1,2);
CREATE TABLE t2 (primary key (a)) select * from t1;
@@ -838,3 +839,4 @@ USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
+End of 5.1 tests
diff --git a/mysql-test/r/date_formats.result b/mysql-test/r/date_formats.result
index cf3495ef26d..9d8de75fe60 100644
--- a/mysql-test/r/date_formats.result
+++ b/mysql-test/r/date_formats.result
@@ -189,12 +189,12 @@ date format datetime
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 2003-01-02 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 2003-01-02 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 2003-01-02 23:11:12
-10:20:10 %H:%i:%s 0000-00-00 00:00:00
-10:20:10 %h:%i:%s.%f 0000-00-00 00:00:00
-10:20:10 %T 0000-00-00 00:00:00
-10:20:10AM %h:%i:%s%p 0000-00-00 00:00:00
-10:20:10AM %r 0000-00-00 00:00:00
-10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 00:00:00
+10:20:10 %H:%i:%s 0000-00-00 10:20:10
+10:20:10 %h:%i:%s.%f 0000-00-00 10:20:10
+10:20:10 %T 0000-00-00 10:20:10
+10:20:10AM %h:%i:%s%p 0000-00-00 10:20:10
+10:20:10AM %r 0000-00-00 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 0000-00-00 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 2001-01-15 12:59:58
15 September 2001 %d %M %Y 2001-09-15 00:00:00
15 SEPTEMB 2001 %d %M %Y 2001-09-15 00:00:00
@@ -211,13 +211,6 @@ Tuesday 52 2001 %W %V %X 2002-01-01 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 2001-01-15 00:00:00
15-01-20 %d-%m-%y 2020-01-15 00:00:00
15-2001-1 %d-%Y-%c 2001-01-15 00:00:00
-Warnings:
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10'
-Warning 1292 Incorrect datetime value: '0000-00-00 10:20:10.440000'
select date,format,DATE(str_to_date(date, format)) as date2 from t1;
date format date2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 2003-01-02
@@ -258,12 +251,12 @@ date format time
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
-10:20:10 %H:%i:%s NULL
-10:20:10 %h:%i:%s.%f NULL
-10:20:10 %T NULL
-10:20:10AM %h:%i:%s%p NULL
-10:20:10AM %r NULL
-10:20:10.44AM %h:%i:%s.%f%p NULL
+10:20:10 %H:%i:%s 10:20:10
+10:20:10 %h:%i:%s.%f 10:20:10
+10:20:10 %T 10:20:10
+10:20:10AM %h:%i:%s%p 10:20:10
+10:20:10AM %r 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00
@@ -280,13 +273,6 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
-Warnings:
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000'
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
date format time2
2003-01-02 10:11:12 %Y-%m-%d %H:%i:%S 10:11:12
@@ -296,12 +282,12 @@ date format time2
2003-01-02 02:11:12.12345AM %Y-%m-%d %h:%i:%S.%f %p 02:11:12.123450
2003-01-02 12:11:12.12345 am %Y-%m-%d %h:%i:%S.%f%p 00:11:12.123450
2003-01-02 11:11:12Pm %Y-%m-%d %h:%i:%S%p 23:11:12
-10:20:10 %H:%i:%s NULL
-10:20:10 %h:%i:%s.%f NULL
-10:20:10 %T NULL
-10:20:10AM %h:%i:%s%p NULL
-10:20:10AM %r NULL
-10:20:10.44AM %h:%i:%s.%f%p NULL
+10:20:10 %H:%i:%s 10:20:10
+10:20:10 %h:%i:%s.%f 10:20:10
+10:20:10 %T 10:20:10
+10:20:10AM %h:%i:%s%p 10:20:10
+10:20:10AM %r 10:20:10
+10:20:10.44AM %h:%i:%s.%f%p 10:20:10.440000
15-01-2001 12:59:58 %d-%m-%Y %H:%i:%S 12:59:58
15 September 2001 %d %M %Y 00:00:00
15 SEPTEMB 2001 %d %M %Y 00:00:00
@@ -318,13 +304,6 @@ Tuesday 52 2001 %W %V %X 00:00:00
15-01-2001 %d-%m-%Y %H:%i:%S 00:00:00
15-01-20 %d-%m-%y 00:00:00
15-2001-1 %d-%Y-%c 00:00:00
-Warnings:
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10'
-Warning 1292 Truncated incorrect time value: '0000-00-00 10:20:10.440000'
select concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'));
concat('',str_to_date('8:11:2.123456 03-01-02','%H:%i:%S.%f %y-%m-%d'))
2003-01-02 08:11:02.123456
@@ -473,8 +452,6 @@ create table t1 select str_to_date("2003-01-02 10:11:12.0012", "%Y-%m-%d %H:%i:%
str_to_date("10:11:12.0012", "%H:%i:%S.%f") as f2,
str_to_date("2003-01-02", "%Y-%m-%d") as f3,
str_to_date("02", "%d") as f4, str_to_date("02 10", "%d %H") as f5;
-Warnings:
-Warning 1265 Data truncated for column 'f4' at row 1
describe t1;
Field Type Null Key Default Extra
f1 datetime YES NULL
@@ -484,7 +461,7 @@ f4 date YES NULL
f5 time YES NULL
select * from t1;
f1 f2 f3 f4 f5
-2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-00 58:00:00
+2003-01-02 10:11:12 10:11:12 2003-01-02 0000-00-02 58:00:00
drop table t1;
create table t1 select "02 10" as a, "%d %H" as b;
select str_to_date(a,b) from t1;
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 972bb99d56f..7177028cb48 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1287,6 +1287,15 @@ select var_samp(e) as '0.5', var_pop(e) as '0.25' from bug22555;
0.5 0.25
0.5000 0.2500
drop table bug22555;
+create table t1 (a decimal(20));
+insert into t1 values (12345678901234567890);
+select count(a) from t1;
+count(a)
+1
+select count(distinct a) from t1;
+count(distinct a)
+1
+drop table t1;
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(1,2),(1,3),(1,4),(1,5),(1,6),(1,7),(1,8);
INSERT INTO t1 SELECT a, b+8 FROM t1;
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 8bc613be4c0..283327430ba 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2297,6 +2297,15 @@ A B tire
0
# # 1
## ## 2
+SELECT REPEAT('0', CAST(0 AS UNSIGNED));
+REPEAT('0', CAST(0 AS UNSIGNED))
+
+SELECT REPEAT('0', -2);
+REPEAT('0', -2)
+
+SELECT REPEAT('0', 2);
+REPEAT('0', 2)
+00
DROP TABLE t1;
SELECT UNHEX('G');
UNHEX('G')
diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result
index 63a92fa3a62..cfca4e318c0 100644
--- a/mysql-test/r/gis.result
+++ b/mysql-test/r/gis.result
@@ -385,7 +385,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
-120 121 0 0 0 0 0 0 1 0
+120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second,
@@ -781,6 +781,91 @@ Field Type Null Key Default Extra
a geometry YES NULL
DROP VIEW v1,v2;
DROP TABLE t1;
+create table t1 (name VARCHAR(100), square GEOMETRY);
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
create view v1 as select * from t1;
desc v1;
@@ -792,3 +877,4 @@ f4 geometry YES NULL
f5 datetime YES NULL
drop view v1;
drop table t1;
+End of 5.1 tests
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index 3453a486da9..3fd6587baaa 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -706,7 +706,7 @@ Warnings:
Warning 1356 View 'test.v2' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
show create table v3;
View Create View
-v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `test`.`sub1`(1) AS `c`
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `sub1`(1) AS `c`
Warnings:
Warning 1356 View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
drop view v2;
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index f2d504f555f..4d104c64fa9 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -3159,3 +3159,21 @@ t2 CREATE TABLE `t2` (
CONSTRAINT `t2_t1` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2, t1;
+CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
+ALTER TABLE t2 MODIFY a INT NOT NULL;
+ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
+DELETE FROM t1;
+DROP TABLE t2,t1;
+CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('DDD');
+SELECT * FROM t1;
+a
+DDD
+DROP TABLE t1;
diff --git a/mysql-test/r/innodb_gis.result b/mysql-test/r/innodb_gis.result
index a65155909f1..e5d921514c5 100644
--- a/mysql-test/r/innodb_gis.result
+++ b/mysql-test/r/innodb_gis.result
@@ -393,7 +393,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
-120 121 0 0 0 0 0 0 1 0
+120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second,
@@ -460,5 +460,91 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
create table t1 (g geometry not null, spatial gk(g)) engine=innodb;
ERROR HY000: The used table type doesn't support SPATIAL indexes
diff --git a/mysql-test/r/log_tables-big.result b/mysql-test/r/log_tables-big.result
new file mode 100644
index 00000000000..9b81127c825
--- /dev/null
+++ b/mysql-test/r/log_tables-big.result
@@ -0,0 +1,29 @@
+set session long_query_time=10;
+select get_lock('bug27638', 1);
+get_lock('bug27638', 1)
+1
+set session long_query_time=1;
+truncate table mysql.slow_log;
+select get_lock('bug27638', 2);
+get_lock('bug27638', 2)
+0
+select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+qt sql_text
+OK select get_lock('bug27638', 2)
+truncate table mysql.slow_log;
+select get_lock('bug27638', 60);
+get_lock('bug27638', 60)
+0
+select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+qt sql_text
+OK select get_lock('bug27638', 60)
+truncate table mysql.slow_log;
+select get_lock('bug27638', 101);
+get_lock('bug27638', 101)
+0
+select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+qt sql_text
+OK select get_lock('bug27638', 101)
+select release_lock('bug27638');
+release_lock('bug27638')
+1
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index 5a7dcca2420..57961698034 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -290,23 +290,23 @@ SET @@session.sql_mode=0/*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
create table t1 (a varchar(64) character set utf8)/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-6-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-6-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-7-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-7-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-8-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-8-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-9-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-9-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=7/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-a-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-a-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-b-0' INTO table t1/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-b-0' INTO table t1/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-load data LOCAL INFILE 'MYSQL_TMP_DIR/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/;
+load data LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/SQL_LOAD_MB-c-0' INTO table t1 character set koi8r/*!*/;
SET TIMESTAMP=1000000000/*!*/;
drop table t1/*!*/;
DELIMITER ;
diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result
index 895e5dd46fa..d898869caac 100644
--- a/mysql-test/r/mysqldump.result
+++ b/mysql-test/r/mysqldump.result
@@ -1568,29 +1568,17 @@ create table t3(a varchar(30) primary key, b int not null);
test_sequence
------ Testing with illegal table names ------
mysqldump: Couldn't find table: "\d-2-1.sql"
-
mysqldump: Couldn't find table: "\t1"
-
mysqldump: Couldn't find table: "\t1"
-
mysqldump: Couldn't find table: "\\t1"
-
mysqldump: Couldn't find table: "t\1"
-
mysqldump: Couldn't find table: "t\1"
-
mysqldump: Couldn't find table: "t/1"
-
mysqldump: Couldn't find table: "T_1"
-
mysqldump: Couldn't find table: "T%1"
-
mysqldump: Couldn't find table: "T'1"
-
mysqldump: Couldn't find table: "T_1"
-
mysqldump: Couldn't find table: "T_"
-
test_sequence
------ Testing with illegal database names ------
mysqldump: Got error: 1049: Unknown database 'mysqldump_test_d' when selecting the database
@@ -3217,6 +3205,83 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
</mysqldump>
DROP TABLE t1;
#
+# Bug#26346: stack + buffer overrun in mysqldump
+#
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+mysqldump: Input filename or options too long: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
+DROP TABLE t1;
+CREATE TABLE t2 (a int);
+CREATE TABLE t3 (a int);
+CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+DROP TABLE IF EXISTS `t1`;
+CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t2`,`t3`);
+DROP TABLE IF EXISTS `t2`;
+CREATE TABLE `t2` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t2` WRITE;
+/*!40000 ALTER TABLE `t2` DISABLE KEYS */;
+/*!40000 ALTER TABLE `t2` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `t3`;
+CREATE TABLE `t3` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+LOCK TABLES `t3` WRITE;
+/*!40000 ALTER TABLE `t3` DISABLE KEYS */;
+/*!40000 ALTER TABLE `t3` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+DROP TABLE t1, t2, t3;
+#
+# Bug #23491: MySQLDump prefix function call in a view by database name
+#
+create database bug23491_original;
+create database bug23491_restore;
+use bug23491_original;
+create table t1 (c1 int);
+create view v1 as select * from t1;
+create procedure p1() select 1;
+create function f1() returns int return 1;
+create view v2 as select f1();
+create function f2() returns int return f1();
+create view v3 as select bug23491_original.f1();
+use bug23491_restore;
+show create view bug23491_restore.v2;
+View Create View
+v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select `f1`() AS `f1()`
+show create view bug23491_restore.v3;
+View Create View
+v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `bug23491_original`.`f1`() AS `bug23491_original.f1()`
+drop database bug23491_original;
+drop database bug23491_restore;
+use test;
+#
# End of 5.0 tests
#
drop table if exists t1;
diff --git a/mysql-test/r/ndb_gis.result b/mysql-test/r/ndb_gis.result
index 23341ee0216..279a0884b5b 100644
--- a/mysql-test/r/ndb_gis.result
+++ b/mysql-test/r/ndb_gis.result
@@ -393,7 +393,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
-120 121 0 0 0 0 0 0 1 0
+120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second,
@@ -460,6 +460,94 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+Warnings:
+Error 1466 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
set engine_condition_pushdown = on;
DROP TABLE IF EXISTS t1, gis_point, gis_line, gis_polygon, gis_multi_point, gis_multi_line, gis_multi_polygon, gis_geometrycollection, gis_geometry;
CREATE TABLE gis_point (fid INTEGER PRIMARY KEY AUTO_INCREMENT, g POINT);
@@ -855,7 +943,7 @@ Intersects(g1.g, g2.g) as i, Crosses(g1.g, g2.g) as r
FROM gis_geometrycollection g1, gis_geometrycollection g2 ORDER BY first, second;
first second w c o e d t i r
120 120 1 1 0 1 0 0 1 0
-120 121 0 0 0 0 0 0 1 0
+120 121 0 0 1 0 0 0 1 0
121 120 0 0 1 0 0 0 1 0
121 121 1 1 0 1 0 0 1 0
explain extended SELECT g1.fid as first, g2.fid as second,
@@ -922,3 +1010,91 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
insert into t1 (fl) values (pointfromtext('point(1,1)'));
ERROR 23000: Column 'fl' cannot be null
drop table t1;
+End of 4.1 tests
+CREATE TABLE t1 (name VARCHAR(100), square GEOMETRY);
+Warnings:
+Error 1466 Table storage engine 'ndbcluster' does not support the create option 'Binlog of table with BLOB attribute and no PK'
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrcontains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrdisjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrequal
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrintersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbroverlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrtouches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+mbrwithin
+big,center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+contains
+center,small
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+disjoint
+down3,left3,right3,up3
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+equals
+center
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+intersect
+big,center,down,down2,left,left2,right,right2,small,up,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+overlaps
+down,left,right,up
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+touches
+down2,left2,right2,up2
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+within
+big,center
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+overlaps
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+overlaps
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+Overlaps(@horiz1, @vert1)
+0
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+Overlaps(@horiz1, @horiz2)
+1
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+Overlaps(@horiz1, @horiz3)
+0
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+Overlaps(@horiz1, @point1)
+0
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+Overlaps(@horiz1, @point2)
+0
+DROP TABLE t1;
+End of 5.0 tests
diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result
index 34d8e3ab768..92900ac1a83 100644
--- a/mysql-test/r/openssl_1.result
+++ b/mysql-test/r/openssl_1.result
@@ -51,3 +51,5 @@ SSL error: Unable to get private key from ''
mysqltest: Could not open connection 'default': 2026 SSL connection error
SSL error: Unable to get certificate from ''
mysqltest: Could not open connection 'default': 2026 SSL connection error
+Variable_name Value
+Ssl_cipher DHE-RSA-AES256-SHA
diff --git a/mysql-test/r/rpl_000015.result b/mysql-test/r/rpl_000015.result
index 13da328e522..8d23136420f 100644
--- a/mysql-test/r/rpl_000015.result
+++ b/mysql-test/r/rpl_000015.result
@@ -4,20 +4,20 @@ File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106
reset slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
change master to master_host='127.0.0.1';
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test DEFAULT_MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # No
change master to master_host='127.0.0.1',master_user='root',
master_password='',master_port=MASTER_PORT;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 7 4 # # No No 0 0 0 # None 0 No # No
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 7 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No
drop table if exists t1;
create table t1 (n int, PRIMARY KEY(n));
insert into t1 values (10),(45),(90);
diff --git a/mysql-test/r/rpl_change_master.result b/mysql-test/r/rpl_change_master.result
index c3909de5ba5..680328bcea5 100644
--- a/mysql-test/r/rpl_change_master.result
+++ b/mysql-test/r/rpl_change_master.result
@@ -12,12 +12,12 @@ insert into t1 values(1);
insert into t1 values(2);
stop slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No
change master to master_user='root';
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No
start slave;
select * from t1;
n
diff --git a/mysql-test/r/rpl_deadlock_innodb.result b/mysql-test/r/rpl_deadlock_innodb.result
index 48fdf051d50..914e1497094 100644
--- a/mysql-test/r/rpl_deadlock_innodb.result
+++ b/mysql-test/r/rpl_deadlock_innodb.result
@@ -78,6 +78,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
stop slave;
delete from t3;
change master to master_log_pos=548;
@@ -132,6 +133,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
set @my_max_relay_log_size= @@global.max_relay_log_size;
set global max_relay_log_size=0;
stop slave;
@@ -191,6 +193,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
drop table t1,t2,t3,t4;
set global max_relay_log_size= @my_max_relay_log_size;
End of 5.1 tests
diff --git a/mysql-test/r/rpl_empty_master_crash.result b/mysql-test/r/rpl_empty_master_crash.result
index 3e234d4ef59..d57600d7396 100644
--- a/mysql-test/r/rpl_empty_master_crash.result
+++ b/mysql-test/r/rpl_empty_master_crash.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
load table t1 from master;
ERROR 08S01: Error connecting to master: Master is not configured
load table t1 from master;
diff --git a/mysql-test/r/rpl_extraCol_innodb.result b/mysql-test/r/rpl_extraCol_innodb.result
index ff505364124..a237edc8063 100644
--- a/mysql-test/r/rpl_extraCol_innodb.result
+++ b/mysql-test/r/rpl_extraCol_innodb.result
@@ -87,6 +87,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -144,6 +145,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -201,6 +203,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -257,6 +260,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -364,6 +368,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -420,6 +425,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -605,6 +611,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Try to insert in master ****
@@ -735,6 +742,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/r/rpl_extraCol_myisam.result b/mysql-test/r/rpl_extraCol_myisam.result
index b5ccab8ff4c..95f99ba1014 100644
--- a/mysql-test/r/rpl_extraCol_myisam.result
+++ b/mysql-test/r/rpl_extraCol_myisam.result
@@ -87,6 +87,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -144,6 +145,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -201,6 +203,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -257,6 +260,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -364,6 +368,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -420,6 +425,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -605,6 +611,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Try to insert in master ****
@@ -735,6 +742,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/r/rpl_flushlog_loop.result b/mysql-test/r/rpl_flushlog_loop.result
index 40eb403f6e7..1e90796b2ea 100644
--- a/mysql-test/r/rpl_flushlog_loop.result
+++ b/mysql-test/r/rpl_flushlog_loop.result
@@ -51,3 +51,4 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
diff --git a/mysql-test/r/rpl_ignore_table.result b/mysql-test/r/rpl_ignore_table.result
index 136cf5cc5eb..e7200b31212 100644
--- a/mysql-test/r/rpl_ignore_table.result
+++ b/mysql-test/r/rpl_ignore_table.result
@@ -14,6 +14,114 @@ SELECT * FROM t4;
a
DROP TABLE t1;
DROP TABLE t4;
+**** Test case for BUG#25482 ****
+**** Adding GRANTS on master ****
+create table test.t1(a int);
+create table test.t4(a int);
+GRANT SELECT ON test.t1 TO mysqltest1@localhost;
+GRANT INSERT ON test.t4 TO mysqltest2@localhost;
+GRANT select, update, insert, references on t1
+to mysqltest2@localhost;
+GRANT SELECT ON test.* TO mysqltest3@localhost;
+GRANT INSERT ON test.t4 TO mysqltest3@localhost;
+GRANT select(a), update(a), insert(a), references(a) on t4
+to mysqltest3@localhost;
+create database mysqltest2;
+create table mysqltest2.t2 (id int);
+GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
+insert into mysql.user (user, host) values ("mysqltest5", "somehost");
+Warnings:
+Warning 1364 Field 'ssl_cipher' doesn't have a default value
+Warning 1364 Field 'x509_issuer' doesn't have a default value
+Warning 1364 Field 'x509_subject' doesn't have a default value
+GRANT SELECT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON test.* TO mysqltest6@localhost;
+GRANT INSERT ON test.t1 TO mysqltest6@localhost;
+show grants for mysqltest1@localhost;
+Grants for mysqltest1@localhost
+GRANT USAGE ON *.* TO 'mysqltest1'@'localhost'
+GRANT SELECT ON `test`.`t1` TO 'mysqltest1'@'localhost'
+show grants for mysqltest2@localhost;
+Grants for mysqltest2@localhost
+GRANT USAGE ON *.* TO 'mysqltest2'@'localhost'
+GRANT SELECT, INSERT, UPDATE, REFERENCES ON `test`.`t1` TO 'mysqltest2'@'localhost'
+GRANT INSERT ON `test`.`t4` TO 'mysqltest2'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+GRANT SELECT ON `mysqltest2`.`t2` TO 'mysqltest4'@'localhost'
+show grants for mysqltest6@localhost;
+Grants for mysqltest6@localhost
+GRANT SELECT, INSERT ON *.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.`t1` TO 'mysqltest6'@'localhost'
+flush privileges;
+show grants for mysqltest5@somehost;
+Grants for mysqltest5@somehost
+GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
+**** Checking grants on slave ****
+show grants for mysqltest2@localhost;
+Grants for mysqltest2@localhost
+GRANT USAGE ON *.* TO 'mysqltest2'@'localhost'
+GRANT INSERT ON `test`.`t4` TO 'mysqltest2'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT SELECT (a), INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+GRANT SELECT ON `mysqltest2`.`t2` TO 'mysqltest4'@'localhost'
+show grants for mysqltest5@somehost;
+Grants for mysqltest5@somehost
+GRANT USAGE ON *.* TO 'mysqltest5'@'somehost'
+show grants for mysqltest6@localhost;
+Grants for mysqltest6@localhost
+GRANT SELECT, INSERT ON *.* TO 'mysqltest6'@'localhost'
+GRANT INSERT ON `test`.* TO 'mysqltest6'@'localhost'
+show grants for mysqltest1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost'
+**** Revoking grants on master ****
+REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
+REVOKE select(a) on t4
+from mysqltest3@localhost;
+show grants for mysqltest1@localhost;
+Grants for mysqltest1@localhost
+GRANT USAGE ON *.* TO 'mysqltest1'@'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+**** Checking grants on slave ****
+show grants for mysqltest1@localhost;
+ERROR 42000: There is no such grant defined for user 'mysqltest1' on host 'localhost'
+show grants for mysqltest3@localhost;
+Grants for mysqltest3@localhost
+GRANT USAGE ON *.* TO 'mysqltest3'@'localhost'
+GRANT SELECT ON `test`.* TO 'mysqltest3'@'localhost'
+GRANT INSERT, INSERT (a), UPDATE (a), REFERENCES (a) ON `test`.`t4` TO 'mysqltest3'@'localhost'
+show grants for mysqltest4@localhost;
+Grants for mysqltest4@localhost
+GRANT USAGE ON *.* TO 'mysqltest4'@'localhost' IDENTIFIED BY PASSWORD '*196BDEDE2AE4F84CA44C47D54D78478C7E2BD7B7'
+drop table t1, t4, mysqltest2.t2;
+drop database mysqltest2;
+delete from mysql.user where user like "mysqltest%";
+delete from mysql.db where user like "mysqltest%";
+delete from mysql.columns_priv where user like "mysqltest%";
+delete from mysql.tables_priv where user like "mysqltest%";
+delete from mysql.tables_priv where user like "mysqltest%";
DROP TABLE IF EXISTS t5;
CREATE TABLE t5 (
word varchar(50) collate utf8_unicode_ci NOT NULL default ''
diff --git a/mysql-test/r/rpl_incident.result b/mysql-test/r/rpl_incident.result
index a9547832ed9..aea35c5f477 100644
--- a/mysql-test/r/rpl_incident.result
+++ b/mysql-test/r/rpl_incident.result
@@ -59,6 +59,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
START SLAVE;
SELECT * FROM t1;
@@ -101,5 +102,6 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
DROP TABLE t1;
DROP TABLE t1;
diff --git a/mysql-test/r/rpl_known_bugs_detection.result b/mysql-test/r/rpl_known_bugs_detection.result
index 9ce6ac25c88..318bc3d63e7 100644
--- a/mysql-test/r/rpl_known_bugs_detection.result
+++ b/mysql-test/r/rpl_known_bugs_detection.result
@@ -45,6 +45,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SELECT * FROM t1;
a b
stop slave;
@@ -127,6 +128,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SELECT * FROM t1;
id field_1 field_2 field_3
drop table t1, t2;
diff --git a/mysql-test/r/rpl_loaddata.result b/mysql-test/r/rpl_loaddata.result
index c68d2d9677e..cabc20b7057 100644
--- a/mysql-test/r/rpl_loaddata.result
+++ b/mysql-test/r/rpl_loaddata.result
@@ -38,8 +38,8 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
set global sql_slave_skip_counter=1;
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1797 # # master-bin.000001 Yes Yes # 0 0 1797 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1797 # # master-bin.000001 Yes Yes # 0 0 1797 # None 0 No # No
set sql_log_bin=0;
delete from t1;
set sql_log_bin=1;
@@ -48,8 +48,8 @@ stop slave;
change master to master_user='test';
change master to master_user='root';
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1832 # # master-bin.000001 No No # 0 0 1832 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 1832 # # master-bin.000001 No No # 0 0 1832 # None 0 No # No
set global sql_slave_skip_counter=1;
start slave;
set sql_log_bin=0;
@@ -59,8 +59,8 @@ load data infile '../std_data_ln/rpl_loaddata.dat' into table t1;
stop slave;
reset slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No
reset master;
create table t2 (day date,id int(9),category enum('a','b','c'),name varchar(60),
unique(day)) engine=MyISAM;
diff --git a/mysql-test/r/rpl_log_pos.result b/mysql-test/r/rpl_log_pos.result
index 01ff89741c8..60fba96fb6a 100644
--- a/mysql-test/r/rpl_log_pos.result
+++ b/mysql-test/r/rpl_log_pos.result
@@ -8,26 +8,26 @@ show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106 <Binlog_Ignore_DB>
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes 0 0 106 # None 0 No # No
stop slave;
change master to master_log_pos=75;
start slave;
stop slave;
change master to master_log_pos=75;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 75 # # master-bin.000001 No No 0 0 75 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 75 # # master-bin.000001 No No 0 0 75 # None 0 No # No
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 75 # # master-bin.000001 No Yes 0 0 75 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 75 # # master-bin.000001 No Yes 0 0 75 # None 0 No # No
stop slave;
change master to master_log_pos=178;
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 178 # # master-bin.000001 No Yes 0 0 178 # None 0 No # No
show master status;
File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 106 <Binlog_Ignore_DB>
diff --git a/mysql-test/r/rpl_ndb_basic.result b/mysql-test/r/rpl_ndb_basic.result
index 499ce41597c..9a99ddd2137 100644
--- a/mysql-test/r/rpl_ndb_basic.result
+++ b/mysql-test/r/rpl_ndb_basic.result
@@ -147,6 +147,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master <Seconds_Behind_Master>
+Master_SSL_Verify_Server_Cert No
set GLOBAL slave_transaction_retries=10;
START SLAVE;
select * from t1 order by nid;
diff --git a/mysql-test/r/rpl_ndb_extraCol.result b/mysql-test/r/rpl_ndb_extraCol.result
index 336a6152d36..8f6dae7c5b5 100644
--- a/mysql-test/r/rpl_ndb_extraCol.result
+++ b/mysql-test/r/rpl_ndb_extraCol.result
@@ -87,6 +87,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t3 ***
@@ -144,6 +145,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t4 ***
@@ -201,6 +203,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t5 ***
@@ -257,6 +260,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
*** Drop t6 ***
DROP TABLE t6;
@@ -364,6 +368,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t10 ***
@@ -420,6 +425,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Drop t11 ***
@@ -605,6 +611,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
*** Try to insert in master ****
@@ -736,6 +743,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
** DROP table t17 ***
diff --git a/mysql-test/r/rpl_ndb_idempotent.result b/mysql-test/r/rpl_ndb_idempotent.result
index 982cab33482..2f2273c145e 100644
--- a/mysql-test/r/rpl_ndb_idempotent.result
+++ b/mysql-test/r/rpl_ndb_idempotent.result
@@ -33,15 +33,15 @@ c1 c2 c3
row3 C 3
row4 D 4
SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No
STOP SLAVE;
CHANGE MASTER TO
master_log_file = 'master-bin.000001',
master_log_pos = <the_pos> ;
SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 No No <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 No No <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No
START SLAVE;
SELECT * FROM t1 ORDER BY c3;
c1 c2 c3
@@ -68,6 +68,6 @@ SELECT * FROM t1;
c1 c2 c3
row2 new on slave 2
SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No
DROP TABLE IF EXISTS t1;
diff --git a/mysql-test/r/rpl_ndb_log.result b/mysql-test/r/rpl_ndb_log.result
index 03b7fd89875..3720da993be 100644
--- a/mysql-test/r/rpl_ndb_log.result
+++ b/mysql-test/r/rpl_ndb_log.result
@@ -127,8 +127,8 @@ slave-bin.000002 # Write_rows 2 # table_id: #
slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
slave-bin.000002 # Query 1 # COMMIT
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 617 # # master-bin.000002 Yes Yes # 0 0 617 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 617 # # master-bin.000002 Yes Yes # 0 0 617 # None 0 No # No
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/r/rpl_ndb_sync.result b/mysql-test/r/rpl_ndb_sync.result
index d05367c5fc0..f2797eaa623 100644
--- a/mysql-test/r/rpl_ndb_sync.result
+++ b/mysql-test/r/rpl_ndb_sync.result
@@ -72,8 +72,8 @@ master_log_file = 'master-bin.000001',
master_log_pos = <the_pos> ;
START SLAVE;
SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master>
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+<Slave_IO_State> 127.0.0.1 root MASTER_PORT 1 master-bin.000001 <Read_Master_Log_Pos> <Relay_Log_File> <Relay_Log_Pos> master-bin.000001 Yes Yes <Replicate_Ignore_Table> 0 0 <Exec_Master_Log_Pos> <Relay_Log_Space> None 0 No <Seconds_Behind_Master> No
SELECT hex(c1),hex(c2),c3 FROM t1 ORDER BY c3;
hex(c1) hex(c2) c3
1 1 row1
diff --git a/mysql-test/r/rpl_openssl.result b/mysql-test/r/rpl_openssl.result
deleted file mode 100644
index 4fe02088632..00000000000
--- a/mysql-test/r/rpl_openssl.result
+++ /dev/null
@@ -1,31 +0,0 @@
-stop slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-reset master;
-reset slave;
-drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
-start slave;
-grant replication slave on *.* to replssl@localhost require ssl;
-create table t1 (t int);
-stop slave;
-change master to master_user='replssl',master_password='';
-start slave;
-insert into t1 values (1);
-select * from t1;
-t
-stop slave;
-change master to master_ssl=1 , master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
-start slave;
-select * from t1;
-t
-1
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 replssl MASTER_MYPORT 1 # # # # # # Yes # 0 0 # # None 0 Yes MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
-stop slave;
-change master to master_user='root',master_password='', master_ssl=0;
-start slave;
-drop user replssl@localhost;
-drop table t1;
-show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 # # # # # # Yes # 0 0 # # None 0 No MYSQL_TEST_DIR/std_data/cacert.pem MYSQL_TEST_DIR/std_data/client-cert.pem MYSQL_TEST_DIR/std_data/client-key.pem #
diff --git a/mysql-test/r/rpl_rbr_to_sbr.result b/mysql-test/r/rpl_rbr_to_sbr.result
index 2cb0eafa5b8..47adb70bcf5 100644
--- a/mysql-test/r/rpl_rbr_to_sbr.result
+++ b/mysql-test/r/rpl_rbr_to_sbr.result
@@ -55,6 +55,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
slave-bin.000001 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
diff --git a/mysql-test/r/rpl_redirect.result b/mysql-test/r/rpl_redirect.result
index dd16626cbe3..64866df1c15 100644
--- a/mysql-test/r/rpl_redirect.result
+++ b/mysql-test/r/rpl_redirect.result
@@ -5,7 +5,7 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
SHOW SLAVE STATUS;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
SHOW SLAVE HOSTS;
Server_id Host Port Rpl_recovery_rank Master_id
2 127.0.0.1 SLAVE_PORT 2 1
diff --git a/mysql-test/r/rpl_replicate_do.result b/mysql-test/r/rpl_replicate_do.result
index 51a281fdb12..fa4f7e224d1 100644
--- a/mysql-test/r/rpl_replicate_do.result
+++ b/mysql-test/r/rpl_replicate_do.result
@@ -27,8 +27,8 @@ select * from t11;
ERROR 42S02: Table 'test.t11' doesn't exist
drop table if exists t1,t2,t11;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes test.t1 # 0 0 # # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 # # # master-bin.000001 Yes Yes test.t1 # 0 0 # # None 0 No # No
create table t1 (ts timestamp);
set one_shot time_zone='met';
insert into t1 values('2005-08-12 00:00:00');
diff --git a/mysql-test/r/rpl_rotate_logs.result b/mysql-test/r/rpl_rotate_logs.result
index cea84dba1ef..9adde45f87a 100644
--- a/mysql-test/r/rpl_rotate_logs.result
+++ b/mysql-test/r/rpl_rotate_logs.result
@@ -15,8 +15,8 @@ insert into temp_table values ("testing temporary tables");
create table t1 (s text);
insert into t1 values('Could not break slave'),('Tried hard');
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 556 # # master-bin.000001 Yes Yes # 0 0 556 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000001 556 # # master-bin.000001 Yes Yes # 0 0 556 # None 0 No # No
select * from t1;
s
Could not break slave
@@ -56,8 +56,8 @@ Log_name File_size
master-bin.000003 415
insert into t2 values (65);
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 504 # # master-bin.000003 Yes Yes # 0 0 504 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000003 504 # # master-bin.000003 Yes Yes # 0 0 504 # None 0 No # No
select * from t2;
m
34
@@ -84,8 +84,8 @@ select * from t4;
a
testing temporary tables part 2
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2040 # # master-bin.000005 Yes Yes # 0 0 2040 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 60 master-bin.000005 2040 # # master-bin.000005 Yes Yes # 0 0 2040 # None 0 No # No
lock tables t3 read;
select count(*) from t3 where n >= 4;
count(*)
diff --git a/mysql-test/r/rpl_row_inexist_tbl.result b/mysql-test/r/rpl_row_inexist_tbl.result
index 7d0d7504ee7..4412a1fa75c 100644
--- a/mysql-test/r/rpl_row_inexist_tbl.result
+++ b/mysql-test/r/rpl_row_inexist_tbl.result
@@ -51,4 +51,5 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
drop table t1, t2;
diff --git a/mysql-test/r/rpl_row_log.result b/mysql-test/r/rpl_row_log.result
index 5d252d72bd1..9de0d3d0ebb 100644
--- a/mysql-test/r/rpl_row_log.result
+++ b/mysql-test/r/rpl_row_log.result
@@ -92,8 +92,8 @@ slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 377 # # master-bin.000002 Yes Yes # 0 0 377 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 377 # # master-bin.000002 Yes Yes # 0 0 377 # None 0 No # No
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/r/rpl_row_log_innodb.result b/mysql-test/r/rpl_row_log_innodb.result
index ff1fabb35cb..4d8175142b2 100644
--- a/mysql-test/r/rpl_row_log_innodb.result
+++ b/mysql-test/r/rpl_row_log_innodb.result
@@ -100,8 +100,8 @@ slave-bin.000002 # Table_map 1 # table_id: # (test.t2)
slave-bin.000002 # Write_rows 1 # table_id: # flags: STMT_END_F
slave-bin.000002 # Xid 1 # COMMIT /* XID */
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 404 # # master-bin.000002 Yes Yes # 0 0 404 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 404 # # master-bin.000002 Yes Yes # 0 0 404 # None 0 No # No
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/r/rpl_row_max_relay_size.result b/mysql-test/r/rpl_row_max_relay_size.result
index 4c0f923c323..cb1692568fc 100644
--- a/mysql-test/r/rpl_row_max_relay_size.result
+++ b/mysql-test/r/rpl_row_max_relay_size.result
@@ -57,6 +57,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 2
#
@@ -100,6 +101,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 3: max_relay_log_size = 0
#
@@ -143,6 +145,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -183,6 +186,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 5
#
@@ -224,6 +228,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
@@ -263,6 +268,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
flush logs;
show master status;
File master-bin.000002
diff --git a/mysql-test/r/rpl_row_reset_slave.result b/mysql-test/r/rpl_row_reset_slave.result
index 657dad30266..c9ae5ced7bc 100644
--- a/mysql-test/r/rpl_row_reset_slave.result
+++ b/mysql-test/r/rpl_row_reset_slave.result
@@ -5,21 +5,21 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
stop slave;
change master to master_user='test';
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No # No
reset slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
stop slave;
reset slave;
start slave;
diff --git a/mysql-test/r/rpl_row_tabledefs_2myisam.result b/mysql-test/r/rpl_row_tabledefs_2myisam.result
index 10001c736ac..4eca19ff098 100644
--- a/mysql-test/r/rpl_row_tabledefs_2myisam.result
+++ b/mysql-test/r/rpl_row_tabledefs_2myisam.result
@@ -137,6 +137,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2);
@@ -175,6 +176,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (4);
@@ -213,6 +215,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (5);
@@ -251,6 +254,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -289,6 +293,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -326,6 +331,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7 ORDER BY a;
diff --git a/mysql-test/r/rpl_row_tabledefs_3innodb.result b/mysql-test/r/rpl_row_tabledefs_3innodb.result
index 6bb98afd4c4..687108e17e5 100644
--- a/mysql-test/r/rpl_row_tabledefs_3innodb.result
+++ b/mysql-test/r/rpl_row_tabledefs_3innodb.result
@@ -137,6 +137,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (2);
@@ -175,6 +176,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (4);
@@ -213,6 +215,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (5);
@@ -251,6 +254,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -289,6 +293,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
START SLAVE;
INSERT INTO t9 VALUES (6);
@@ -326,6 +331,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
INSERT INTO t7 VALUES (1),(2),(3);
INSERT INTO t8 VALUES (1),(2),(3);
SELECT * FROM t7 ORDER BY a;
diff --git a/mysql-test/r/rpl_row_until.result b/mysql-test/r/rpl_row_until.result
index cffcf12a31b..c691185650a 100644
--- a/mysql-test/r/rpl_row_until.result
+++ b/mysql-test/r/rpl_row_until.result
@@ -20,8 +20,8 @@ n
3
4
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-bin.000001 311 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-bin.000001 311 No # No
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
@@ -30,22 +30,22 @@ n
3
4
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-no-such-bin.000001 291 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 315 # Master master-no-such-bin.000001 291 No # No
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
select * from t2;
n
1
2
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 590 # Relay slave-relay-bin.000004 728 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 # No 0 0 590 # Relay slave-relay-bin.000004 728 No # No
start slave;
stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=740;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 744 # Master master-bin.000001 740 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 744 slave-relay-bin.000004 # master-bin.000001 Yes No 0 0 744 # Master master-bin.000001 740 No # No
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
diff --git a/mysql-test/r/rpl_server_id1.result b/mysql-test/r/rpl_server_id1.result
index 3f0c1a79de3..8f82ca8ea12 100644
--- a/mysql-test/r/rpl_server_id1.result
+++ b/mysql-test/r/rpl_server_id1.result
@@ -9,8 +9,8 @@ reset master;
stop slave;
change master to master_port=SLAVE_PORT;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 106 None 0 No NULL
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # # 0 0 0 106 None 0 No NULL No
start slave;
insert into t1 values (1);
show status like "slave_running";
diff --git a/mysql-test/r/rpl_server_id2.result b/mysql-test/r/rpl_server_id2.result
index 60550aba98e..a5c7fc07714 100644
--- a/mysql-test/r/rpl_server_id2.result
+++ b/mysql-test/r/rpl_server_id2.result
@@ -9,8 +9,8 @@ reset master;
stop slave;
change master to master_port=SLAVE_PORT;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
- 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 106 None 0 No NULL
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+ 127.0.0.1 root SLAVE_PORT 1 4 slave-relay-bin.000001 4 No No # 0 0 0 106 None 0 No NULL No
start slave;
insert into t1 values (1);
select * from t1;
diff --git a/mysql-test/r/rpl_slave_status.result b/mysql-test/r/rpl_slave_status.result
index c7a5d32ddd7..29ec7b77b45 100644
--- a/mysql-test/r/rpl_slave_status.result
+++ b/mysql-test/r/rpl_slave_status.result
@@ -52,6 +52,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master NULL
+Master_SSL_Verify_Server_Cert No
drop table t1;
delete from mysql.user where user='rpl';
drop table t1;
diff --git a/mysql-test/r/rpl_ssl.result b/mysql-test/r/rpl_ssl.result
index 33deb9a8c92..908f0020188 100644
--- a/mysql-test/r/rpl_ssl.result
+++ b/mysql-test/r/rpl_ssl.result
@@ -53,10 +53,12 @@ Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
STOP SLAVE;
select * from t1;
t
1
+insert into t1 values (NULL);
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
@@ -91,3 +93,6 @@ Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
Master_SSL_Cipher
Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+drop user replssl@localhost;
+drop table t1;
diff --git a/mysql-test/r/rpl_ssl1.result b/mysql-test/r/rpl_ssl1.result
new file mode 100644
index 00000000000..6bc4b53849f
--- /dev/null
+++ b/mysql-test/r/rpl_ssl1.result
@@ -0,0 +1,146 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+grant replication slave on *.* to replssl@localhost require ssl;
+create table t1 (t int);
+stop slave;
+change master to master_user='replssl',master_password='';
+start slave;
+insert into t1 values (1);
+select * from t1;
+t
+stop slave;
+change master to master_ssl=1 , master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem', master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem', master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
+start slave;
+select * from t1;
+t
+1
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User replssl
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed Yes
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+stop slave;
+change master to master_user='root',master_password='', master_ssl=0;
+start slave;
+drop user replssl@localhost;
+drop table t1;
+show slave status;
+Slave_IO_State #
+Master_Host 127.0.0.1
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed No
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
+stop slave;
+change master to
+master_host="localhost",
+master_ssl=1 ,
+master_ssl_ca ='MYSQL_TEST_DIR/std_data/cacert.pem',
+master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem',
+master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem',
+master_ssl_verify_server_cert=1;
+start slave;
+create table t1 (t int);
+insert into t1 values (1);
+on slave
+select * from t1;
+t
+1
+show slave status;
+Slave_IO_State #
+Master_Host localhost
+Master_User root
+Master_Port MASTER_MYPORT
+Connect_Retry 1
+Master_Log_File #
+Read_Master_Log_Pos #
+Relay_Log_File #
+Relay_Log_Pos #
+Relay_Master_Log_File #
+Slave_IO_Running #
+Slave_SQL_Running Yes
+Replicate_Do_DB
+Replicate_Ignore_DB
+Replicate_Do_Table
+Replicate_Ignore_Table #
+Replicate_Wild_Do_Table
+Replicate_Wild_Ignore_Table
+Last_Errno 0
+Last_Error
+Skip_Counter 0
+Exec_Master_Log_Pos #
+Relay_Log_Space #
+Until_Condition None
+Until_Log_File
+Until_Log_Pos 0
+Master_SSL_Allowed Yes
+Master_SSL_CA_File MYSQL_TEST_DIR/std_data/cacert.pem
+Master_SSL_CA_Path
+Master_SSL_Cert MYSQL_TEST_DIR/std_data/client-cert.pem
+Master_SSL_Cipher
+Master_SSL_Key MYSQL_TEST_DIR/std_data/client-key.pem
+Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert Yes
+drop table t1;
diff --git a/mysql-test/r/rpl_stm_log.result b/mysql-test/r/rpl_stm_log.result
index f69ad8a57c1..3ee2d990159 100644
--- a/mysql-test/r/rpl_stm_log.result
+++ b/mysql-test/r/rpl_stm_log.result
@@ -90,8 +90,8 @@ slave-bin.000002 # Format_desc 2 # Server ver: VERSION, Binlog ver: 4
slave-bin.000002 # Query 1 # use `test`; create table t2 (n int)ENGINE=MyISAM
slave-bin.000002 # Query 1 # use `test`; insert into t2 values (1)
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 392 # # master-bin.000002 Yes Yes # 0 0 392 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000002 392 # # master-bin.000002 Yes Yes # 0 0 392 # None 0 No # No
show binlog events in 'slave-bin.000005' from 4;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
DROP TABLE t1;
diff --git a/mysql-test/r/rpl_stm_max_relay_size.result b/mysql-test/r/rpl_stm_max_relay_size.result
index 2509cc08205..c2e57be6ad4 100644
--- a/mysql-test/r/rpl_stm_max_relay_size.result
+++ b/mysql-test/r/rpl_stm_max_relay_size.result
@@ -55,6 +55,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 2
#
@@ -98,6 +99,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 3: max_relay_log_size = 0
#
@@ -141,6 +143,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 4: Tests below are mainly to ensure that we have not coded with wrong assumptions
#
@@ -181,6 +184,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 5
#
@@ -222,6 +226,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
#
# Test 6: one more rotation, to be sure Relay_Log_Space is correctly updated
#
@@ -261,6 +266,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
flush logs;
show master status;
File master-bin.000002
diff --git a/mysql-test/r/rpl_stm_reset_slave.result b/mysql-test/r/rpl_stm_reset_slave.result
index 2b9fdca0911..e134629d597 100644
--- a/mysql-test/r/rpl_stm_reset_slave.result
+++ b/mysql-test/r/rpl_stm_reset_slave.result
@@ -5,21 +5,21 @@ reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
stop slave;
change master to master_user='test';
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 test MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 No No # 0 0 106 # None 0 No # No
reset slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 4 # # No No # 0 0 0 # None 0 No # No
start slave;
show slave status;
-Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
-# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No #
+Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master Master_SSL_Verify_Server_Cert
+# 127.0.0.1 root MASTER_PORT 1 master-bin.000001 106 # # master-bin.000001 Yes Yes # 0 0 106 # None 0 No # No
stop slave;
reset slave;
start slave;
diff --git a/mysql-test/r/rpl_stm_until.result b/mysql-test/r/rpl_stm_until.result
index 63544199f4c..ffe6216a42b 100644
--- a/mysql-test/r/rpl_stm_until.result
+++ b/mysql-test/r/rpl_stm_until.result
@@ -53,6 +53,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
select * from t1;
n
@@ -94,6 +95,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=746;
select * from t2;
n
@@ -133,6 +135,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
start slave;
stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=776;
@@ -170,6 +173,7 @@ Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
+Master_SSL_Verify_Server_Cert No
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
diff --git a/mysql-test/r/sp-code.result b/mysql-test/r/sp-code.result
index 588f4329368..d56ad426585 100644
--- a/mysql-test/r/sp-code.result
+++ b/mysql-test/r/sp-code.result
@@ -187,7 +187,7 @@ Pos Instruction
32 set v_dig@4 (v_dig@4 + 1)
33 stmt 4 "update sudoku_work set dig = v_dig wh..."
34 set v_tcounter@6 (v_tcounter@6 + 1)
-35 jump_if_not 37(37) (not(`test`.`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
+35 jump_if_not 37(37) (not(`sudoku_digit_ok`(v_row@7,v_col@8,v_dig@4)))
36 jump 15
37 set v_i@3 (v_i@3 + 1)
38 jump 15
diff --git a/mysql-test/r/strict.result b/mysql-test/r/strict.result
index 0e21ff80e29..74cd723e130 100644
--- a/mysql-test/r/strict.result
+++ b/mysql-test/r/strict.result
@@ -7,7 +7,6 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
INSERT INTO t1 VALUES('0000-10-31');
-ERROR 22007: Incorrect date value: '0000-10-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31');
ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31');
@@ -57,6 +56,7 @@ select * from t1;
col1
2004-01-01
2004-02-29
+0000-10-31
2004-01-02
2004-01-03
2004-00-31
@@ -124,7 +124,6 @@ set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
INSERT INTO t1 VALUES('0000-10-31 15:30:00');
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-0-31 15:30:00');
ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 VALUES('2004-10-0 15:30:00');
@@ -145,6 +144,7 @@ select * from t1;
col1
2004-10-31 15:30:00
2004-02-29 15:30:00
+0000-10-31 15:30:00
drop table t1;
CREATE TABLE t1 (col1 timestamp);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
@@ -206,7 +206,6 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect date value: '0000-10-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect date value: '2004-00-31 15:30:00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -222,7 +221,6 @@ ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_ti
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
ERROR 22007: Incorrect datetime value: '2004-00-31 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -259,7 +257,6 @@ INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
-ERROR 22007: Incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
@@ -267,7 +264,6 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -275,7 +271,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
@@ -288,7 +284,6 @@ INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
-ERROR 22007: Incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
@@ -296,7 +291,6 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
@@ -304,7 +298,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
-ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
+ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
@@ -1352,3 +1346,44 @@ t1 CREATE TABLE `t1` (
`i` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='123456789*123456789*123456789*123456789*123456789*123456789*'
drop table t1;
+set sql_mode= 'traditional';
+create table t1(col1 tinyint, col2 tinyint unsigned,
+col3 smallint, col4 smallint unsigned,
+col5 mediumint, col6 mediumint unsigned,
+col7 int, col8 int unsigned,
+col9 bigint, col10 bigint unsigned);
+insert into t1(col1) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col1' at row 1
+insert into t1(col2) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col2' at row 1
+insert into t1(col3) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col3' at row 1
+insert into t1(col4) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col4' at row 1
+insert into t1(col5) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col5' at row 1
+insert into t1(col6) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col6' at row 1
+insert into t1(col7) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col7' at row 1
+insert into t1(col8) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col8' at row 1
+insert into t1(col9) values('-');
+ERROR HY000: Incorrect integer value: '-' for column 'col9' at row 1
+insert into t1(col10) values('+');
+ERROR HY000: Incorrect integer value: '+' for column 'col10' at row 1
+drop table t1;
+set sql_mode='traditional';
+create table t1(a year);
+insert into t1 values ('-');
+ERROR HY000: Incorrect integer value: '-' for column 'a' at row 1
+insert into t1 values ('+');
+ERROR HY000: Incorrect integer value: '+' for column 'a' at row 1
+insert into t1 values ('');
+ERROR HY000: Incorrect integer value: '' for column 'a' at row 1
+insert into t1 values ('2000a');
+ERROR 01000: Data truncated for column 'a' at row 1
+insert into t1 values ('2E3x');
+ERROR 01000: Data truncated for column 'a' at row 1
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 12ce742eab4..644d4d971c6 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -99,7 +99,7 @@ DROP TABLE t1, t2, t3;
CREATE TABLE t1 (y YEAR);
INSERT INTO t1 VALUES ('abc');
Warnings:
-Warning 1264 Out of range value for column 'y' at row 1
+Warning 1366 Incorrect integer value: 'abc' for column 'y' at row 1
SELECT * FROM t1;
y
0000
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index b54bd155c7d..e40ec689127 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -26,8 +26,6 @@ Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
-Warnings:
-Warning 1264 Out of range value for column 't' at row 5
insert into t1 values ("2003-003-03");
insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
select * from t1;
@@ -36,7 +34,7 @@ t
2069-12-31 00:00:00
1970-01-01 00:00:00
1999-12-31 00:00:00
-0000-00-00 00:00:00
+0000-01-01 00:00:00
0001-01-01 00:00:00
9999-12-31 00:00:00
2000-10-10 00:00:00
diff --git a/mysql-test/r/type_year.result b/mysql-test/r/type_year.result
index 84b688429db..e52947455c8 100644
--- a/mysql-test/r/type_year.result
+++ b/mysql-test/r/type_year.result
@@ -34,3 +34,15 @@ select if(y = now(), 1, 0) from t1;
if(y = now(), 1, 0)
1
drop table t1;
+create table t1(a year);
+insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
+Warnings:
+Warning 1265 Data truncated for column 'a' at row 3
+select * from t1;
+a
+2001
+2001
+2001
+2001
+drop table t1;
+End of 5.0 tests
diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result
index 593ac63ca80..c7a9b0982a9 100644
--- a/mysql-test/r/udf.result
+++ b/mysql-test/r/udf.result
@@ -159,7 +159,7 @@ EXPLAIN EXTENDED SELECT myfunc_int(fn(MIN(b))) as c FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
Warnings:
-Note 1003 select myfunc_int(`test`.`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a`
+Note 1003 select myfunc_int(`fn`(min(`test`.`t1`.`b`)) AS `fn(MIN(b))`) AS `c` from `test`.`t1` group by `test`.`t1`.`a`
EXPLAIN EXTENDED SELECT myfunc_int(test.fn(MIN(b))) as c FROM t1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using temporary; Using filesort
diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test
index 5a91cd7a7ad..4e212d81e66 100644
--- a/mysql-test/t/crash_commit_before.test
+++ b/mysql-test/t/crash_commit_before.test
@@ -30,3 +30,6 @@ COMMIT;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
+
+
+DROP TABLE t1;
diff --git a/mysql-test/t/create.test b/mysql-test/t/create.test
index ffdcee06488..6861905542b 100644
--- a/mysql-test/t/create.test
+++ b/mysql-test/t/create.test
@@ -660,6 +660,7 @@ create table t1(a set("a,b","c,d") not null);
# End of 4.1 tests
+
#
# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
# platforms
@@ -678,7 +679,7 @@ drop table t1;
create table t1 (upgrade int);
drop table t1;
-# End of 5.0 tests
+--echo End of 5.0 tests
#
# Test of behaviour with CREATE ... SELECT
@@ -734,3 +735,5 @@ drop database mysqltest;
USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
--error 1102
SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test
index 4989199f3aa..778bfc9528f 100644
--- a/mysql-test/t/func_group.test
+++ b/mysql-test/t/func_group.test
@@ -801,6 +801,16 @@ drop table bug22555;
#
+# Bug #21976: Unnecessary warning with count(decimal)
+#
+
+create table t1 (a decimal(20));
+insert into t1 values (12345678901234567890);
+select count(a) from t1;
+select count(distinct a) from t1;
+drop table t1;
+
+#
# Bug #23184: SELECT causes server crash
#
CREATE TABLE t1 (a INT, b INT);
@@ -824,5 +834,4 @@ SELECT a,AVG(DISTINCT b) AS average FROM t1 GROUP BY a HAVING average > 50;
DROP TABLE t1;
-###
--echo End of 5.0 tests
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 849d39cfc32..ca78ced134b 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1145,6 +1145,10 @@ INSERT INTO `t1` (`id`, `tire`) VALUES ('A', 0), ('B', 1),('C', 2);
SELECT REPEAT( '#', tire ) AS A,
REPEAT( '#', tire % 999 ) AS B, tire FROM `t1`;
+SELECT REPEAT('0', CAST(0 AS UNSIGNED));
+SELECT REPEAT('0', -2);
+SELECT REPEAT('0', 2);
+
DROP TABLE t1;
#
diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test
index a3952dbc3da..3845bdcb983 100644
--- a/mysql-test/t/gis.test
+++ b/mysql-test/t/gis.test
@@ -493,6 +493,75 @@ DROP VIEW v1,v2;
DROP TABLE t1;
#
+# Bug#24563: MBROverlaps does not seem to function propertly
+# Bug#54888: MBROverlaps missing in 5.1?
+#
+
+# Test all MBR* functions and their non-MBR-prefixed aliases,
+# using shifted squares to verify the spatial relations.
+
+create table t1 (name VARCHAR(100), square GEOMETRY);
+
+INSERT INTO t1 VALUES("center", GeomFromText('POLYGON (( 0 0, 0 2, 2 2, 2 0, 0 0))'));
+
+INSERT INTO t1 VALUES("small", GeomFromText('POLYGON (( 0 0, 0 1, 1 1, 1 0, 0 0))'));
+INSERT INTO t1 VALUES("big", GeomFromText('POLYGON (( 0 0, 0 3, 3 3, 3 0, 0 0))'));
+
+INSERT INTO t1 VALUES("up", GeomFromText('POLYGON (( 0 1, 0 3, 2 3, 2 1, 0 1))'));
+INSERT INTO t1 VALUES("up2", GeomFromText('POLYGON (( 0 2, 0 4, 2 4, 2 2, 0 2))'));
+INSERT INTO t1 VALUES("up3", GeomFromText('POLYGON (( 0 3, 0 5, 2 5, 2 3, 0 3))'));
+
+INSERT INTO t1 VALUES("down", GeomFromText('POLYGON (( 0 -1, 0 1, 2 1, 2 -1, 0 -1))'));
+INSERT INTO t1 VALUES("down2", GeomFromText('POLYGON (( 0 -2, 0 0, 2 0, 2 -2, 0 -2))'));
+INSERT INTO t1 VALUES("down3", GeomFromText('POLYGON (( 0 -3, 0 -1, 2 -1, 2 -3, 0 -3))'));
+
+INSERT INTO t1 VALUES("right", GeomFromText('POLYGON (( 1 0, 1 2, 3 2, 3 0, 1 0))'));
+INSERT INTO t1 VALUES("right2", GeomFromText('POLYGON (( 2 0, 2 2, 4 2, 4 0, 2 0))'));
+INSERT INTO t1 VALUES("right3", GeomFromText('POLYGON (( 3 0, 3 2, 5 2, 5 0, 3 0))'));
+
+INSERT INTO t1 VALUES("left", GeomFromText('POLYGON (( -1 0, -1 2, 1 2, 1 0, -1 0))'));
+INSERT INTO t1 VALUES("left2", GeomFromText('POLYGON (( -2 0, -2 2, 0 2, 0 0, -2 0))'));
+INSERT INTO t1 VALUES("left3", GeomFromText('POLYGON (( -3 0, -3 2, -1 2, -1 0, -3 0))'));
+
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrcontains FROM t1 a1 JOIN t1 a2 ON MBRContains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrdisjoint FROM t1 a1 JOIN t1 a2 ON MBRDisjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrequal FROM t1 a1 JOIN t1 a2 ON MBREqual( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrintersect FROM t1 a1 JOIN t1 a2 ON MBRIntersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbroverlaps FROM t1 a1 JOIN t1 a2 ON MBROverlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrtouches FROM t1 a1 JOIN t1 a2 ON MBRTouches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS mbrwithin FROM t1 a1 JOIN t1 a2 ON MBRWithin( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS contains FROM t1 a1 JOIN t1 a2 ON Contains( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS disjoint FROM t1 a1 JOIN t1 a2 ON Disjoint( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS equals FROM t1 a1 JOIN t1 a2 ON Equals( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS intersect FROM t1 a1 JOIN t1 a2 ON Intersects( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS overlaps FROM t1 a1 JOIN t1 a2 ON Overlaps( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS touches FROM t1 a1 JOIN t1 a2 ON Touches( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+SELECT GROUP_CONCAT(a2.name ORDER BY a2.name) AS within FROM t1 a1 JOIN t1 a2 ON Within( a1.square, a2.square) WHERE a1.name = "center" GROUP BY a1.name;
+
+# Overlaps needs a few more tests, with point and line dimensions
+
+SET @vert1 = GeomFromText('POLYGON ((0 -2, 0 2, 0 -2))');
+SET @horiz1 = GeomFromText('POLYGON ((-2 0, 2 0, -2 0))');
+SET @horiz2 = GeomFromText('POLYGON ((-1 0, 3 0, -1 0))');
+SET @horiz3 = GeomFromText('POLYGON ((2 0, 3 0, 2 0))');
+SET @point1 = GeomFromText('POLYGON ((0 0))');
+SET @point2 = GeomFromText('POLYGON ((-2 0))');
+
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @vert1) GROUP BY a1.name;
+SELECT GROUP_CONCAT(a1.name ORDER BY a1.name) AS overlaps FROM t1 a1 WHERE Overlaps(a1.square, @horiz1) GROUP BY a1.name;
+SELECT Overlaps(@horiz1, @vert1) FROM DUAL;
+SELECT Overlaps(@horiz1, @horiz2) FROM DUAL;
+SELECT Overlaps(@horiz1, @horiz3) FROM DUAL;
+SELECT Overlaps(@horiz1, @point1) FROM DUAL;
+SELECT Overlaps(@horiz1, @point2) FROM DUAL;
+
+DROP TABLE t1;
+
+--echo End of 5.0 tests
+
+
+#
# Bug #11335 View redefines column types
#
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
@@ -501,3 +570,4 @@ desc v1;
drop view v1;
drop table t1;
+--echo End of 5.1 tests
diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
index 0937b4fd30d..75f2796abc6 100644
--- a/mysql-test/t/innodb.test
+++ b/mysql-test/t/innodb.test
@@ -1810,7 +1810,6 @@ select a,hex(s1) from t1;
select hex(s1) from t2;
drop table t2,t1;
-
# Ensure that <tablename>_ibfk_0 is not mistreated as a
# generated foreign key identifier. (Bug #16387)
@@ -2293,6 +2292,34 @@ DELETE CASCADE ON UPDATE CASCADE;
SHOW CREATE TABLE t2;
DROP TABLE t2, t1;
+#
+# Bug #25927: Prevent ALTER TABLE ... MODIFY ... NOT NULL on columns
+# for which there is a foreign key constraint ON ... SET NULL.
+#
+
+CREATE TABLE t1 (a INT, INDEX(a)) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, INDEX(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t2 VALUES (1);
+ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL;
+--replace_regex /'\.\/test\/#sql-[0-9a-f_]*'/'#sql-temporary'/
+--error 1025
+ALTER TABLE t2 MODIFY a INT NOT NULL;
+DELETE FROM t1;
+DROP TABLE t2,t1;
+
+#
+# Bug #26835: table corruption after delete+insert
+#
+
+CREATE TABLE t1 (a VARCHAR(5) COLLATE utf8_unicode_ci PRIMARY KEY)
+ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0xEFBCA4EFBCA4EFBCA4);
+DELETE FROM t1;
+INSERT INTO t1 VALUES ('DDD');
+SELECT * FROM t1;
+DROP TABLE t1;
+
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
index e772089ce7a..16f466e9b54 100644
--- a/mysql-test/t/log_state.test
+++ b/mysql-test/t/log_state.test
@@ -136,4 +136,3 @@ disconnect con1;
# Remove the log files that was created in the "default location"
# i.e var/run
--remove_file $MYSQLTEST_VARDIR/run/master.log
---remove_file $MYSQLTEST_VARDIR/run/master-slow.log
diff --git a/mysql-test/t/log_tables-big-master.opt b/mysql-test/t/log_tables-big-master.opt
new file mode 100644
index 00000000000..35ff7911705
--- /dev/null
+++ b/mysql-test/t/log_tables-big-master.opt
@@ -0,0 +1 @@
+--log-slow-queries
diff --git a/mysql-test/t/log_tables-big.test b/mysql-test/t/log_tables-big.test
new file mode 100644
index 00000000000..8c956fa6f55
--- /dev/null
+++ b/mysql-test/t/log_tables-big.test
@@ -0,0 +1,35 @@
+# this test needs multithreaded mysqltest
+-- source include/not_embedded.inc
+
+# Test sleeps for long times
+--source include/big_test.inc
+
+# check that CSV engine was compiled in
+--source include/have_csv.inc
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+#
+# Bug #27638: slow logging to CSV table inserts bad query_time and lock_time values
+#
+connection con1;
+set session long_query_time=10;
+select get_lock('bug27638', 1);
+connection con2;
+set session long_query_time=1;
+truncate table mysql.slow_log;
+select get_lock('bug27638', 2);
+select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+truncate table mysql.slow_log;
+select get_lock('bug27638', 60);
+select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+truncate table mysql.slow_log;
+select get_lock('bug27638', 101);
+select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+connection con1;
+select release_lock('bug27638');
+connection default;
+
+disconnect con1;
+disconnect con2;
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index a73d7a40d8b..e4cbd2938fb 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -204,8 +204,8 @@ load data infile '../std_data_ln/loaddata6.dat' into table t1 character set koi8
select hex(a) from t1;
drop table t1;
flush logs;
---replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
---exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000010
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ $MYSQLTEST_VARDIR/log/master-bin.000010
--echo End of 5.0 tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index d9372ad35c1..49adda73f2d 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -919,7 +919,7 @@ port=1234
EOF
--exec $MYSQL_MY_PRINT_DEFAULTS -c $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1
--exec $MYSQL_MY_PRINT_DEFAULTS -e $MYSQLTEST_VARDIR/tmp/tmp.cnf mysqltest1 mysqltest1
---remov_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
+--remove_file $MYSQLTEST_VARDIR/tmp/tmp.cnf
--echo #
--echo # Test of fix to BUG 12597
@@ -1431,6 +1431,72 @@ INSERT INTO t1 VALUES(1,0xff00fef0);
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#26346: stack + buffer overrun in mysqldump
+--echo #
+
+CREATE TABLE t1(a int);
+INSERT INTO t1 VALUES (1), (2);
+
+# too long a file path causes an error
+--error 1
+--exec $MYSQL_DUMP --tab=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test 2>&1
+
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-optionally-enclosed-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --fields-escaped-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+--exec $MYSQL_DUMP --tab=$MYSQLTEST_VARDIR/tmp/ --lines-terminated-by=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa test
+
+--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
+
+DROP TABLE t1;
+
+#
+# Bug #25993: crashe with a merge table and -c
+#
+
+CREATE TABLE t2 (a int);
+CREATE TABLE t3 (a int);
+CREATE TABLE t1 (a int) ENGINE=merge UNION=(t2, t3);
+--exec $MYSQL_DUMP --skip-comments -c test
+DROP TABLE t1, t2, t3;
+
+--echo #
+--echo # Bug #23491: MySQLDump prefix function call in a view by database name
+--echo #
+
+# Setup
+create database bug23491_original;
+create database bug23491_restore;
+use bug23491_original;
+create table t1 (c1 int);
+create view v1 as select * from t1;
+create procedure p1() select 1;
+create function f1() returns int return 1;
+create view v2 as select f1();
+create function f2() returns int return f1();
+create view v3 as select bug23491_original.f1();
+
+# Backup.
+--exec $MYSQL_DUMP --skip-comments -uroot --opt --routines bug23491_original > $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
+
+# Restore.
+--exec $MYSQL bug23491_restore < $MYSQLTEST_VARDIR/tmp/bug23491_backup.sql
+
+# Verify
+use bug23491_restore;
+show create view bug23491_restore.v2;
+show create view bug23491_restore.v3;
+
+# Cleanup
+drop database bug23491_original;
+drop database bug23491_restore;
+use test;
+
--echo #
--echo # End of 5.0 tests
--echo #
diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test
index 8772b8157e3..362443023e1 100644
--- a/mysql-test/t/openssl_1.test
+++ b/mysql-test/t/openssl_1.test
@@ -96,4 +96,11 @@ drop table t1;
--error 1
--exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
-
+#
+# Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23
+#
+# Test that we can open encrypted connection to server without
+# verification of servers certificate by setting both ca certificate
+# and ca path to NULL
+#
+--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1
diff --git a/mysql-test/t/rpl_ignore_table.test b/mysql-test/t/rpl_ignore_table.test
index 10c75db0b70..fd4ae64165a 100644
--- a/mysql-test/t/rpl_ignore_table.test
+++ b/mysql-test/t/rpl_ignore_table.test
@@ -27,8 +27,118 @@ SELECT * FROM t4;
connection master;
DROP TABLE t1;
DROP TABLE t4;
+
+sync_slave_with_master;
+
+
+#
+# Bug#25482 GRANT statements are not replicated if
+# you use "replicate-ignore-table"
+#
+
+--echo **** Test case for BUG#25482 ****
+--echo **** Adding GRANTS on master ****
+
+connection master;
+create table test.t1(a int);
+create table test.t4(a int);
+
+# Simple user that should not replicate
+GRANT SELECT ON test.t1 TO mysqltest1@localhost;
+
+# Partial replicate
+GRANT INSERT ON test.t4 TO mysqltest2@localhost;
+GRANT select, update, insert, references on t1
+ to mysqltest2@localhost;
+
+# Partial replicate 2
+GRANT SELECT ON test.* TO mysqltest3@localhost;
+GRANT INSERT ON test.t4 TO mysqltest3@localhost;
+GRANT select(a), update(a), insert(a), references(a) on t4
+ to mysqltest3@localhost;
+
+# Create another database and table
+create database mysqltest2;
+create table mysqltest2.t2 (id int);
+# Create a grant that should replicate
+GRANT SELECT ON mysqltest2.t2 TO mysqltest4@localhost IDENTIFIED BY 'pass';
+
+# Create a grant manually
+insert into mysql.user (user, host) values ("mysqltest5", "somehost");
+
+# Partial replicate 3 with *.*
+GRANT SELECT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON *.* TO mysqltest6@localhost;
+GRANT INSERT ON test.* TO mysqltest6@localhost;
+GRANT INSERT ON test.t1 TO mysqltest6@localhost;
+
+show grants for mysqltest1@localhost;
+show grants for mysqltest2@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+show grants for mysqltest6@localhost;
+
+flush privileges;
+show grants for mysqltest5@somehost;
+
+
sync_slave_with_master;
+--echo **** Checking grants on slave ****
+
+# Check that grants are replicated to slave
+show grants for mysqltest2@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+show grants for mysqltest5@somehost;
+show grants for mysqltest6@localhost;
+
+# mysqltest1 should not be on slave
+--error 1141
+show grants for mysqltest1@localhost;
+
+--echo **** Revoking grants on master ****
+connection master;
+REVOKE SELECT ON test.t1 FROM mysqltest1@localhost;
+REVOKE SELECT ON mysqltest2.t2 FROM mysqltest4@localhost;
+REVOKE select(a) on t4
+ from mysqltest3@localhost;
+
+show grants for mysqltest1@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+
+sync_slave_with_master;
+
+--echo **** Checking grants on slave ****
+
+# mysqltest1 should not be on slave
+--error 1141
+show grants for mysqltest1@localhost;
+show grants for mysqltest3@localhost;
+show grants for mysqltest4@localhost;
+
+# Cleanup
+connection master;
+drop table t1, t4, mysqltest2.t2;
+drop database mysqltest2;
+delete from mysql.user where user like "mysqltest%";
+delete from mysql.db where user like "mysqltest%";
+#
+# BUG 27606 causes failure to replicate this statement
+# move it to slave instead
+#delete from mysql.tables_priv where user like "mysqltest%";
+delete from mysql.columns_priv where user like "mysqltest%";
+sync_slave_with_master;
+
+#BUG27606
+delete from mysql.tables_priv where user like "mysqltest%";
+
+connection master;
+
+#BUG27606
+delete from mysql.tables_priv where user like "mysqltest%";
+
#
# bug#22877 replication character sets get out of sync
# using replicate-wild-ignore-table
diff --git a/mysql-test/t/rpl_packet.test b/mysql-test/t/rpl_packet.test
index db6f475dc94..83fe75363a5 100644
--- a/mysql-test/t/rpl_packet.test
+++ b/mysql-test/t/rpl_packet.test
@@ -68,5 +68,11 @@ connection slave;
sleep 2;
SHOW STATUS LIKE 'Slave_running';
+# cleanup
+#connection master;
+#drop table t1;
+#connection slave;
+#drop table t1;
+
# End of tests
diff --git a/mysql-test/t/rpl_ssl.test b/mysql-test/t/rpl_ssl.test
index 9f25f71525a..dd03d5533b0 100644
--- a/mysql-test/t/rpl_ssl.test
+++ b/mysql-test/t/rpl_ssl.test
@@ -54,7 +54,16 @@ while ($i)
start slave;
enable_query_log;
connection master;
+# INSERT one more record to make sure
+# the sync has something to do
+insert into t1 values (NULL);
sync_slave_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
query_vertical show slave status;
+
+connection master;
+drop user replssl@localhost;
+drop table t1;
+sync_slave_with_master;
+
diff --git a/mysql-test/t/rpl_openssl.test b/mysql-test/t/rpl_ssl1.test
index edef603f617..6ca1484bb17 100644
--- a/mysql-test/t/rpl_openssl.test
+++ b/mysql-test/t/rpl_ssl1.test
@@ -46,7 +46,7 @@ select * from t1;
#checking show slave status
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
#checking if replication works without ssl also performing clean up
stop slave;
@@ -60,6 +60,38 @@ connection slave;
sync_with_master;
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
-show slave status;
+query_vertical show slave status;
# End of 4.1 tests
+
+# Start replication with ssl_verify_server_cert turned on
+connection slave;
+stop slave;
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
+eval change master to
+ master_host="localhost",
+ master_ssl=1 ,
+ master_ssl_ca ='$MYSQL_TEST_DIR/std_data/cacert.pem',
+ master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
+ master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem',
+ master_ssl_verify_server_cert=1;
+start slave;
+
+connection master;
+create table t1 (t int);
+insert into t1 values (1);
+
+sync_slave_with_master;
+
+echo on slave;
+#checking that replication is ok
+select * from t1;
+
+#checking show slave status
+--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 6 # 7 # 8 # 9 # 10 # 11 # 16 # 22 # 23 # 33 #
+query_vertical show slave status;
+
+connection master;
+drop table t1;
+sync_slave_with_master;
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 1c41498c4c7..f776be40864 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -706,9 +706,11 @@ begin
insert into test.t1 values (concat(x, "2"), y+2);
end|
---system rm -f $MYSQLTEST_VARDIR/tmp/spout
+# Remove spout file if it exists
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/tmp/spout
call into_outfile("ofile", 1)|
---system rm -f $MYSQLTEST_VARDIR/tmp/spout
+--remove_file $MYSQLTEST_VARDIR/tmp/spout
delete from t1|
drop procedure into_outfile|
@@ -723,9 +725,11 @@ begin
insert into test.t1 values (concat(x, "2"), y+2);
end|
---system rm -f $MYSQLTEST_VARDIR/tmp/spdump
+# Remove spdump file if it exists
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/tmp/spdump
call into_dumpfile("dfile", 1)|
---system rm -f $MYSQLTEST_VARDIR/tmp/spdump
+--remove_file $MYSQLTEST_VARDIR/tmp/spdump
delete from t1|
drop procedure into_dumpfile|
diff --git a/mysql-test/t/ssl_des-master.opt b/mysql-test/t/ssl_des-master.opt
deleted file mode 100644
index 0b2b8cb85ac..00000000000
--- a/mysql-test/t/ssl_des-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---loose_ssl-cert=std_data/server-cert-des.pem --loose_ssl-key=std_data/server-key-des.pem
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index 2f35bbf22f2..3ff84c35f16 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -14,7 +14,6 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (col1 date);
INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29');
---error 1292
INSERT INTO t1 VALUES('0000-10-31');
# All test cases expected to fail should return
@@ -100,7 +99,6 @@ set @@sql_mode='ansi,traditional';
CREATE TABLE t1 (col1 datetime);
INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00');
---error 1292
INSERT INTO t1 VALUES('0000-10-31 15:30:00');
# All test cases expected to fail should return
@@ -194,7 +192,6 @@ INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
---error 1292
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
@@ -216,7 +213,6 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
---error 1292
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1292
@@ -271,7 +267,6 @@ INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
---error 1292
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
--error 1292
@@ -299,7 +294,6 @@ INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
---error 1292
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
--error 1292
@@ -367,7 +361,6 @@ INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
---error 1292
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
--error 1292
@@ -394,7 +387,6 @@ INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
---error 1292
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
--error 1292
@@ -1208,3 +1200,53 @@ create table t1 (i int)
comment '123456789*123456789*123456789*123456789*123456789*123456789*';
show create table t1;
drop table t1;
+
+#
+# Bug #26359: Strings becoming truncated and converted to numbers under STRICT mode
+#
+set sql_mode= 'traditional';
+create table t1(col1 tinyint, col2 tinyint unsigned,
+ col3 smallint, col4 smallint unsigned,
+ col5 mediumint, col6 mediumint unsigned,
+ col7 int, col8 int unsigned,
+ col9 bigint, col10 bigint unsigned);
+--error 1366
+insert into t1(col1) values('-');
+--error 1366
+insert into t1(col2) values('+');
+--error 1366
+insert into t1(col3) values('-');
+--error 1366
+insert into t1(col4) values('+');
+--error 1366
+insert into t1(col5) values('-');
+--error 1366
+insert into t1(col6) values('+');
+--error 1366
+insert into t1(col7) values('-');
+--error 1366
+insert into t1(col8) values('+');
+--error 1366
+insert into t1(col9) values('-');
+--error 1366
+insert into t1(col10) values('+');
+drop table t1;
+
+#
+# Bug #27176: Assigning a string to an year column has unexpected results
+#
+set sql_mode='traditional';
+create table t1(a year);
+--error 1366
+insert into t1 values ('-');
+--error 1366
+insert into t1 values ('+');
+--error 1366
+insert into t1 values ('');
+--error 1265
+insert into t1 values ('2000a');
+--error 1265
+insert into t1 values ('2E3x');
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test
index 9744da24c02..0e174a556d6 100644
--- a/mysql-test/t/type_year.test
+++ b/mysql-test/t/type_year.test
@@ -21,4 +21,12 @@ insert into t1 values (now());
select if(y = now(), 1, 0) from t1;
drop table t1;
-# End of 4.1 tests
+#
+# Bug #27176: Assigning a string to an year column has unexpected results
+#
+create table t1(a year);
+insert into t1 values (2000.5), ('2000.5'), ('2001a'), ('2.001E3');
+select * from t1;
+drop table t1;
+
+--echo End of 5.0 tests
diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c
index 6c412157937..c1108f85054 100644
--- a/mysys/mf_tempfile.c
+++ b/mysys/mf_tempfile.c
@@ -22,15 +22,36 @@
#include <paths.h>
#endif
-#ifdef HAVE_TEMPNAM
-#if !defined(__NETWARE__)
-extern char **environ;
-#endif
-#endif
+
/*
- Create a temporary file in a given directory
- This function should be used instead of my_tempnam() !
+ @brief
+ Create a temporary file with unique name in a given directory
+
+ @details
+ create_temp_file
+ to pointer to buffer where temporary filename will be stored
+ dir directory where to create the file
+ prefix prefix the filename with this
+ mode Flags to use for my_create/my_open
+ MyFlags Magic flags
+
+ @return
+ File descriptor of opened file if success
+ -1 and sets errno if fails.
+
+ @note
+ The behaviour of this function differs a lot between
+ implementation, it's main use is to generate a file with
+ a name that does not already exist.
+
+ When passing O_TEMPORARY flag in "mode" the file should
+ be automatically deleted
+
+ The implementation using mkstemp should be considered the
+ reference implementation when adding a new or modifying an
+ existing one
+
*/
File create_temp_file(char *to, const char *dir, const char *prefix,
@@ -38,41 +59,33 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
myf MyFlags __attribute__((unused)))
{
File file= -1;
+
DBUG_ENTER("create_temp_file");
-#if defined(_MSC_VER)
+ DBUG_PRINT("enter", ("dir: %s, prefix: %s", dir, prefix));
+#if defined (__WIN__)
+
+ /*
+ Use GetTempFileName to generate a unique filename, create
+ the file and release it's handle
+ - uses up to the first three letters from prefix
+ */
+ if (GetTempFileName(dir, prefix, 0, to) == 0)
+ DBUG_RETURN(-1);
+
+ DBUG_PRINT("info", ("name: %s", to));
+
+ /*
+ Open the file without the "open only if file doesn't already exist"
+ since the file has already been created by GetTempFileName
+ */
+ if ((file= my_open(to, (mode & ~O_EXCL), MyFlags)) < 0)
{
- char temp[FN_REFLEN],*end,*res,**old_env,*temp_env[1];
- old_env=environ;
- if (dir)
- {
- end=strend(dir)-1;
- if (!dir[0])
- { /* Change empty string to current dir */
- to[0]= FN_CURLIB;
- to[1]= 0;
- dir=to;
- }
- else if (*end == FN_DEVCHAR)
- { /* Get current dir for drive */
- _fullpath(temp,dir,FN_REFLEN);
- dir=to;
- }
- else if (*end == FN_LIBCHAR && dir < end && end[-1] != FN_DEVCHAR)
- {
- strmake(to,dir,(uint) (end-dir)); /* Copy and remove last '\' */
- dir=to;
- }
- environ=temp_env; /* Force use of dir (dir not checked) */
- temp_env[0]=0;
- }
- if ((res=tempnam((char*) dir,(char *) prefix)))
- {
- strmake(to,res,FN_REFLEN-1);
- (*free)(res);
- file=my_create(to,0, mode | O_EXCL | O_NOFOLLOW, MyFlags);
- }
- environ=old_env;
+ /* Open failed, remove the file created by GetTempFileName */
+ int tmp= my_errno;
+ (void) my_delete(to, MYF(0));
+ my_errno= tmp;
}
+
#elif defined(_ZTC__)
if (!dir)
dir=getenv("TMPDIR");
@@ -101,6 +114,8 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
}
strmov(convert_dirname(to,dir,NullS),prefix_buff);
org_file=mkstemp(to);
+ if (mode & O_TEMPORARY)
+ (void) my_delete(to, MYF(MY_WME | ME_NOINPUT));
file=my_register_filename(org_file, to, FILE_BY_MKSTEMP,
EE_CANTCREATEFILE, MyFlags);
/* If we didn't manage to register the name, remove the temp file */
@@ -113,6 +128,10 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
}
#elif defined(HAVE_TEMPNAM)
{
+#if !defined(__NETWARE__)
+ extern char **environ;
+#endif
+
char *res,**old_env,*temp_env[1];
if (dir && !dir[0])
{ /* Change empty string to current dir */
@@ -147,40 +166,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix,
#endif
}
#else
- {
- register long uniq;
- register int length;
- my_string pos,end_pos;
- /* Make an unique number */
- pthread_mutex_lock(&THR_LOCK_open);
- uniq= ((long) getpid() << 20) + (long) _my_tempnam_used++ ;
- pthread_mutex_unlock(&THR_LOCK_open);
- if (!dir && !(dir=getenv("TMPDIR"))) /* Use this if possibly */
- dir=P_tmpdir; /* Use system default */
- length=strlen(dir)+strlen(pfx)+1;
-
- DBUG_PRINT("test",("mallocing %d byte",length+8+sizeof(TMP_EXT)+1));
- if (length+8+sizeof(TMP_EXT)+1 > FN_REFLENGTH)
- errno=my_errno= ENAMETOOLONG;
- else
- {
- end_pos=strmov(to,dir);
- if (end_pos != to && end_pos[-1] != FN_LIBCHAR)
- *end_pos++=FN_LIBCHAR;
- end_pos=strmov(end_pos,pfx);
-
- for (length=0 ; length < 8 && uniq ; length++)
- {
- *end_pos++= _dig_vec_upper[(int) (uniq & 31)];
- uniq >>= 5;
- }
- (void) strmov(end_pos,TMP_EXT);
- file=my_create(to,0,
- (int) (O_RDWR | O_BINARY | O_TRUNC | O_EXCL | O_NOFOLLOW |
- O_TEMPORARY | O_SHORT_LIVED),
- MYF(MY_WME));
- }
- }
+#error No implementation found for create_temp_file
#endif
if (file >= 0)
thread_safe_increment(my_tmp_file_created,&THR_LOCK_open);
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index 3601a533480..b0e775177a6 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -37,7 +37,7 @@ gptr my_malloc(unsigned int size, myf my_flags)
if (my_flags & MY_FAE)
error_handler_hook=fatal_error_handler_hook;
if (my_flags & (MY_FAE+MY_WME))
- my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),size);
+ my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH),size);
if (my_flags & MY_FAE)
exit(1);
}
diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c
index d8182b67442..aba3e47d754 100644
--- a/mysys/my_pthread.c
+++ b/mysys/my_pthread.c
@@ -29,7 +29,7 @@
#define SCHED_POLICY SCHED_OTHER
#endif
-uint thd_lib_detected;
+uint thd_lib_detected= 0;
#ifndef my_pthread_setprio
void my_pthread_setprio(pthread_t thread_id,int prior)
diff --git a/mysys/my_static.c b/mysys/my_static.c
index 95521c49ab7..42dd9d71490 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -69,11 +69,6 @@ my_bool my_use_large_pages= 0;
uint my_large_page_size= 0;
#endif
- /* from my_tempnam */
-#if !defined(HAVE_TEMPNAM) || defined(HPUX11)
-int _my_tempnam_used=0;
-#endif
-
/* from safe_malloc */
uint sf_malloc_prehunc=0, /* If you have problem with core- */
sf_malloc_endhunc=0, /* dump when malloc-message.... */
diff --git a/mysys/my_static.h b/mysys/my_static.h
index cbd293a0431..b438c936225 100644
--- a/mysys/my_static.h
+++ b/mysys/my_static.h
@@ -60,10 +60,6 @@ extern const char *soundex_map;
extern USED_MEM* my_once_root_block;
extern uint my_once_extra;
-#if !defined(HAVE_TEMPNAM) || defined(HPUX11)
-extern int _my_tempnam_used;
-#endif
-
extern byte *sf_min_adress,*sf_max_adress;
extern uint sf_malloc_count;
extern struct st_irem *sf_malloc_root;
diff --git a/mysys/safemalloc.c b/mysys/safemalloc.c
index da15b02345b..f2a4c280610 100644
--- a/mysys/safemalloc.c
+++ b/mysys/safemalloc.c
@@ -150,11 +150,11 @@ gptr _mymalloc(uint size, const char *filename, uint lineno, myf MyFlags)
char buff[SC_MAXWIDTH];
my_errno=errno;
sprintf(buff,"Out of memory at line %d, '%s'", lineno, filename);
- my_message(EE_OUTOFMEMORY,buff,MYF(ME_BELL+ME_WAITTANG));
+ my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
sprintf(buff,"needed %d byte (%ldk), memory in use: %ld bytes (%ldk)",
size, (size + 1023L) / 1024L,
sf_malloc_max_memory, (sf_malloc_max_memory + 1023L) / 1024L);
- my_message(EE_OUTOFMEMORY,buff,MYF(ME_BELL+ME_WAITTANG));
+ my_message(EE_OUTOFMEMORY, buff, MYF(ME_BELL+ME_WAITTANG+ME_NOREFRESH));
}
DBUG_PRINT("error",("Out of memory, in use: %ld at line %d, '%s'",
sf_malloc_max_memory,lineno, filename));
diff --git a/scripts/make_win_bin_dist b/scripts/make_win_bin_dist
index 146dcad95f1..1cd4141f532 100755
--- a/scripts/make_win_bin_dist
+++ b/scripts/make_win_bin_dist
@@ -302,6 +302,7 @@ cp mysql-test/std_data/*.cnf $DESTDIR/mysql-test/std_data/
cp mysql-test/std_data/*.dat $DESTDIR/mysql-test/std_data/
cp mysql-test/std_data/*.frm $DESTDIR/mysql-test/std_data/
cp mysql-test/std_data/*.pem $DESTDIR/mysql-test/std_data/
+cp mysql-test/std_data/*.MY* $DESTDIR/mysql-test/std_data/
cp mysql-test/t/*.opt $DESTDIR/mysql-test/t/
cp mysql-test/t/*.sh $DESTDIR/mysql-test/t/
cp mysql-test/t/*.slave-mi $DESTDIR/mysql-test/t/
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index da2438c606c..808179c0750 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -135,6 +135,17 @@ else
fi
fi
+# Check that no previous MySQL installation exist
+if test -f "$ldata/mysql/db.frm"
+then
+ echo "FATAL ERROR: Found already existing MySQL system tables"
+ echo "in $ldata."
+ echo "If you are upgrading from a previous MySQL version you"
+ echo "should run '$bindir/mysql_upgrade', "
+ echo "to upgrade all tables for this version of MySQL"
+ exit 1;
+fi
+
# Find SQL scripts needed for bootstrap
fill_help_tables="fill_help_tables.sql"
create_system_tables="mysql_system_tables.sql"
@@ -181,7 +192,6 @@ then
fi
# Find executables and paths
-mdata=$ldata/mysql
mysqld=$execdir/mysqld
mysqld_opt=""
scriptdir=$bindir
@@ -264,12 +274,6 @@ if test -w / -a ! -z "$user"; then
chown $user $ldata $ldata/mysql $ldata/test;
fi
-# Check is "db" table already exist
-if test ! -f $mdata/db.frm
-then
- db_table_already_exist="yes"
-fi
-
if test -n "$user"; then
args="$args --user=$user"
fi
@@ -322,16 +326,6 @@ then
echo "$bindir/mysqladmin -u root -h $hostname password 'new-password'"
echo "See the manual for more instructions."
- # Print message about upgrading unless we have created a new db table.
- if test -z "$db_table_already_exist"
- then
- echo
- echo "NOTE: If you are upgrading from a previous MySQL verision you "
- echo "should run '$bindir/mysql_upgrade', to make sure all tables have "
- echo "been upgraded for this version of MySQL"
- fi
- echo
-
if test "$in_rpm" = "0"
then
echo "You can start the MySQL daemon with:"
diff --git a/sql-common/client.c b/sql-common/client.c
index 12a2483e54d..89d69b4bd1f 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2948,7 +2948,7 @@ mysql_fetch_lengths(MYSQL_RES *res)
int STDCALL
-mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
+mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
{
DBUG_ENTER("mysql_option");
DBUG_PRINT("enter",("option: %d",(int) option));
@@ -3022,7 +3022,7 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
mysql->reconnect= *(my_bool *) arg;
break;
case MYSQL_OPT_SSL_VERIFY_SERVER_CERT:
- if (!arg || test(*(uint*) arg))
+ if (*(my_bool*) arg)
mysql->options.client_flag|= CLIENT_SSL_VERIFY_SERVER_CERT;
else
mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT;
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index e62003d13ed..0530482237e 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -85,8 +85,7 @@ my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date,
(!(flags & TIME_INVALID_DATES) &&
ltime->month && ltime->day > days_in_month[ltime->month-1] &&
(ltime->month != 2 || calc_days_in_year(ltime->year) != 366 ||
- ltime->day != 29)) ||
- (ltime->year == 0 && (ltime->month != 0 || ltime->day != 0)))
+ ltime->day != 29)))
{
*was_cut= 2;
return TRUE;
@@ -410,9 +409,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
if (number_of_fields < 3 ||
l_time->year > 9999 || l_time->month > 12 ||
l_time->day > 31 || l_time->hour > 23 ||
- l_time->minute > 59 || l_time->second > 59 ||
- (l_time->year == 0 && l_time->month == 0 && l_time->day == 0 &&
- (l_time->hour != 0 || l_time->minute != 0 || l_time->second != 0)))
+ l_time->minute > 59 || l_time->second > 59)
{
/* Only give warning for a zero date if there is some garbage after */
if (!not_zero_date) /* If zero date */
diff --git a/sql/field.cc b/sql/field.cc
index 250a9e3c1b9..460c4fdae11 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -968,6 +968,31 @@ static Item_result field_types_result_type [FIELDTYPE_NUM]=
/*
+ Test if the given string contains important data:
+ not spaces for character string,
+ or any data for binary string.
+
+ SYNOPSIS
+ test_if_important_data()
+ cs Character set
+ str String to test
+ strend String end
+
+ RETURN
+ FALSE - If string does not have important data
+ TRUE - If string has some important data
+*/
+
+static bool
+test_if_important_data(CHARSET_INFO *cs, const char *str, const char *strend)
+{
+ if (cs != &my_charset_bin)
+ str+= cs->cset->scan(cs, str, strend, MY_SEQ_SPACES);
+ return (str < strend);
+}
+
+
+/*
Detect Item_result by given field type of UNION merge result
SYNOPSIS
@@ -1055,64 +1080,113 @@ void Field_num::prepend_zeros(String *value)
}
/*
- Test if given number is a int (or a fixed format float with .000)
+ Test if given number is a int.
SYNOPSIS
- test_if_int()
+ Field_num::check_int
+ cs Character set
str String to test
end Pointer to char after last used digit
- cs Character set
+ length String length
+ error Error returned by strntoull10rnd()
- NOTES
- This is called after one has called my_strntol() or similar function.
- This is only used to give warnings in ALTER TABLE or LOAD DATA...
-
- TODO
- Make this multi-byte-character safe
+ NOTE
+ This is called after one has called strntoull10rnd() function.
RETURN
- 0 OK
- 1 error. A warning is pushed if field_name != 0
+ 0 ok
+ 1 error: empty string or wrong integer.
+ 2 error: garbage at the end of string.
*/
-bool Field::check_int(const char *str, int length, const char *int_end,
- CHARSET_INFO *cs)
+int Field_num::check_int(CHARSET_INFO *cs, const char *str, int length,
+ const char *int_end, int error)
{
- const char *end;
- if (str == int_end)
+ /* Test if we get an empty string or wrong integer */
+ if (str == int_end || error == MY_ERRNO_EDOM)
{
char buff[128];
- String tmp(buff,(uint32) sizeof(buff), system_charset_info);
+ String tmp(buff, (uint32) sizeof(buff), system_charset_info);
tmp.copy(str, length, system_charset_info);
push_warning_printf(table->in_use, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_TRUNCATED_WRONG_VALUE_FOR_FIELD,
ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
"integer", tmp.c_ptr(), field_name,
(ulong) table->in_use->row_count);
- return 1; // Empty string
+ return 1;
}
- end= str+length;
- if ((str= int_end) == end)
- return 0; // OK; All digits was used
+ /* Test if we have garbage at the end of the given string. */
+ if (test_if_important_data(cs, int_end, str + length))
+ {
+ set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
+ return 2;
+ }
+ return 0;
+}
- /* Allow end .0000 */
- if (*str == '.')
+
+/*
+ Conver a string to an integer then check bounds.
+
+ SYNOPSIS
+ Field_num::get_int
+ cs Character set
+ from String to convert
+ len Length of the string
+ rnd OUT longlong value
+ unsigned_max max unsigned value
+ signed_min min signed value
+ signed_max max signed value
+
+ DESCRIPTION
+ The function calls strntoull10rnd() to get an integer value then
+ check bounds and errors returned. In case of any error a warning
+ is raised.
+
+ RETURN
+ 0 ok
+ 1 error
+*/
+
+bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
+ longlong *rnd, ulonglong unsigned_max,
+ longlong signed_min, longlong signed_max)
+{
+ char *end;
+ int error;
+
+ *rnd= (longlong) cs->cset->strntoull10rnd(cs, from, len, unsigned_flag, &end,
+ &error);
+ if (unsigned_flag)
{
- for (str++ ; str != end && *str == '0'; str++)
- ;
+
+ if (((ulonglong) *rnd > unsigned_max) && (*rnd= (longlong) unsigned_max) ||
+ error == MY_ERRNO_ERANGE)
+ {
+ goto out_of_range;
+ }
}
- /* Allow end space */
- for ( ; str != end ; str++)
+ else
{
- if (!my_isspace(cs,*str))
+ if (*rnd < signed_min)
{
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1);
- return 1;
+ *rnd= signed_min;
+ goto out_of_range;
+ }
+ else if (*rnd > signed_max)
+ {
+ *rnd= signed_max;
+ goto out_of_range;
}
}
+ if (table->in_use->count_cuted_fields && check_int(cs, from, len, end, error))
+ return 1;
return 0;
-}
+out_of_range:
+ set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
+ return 1;
+}
/*
Process decimal library return codes and issue warnings for overflow and
@@ -2569,45 +2643,11 @@ uint Field_new_decimal::is_equal(create_field *new_field)
int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
- char *end;
int error;
-
- if (unsigned_flag)
- {
- ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end, &error);
- if (error == MY_ERRNO_ERANGE || tmp > 255)
- {
- set_if_smaller(tmp, 255);
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
- error= 1;
- else
- error= 0;
- ptr[0]= (char) tmp;
- }
- else
- {
- longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
- if (tmp < -128)
- {
- tmp= -128;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (tmp >= 128)
- {
- tmp= 127;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
- error= 1;
- else
- error= 0;
- ptr[0]= (char) tmp;
- }
+ longlong rnd;
+
+ error= get_int(cs, from, len, &rnd, 255, -128, 127);
+ ptr[0]= unsigned_flag ? (char) (ulonglong) rnd : (char) rnd;
return error;
}
@@ -2778,59 +2818,20 @@ void Field_tiny::sql_type(String &res) const
int Field_short::store(const char *from,uint len,CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
- char *end;
+ int store_tmp;
int error;
-
- if (unsigned_flag)
- {
- ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end, &error);
- if (error == MY_ERRNO_ERANGE || tmp > UINT_MAX16)
- {
- set_if_smaller(tmp, UINT_MAX16);
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
- error= 1;
- else
- error= 0;
+ longlong rnd;
+
+ error= get_int(cs, from, len, &rnd, UINT_MAX16, INT_MIN16, INT_MAX16);
+ store_tmp= unsigned_flag ? (int) (ulonglong) rnd : (int) rnd;
#ifdef WORDS_BIGENDIAN
- if (table->s->db_low_byte_first)
- {
- int2store(ptr,tmp);
- }
- else
-#endif
- shortstore(ptr,(short) tmp);
+ if (table->s->db_low_byte_first)
+ {
+ int2store(ptr, store_tmp);
}
else
- {
- longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
- if (tmp < INT_MIN16)
- {
- tmp= INT_MIN16;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (tmp > INT_MAX16)
- {
- tmp=INT_MAX16;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
- error= 1;
- else
- error= 0;
-#ifdef WORDS_BIGENDIAN
- if (table->s->db_low_byte_first)
- {
- int2store(ptr,tmp);
- }
- else
#endif
- shortstore(ptr,(short) tmp);
- }
+ shortstore(ptr, (short) store_tmp);
return error;
}
@@ -3064,45 +3065,13 @@ void Field_short::sql_type(String &res) const
int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs)
{
ASSERT_COLUMN_MARKED_FOR_WRITE;
- char *end;
+ int store_tmp;
int error;
-
- if (unsigned_flag)
- {
- ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end, &error);
- if (error == MY_ERRNO_ERANGE || tmp > UINT_MAX24)
- {
- set_if_smaller(tmp, UINT_MAX24);
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
- error= 1;
- else
- error= 0;
- int3store(ptr,tmp);
- }
- else
- {
- longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
- if (tmp < INT_MIN24)
- {
- tmp= INT_MIN24;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (tmp > INT_MAX24)
- {
- tmp=INT_MAX24;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
- error= 1;
- else
- error= 0;
- int3store(ptr,tmp);
- }
+ longlong rnd;
+
+ error= get_int(cs, from, len, &rnd, UINT_MAX24, INT_MIN24, INT_MAX24);
+ store_tmp= unsigned_flag ? (int) (ulonglong) rnd : (int) rnd;
+ int3store(ptr, store_tmp);
return error;
}
@@ -3288,45 +3257,10 @@ int Field_long::store(const char *from,uint len,CHARSET_INFO *cs)
ASSERT_COLUMN_MARKED_FOR_WRITE;
long store_tmp;
int error;
- char *end;
-
- if (unsigned_flag)
- {
- ulonglong tmp= cs->cset->strntoull10rnd(cs, from, len, 1, &end, &error);
- if (error == MY_ERRNO_ERANGE || tmp > (ulonglong) UINT_MAX32)
- {
- set_if_smaller(tmp, (ulonglong) UINT_MAX32);
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
- error= 1;
- else
- error= 0;
- store_tmp= (long) tmp;
- }
- else
- {
- longlong tmp= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
- if (tmp < INT_MIN32)
- {
- tmp= INT_MIN32;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (tmp > INT_MAX32)
- {
- tmp=INT_MAX32;
- set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
- error= 1;
- }
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
- error= 1;
- else
- error= 0;
- store_tmp= (long) tmp;
- }
-
+ longlong rnd;
+
+ error= get_int(cs, from, len, &rnd, UINT_MAX32, INT_MIN32, INT_MAX32);
+ store_tmp= unsigned_flag ? (long) (ulonglong) rnd : (long) rnd;
#ifdef WORDS_BIGENDIAN
if (table->s->db_low_byte_first)
{
@@ -3578,7 +3512,8 @@ int Field_longlong::store(const char *from,uint len,CHARSET_INFO *cs)
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
error= 1;
}
- else if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
+ else if (table->in_use->count_cuted_fields &&
+ check_int(cs, from, len, end, error))
error= 1;
else
error= 0;
@@ -5116,16 +5051,25 @@ int Field_year::store(const char *from, uint len,CHARSET_INFO *cs)
ASSERT_COLUMN_MARKED_FOR_WRITE;
char *end;
int error;
- long nr= my_strntol(cs, from, len, 10, &end, &error);
+ longlong nr= cs->cset->strntoull10rnd(cs, from, len, 0, &end, &error);
- if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155 || error)
+ if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155 ||
+ error == MY_ERRNO_ERANGE)
{
*ptr=0;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, 1);
return 1;
}
- if (table->in_use->count_cuted_fields && check_int(from,len,end,cs))
+ if (table->in_use->count_cuted_fields &&
+ (error= check_int(cs, from, len, end, error)))
+ {
+ if (error == 1) /* empty or incorrect string */
+ {
+ *ptr= 0;
+ return 1;
+ }
error= 1;
+ }
if (nr != 0 || len != 4)
{
@@ -6034,31 +5978,6 @@ report_data_too_long(Field_str *field)
}
-/*
- Test if the given string contains important data:
- not spaces for character string,
- or any data for binary string.
-
- SYNOPSIS
- test_if_important_data()
- cs Character set
- str String to test
- strend String end
-
- RETURN
- FALSE - If string does not have important data
- TRUE - If string has some important data
-*/
-
-static bool
-test_if_important_data(CHARSET_INFO *cs, const char *str, const char *strend)
-{
- if (cs != &my_charset_bin)
- str+= cs->cset->scan(cs, str, strend, MY_SEQ_SPACES);
- return (str < strend);
-}
-
-
/* Copy a string and fill with space */
int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
diff --git a/sql/field.h b/sql/field.h
index b2169dac5b6..3d1ac7528c1 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -358,8 +358,6 @@ public:
virtual void set_derivation(enum Derivation derivation_arg) { }
bool set_warning(MYSQL_ERROR::enum_warning_level, unsigned int code,
int cuted_increment);
- bool check_int(const char *str, int length, const char *int_end,
- CHARSET_INFO *cs);
void set_datetime_warning(MYSQL_ERROR::enum_warning_level, uint code,
const char *str, uint str_len,
timestamp_type ts_type, int cuted_increment);
@@ -445,6 +443,11 @@ public:
int store_decimal(const my_decimal *);
my_decimal *val_decimal(my_decimal *);
uint is_equal(create_field *new_field);
+ int check_int(CHARSET_INFO *cs, const char *str, int length,
+ const char *int_end, int error);
+ bool get_int(CHARSET_INFO *cs, const char *from, uint len,
+ longlong *rnd, ulonglong unsigned_max,
+ longlong signed_min, longlong signed_max);
};
diff --git a/sql/item.h b/sql/item.h
index bf662b98732..429a1d33041 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -735,12 +735,11 @@ public:
virtual bool get_date_result(TIME *ltime,uint fuzzydate)
{ return get_date(ltime,fuzzydate); }
/*
- This function is used only in Item_func_isnull/Item_func_isnotnull
- (implementations of IS NULL/IS NOT NULL clauses). Item_func_is{not}null
- calls this method instead of one of val/result*() methods, which
- normally will set null_value. This allows to determine nullness of
- a complex expression without fully evaluating it.
- Any new item which can be NULL must implement this call.
+ The method allows to determine nullness of a complex expression
+ without fully evaluating it, instead of calling val/result*() then
+ checking null_value. Used in Item_func_isnull/Item_func_isnotnull
+ and Item_sum_count/Item_sum_count_distinct.
+ Any new item which can be NULL must implement this method.
*/
virtual bool is_null() { return 0; }
diff --git a/sql/item_create.cc b/sql/item_create.cc
index 6a1e87a3aae..8ff78ef1b48 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -167,7 +167,7 @@ class Create_sp_func : public Create_qfunc
{
public:
virtual Item* create(THD *thd, LEX_STRING db, LEX_STRING name,
- List<Item> *item_list);
+ bool use_explicit_name, List<Item> *item_list);
static Create_sp_func s_singleton;
@@ -2316,7 +2316,7 @@ Create_qfunc::create(THD *thd, LEX_STRING name, List<Item> *item_list)
if (thd->copy_db_to(&db.str, &db.length))
return NULL;
- return create(thd, db, name, item_list);
+ return create(thd, db, name, false, item_list);
}
@@ -2433,7 +2433,7 @@ Create_sp_func Create_sp_func::s_singleton;
Item*
Create_sp_func::create(THD *thd, LEX_STRING db, LEX_STRING name,
- List<Item> *item_list)
+ bool use_explicit_name, List<Item> *item_list)
{
int arg_count= 0;
Item *func= NULL;
@@ -2458,7 +2458,7 @@ Create_sp_func::create(THD *thd, LEX_STRING db, LEX_STRING name,
if (item_list != NULL)
arg_count= item_list->elements;
- qname= new (thd->mem_root) sp_name(db, name);
+ qname= new (thd->mem_root) sp_name(db, name, use_explicit_name);
qname->init_qname(thd);
sp_add_used_routine(lex, thd, qname, TYPE_ENUM_FUNCTION);
@@ -4792,6 +4792,12 @@ static Native_func_registry func_array[] =
{ C_STRING_WITH_LEN("MAKE_SET"), BUILDER(Create_func_make_set)},
{ C_STRING_WITH_LEN("MASTER_POS_WAIT"), BUILDER(Create_func_master_pos_wait)},
{ C_STRING_WITH_LEN("MBRCONTAINS"), GEOM_BUILDER(Create_func_contains)},
+ { C_STRING_WITH_LEN("MBRDISJOINT"), GEOM_BUILDER(Create_func_disjoint)},
+ { C_STRING_WITH_LEN("MBREQUAL"), GEOM_BUILDER(Create_func_equals)},
+ { C_STRING_WITH_LEN("MBRINTERSECTS"), GEOM_BUILDER(Create_func_intersects)},
+ { C_STRING_WITH_LEN("MBROVERLAPS"), GEOM_BUILDER(Create_func_overlaps)},
+ { C_STRING_WITH_LEN("MBRTOUCHES"), GEOM_BUILDER(Create_func_touches)},
+ { C_STRING_WITH_LEN("MBRWITHIN"), GEOM_BUILDER(Create_func_within)},
{ C_STRING_WITH_LEN("MD5"), BUILDER(Create_func_md5)},
{ C_STRING_WITH_LEN("MLINEFROMTEXT"), GEOM_BUILDER(Create_func_geometry_from_text)},
{ C_STRING_WITH_LEN("MLINEFROMWKB"), GEOM_BUILDER(Create_func_geometry_from_wkb)},
diff --git a/sql/item_create.h b/sql/item_create.h
index 985c4428d8f..0a668b3e67f 100644
--- a/sql/item_create.h
+++ b/sql/item_create.h
@@ -87,11 +87,12 @@ public:
@param thd The current thread
@param db The database name
@param name The function name
+ @param use_explicit_name Should the function be represented as 'db.name'?
@param item_list The list of arguments to the function, can be NULL
@return An item representing the parsed function call
*/
virtual Item* create(THD *thd, LEX_STRING db, LEX_STRING name,
- List<Item> *item_list) = 0;
+ bool use_explicit_name, List<Item> *item_list) = 0;
protected:
/** Constructor. */
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 59894c981af..c24fb61cc43 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -5029,7 +5029,7 @@ Item_func_sp::func_name() const
{
THD *thd= current_thd;
/* Calculate length to avoid reallocation of string for sure */
- uint len= ((m_name->m_db.length +
+ uint len= ((m_name->m_explicit_name ? m_name->m_db.length : 0 +
m_name->m_name.length)*2 + //characters*quoting
2 + // ` and `
1 + // .
@@ -5039,8 +5039,11 @@ Item_func_sp::func_name() const
system_charset_info);
qname.length(0);
- append_identifier(thd, &qname, m_name->m_db.str, m_name->m_db.length);
- qname.append('.');
+ if (m_name->m_explicit_name)
+ {
+ append_identifier(thd, &qname, m_name->m_db.str, m_name->m_db.length);
+ qname.append('.');
+ }
append_identifier(thd, &qname, m_name->m_name.str, m_name->m_name.length);
return qname.ptr();
}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index e6f951bfc7b..4e28967b2b0 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2348,7 +2348,7 @@ String *Item_func_repeat::val_str(String *str)
goto err; // string and/or delim are null
null_value= 0;
- if (count == 0 || count < 0 && !args[1]->unsigned_flag)
+ if (count <= 0 && (count == 0 || !args[1]->unsigned_flag))
return &my_empty_string;
/* Assumes that the maximum length of a String is < INT_MAX32. */
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 7c3762d4785..f217a6ea953 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1090,14 +1090,8 @@ void Item_sum_count::clear()
bool Item_sum_count::add()
{
- if (!args[0]->maybe_null)
+ if (!args[0]->maybe_null || !args[0]->is_null())
count++;
- else
- {
- args[0]->update_null_value();
- if (!args[0]->null_value)
- count++;
- }
return 0;
}
@@ -1940,14 +1934,8 @@ void Item_sum_count::reset_field()
char *res=result_field->ptr;
longlong nr=0;
- if (!args[0]->maybe_null)
+ if (!args[0]->maybe_null || !args[0]->is_null())
nr=1;
- else
- {
- args[0]->update_null_value();
- if (!args[0]->null_value)
- nr=1;
- }
int8store(res,nr);
}
@@ -2050,14 +2038,8 @@ void Item_sum_count::update_field()
char *res=result_field->ptr;
nr=sint8korr(res);
- if (!args[0]->maybe_null)
+ if (!args[0]->maybe_null || !args[0]->is_null())
nr++;
- else
- {
- args[0]->update_null_value();
- if (!args[0]->null_value)
- nr++;
- }
int8store(res,nr);
}
@@ -2481,12 +2463,8 @@ bool Item_sum_count_distinct::setup(THD *thd)
Item *item=args[i];
if (list.push_back(item))
return TRUE; // End of memory
- if (item->const_item())
- {
- item->update_null_value();
- if (item->null_value)
- always_null=1;
- }
+ if (item->const_item() && item->is_null())
+ always_null= 1;
}
if (always_null)
return FALSE;
diff --git a/sql/lex.h b/sql/lex.h
index 45155da7692..e311379120d 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -312,6 +312,7 @@ static SYMBOL symbols[] = {
{ "MASTER_SSL_CERT", SYM(MASTER_SSL_CERT_SYM)},
{ "MASTER_SSL_CIPHER",SYM(MASTER_SSL_CIPHER_SYM)},
{ "MASTER_SSL_KEY", SYM(MASTER_SSL_KEY_SYM)},
+ { "MASTER_SSL_VERIFY_SERVER_CERT", SYM(MASTER_SSL_VERIFY_SERVER_CERT_SYM)},
{ "MASTER_USER", SYM(MASTER_USER_SYM)},
{ "MATCH", SYM(MATCH)},
{ "MAX_CONNECTIONS_PER_HOUR", SYM(MAX_CONNECTIONS_PER_HOUR)},
diff --git a/sql/log.cc b/sql/log.cc
index fe3a4f7df5e..3cfcabd8363 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -569,11 +569,21 @@ bool Log_to_csv_event_handler::
if (query_start_arg)
{
+ /*
+ A TIME field can not hold the full longlong range; query_time or
+ lock_time may be truncated without warning here, if greater than
+ 839 hours (~35 days)
+ */
+ TIME t;
+ t.neg= 0;
+
/* fill in query_time field */
- if (table->field[2]->store(query_time, TRUE))
+ calc_time_from_sec(&t, (long) min(query_time, (longlong) TIME_MAX_VALUE_SECONDS), 0);
+ if (table->field[2]->store_time(&t, MYSQL_TIMESTAMP_TIME))
goto err;
/* lock_time */
- if (table->field[3]->store(lock_time, TRUE))
+ calc_time_from_sec(&t, (long) min(lock_time, (longlong) TIME_MAX_VALUE_SECONDS), 0);
+ if (table->field[3]->store_time(&t, MYSQL_TIMESTAMP_TIME))
goto err;
/* rows_sent */
if (table->field[4]->store((longlong) thd->sent_row_count, TRUE))
@@ -1714,7 +1724,7 @@ err:
#ifdef __NT__
static int eventSource = 0;
-void setup_windows_event_source()
+static void setup_windows_event_source()
{
HKEY hRegKey= NULL;
DWORD dwError= 0;
@@ -4218,38 +4228,6 @@ static bool test_if_number(register const char *str,
} /* test_if_number */
-void print_buffer_to_file(enum loglevel level, const char *buffer)
-{
- time_t skr;
- struct tm tm_tmp;
- struct tm *start;
- DBUG_ENTER("print_buffer_to_file");
- DBUG_PRINT("enter",("buffer: %s", buffer));
-
- VOID(pthread_mutex_lock(&LOCK_error_log));
-
- skr=time(NULL);
- localtime_r(&skr, &tm_tmp);
- start=&tm_tmp;
-
- fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n",
- start->tm_year % 100,
- start->tm_mon+1,
- start->tm_mday,
- start->tm_hour,
- start->tm_min,
- start->tm_sec,
- (level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
- "Warning" : "Note"),
- buffer);
-
- fflush(stderr);
-
- VOID(pthread_mutex_unlock(&LOCK_error_log));
- DBUG_VOID_RETURN;
-}
-
-
void sql_perror(const char *message)
{
#ifdef HAVE_STRERROR
@@ -4316,23 +4294,15 @@ void MYSQL_BIN_LOG::signal_update()
}
#ifdef __NT__
-void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
- uint length, int buffLen)
+static void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
+ size_t length, size_t buffLen)
{
HANDLE event;
- char *buffptr;
- LPCSTR *buffmsgptr;
+ char *buffptr= buff;
DBUG_ENTER("print_buffer_to_nt_eventlog");
- buffptr= buff;
- if (length > (uint)(buffLen-5))
- {
- char *newBuff= new char[length + 5];
- strcpy(newBuff, buff);
- buffptr= newBuff;
- }
- strmov(buffptr+length, "\r\n\r\n");
- buffmsgptr= (LPCSTR*) &buffptr; // Keep windows happy
+ /* Add ending CR/LF's to string, overwrite last chars if necessary */
+ strmov(buffptr+min(length, buffLen-5), "\r\n\r\n");
setup_windows_event_source();
if ((event= RegisterEventSource(NULL,"MySQL")))
@@ -4340,24 +4310,20 @@ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
switch (level) {
case ERROR_LEVEL:
ReportEvent(event, EVENTLOG_ERROR_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
- buffmsgptr, NULL);
+ (LPCSTR*)&buffptr, NULL);
break;
case WARNING_LEVEL:
ReportEvent(event, EVENTLOG_WARNING_TYPE, 0, MSG_DEFAULT, NULL, 1, 0,
- buffmsgptr, NULL);
+ (LPCSTR*) &buffptr, NULL);
break;
case INFORMATION_LEVEL:
ReportEvent(event, EVENTLOG_INFORMATION_TYPE, 0, MSG_DEFAULT, NULL, 1,
- 0, buffmsgptr, NULL);
+ 0, (LPCSTR*) &buffptr, NULL);
break;
}
DeregisterEventSource(event);
}
- /* if we created a string buffer, then delete it */
- if (buffptr != buff)
- delete[] buffptr;
-
DBUG_VOID_RETURN;
}
#endif /* __NT__ */
@@ -4394,14 +4360,45 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
DBUG_RETURN(0);
}
#else /*!EMBEDDED_LIBRARY*/
+static void print_buffer_to_file(enum loglevel level, const char *buffer)
+{
+ time_t skr;
+ struct tm tm_tmp;
+ struct tm *start;
+ DBUG_ENTER("print_buffer_to_file");
+ DBUG_PRINT("enter",("buffer: %s", buffer));
+
+ VOID(pthread_mutex_lock(&LOCK_error_log));
+
+ skr=time(NULL);
+ localtime_r(&skr, &tm_tmp);
+ start=&tm_tmp;
+
+ fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %s\n",
+ start->tm_year % 100,
+ start->tm_mon+1,
+ start->tm_mday,
+ start->tm_hour,
+ start->tm_min,
+ start->tm_sec,
+ (level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
+ "Warning" : "Note"),
+ buffer);
+
+ fflush(stderr);
+
+ VOID(pthread_mutex_unlock(&LOCK_error_log));
+ DBUG_VOID_RETURN;
+}
+
+
int vprint_msg_to_log(enum loglevel level, const char *format, va_list args)
{
char buff[1024];
- uint length;
+ size_t length;
DBUG_ENTER("vprint_msg_to_log");
- /* "- 5" is because of print_buffer_to_nt_eventlog() */
- length= my_vsnprintf(buff, sizeof(buff) - 5, format, args);
+ length= my_vsnprintf(buff, sizeof(buff), format, args);
print_buffer_to_file(level, buff);
#ifdef __NT__
diff --git a/sql/log_event.cc b/sql/log_event.cc
index e3c94b5e1c9..593328c4bf2 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -784,19 +784,34 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
LOG_READ_TOO_LARGE);
goto end;
}
- packet->append(buf, sizeof(buf));
+
+ /* Append the log event header to packet */
+ if (packet->append(buf, sizeof(buf)))
+ {
+ /* Failed to allocate packet */
+ result= LOG_READ_MEM;
+ goto end;
+ }
data_len-= LOG_EVENT_MINIMAL_HEADER_LEN;
if (data_len)
{
+ /* Append rest of event, read directly from file into packet */
if (packet->append(file, data_len))
{
/*
- Here if we hit EOF it's really an error: as data_len is >=0
- there's supposed to be more bytes available.
- EOF means we are reading the event partially, which should
- never happen: either we read badly or the binlog is truncated.
+ Fatal error occured when appending rest of the event
+ to packet, possible failures:
+ 1. EOF occured when reading from file, it's really an error
+ as data_len is >=0 there's supposed to be more bytes available.
+ file->error will have been set to number of bytes left to read
+ 2. Read was interrupted, file->error would normally be set to -1
+ 3. Failed to allocate memory for packet, my_errno
+ will be ENOMEM(file->error shuold be 0, but since the
+ memory allocation occurs before the call to read it might
+ be uninitialized)
*/
- result= file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO;
+ result= (my_errno == ENOMEM ? LOG_READ_MEM :
+ (file->error >= 0 ? LOG_READ_TRUNC: LOG_READ_IO));
/* Implicit goto end; */
}
}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 9bdf117f8f7..c8da0dccd5c 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7347,6 +7347,18 @@ static void mysql_init_variables(void)
/* Allow Win32 and NetWare users to move MySQL anywhere */
{
char prg_dev[LIBLEN];
+#if defined __WIN__
+ char executing_path_name[LIBLEN];
+ if (!test_if_hard_path(my_progname))
+ {
+ // we don't want to use GetModuleFileName inside of my_path since
+ // my_path is a generic path dereferencing function and here we care
+ // only about the executing binary.
+ GetModuleFileName(NULL, executing_path_name, sizeof(executing_path_name));
+ my_path(prg_dev, executing_path_name, NULL);
+ }
+ else
+#endif
my_path(prg_dev,my_progname,"mysql/bin");
strcat(prg_dev,"/../"); // Remove 'bin' to get base dir
cleanup_dirname(mysql_home,prg_dev);
diff --git a/sql/repl_failsafe.cc b/sql/repl_failsafe.cc
index 934a6821514..73fdc3a3aee 100644
--- a/sql/repl_failsafe.cc
+++ b/sql/repl_failsafe.cc
@@ -692,12 +692,16 @@ int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi)
#ifdef HAVE_OPENSSL
if (mi->ssl)
+ {
mysql_ssl_set(mysql,
mi->ssl_key[0]?mi->ssl_key:0,
mi->ssl_cert[0]?mi->ssl_cert:0,
mi->ssl_ca[0]?mi->ssl_ca:0,
mi->ssl_capath[0]?mi->ssl_capath:0,
mi->ssl_cipher[0]?mi->ssl_cipher:0);
+ mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
+ &mi->ssl_verify_server_cert);
+ }
#endif
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 1c426eff768..354a97cefde 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -29,12 +29,13 @@ int init_strvar_from_file(char *var, int max_size, IO_CACHE *f,
MASTER_INFO::MASTER_INFO()
:ssl(0), fd(-1), io_thd(0), inited(0),
- abort_slave(0),slave_running(0), slave_run_id(0)
+ abort_slave(0),slave_running(0), slave_run_id(0),
+ ssl_verify_server_cert(0)
{
host[0] = 0; user[0] = 0; password[0] = 0;
ssl_ca[0]= 0; ssl_capath[0]= 0; ssl_cert[0]= 0;
ssl_cipher[0]= 0; ssl_key[0]= 0;
-
+
bzero((char*) &file, sizeof(file));
pthread_mutex_init(&run_lock, MY_MUTEX_INIT_FAST);
pthread_mutex_init(&data_lock, MY_MUTEX_INIT_FAST);
@@ -80,12 +81,21 @@ void init_master_info_with_options(MASTER_INFO* mi)
strmake(mi->ssl_cipher, master_ssl_cipher, sizeof(mi->ssl_cipher)-1);
if (master_ssl_key)
strmake(mi->ssl_key, master_ssl_key, sizeof(mi->ssl_key)-1);
+ /* Intentionally init ssl_verify_server_cert to 0, no option available */
+ mi->ssl_verify_server_cert= 0;
DBUG_VOID_RETURN;
}
-#define LINES_IN_MASTER_INFO_WITH_SSL 14
+enum {
+ LINES_IN_MASTER_INFO_WITH_SSL= 14,
+
+ /* 5.1.16 added value of master_ssl_verify_server_cert */
+ LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT= 15,
+ /* Number of lines currently used when saving master info file */
+ LINES_IN_MASTER_INFO= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT
+};
int init_master_info(MASTER_INFO* mi, const char* master_info_fname,
const char* slave_info_fname,
@@ -184,7 +194,8 @@ file '%s')", fname);
}
mi->fd = fd;
- int port, connect_retry, master_log_pos, ssl= 0, lines;
+ int port, connect_retry, master_log_pos, lines;
+ int ssl= 0, ssl_verify_server_cert= 0;
char *first_non_digit;
/*
@@ -195,7 +206,8 @@ file '%s')", fname);
file since versions before 4.1.x could generate files with more
lines than needed.
If first line doesn't contain a number or contain number less than
- 14 then such file is treated like file from pre 4.1.1 version.
+ LINES_IN_MASTER_INFO_WITH_SSL then such file is treated like file
+ from pre 4.1.1 version.
There is no ambiguity when reading an old master.info, as before
4.1.1, the first line contained the binlog's name, which is either
empty or has an extension (contains a '.'), so can't be confused
@@ -219,7 +231,8 @@ file '%s')", fname);
if (mi->master_log_name[0]!='\0' &&
*first_non_digit=='\0' && lines >= LINES_IN_MASTER_INFO_WITH_SSL)
- { // Seems to be new format
+ {
+ /* Seems to be new format => read master log name from next line */
if (init_strvar_from_file(mi->master_log_name,
sizeof(mi->master_log_name), &mi->file, ""))
goto errwithmsg;
@@ -245,19 +258,31 @@ file '%s')", fname);
slave will try connect to master, so in this case warning
is printed.
*/
- if (lines >= LINES_IN_MASTER_INFO_WITH_SSL &&
- (init_intvar_from_file(&ssl, &mi->file, master_ssl) ||
- init_strvar_from_file(mi->ssl_ca, sizeof(mi->ssl_ca),
- &mi->file, master_ssl_ca) ||
- init_strvar_from_file(mi->ssl_capath, sizeof(mi->ssl_capath),
- &mi->file, master_ssl_capath) ||
- init_strvar_from_file(mi->ssl_cert, sizeof(mi->ssl_cert),
- &mi->file, master_ssl_cert) ||
- init_strvar_from_file(mi->ssl_cipher, sizeof(mi->ssl_cipher),
- &mi->file, master_ssl_cipher) ||
- init_strvar_from_file(mi->ssl_key, sizeof(mi->ssl_key),
- &mi->file, master_ssl_key)))
- goto errwithmsg;
+ if (lines >= LINES_IN_MASTER_INFO_WITH_SSL)
+ {
+ if (init_intvar_from_file(&ssl, &mi->file, master_ssl) ||
+ init_strvar_from_file(mi->ssl_ca, sizeof(mi->ssl_ca),
+ &mi->file, master_ssl_ca) ||
+ init_strvar_from_file(mi->ssl_capath, sizeof(mi->ssl_capath),
+ &mi->file, master_ssl_capath) ||
+ init_strvar_from_file(mi->ssl_cert, sizeof(mi->ssl_cert),
+ &mi->file, master_ssl_cert) ||
+ init_strvar_from_file(mi->ssl_cipher, sizeof(mi->ssl_cipher),
+ &mi->file, master_ssl_cipher) ||
+ init_strvar_from_file(mi->ssl_key, sizeof(mi->ssl_key),
+ &mi->file, master_ssl_key))
+ goto errwithmsg;
+
+ /*
+ Starting from 5.1.16 ssl_verify_server_cert might be
+ in the file
+ */
+ if (lines >= LINE_FOR_MASTER_SSL_VERIFY_SERVER_CERT &&
+ init_intvar_from_file(&ssl_verify_server_cert, &mi->file, 0))
+ goto errwithmsg;
+
+ }
+
#ifndef HAVE_OPENSSL
if (ssl)
sql_print_warning("SSL information in the master info file "
@@ -273,6 +298,7 @@ file '%s')", fname);
mi->port= (uint) port;
mi->connect_retry= (uint) connect_retry;
mi->ssl= (my_bool) ssl;
+ mi->ssl_verify_server_cert= ssl_verify_server_cert;
}
DBUG_PRINT("master_info",("log_file_name: %s position: %ld",
mi->master_log_name,
@@ -315,6 +341,7 @@ int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
{
IO_CACHE* file = &mi->file;
char lbuf[22];
+
DBUG_ENTER("flush_master_info");
DBUG_PRINT("enter",("master_pos: %ld", (long) mi->master_log_pos));
@@ -352,13 +379,14 @@ int flush_master_info(MASTER_INFO* mi, bool flush_relay_log_cache)
*/
my_b_seek(file, 0L);
- my_b_printf(file, "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n",
- LINES_IN_MASTER_INFO_WITH_SSL,
+ my_b_printf(file,
+ "%u\n%s\n%s\n%s\n%s\n%s\n%d\n%d\n%d\n%s\n%s\n%s\n%s\n%s\n%d\n",
+ LINES_IN_MASTER_INFO,
mi->master_log_name, llstr(mi->master_log_pos, lbuf),
mi->host, mi->user,
mi->password, mi->port, mi->connect_retry,
(int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
- mi->ssl_cipher, mi->ssl_key);
+ mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert);
DBUG_RETURN(-flush_io_cache(file));
}
diff --git a/sql/rpl_mi.h b/sql/rpl_mi.h
index ae77e64d93a..c39a89a35b3 100644
--- a/sql/rpl_mi.h
+++ b/sql/rpl_mi.h
@@ -65,6 +65,7 @@ class MASTER_INFO
my_bool ssl; // enables use of SSL connection if true
char ssl_ca[FN_REFLEN], ssl_capath[FN_REFLEN], ssl_cert[FN_REFLEN];
char ssl_cipher[FN_REFLEN], ssl_key[FN_REFLEN];
+ my_bool ssl_verify_server_cert;
my_off_t master_log_pos;
File fd; // we keep the file open, so we need to remember the file pointer
diff --git a/sql/slave.cc b/sql/slave.cc
index bc6cef95fc6..2e2fd93ea86 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -1252,6 +1252,8 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
sizeof(mi->ssl_key)));
field_list.push_back(new Item_return_int("Seconds_Behind_Master", 10,
MYSQL_TYPE_LONGLONG));
+ field_list.push_back(new Item_empty_string("Master_SSL_Verify_Server_Cert",
+ 3));
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
@@ -1358,7 +1360,10 @@ bool show_master_info(THD* thd, MASTER_INFO* mi)
max(0, time_diff) : 0));
}
else
+ {
protocol->store_null();
+ }
+ protocol->store(mi->ssl_verify_server_cert? "Yes":"No", &my_charset_bin);
pthread_mutex_unlock(&mi->rli.data_lock);
pthread_mutex_unlock(&mi->data_lock);
@@ -3142,12 +3147,16 @@ static int connect_to_master(THD* thd, MYSQL* mysql, MASTER_INFO* mi,
#ifdef HAVE_OPENSSL
if (mi->ssl)
+ {
mysql_ssl_set(mysql,
mi->ssl_key[0]?mi->ssl_key:0,
mi->ssl_cert[0]?mi->ssl_cert:0,
mi->ssl_ca[0]?mi->ssl_ca:0,
mi->ssl_capath[0]?mi->ssl_capath:0,
mi->ssl_cipher[0]?mi->ssl_cipher:0);
+ mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
+ &mi->ssl_verify_server_cert);
+ }
#endif
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset_info->csname);
diff --git a/sql/sp.cc b/sql/sp.cc
index d8dd9b3d67e..8ede0801d6d 100644
--- a/sql/sp.cc
+++ b/sql/sp.cc
@@ -1041,7 +1041,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *routines, bool any, bool no_error)
lex_name.length= strlen(routine->table_name);
lex_db.str= thd->strmake(routine->db, lex_db.length);
lex_name.str= thd->strmake(routine->table_name, lex_name.length);
- name= new sp_name(lex_db, lex_name);
+ name= new sp_name(lex_db, lex_name, true);
name->init_qname(thd);
sp_object_found= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, name,
&thd->sp_proc_cache, FALSE) != NULL ||
diff --git a/sql/sp_head.h b/sql/sp_head.h
index 9aee9e9389e..90b937b9161 100644
--- a/sql/sp_head.h
+++ b/sql/sp_head.h
@@ -59,9 +59,10 @@ public:
calling set_routine_type().
*/
LEX_STRING m_sroutines_key;
+ bool m_explicit_name; /**< Prepend the db name? */
- sp_name(LEX_STRING db, LEX_STRING name)
- : m_db(db), m_name(name)
+ sp_name(LEX_STRING db, LEX_STRING name, bool use_explicit_name)
+ : m_db(db), m_name(name), m_explicit_name(use_explicit_name)
{
m_qname.str= m_sroutines_key.str= 0;
m_qname.length= m_sroutines_key.length= 0;
@@ -79,6 +80,7 @@ public:
m_name.length= m_qname.length= key_len - 1;
m_db.str= 0;
m_db.length= 0;
+ m_explicit_name= false;
}
// Init. the qualified name from the db and name.
diff --git a/sql/spatial.h b/sql/spatial.h
index 0c0452b5abc..f806861290e 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -144,15 +144,46 @@ struct MBR
return (xmin<x) && (xmax>x) && (ymin<y) && (ymax>y);
}
+ /**
+ The dimension maps to an integer as:
+ - Polygon -> 2
+ - Horizontal or vertical line -> 1
+ - Point -> 0
+ - Invalid MBR -> -1
+ */
+ int dimension() const
+ {
+ int d= 0;
+
+ if (xmin > xmax)
+ return -1;
+ else if (xmin < xmax)
+ d++;
+
+ if (ymin > ymax)
+ return -1;
+ else if (ymin < ymax)
+ d++;
+
+ return d;
+ }
+
int overlaps(const MBR *mbr)
{
- int lb= mbr->inner_point(xmin, ymin);
- int rb= mbr->inner_point(xmax, ymin);
- int rt= mbr->inner_point(xmax, ymax);
- int lt= mbr->inner_point(xmin, ymax);
+ /*
+ overlaps() requires that some point inside *this is also inside
+ *mbr, and that both geometries and their intersection are of the
+ same dimension.
+ */
+ int d = dimension();
+
+ if (d != mbr->dimension() || d <= 0 || contains(mbr) || within(mbr))
+ return 0;
+
+ MBR intersection(max(xmin, mbr->xmin), max(ymin, mbr->ymin),
+ min(xmax, mbr->xmax), min(ymax, mbr->ymax));
- int a = lb+rb+rt+lt;
- return (a>0) && (a<4) && (!within(mbr));
+ return (d == intersection.dimension());
}
};
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index d8a5a0b04f0..850586c6098 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -188,12 +188,12 @@ typedef struct st_lex_master_info
uint port, connect_retry;
ulonglong pos;
ulong server_id;
- /*
- Variable for MASTER_SSL option.
- MASTER_SSL=0 in CHANGE MASTER TO corresponds to SSL_DISABLE
- MASTER_SSL=1 corresponds to SSL_ENABLE
- */
- enum {SSL_UNCHANGED=0, SSL_DISABLE, SSL_ENABLE} ssl;
+ /*
+ Enum is used for making it possible to detect if the user
+ changed variable or if it should be left at old value
+ */
+ enum {SSL_UNCHANGED, SSL_DISABLE, SSL_ENABLE}
+ ssl, ssl_verify_server_cert;
char *ssl_key, *ssl_cert, *ssl_ca, *ssl_capath, *ssl_cipher;
char *relay_log_name;
ulong relay_log_pos;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index debc9a7b572..66dc1c97d56 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1130,6 +1130,11 @@ bool change_master(THD* thd, MASTER_INFO* mi)
if (lex_mi->ssl != LEX_MASTER_INFO::SSL_UNCHANGED)
mi->ssl= (lex_mi->ssl == LEX_MASTER_INFO::SSL_ENABLE);
+
+ if (lex_mi->ssl_verify_server_cert != LEX_MASTER_INFO::SSL_UNCHANGED)
+ mi->ssl_verify_server_cert=
+ (lex_mi->ssl_verify_server_cert == LEX_MASTER_INFO::SSL_ENABLE);
+
if (lex_mi->ssl_ca)
strmake(mi->ssl_ca, lex_mi->ssl_ca, sizeof(mi->ssl_ca)-1);
if (lex_mi->ssl_capath)
@@ -1142,7 +1147,8 @@ bool change_master(THD* thd, MASTER_INFO* mi)
strmake(mi->ssl_key, lex_mi->ssl_key, sizeof(mi->ssl_key)-1);
#ifndef HAVE_OPENSSL
if (lex_mi->ssl || lex_mi->ssl_ca || lex_mi->ssl_capath ||
- lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key )
+ lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key ||
+ lex_mi->ssl_verify_server_cert )
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_SLAVE_IGNORED_SSL_PARAMS, ER(ER_SLAVE_IGNORED_SSL_PARAMS));
#endif
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 445890adedb..16867a9c0cf 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -4709,6 +4709,12 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
DBUG_RETURN(0);
}
break;
+ case MYSQL_TYPE_FLOAT:
+ case MYSQL_TYPE_DOUBLE:
+ if ((item= new Item_float(fields_info->field_name, 0.0, NOT_FIXED_DEC,
+ fields_info->field_length)) == NULL)
+ DBUG_RETURN(NULL);
+ break;
case MYSQL_TYPE_DECIMAL:
if (!(item= new Item_decimal((longlong) fields_info->value, false)))
{
@@ -4725,6 +4731,9 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
strlen(fields_info->field_name), cs);
break;
default:
+ /* Don't let unimplemented types pass through. Could be a grave error. */
+ DBUG_ASSERT(fields_info->field_type == MYSQL_TYPE_STRING);
+
/* this should be changed when Item_empty_string is fixed(in 4.1) */
if (!(item= new Item_empty_string("", 0, cs)))
{
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 0c6ce1d7eeb..542c23dfe47 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -780,6 +780,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
%token MASTER_SSL_CIPHER_SYM
%token MASTER_SSL_KEY_SYM
%token MASTER_SSL_SYM
+%token MASTER_SSL_VERIFY_SERVER_CERT_SYM
%token MASTER_SYM
%token MASTER_USER_SYM
%token MATCH /* SQL-2003-R */
@@ -1529,6 +1530,11 @@ master_def:
{
Lex->mi.ssl_key= $3.str;
}
+ | MASTER_SSL_VERIFY_SERVER_CERT_SYM EQ ulong_num
+ {
+ Lex->mi.ssl_verify_server_cert= $3 ?
+ LEX_MASTER_INFO::SSL_ENABLE : LEX_MASTER_INFO::SSL_DISABLE;
+ }
|
master_file_def
;
@@ -1931,7 +1937,7 @@ sp_name:
my_error(ER_SP_WRONG_NAME, MYF(0), $3.str);
MYSQL_YYABORT;
}
- $$= new sp_name($1, $3);
+ $$= new sp_name($1, $3, true);
$$->init_qname(YYTHD);
}
| ident
@@ -1945,7 +1951,7 @@ sp_name:
}
if (thd->copy_db_to(&db.str, &db.length))
MYSQL_YYABORT;
- $$= new sp_name(db, $1);
+ $$= new sp_name(db, $1, false);
if ($$)
$$->init_qname(YYTHD);
}
@@ -6923,7 +6929,7 @@ function_call_generic:
builder= find_qualified_function_builder(thd);
DBUG_ASSERT(builder);
- item= builder->create(thd, $1, $3, $5);
+ item= builder->create(thd, $1, $3, true, $5);
if (! ($$= item))
{
@@ -10840,7 +10846,8 @@ grant_ident:
| table_ident
{
LEX *lex=Lex;
- if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL,0))
+ if (!lex->current_select->add_table_to_list(lex->thd, $1,NULL,
+ TL_OPTION_UPDATING))
MYSQL_YYABORT;
if (lex->grant == GLOBAL_ACLS)
lex->grant = TABLE_ACLS & ~GRANT_ACL;
diff --git a/sql/time.cc b/sql/time.cc
index 4854206b1c8..ef2c87673d5 100644
--- a/sql/time.cc
+++ b/sql/time.cc
@@ -313,6 +313,11 @@ void localtime_to_TIME(TIME *to, struct tm *from)
void calc_time_from_sec(TIME *to, long seconds, long microseconds)
{
long t_seconds;
+ // to->neg is not cleared, it may already be set to a useful value
+ to->time_type= MYSQL_TIMESTAMP_TIME;
+ to->year= 0;
+ to->month= 0;
+ to->day= 0;
to->hour= seconds/3600L;
t_seconds= seconds%3600L;
to->minute= t_seconds/60L;
diff --git a/storage/innobase/Makefile.am b/storage/innobase/Makefile.am
index f433604f9d4..62c0f8e817c 100644
--- a/storage/innobase/Makefile.am
+++ b/storage/innobase/Makefile.am
@@ -89,6 +89,8 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
include/ut0list.h include/ut0list.ic \
include/ut0wqueue.h \
+ pars/make_bison.sh pars/make_flex.sh \
+ pars/pars0grm.y pars/pars0lex.l \
CMakeLists.txt plug.in
noinst_LIBRARIES = libinnobase.a
diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
index ad775fbd6d5..c847b8db9e2 100644
--- a/storage/innobase/buf/buf0buf.c
+++ b/storage/innobase/buf/buf0buf.c
@@ -802,9 +802,7 @@ buf_awe_map_page_to_frame(
{
buf_block_t* bck;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(block);
if (block->frame) {
@@ -900,9 +898,7 @@ buf_block_make_young(
/*=================*/
buf_block_t* block) /* in: block to make younger */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* Note that we read freed_page_clock's without holding any mutex:
this is allowed since the result is used only in heuristics */
@@ -1635,10 +1631,9 @@ buf_page_init(
in units of a page */
buf_block_t* block) /* in: block to init */
{
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&(block->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(block->state != BUF_BLOCK_FILE_PAGE);
/* Set the state of the block */
diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
index 650c9d5d707..423c08c0569 100644
--- a/storage/innobase/buf/buf0flu.c
+++ b/storage/innobase/buf/buf0flu.c
@@ -48,10 +48,7 @@ buf_flush_insert_into_flush_list(
/*=============================*/
buf_block_t* block) /* in: block which is modified */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
-
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_ad((UT_LIST_GET_FIRST(buf_pool->flush_list) == NULL)
@@ -77,9 +74,7 @@ buf_flush_insert_sorted_into_flush_list(
buf_block_t* prev_b;
buf_block_t* b;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
prev_b = NULL;
b = UT_LIST_GET_FIRST(buf_pool->flush_list);
@@ -111,10 +106,8 @@ buf_flush_ready_for_replace(
buf_block_t* block) /* in: buffer control block, must be in state
BUF_BLOCK_FILE_PAGE and in the LRU list */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&block->mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (block->state != BUF_BLOCK_FILE_PAGE) {
ut_print_timestamp(stderr);
fprintf(stderr,
@@ -147,10 +140,8 @@ buf_flush_ready_for_flush(
BUF_BLOCK_FILE_PAGE */
ulint flush_type)/* in: BUF_FLUSH_LRU or BUF_FLUSH_LIST */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&(block->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
if ((ut_dulint_cmp(block->oldest_modification, ut_dulint_zero) > 0)
diff --git a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
index 377552ece6c..1e27144bdbf 100644
--- a/storage/innobase/buf/buf0lru.c
+++ b/storage/innobase/buf/buf0lru.c
@@ -549,9 +549,7 @@ buf_LRU_old_adjust_len(void)
ulint new_len;
ut_a(buf_pool->LRU_old);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(3 * (BUF_LRU_OLD_MIN_LEN / 8) > BUF_LRU_OLD_TOLERANCE + 5);
for (;;) {
@@ -593,6 +591,7 @@ buf_LRU_old_init(void)
{
buf_block_t* block;
+ ut_ad(mutex_own(&(buf_pool->mutex)));
ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == BUF_LRU_OLD_MIN_LEN);
/* We first initialize all blocks in the LRU list as old and then use
@@ -624,9 +623,7 @@ buf_LRU_remove_block(
{
ut_ad(buf_pool);
ut_ad(block);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(block->in_LRU_list);
@@ -690,9 +687,7 @@ buf_LRU_add_block_to_end_low(
ut_ad(buf_pool);
ut_ad(block);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
@@ -755,9 +750,7 @@ buf_LRU_add_block_low(
ut_ad(buf_pool);
ut_ad(block);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
ut_a(!block->in_LRU_list);
@@ -858,10 +851,9 @@ buf_LRU_block_free_non_file_page(
/*=============================*/
buf_block_t* block) /* in: block, must not contain a file page */
{
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&block->mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(block);
ut_a((block->state == BUF_BLOCK_MEMORY)
@@ -898,10 +890,8 @@ buf_LRU_block_remove_hashed_page(
be in a state where it can be freed; there
may or may not be a hash index to the page */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&block->mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(block);
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
@@ -961,10 +951,9 @@ buf_LRU_block_free_hashed_page(
buf_block_t* block) /* in: block, must contain a file page and
be in a state where it can be freed */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(mutex_own(&block->mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
ut_a(block->state == BUF_BLOCK_REMOVE_HASH);
block->state = BUF_BLOCK_MEMORY;
diff --git a/storage/innobase/dict/dict0boot.c b/storage/innobase/dict/dict0boot.c
index 08515d8fb13..f8849008854 100644
--- a/storage/innobase/dict/dict0boot.c
+++ b/storage/innobase/dict/dict0boot.c
@@ -86,9 +86,7 @@ dict_hdr_flush_row_id(void)
dulint id;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
id = dict_sys->row_id;
diff --git a/storage/innobase/dict/dict0crea.c b/storage/innobase/dict/dict0crea.c
index 76474c72c43..e060d45768e 100644
--- a/storage/innobase/dict/dict0crea.c
+++ b/storage/innobase/dict/dict0crea.c
@@ -212,9 +212,7 @@ dict_build_table_def_step(
ulint i;
ulint row_len;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
table = node->table;
@@ -312,9 +310,7 @@ dict_create_sys_indexes_tuple(
dfield_t* dfield;
byte* ptr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(index && heap);
sys_indexes = dict_sys->sys_indexes;
@@ -512,9 +508,7 @@ dict_build_index_def_step(
dtuple_t* row;
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
@@ -585,9 +579,7 @@ dict_create_index_tree_step(
btr_pcur_t pcur;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
index = node->index;
table = node->table;
@@ -642,10 +634,7 @@ dict_drop_index_tree(
byte* ptr;
ulint len;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
-
ut_a(!dict_table_is_comp(dict_sys->sys_indexes));
ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
@@ -718,10 +707,7 @@ dict_truncate_index_tree(
ulint comp;
dict_index_t* index;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
-
ut_a(!dict_table_is_comp(dict_sys->sys_indexes));
rec = btr_pcur_get_rec(pcur);
ptr = rec_get_nth_field_old(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, &len);
@@ -907,9 +893,7 @@ dict_create_table_step(
trx_t* trx;
ut_ad(thr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
@@ -1016,9 +1000,7 @@ dict_create_index_step(
trx_t* trx;
ut_ad(thr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
@@ -1440,9 +1422,7 @@ dict_create_add_foreigns_to_dictionary(
ulint number = start_id + 1;
ulint error;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
fprintf(stderr,
diff --git a/storage/innobase/dict/dict0dict.c b/storage/innobase/dict/dict0dict.c
index 6ae02c0b81a..f450d3553eb 100644
--- a/storage/innobase/dict/dict0dict.c
+++ b/storage/innobase/dict/dict0dict.c
@@ -689,9 +689,8 @@ dict_table_get_on_id(
if we are doing a rollback to handle an error in TABLE
CREATE, for example, we already have the mutex! */
-#ifdef UNIV_SYNC_DEBUG
- ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+ ut_ad(mutex_own(&(dict_sys->mutex))
+ || trx->dict_operation_lock_mode == RW_X_LATCH);
return(dict_table_get_on_id_low(table_id));
}
@@ -854,9 +853,7 @@ dict_table_add_to_cache(
ulint row_len;
ut_ad(table);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->n_def == table->n_cols - DATA_N_SYS_COLS);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(table->cached == FALSE);
@@ -1003,9 +1000,7 @@ dict_table_rename_in_cache(
ibool success;
ut_ad(table);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
old_size = mem_heap_get_size(table->heap);
@@ -1209,9 +1204,7 @@ dict_table_change_id_in_cache(
dulint new_id) /* in: new id to set */
{
ut_ad(table);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* Remove the table from the hash table of id's */
@@ -1238,9 +1231,7 @@ dict_table_remove_from_cache(
ulint size;
ut_ad(table);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
#if 0
@@ -1354,9 +1345,7 @@ dict_index_add_to_cache(
ulint i;
ut_ad(index);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(index->n_def == index->n_fields);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
@@ -1452,9 +1441,7 @@ dict_index_remove_from_cache(
ut_ad(table && index);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
rw_lock_free(&index->lock);
@@ -1484,9 +1471,7 @@ dict_index_find_cols(
ut_ad(table && index);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < index->n_fields; i++) {
ulint j;
@@ -1648,9 +1633,7 @@ dict_index_build_internal_clust(
ut_ad(table && index);
ut_ad(index->type & DICT_CLUSTERED);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* Create a new index object with certainly enough fields */
@@ -1803,9 +1786,7 @@ dict_index_build_internal_non_clust(
ut_ad(table && index);
ut_ad(0 == (index->type & DICT_CLUSTERED));
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
/* The clustered index should be the first in the list of indexes */
@@ -1918,9 +1899,7 @@ dict_foreign_remove_from_cache(
/*===========================*/
dict_foreign_t* foreign) /* in, own: foreign constraint */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(foreign);
if (foreign->referenced_table) {
@@ -1951,9 +1930,7 @@ dict_foreign_find(
{
dict_foreign_t* foreign;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
foreign = UT_LIST_GET_FIRST(table->foreign_list);
@@ -1994,9 +1971,12 @@ dict_foreign_find_index(
ulint n_cols, /* in: number of columns */
dict_index_t* types_idx, /* in: NULL or an index to whose types the
column types must match */
- ibool check_charsets)
+ ibool check_charsets,
/* in: whether to check charsets.
only has an effect if types_idx != NULL */
+ ulint check_null)
+ /* in: nonzero if none of the columns must
+ be declared NOT NULL */
{
dict_index_t* index;
dict_field_t* field;
@@ -2026,6 +2006,12 @@ dict_foreign_find_index(
break;
}
+ if (check_null
+ && (field->col->prtype & DATA_NOT_NULL)) {
+
+ return(NULL);
+ }
+
if (types_idx && !cmp_cols_are_equal(
dict_index_get_nth_col(index, i),
dict_index_get_nth_col(types_idx,
@@ -2113,9 +2099,7 @@ dict_foreign_add_to_cache(
ibool added_to_referenced_list= FALSE;
FILE* ef = dict_foreign_err_file;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
for_table = dict_table_check_if_in_cache_low(
foreign->foreign_table_name);
@@ -2144,7 +2128,7 @@ dict_foreign_add_to_cache(
ref_table,
(const char**) for_in_cache->referenced_col_names,
for_in_cache->n_fields, for_in_cache->foreign_index,
- check_charsets);
+ check_charsets, FALSE);
if (index == NULL) {
dict_foreign_error_report(
@@ -2176,7 +2160,10 @@ dict_foreign_add_to_cache(
for_table,
(const char**) for_in_cache->foreign_col_names,
for_in_cache->n_fields,
- for_in_cache->referenced_index, check_charsets);
+ for_in_cache->referenced_index, check_charsets,
+ for_in_cache->type
+ & (DICT_FOREIGN_ON_DELETE_SET_NULL
+ | DICT_FOREIGN_ON_UPDATE_SET_NULL));
if (index == NULL) {
dict_foreign_error_report(
@@ -2186,7 +2173,9 @@ dict_foreign_add_to_cache(
"the columns as the first columns,"
" or the data types in the\n"
"table do not match"
- " the ones in the referenced table.");
+ " the ones in the referenced table\n"
+ "or one of the ON ... SET NULL columns"
+ " is declared NOT NULL.");
if (for_in_cache == foreign) {
if (added_to_referenced_list) {
@@ -2794,9 +2783,7 @@ dict_create_foreign_constraints_low(
const char* column_names[500];
const char* referenced_table_name;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
table = dict_table_get_low(name);
@@ -2994,7 +2981,8 @@ col_loop1:
/* Try to find an index which contains the columns
as the first fields and in the right order */
- index = dict_foreign_find_index(table, column_names, i, NULL, TRUE);
+ index = dict_foreign_find_index(table, column_names, i,
+ NULL, TRUE, FALSE);
if (!index) {
mutex_enter(&dict_foreign_err_mutex);
@@ -3265,7 +3253,8 @@ try_find_index:
if (referenced_table) {
index = dict_foreign_find_index(referenced_table,
column_names, i,
- foreign->foreign_index, TRUE);
+ foreign->foreign_index,
+ TRUE, FALSE);
if (!index) {
dict_foreign_free(foreign);
mutex_enter(&dict_foreign_err_mutex);
@@ -3425,9 +3414,7 @@ dict_foreign_parse_drop_constraints(
str = dict_strip_comments(*(trx->mysql_query_str));
ptr = str;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
loop:
ptr = dict_scan_to(ptr, "DROP");
@@ -3864,9 +3851,7 @@ dict_foreign_print_low(
{
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
fprintf(stderr, " FOREIGN KEY CONSTRAINT %s: %s (",
foreign->id, foreign->foreign_table_name);
@@ -3931,9 +3916,7 @@ dict_table_print_low(
dict_foreign_t* foreign;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
dict_update_statistics_low(table, TRUE);
@@ -3989,9 +3972,7 @@ dict_col_print_low(
{
dtype_t type;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
dict_col_copy_type(col, &type);
fprintf(stderr, "%s: ", dict_table_get_col_name(table,
@@ -4011,9 +3992,7 @@ dict_index_print_low(
ib_longlong n_vals;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (index->n_user_defined_cols > 0) {
n_vals = index->stat_n_diff_key_vals[
@@ -4061,9 +4040,8 @@ dict_field_print_low(
/*=================*/
dict_field_t* field) /* in: field */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+
fprintf(stderr, " %s", field->name);
if (field->prefix_len != 0) {
diff --git a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
index e23795f9898..ba2e25cf031 100644
--- a/storage/innobase/dict/dict0load.c
+++ b/storage/innobase/dict/dict0load.c
@@ -67,9 +67,7 @@ dict_get_first_table_name_in_db(
ulint len;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(1000);
@@ -353,9 +351,7 @@ dict_load_columns(
ulint i;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
@@ -478,11 +474,7 @@ dict_load_fields(
ulint i;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
-
- UT_NOT_USED(table);
mtr_start(&mtr);
@@ -586,9 +578,7 @@ dict_load_indexes(
dulint id;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if ((ut_dulint_get_high(table->id) == 0)
&& (ut_dulint_get_low(table->id) < DICT_HDR_FIRST_ID)) {
@@ -754,9 +744,7 @@ dict_load_table(
ulint err;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(1000);
@@ -920,9 +908,7 @@ dict_load_table_on_id(
dict_table_t* table;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* NOTE that the operation of this function is protected by
the dictionary mutex, and therefore no deadlocks can occur
@@ -1003,9 +989,7 @@ dict_load_sys_table(
{
mem_heap_t* heap;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(1000);
@@ -1035,9 +1019,7 @@ dict_load_foreign_cols(
ulint i;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
foreign->foreign_col_names = mem_heap_alloc(
foreign->heap, foreign->n_fields * sizeof(void*));
@@ -1113,9 +1095,7 @@ dict_load_foreign(
ulint n_fields_and_type;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
heap2 = mem_heap_create(1000);
@@ -1243,9 +1223,7 @@ dict_load_foreigns(
ulint err;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
sys_foreign = dict_table_get_low("SYS_FOREIGN");
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 883fbd09ee4..c63d67cae60 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -409,9 +409,7 @@ fil_space_is_flushed(
{
fil_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(fil_system->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
node = UT_LIST_GET_FIRST(space->chain);
@@ -514,9 +512,7 @@ fil_node_open_file(
ulint space_id;
#endif /* !UNIV_HOTBACKUP */
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(node->n_pending == 0);
ut_a(node->open == FALSE);
@@ -660,9 +656,7 @@ fil_node_close_file(
ibool ret;
ut_ad(node && system);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(node->open);
ut_a(node->n_pending == 0);
ut_a(node->n_pending_flushes == 0);
@@ -705,9 +699,8 @@ fil_try_to_close_file_in_LRU(
fil_system_t* system = fil_system;
fil_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+
node = UT_LIST_GET_LAST(system->LRU);
if (print_info) {
@@ -765,9 +758,7 @@ fil_mutex_enter_and_prepare_for_io(
ulint count = 0;
ulint count2 = 0;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&(system->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
retry:
mutex_enter(&(system->mutex));
@@ -881,9 +872,7 @@ fil_node_free(
fil_space_t* space) /* in: space where the file node is chained */
{
ut_ad(node && system && space);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(node->magic_n == FIL_NODE_MAGIC_N);
ut_a(node->n_pending == 0);
@@ -3870,9 +3859,7 @@ fil_node_prepare_for_io(
fil_space_t* space) /* in: space */
{
ut_ad(node && system && space);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (system->n_open > system->max_n_open + 5) {
ut_print_timestamp(stderr);
@@ -3917,9 +3904,7 @@ fil_node_complete_io(
{
ut_ad(node);
ut_ad(system);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(system->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(node->n_pending > 0);
diff --git a/storage/innobase/fsp/fsp0fsp.c b/storage/innobase/fsp/fsp0fsp.c
index 00c5e582b3e..b5662fd24a4 100644
--- a/storage/innobase/fsp/fsp0fsp.c
+++ b/storage/innobase/fsp/fsp0fsp.c
@@ -2045,11 +2045,9 @@ fseg_create_general(
mtr);
}
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
-#endif /* UNIV_SYNC_DEBUG */
latch = fil_space_get_latch(space);
mtr_x_lock(latch, mtr);
@@ -2205,11 +2203,10 @@ fseg_n_reserved_pages(
space = buf_frame_get_space_id(header);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
-#endif /* UNIV_SYNC_DEBUG */
+
mtr_x_lock(fil_space_get_latch(space), mtr);
inode = fseg_inode_get(header, mtr);
@@ -2601,11 +2598,9 @@ fseg_alloc_free_page_general(
space = buf_frame_get_space_id(seg_header);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
-#endif /* UNIV_SYNC_DEBUG */
latch = fil_space_get_latch(space);
mtr_x_lock(latch, mtr);
@@ -2751,11 +2746,9 @@ fsp_reserve_free_extents(
ulint n_pages_added;
ut_ad(mtr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
-#endif /* UNIV_SYNC_DEBUG */
*n_reserved = n_ext;
latch = fil_space_get_latch(space);
@@ -2853,9 +2846,8 @@ fsp_get_available_space_in_free_extents(
rw_lock_t* latch;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
mtr_start(&mtr);
latch = fil_space_get_latch(space);
@@ -3113,11 +3105,10 @@ fseg_free_page(
{
fseg_inode_t* seg_inode;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
-#endif /* UNIV_SYNC_DEBUG */
+
mtr_x_lock(fil_space_get_latch(space), mtr);
seg_inode = fseg_inode_get(seg_header, mtr);
@@ -3222,11 +3213,10 @@ fseg_free_step(
space = buf_frame_get_space_id(header);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
-#endif /* UNIV_SYNC_DEBUG */
+
mtr_x_lock(fil_space_get_latch(space), mtr);
descr = xdes_get_descriptor(space, buf_frame_get_page_no(header), mtr);
@@ -3297,11 +3287,10 @@ fseg_free_step_not_header(
space = buf_frame_get_space_id(header);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex)
|| mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
-#endif /* UNIV_SYNC_DEBUG */
+
mtr_x_lock(fil_space_get_latch(space), mtr);
inode = fseg_inode_get(header, mtr);
diff --git a/storage/innobase/ha/ha0ha.c b/storage/innobase/ha/ha0ha.c
index 07dfb66afa8..7f241140050 100644
--- a/storage/innobase/ha/ha0ha.c
+++ b/storage/innobase/ha/ha0ha.c
@@ -96,9 +96,8 @@ ha_insert_for_fold(
ulint hash;
ut_ad(table && data);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
-#endif /* UNIV_SYNC_DEBUG */
+
hash = hash_calc_hash(fold, table);
cell = hash_get_nth_cell(table, hash);
@@ -194,9 +193,8 @@ ha_delete(
{
ha_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
-#endif /* UNIV_SYNC_DEBUG */
+
node = ha_search_with_data(table, fold, data);
ut_a(node);
@@ -218,9 +216,7 @@ ha_search_and_update_if_found(
{
ha_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
-#endif /* UNIV_SYNC_DEBUG */
node = ha_search_with_data(table, fold, data);
@@ -248,9 +244,8 @@ ha_remove_all_nodes_to_page(
{
ha_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
-#endif /* UNIV_SYNC_DEBUG */
+
node = ha_chain_get_first(table, fold);
while (node) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index e9309f4f8b8..5faefe83a85 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -56,53 +56,6 @@ bool innodb_inited= 0;
*/
static handlerton *legacy_innodb_hton;
-/*-----------------------------------------------------------------*/
-/* These variables are used to implement (semi-)synchronous MySQL binlog
-replication for InnoDB tables. */
-
-pthread_cond_t innobase_repl_cond; /* Posix cond variable;
- this variable is signaled
- when enough binlog has been
- sent to slave, so that a
- waiting trx can return the
- 'ok' message to the client
- for a commit */
-pthread_mutex_t innobase_repl_cond_mutex; /* Posix cond variable mutex
- that also protects the next
- innobase_repl_... variables */
-uint innobase_repl_state; /* 1 if synchronous replication
- is switched on and is working
- ok; else 0 */
-uint innobase_repl_file_name_inited = 0; /* This is set to 1 when
- innobase_repl_file_name
- contains meaningful data */
-char* innobase_repl_file_name; /* The binlog name up to which
- we have sent some binlog to
- the slave */
-my_off_t innobase_repl_pos; /* The position in that file
- up to which we have sent the
- binlog to the slave */
-uint innobase_repl_n_wait_threads = 0; /* This tells how many
- transactions currently are
- waiting for the binlog to be
- sent to the client */
-uint innobase_repl_wait_file_name_inited = 0; /* This is set to 1
- when we know the 'smallest'
- wait position */
-char* innobase_repl_wait_file_name; /* NULL, or the 'smallest'
- innobase_repl_file_name that
- a transaction is waiting for */
-my_off_t innobase_repl_wait_pos; /* The smallest position in
- that file that a trx is
- waiting for: the trx can
- proceed and send an 'ok' to
- the client when MySQL has sent
- the binlog up to this position
- to the slave */
-/*-----------------------------------------------------------------*/
-
-
-
/* Store MySQL definition of 'byte': in Linux it is char while InnoDB
uses unsigned char; the header univ.i which we include next defines
'byte' as a macro which expands to 'unsigned char' */
@@ -139,9 +92,6 @@ extern "C" {
#include "../storage/innobase/include/ha_prototypes.h"
}
-#define HA_INNOBASE_ROWS_IN_TABLE 10000 /* to get optimization right */
-#define HA_INNOBASE_RANGE_COUNT 100
-
ulong innobase_large_page_size = 0;
/* The default values for the following, type long or longlong, start-up
@@ -189,7 +139,7 @@ srv_active_wake_master_thread after each fetch or search, we only do
it every INNOBASE_WAKE_INTERVAL'th step. */
#define INNOBASE_WAKE_INTERVAL 32
-ulong innobase_active_counter = 0;
+static ulong innobase_active_counter = 0;
static HASH innobase_open_tables;
@@ -222,16 +172,149 @@ static handler *innobase_create_handler(handlerton *hton,
return new (mem_root) ha_innobase(hton, table);
}
+/***********************************************************************
+This function is used to prepare X/Open XA distributed transaction */
+static
+int
+innobase_xa_prepare(
+/*================*/
+ /* out: 0 or error number */
+ handlerton* hton,
+ THD* thd, /* in: handle to the MySQL thread of the user
+ whose XA transaction should be prepared */
+ bool all); /* in: TRUE - commit transaction
+ FALSE - the current SQL statement ended */
+/***********************************************************************
+This function is used to recover X/Open XA distributed transactions */
+static
+int
+innobase_xa_recover(
+/*================*/
+ /* out: number of prepared transactions
+ stored in xid_list */
+ handlerton* hton,
+ XID* xid_list, /* in/out: prepared transactions */
+ uint len); /* in: number of slots in xid_list */
+/***********************************************************************
+This function is used to commit one X/Open XA distributed transaction
+which is in the prepared state */
+static
+int
+innobase_commit_by_xid(
+/*===================*/
+ /* out: 0 or error number */
+ handlerton* hton,
+ XID* xid); /* in: X/Open XA transaction identification */
+/***********************************************************************
+This function is used to rollback one X/Open XA distributed transaction
+which is in the prepared state */
+static
+int
+innobase_rollback_by_xid(
+/*=====================*/
+ /* out: 0 or error number */
+ handlerton* hton,
+ XID *xid); /* in: X/Open XA transaction identification */
+/***********************************************************************
+Create a consistent view for a cursor based on current transaction
+which is created if the corresponding MySQL thread still lacks one.
+This consistent view is then used inside of MySQL when accessing records
+using a cursor. */
+static
+void*
+innobase_create_cursor_view(
+/*========================*/
+ /* out: pointer to cursor view or NULL */
+ handlerton* hton, /* in: innobase hton */
+ THD* thd); /* in: user thread handle */
+/***********************************************************************
+Set the given consistent cursor view to a transaction which is created
+if the corresponding MySQL thread still lacks one. If the given
+consistent cursor view is NULL global read view of a transaction is
+restored to a transaction read view. */
+static
+void
+innobase_set_cursor_view(
+/*=====================*/
+ handlerton* hton,
+ THD* thd, /* in: user thread handle */
+ void* curview);/* in: Consistent cursor view to be set */
+/***********************************************************************
+Close the given consistent cursor view of a transaction and restore
+global read view to a transaction read view. Transaction is created if the
+corresponding MySQL thread still lacks one. */
+static
+void
+innobase_close_cursor_view(
+/*=======================*/
+ handlerton* hton,
+ THD* thd, /* in: user thread handle */
+ void* curview);/* in: Consistent read view to be closed */
+/*********************************************************************
+Removes all tables in the named database inside InnoDB. */
+static
+void
+innobase_drop_database(
+/*===================*/
+ /* out: error number */
+ handlerton* hton, /* in: handlerton of Innodb */
+ char* path); /* in: database path; inside InnoDB the name
+ of the last directory in the path is used as
+ the database name: for example, in 'mysql/data/test'
+ the database name is 'test' */
+/***********************************************************************
+Closes an InnoDB database. */
+static
+int
+innobase_end(handlerton *hton, ha_panic_function type);
/*********************************************************************
-Commits a transaction in an InnoDB database. */
+Creates an InnoDB transaction struct for the thd if it does not yet have one.
+Starts a new InnoDB transaction if a transaction is not yet started. And
+assigns a new snapshot for a consistent read if the transaction does not yet
+have one. */
+static
+int
+innobase_start_trx_and_assign_read_view(
+/*====================================*/
+ /* out: 0 */
+ handlerton* hton, /* in: Innodb handlerton */
+ THD* thd); /* in: MySQL thread handle of the user for whom
+ the transaction should be committed */
+/********************************************************************
+Flushes InnoDB logs to disk and makes a checkpoint. Really, a commit flushes
+the logs, and the name of this function should be innobase_checkpoint. */
+static
+bool
+innobase_flush_logs(
+/*================*/
+ /* out: TRUE if error */
+ handlerton* hton); /* in: InnoDB handlerton */
+/****************************************************************************
+Implements the SHOW INNODB STATUS command. Sends the output of the InnoDB
+Monitor to the client. */
+static
+bool
+innodb_show_status(
+/*===============*/
+ handlerton* hton, /* in: the innodb handlerton */
+ THD* thd, /* in: the MySQL query thread of the caller */
+ stat_print_fn *stat_print);
+static
+bool innobase_show_status(handlerton *hton, THD* thd,
+ stat_print_fn* stat_print,
+ enum ha_stat_type stat_type);
+
+/*********************************************************************
+Commits a transaction in an InnoDB database. */
+static
void
innobase_commit_low(
/*================*/
trx_t* trx); /* in: transaction handle */
-SHOW_VAR innodb_status_variables[]= {
+static SHOW_VAR innodb_status_variables[]= {
{"buffer_pool_pages_data",
(char*) &export_vars.innodb_buffer_pool_pages_data, SHOW_LONG},
{"buffer_pool_pages_dirty",
@@ -380,10 +463,23 @@ innobase_release_stat_resources(
}
/************************************************************************
+Obtain the InnoDB transaction of a MySQL thread. */
+inline
+trx_t*&
+thd_to_trx(
+/*=======*/
+ /* out: reference to transaction pointer */
+ THD* thd, /* in: MySQL thread */
+ handlerton* hton) /* in: InnoDB handlerton */
+{
+ return(*(trx_t**) thd_ha_data(thd, hton));
+}
+
+/************************************************************************
Call this function when mysqld passes control to the client. That is to
avoid deadlocks on the adaptive hash S-latch possibly held by thd. For more
documentation, see handler.cc. */
-
+static
int
innobase_release_temporary_latches(
/*===============================*/
@@ -397,7 +493,7 @@ innobase_release_temporary_latches(
return 0;
}
- trx = (trx_t*) thd->ha_data[hton->slot];
+ trx = thd_to_trx(thd, hton);
if (trx) {
innobase_release_stat_resources(trx);
@@ -857,12 +953,10 @@ check_trx_exists(
handlerton* hton, /* in: handlerton for innodb */
THD* thd) /* in: user thread handle */
{
- trx_t* trx;
+ trx_t*& trx = thd_to_trx(thd, hton);
ut_ad(thd == current_thd);
- trx = (trx_t*) thd->ha_data[hton->slot];
-
if (trx == NULL) {
DBUG_ASSERT(thd != NULL);
trx = trx_allocate_for_mysql();
@@ -874,8 +968,6 @@ check_trx_exists(
/* Update the info whether we should skip XA steps that eat
CPU time */
trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
-
- thd->ha_data[hton->slot] = trx;
} else {
if (trx->magic_n != TRX_MAGIC_N) {
mem_analyze_corruption(trx);
@@ -928,7 +1020,6 @@ ha_innobase::update_thd(
/* out: 0 or error code */
THD* thd) /* in: thd to use the handle */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
trx = check_trx_exists(ht, thd);
@@ -1046,7 +1137,7 @@ holding any InnoDB semaphores. The calling thread is holding the
query cache mutex, and this function will reserver the InnoDB kernel mutex.
Thus, the 'rank' in sync0sync.h of the MySQL query cache mutex is above
the InnoDB kernel mutex. */
-
+static
my_bool
innobase_query_caching_of_table_permitted(
/*======================================*/
@@ -1271,8 +1362,6 @@ void
ha_innobase::init_table_handle_for_HANDLER(void)
/*============================================*/
{
- row_prebuilt_t* prebuilt;
-
/* If current thd does not yet have a trx struct, create one.
If the current handle does not yet have a prebuilt struct, create
one. Update the trx pointers in the prebuilt struct. Normally
@@ -1283,8 +1372,6 @@ ha_innobase::init_table_handle_for_HANDLER(void)
/* Initialize the prebuilt struct much like it would be inited in
external_lock */
- prebuilt = (row_prebuilt_t*)innobase_prebuilt;
-
innobase_release_stat_resources(prebuilt->trx);
/* If the transaction is not started yet, start it */
@@ -1331,7 +1418,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
/*************************************************************************
Opens an InnoDB database. */
-
+static
int
innobase_init(void *p)
/*===============*/
@@ -1620,7 +1707,7 @@ error:
/***********************************************************************
Closes an InnoDB database. */
-
+static
int
innobase_end(handlerton *hton, ha_panic_function type)
/*==============*/
@@ -1658,7 +1745,7 @@ innobase_end(handlerton *hton, ha_panic_function type)
/********************************************************************
Flushes InnoDB logs to disk and makes a checkpoint. Really, a commit flushes
the logs, and the name of this function should be innobase_checkpoint. */
-
+static
bool
innobase_flush_logs(handlerton *hton)
/*=====================*/
@@ -1675,7 +1762,7 @@ innobase_flush_logs(handlerton *hton)
/*********************************************************************
Commits a transaction in an InnoDB database. */
-
+static
void
innobase_commit_low(
/*================*/
@@ -1694,7 +1781,7 @@ Creates an InnoDB transaction struct for the thd if it does not yet have one.
Starts a new InnoDB transaction if a transaction is not yet started. And
assigns a new snapshot for a consistent read if the transaction does not yet
have one. */
-
+static
int
innobase_start_trx_and_assign_read_view(
/*====================================*/
@@ -1759,12 +1846,11 @@ innobase_commit(
/* Update the info whether we should skip XA steps that eat CPU time */
trx->support_xa = (ibool)(thd->variables.innodb_support_xa);
- /* Release a possible FIFO ticket and search latch. Since we will
- reserve the kernel mutex, we have to release the search system latch
- first to obey the latching order. */
+ /* Since we will reserve the kernel mutex, we have to release
+ the search system latch first to obey the latching order. */
if (trx->has_search_latch) {
- trx_search_latch_release_if_reserved(trx);
+ trx_search_latch_release_if_reserved(trx);
}
/* The flag trx->active_trans is set to 1 in
@@ -1851,18 +1937,20 @@ retry:
trx_mark_sql_stat_end(trx);
}
- /* Tell the InnoDB server that there might be work for utility
- threads: */
if (trx->declared_to_be_inside_innodb) {
- /* Release our possible ticket in the FIFO */
+ /* Release our possible ticket in the FIFO */
- srv_conc_force_exit_innodb(trx);
+ srv_conc_force_exit_innodb(trx);
}
+
+ /* Tell the InnoDB server that there might be work for utility
+ threads: */
srv_active_wake_master_thread();
DBUG_RETURN(0);
}
+#if 0
/* TODO: put the
MySQL-4.1 functionality back to 5.0. This is needed to get InnoDB Hot Backup
to work. */
@@ -1875,7 +1963,7 @@ transaction inside InnoDB but does NOT flush InnoDB log files to disk.
To flush you have to call innobase_commit_complete(). We have separated
flushing to eliminate the bottleneck of LOCK_log in log.cc which disabled
InnoDB's group commit capability. */
-
+static
int
innobase_report_binlog_offset_and_commit(
/*=====================================*/
@@ -1905,10 +1993,9 @@ innobase_report_binlog_offset_and_commit(
return(0);
}
-#if 0
/***********************************************************************
This function stores the binlog offset and flushes logs. */
-
+static
void
innobase_store_binlog_offset_and_flush_log(
/*=======================================*/
@@ -1936,12 +2023,11 @@ innobase_store_binlog_offset_and_flush_log(
/* Synchronous flush of the log buffer to disk */
log_buffer_flush_to_disk();
}
-#endif
/*********************************************************************
This is called after MySQL has written the binlog entry for the current
transaction. Flushes the InnoDB log files to disk if required. */
-
+static
int
innobase_commit_complete(
/*=====================*/
@@ -1951,7 +2037,7 @@ innobase_commit_complete(
{
trx_t* trx;
- trx = (trx_t*) thd->ha_data[hton->slot];
+ trx = thd_to_trx(thd, hton);
if (trx && trx->active_trans) {
@@ -1967,6 +2053,7 @@ innobase_commit_complete(
return(0);
}
+#endif
/*********************************************************************
Rolls back a transaction or the latest SQL statement. */
@@ -2020,7 +2107,7 @@ innobase_rollback(
/*********************************************************************
Rolls back a transaction */
-
+static
int
innobase_rollback_trx(
/*==================*/
@@ -2175,7 +2262,7 @@ innobase_close_connection(
{
trx_t* trx;
- trx = (trx_t*)thd->ha_data[hton->slot];
+ trx = thd_to_trx(thd, hton);
ut_a(trx);
@@ -2216,8 +2303,6 @@ ha_innobase::get_row_type() const
/*=============================*/
/* out: ROW_TYPE_REDUNDANT or ROW_TYPE_COMPACT */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
-
if (prebuilt && prebuilt->table) {
if (dict_table_is_comp_noninline(prebuilt->table)) {
return(ROW_TYPE_COMPACT);
@@ -2317,8 +2402,6 @@ ha_innobase::open(
user_thd = NULL;
- last_query_id = (ulong)-1;
-
if (!(share=get_share(name))) {
DBUG_RETURN(1);
@@ -2364,7 +2447,7 @@ ha_innobase::open(
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
- if (ib_table->ibd_file_missing && !thd->tablespace_op) {
+ if (ib_table->ibd_file_missing && !thd_tablespace_op(thd)) {
ut_print_timestamp(stderr);
sql_print_error("MySQL is trying to open a table handle but "
"the .ibd file for\ntable %s does not exist.\n"
@@ -2382,10 +2465,9 @@ ha_innobase::open(
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
}
- innobase_prebuilt = row_create_prebuilt(ib_table);
+ prebuilt = row_create_prebuilt(ib_table);
- ((row_prebuilt_t*)innobase_prebuilt)->mysql_row_len =
- table->s->reclength;
+ prebuilt->mysql_row_len = table->s->reclength;
/* Looks like MySQL-3.23 sometimes has primary key number != 0 */
@@ -2404,8 +2486,8 @@ ha_innobase::open(
"dictionary, but not in MySQL!", name);
}
- ((row_prebuilt_t*)innobase_prebuilt)
- ->clust_index_was_generated = FALSE;
+ prebuilt->clust_index_was_generated = FALSE;
+
/* MySQL allocates the buffer for ref. key_info->key_length
includes space for all key columns + one byte for each column
that may be NULL. ref_length must be as exact as possible to
@@ -2426,8 +2508,7 @@ ha_innobase::open(
"of the table.", name);
}
- ((row_prebuilt_t*)innobase_prebuilt)
- ->clust_index_was_generated = TRUE;
+ prebuilt->clust_index_was_generated = TRUE;
ref_length = DATA_ROW_ID_LEN;
@@ -2474,7 +2555,7 @@ ha_innobase::close(void)
{
DBUG_ENTER("ha_innobase::close");
- row_prebuilt_free((row_prebuilt_t*) innobase_prebuilt);
+ row_prebuilt_free(prebuilt);
my_free((gptr) upd_buff, MYF(0));
free_share(share);
@@ -3264,35 +3345,31 @@ ha_innobase::write_row(
/* out: error code */
mysql_byte* record) /* in: a row in MySQL format */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
int error;
longlong auto_inc;
longlong dummy;
ibool auto_inc_used= FALSE;
+ THD* thd = current_thd;
+ trx_t* trx = thd_to_trx(thd, ht);
DBUG_ENTER("ha_innobase::write_row");
- if (prebuilt->trx !=
- (trx_t*) current_thd->ha_data[ht->slot]) {
+ if (prebuilt->trx != trx) {
sql_print_error("The transaction object for the table handle is at "
"%p, but for the current thread it is at %p",
- prebuilt->trx,
- (trx_t*) current_thd->ha_data[ht->slot]);
+ prebuilt->trx, trx);
fputs("InnoDB: Dump of 200 bytes around prebuilt: ", stderr);
ut_print_buf(stderr, ((const byte*)prebuilt) - 100, 200);
fputs("\n"
- "InnoDB: Dump of 200 bytes around transaction.all: ",
+ "InnoDB: Dump of 200 bytes around ha_data: ",
stderr);
- ut_print_buf(stderr,
- ((byte*)(&(current_thd->ha_data[ht->slot]))) - 100,
- 200);
+ ut_print_buf(stderr, ((const byte*) trx) - 100, 200);
putc('\n', stderr);
ut_error;
}
- statistic_increment(current_thd->status_var.ha_write_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_write_count);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
@@ -3367,13 +3444,6 @@ no_commit:
num_write_row++;
- if (last_query_id != user_thd->query_id) {
- prebuilt->sql_stat_start = TRUE;
- last_query_id = user_thd->query_id;
-
- innobase_release_stat_resources(prebuilt->trx);
- }
-
if (table->next_number_field && record == table->record[0]) {
/* This is the case where the table has an
auto-increment column */
@@ -3528,13 +3598,6 @@ calc_row_difference(
for (i = 0; i < n_fields; i++) {
field = table->field[i];
- /* if (thd->query_id != field->query_id) { */
- /* TODO: check that these fields cannot have
- changed! */
-
- /* goto skip_field;
- }*/
-
o_ptr = (byte*) old_row + get_field_offset(table, field);
n_ptr = (byte*) new_row + get_field_offset(table, field);
@@ -3655,25 +3718,17 @@ ha_innobase::update_row(
const mysql_byte* old_row,/* in: old row in MySQL format */
mysql_byte* new_row)/* in: new row in MySQL format */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
upd_t* uvect;
int error = 0;
+ trx_t* trx = thd_to_trx(current_thd, ht);
DBUG_ENTER("ha_innobase::update_row");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == trx);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
- if (last_query_id != user_thd->query_id) {
- prebuilt->sql_stat_start = TRUE;
- last_query_id = user_thd->query_id;
-
- innobase_release_stat_resources(prebuilt->trx);
- }
-
if (prebuilt->upd_node) {
uvect = prebuilt->upd_node->update;
} else {
@@ -3692,11 +3747,11 @@ ha_innobase::update_row(
assert(prebuilt->template_type == ROW_MYSQL_WHOLE_ROW);
- innodb_srv_conc_enter_innodb(prebuilt->trx);
+ innodb_srv_conc_enter_innodb(trx);
error = row_update_for_mysql((byte*) old_row, prebuilt);
- innodb_srv_conc_exit_innodb(prebuilt->trx);
+ innodb_srv_conc_exit_innodb(trx);
error = convert_error_code_to_mysql(error, user_thd);
@@ -3717,20 +3772,12 @@ ha_innobase::delete_row(
/* out: error number or 0 */
const mysql_byte* record) /* in: a row in MySQL format */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
int error = 0;
+ trx_t* trx = thd_to_trx(current_thd, ht);
DBUG_ENTER("ha_innobase::delete_row");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
-
- if (last_query_id != user_thd->query_id) {
- prebuilt->sql_stat_start = TRUE;
- last_query_id = user_thd->query_id;
-
- innobase_release_stat_resources(prebuilt->trx);
- }
+ ut_a(prebuilt->trx == trx);
if (!prebuilt->upd_node) {
row_get_prebuilt_update_vector(prebuilt);
@@ -3740,11 +3787,11 @@ ha_innobase::delete_row(
prebuilt->upd_node->is_delete = TRUE;
- innodb_srv_conc_enter_innodb(prebuilt->trx);
+ innodb_srv_conc_enter_innodb(trx);
error = row_update_for_mysql((byte*) record, prebuilt);
- innodb_srv_conc_exit_innodb(prebuilt->trx);
+ innodb_srv_conc_exit_innodb(trx);
error = convert_error_code_to_mysql(error, user_thd);
@@ -3765,19 +3812,8 @@ void
ha_innobase::unlock_row(void)
/*=========================*/
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
-
DBUG_ENTER("ha_innobase::unlock_row");
- if (UNIV_UNLIKELY(last_query_id != user_thd->query_id)) {
- ut_print_timestamp(stderr);
- sql_print_error("last_query_id is %lu != user_thd_query_id is "
- "%lu", (ulong) last_query_id,
- (ulong) user_thd->query_id);
- mem_analyze_corruption((byte *) prebuilt->trx);
- ut_error;
- }
-
/* Consistent read does not take any locks, thus there is
nothing to unlock. */
@@ -3808,8 +3844,6 @@ bool
ha_innobase::was_semi_consistent_read(void)
/*=======================================*/
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
-
return(prebuilt->row_read_type == ROW_READ_DID_SEMI_CONSISTENT);
}
@@ -3818,10 +3852,7 @@ void
ha_innobase::try_semi_consistent_read(bool yes)
/*===========================================*/
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
-
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
/* Row read type is set to semi consistent read if this was
requested by the MySQL and either innodb_locks_unsafe_for_binlog
@@ -3978,7 +4009,6 @@ ha_innobase::index_read(
uint key_len,/* in: key value length */
enum ha_rkey_function find_flag)/* in: search flags from my_base.h */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
ulint mode;
dict_index_t* index;
ulint match_mode = 0;
@@ -3987,18 +4017,9 @@ ha_innobase::index_read(
DBUG_ENTER("index_read");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
- statistic_increment(current_thd->status_var.ha_read_key_count,
- &LOCK_status);
-
- if (last_query_id != user_thd->query_id) {
- prebuilt->sql_stat_start = TRUE;
- last_query_id = user_thd->query_id;
-
- innobase_release_stat_resources(prebuilt->trx);
- }
+ ha_statistic_increment(&SSV::ha_read_key_count);
index = prebuilt->index;
@@ -4095,15 +4116,12 @@ ha_innobase::change_active_index(
index, even if it was internally generated by
InnoDB */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
KEY* key=0;
- statistic_increment(current_thd->status_var.ha_read_key_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_key_count);
DBUG_ENTER("change_active_index");
ut_ad(user_thd == current_thd);
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(user_thd, ht));
active_index = keynr;
@@ -4186,14 +4204,12 @@ ha_innobase::general_fetch(
uint match_mode) /* in: 0, ROW_SEL_EXACT, or
ROW_SEL_EXACT_PREFIX */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
ulint ret;
int error = 0;
DBUG_ENTER("general_fetch");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
innodb_srv_conc_enter_innodb(prebuilt->trx);
@@ -4232,8 +4248,7 @@ ha_innobase::index_next(
mysql_byte* buf) /* in/out: buffer for next row in MySQL
format */
{
- statistic_increment(current_thd->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
return(general_fetch(buf, ROW_SEL_NEXT, 0));
}
@@ -4250,8 +4265,7 @@ ha_innobase::index_next_same(
const mysql_byte* key, /* in: key value */
uint keylen) /* in: key value length */
{
- statistic_increment(current_thd->status_var.ha_read_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_next_count);
return(general_fetch(buf, ROW_SEL_NEXT, last_match_mode));
}
@@ -4268,8 +4282,7 @@ ha_innobase::index_prev(
mysql_byte* buf) /* in/out: buffer for previous row in MySQL
format */
{
- statistic_increment(current_thd->status_var.ha_read_prev_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_prev_count);
return(general_fetch(buf, ROW_SEL_PREV, 0));
}
@@ -4288,8 +4301,7 @@ ha_innobase::index_first(
int error;
DBUG_ENTER("index_first");
- statistic_increment(current_thd->status_var.ha_read_first_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_first_count);
error = index_read(buf, NULL, 0, HA_READ_AFTER_KEY);
@@ -4315,8 +4327,7 @@ ha_innobase::index_last(
int error;
DBUG_ENTER("index_last");
- statistic_increment(current_thd->status_var.ha_read_last_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_last_count);
error = index_read(buf, NULL, 0, HA_READ_BEFORE_KEY);
@@ -4340,8 +4351,6 @@ ha_innobase::rnd_init(
{
int err;
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
-
/* Store the active index value so that we can restore the original
value after a scan */
@@ -4388,8 +4397,7 @@ ha_innobase::rnd_next(
int error;
DBUG_ENTER("rnd_next");
- statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_next_count);
if (start_of_scan) {
error = index_first(buf);
@@ -4419,17 +4427,14 @@ ha_innobase::rnd_pos(
the length of data in pos has to be
ref_length */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
int error;
uint keynr = active_index;
DBUG_ENTER("rnd_pos");
DBUG_DUMP("key", (char*) pos, ref_length);
- statistic_increment(current_thd->status_var.ha_read_rnd_count,
- &LOCK_status);
+ ha_statistic_increment(&SSV::ha_read_rnd_count);
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
@@ -4475,11 +4480,9 @@ ha_innobase::position(
/*==================*/
const mysql_byte* record) /* in: row in MySQL format */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
uint len;
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
if (prebuilt->clust_index_was_generated) {
/* No primary key was defined for the table and we
@@ -4970,16 +4973,15 @@ ha_innobase::discard_or_import_tablespace(
/* out: 0 == success, -1 == error */
my_bool discard) /* in: TRUE if discard, else import */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
dict_table_t* dict_table;
trx_t* trx;
int err;
DBUG_ENTER("ha_innobase::discard_or_import_tablespace");
- ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx);
+ ut_a(prebuilt->trx->magic_n == TRX_MAGIC_N);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
dict_table = prebuilt->table;
trx = prebuilt->trx;
@@ -5003,7 +5005,6 @@ ha_innobase::delete_all_rows(void)
/*==============================*/
/* out: error number */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
int error;
THD* thd = current_thd;
@@ -5121,7 +5122,7 @@ ha_innobase::delete_table(
/*********************************************************************
Removes all tables in the named database inside InnoDB. */
-
+static
void
innobase_drop_database(
/*===================*/
@@ -5288,7 +5289,6 @@ ha_innobase::records_in_range(
key_range *max_key) /* in: range end key val, may
also be 0 */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
KEY* key;
dict_index_t* index;
mysql_byte* key_val_buff2 = (mysql_byte*) my_malloc(
@@ -5307,8 +5307,7 @@ ha_innobase::records_in_range(
DBUG_ENTER("records_in_range");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
prebuilt->trx->op_info = (char*)"estimating records in index range";
@@ -5382,7 +5381,6 @@ ha_innobase::estimate_rows_upper_bound(void)
/*======================================*/
/* out: upper bound of rows */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
dict_index_t* index;
ulonglong estimate;
ulonglong local_data_file_length;
@@ -5431,8 +5429,6 @@ ha_innobase::scan_time()
/*====================*/
/* out: estimated time measured in disk seeks */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
-
/* Since MySQL seems to favor table scans too much over index
searches, we pretend that a sequential read takes the same time
as a random disk read, that is, we do not divide the following
@@ -5488,7 +5484,6 @@ ha_innobase::info(
/*==============*/
uint flag) /* in: what information MySQL requests */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
dict_table_t* ib_table;
dict_index_t* index;
ha_rows rec_per_key;
@@ -5741,12 +5736,10 @@ ha_innobase::check(
HA_CHECK_OPT* check_opt) /* in: check options, currently
ignored */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
ulint ret;
ut_a(prebuilt->trx && prebuilt->trx->magic_n == TRX_MAGIC_N);
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
if (prebuilt->mysql_template == NULL) {
/* Build the template; we will use a dummy template
@@ -5776,9 +5769,8 @@ ha_innobase::update_table_comment(
info on foreign keys */
const char* comment)/* in: table comment defined by user */
{
- uint length = (uint) strlen(comment);
- char* str;
- row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
+ uint length = (uint) strlen(comment);
+ char* str;
long flen;
/* We do not know if MySQL can call this function before calling
@@ -5851,7 +5843,6 @@ ha_innobase::get_foreign_key_create_info(void)
can be inserted to the CREATE TABLE statement,
MUST be freed with ::free_foreign_key_create_info */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
char* str = 0;
long flen;
@@ -5909,7 +5900,6 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
dict_foreign_t* foreign;
DBUG_ENTER("get_foreign_key_list");
- row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
ut_a(prebuilt != NULL);
update_thd(current_thd);
prebuilt->trx->op_info = (char*)"getting list of foreign keys";
@@ -6042,13 +6032,11 @@ bool
ha_innobase::can_switch_engines(void)
/*=================================*/
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
bool can_switch;
DBUG_ENTER("ha_innobase::can_switch_engines");
- ut_a(prebuilt->trx ==
- (trx_t*) current_thd->ha_data[ht->slot]);
+ ut_a(prebuilt->trx == thd_to_trx(current_thd, ht));
prebuilt->trx->op_info =
"determining if there are foreign key constraints";
@@ -6074,8 +6062,6 @@ ha_innobase::referenced_by_foreign_key(void)
/*========================================*/
/* out: > 0 if referenced by a FOREIGN KEY */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*)innobase_prebuilt;
-
if (dict_table_referenced_by_foreign_key(prebuilt->table)) {
return(1);
@@ -6108,8 +6094,6 @@ ha_innobase::extra(
enum ha_extra_function operation)
/* in: HA_EXTRA_FLUSH or some other flag */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
-
/* Warning: since it is not sure that MySQL calls external_lock
before calling this function, the trx field in prebuilt can be
obsolete! */
@@ -6142,7 +6126,6 @@ ha_innobase::extra(
int ha_innobase::reset()
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
if (prebuilt->blob_heap) {
row_mysql_prebuilt_free_blob_heap(prebuilt);
}
@@ -6161,7 +6144,7 @@ on that table.
MySQL-5.0 also calls this before each statement in an execution of a stored
procedure. To make the execution more deterministic for binlogging, MySQL-5.0
locks all tables involved in a stored procedure with full explicit table
-locks (thd->in_lock_tables is true in ::store_lock()) before executing the
+locks (thd_in_lock_tables(thd) holds in store_lock()) before executing the
procedure. */
int
@@ -6171,7 +6154,6 @@ ha_innobase::start_stmt(
THD* thd, /* in: handle to the user thread */
thr_lock_type lock_type)
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
update_thd(thd);
@@ -6270,7 +6252,6 @@ ha_innobase::external_lock(
THD* thd, /* in: handle to the user thread */
int lock_type) /* in: lock type */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
DBUG_ENTER("ha_innobase::external_lock");
@@ -6336,16 +6317,16 @@ ha_innobase::external_lock(
VERY easily deadlocks.
We do not set InnoDB table locks if user has not explicitly
- requested a table lock. Note that thd->in_lock_tables
- can be TRUE on some cases e.g. at the start of a stored
+ requested a table lock. Note that thd_in_lock_tables(thd)
+ can hold in some cases, e.g., at the start of a stored
procedure call (SQLCOM_CALL). */
if (prebuilt->select_lock_type != LOCK_NONE) {
- if (thd->in_lock_tables &&
- thd->lex->sql_command == SQLCOM_LOCK_TABLES &&
- thd->variables.innodb_table_locks &&
- (thd->options & OPTION_NOT_AUTOCOMMIT)) {
+ if (thd->lex->sql_command == SQLCOM_LOCK_TABLES
+ && thd->variables.innodb_table_locks
+ && (thd->options & OPTION_NOT_AUTOCOMMIT)
+ && thd_in_lock_tables(thd)) {
ulint error = row_lock_table_for_mysql(
prebuilt, NULL, 0);
@@ -6412,7 +6393,6 @@ ha_innobase::transactional_table_lock(
THD* thd, /* in: handle to the user thread */
int lock_type) /* in: lock type */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
DBUG_ENTER("ha_innobase::transactional_table_lock");
@@ -6424,7 +6404,8 @@ ha_innobase::transactional_table_lock(
update_thd(thd);
- if (prebuilt->table->ibd_file_missing && !current_thd->tablespace_op) {
+ if (prebuilt->table->ibd_file_missing
+ && !thd_tablespace_op(current_thd)) {
ut_print_timestamp(stderr);
fprintf(stderr, " InnoDB error:\n"
"MySQL is trying to use a table handle but the .ibd file for\n"
@@ -6469,7 +6450,7 @@ ha_innobase::transactional_table_lock(
trx->active_trans = 1;
}
- if (thd->in_lock_tables && thd->variables.innodb_table_locks) {
+ if (thd->variables.innodb_table_locks && thd_in_lock_tables(thd)) {
ulint error = DB_SUCCESS;
error = row_lock_table_for_mysql(prebuilt, NULL, 0);
@@ -6494,7 +6475,7 @@ ha_innobase::transactional_table_lock(
/****************************************************************************
Here we export InnoDB status variables to MySQL. */
-
+static
int
innodb_export_status()
/*==================*/
@@ -6509,7 +6490,7 @@ innodb_export_status()
/****************************************************************************
Implements the SHOW INNODB STATUS command. Sends the output of the InnoDB
Monitor to the client. */
-
+static
bool
innodb_show_status(
/*===============*/
@@ -6600,7 +6581,7 @@ innodb_show_status(
/****************************************************************************
Implements the SHOW MUTEX STATUS command. . */
-
+static
bool
innodb_mutex_show_status(
/*=====================*/
@@ -6699,6 +6680,7 @@ innodb_mutex_show_status(
DBUG_RETURN(FALSE);
}
+static
bool innobase_show_status(handlerton *hton, THD* thd,
stat_print_fn* stat_print,
enum ha_stat_type stat_type)
@@ -6800,7 +6782,6 @@ ha_innobase::store_lock(
'lock'; this may also be
TL_IGNORE */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
trx_t* trx;
/* Note that trx in this function is NOT necessarily prebuilt->trx
@@ -6821,16 +6802,28 @@ ha_innobase::store_lock(
trx->isolation_level = innobase_map_isolation_level(
(enum_tx_isolation)
thd->variables.tx_isolation);
+
+ if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
+ && trx->global_read_view) {
+
+ /* At low transaction isolation levels we let
+ each consistent read set its own snapshot */
+
+ read_view_close_for_mysql(trx);
+ }
+
}
+ const bool in_lock_tables = thd_in_lock_tables(thd);
+
if (thd->lex->sql_command == SQLCOM_DROP_TABLE) {
/* MySQL calls this function in DROP TABLE though this table
handle may belong to another thd that is running a query. Let
us in that case skip any changes to the prebuilt struct. */
- } else if ((lock_type == TL_READ && thd->in_lock_tables) ||
- (lock_type == TL_READ_HIGH_PRIORITY && thd->in_lock_tables) ||
+ } else if ((lock_type == TL_READ && in_lock_tables) ||
+ (lock_type == TL_READ_HIGH_PRIORITY && in_lock_tables) ||
lock_type == TL_READ_WITH_SHARED_LOCKS ||
lock_type == TL_READ_NO_INSERT ||
(thd->lex->sql_command != SQLCOM_SELECT
@@ -6901,7 +6894,7 @@ ha_innobase::store_lock(
/* Starting from 5.0.7, we weaken also the table locks
set at the start of a MySQL stored procedure call, just like
we weaken the locks set at the start of an SQL statement.
- MySQL does set thd->in_lock_tables TRUE there, but in reality
+ MySQL does set in_lock_tables TRUE there, but in reality
we do not need table locks to make the execution of a
single transaction stored procedure call deterministic
(if it does not use a consistent read). */
@@ -6929,14 +6922,14 @@ ha_innobase::store_lock(
We especially allow multiple writers if MySQL is at the
start of a stored procedure call (SQLCOM_CALL) or a
- stored function call (MySQL does have thd->in_lock_tables
+ stored function call (MySQL does have in_lock_tables
TRUE there). */
if ((lock_type >= TL_WRITE_CONCURRENT_INSERT
&& lock_type <= TL_WRITE)
- && !(thd->in_lock_tables
+ && !(in_lock_tables
&& thd->lex->sql_command == SQLCOM_LOCK_TABLES)
- && !thd->tablespace_op
+ && !thd_tablespace_op(thd)
&& thd->lex->sql_command != SQLCOM_TRUNCATE
&& thd->lex->sql_command != SQLCOM_OPTIMIZE
@@ -6963,7 +6956,7 @@ ha_innobase::store_lock(
We especially allow concurrent inserts if MySQL is at the
start of a stored procedure call (SQLCOM_CALL)
- (MySQL does have thd->in_lock_tables TRUE there). */
+ (MySQL does have in_lock_tables TRUE there). */
if (lock_type == TL_READ_NO_INSERT
&& thd->lex->sql_command != SQLCOM_LOCK_TABLES) {
@@ -6992,7 +6985,6 @@ ha_innobase::innobase_read_and_init_auto_inc(
timeout */
longlong* ret) /* out: auto-inc value */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
longlong auto_inc;
ulint old_select_lock_type;
ibool trx_was_not_started = FALSE;
@@ -7172,8 +7164,7 @@ ha_innobase::reset_auto_increment(ulonglong value)
{
DBUG_ENTER("ha_innobase::reset_auto_increment");
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
- int error;
+ int error;
update_thd(current_thd);
@@ -7217,7 +7208,6 @@ ha_innobase::cmp_ref(
const mysql_byte* ref2) /* in: an (internal) primary key value in the
MySQL key value format */
{
- row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
enum_field_types mysql_type;
Field* field;
KEY_PART_INFO* key_part;
@@ -7276,6 +7266,33 @@ ha_innobase::cmp_ref(
return(0);
}
+/***********************************************************************
+Ask InnoDB if a query to a table can be cached. */
+
+my_bool
+ha_innobase::register_query_cache_table(
+/*====================================*/
+ /* out: TRUE if query caching
+ of the table is permitted */
+ THD* thd, /* in: user thread handle */
+ char* table_key, /* in: concatenation of database name,
+ the null character '\0',
+ and the table name */
+ uint key_length, /* in: length of the full name, i.e.
+ len(dbname) + len(tablename) + 1 */
+ qc_engine_callback*
+ call_back, /* out: pointer to function for
+ checking if query caching
+ is permitted */
+ ulonglong *engine_data) /* in/out: data to call_back */
+{
+ *call_back = innobase_query_caching_of_table_permitted;
+ *engine_data = 0;
+ return(innobase_query_caching_of_table_permitted(thd, table_key,
+ key_length,
+ engine_data));
+}
+
char*
ha_innobase::get_mysql_bin_log_name()
{
@@ -7408,7 +7425,7 @@ innobase_query_is_update(void)
/***********************************************************************
This function is used to prepare X/Open XA distributed transaction */
-
+static
int
innobase_xa_prepare(
/*================*/
@@ -7504,7 +7521,7 @@ innobase_xa_prepare(
/***********************************************************************
This function is used to recover X/Open XA distributed transactions */
-
+static
int
innobase_xa_recover(
/*================*/
@@ -7525,7 +7542,7 @@ innobase_xa_recover(
/***********************************************************************
This function is used to commit one X/Open XA distributed transaction
which is in the prepared state */
-
+static
int
innobase_commit_by_xid(
/*===================*/
@@ -7549,7 +7566,7 @@ innobase_commit_by_xid(
/***********************************************************************
This function is used to rollback one X/Open XA distributed transaction
which is in the prepared state */
-
+static
int
innobase_rollback_by_xid(
/*=====================*/
@@ -7573,9 +7590,10 @@ Create a consistent view for a cursor based on current transaction
which is created if the corresponding MySQL thread still lacks one.
This consistent view is then used inside of MySQL when accessing records
using a cursor. */
-
+static
void*
innobase_create_cursor_view(
+/*========================*/
/* out: pointer to cursor view or NULL */
handlerton *hton, /* in: innobase hton */
THD* thd) /* in: user thread handle */
@@ -7588,9 +7606,10 @@ innobase_create_cursor_view(
Close the given consistent cursor view of a transaction and restore
global read view to a transaction read view. Transaction is created if the
corresponding MySQL thread still lacks one. */
-
+static
void
innobase_close_cursor_view(
+/*=======================*/
handlerton *hton,
THD* thd, /* in: user thread handle */
void* curview)/* in: Consistent read view to be closed */
@@ -7604,7 +7623,7 @@ Set the given consistent cursor view to a transaction which is created
if the corresponding MySQL thread still lacks one. If the given
consistent cursor view is NULL global read view of a transaction is
restored to a transaction read view. */
-
+static
void
innobase_set_cursor_view(
/*=====================*/
@@ -7651,12 +7670,12 @@ static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
return 0;
}
-SHOW_VAR innodb_status_variables_export[]= {
+static SHOW_VAR innodb_status_variables_export[]= {
{"Innodb", (char*) &show_innodb_vars, SHOW_FUNC},
{NullS, NullS, SHOW_LONG}
};
-struct st_mysql_storage_engine innobase_storage_engine=
+static struct st_mysql_storage_engine innobase_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
mysql_declare_plugin(innobase)
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 339238a584e..f5df362b490 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -33,23 +33,17 @@ typedef struct st_innobase_share {
struct row_prebuilt_struct;
-
-my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
- uint full_name_len,
- ulonglong *unused);
+typedef struct row_prebuilt_struct row_prebuilt_t;
/* The class defining a handle to an Innodb table */
class ha_innobase: public handler
{
- void* innobase_prebuilt;/* (row_prebuilt_t*) prebuilt
- struct in InnoDB, used to save
- CPU time with prebuilt data
+ row_prebuilt_t* prebuilt; /* prebuilt struct in InnoDB, used
+ to save CPU time with prebuilt data
structures*/
THD* user_thd; /* the thread handle of the user
currently using the handle; this is
set in external_lock function */
- query_id_t last_query_id; /* the latest query id where the
- handle was used */
THR_LOCK_DATA lock;
INNOBASE_SHARE *share;
@@ -186,14 +180,7 @@ class ha_innobase: public handler
my_bool register_query_cache_table(THD *thd, char *table_key,
uint key_length,
qc_engine_callback *call_back,
- ulonglong *engine_data)
- {
- *call_back= innobase_query_caching_of_table_permitted;
- *engine_data= 0;
- return innobase_query_caching_of_table_permitted(thd, table_key,
- key_length,
- engine_data);
- }
+ ulonglong *engine_data);
static char *get_mysql_bin_log_name();
static ulonglong get_mysql_bin_log_pos();
bool primary_key_is_clustered() { return true; }
@@ -202,7 +189,6 @@ class ha_innobase: public handler
uint table_changes);
};
-extern SHOW_VAR innodb_status_variables[];
extern ulong innobase_fast_shutdown;
extern ulong innobase_large_page_size;
extern long innobase_mirrored_log_groups, innobase_log_files_in_group;
@@ -238,11 +224,6 @@ extern ulong srv_commit_concurrency;
extern ulong srv_flush_log_at_trx_commit;
}
-int innobase_init(void);
-int innobase_end(handlerton *hton, ha_panic_function type);
-bool innobase_flush_logs(handlerton *hton);
-uint innobase_get_free_space(void);
-
/*
don't delete it - it may be re-enabled later
as an optimization for the most common case InnoDB+binlog
@@ -256,93 +237,3 @@ int innobase_report_binlog_offset_and_commit(
int innobase_commit_complete(void* trx_handle);
void innobase_store_binlog_offset_and_flush_log(char *binlog_name,longlong offset);
#endif
-
-void innobase_drop_database(handlerton *hton, char *path);
-bool innobase_show_status(handlerton *hton, THD* thd, stat_print_fn*, enum ha_stat_type);
-
-int innobase_release_temporary_latches(handlerton *hton, THD *thd);
-
-void innobase_store_binlog_offset_and_flush_log(handlerton *hton, char *binlog_name,longlong offset);
-
-int innobase_start_trx_and_assign_read_view(handlerton *hton, THD* thd);
-
-/***********************************************************************
-This function is used to prepare X/Open XA distributed transaction */
-
-int innobase_xa_prepare(
-/*====================*/
- /* out: 0 or error number */
- handlerton *hton, /* in: innobase hton */
- THD* thd, /* in: handle to the MySQL thread of the user
- whose XA transaction should be prepared */
- bool all); /* in: TRUE - commit transaction
- FALSE - the current SQL statement ended */
-
-/***********************************************************************
-This function is used to recover X/Open XA distributed transactions */
-
-int innobase_xa_recover(
-/*====================*/
- /* out: number of prepared transactions
- stored in xid_list */
- handlerton *hton, /* in: innobase hton */
- XID* xid_list, /* in/out: prepared transactions */
- uint len); /* in: number of slots in xid_list */
-
-/***********************************************************************
-This function is used to commit one X/Open XA distributed transaction
-which is in the prepared state */
-
-int innobase_commit_by_xid(
-/*=======================*/
- /* out: 0 or error number */
- handlerton *hton, /* in: innobase hton */
- XID* xid); /* in : X/Open XA Transaction Identification */
-
-/***********************************************************************
-This function is used to rollback one X/Open XA distributed transaction
-which is in the prepared state */
-
-int innobase_rollback_by_xid(
- /* out: 0 or error number */
- handlerton *hton, /* in: innobase hton */
- XID *xid); /* in : X/Open XA Transaction Identification */
-
-
-/***********************************************************************
-Create a consistent view for a cursor based on current transaction
-which is created if the corresponding MySQL thread still lacks one.
-This consistent view is then used inside of MySQL when accessing records
-using a cursor. */
-
-void*
-innobase_create_cursor_view(
- /* out: Pointer to cursor view or NULL */
- handlerton *hton, /* in: innobase hton */
- THD* thd); /* in: user thread handle */
-
-/***********************************************************************
-Close the given consistent cursor view of a transaction and restore
-global read view to a transaction read view. Transaction is created if the
-corresponding MySQL thread still lacks one. */
-
-void
-innobase_close_cursor_view(
-/*=======================*/
- handlerton *hton, /* in: innobase hton */
- THD* thd, /* in: user thread handle */
- void* curview); /* in: Consistent read view to be closed */
-
-
-/***********************************************************************
-Set the given consistent cursor view to a transaction which is created
-if the corresponding MySQL thread still lacks one. If the given
-consistent cursor view is NULL global read view of a transaction is
-restored to a transaction read view. */
-
-void
-innobase_set_cursor_view(
-/*=====================*/
- handlerton *hton, /* in: innobase hton */
- THD* thd, /* in: user thread handle */
- void* curview); /* in: Consistent read view to be set */
diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c
index 96ab928a436..1cbb6003cfc 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.c
+++ b/storage/innobase/ibuf/ibuf0ibuf.c
@@ -417,9 +417,7 @@ ibuf_data_sizes_update(
{
ulint old_size;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&ibuf_mutex));
-#endif /* UNIV_SYNC_DEBUG */
old_size = data->size;
@@ -1576,9 +1574,7 @@ ibuf_data_enough_free_for_insert(
/* out: TRUE if enough free pages in list */
ibuf_data_t* data) /* in: ibuf data for the space */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&ibuf_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* We want a big margin of free pages, because a B-tree can sometimes
grow in size also if records are deleted from it, as the node pointers
@@ -1604,16 +1600,9 @@ ibuf_data_too_much_free(
/* out: TRUE if enough free pages in list */
ibuf_data_t* data) /* in: ibuf data for the space */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&ibuf_mutex));
-#endif /* UNIV_SYNC_DEBUG */
-
- if (data->free_list_len >= 3 + data->size / 2 + 3 * data->height) {
- return(TRUE);
- }
-
- return(FALSE);
+ return(data->free_list_len >= 3 + data->size / 2 + 3 * data->height);
}
/*************************************************************************
@@ -3451,9 +3440,7 @@ ibuf_validate_low(void)
ibuf_data_t* data;
ulint sum_sizes;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&ibuf_mutex));
-#endif /* UNIV_SYNC_DEBUG */
sum_sizes = 0;
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index c448c28933a..031bf6c51b4 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -128,9 +128,7 @@ buf_pool_clock_tic(void)
/*====================*/
/* out: new clock value */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
buf_pool->ulint_clock++;
@@ -456,7 +454,7 @@ buf_frame_modify_clock_inc(
#ifdef UNIV_SYNC_DEBUG
ut_ad((mutex_own(&(buf_pool->mutex)) && (block->buf_fix_count == 0))
|| rw_lock_own(&(block->lock), RW_LOCK_EXCLUSIVE));
-#endif /*UNIV_SYNC_DEBUG */
+#endif /* UNIV_SYNC_DEBUG */
UT_DULINT_INC(block->modify_clock);
@@ -513,14 +511,12 @@ buf_block_buf_fix_inc_debug(
const char* file __attribute__ ((unused)), /* in: file name */
ulint line __attribute__ ((unused))) /* in: line */
{
-#ifdef UNIV_SYNC_DEBUG
ibool ret;
ret = rw_lock_s_lock_func_nowait(&(block->debug_latch), file, line);
ut_ad(ret == TRUE);
ut_ad(mutex_own(&block->mutex));
-#endif
block->buf_fix_count++;
}
#else /* UNIV_SYNC_DEBUG */
@@ -532,9 +528,8 @@ buf_block_buf_fix_inc(
/*==================*/
buf_block_t* block) /* in: block to bufferfix */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&block->mutex));
-#endif
+
block->buf_fix_count++;
}
#endif /* UNIV_SYNC_DEBUG */
@@ -552,9 +547,7 @@ buf_page_hash_get(
ulint fold;
ut_ad(buf_pool);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(buf_pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* Look for the page in the hash table */
diff --git a/storage/innobase/include/buf0flu.ic b/storage/innobase/include/buf0flu.ic
index b304673f8be..ae873c42088 100644
--- a/storage/innobase/include/buf0flu.ic
+++ b/storage/innobase/include/buf0flu.ic
@@ -42,8 +42,8 @@ buf_flush_note_modification(
ut_ad(block->buf_fix_count > 0);
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
- ut_ad(mutex_own(&(buf_pool->mutex)));
#endif /* UNIV_SYNC_DEBUG */
+ ut_ad(mutex_own(&(buf_pool->mutex)));
ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0);
ut_ad(mtr->modifications);
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index d59e99277da..4a9afd2f3f5 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -551,9 +551,7 @@ dict_table_check_if_in_cache_low(
ulint table_fold;
ut_ad(table_name);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* Look for the table name in the hash table */
table_fold = ut_fold_string(table_name);
@@ -576,9 +574,7 @@ dict_table_get_low(
dict_table_t* table;
ut_ad(table_name);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
table = dict_table_check_if_in_cache_low(table_name);
@@ -601,9 +597,7 @@ dict_table_get_on_id_low(
dict_table_t* table;
ulint fold;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* Look for the table name in the hash table */
fold = ut_fold_dulint(table_id);
diff --git a/storage/innobase/include/ha0ha.ic b/storage/innobase/include/ha0ha.ic
index 1584e1ff4bf..fb264377f28 100644
--- a/storage/innobase/include/ha0ha.ic
+++ b/storage/innobase/include/ha0ha.ic
@@ -81,9 +81,7 @@ ha_search(
{
ha_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
-#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
@@ -113,9 +111,7 @@ ha_search_and_get_data(
{
ha_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
-#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
@@ -145,9 +141,7 @@ ha_search_with_data(
{
ha_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
-#endif /* UNIV_SYNC_DEBUG */
node = ha_chain_get_first(table, fold);
@@ -177,9 +171,7 @@ ha_search_and_delete_if_found(
{
ha_node_t* node;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!table->mutexes || mutex_own(hash_get_mutex(table, fold)));
-#endif /* UNIV_SYNC_DEBUG */
node = ha_search_with_data(table, fold, data);
diff --git a/storage/innobase/include/lock0lock.ic b/storage/innobase/include/lock0lock.ic
index feec460bec8..311623b190b 100644
--- a/storage/innobase/include/lock0lock.ic
+++ b/storage/innobase/include/lock0lock.ic
@@ -65,9 +65,7 @@ lock_clust_rec_some_has_impl(
{
dulint trx_id;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(index->type & DICT_CLUSTERED);
ut_ad(page_rec_is_user_rec(rec));
diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic
index 06deff196bc..df0a8baf2d5 100644
--- a/storage/innobase/include/log0log.ic
+++ b/storage/innobase/include/log0log.ic
@@ -255,9 +255,7 @@ log_block_init(
{
ulint no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
no = log_block_convert_lsn_to_no(lsn);
@@ -279,9 +277,7 @@ log_block_init_in_old_format(
{
ulint no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
no = log_block_convert_lsn_to_no(lsn);
diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h
index f68d45d83df..2d5fd1db6c3 100644
--- a/storage/innobase/include/mem0mem.h
+++ b/storage/innobase/include/mem0mem.h
@@ -280,17 +280,6 @@ mem_strdupl(
ulint len); /* in: length of str, in bytes */
/**************************************************************************
-Makes a NUL-terminated quoted copy of a NUL-terminated string. */
-UNIV_INLINE
-char*
-mem_strdupq(
-/*========*/
- /* out, own: a quoted copy of the string,
- must be deallocated with mem_free */
- const char* str, /* in: string to be copied */
- char q); /* in: quote character */
-
-/**************************************************************************
Duplicates a NUL-terminated string, allocated from a memory heap. */
char*
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index 069f8de36cb..cb8fbe92cf0 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -590,41 +590,6 @@ mem_strdupl(
}
/**************************************************************************
-Makes a NUL-terminated quoted copy of a NUL-terminated string. */
-UNIV_INLINE
-char*
-mem_strdupq(
-/*========*/
- /* out, own: a quoted copy of the string,
- must be deallocated with mem_free */
- const char* str, /* in: string to be copied */
- char q) /* in: quote character */
-{
- char* dst;
- char* d;
- const char* s = str;
- size_t len = strlen(str) + 3;
- /* calculate the number of quote characters in the string */
- while((s = strchr(s, q)) != NULL) {
- s++;
- len++;
- }
- /* allocate the quoted string, and copy it */
- d = dst = mem_alloc(len);
- *d++ = q;
- s = str;
- while(*s) {
- if ((*d++ = *s++) == q) {
- *d++ = q;
- }
- }
- *d++ = q;
- *d++ = '\0';
- ut_ad((ssize_t) len == d - dst);
- return(dst);
-}
-
-/**************************************************************************
Makes a NUL-terminated copy of a nonterminated string,
allocated from a memory heap. */
UNIV_INLINE
diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic
index ace90247b80..90a35af74dc 100644
--- a/storage/innobase/include/rem0rec.ic
+++ b/storage/innobase/include/rem0rec.ic
@@ -995,6 +995,9 @@ rec_offs_nth_size(
{
ut_ad(rec_offs_validate(NULL, NULL, offsets));
ut_ad(n < rec_offs_n_fields(offsets));
+ if (!n) {
+ return(rec_offs_base(offsets)[1 + n] & REC_OFFS_MASK);
+ }
return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n])
& REC_OFFS_MASK);
}
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
index defe0692aa8..f8b5367739a 100644
--- a/storage/innobase/include/sync0rw.ic
+++ b/storage/innobase/include/sync0rw.ic
@@ -133,9 +133,8 @@ rw_lock_s_lock_low(
const char* file_name, /* in: file name where lock requested */
ulint line) /* in: line where requested */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(rw_lock_get_mutex(lock)));
-#endif /* UNIV_SYNC_DEBUG */
+
/* Check if the writer field is free */
if (UNIV_LIKELY(lock->writer == RW_LOCK_NOT_LOCKED)) {
diff --git a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
index e7e135c0c7e..69c0cd9e39b 100644
--- a/storage/innobase/include/sync0sync.h
+++ b/storage/innobase/include/sync0sync.h
@@ -114,13 +114,20 @@ mutex_enter_func(
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name, /* in: file name where locked */
ulint line); /* in: line where locked */
+/******************************************************************
+NOTE! The following macro should be used in mutex locking, not the
+corresponding function. */
+
+#define mutex_enter_nowait(M) \
+ mutex_enter_nowait_func((M), __FILE__, __LINE__)
/************************************************************************
-Tries to lock the mutex for the current thread. If the lock is not acquired
-immediately, returns with return value 1. */
+NOTE! Use the corresponding macro in the header file, not this function
+directly. Tries to lock the mutex for the current thread. If the lock is not
+acquired immediately, returns with return value 1. */
ulint
-mutex_enter_nowait(
-/*===============*/
+mutex_enter_nowait_func(
+/*====================*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name, /* in: file name where mutex
@@ -170,7 +177,16 @@ Checks that the mutex has been initialized. */
ibool
mutex_validate(
/*===========*/
- mutex_t* mutex);
+ const mutex_t* mutex);
+/**********************************************************************
+Checks that the current thread owns the mutex. Works only
+in the debug version. */
+
+ibool
+mutex_own(
+/*======*/
+ /* out: TRUE if owns */
+ const mutex_t* mutex); /* in: mutex */
#endif /* UNIV_DEBUG */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
@@ -215,15 +231,6 @@ sync_thread_levels_empty_gen(
also purge_is_running mutex is
allowed */
/**********************************************************************
-Checks that the current thread owns the mutex. Works only
-in the debug version. */
-
-ibool
-mutex_own(
-/*======*/
- /* out: TRUE if owns */
- mutex_t* mutex); /* in: mutex */
-/**********************************************************************
Gets the debug information for a reserved mutex. */
void
@@ -248,7 +255,7 @@ UNIV_INLINE
ulint
mutex_get_lock_word(
/*================*/
- mutex_t* mutex); /* in: mutex */
+ const mutex_t* mutex); /* in: mutex */
#ifdef UNIV_SYNC_DEBUG
/**********************************************************************
NOT to be used outside this module except in debugging! Gets the waiters
@@ -258,7 +265,7 @@ ulint
mutex_get_waiters(
/*==============*/
/* out: value to set */
- mutex_t* mutex); /* in: mutex */
+ const mutex_t* mutex); /* in: mutex */
#endif /* UNIV_SYNC_DEBUG */
/*
@@ -479,13 +486,13 @@ struct mutex_struct {
#ifdef UNIV_SYNC_DEBUG
const char* file_name; /* File where the mutex was locked */
ulint line; /* Line where the mutex was locked */
- os_thread_id_t thread_id; /* Debug version: The thread id of the
- thread which locked the mutex. */
ulint level; /* Level in the global latching order */
#endif /* UNIV_SYNC_DEBUG */
const char* cfile_name;/* File name where mutex created */
ulint cline; /* Line where created */
#ifdef UNIV_DEBUG
+ os_thread_id_t thread_id; /* The thread id of the thread
+ which locked the mutex. */
ulint magic_n;
# define MUTEX_MAGIC_N (ulint)979585
#endif /* UNIV_DEBUG */
diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic
index 4b48a1469ff..9bd5ac2a518 100644
--- a/storage/innobase/include/sync0sync.ic
+++ b/storage/innobase/include/sync0sync.ic
@@ -6,6 +6,16 @@ Mutex, the basic synchronization primitive
Created 9/5/1995 Heikki Tuuri
*******************************************************/
+#if defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
+/* %z0: Use the size of operand %0 which in our case is *m to determine
+instruction size, it should end up as xchgl. "1" in the input constraint,
+says that "in" has to go in the same place as "out".*/
+#define TAS(m, in, out) \
+ asm volatile ("xchg%z0 %2, %0" \
+ : "=g" (*(m)), "=r" (out) \
+ : "1" (in)) /* Note: "1" here refers to "=r" (out) */
+#endif
+
/**********************************************************************
Sets the waiters field in a mutex. */
@@ -89,20 +99,10 @@ mutex_test_and_set(
return(res);
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
- ulint* lw;
ulint res;
- lw = &(mutex->lock_word);
-
- /* In assembly we use the so-called AT & T syntax where
- the order of operands is inverted compared to the ordinary Intel
- syntax. The 'l' after the mnemonics denotes a 32-bit operation.
- The line after the code tells which values come out of the asm
- code, and the second line tells the input to the asm code. */
+ TAS(&mutex->lock_word, 1, res);
- asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
- "=eax" (res), "=m" (*lw) :
- "ecx" (lw));
return(res);
#else
ibool ret;
@@ -141,20 +141,9 @@ mutex_reset_lock_word(
__asm MOV ECX, lw
__asm XCHG EDX, DWORD PTR [ECX]
#elif defined(not_defined) && defined(__GNUC__) && defined(UNIV_INTEL_X86)
- ulint* lw;
-
- lw = &(mutex->lock_word);
-
- /* In assembly we use the so-called AT & T syntax where
- the order of operands is inverted compared to the ordinary Intel
- syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
+ ulint res;
- asm volatile("movl $0, %%eax; xchgl (%%ecx), %%eax" :
- "=m" (*lw) :
- "ecx" (lw) :
- "eax"); /* gcc does not seem to understand
- that our asm code resets eax: tell it
- explicitly that after the third ':' */
+ TAS(&mutex->lock_word, 0, res);
#else
mutex->lock_word = 0;
@@ -168,9 +157,9 @@ UNIV_INLINE
ulint
mutex_get_lock_word(
/*================*/
- mutex_t* mutex) /* in: mutex */
+ const mutex_t* mutex) /* in: mutex */
{
- volatile ulint* ptr; /* declared volatile to ensure that
+ const volatile ulint* ptr; /* declared volatile to ensure that
lock_word is loaded from memory */
ut_ad(mutex);
@@ -186,9 +175,9 @@ ulint
mutex_get_waiters(
/*==============*/
/* out: value to set */
- mutex_t* mutex) /* in: mutex */
+ const mutex_t* mutex) /* in: mutex */
{
- volatile ulint* ptr; /* declared volatile to ensure that
+ const volatile ulint* ptr; /* declared volatile to ensure that
the value is read from memory */
ut_ad(mutex);
@@ -206,11 +195,11 @@ mutex_exit(
/*=======*/
mutex_t* mutex) /* in: pointer to mutex */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(mutex));
- mutex->thread_id = ULINT_UNDEFINED;
+ ut_d(mutex->thread_id = ULINT_UNDEFINED);
+#ifdef UNIV_SYNC_DEBUG
sync_thread_reset_level(mutex);
#endif
mutex_reset_lock_word(mutex);
@@ -250,6 +239,7 @@ mutex_enter_func(
ulint line) /* in: line where locked */
{
ut_ad(mutex_validate(mutex));
+ ut_ad(!mutex_own(mutex));
/* Note that we do not peek at the value of lock_word before trying
the atomic test_and_set; we could peek, and possibly save time. */
@@ -259,6 +249,7 @@ mutex_enter_func(
#endif /* UNIV_DEBUG && !UNIV_HOTBACKUP */
if (!mutex_test_and_set(mutex)) {
+ ut_d(mutex->thread_id = os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
diff --git a/storage/innobase/include/trx0sys.ic b/storage/innobase/include/trx0sys.ic
index 9c950be09f0..86b71df08d6 100644
--- a/storage/innobase/include/trx0sys.ic
+++ b/storage/innobase/include/trx0sys.ic
@@ -62,9 +62,7 @@ trx_sys_get_nth_rseg(
trx_sys_t* sys, /* in: trx system */
ulint n) /* in: index of slot */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(n < TRX_SYS_N_RSEGS);
return(sys->rseg_array[n]);
@@ -121,9 +119,7 @@ trx_sysf_rseg_get_space(
ulint i, /* in: slot index == rseg id */
mtr_t* mtr) /* in: mtr */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
@@ -146,9 +142,7 @@ trx_sysf_rseg_get_page_no(
mtr_t* mtr) /* in: mtr */
{
ut_ad(sys_header);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(i < TRX_SYS_N_RSEGS);
return(mtr_read_ulint(sys_header + TRX_SYS_RSEGS
@@ -168,9 +162,7 @@ trx_sysf_rseg_set_space(
ulint space, /* in: space id */
mtr_t* mtr) /* in: mtr */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
@@ -194,9 +186,7 @@ trx_sysf_rseg_set_page_no(
slot is reset to unused */
mtr_t* mtr) /* in: mtr */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(sys_header);
ut_ad(i < TRX_SYS_N_RSEGS);
@@ -250,9 +240,7 @@ trx_get_on_id(
{
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
@@ -282,9 +270,7 @@ trx_list_get_min_trx_id(void)
{
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_LAST(trx_sys->trx_list);
@@ -307,9 +293,7 @@ trx_is_active(
{
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (ut_dulint_cmp(trx_id, trx_list_get_min_trx_id()) < 0) {
@@ -346,9 +330,7 @@ trx_sys_get_new_trx_id(void)
{
dulint id;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* VERY important: after the database is started, max_trx_id value is
divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if
@@ -378,9 +360,7 @@ trx_sys_get_new_trx_no(void)
/*========================*/
/* out: new, allocated trx number */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
return(trx_sys_get_new_trx_id());
}
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 8232699c7f9..fe36b0d1a01 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -375,8 +375,6 @@ trx_is_interrupted(
/* Signal to a transaction */
struct trx_sig_struct{
ulint type; /* signal type */
- ulint state; /* TRX_SIG_WAITING or
- TRX_SIG_BEING_HANDLED */
ulint sender; /* TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */
que_thr_t* receiver; /* non-NULL if the sender of the signal
@@ -404,7 +402,7 @@ struct trx_struct{
const char* op_info; /* English text describing the
current operation, or an empty
string */
- ulint type; /* TRX_USER, TRX_PURGE */
+ unsigned is_purge:1; /* 0=user transaction, 1=purge */
ulint conc_state; /* state of the trx from the point
of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
@@ -675,12 +673,6 @@ struct trx_struct{
single operation of a
transaction, e.g., a parallel
query */
-/* Transaction types */
-#define TRX_USER 1 /* normal user transaction */
-#define TRX_PURGE 2 /* purge transaction: this is not
- inserted to the trx list of trx_sys
- and no rollback segment is assigned to
- this */
/* Transaction concurrency states */
#define TRX_NOT_STARTED 1
#define TRX_ACTIVE 2
@@ -742,9 +734,6 @@ struct trx_struct{
session */
#define TRX_SIG_OTHER_SESS 2 /* sent by another session (which
must hold rights to this) */
-/* Signal states */
-#define TRX_SIG_WAITING 1
-#define TRX_SIG_BEING_HANDLED 2
/* Commit command node in a query graph */
struct commit_node_struct{
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 7a5cb21f07a..957baa0391f 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -40,9 +40,9 @@ if we are compiling on Windows. */
# undef VERSION
/* Include the header file generated by GNU autoconf */
-#ifndef __WIN__
-# include "config.h"
-#endif
+# ifndef __WIN__
+# include "config.h"
+# endif
# ifdef HAVE_SCHED_H
# include <sched.h>
@@ -51,9 +51,9 @@ if we are compiling on Windows. */
/* When compiling for Itanium IA64, undefine the flag below to prevent use
of the 32-bit x86 assembler in mutex operations. */
-#if defined(__WIN__) && !defined(WIN64) && !defined(_WIN64)
-#define UNIV_CAN_USE_X86_ASSEMBLER
-#endif
+# if defined(__WIN__) && !defined(WIN64) && !defined(_WIN64)
+# define UNIV_CAN_USE_X86_ASSEMBLER
+# endif
/* We only try to do explicit inlining of functions with gcc and
Microsoft Visual C++ */
diff --git a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h
index 9735bf315c6..ebe2803fe23 100644
--- a/storage/innobase/include/ut0lst.h
+++ b/storage/innobase/include/ut0lst.h
@@ -74,6 +74,7 @@ the pointer to the node to be added to the list. NAME is the list name. */
((N)->NAME).next = (BASE).start;\
((N)->NAME).prev = NULL;\
if ((BASE).start != NULL) {\
+ ut_ad((BASE).start != (N));\
(((BASE).start)->NAME).prev = (N);\
}\
(BASE).start = (N);\
@@ -94,6 +95,7 @@ the pointer to the node to be added to the list. NAME is the list name. */
((N)->NAME).prev = (BASE).end;\
((N)->NAME).next = NULL;\
if ((BASE).end != NULL) {\
+ ut_ad((BASE).end != (N));\
(((BASE).end)->NAME).next = (N);\
}\
(BASE).end = (N);\
@@ -111,6 +113,7 @@ name, NODE1 and NODE2 are pointers to nodes. */
{\
ut_ad(NODE1);\
ut_ad(NODE2);\
+ ut_ad((NODE1) != (NODE2));\
((BASE).count)++;\
((NODE2)->NAME).prev = (NODE1);\
((NODE2)->NAME).next = ((NODE1)->NAME).next;\
diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c
index 84b64b146dc..93a43d9a30f 100644
--- a/storage/innobase/lock/lock0lock.c
+++ b/storage/innobase/lock/lock0lock.c
@@ -1162,9 +1162,7 @@ lock_rec_get_next_on_page(
ulint space;
ulint page_no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(lock_get_type(lock) == LOCK_REC);
space = lock->un_member.rec_lock.space;
@@ -1201,9 +1199,7 @@ lock_rec_get_first_on_page_addr(
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock = HASH_GET_FIRST(lock_sys->rec_hash,
lock_rec_hash(space, page_no));
@@ -1261,9 +1257,7 @@ lock_rec_get_first_on_page(
ulint space;
ulint page_no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
hash = buf_frame_get_lock_hash_val(ptr);
@@ -1295,9 +1289,7 @@ lock_rec_get_next(
rec_t* rec, /* in: record on a page */
lock_t* lock) /* in: lock */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(lock_get_type(lock) == LOCK_REC);
if (page_rec_is_comp(rec)) {
@@ -1326,9 +1318,7 @@ lock_rec_get_first(
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock = lock_rec_get_first_on_page(rec);
if (UNIV_LIKELY_NULL(lock)) {
@@ -1414,9 +1404,7 @@ lock_rec_get_prev(
ulint page_no;
lock_t* found_lock = NULL;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(lock_get_type(in_lock) == LOCK_REC);
space = in_lock->un_member.rec_lock.space;
@@ -1456,9 +1444,7 @@ lock_table_has(
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* Look for stronger locks the same trx already has on the table */
@@ -1502,9 +1488,7 @@ lock_rec_has_expl(
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad((precise_mode & LOCK_MODE_MASK) == LOCK_S
|| (precise_mode & LOCK_MODE_MASK) == LOCK_X);
ut_ad(!(precise_mode & LOCK_INSERT_INTENTION));
@@ -1552,9 +1536,7 @@ lock_rec_other_has_expl_req(
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(mode == LOCK_X || mode == LOCK_S);
ut_ad(gap == 0 || gap == LOCK_GAP);
ut_ad(wait == 0 || wait == LOCK_WAIT);
@@ -1594,9 +1576,8 @@ lock_rec_other_has_conflicting(
trx_t* trx) /* in: our transaction */
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock = lock_rec_get_first(rec);
@@ -1629,9 +1610,7 @@ lock_rec_find_similar_on_page(
lock_t* lock;
ulint heap_no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
heap_no = rec_get_heap_no(rec, page_rec_is_comp(rec));
lock = lock_rec_get_first_on_page(rec);
@@ -1665,9 +1644,7 @@ lock_sec_rec_some_has_impl_off_kernel(
{
page_t* page;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(!(index->type & DICT_CLUSTERED));
ut_ad(page_rec_is_user_rec(rec));
ut_ad(rec_offs_validate(rec, index, offsets));
@@ -1760,9 +1737,7 @@ lock_rec_create(
ulint n_bits;
ulint n_bytes;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
page = buf_frame_align(rec);
space = buf_frame_get_space_id(page);
@@ -1842,9 +1817,7 @@ lock_rec_enqueue_waiting(
lock_t* lock;
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* Test if there already is some other reason to suspend thread:
we do not enqueue a lock request if the query thread should be
@@ -1934,9 +1907,7 @@ lock_rec_add_to_queue(
ulint heap_no;
ibool somebody_waits = FALSE;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad((type_mode & (LOCK_WAIT | LOCK_GAP))
|| ((type_mode & LOCK_MODE_MASK) != LOCK_S)
|| !lock_rec_other_has_expl_req(LOCK_X, 0, LOCK_WAIT,
@@ -2017,9 +1988,7 @@ lock_rec_lock_fast(
ulint heap_no;
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
@@ -2102,9 +2071,7 @@ lock_rec_lock_slow(
trx_t* trx;
ulint err;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
@@ -2176,9 +2143,7 @@ lock_rec_lock(
{
ulint err;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad((LOCK_MODE_MASK & mode) != LOCK_S
|| lock_table_has(thr_get_trx(thr), index->table, LOCK_IS));
ut_ad((LOCK_MODE_MASK & mode) != LOCK_X
@@ -2216,9 +2181,7 @@ lock_rec_has_to_wait_in_queue(
ulint page_no;
ulint heap_no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(lock_get_wait(wait_lock));
ut_ad(lock_get_type(wait_lock) == LOCK_REC);
@@ -2251,9 +2214,7 @@ lock_grant(
/*=======*/
lock_t* lock) /* in: waiting lock request */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock_reset_lock_and_trx_wait(lock);
@@ -2298,9 +2259,7 @@ lock_rec_cancel(
/*============*/
lock_t* lock) /* in: waiting record lock request */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(lock_get_type(lock) == LOCK_REC);
/* Reset the bit (there can be only one set bit) in the lock bitmap */
@@ -2333,9 +2292,7 @@ lock_rec_dequeue_from_page(
lock_t* lock;
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(lock_get_type(in_lock) == LOCK_REC);
trx = in_lock->trx;
@@ -2378,9 +2335,7 @@ lock_rec_discard(
ulint page_no;
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(lock_get_type(in_lock) == LOCK_REC);
trx = in_lock->trx;
@@ -2409,9 +2364,7 @@ lock_rec_free_all_from_discard_page(
lock_t* lock;
lock_t* next_lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
space = buf_frame_get_space_id(page);
page_no = buf_frame_get_page_no(page);
@@ -2444,9 +2397,7 @@ lock_rec_reset_and_release_wait(
lock_t* lock;
ulint heap_no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
heap_no = rec_get_heap_no(rec, page_rec_is_comp(rec));
@@ -2477,9 +2428,8 @@ lock_rec_inherit_to_gap(
the locks on this record */
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock = lock_rec_get_first(rec);
@@ -2518,9 +2468,8 @@ lock_rec_inherit_to_gap_if_gap_lock(
the locks on this record */
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock = lock_rec_get_first(rec);
@@ -2554,9 +2503,7 @@ lock_rec_move(
ulint heap_no;
ulint type_mode;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
heap_no = rec_get_heap_no(donator, comp);
@@ -3228,9 +3175,7 @@ lock_deadlock_occurs(
ulint cost = 0;
ut_ad(trx && lock);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
retry:
/* We check that adding this trx to the waits-for graph
does not produce a cycle. First mark all active transactions
@@ -3302,9 +3247,7 @@ lock_deadlock_recursive(
ulint ret;
ut_a(trx && start && wait_lock);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (trx->deadlock_mark == 1) {
/* We have already exhaustively searched the subtree starting
@@ -3315,12 +3258,6 @@ lock_deadlock_recursive(
*cost = *cost + 1;
- if ((depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK)
- || (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK)) {
-
- return(LOCK_VICTIM_IS_START);
- }
-
lock = wait_lock;
if (lock_get_type(wait_lock) == LOCK_REC) {
@@ -3353,11 +3290,18 @@ lock_deadlock_recursive(
if (lock_has_to_wait(wait_lock, lock)) {
+ ibool too_far
+ = depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK
+ || *cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK;
+
lock_trx = lock->trx;
- if (lock_trx == start) {
+ if (lock_trx == start || too_far) {
+
/* We came back to the recursion starting
- point: a deadlock detected */
+ point: a deadlock detected; or we have
+ searched the waits-for graph too long */
+
FILE* ef = lock_latest_err_file;
rewind(ef);
@@ -3399,9 +3343,20 @@ lock_deadlock_recursive(
}
#ifdef UNIV_DEBUG
if (lock_print_waits) {
- fputs("Deadlock detected\n", stderr);
+ fputs("Deadlock detected"
+ " or too long search\n",
+ stderr);
}
#endif /* UNIV_DEBUG */
+ if (too_far) {
+
+ fputs("TOO DEEP OR LONG SEARCH"
+ " IN THE LOCK TABLE"
+ " WAITS-FOR GRAPH\n", ef);
+
+ return(LOCK_VICTIM_IS_START);
+ }
+
if (ut_dulint_cmp(wait_lock->trx->undo_no,
start->undo_no) >= 0) {
/* Our recursion starting point
@@ -3472,9 +3427,7 @@ lock_table_create(
lock_t* lock;
ut_ad(table && trx);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (type_mode == LOCK_AUTO_INC) {
/* Only one trx can have the lock on the table
@@ -3519,9 +3472,7 @@ lock_table_remove_low(
dict_table_t* table;
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
table = lock->un_member.tab_lock.table;
trx = lock->trx;
@@ -3555,9 +3506,7 @@ lock_table_enqueue_waiting(
lock_t* lock;
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* Test if there already is some other reason to suspend thread:
we do not enqueue a lock request if the query thread should be
@@ -3630,9 +3579,7 @@ lock_table_other_has_incompatible(
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock = UT_LIST_GET_LAST(table->locks);
@@ -3786,9 +3733,7 @@ lock_table_dequeue(
{
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(lock_get_type(in_lock) == LOCK_TABLE);
lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, in_lock);
@@ -3930,9 +3875,7 @@ lock_release_off_kernel(
ulint count;
lock_t* lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock = UT_LIST_GET_LAST(trx->trx_locks);
@@ -3993,9 +3936,7 @@ lock_cancel_waiting_and_release(
/*============================*/
lock_t* lock) /* in: waiting lock request */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (lock_get_type(lock) == LOCK_REC) {
@@ -4028,9 +3969,7 @@ lock_reset_all_on_table_for_trx(
lock_t* lock;
lock_t* prev_lock;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
lock = UT_LIST_GET_LAST(trx->trx_locks);
@@ -4091,9 +4030,7 @@ lock_table_print(
FILE* file, /* in: file where to print */
lock_t* lock) /* in: table type lock */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(lock_get_type(lock) == LOCK_TABLE);
fputs("TABLE LOCK table ", file);
@@ -4143,9 +4080,7 @@ lock_rec_print(
ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(lock_get_type(lock) == LOCK_REC);
space = lock->un_member.rec_lock.space;
@@ -4250,9 +4185,7 @@ lock_get_n_rec_locks(void)
ulint n_locks = 0;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < hash_get_n_cells(lock_sys->rec_hash); i++) {
@@ -4492,9 +4425,7 @@ lock_table_queue_validate(
lock_t* lock;
ibool is_waiting;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
is_waiting = FALSE;
@@ -4665,9 +4596,7 @@ lock_rec_validate_page(
ulint* offsets = offsets_;
*offsets_ = (sizeof offsets_) / sizeof *offsets_;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
@@ -4943,9 +4872,7 @@ lock_rec_convert_impl_to_expl(
{
trx_t* impl_trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(page_rec_is_user_rec(rec));
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(!page_rec_is_comp(rec) == !rec_offs_comp(offsets));
diff --git a/storage/innobase/log/log0log.c b/storage/innobase/log/log0log.c
index 5d8875f1bd0..e9dedf6aac4 100644
--- a/storage/innobase/log/log0log.c
+++ b/storage/innobase/log/log0log.c
@@ -165,9 +165,7 @@ log_buf_pool_get_oldest_modification(void)
{
dulint lsn;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
lsn = buf_pool_get_oldest_modification();
@@ -269,9 +267,7 @@ log_write_low(
ulint data_len;
byte* log_block;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
part_loop:
/* Calculate a part length */
@@ -340,9 +336,7 @@ log_close(void)
log_t* log = log_sys;
ulint checkpoint_age;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
lsn = log->lsn;
@@ -464,9 +458,7 @@ log_group_get_capacity(
/* out: capacity in bytes */
log_group_t* group) /* in: log group */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
return((group->file_size - LOG_FILE_HDR_SIZE) * group->n_files);
}
@@ -482,9 +474,7 @@ log_group_calc_size_offset(
ulint offset, /* in: real offset within the log group */
log_group_t* group) /* in: log group */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
return(offset - LOG_FILE_HDR_SIZE * (1 + offset / group->file_size));
}
@@ -500,9 +490,7 @@ log_group_calc_real_offset(
ulint offset, /* in: size offset within the log group */
log_group_t* group) /* in: log group */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
return(offset + LOG_FILE_HDR_SIZE
* (1 + offset / (group->file_size - LOG_FILE_HDR_SIZE)));
@@ -525,9 +513,7 @@ log_group_calc_lsn_offset(
ib_longlong group_size;
ib_longlong offset;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* If total log file size is > 2 GB we can easily get overflows
with 32-bit integers. Use 64-bit integers instead. */
@@ -642,9 +628,7 @@ log_calc_max_ages(void)
ulint archive_margin;
ulint smallest_archive_margin;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(log_sys->mutex));
@@ -942,9 +926,7 @@ log_flush_do_unlocks(
ulint code) /* in: any ORed combination of LOG_UNLOCK_FLUSH_LOCK
and LOG_UNLOCK_NONE_FLUSHED_LOCK */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* NOTE that we must own the log mutex when doing the setting of the
events: this is because transactions will wait for these events to
@@ -976,9 +958,7 @@ log_group_check_flush_completion(
/* out: LOG_UNLOCK_NONE_FLUSHED_LOCK or 0 */
log_group_t* group) /* in: log group */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (!log_sys->one_flushed && group->n_pending_writes == 0) {
#ifdef UNIV_DEBUG
@@ -1015,9 +995,7 @@ log_sys_check_flush_completion(void)
ulint move_start;
ulint move_end;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (log_sys->n_pending_writes == 0) {
@@ -1129,10 +1107,8 @@ log_group_file_header_flush(
{
byte* buf;
ulint dest_offset;
-#ifdef UNIV_SYNC_DEBUG
- ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+ ut_ad(mutex_own(&(log_sys->mutex)));
ut_a(nth_file < group->n_files);
buf = *(group->file_header_bufs + nth_file);
@@ -1203,9 +1179,7 @@ log_group_write_buf(
ulint next_offset;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(len % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_a(ut_dulint_get_low(start_lsn) % OS_FILE_LOG_BLOCK_SIZE == 0);
@@ -1626,9 +1600,7 @@ void
log_complete_checkpoint(void)
/*=========================*/
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(log_sys->n_pending_checkpoint_writes == 0);
log_sys->next_checkpoint_no
@@ -1715,9 +1687,7 @@ log_group_checkpoint(
byte* buf;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
#if LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE
# error "LOG_CHECKPOINT_SIZE > OS_FILE_LOG_BLOCK_SIZE"
#endif
@@ -1882,9 +1852,7 @@ log_group_read_checkpoint_info(
log_group_t* group, /* in: log group */
ulint field) /* in: LOG_CHECKPOINT_1 or LOG_CHECKPOINT_2 */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
log_sys->n_log_ios++;
@@ -1902,9 +1870,7 @@ log_groups_write_checkpoint_info(void)
{
log_group_t* group;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
group = UT_LIST_GET_FIRST(log_sys->log_groups);
@@ -2162,9 +2128,7 @@ log_group_read_log_seg(
ulint source_offset;
ibool sync;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
sync = FALSE;
@@ -2237,9 +2201,7 @@ log_group_archive_file_header_write(
byte* buf;
ulint dest_offset;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(nth_file < group->n_files);
@@ -2276,9 +2238,7 @@ log_group_archive_completed_header_write(
byte* buf;
ulint dest_offset;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(nth_file < group->n_files);
buf = *(group->archive_file_header_bufs + nth_file);
@@ -2317,9 +2277,7 @@ log_group_archive(
ulint n_files;
ulint open_mode;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
start_lsn = log_sys->archived_lsn;
@@ -2452,9 +2410,7 @@ log_archive_groups(void)
{
log_group_t* group;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
group = UT_LIST_GET_FIRST(log_sys->log_groups);
@@ -2477,9 +2433,7 @@ log_archive_write_complete_groups(void)
dulint end_lsn;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
group = UT_LIST_GET_FIRST(log_sys->log_groups);
@@ -2546,9 +2500,7 @@ void
log_archive_check_completion_low(void)
/*==================================*/
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (log_sys->n_pending_archive_ios == 0
&& log_sys->archiving_phase == LOG_ARCHIVE_READ) {
@@ -2784,9 +2736,7 @@ log_archive_close_groups(
log_group_t* group;
ulint trunc_len;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (log_sys->archiving_state == LOG_ARCH_OFF) {
@@ -3278,9 +3228,7 @@ log_check_log_recs(
byte* buf1;
byte* scan_buf;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (len == 0) {
@@ -3322,7 +3270,7 @@ log_peek_lsn(
log system mutex */
dulint* lsn) /* out: if returns TRUE, current lsn is here */
{
- if (0 == mutex_enter_nowait(&(log_sys->mutex), __FILE__, __LINE__)) {
+ if (0 == mutex_enter_nowait(&(log_sys->mutex))) {
*lsn = log_sys->lsn;
mutex_exit(&(log_sys->mutex));
diff --git a/storage/innobase/log/log0recv.c b/storage/innobase/log/log0recv.c
index 41e2b921664..ab5f42e3a13 100644
--- a/storage/innobase/log/log0recv.c
+++ b/storage/innobase/log/log0recv.c
@@ -171,9 +171,8 @@ void
recv_sys_empty_hash(void)
/*=====================*/
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(recv_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+
if (recv_sys->n_addrs != 0) {
fprintf(stderr,
"InnoDB: Error: %lu pages with log records"
@@ -1396,9 +1395,8 @@ loop:
goto loop;
}
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
if (!allow_ibuf) {
recv_no_ibuf_operations = TRUE;
}
@@ -1842,9 +1840,7 @@ recv_parse_log_recs(
byte* body;
ulint n_recs;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(!ut_dulint_is_zero(recv_sys->parse_start_lsn));
loop:
ptr = recv_sys->buf + recv_sys->recovered_offset;
@@ -2894,9 +2890,8 @@ recv_reset_logs(
{
log_group_t* group;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(log_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+
log_sys->lsn = ut_dulint_align_up(lsn, OS_FILE_LOG_BLOCK_SIZE);
group = UT_LIST_GET_FIRST(log_sys->log_groups);
diff --git a/storage/innobase/mem/mem0pool.c b/storage/innobase/mem/mem0pool.c
index a7acd331e16..c010ae61160 100644
--- a/storage/innobase/mem/mem0pool.c
+++ b/storage/innobase/mem/mem0pool.c
@@ -257,9 +257,7 @@ mem_pool_fill_free_list(
mem_area_t* area2;
ibool ret;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(pool->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (i >= 63) {
/* We come here when we have run out of space in the
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index c4d051ec771..60ba941dbbf 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -930,7 +930,7 @@ try_again:
file = CreateFile((LPCTSTR) name,
access,
FILE_SHARE_READ | FILE_SHARE_WRITE,
- /* file can be read ansd written also
+ /* file can be read and written also
by other processes */
NULL, /* default security attributes */
create_flag,
@@ -1509,7 +1509,7 @@ os_file_rename(
return(TRUE);
}
- os_file_handle_error(oldpath, "rename");
+ os_file_handle_error_no_exit(oldpath, "rename");
return(FALSE);
#else
@@ -1518,7 +1518,7 @@ os_file_rename(
ret = rename((const char*)oldpath, (const char*)newpath);
if (ret != 0) {
- os_file_handle_error(oldpath, "rename");
+ os_file_handle_error_no_exit(oldpath, "rename");
return(FALSE);
}
diff --git a/storage/innobase/pars/pars0pars.c b/storage/innobase/pars/pars0pars.c
index 6861844870c..16530494a96 100644
--- a/storage/innobase/pars/pars0pars.c
+++ b/storage/innobase/pars/pars0pars.c
@@ -1859,10 +1859,9 @@ pars_sql(
heap = mem_heap_create(256);
-#ifdef UNIV_SYNC_DEBUG
/* Currently, the parser is not reentrant: */
ut_ad(mutex_own(&(dict_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+
pars_sym_tab_global = sym_tab_create(heap);
pars_sym_tab_global->string_len = strlen(str);
diff --git a/storage/innobase/que/que0que.c b/storage/innobase/que/que0que.c
index f5a63ae6ffa..bf83f28f04e 100644
--- a/storage/innobase/que/que0que.c
+++ b/storage/innobase/que/que0que.c
@@ -127,9 +127,7 @@ que_graph_publish(
que_t* graph, /* in: graph */
sess_t* sess) /* in: session */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
UT_LIST_ADD_LAST(graphs, sess->graphs, graph);
}
@@ -238,9 +236,7 @@ que_thr_end_wait(
{
ibool was_active;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
@@ -280,9 +276,7 @@ que_thr_end_wait_no_next_thr(
ut_a(thr->state == QUE_THR_LOCK_WAIT); /* In MySQL this is the
only possible state here */
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(thr);
ut_ad((thr->state == QUE_THR_LOCK_WAIT)
|| (thr->state == QUE_THR_PROCEDURE_WAIT)
@@ -419,9 +413,7 @@ que_fork_error_handle(
{
que_thr_t* thr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->sess->state == SESS_ERROR);
ut_ad(UT_LIST_GET_LEN(trx->reply_signals) == 0);
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
@@ -698,9 +690,7 @@ que_graph_try_free(
{
sess_t* sess;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
sess = (graph->trx)->sess;
@@ -931,9 +921,7 @@ que_thr_stop(
que_t* graph;
ibool ret = TRUE;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
graph = thr->graph;
trx = graph->trx;
@@ -1309,10 +1297,7 @@ que_run_threads_low(
ut_ad(thr->state == QUE_THR_RUNNING);
ut_a(thr_get_trx(thr)->error_state == DB_SUCCESS);
-
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* cumul_resource counts how much resources the OS thread (NOT the
query thread) has spent in this function */
diff --git a/storage/innobase/read/read0read.c b/storage/innobase/read/read0read.c
index 2375c35190a..10a6e07e96a 100644
--- a/storage/innobase/read/read0read.c
+++ b/storage/innobase/read/read0read.c
@@ -162,9 +162,8 @@ read_view_oldest_copy_or_open_new(
ulint n;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
old_view = UT_LIST_GET_LAST(trx_sys->view_list);
if (old_view == NULL) {
@@ -245,9 +244,9 @@ read_view_open_now(
read_view_t* view;
trx_t* trx;
ulint n;
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
view = read_view_create_low(UT_LIST_GET_LEN(trx_sys->trx_list), heap);
view->creator_trx_id = cr_trx_id;
@@ -313,9 +312,8 @@ read_view_close(
/*============*/
read_view_t* view) /* in: read view */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
UT_LIST_REMOVE(view_list, trx_sys->view_list, view);
}
diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
index 78851c7b4f9..7c9427db0d2 100644
--- a/storage/innobase/row/row0mysql.c
+++ b/storage/innobase/row/row0mysql.c
@@ -1748,8 +1748,8 @@ row_create_table_for_mysql(
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
- ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
+ ut_ad(mutex_own(&(dict_sys->mutex)));
ut_ad(trx->dict_operation_lock_mode == RW_X_LATCH);
if (srv_created_new_raw) {
@@ -1964,8 +1964,8 @@ row_create_index_for_mysql(
#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
- ut_ad(mutex_own(&(dict_sys->mutex)));
#endif /* UNIV_SYNC_DEBUG */
+ ut_ad(mutex_own(&(dict_sys->mutex)));
ut_ad(trx->mysql_thread_id == os_thread_get_curr_id());
trx->op_info = "creating index";
@@ -2080,8 +2080,8 @@ row_table_add_foreign_constraints(
{
ulint err;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
ut_a(sql_string);
@@ -2246,9 +2246,7 @@ row_get_background_drop_list_len_low(void)
/*======================================*/
/* out: how many tables in list */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (!row_mysql_drop_list_inited) {
@@ -2726,8 +2724,8 @@ row_truncate_table_for_mysql(
row_mysql_lock_data_dictionary(trx);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
@@ -3001,8 +2999,8 @@ row_drop_table_for_mysql(
locked_dictionary = TRUE;
}
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(dict_sys->mutex)));
+#ifdef UNIV_SYNC_DEBUG
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
#endif /* UNIV_SYNC_DEBUG */
diff --git a/storage/innobase/row/row0undo.c b/storage/innobase/row/row0undo.c
index 2f04e65e8ee..f03f84ed1b0 100644
--- a/storage/innobase/row/row0undo.c
+++ b/storage/innobase/row/row0undo.c
@@ -213,7 +213,7 @@ row_undo(
ulint err;
trx_t* trx;
dulint roll_ptr;
- ibool froze_data_dict = FALSE;
+ ibool locked_data_dict;
ut_ad(node && thr);
@@ -266,13 +266,13 @@ row_undo(
/* Prevent DROP TABLE etc. while we are rolling back this row.
If we are doing a TABLE CREATE or some other dictionary operation,
then we already have dict_operation_lock locked in x-mode. Do not
- try to lock again in s-mode, because that would cause a hang. */
+ try to lock again, because that would cause a hang. */
- if (trx->dict_operation_lock_mode == 0) {
+ locked_data_dict = (trx->dict_operation_lock_mode == 0);
- row_mysql_freeze_data_dictionary(trx);
+ if (locked_data_dict) {
- froze_data_dict = TRUE;
+ row_mysql_lock_data_dictionary(trx);
}
if (node->state == UNDO_NODE_INSERT) {
@@ -285,9 +285,9 @@ row_undo(
err = row_undo_mod(node, thr);
}
- if (froze_data_dict) {
+ if (locked_data_dict) {
- row_mysql_unfreeze_data_dictionary(trx);
+ row_mysql_unlock_data_dictionary(trx);
}
/* Do some cleanup */
diff --git a/storage/innobase/row/row0vers.c b/storage/innobase/row/row0vers.c
index c8b71965f75..03d9a2f1203 100644
--- a/storage/innobase/row/row0vers.c
+++ b/storage/innobase/row/row0vers.c
@@ -63,8 +63,8 @@ row_vers_impl_x_locked_off_kernel(
mtr_t mtr;
ulint comp;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
+#ifdef UNIV_SYNC_DEBUG
ut_ad(!rw_lock_own(&(purge_sys->latch), RW_LOCK_SHARED));
#endif /* UNIV_SYNC_DEBUG */
diff --git a/storage/innobase/srv/srv0que.c b/storage/innobase/srv/srv0que.c
index 9c261cbb00e..e2b4e217980 100644
--- a/storage/innobase/srv/srv0que.c
+++ b/storage/innobase/srv/srv0que.c
@@ -82,10 +82,7 @@ srv_que_task_enqueue_low(
que_thr_t* thr) /* in: query thread */
{
ut_ad(thr);
-
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
UT_LIST_ADD_LAST(queue, srv_sys->tasks, thr);
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index 2a177ed26cd..72e8fe751d0 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -726,9 +726,7 @@ srv_suspend_thread(void)
ulint slot_no;
ulint type;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
slot_no = thr_local_get_slot_no(os_thread_get_curr_id());
@@ -780,9 +778,7 @@ srv_release_threads(
ut_ad(type >= SRV_WORKER);
ut_ad(type <= SRV_MASTER);
ut_ad(n > 0);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < OS_THREAD_MAX_N; i++) {
@@ -1305,9 +1301,7 @@ srv_table_reserve_slot_for_mysql(void)
srv_slot_t* slot;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
i = 0;
slot = srv_mysql_table + i;
@@ -1387,9 +1381,7 @@ srv_suspend_mysql_thread(
ulint sec;
ulint ms;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx = thr_get_trx(thr);
@@ -1535,9 +1527,7 @@ srv_release_mysql_thread_if_suspended(
srv_slot_t* slot;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
for (i = 0; i < OS_THREAD_MAX_N; i++) {
@@ -1830,15 +1820,15 @@ srv_export_innodb_status(void)
export_vars.innodb_row_lock_waits = srv_n_lock_wait_count;
export_vars.innodb_row_lock_current_waits
= srv_n_lock_wait_current_count;
- export_vars.innodb_row_lock_time = srv_n_lock_wait_time / 10000;
+ export_vars.innodb_row_lock_time = srv_n_lock_wait_time / 1000;
if (srv_n_lock_wait_count > 0) {
export_vars.innodb_row_lock_time_avg = (ulint)
- (srv_n_lock_wait_time / 10000 / srv_n_lock_wait_count);
+ (srv_n_lock_wait_time / 1000 / srv_n_lock_wait_count);
} else {
export_vars.innodb_row_lock_time_avg = 0;
}
export_vars.innodb_row_lock_time_max
- = srv_n_lock_max_wait_time / 10000;
+ = srv_n_lock_max_wait_time / 1000;
export_vars.innodb_rows_read = srv_n_rows_read;
export_vars.innodb_rows_inserted = srv_n_rows_inserted;
export_vars.innodb_rows_updated = srv_n_rows_updated;
diff --git a/storage/innobase/sync/sync0rw.c b/storage/innobase/sync/sync0rw.c
index f06db577bad..34b45e2c1c3 100644
--- a/storage/innobase/sync/sync0rw.c
+++ b/storage/innobase/sync/sync0rw.c
@@ -339,9 +339,8 @@ rw_lock_x_lock_low(
const char* file_name,/* in: file name where lock requested */
ulint line) /* in: line where requested */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(rw_lock_get_mutex(lock)));
-#endif /* UNIV_SYNC_DEBUG */
+
if (rw_lock_get_writer(lock) == RW_LOCK_NOT_LOCKED) {
if (rw_lock_get_reader_count(lock) == 0) {
@@ -564,8 +563,7 @@ rw_lock_debug_mutex_enter(void)
/*==========================*/
{
loop:
- if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- __FILE__, __LINE__)) {
+ if (0 == mutex_enter_nowait(&rw_lock_debug_mutex)) {
return;
}
@@ -573,8 +571,7 @@ loop:
rw_lock_debug_waiters = TRUE;
- if (0 == mutex_enter_nowait(&rw_lock_debug_mutex,
- __FILE__, __LINE__)) {
+ if (0 == mutex_enter_nowait(&rw_lock_debug_mutex)) {
return;
}
diff --git a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
index c0198469491..672e1f93aad 100644
--- a/storage/innobase/sync/sync0sync.c
+++ b/storage/innobase/sync/sync0sync.c
@@ -311,12 +311,13 @@ mutex_free(
}
/************************************************************************
-Tries to lock the mutex for the current thread. If the lock is not acquired
-immediately, returns with return value 1. */
+NOTE! Use the corresponding macro in the header file, not this function
+directly. Tries to lock the mutex for the current thread. If the lock is not
+acquired immediately, returns with return value 1. */
ulint
-mutex_enter_nowait(
-/*===============*/
+mutex_enter_nowait_func(
+/*====================*/
/* out: 0 if succeed, 1 if not */
mutex_t* mutex, /* in: pointer to mutex */
const char* file_name __attribute__((unused)),
@@ -329,6 +330,7 @@ mutex_enter_nowait(
if (!mutex_test_and_set(mutex)) {
+ ut_d(mutex->thread_id = os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
@@ -346,13 +348,29 @@ Checks that the mutex has been initialized. */
ibool
mutex_validate(
/*===========*/
- mutex_t* mutex)
+ const mutex_t* mutex)
{
ut_a(mutex);
ut_a(mutex->magic_n == MUTEX_MAGIC_N);
return(TRUE);
}
+
+/**********************************************************************
+Checks that the current thread owns the mutex. Works only in the debug
+version. */
+
+ibool
+mutex_own(
+/*======*/
+ /* out: TRUE if owns */
+ const mutex_t* mutex) /* in: mutex */
+{
+ ut_ad(mutex_validate(mutex));
+
+ return(mutex_get_lock_word(mutex) == 1
+ && os_thread_eq(mutex->thread_id, os_thread_get_curr_id()));
+}
#endif /* UNIV_DEBUG */
/**********************************************************************
@@ -451,6 +469,7 @@ spin_loop:
if (mutex_test_and_set(mutex) == 0) {
/* Succeeded! */
+ ut_d(mutex->thread_id = os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
@@ -492,6 +511,7 @@ spin_loop:
sync_array_free_cell_protected(sync_primary_wait_array,
index);
+ ut_d(mutex->thread_id = os_thread_get_curr_id());
#ifdef UNIV_SYNC_DEBUG
mutex_set_debug_info(mutex, file_name, line);
#endif
@@ -592,7 +612,6 @@ mutex_set_debug_info(
mutex->file_name = file_name;
mutex->line = line;
- mutex->thread_id = os_thread_get_curr_id();
}
/**********************************************************************
@@ -615,31 +634,6 @@ mutex_get_debug_info(
}
/**********************************************************************
-Checks that the current thread owns the mutex. Works only in the debug
-version. */
-
-ibool
-mutex_own(
-/*======*/
- /* out: TRUE if owns */
- mutex_t* mutex) /* in: mutex */
-{
- ut_ad(mutex_validate(mutex));
-
- if (mutex_get_lock_word(mutex) != 1) {
-
- return(FALSE);
- }
-
- if (!os_thread_eq(mutex->thread_id, os_thread_get_curr_id())) {
-
- return(FALSE);
- }
-
- return(TRUE);
-}
-
-/**********************************************************************
Prints debug info of currently reserved mutexes. */
static
void
diff --git a/storage/innobase/thr/thr0loc.c b/storage/innobase/thr/thr0loc.c
index f22e909f392..b803bd53101 100644
--- a/storage/innobase/thr/thr0loc.c
+++ b/storage/innobase/thr/thr0loc.c
@@ -64,9 +64,7 @@ thr_local_get(
try_again:
ut_ad(thr_local_hash);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&thr_local_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* Look for the local struct in the hash table */
diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
index 11e089ac90e..f0e85ef1604 100644
--- a/storage/innobase/trx/trx0purge.c
+++ b/storage/innobase/trx/trx0purge.c
@@ -197,9 +197,7 @@ void
trx_purge_sys_create(void)
/*======================*/
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
purge_sys = mem_alloc(sizeof(trx_purge_t));
@@ -223,7 +221,7 @@ trx_purge_sys_create(void)
purge_sys->trx = purge_sys->sess->trx;
- purge_sys->trx->type = TRX_PURGE;
+ purge_sys->trx->is_purge = 1;
ut_a(trx_start_low(purge_sys->trx, ULINT_UNDEFINED));
@@ -260,9 +258,8 @@ trx_purge_add_update_undo_to_history(
ut_ad(undo);
rseg = undo->rseg;
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
rseg_header = trx_rsegf_get(rseg->space, rseg->page_no, mtr);
@@ -341,9 +338,7 @@ trx_purge_free_segment(
/* fputs("Freeing an update undo log segment\n", stderr); */
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
loop:
mtr_start(&mtr);
mutex_enter(&(rseg->mutex));
@@ -445,9 +440,7 @@ trx_purge_truncate_rseg_history(
ulint n_removed_logs = 0;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
mutex_enter(&(rseg->mutex));
@@ -537,9 +530,7 @@ trx_purge_truncate_history(void)
dulint limit_trx_no;
dulint limit_undo_no;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx_purge_arr_get_biggest(purge_sys->arr, &limit_trx_no,
&limit_undo_no);
@@ -579,9 +570,7 @@ trx_purge_truncate_if_arr_empty(void)
/*=================================*/
/* out: TRUE if array empty */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (purge_sys->arr->n_used == 0) {
@@ -610,9 +599,7 @@ trx_purge_rseg_get_next_history_log(
ibool del_marks;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
mutex_enter(&(rseg->mutex));
@@ -715,9 +702,7 @@ trx_purge_choose_next_log(void)
ulint offset = 0; /* remove warning (??? bug ???) */
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(purge_sys->next_stored == FALSE);
rseg = UT_LIST_GET_FIRST(trx_sys->rseg_list);
@@ -818,9 +803,7 @@ trx_purge_get_next_rec(
ulint cmpl_info;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(purge_sys->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(purge_sys->next_stored);
space = purge_sys->rseg->space;
diff --git a/storage/innobase/trx/trx0roll.c b/storage/innobase/trx/trx0roll.c
index 201d1be3656..91dcf035f96 100644
--- a/storage/innobase/trx/trx0roll.c
+++ b/storage/innobase/trx/trx0roll.c
@@ -785,10 +785,8 @@ trx_roll_try_truncate(
dulint limit;
dulint biggest;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&((trx->rseg)->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx->pages_undone = 0;
@@ -831,9 +829,7 @@ trx_roll_pop_top_rec(
trx_undo_rec_t* prev_rec;
page_t* prev_rec_page;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
undo_page = trx_undo_page_get_s_latched(undo->space,
undo->top_page_no, mtr);
@@ -1060,9 +1056,7 @@ trx_rollback(
que_thr_t* thr;
/* que_thr_t* thr2; */
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad((trx->undo_no_arr == NULL) || ((trx->undo_no_arr)->n_used == 0));
/* Initialize the rollback field in the transaction */
@@ -1131,9 +1125,7 @@ trx_roll_graph_build(
que_thr_t* thr;
/* que_thr_t* thr2; */
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
heap = mem_heap_create(512);
fork = que_fork_create(NULL, NULL, QUE_FORK_ROLLBACK, heap);
@@ -1160,9 +1152,7 @@ trx_finish_error_processing(
trx_sig_t* sig;
trx_sig_t* next_sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->signals);
@@ -1195,9 +1185,7 @@ trx_finish_partial_rollback_off_kernel(
{
trx_sig_t* sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->signals);
@@ -1228,9 +1216,7 @@ trx_finish_rollback_off_kernel(
trx_sig_t* sig;
trx_sig_t* next_sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_a(trx->undo_no_arr == NULL || trx->undo_no_arr->n_used == 0);
diff --git a/storage/innobase/trx/trx0rseg.c b/storage/innobase/trx/trx0rseg.c
index 7a6989c7b4f..020f217c90b 100644
--- a/storage/innobase/trx/trx0rseg.c
+++ b/storage/innobase/trx/trx0rseg.c
@@ -60,9 +60,7 @@ trx_rseg_header_create(
page_t* page;
ut_ad(mtr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(mtr_memo_contains(mtr, fil_space_get_latch(space),
MTR_MEMO_X_LOCK));
sys_header = trx_sysf_get(mtr);
@@ -138,9 +136,7 @@ trx_rseg_mem_create(
ulint sum_of_undo_sizes;
ulint len;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
rseg = mem_alloc(sizeof(trx_rseg_t));
diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
index b87f3d5e090..307a03bfbc3 100644
--- a/storage/innobase/trx/trx0sys.c
+++ b/storage/innobase/trx/trx0sys.c
@@ -547,9 +547,7 @@ trx_in_trx_list(
{
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
trx = UT_LIST_GET_FIRST(trx_sys->trx_list);
@@ -576,9 +574,7 @@ trx_sys_flush_max_trx_id(void)
trx_sysf_t* sys_header;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
@@ -799,9 +795,7 @@ trx_sysf_rseg_find_free(
ulint page_no;
ulint i;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(kernel_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
sys_header = trx_sysf_get(mtr);
diff --git a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
index 6f59d2659ec..cdea3e9c477 100644
--- a/storage/innobase/trx/trx0trx.c
+++ b/storage/innobase/trx/trx0trx.c
@@ -101,9 +101,7 @@ trx_create(
{
trx_t* trx;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx = mem_alloc(sizeof(trx_t));
@@ -111,7 +109,7 @@ trx_create(
trx->op_info = "";
- trx->type = TRX_USER;
+ trx->is_purge = 0;
trx->conc_state = TRX_NOT_STARTED;
trx->start_time = time(NULL);
@@ -280,9 +278,7 @@ trx_free(
/*=====*/
trx_t* trx) /* in, own: trx object */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (trx->declared_to_be_inside_innodb) {
ut_print_timestamp(stderr);
@@ -406,9 +402,7 @@ trx_list_insert_ordered(
{
trx_t* trx2;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx2 = UT_LIST_GET_FIRST(trx_sys->trx_list);
@@ -633,9 +627,7 @@ trx_assign_rseg(void)
{
trx_rseg_t* rseg = trx_sys->latest_rseg;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
loop:
/* Get next rseg in a round-robin fashion */
@@ -672,12 +664,10 @@ trx_start_low(
{
trx_rseg_t* rseg;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->rseg == NULL);
- if (trx->type == TRX_PURGE) {
+ if (trx->is_purge) {
trx->id = ut_dulint_zero;
trx->conc_state = TRX_ACTIVE;
trx->start_time = time(NULL);
@@ -749,9 +739,7 @@ trx_commit_off_kernel(
ibool must_flush_log = FALSE;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx->must_flush_log_later = FALSE;
@@ -851,9 +839,7 @@ trx_commit_off_kernel(
ut_ad(trx->conc_state == TRX_ACTIVE
|| trx->conc_state == TRX_PREPARED);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/* The following assignment makes the transaction committed in memory
and makes its changes to data visible to other transactions.
@@ -1036,9 +1022,7 @@ trx_handle_commit_sig_off_kernel(
trx_sig_t* sig;
trx_sig_t* next_sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
trx->que_state = TRX_QUE_COMMITTING;
@@ -1078,9 +1062,7 @@ trx_end_lock_wait(
{
que_thr_t* thr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
@@ -1107,9 +1089,7 @@ trx_lock_wait_to_suspended(
{
que_thr_t* thr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->que_state == TRX_QUE_LOCK_WAIT);
thr = UT_LIST_GET_FIRST(trx->wait_thrs);
@@ -1137,9 +1117,7 @@ trx_sig_reply_wait_to_suspended(
trx_sig_t* sig;
que_thr_t* thr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
sig = UT_LIST_GET_FIRST(trx->reply_signals);
@@ -1172,9 +1150,7 @@ trx_sig_is_compatible(
{
trx_sig_t* sig;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (UT_LIST_GET_LEN(trx->signals) == 0) {
@@ -1260,9 +1236,7 @@ trx_sig_send(
trx_t* receiver_trx;
ut_ad(trx);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (!trx_sig_is_compatible(trx, type, sender)) {
/* The signal is not compatible with the other signals in
@@ -1288,7 +1262,6 @@ trx_sig_send(
UT_LIST_ADD_LAST(signals, trx->signals, sig);
sig->type = type;
- sig->state = TRX_SIG_WAITING;
sig->sender = sender;
sig->receiver = receiver_thr;
@@ -1332,9 +1305,7 @@ trx_end_signal_handling(
/*====================*/
trx_t* trx) /* in: trx */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(trx->handling_signals == TRUE);
trx->handling_signals = FALSE;
@@ -1368,9 +1339,7 @@ loop:
we can process immediately */
ut_ad(trx);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (trx->handling_signals && (UT_LIST_GET_LEN(trx->signals) == 0)) {
@@ -1471,9 +1440,7 @@ trx_sig_reply(
trx_t* receiver_trx;
ut_ad(sig);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
if (sig->receiver != NULL) {
ut_ad((sig->receiver)->state == QUE_THR_SIG_REPLY_WAIT);
@@ -1501,9 +1468,7 @@ trx_sig_remove(
trx_sig_t* sig) /* in, own: signal */
{
ut_ad(trx && sig);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(sig->receiver == NULL);
@@ -1743,7 +1708,7 @@ trx_print(
fputs(trx->op_info, f);
}
- if (trx->type != TRX_USER) {
+ if (trx->is_purge) {
fputs(" purge trx", f);
}
@@ -1820,9 +1785,7 @@ trx_prepare_off_kernel(
dulint lsn;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
@@ -1868,9 +1831,7 @@ trx_prepare_off_kernel(
mutex_enter(&kernel_mutex);
}
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
/*--------------------------------------*/
trx->conc_state = TRX_PREPARED;
diff --git a/storage/innobase/trx/trx0undo.c b/storage/innobase/trx/trx0undo.c
index fbcfab38f01..831e337f513 100644
--- a/storage/innobase/trx/trx0undo.c
+++ b/storage/innobase/trx/trx0undo.c
@@ -395,9 +395,7 @@ trx_undo_seg_create(
ibool success;
ut_ad(mtr && id && rseg_hdr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
/* fputs(type == TRX_UNDO_INSERT
? "Creating insert undo log segment\n"
@@ -836,11 +834,9 @@ trx_undo_add_page(
ulint n_reserved;
ibool success;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(!mutex_own(&kernel_mutex));
ut_ad(mutex_own(&(trx->rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
@@ -911,10 +907,8 @@ trx_undo_free_page(
ulint hist_size;
ut_a(hdr_page_no != page_no);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
undo_page = trx_undo_page_get(space, page_no, mtr);
@@ -961,9 +955,7 @@ trx_undo_free_page_in_rollback(
ulint last_page_no;
ut_ad(undo->hdr_page_no != page_no);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
last_page_no = trx_undo_free_page(undo->rseg, FALSE, undo->space,
undo->hdr_page_no, page_no, mtr);
@@ -1016,10 +1008,8 @@ trx_undo_truncate_end(
trx_rseg_t* rseg;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
ut_ad(mutex_own(&(trx->rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
rseg = trx->rseg;
@@ -1096,9 +1086,7 @@ trx_undo_truncate_start(
ulint page_no;
mtr_t mtr;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (0 == ut_dulint_cmp(limit, ut_dulint_zero)) {
@@ -1164,9 +1152,9 @@ trx_undo_seg_free(
while (!finished) {
mtr_start(&mtr);
-#ifdef UNIV_SYNC_DEBUG
+
ut_ad(!mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
mutex_enter(&(rseg->mutex));
seg_header = trx_undo_page_get(undo->space, undo->hdr_page_no,
@@ -1389,9 +1377,7 @@ trx_undo_mem_create(
{
trx_undo_t* undo;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (id >= TRX_RSEG_N_SLOTS) {
fprintf(stderr,
@@ -1437,11 +1423,9 @@ trx_undo_mem_init_for_reuse(
XID* xid, /* in: X/Open XA transaction identification*/
ulint offset) /* in: undo log header byte offset on page */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&((undo->rseg)->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
- if (undo->id >= TRX_RSEG_N_SLOTS) {
+ if (UNIV_UNLIKELY(undo->id >= TRX_RSEG_N_SLOTS)) {
fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
(ulong) undo->id);
@@ -1501,9 +1485,7 @@ trx_undo_create(
trx_undo_t* undo;
page_t* undo_page;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (rseg->curr_size == rseg->max_size) {
@@ -1561,9 +1543,7 @@ trx_undo_reuse_cached(
page_t* undo_page;
ulint offset;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
if (type == TRX_UNDO_INSERT) {
@@ -1671,15 +1651,12 @@ trx_undo_assign_undo(
rseg = trx->rseg;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(trx->undo_mutex)));
-#endif /* UNIV_SYNC_DEBUG */
mtr_start(&mtr);
-#ifdef UNIV_SYNC_DEBUG
ut_ad(!mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
mutex_enter(&(rseg->mutex));
undo = trx_undo_reuse_cached(trx, rseg, type, trx->id, &trx->xid,
@@ -1836,9 +1813,8 @@ trx_undo_update_cleanup(
undo = trx->update_undo;
rseg = trx->rseg;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&(rseg->mutex)));
-#endif /* UNIV_SYNC_DEBUG */
+
trx_purge_add_update_undo_to_history(trx, undo_page, mtr);
UT_LIST_REMOVE(undo_list, rseg->update_undo_list, undo);
diff --git a/storage/innobase/usr/usr0sess.c b/storage/innobase/usr/usr0sess.c
index ca97ea23e95..3740c05eaab 100644
--- a/storage/innobase/usr/usr0sess.c
+++ b/storage/innobase/usr/usr0sess.c
@@ -32,9 +32,8 @@ sess_open(void)
{
sess_t* sess;
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
sess = mem_alloc(sizeof(sess_t));
sess->state = SESS_ACTIVE;
@@ -54,9 +53,7 @@ sess_close(
/*=======*/
sess_t* sess) /* in, own: session object */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
ut_ad(sess->trx == NULL);
mem_free(sess);
@@ -72,9 +69,8 @@ sess_try_close(
/* out: TRUE if closed */
sess_t* sess) /* in, own: session object */
{
-#ifdef UNIV_SYNC_DEBUG
ut_ad(mutex_own(&kernel_mutex));
-#endif /* UNIV_SYNC_DEBUG */
+
if (UT_LIST_GET_LEN(sess->graphs) == 0) {
sess_close(sess);
diff --git a/storage/innobase/ut/ut0ut.c b/storage/innobase/ut/ut0ut.c
index d805cc3b4b2..bc6778f4c2f 100644
--- a/storage/innobase/ut/ut0ut.c
+++ b/storage/innobase/ut/ut0ut.c
@@ -20,6 +20,55 @@ Created 5/11/1994 Heikki Tuuri
ibool ut_always_false = FALSE;
+#ifdef __WIN__
+/*********************************************************************
+NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix
+epoch starts from 1970/1/1. For selection of constant see:
+http://support.microsoft.com/kb/167296/ */
+#define WIN_TO_UNIX_DELTA_USEC ((ib_longlong) 11644473600000000ULL)
+
+
+/*********************************************************************
+This is the Windows version of gettimeofday(2).*/
+static
+int
+ut_gettimeofday(
+/*============*/
+ /* out: 0 if all OK else -1 */
+ struct timeval* tv, /* out: Values are relative to Unix epoch */
+ void* tz) /* in: not used */
+{
+ FILETIME ft;
+ ib_longlong tm;
+
+ if (!tv) {
+ errno = EINVAL;
+ return(-1);
+ }
+
+ GetSystemTimeAsFileTime(&ft);
+
+ tm = (ib_longlong) ft.dwHighDateTime << 32;
+ tm |= ft.dwLowDateTime;
+
+ ut_a(tm >= 0); /* If tm wraps over to negative, the quotient / 10
+ does not work */
+
+ tm /= 10; /* Convert from 100 nsec periods to usec */
+
+ /* If we don't convert to the Unix epoch the value for
+ struct timeval::tv_sec will overflow.*/
+ tm -= WIN_TO_UNIX_DELTA_USEC;
+
+ tv->tv_sec = (long) (tm / 1000000L);
+ tv->tv_usec = (long) (tm % 1000000L);
+
+ return(0);
+}
+#else
+#define ut_gettimeofday gettimeofday
+#endif
+
#ifndef UNIV_HOTBACKUP
/*********************************************************************
Display an SQL identifier.
@@ -85,17 +134,11 @@ ut_usectime(
ulint* sec, /* out: seconds since the Epoch */
ulint* ms) /* out: microseconds since the Epoch+*sec */
{
-#ifdef __WIN__
- SYSTEMTIME st;
- GetLocalTime(&st);
- *sec = (ulint) st.wSecond;
- *ms = (ulint) st.wMilliseconds;
-#else
struct timeval tv;
- gettimeofday(&tv,NULL);
+
+ ut_gettimeofday(&tv, NULL);
*sec = (ulint) tv.tv_sec;
*ms = (ulint) tv.tv_usec;
-#endif
}
/**************************************************************
diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c
index e4d856624d3..d318f1b0122 100644
--- a/vio/viosslfactories.c
+++ b/vio/viosslfactories.c
@@ -309,6 +309,14 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
{
struct st_VioSSLFd *ssl_fd;
int verify= SSL_VERIFY_PEER;
+
+ /*
+ Turn off verification of servers certificate if both
+ ca_file and ca_path is set to NULL
+ */
+ if (ca_file == 0 && ca_path == 0)
+ verify= SSL_VERIFY_NONE;
+
if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file,
ca_path, cipher, TLSv1_client_method())))
{