+mysql-wsrep-5.6 (5.6.37-0~u14.04+mos0) mos; urgency=medium
+
+ * Update mysql to 5.6.37
+ * d/p/* - quilt refresh to avoid fuzz
+
+ -- Dmitry Teselkin <mos-linux@mirantis.com> Mon, 24 Jul 2017 11:53:55 +0300
+
mysql-wsrep-5.6 (5.6.36-0~u14.04+mos0) mos; urgency=medium
* Update mysql to 5.6.36
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
-@@ -29,9 +29,6 @@
+@@ -31,9 +31,6 @@
syslog_tag_mysqld=mysqld
syslog_tag_mysqld_safe=mysqld_safe
# MySQL-specific environment variable. First off, it's not really a umask,
# it's the desired mode. Second, it follows umask(2), not umask(3) in that
# octal needs to be explicit. Our shell might be a proper sh without printf,
-@@ -169,7 +166,7 @@
+@@ -171,7 +168,7 @@
# sed buffers output (only GNU sed supports a -u (unbuffered) option)
# which means that messages may not get sent to syslog until the
# mysqld process quits.
;;
*)
echo "Internal program error (non-fatal):" \
-@@ -891,6 +888,13 @@
+@@ -897,6 +894,13 @@
fi
#
"${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} -pg")
ENDIF()
+IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ OPTION(REPRODUCIBLE_BUILD "Take extra pains to make build result independent of build location and time" OFF)
+ENDIF()
+IF(REPRODUCIBLE_BUILD)
+ SET(DEBUG_PREFIX_FLAGS
+ "-fdebug-prefix-map=${CMAKE_SOURCE_DIR}/=./ -fdebug-prefix-map=${CMAKE_CURRENT_BINARY_DIR}=./obj")
+
+ # See if -fdebug-prefix= commands are included in the debug output,
+ # making the build unreproducible with switches recorded.
+ # See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69821.
+ EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -g3 -x c -S -fdebug-prefix-map=foo=bar -o - -
+ INPUT_FILE /dev/null OUTPUT_VARIABLE DEBUG_PREFIX_MAP_RESULT)
+ IF(DEBUG_PREFIX_MAP_RESULT MATCHES "foo=bar")
+ SET(DEBUG_PREFIX_FLAGS "${DEBUG_PREFIX_FLAGS} -gno-record-gcc-switches")
+ ENDIF()
+
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${DEBUG_PREFIX_FLAGS}")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO
+ "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${DEBUG_PREFIX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEBUG_PREFIX_FLAGS}")
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO
+ "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${DEBUG_PREFIX_FLAGS}")
+
+ SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--build-id=none")
+ SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -Wl,--build-id=none")
+
+ set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE
+ "${CMAKE_SOURCE_DIR}/scripts/invoke-with-relative-paths.pl")
+ENDIF()
+
OPTION(ENABLED_LOCAL_INFILE
"If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
MARK_AS_ADVANCED(ENABLED_LOCAL_INFILE)
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=6
-MYSQL_VERSION_PATCH=36
+MYSQL_VERSION_PATCH=37
MYSQL_VERSION_EXTRA=
default_pager_set= 0, opt_sigint_ignore= 0,
auto_vertical_output= 0,
show_warnings= 0, executing_query= 0, interrupted_query= 0,
- ignore_spaces= 0;
+ ignore_spaces= 0, opt_binhex= 0;
static my_bool debug_info_flag, debug_check_flag;
static my_bool column_types_flag;
static my_bool preserve_comments= 0;
{"bind-address", 0, "IP address to bind to.",
(uchar**) &opt_bind_addr, (uchar**) &opt_bind_addr, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex,
+ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
tee_puts("", PAGER);
}
+/* Used to determine if we should invoke print_as_hex for this field */
+
+static bool
+is_binary_field(MYSQL_FIELD *field)
+{
+ if ((field->charsetnr == 63) &&
+ (field->type == MYSQL_TYPE_BIT ||
+ field->type == MYSQL_TYPE_BLOB ||
+ field->type == MYSQL_TYPE_LONG_BLOB ||
+ field->type == MYSQL_TYPE_MEDIUM_BLOB ||
+ field->type == MYSQL_TYPE_TINY_BLOB ||
+ field->type == MYSQL_TYPE_VAR_STRING ||
+ field->type == MYSQL_TYPE_STRING ||
+ field->type == MYSQL_TYPE_VARCHAR ||
+ field->type == MYSQL_TYPE_GEOMETRY))
+ return 1;
+ return 0;
+}
+
+
+/* Print binary value as hex literal (0x ...) */
+
+static void
+print_as_hex(FILE *output_file, const char *str, ulong len, ulong total_bytes_to_send)
+{
+ const char *ptr= str, *end= ptr+len;
+ ulong i;
+ fprintf(output_file, "0x");
+ for(; ptr < end; ptr++)
+ fprintf(output_file, "%02X", *((uchar*)ptr));
+ for (i= 2*len+2; i < total_bytes_to_send; i++)
+ tee_putc((int)' ', output_file);
+}
static void
print_table_data(MYSQL_RES *result)
length= max<size_t>(length, field->max_length);
if (length < 4 && !IS_NOT_NULL(field->flags))
length=4; // Room for "NULL"
- field->max_length=length;
+ if (opt_binhex && is_binary_field(field))
+ length= 2 + length * 2;
+ field->max_length=(ulong) length;
separator.fill(separator.length()+length+2,'-');
separator.append('+');
}
many extra padding-characters we should send with the printing function.
*/
visible_length= charset_info->cset->numcells(charset_info, buffer, buffer + data_length);
- extra_padding= data_length - visible_length;
+ extra_padding= (uint) (data_length - visible_length);
- if (field_max_length > MAX_COLUMN_LENGTH)
+ if (opt_binhex && is_binary_field(field))
+ print_as_hex(PAGER, cur[off], lengths[off], field_max_length);
+ else if (field_max_length > MAX_COLUMN_LENGTH)
tee_print_sized_data(buffer, data_length, MAX_COLUMN_LENGTH+extra_padding, FALSE);
else
{
if (interrupted_query)
break;
ulong *lengths=mysql_fetch_lengths(result);
+ field= mysql_fetch_fields(result);
(void) tee_fputs("<TR>", PAGER);
for (uint i=0; i < mysql_num_fields(result); i++)
{
(void) tee_fputs("<TD>", PAGER);
- xmlencode_print(cur[i], lengths[i]);
+ if (opt_binhex && is_binary_field(&field[i]))
+ print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
+ else
+ xmlencode_print(cur[i], lengths[i]);
(void) tee_fputs("</TD>", PAGER);
}
(void) tee_fputs("</TR>", PAGER);
(void) tee_fputs("</TABLE>", PAGER);
}
-
static void
print_table_data_xml(MYSQL_RES *result)
{
if (cur[i])
{
tee_fprintf(PAGER, "\">");
- xmlencode_print(cur[i], lengths[i]);
+ if (opt_binhex && is_binary_field(&fields[i]))
+ print_as_hex(PAGER, cur[i], lengths[i], lengths[i]);
+ else
+ xmlencode_print(cur[i], lengths[i]);
tee_fprintf(PAGER, "</field>\n");
}
else
tee_fprintf(PAGER, "%*s: ",(int) max_length,field->name);
if (cur[off])
{
- tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB);
+ if (opt_binhex && is_binary_field(field))
+ print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
+ else
+ tee_write(PAGER, cur[off], lengths[off], MY_PRINT_SPS_0 | MY_PRINT_MB);
tee_putc('\n', PAGER);
}
else
while ((cur = mysql_fetch_row(result)))
{
lengths=mysql_fetch_lengths(result);
- safe_put_field(cur[0],lengths[0]);
+
+ field= mysql_fetch_fields(result);
+ if (opt_binhex && is_binary_field(&field[0]))
+ print_as_hex(PAGER, cur[0], lengths[0], lengths[0]);
+ else
+ safe_put_field(cur[0],lengths[0]);
+
for (uint off=1 ; off < mysql_num_fields(result); off++)
{
(void) tee_fputs("\t", PAGER);
- safe_put_field(cur[off], lengths[off]);
+
+ if (opt_binhex && field && is_binary_field(&field[off]))
+ print_as_hex(PAGER, cur[off], lengths[off], lengths[off]);
+ else
+ safe_put_field(cur[off], lengths[off]);
}
(void) tee_fputs("\n", PAGER);
}
memset(buff, 0, sizeof(buff));
/*
- In case number of quotes exceed 2, we try to get
- the normalized db name.
+ In case of quotes used, try to get the normalized db name.
*/
- if (get_quote_count(line) > 2)
+ if (get_quote_count(line) > 0)
{
if (normalize_dbname(line, buff, sizeof(buff)))
return put_error(&mysql);
static int
get_quote_count(const char *line)
{
- int quote_count;
- const char *ptr= line;
+ int quote_count= 0;
+ const char *quote= line;
- for(quote_count= 0; ptr ++ && *ptr; ptr= strpbrk(ptr, "\"\'`"))
- quote_count ++;
+ while ((quote= strpbrk(quote, "'`\"")) != NULL) {
+ quote_count++;
+ quote++;
+ }
return quote_count;
}
/*
- Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES)
+/**
+ The function represents Log_event delete wrapper
+ to reset possibly active temp_buf member.
+ It's to be invoked in context where the member is
+ not bound with dynamically allocated memory and therefore can
+ be reset as simple as with plain assignment to NULL.
+
+ @param ev a pointer to Log_event instance
+*/
+inline void reset_temp_buf_and_delete(Log_event *ev)
+{
+ ev->temp_buf= NULL;
+ delete ev;
+}
+
char server_version[SERVER_VERSION_LENGTH];
ulong filter_server_id = 0;
/*
if ((rev->ident_len != logname_len) ||
memcmp(rev->new_log_ident, logname, logname_len))
{
+ reset_temp_buf_and_delete(rev);
DBUG_RETURN(OK_CONTINUE);
}
/*
log. If we are running with to_last_remote_log, we print it,
because it serves as a useful marker between binlogs then.
*/
+ reset_temp_buf_and_delete(rev);
continue;
}
/*
MYF(MY_WME))))
{
error("Could not create log file '%s'", log_file_name);
+ reset_temp_buf_and_delete(ev);
DBUG_RETURN(ERROR_STOP);
}
DBUG_EXECUTE_IF("simulate_result_file_write_error_for_FD_event",
BIN_LOG_HEADER_SIZE, MYF(MY_NABP)))
{
error("Could not write into log file '%s'", log_file_name);
+ reset_temp_buf_and_delete(ev);
DBUG_RETURN(ERROR_STOP);
}
/*
retval= ERROR_STOP;
}
if (ev)
- {
- ev->temp_buf=0;
- delete ev;
- }
+ reset_temp_buf_and_delete(ev);
+ /* Flush result_file after every event */
+ fflush(result_file);
}
else
{
File file;
if ((file= load_processor.prepare_new_file_for_old_format(le,fname)) < 0)
+ {
+ reset_temp_buf_and_delete(ev);
DBUG_RETURN(ERROR_STOP);
+ }
retval= process_event(print_event_info, ev, old_off, logname);
if (retval != OK_CONTINUE)
-/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (*((long *) (A)))
#define uint2korr(A) (*((uint16 *) (A)))
-/*
- Attention: Please, note, uint3korr reads 4 bytes (not 3)!
- It means, that you have to provide enough allocated space.
-*/
-#if defined(HAVE_purify) && !defined(_WIN32)
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16))
-#else
-#define uint3korr(A) (long) (*((unsigned int *) (A)) & 0xFFFFFF)
-#endif
#define uint4korr(A) (*((uint32 *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
-/* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
((uint32) (uchar) (A)[0])))
#define sint4korr(A) (int32) (*((int32 *) (A)))
#define uint2korr(A) (uint16) (*((uint16 *) (A)))
-/*
- Attention: Please, note, uint3korr reads 4 bytes (not 3)!
- It means, that you have to provide enough allocated space.
-*/
-#if defined(HAVE_purify) && !defined(_WIN32)
#define uint3korr(A) (uint32) (((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
(((uint32) ((uchar) (A)[2])) << 16))
-#else
-#define uint3korr(A) (uint32) (*((unsigned int *) (A)) & 0xFFFFFF)
-#endif
#define uint4korr(A) (uint32) (*((uint32 *) (A)))
#define uint5korr(A) ((ulonglong)(((uint32) ((uchar) (A)[0])) +\
(((uint32) ((uchar) (A)[1])) << 8) +\
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#ifdef _WIN32
#include <malloc.h> /*for alloca*/
#endif
+#include <sys/stat.h>
#define MY_INIT(name) { my_progname= name; my_init(); }
typedef int (*qsort2_cmp)(const void *, const void *, const void *);
+/*
+ Subset of struct stat fields filled by stat/lstat/fstat that uniquely
+ identify a file
+*/
+typedef struct st_file_id
+{
+ dev_t st_dev;
+ ino_t st_ino;
+} ST_FILE_ID;
+
typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
extern int my_close(File Filedes,myf MyFlags);
extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
extern int my_readlink(char *to, const char *filename, myf MyFlags);
-extern int my_is_symlink(const char *filename);
+extern int my_is_symlink(const char *filename, ST_FILE_ID *file_id);
extern int my_realpath(char *to, const char *filename, myf MyFlags);
+extern int my_is_same_file(File file, const ST_FILE_ID *file_id);
extern File my_create_with_symlink(const char *linkname, const char *filename,
int createflags, int access_flags,
myf MyFlags);
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
mysql->status= MYSQL_STATUS_READY;
}
int4store(buff, stmt->stmt_id);
- if ((rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt)))
- {
- set_stmt_errmsg(stmt, &mysql->net);
- }
+ /*
+ If stmt_command failed, it would have already raised
+ error using set_mysql_error. Caller should use
+ mysql_error() or mysql_errno() to find out details.
+ Memory allocated for stmt will be released regardless
+ of the error.
+ */
+ rc= stmt_command(mysql, COM_STMT_CLOSE, buff, 4, stmt);
}
}
--- /dev/null
+###############################################################################
+# This .inc is used to check coordinator behaviour of scheduling an event
+# when the new event cannot be placed into worker's queue due to size limit
+# (SLAVE_PENDING_JOBS_SIZE_MAX)
+#
+# Usage:
+# --let $table_to_lock=db1.t
+# --let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES ('small event')
+# --let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max))
+# --let $tables_involved_in_test=db1.t, db2.t
+# --source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc
+#
+# Parameters:
+#
+# $table_to_lock:
+# Provide full table name that needs to be locked using LOCK TABLE.
+# Eg: --let $table_to_lock=db1.t
+#
+# $query_that_waits_on_table_lock:
+# A query that cannot be executed due the lock acquired by LOCK TABLE.
+# Eg: --let $table_to_lock=db1.t
+# --let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES ('small event')
+#
+# $query_that_needs_to_be_processed_by_coordinator:
+# A query that will be processed by coordinator only after
+# $query_that_waits_on_table_lock is completely executed due to size limit
+# (SLAVE_PENDING_JOBS_SIZE_MAX)
+# --let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max))
+#
+# $tables_involved_in_test:
+# Tables that are involved in the test. This list will be used to do diff
+# between master and slave's tables to test that replication worked fine.
+# Eg: --let $tables_involved_in_test=db1.t, db2.t
+#
+###############################################################################
+
+if (!$table_to_lock)
+{
+ --die ERROR IN TEST: you must set $table_to_lock before sourcing rpl_mts_pending_events.inc.
+}
+if (!$query_that_waits_on_table_lock)
+{
+ --die ERROR IN TEST: you must set $query_that_waits_on_table_lock before sourcing rpl_mts_pending_events.inc.
+}
+if (!$query_that_needs_to_be_processed_by_coordinator)
+{
+ --die ERROR IN TEST: you must set $query_that_needs_to_be_processed_by_coordinator before sourcing rpl_mts_pending_events.inc.
+}
+if (!$tables_involved_in_test)
+{
+ --die ERROR IN TEST: you must set $tables_involved_in_test before sourcing rpl_mts_pending_events.inc.
+}
+
+--echo #
+--echo # 1) On Slave, lock one table so that any operation on that
+--echo # will be waiting for the lock to be released.
+--echo #
+--source include/rpl_connection_slave1.inc
+--eval LOCK TABLE $table_to_lock WRITE
+
+--echo #
+--echo # 2) Execute query that is going to wait for the table lock.
+--echo #
+--source include/rpl_connection_master.inc
+--eval $query_that_waits_on_table_lock
+
+--echo #
+--echo # 3) Wait on Slave till a worker picks this event and wait for the
+--echo # lock (which is acquired in step 1)
+--echo #
+--source include/rpl_connection_slave.inc
+--let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for table metadata lock"
+--source include/wait_condition.inc
+
+--echo #
+--echo # 4) Now on Master, insert another query that reaches slave.
+--echo #
+--source include/rpl_connection_master.inc
+--eval $query_that_needs_to_be_processed_by_coordinator
+
+--echo #
+--echo # 5) Check that Coordinator waits for the query (at step 2) to be
+--echo # executed before dedicating this new query (at step 4) to
+--echo # one of the workers because of the event size limits.
+--echo #
+--source include/rpl_connection_slave.inc
+--let $assert_text= Check that one of the applier worker thread is waiting for the table metadata lock.
+--let $assert_cond= [SELECT count(*) FROM information_schema.processlist WHERE state = "Waiting for table metadata lock"] = 1
+--source include/assert.inc
+
+--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for Slave Workers to free pending events"
+--source include/wait_condition.inc
+
+--echo #
+--echo # 6) Release the lock acquired in step 1, so that first query will
+--echo # continue it's work and once it is done, second big event
+--echo # will also continue it's work.
+--echo #
+--source include/rpl_connection_slave1.inc
+UNLOCK TABLES;
+
+--echo #
+--echo # 7) check that slave is able to catch up with master after releasing the
+--echo # lock in step 6.
+--echo #
+--echo # 7.1) Sync SQL thread with Master.
+--echo #
+--source include/rpl_connection_master.inc
+--source include/sync_slave_sql_with_master.inc
+
+--echo #
+--echo # 7.2) Diff all the tables involved in the test to prove
+--echo # that replication worked fine.
+--echo #
+--let $number_of_tables_involved_in_test=`SELECT LENGTH('$tables_involved_in_test') - LENGTH(REPLACE('$tables_involved_in_test',',','')) + 1`
+--let $t=1
+while ($t <= $number_of_tables_involved_in_test)
+{
+ --let $table= `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX('$tables_involved_in_test', ',', $t), ',', -1 )`
+ --let $diff_tables= master:$table,slave:$table
+ --source include/diff_tables.inc
+ --inc $t
+}
# -*- cperl -*-
-# Copyright (c) 2007, 2011, Oracle and/or its affiliates
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
my @mysqlbinlog_rules=
(
{ 'character-sets-dir' => \&fix_charset_dir },
+ { 'local-load' => sub { return shift->{ARGS}->{tmpdir}; } },
);
"$basedir/storage/myisam/myisampack",
"$basedir/myisam/myisampack"));
+ # ----------------------------------------------------
+ # mysqlaccess
+ # ----------------------------------------------------
+ my $mysqlaccess=
+ mtr_pl_maybe_exists("$bindir/scripts/mysqlaccess") ||
+ mtr_pl_maybe_exists("$path_client_bindir/mysqlaccess");
+ if ($mysqlaccess)
+ {
+ $ENV{'MYSQLACCESS'}= $mysqlaccess;
+ }
+
# ----------------------------------------------------
# mysqlhotcopy
# ----------------------------------------------------
my $found_skip_core= 0;
my $found_no_console= 0;
my $found_log_error= 0;
+
+ # On windows, do not add console if log-error found in .cnf file
+ open (CONFIG_FILE, " < $path_config_file") or
+ die("Could not open output file $path_config_file");
+
+ while (<CONFIG_FILE>)
+ {
+ if (m/^log[-_]error/)
+ {
+ $found_log_error= 1;
+ }
+ }
+ close (CONFIG_FILE);
+
foreach my $arg ( @$extra_opts )
{
# Skip --defaults-file option since it's handled above.
next if $arg =~ /^--defaults-file/;
-
- if ($arg eq "--log-error")
+ if ($arg =~ /^--log[-_]error/)
{
$found_log_error= 1;
}
--- /dev/null
+USE test;
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (c1 TINYBLOB,
+c2 BLOB,
+c3 MEDIUMBLOB,
+c4 LONGBLOB,
+c5 TEXT,
+c6 BIT(1),
+c7 CHAR,
+c8 VARCHAR(10),
+c9 GEOMETRY) CHARACTER SET = binary;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` tinyblob,
+ `c2` blob,
+ `c3` mediumblob,
+ `c4` longblob,
+ `c5` blob,
+ `c6` bit(1) DEFAULT NULL,
+ `c7` binary(1) DEFAULT NULL,
+ `c8` varbinary(10) DEFAULT NULL,
+ `c9` geometry DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=binary
+INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
+'mediumblob-text readable', 'longblob-text readable',
+'text readable', b'1', 'c', 'variable',
+POINT(1, 1));
+CREATE TABLE t2(id int, `col1` binary(10),`col2` blob);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) DEFAULT NULL,
+ `col1` binary(10) DEFAULT NULL,
+ `col2` blob
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
+#Print the table contents when binary-as-hex option is off.
+SELECT * FROM t1;
+c1 c2 c3 c4 c5 c6 c7 c8 c9
+tinyblob-text readable blob-text readable mediumblob-text readable longblob-text readable text readable # c variable #
+SELECT * FROM t2;
+id col1 col2
+1 # #
+2 # #
+#Print the table contents after turning on the binary-as-hex option
+
+#Print the table contents in tab format
+
+c1 c2 c3 c4 c5 c6 c7 c8 c9
+0x74696E79626C6F622D74657874207265616461626C65 0x626C6F622D74657874207265616461626C65 0x6D656469756D626C6F622D74657874207265616461626C65 0x6C6F6E67626C6F622D74657874207265616461626C65 0x74657874207265616461626C65 0x01 0x63 0x7661726961626C65 0x000000000101000000000000000000F03F000000000000F03F
+id col1 col2
+1 0xAB123400000000000000 0x123ABC
+2 0xDE123400000000000000 0x123DEF
+
+#Print the table contents in table format
+
++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
+| c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 |
++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
+| 0x74696E79626C6F622D74657874207265616461626C65 | 0x626C6F622D74657874207265616461626C65 | 0x6D656469756D626C6F622D74657874207265616461626C65 | 0x6C6F6E67626C6F622D74657874207265616461626C65 | 0x74657874207265616461626C65 | 0x01 | 0x63 | 0x7661726961626C65 | 0x000000000101000000000000000000F03F000000000000F03F |
++------------------------------------------------+----------------------------------------+----------------------------------------------------+------------------------------------------------+------------------------------+------------+------------+--------------------+------------------------------------------------------+
++------+------------------------+------------+
+| id | col1 | col2 |
++------+------------------------+------------+
+| 1 | 0xAB123400000000000000 | 0x123ABC |
++------+------------------------+------------+
+
+#Print the table contents vertically
+
+*************************** 1. row ***************************
+c1: 0x74696E79626C6F622D74657874207265616461626C65
+c2: 0x626C6F622D74657874207265616461626C65
+c3: 0x6D656469756D626C6F622D74657874207265616461626C65
+c4: 0x6C6F6E67626C6F622D74657874207265616461626C65
+c5: 0x74657874207265616461626C65
+c6: 0x01
+c7: 0x63
+c8: 0x7661726961626C65
+c9: 0x000000000101000000000000000000F03F000000000000F03F
+
+#Print the table contents in xml format
+
+<?xml version="1.0"?>
+
+<resultset statement="SELECT * FROM t1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <row>
+ <field name="c1">0x74696E79626C6F622D74657874207265616461626C65</field>
+ <field name="c2">0x626C6F622D74657874207265616461626C65</field>
+ <field name="c3">0x6D656469756D626C6F622D74657874207265616461626C65</field>
+ <field name="c4">0x6C6F6E67626C6F622D74657874207265616461626C65</field>
+ <field name="c5">0x74657874207265616461626C65</field>
+ <field name="c6">0x01</field>
+ <field name="c7">0x63</field>
+ <field name="c8">0x7661726961626C65</field>
+ <field name="c9">0x000000000101000000000000000000F03F000000000000F03F</field>
+ </row>
+</resultset>
+<?xml version="1.0"?>
+
+<resultset statement="SELECT * FROM t2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <row>
+ <field name="id">1</field>
+ <field name="col1">0xAB123400000000000000</field>
+ <field name="col2">0x123ABC</field>
+ </row>
+
+ <row>
+ <field name="id">2</field>
+ <field name="col1">0xDE123400000000000000</field>
+ <field name="col2">0x123DEF</field>
+ </row>
+</resultset>
+
+#Print the table contents in html format
+
+<TABLE BORDER=1><TR><TH>c1</TH><TH>c2</TH><TH>c3</TH><TH>c4</TH><TH>c5</TH><TH>c6</TH><TH>c7</TH><TH>c8</TH><TH>c9</TH></TR><TR><TD>0x74696E79626C6F622D74657874207265616461626C65</TD><TD>0x626C6F622D74657874207265616461626C65</TD><TD>0x6D656469756D626C6F622D74657874207265616461626C65</TD><TD>0x6C6F6E67626C6F622D74657874207265616461626C65</TD><TD>0x74657874207265616461626C65</TD><TD>0x01</TD><TD>0x63</TD><TD>0x7661726961626C65</TD><TD>0x000000000101000000000000000000F03F000000000000F03F</TD></TR></TABLE><TABLE BORDER=1><TR><TH>id</TH><TH>col1</TH><TH>col2</TH></TR><TR><TD>1</TD><TD>0xAB123400000000000000</TD><TD>0x123ABC</TD></TR><TR><TD>2</TD><TD>0xDE123400000000000000</TD><TD>0x123DEF</TD></TR></TABLE>DROP TABLE t1, t2;
200
#cleanup
DROP DATABASE `db-db`;
+#
+#Bug #25943038: QUERY WITH DERIVED TABLE IS CACHED IN MVCC SCENARIO
+#
+use test;
+CREATE TABLE t1(i1 INT, i2 INT, v3 VARCHAR(20)) ENGINE=INNODB;
+SET @qc= @@query_cache_size;
+SET GLOBAL query_cache_size=16777216;
+SELECT @@query_cache_size, @@query_cache_type;
+@@query_cache_size @@query_cache_type
+16777216 ON
+connection con1;
+START TRANSACTION;
+INSERT INTO t1 VALUES(1,1,'a'),(2,1,'b'),(3,2,'c'),(4,2,'d');
+connection con2;
+SHOW GLOBAL STATUS LIKE 'qcache%cache%';
+Variable_name Value
+Qcache_not_cached 7
+Qcache_queries_in_cache 0
+SELECT * FROM t1;
+i1 i2 v3
+SELECT * FROM (SELECT i2,SUM(i1) FROM t1 GROUP BY i2) b;
+i2 SUM(i1)
+SHOW GLOBAL STATUS LIKE 'qcache%cache%';
+Variable_name Value
+Qcache_not_cached 9
+Qcache_queries_in_cache 0
+connection con1;
+SHOW GLOBAL STATUS LIKE 'qcache%cache%';
+Variable_name Value
+Qcache_not_cached 9
+Qcache_queries_in_cache 0
+commit;
+connection con2;
+SHOW GLOBAL STATUS LIKE 'qcache%cache%';
+Variable_name Value
+Qcache_not_cached 9
+Qcache_queries_in_cache 0
+SELECT * FROM t1;
+i1 i2 v3
+1 1 a
+2 1 b
+3 2 c
+4 2 d
+SELECT * FROM (SELECT * FROM t1) a;
+i1 i2 v3
+1 1 a
+2 1 b
+3 2 c
+4 2 d
+SELECT * FROM (SELECT i2,SUM(i1) FROM t1 GROUP BY i2) b;
+i2 SUM(i1)
+1 3
+2 7
+disconnect con1;
+disconnect con2;
+connection default;
+DROP TABLE t1;
SET GLOBAL query_cache_size = @query_cache_size.saved;
#
--- /dev/null
+"Test SHOW PROCESSLIST, column INFO"
+show processlist;
+Id User Host db Command Time State Info
+ID root HOST test Query TIME init show processlist
--- /dev/null
+RESET MASTER;
+include/stop_dump_threads.inc
+# Step-1: Execute some dummy statements.
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (1);
+# Step-2: Execute MYSQL_BINLOG with --stop-never and --raw option.
+# Step-3: Wait till dump thread transfer is completed.
+# Step-4: copy binary log file that is downloaded till now before
+# stopping dump thread that is serving mysqlbinlog
+# --stop-never process.
+# Step-5: kill the dump thread serving the mysqlbinlog --stop-never process
+include/stop_dump_threads.inc
+# Step-6: Cleanup the data, so that it is ready for reapply.
+DROP TABLE t1;
+RESET MASTER;
+# Step-7: Apply the data that we got from --stop-never process.
+# Step-8: Check that the data is there.
+include/assert.inc [Check the table t1 exists and contains one tuple with value 1.]
+# Step-9: Cleanup
+DROP TABLE t1;
--- /dev/null
+#
+# 1. Apply some data on server.
+#
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+#
+# 2. Check that a SQL file with already logged transactions
+# is correctly skipped when is replayed.
+#
+FLUSH LOGS;
+#
+# 3. Clean up.
+#
+DROP TABLE t1;
--- /dev/null
+###############################################################################
+# Bug#24609402 MYSQLBINLOG --RAW DOES NOT GET ALL LATEST EVENTS
+#
+# Problem: When mysqlbinlog is used with --raw option, output file
+# is not getting flushed till the process is completed.
+# With --stop-never option (mysqlbinlog process never completes),
+# output file will never contain any event.
+#
+# Steps to reproduce:
+# 1) Execute some dummy statements(a create and an insert).
+# 2) Execute MYSQL_BINLOG with --stop-never and --raw option
+# and backup the binlog content.
+# 3) Wait till server dump thread transfers all the data.
+# 4) Copy binary log file that is downloaded till now before
+# stopping dump thread that is serving mysqlbinlog
+# --stop-never process.
+# 5) kill the dump thread (serving the mysqlbinlog process).
+# 6) Clean up the data on the server (a drop and a reset).
+# 7) Apply binlog content (binlog from Step-2).
+# 8) Check that table and the data in it exists (data from step-1).
+# 9) Cleanup the server.
+###############################################################################
+
+# Running MYSQL_BINLOG in a separate shell does not work properly in windows
+# due to MTR limitation.
+--source include/not_windows.inc
+
+# Test is not specific to any binlog format. Hence Running only for 'row'.
+--source include/have_binlog_format_row.inc
+
+# binlog file name is needed in the test. To use master-bin.000001,
+# RESET MASTER is needed.
+RESET MASTER;
+# kill the dump threads if there any dump threads (may be from previous test)
+--source include/stop_dump_threads.inc
+
+--echo # Step-1: Execute some dummy statements.
+CREATE TABLE t1(i int);
+INSERT INTO t1 values (1);
+
+--echo # Step-2: Execute MYSQL_BINLOG with --stop-never and --raw option.
+--write_file $MYSQL_TMP_DIR/mysqlbinlog_raw.sh
+#!/bin/bash
+(`$MYSQL_BINLOG --raw --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --result-file=$MYSQL_TMP_DIR/ master-bin.000001`) < /dev/null > /dev/null 2>&1 &
+EOF
+--chmod 0755 $MYSQL_TMP_DIR/mysqlbinlog_raw.sh
+--exec $MYSQL_TMP_DIR/mysqlbinlog_raw.sh
+
+--echo # Step-3: Wait till dump thread transfer is completed.
+let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
+--source include/wait_condition.inc
+
+--echo # Step-4: copy binary log file that is downloaded till now before
+--echo # stopping dump thread that is serving mysqlbinlog
+--echo # --stop-never process.
+--copy_file $MYSQL_TMP_DIR/master-bin.000001 $MYSQL_TMP_DIR/master-bin-back_up_file.000001
+
+--echo # Step-5: kill the dump thread serving the mysqlbinlog --stop-never process
+--source include/stop_dump_threads.inc
+
+--echo # Step-6: Cleanup the data, so that it is ready for reapply.
+DROP TABLE t1;
+RESET MASTER;
+
+--echo # Step-7: Apply the data that we got from --stop-never process.
+--exec $MYSQL_BINLOG $MYSQL_TMP_DIR/master-bin-back_up_file.000001 | $MYSQL --user=root --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT
+
+--echo # Step-8: Check that the data is there.
+--let $assert_text= Check the table t1 exists and contains one tuple with value 1.
+--let $assert_cond= [SELECT COUNT(*) AS Val FROM t1 WHERE i = 1, Val, 1] = 1
+--source include/assert.inc
+
+--echo # Step-9: Cleanup
+DROP TABLE t1;
+--remove_file $MYSQL_TMP_DIR/mysqlbinlog_raw.sh
+--remove_file $MYSQL_TMP_DIR/master-bin.000001
+--remove_file $MYSQL_TMP_DIR/master-bin-back_up_file.000001
--- /dev/null
+# ==== Purpose ====
+#
+# This test will check that mysql client program is able to apply
+# GTID skipped transactions without errors in the "use `<DATABASE>`"
+# statements.
+#
+# ==== Related Bugs and Worklogs ====
+#
+# BUG#26128931 USE `DATABASE` STATEMENT FAILS INSIDE GTID SKIPPED TRANSACTION
+#
+--source include/have_gtid.inc
+
+--echo #
+--echo # 1. Apply some data on server.
+--echo #
+CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (1);
+INSERT INTO t1 VALUES (2);
+INSERT INTO t1 VALUES (3);
+
+--echo #
+--echo # 2. Check that a SQL file with already logged transactions
+--echo # is correctly skipped when is replayed.
+--echo #
+--let $MYSQLD_DATADIR= `SELECT @@DATADIR`
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+FLUSH LOGS;
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/binlog_gtid_set_gtid_next.sql
+--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/binlog_gtid_set_gtid_next.sql
+--remove_file $MYSQLTEST_VARDIR/tmp/binlog_gtid_set_gtid_next.sql
+
+--echo #
+--echo # 3. Clean up.
+--echo #
+DROP TABLE t1;
--- /dev/null
+CREATE TABLE t (id INT, a INT, b INT, KEY (a), KEY (b)) ENGINE=INNODB
+PARTITION BY HASH (id) PARTITIONS 10;
+insert into t values (0,4,1);
+insert into t values (6,2,5);
+insert into t values (6,7,5);
+insert into t values (2,4,6);
+insert into t values (3,5,6);
+insert into t values (1,3,9);
+insert into t values (1,3,9);
+insert into t values (3,4,6);
+insert into t values (4,4,6);
+EXPLAIN SELECT SQL_NO_CACHE COUNT(*) FROM t WHERE a=4 AND b=6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t index_merge a,b a,b 5,5 NULL 7 Using intersect(a,b); Using where; Using index
+EXPLAIN SELECT SQL_NO_CACHE a,b FROM t WHERE a=4 AND b=6;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t index_merge a,b a,b 5,5 NULL 7 Using intersect(a,b); Using where; Using index
+SELECT SQL_NO_CACHE * FROM t WHERE a=4 AND b=6 ORDER BY id;
+id a b
+2 4 6
+3 4 6
+4 4 6
+SELECT SQL_NO_CACHE COUNT(*) FROM t WHERE a=4 AND b=6;
+COUNT(*)
+3
+DROP TABLE t;
--- /dev/null
+--source include/have_innodb.inc
+
+CREATE TABLE t (id INT, a INT, b INT, KEY (a), KEY (b)) ENGINE=INNODB
+PARTITION BY HASH (id) PARTITIONS 10;
+
+insert into t values (0,4,1);
+insert into t values (6,2,5);
+insert into t values (6,7,5);
+insert into t values (2,4,6);
+insert into t values (3,5,6);
+insert into t values (1,3,9);
+insert into t values (1,3,9);
+insert into t values (3,4,6);
+insert into t values (4,4,6);
+
+EXPLAIN SELECT SQL_NO_CACHE COUNT(*) FROM t WHERE a=4 AND b=6;
+EXPLAIN SELECT SQL_NO_CACHE a,b FROM t WHERE a=4 AND b=6;
+SELECT SQL_NO_CACHE * FROM t WHERE a=4 AND b=6 ORDER BY id;
+SELECT SQL_NO_CACHE COUNT(*) FROM t WHERE a=4 AND b=6;
+
+DROP TABLE t;
--- /dev/null
+include/master-slave.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+[connection master]
+#
+# 0) Set SLAVE_PENDING_JOBS_SIZE_MAX to a smaller number (1024)
+# and slave_parallel_workers to 2 to make the test easy.
+#
+[connection slave]
+SET @save.slave_pending_jobs_size_max= @@global.slave_pending_jobs_size_max;
+SET @save.slave_parallel_workers= @@global.slave_parallel_workers;
+SET @@GLOBAL.slave_pending_jobs_size_max= 1024;
+SET @@GLOBAL.slave_parallel_workers= 2;
+include/start_slave.inc
+#
+#
+# 1) Create initial data required for the test
+# (two databases (db1, db2) and two tables (db1.t and db2.t)).
+#
+[connection master]
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.t (a TEXT) ENGINE=INNODB;
+CREATE TABLE db2.t (a TEXT) ENGINE=INNODB;
+include/sync_slave_sql_with_master.inc
+#
+# 2) Prove that Coordinator will make a big event (bigger in size than
+# SLAVE_PENDING_JOBS_SIZE_MAX) wait for all workers to finish
+# their work (empty their queue) before processing the big event.
+#
+#
+# 1) On Slave, lock one table so that any operation on that
+# will be waiting for the lock to be released.
+#
+[connection slave1]
+LOCK TABLE db1.t WRITE;
+#
+# 2) Execute query that is going to wait for the table lock.
+#
+[connection master]
+INSERT INTO db1.t VALUES ('small event');
+#
+# 3) Wait on Slave till a worker picks this event and wait for the
+# lock (which is acquired in step 1)
+#
+[connection slave]
+#
+# 4) Now on Master, insert another query that reaches slave.
+#
+[connection master]
+INSERT INTO db2.t VALUES (REPEAT('big event', 1024));
+#
+# 5) Check that Coordinator waits for the query (at step 2) to be
+# executed before dedicating this new query (at step 4) to
+# one of the workers because of the event size limits.
+#
+[connection slave]
+include/assert.inc [Check that one of the applier worker thread is waiting for the table metadata lock.]
+#
+# 6) Release the lock acquired in step 1, so that first query will
+# continue it's work and once it is done, second big event
+# will also continue it's work.
+#
+[connection slave1]
+UNLOCK TABLES;
+#
+# 7) check that slave is able to catch up with master after releasing the
+# lock in step 6.
+#
+# 7.1) Sync SQL thread with Master.
+#
+[connection master]
+include/sync_slave_sql_with_master.inc
+#
+# 7.2) Diff all the tables involved in the test to prove
+# that replication worked fine.
+#
+include/diff_tables.inc [master:db1.t,slave:db1.t]
+include/diff_tables.inc [master: db2.t,slave: db2.t]
+#
+# 3) When a big event is being processed by a worker,
+# Coordinator will make smaller events to wait until the big event
+# is executed completely.
+#
+#
+#
+# 1) On Slave, lock one table so that any operation on that
+# will be waiting for the lock to be released.
+#
+[connection slave1]
+LOCK TABLE db1.t WRITE;
+#
+# 2) Execute query that is going to wait for the table lock.
+#
+[connection master]
+INSERT INTO db1.t VALUES (REPEAT('big event', 1024));
+#
+# 3) Wait on Slave till a worker picks this event and wait for the
+# lock (which is acquired in step 1)
+#
+[connection slave]
+#
+# 4) Now on Master, insert another query that reaches slave.
+#
+[connection master]
+INSERT INTO db2.t VALUES ('small event');
+#
+# 5) Check that Coordinator waits for the query (at step 2) to be
+# executed before dedicating this new query (at step 4) to
+# one of the workers because of the event size limits.
+#
+[connection slave]
+include/assert.inc [Check that one of the applier worker thread is waiting for the table metadata lock.]
+#
+# 6) Release the lock acquired in step 1, so that first query will
+# continue it's work and once it is done, second big event
+# will also continue it's work.
+#
+[connection slave1]
+UNLOCK TABLES;
+#
+# 7) check that slave is able to catch up with master after releasing the
+# lock in step 6.
+#
+# 7.1) Sync SQL thread with Master.
+#
+[connection master]
+include/sync_slave_sql_with_master.inc
+#
+# 7.2) Diff all the tables involved in the test to prove
+# that replication worked fine.
+#
+include/diff_tables.inc [master:db1.t,slave:db1.t]
+include/diff_tables.inc [master: db2.t,slave: db2.t]
+#
+# 4) When a big event is being processed by a worker,
+# Coordinator will make another big event also to wait until the
+# first big event is executed completely.
+#
+#
+# 1) On Slave, lock one table so that any operation on that
+# will be waiting for the lock to be released.
+#
+[connection slave1]
+LOCK TABLE db1.t WRITE;
+#
+# 2) Execute query that is going to wait for the table lock.
+#
+[connection master]
+INSERT INTO db1.t VALUES (REPEAT('big event', 1024));
+#
+# 3) Wait on Slave till a worker picks this event and wait for the
+# lock (which is acquired in step 1)
+#
+[connection slave]
+#
+# 4) Now on Master, insert another query that reaches slave.
+#
+[connection master]
+INSERT INTO db2.t VALUES (REPEAT('big event', 1024));
+#
+# 5) Check that Coordinator waits for the query (at step 2) to be
+# executed before dedicating this new query (at step 4) to
+# one of the workers because of the event size limits.
+#
+[connection slave]
+include/assert.inc [Check that one of the applier worker thread is waiting for the table metadata lock.]
+#
+# 6) Release the lock acquired in step 1, so that first query will
+# continue it's work and once it is done, second big event
+# will also continue it's work.
+#
+[connection slave1]
+UNLOCK TABLES;
+#
+# 7) check that slave is able to catch up with master after releasing the
+# lock in step 6.
+#
+# 7.1) Sync SQL thread with Master.
+#
+[connection master]
+include/sync_slave_sql_with_master.inc
+#
+# 7.2) Diff all the tables involved in the test to prove
+# that replication worked fine.
+#
+include/diff_tables.inc [master:db1.t,slave:db1.t]
+include/diff_tables.inc [master: db2.t,slave: db2.t]
+#
+# 5) Cleanup (drop tables/databases and reset the variables)
+#
+[connection master]
+DROP DATABASE db1;
+DROP DATABASE db2;
+include/sync_slave_sql_with_master.inc
+include/stop_slave_sql.inc
+SET @@global.slave_pending_jobs_size_max= @save.slave_pending_jobs_size_max;
+SET @@GLOBAL.slave_parallel_workers= @save.slave_parallel_workers;
+include/start_slave_sql.inc
+include/rpl_end.inc
--- /dev/null
+include/master-slave.inc
+Warnings:
+Note #### Sending passwords in plain text without SSL/TLS is extremely insecure.
+Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information.
+[connection master]
+[connection master]
+CREATE TABLE t1 (c1 INT);
+INSERT INTO t1 (c1) VALUES (1);
+include/sync_slave_sql_with_master.inc
+[connection slave]
+include/stop_slave_sql.inc
+[connection master]
+FLUSH LOGS;
+FLUSH LOGS;
+INSERT INTO t1 (c1) VALUES (2);
+include/sync_slave_io_with_master.inc
+call mtr.add_suppression("File '.*slave-relay-bin.");
+call mtr.add_suppression("Could not open log file");
+call mtr.add_suppression("Failed to open the relay log");
+call mtr.add_suppression("Slave failed to initialize relay log info structure");
+call mtr.add_suppression("Could not find target log file mentioned in relay log info in the index file");
+call mtr.add_suppression("Failed to initialize the relay-log-info structure");
+call mtr.add_suppression("Failed to initialize the master info structure");
+include/rpl_stop_server.inc [server_number=2]
+# Removing file(s)
+include/rpl_start_server.inc [server_number=2]
+START SLAVE;
+ERROR HY000: Slave failed to initialize relay log info structure from the repository
+START SLAVE;
+ERROR HY000: Slave failed to initialize relay log info structure from the repository
+RESET SLAVE;
+RESET MASTER;
+DROP TABLE t1;
+include/start_slave.inc
+[connection master]
+include/sync_slave_sql_with_master.inc
+include/diff_tables.inc [master:t1, slave:t1]
+[connection master]
+DROP TABLE t1;
+include/sync_slave_sql_with_master.inc
+include/rpl_end.inc
SET GLOBAL rpl_semi_sync_slave_enabled = OFF;
include/start_slave.inc
UNINSTALL PLUGIN rpl_semi_sync_slave;
-include/assert.inc [semi sync master clients should be 0.]
UNINSTALL PLUGIN rpl_semi_sync_master;
CREATE TABLE t1(i int);
INSERT INTO t1 values (3);
# works fine.
#
+# "Flush" commands are logged as rotate events in the binary
+# log without gtid events. So it is correct to check master
+# and slave sync logic with positions instead gtids numbers.
+# Hence for this test script, making use_gtids to false
+# in all the cases (GTID_MODE ON or OFF).
+--let $use_gtids=0
+
--source include/master-slave.inc
--source include/have_binlog_format_statement.inc
connection master;
--- /dev/null
+###############################################################################
+# Bug #21280753 MTS MUST BE ABLE HANDLE LARGE PACKETS WITH SMALL
+# SLAVE_PENDING_JOBS_SIZE_MAX
+#
+# To prove the slave applier can apply events that are larger
+# than SLAVE_PENDING_JOBS_SIZE_MAX but only one at a time.
+#
+# Steps to reproduce the issue:
+#
+# 0) Set SLAVE_PENDING_JOBS_SIZE_MAX to a smaller number (1024)
+# and slave_parallel_workers to 2 to make the test easy.
+#
+# 1) Create initial data required for the test
+# (two databases (db1, db2) and two tables (db1.t and db2.t)).
+#
+# 2) Prove that Coordinator will make a big event (bigger in size than
+# SLAVE_PENDING_JOBS_SIZE_MAX) wait for all workers to finish
+# their work (empty their queue) before processing the big event.
+#
+# 3) Prove that when a big event is being processed by a
+# worker, Coordinator will make smaller events to wait.
+#
+# 4) Prove that when a big event is being processed by a
+# worker, Coordinator will make another big event also to wait.
+#
+# 5) Cleanup (drop tables/databases and reset the variables)
+#
+###############################################################################
+
+# Row format is choosen so that event size can be changed easily.
+--source include/have_binlog_format_row.inc
+--let $rpl_skip_start_slave= 1
+--source include/master-slave.inc
+
+--echo #
+--echo # 0) Set SLAVE_PENDING_JOBS_SIZE_MAX to a smaller number (1024)
+--echo # and slave_parallel_workers to 2 to make the test easy.
+--echo #
+--source include/rpl_connection_slave.inc
+SET @save.slave_pending_jobs_size_max= @@global.slave_pending_jobs_size_max;
+SET @save.slave_parallel_workers= @@global.slave_parallel_workers;
+--let $mts_pending_max=1024
+--eval SET @@GLOBAL.slave_pending_jobs_size_max= $mts_pending_max
+--eval SET @@GLOBAL.slave_parallel_workers= 2
+--disable_warnings
+--source include/start_slave.inc
+--enable_warnings
+
+--echo #
+--echo #
+--echo # 1) Create initial data required for the test
+--echo # (two databases (db1, db2) and two tables (db1.t and db2.t)).
+--echo #
+--source include/rpl_connection_master.inc
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+CREATE TABLE db1.t (a TEXT) ENGINE=INNODB;
+CREATE TABLE db2.t (a TEXT) ENGINE=INNODB;
+--source include/sync_slave_sql_with_master.inc
+
+--echo #
+--echo # 2) Prove that Coordinator will make a big event (bigger in size than
+--echo # SLAVE_PENDING_JOBS_SIZE_MAX) wait for all workers to finish
+--echo # their work (empty their queue) before processing the big event.
+--echo #
+--let $table_to_lock=db1.t
+--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES ('small event')
+--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max))
+--let $tables_involved_in_test=db1.t, db2.t
+--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc
+
+--echo #
+--echo # 3) When a big event is being processed by a worker,
+--echo # Coordinator will make smaller events to wait until the big event
+--echo # is executed completely.
+--echo #
+--echo #
+--let $table_to_lock=db1.t
+--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES (REPEAT('big event', $mts_pending_max))
+--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES ('small event')
+--let $tables_involved_in_test=db1.t, db2.t
+--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc
+
+--echo #
+--echo # 4) When a big event is being processed by a worker,
+--echo # Coordinator will make another big event also to wait until the
+--echo # first big event is executed completely.
+--echo #
+--let $table_to_lock=db1.t
+--let $query_that_waits_on_table_lock=INSERT INTO db1.t VALUES (REPEAT('big event', $mts_pending_max))
+--let $query_that_needs_to_be_processed_by_coordinator=INSERT INTO db2.t VALUES (REPEAT('big event', $mts_pending_max))
+--let $tables_involved_in_test=db1.t, db2.t
+--source ../mysql-test/extra/rpl_tests/rpl_mts_pending_events.inc
+
+--echo #
+--echo # 5) Cleanup (drop tables/databases and reset the variables)
+--echo #
+--source include/rpl_connection_master.inc
+DROP DATABASE db1;
+DROP DATABASE db2;
+--source include/sync_slave_sql_with_master.inc
+--source include/stop_slave_sql.inc
+SET @@global.slave_pending_jobs_size_max= @save.slave_pending_jobs_size_max;
+SET @@GLOBAL.slave_parallel_workers= @save.slave_parallel_workers;
+--disable_warnings
+--source include/start_slave_sql.inc
+--enable_warnings
+--source include/rpl_end.inc
--- /dev/null
+###############################################################################
+# Bug#24901077: RESET SLAVE ALL DOES NOT ALWAYS RESET SLAVE
+#
+# Problem:
+# =======
+# If you have a relay log index file that has ended up with
+# some relay log files that do not exists, then RESET SLAVE
+# ALL is not enough to get back to a clean state.
+###############################################################################
+# Remove all slave-relay-bin.0* files (do not remove slave-relay-bin.index)
+# During server restart rli initialization will fail as there are no
+# relay logs. In case of bug RESET SLAVE will not do the required clean up
+# as rli is not inited and subsequent START SLAVE will fail.
+# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
+# because it is different on Unix and Windows systems.
+
+--source include/have_binlog_format_mixed.inc
+--source include/master-slave.inc
+
+--source include/rpl_connection_master.inc
+CREATE TABLE t1 (c1 INT);
+INSERT INTO t1 (c1) VALUES (1);
+--source include/sync_slave_sql_with_master.inc
+
+--source include/rpl_connection_slave.inc
+--source include/stop_slave_sql.inc
+--let $MYSQLD_SLAVE_DATADIR= `select @@datadir`
+
+--source include/rpl_connection_master.inc
+# Generate more relay logs on slave.
+FLUSH LOGS;
+FLUSH LOGS;
+INSERT INTO t1 (c1) VALUES (2);
+
+--source include/sync_slave_io_with_master.inc
+call mtr.add_suppression("File '.*slave-relay-bin.");
+call mtr.add_suppression("Could not open log file");
+call mtr.add_suppression("Failed to open the relay log");
+call mtr.add_suppression("Slave failed to initialize relay log info structure");
+call mtr.add_suppression("Could not find target log file mentioned in relay log info in the index file");
+call mtr.add_suppression("Failed to initialize the relay-log-info structure");
+call mtr.add_suppression("Failed to initialize the master info structure");
+
+# Stop slave
+--let $rpl_server_number= 2
+--source include/rpl_stop_server.inc
+
+# Delete file(s)
+--echo # Removing $remove_pattern file(s)
+--let $remove_pattern= slave-relay-bin.0*
+--remove_files_wildcard $MYSQLD_SLAVE_DATADIR $remove_pattern
+
+# Start slave
+--let $rpl_server_number= 2
+--source include/rpl_start_server.inc
+
+# Start slave must fail because of the removed file(s).
+--error ER_SLAVE_RLI_INIT_REPOSITORY
+START SLAVE;
+
+# Try a second time, it must fail again.
+--error ER_SLAVE_RLI_INIT_REPOSITORY
+START SLAVE;
+
+# Retrieve master executed position before reset slave.
+--let $master_exec_file= query_get_value("SHOW SLAVE STATUS", Relay_Master_Log_File, 1)
+--let $master_exec_pos= query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1)
+
+# Reset slave.
+# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
+# because it is different on Unix and Windows systems.
+--disable_warnings
+RESET SLAVE;
+--enable_warnings
+RESET MASTER;
+DROP TABLE t1;
+# Start slave.
+--source include/start_slave.inc
+
+--source include/rpl_connection_master.inc
+--source include/sync_slave_sql_with_master.inc
+# Check consistency.
+--let $diff_tables= master:t1, slave:t1
+--source include/diff_tables.inc
+
+# Cleanup
+--source include/rpl_connection_master.inc
+DROP TABLE t1;
+--source include/sync_slave_sql_with_master.inc
+--source include/rpl_end.inc
# Step 4.4: Uninstall semi sync plugin, it should be successful now.
UNINSTALL PLUGIN rpl_semi_sync_slave;
-# Step 4.5: On Master, check that semi sync slaves are now '0'.
+# Step 4.5: On Master, wait until semi sync slaves is '0'.
--connection master
---let $master_clients=[show status like "Rpl_semi_sync_master_clients", Value, 1]
---let assert_cond= $master_clients = 0
---let assert_text= semi sync master clients should be 0.
---source include/assert.inc
+--let $status_var= Rpl_semi_sync_master_clients
+--let $status_var_value= 0
+--source include/wait_for_status_var.inc
# Step 4.6: So uninstalling semi sync plugin should be allowed
UNINSTALL PLUGIN rpl_semi_sync_master;
--- /dev/null
+# === Purpose ===
+# The purpose of this test case is to make
+# sure that the binary data in tables is printed
+# as hex when the option binary-as-hex is enabled.
+#
+# === Related bugs and/or worklogs ===
+# Bug #25340722 - PRINT BINARY DATA AS HEX IN THE MYSQL
+# CLIENT (CONTRIBUTION)
+#
+
+# Save the initial number of concurrent sessions
+--source include/count_sessions.inc
+--source include/not_embedded.inc
+
+USE test;
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE TABLE t1 (c1 TINYBLOB,
+ c2 BLOB,
+ c3 MEDIUMBLOB,
+ c4 LONGBLOB,
+ c5 TEXT,
+ c6 BIT(1),
+ c7 CHAR,
+ c8 VARCHAR(10),
+ c9 GEOMETRY) CHARACTER SET = binary;
+
+SHOW CREATE TABLE t1;
+
+INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
+ 'mediumblob-text readable', 'longblob-text readable',
+ 'text readable', b'1', 'c', 'variable',
+ POINT(1, 1));
+
+CREATE TABLE t2(id int, `col1` binary(10),`col2` blob);
+
+SHOW CREATE TABLE t2;
+
+INSERT INTO t2 VALUES (1, X'AB1234', X'123ABC'), (2, X'DE1234', X'123DEF');
+
+--echo #Print the table contents when binary-as-hex option is off.
+--replace_column 6 # 9 #
+SELECT * FROM t1;
+
+--replace_column 2 # 3 #
+SELECT * FROM t2;
+
+--echo #Print the table contents after turning on the binary-as-hex option
+--echo
+--echo #Print the table contents in tab format
+--echo
+--exec $MYSQL test --binary-as-hex -e "SELECT * FROM t1; SELECT * FROM t2;"
+--echo
+--echo #Print the table contents in table format
+--echo
+--exec $MYSQL test --binary-as-hex --table -e "SELECT * FROM t1; SELECT * FROM t2 WHERE col2=0x123ABC;"
+--echo
+--echo #Print the table contents vertically
+--echo
+--exec $MYSQL test --binary-as-hex --vertical -e "SELECT * FROM t1;"
+--echo
+--echo #Print the table contents in xml format
+--echo
+--exec $MYSQL test --binary-as-hex --xml -e "SELECT * FROM t1; SELECT * FROM t2;"
+--echo
+--echo #Print the table contents in html format
+--echo
+--exec $MYSQL test --binary-as-hex --html -e "SELECT * FROM t1; SELECT * FROM t2;"
+
+#Cleanup
+DROP TABLE t1, t2;
+
+# Wait till all disconnects are completed
+ --source include/wait_until_count_sessions.inc
ds_mrr-big @solaris : Bug#14168107 2012-04-03 Hemant disabled new test added by Olav Sandstå,since this leads to timeout on Solaris on slow sparc servers
mysql_embedded_client_test : Bug#13964673 2012-04-16 amitbha since most of the test cases are failing
mysql_client_test_embedded : Bug#16084066 2013-01-08 Disabled since this test is failing
+mysqlhotcopy_archive @solaris : DBD-mysql perl module not available on Solaris
+mysqlhotcopy_myisam @solaris : DBD-mysql perl module not available on Solaris
file_contents : Galera mysql-wsrep#4 2014-10-28 pstoev main.file_contents MTR test fails in mysql-wsrep
bootstrap : Galera mysql-wsrep#19 2014-11-21 pstoev Crash in LOGGER::error_log_print when printing a WSREP message
--echo #cleanup
DROP DATABASE `db-db`;
+
+--echo #
+--echo #Bug #25943038: QUERY WITH DERIVED TABLE IS CACHED IN MVCC SCENARIO
+--echo #
+
+use test;
+CREATE TABLE t1(i1 INT, i2 INT, v3 VARCHAR(20)) ENGINE=INNODB;
+SET @qc= @@query_cache_size;
+SET GLOBAL query_cache_size=16777216;
+
+SELECT @@query_cache_size, @@query_cache_type;
+
+connect (con1, localhost, root);
+connect (con2, localhost, root);
+
+--enable_connect_log
+connection con1;
+START TRANSACTION;
+INSERT INTO t1 VALUES(1,1,'a'),(2,1,'b'),(3,2,'c'),(4,2,'d');
+
+connection con2;
+SHOW GLOBAL STATUS LIKE 'qcache%cache%';
+SELECT * FROM t1;
+SELECT * FROM (SELECT i2,SUM(i1) FROM t1 GROUP BY i2) b;
+SHOW GLOBAL STATUS LIKE 'qcache%cache%';
+
+connection con1;
+SHOW GLOBAL STATUS LIKE 'qcache%cache%';
+commit;
+
+connection con2;
+SHOW GLOBAL STATUS LIKE 'qcache%cache%';
+SELECT * FROM t1;
+SELECT * FROM (SELECT * FROM t1) a;
+SELECT * FROM (SELECT i2,SUM(i1) FROM t1 GROUP BY i2) b;
+
+disconnect con1;
+disconnect con2;
+--source include/wait_until_disconnected.inc
+connection default;
+DROP TABLE t1;
+
SET GLOBAL query_cache_size = @query_cache_size.saved;
--echo #
--- /dev/null
+
+--source include/not_embedded.inc
+
+#
+# Output should be the same with or without the performance schema.
+#
+
+--echo "Test SHOW PROCESSLIST, column INFO"
+--replace_column 1 ID 3 HOST 6 TIME
+show processlist;
+
-/* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#endif
-int my_is_symlink(const char *filename MY_ATTRIBUTE((unused)))
+int my_is_symlink(const char *filename MY_ATTRIBUTE((unused)),
+ ST_FILE_ID *file_id)
{
#if defined (HAVE_LSTAT) && defined (S_ISLNK)
struct stat stat_buff;
- return !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode);
+ int result= !lstat(filename, &stat_buff) && S_ISLNK(stat_buff.st_mode);
+ if (file_id && !result)
+ {
+ file_id->st_dev= stat_buff.st_dev;
+ file_id->st_ino= stat_buff.st_ino;
+ }
+ return result;
#elif defined (_WIN32)
DWORD dwAttr = GetFileAttributes(filename);
return (dwAttr != INVALID_FILE_ATTRIBUTES) &&
#endif
return 0;
}
+
+
+/**
+ Return non-zero if the file descriptor and a previously lstat-ed file
+ identified by file_id point to the same file
+*/
+int my_is_same_file(File file, const ST_FILE_ID *file_id)
+{
+ MY_STAT stat_buf;
+ if(my_fstat(file, &stat_buf, MYF(0)) == -1)
+ {
+ my_errno= errno;
+ return 0;
+ }
+ return (stat_buf.st_dev == file_id->st_dev)
+ && (stat_buf.st_ino == file_id->st_ino);
+}
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
tot_no_parts= no_parts;
tot_no_loops= 1024;
perform_insert(&queue);
- if ((result= perform_ins_del(&queue, max_ind)))
- delete_queue(&queue);
+ result= perform_ins_del(&queue, max_ind);
if (result)
{
printf("Error\n");
+ delete_queue(&queue);
return TRUE;
}
+ delete_queue(&queue);
return FALSE;
}
queue_remove(queue, (uint) 0);
queue_remove_all(queue);
stop_measurement();
+ delete_queue(queue);
}
int main()
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.\r
+# Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.\r
# \r
# This program is free software; you can redistribute it and/or modify\r
# it under the terms of the GNU General Public License as published by\r
# along with this program; if not, write to the Free Software\r
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
\r
+SET(LINK_STATIC_RUNTIME_LIBRARIES "@LINK_STATIC_RUNTIME_LIBRARIES@")\r
SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")\r
SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")\r
SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@")\r
OUTPUT_STRIP_TRAILING_WHITESPACE)\r
ENDMACRO()\r
\r
-SET(INC_VAR 0)\r
+# Make sure that WIX identifier created from a path matches all the rules:\r
+# - it is shorter than 72 characters\r
+# - doesn't contain reserver characters ('+', '-' and '/')\r
+# ID_SET contains a global list of all identifiers which are too long.\r
+# Every time we use an identifier which is too long we use its index in\r
+# ID_SET to shorten the name.\r
+SET_PROPERTY(GLOBAL PROPERTY ID_SET)\r
MACRO(MAKE_WIX_IDENTIFIER str varname)\r
STRING(REPLACE "/" "." ${varname} "${str}")\r
+ STRING(REPLACE "+" "p" ${varname} "${str}")\r
+ STRING(REPLACE "-" "m" ${varname} "${str}")\r
STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")\r
STRING(LENGTH "${${varname}}" len)\r
+ # FIXME: the prefix length has to be controlled better\r
# Identifier should be smaller than 72 character\r
- # We have to cut down the length to 70 chars, since we add 2 char prefix\r
+ # We have to cut down the length to 40 chars, since we add prefixes\r
# pretty often\r
- IF(len GREATER 70)\r
- STRING(SUBSTRING "${${varname}}" 0 67 shortstr)\r
- MATH(EXPR INC_VAR ${INC_VAR}+1)\r
- SET(${varname} "${shortstr}${INC_VAR}")\r
+ IF(len GREATER 40) \r
+ STRING(SUBSTRING "${${varname}}" 0 37 shortstr)\r
+ GET_PROPERTY(LOCAL_LIST GLOBAL PROPERTY ID_SET)\r
+ LIST(FIND LOCAL_LIST "${${varname}}" STRING_ID)\r
+ IF(${STRING_ID} EQUAL -1)\r
+ LIST(APPEND LOCAL_LIST "${${varname}}")\r
+ SET_PROPERTY(GLOBAL PROPERTY ID_SET "${LOCAL_LIST}")\r
+ LIST(LENGTH LOCAL_LIST STRING_ID)\r
+ MATH(EXPR STRING_ID "${STRING_ID}-1" )\r
+ ENDIF()\r
+ SET(${varname} "${shortstr}${STRING_ID}")\r
ENDIF()\r
ENDMACRO()\r
\r
-\r
FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)\r
FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})\r
IF(dir_rel)\r
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">\r
\r
<!--\r
- Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.\r
+ Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.\r
\r
This program is free software; you can redistribute it and/or modify\r
it under the terms of the GNU General Public License as published by\r
<RemoveExistingProducts After="InstallInitialize"/>\r
</InstallExecuteSequence>\r
\r
+ <?if "@LINK_STATIC_RUNTIME_LIBRARIES@"="OFF" ?>\r
+ <?if "@Platform@"="x64"?>\r
+ <Property Id="VS10REDISTX64">\r
+ <RegistrySearch Id="FindRedistVS10"\r
+ Root="HKLM"\r
+ Key="SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x64"\r
+ Name="Version"\r
+ Type="raw" />\r
+ </Property>\r
+ <Condition Message="This application requires Visual Studio 2010 x64 Redistributable. Please install the Redistributable then run this installer again.">\r
+ Installed OR VS10REDISTX64\r
+ </Condition>\r
+ <?elseif "@Platform@"="x86" ?>\r
+ <Property Id="VS10REDISTX86">\r
+ <RegistrySearch Id="FindRedistVS10"\r
+ Root="HKLM"\r
+ Key="SOFTWARE\WOW6432Node\Microsoft\VisualStudio\10.0\VC\VCRedist\x86"\r
+ Name="Version"\r
+ Type="raw" />\r
+ </Property>\r
+ <Condition Message="This application requires Visual Studio 2010 x86 Redistributable. Please install the Redistributable then run this installer again.">\r
+ Installed OR VS10REDISTX86\r
+ </Condition>\r
+ <?endif?>\r
+ <?endif?> \r
+ \r
<!-- Save/restore install location -->\r
<CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />\r
<InstallExecuteSequence>\r
SET (DEB_INSTALL_LICENSEFILE "LICENSE.mysql")
SET (DEB_SERVERVERSION "${VERSION}+commercial-1")
SET (DEB_PLUGIN_SETPERMISSION "")
+ SET (DEB_MAN_SETPERMISSION "")
# List of plugins that are only in commercial packages
# Plugins that are in both community and commercial should NOT be added here
SET (DEB_SERVERVERSION "${VERSION}-1")
SET (DEB_REMOVEPATTERN "com.in")
SET (DEB_PLUGIN_SETPERMISSION "usr/bin/mysql_setpermission")
+ SET (DEB_MAN_SETPERMISSION "usr/share/man/man1/mysql_setpermission.1")
ENDIF()
# Platform specifics. The differences are generally only distro version
${shlibs:Depends}, ${misc:Depends}
Breaks: mysql-common (<< 5.6.36)
Conflicts: mysql,
+ mysql-client-5.0, mysql-client-core-5.0,
+ mysql-client-5.1, mysql-client-core-5.1,
+ mysql-client-5.5, mysql-client-core-5.5,
+ mysql-client-5.6, mysql-client-core-5.6,
+ mysql-client-5.7, mysql-client-core-5.7,
mysql-server-5.0, mysql-server-core-5.0,
mysql-server-5.1, mysql-server-core-5.1,
mysql-server-5.5, mysql-server-core-5.5,
mysql-server-5.6, mysql-server-core-5.6,
mysql-server-5.7, mysql-server-core-5.7,
mysql-@DEB_NOTPRODUCTNAME@-server,
+ mariadb-client-5.5, mariadb-client-core-5.5,
+ mariadb-client-10.0, mariadb-client-core-10.0,
+ mariadb-client-10.1, mariadb-client-core-10.1,
+ mariadb-client-10.2, mariadb-client-core-10.2,
mariadb-server-5.5, mariadb-server-core-5.5,
mariadb-server-10.0, mariadb-server-core-10.0,
mariadb-server-10.1, mariadb-server-core-10.1,
mysql-client-5.5, mysql-client-core-5.5,
mysql-client-5.6, mysql-client-core-5.6,
mysql-client-5.7, mysql-client-core-5.7,
+ mysql-server-5.0, mysql-server-core-5.0,
+ mysql-server-5.1, mysql-server-core-5.1,
+ mysql-server-5.5, mysql-server-core-5.5,
+ mysql-server-5.6, mysql-server-core-5.6,
+ mysql-server-5.7, mysql-server-core-5.7,
mysql-@DEB_NOTPRODUCTNAME@-client,
mariadb-client-5.5, mariadb-client-core-5.5,
mariadb-client-10.0, mariadb-client-core-10.0,
mariadb-client-10.1, mariadb-client-core-10.1,
- mariadb-client-10.2, mariadb-client-core-10.2
+ mariadb-client-10.2, mariadb-client-core-10.2,
+ mariadb-server-5.5, mariadb-server-core-5.5,
+ mariadb-server-10.0, mariadb-server-core-10.0,
+ mariadb-server-10.1, mariadb-server-core-10.1,
+ mariadb-server-10.2, mariadb-server-core-10.2
Replaces: mysql,
mysql-client-5.0, mysql-client-core-5.0,
mysql-client-5.1, mysql-client-core-5.1,
-# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
usr/share/man/man1/mysql.1
usr/share/man/man1/mysql_config_editor.1
usr/share/man/man1/mysql_embedded.1
+usr/share/man/man1/mysql_find_rows.1
+usr/share/man/man1/mysql_fix_extensions.1
usr/share/man/man1/mysql_plugin.1
+usr/share/man/man1/mysql_waitpid.1
usr/share/man/man1/mysqlaccess.1
usr/share/man/man1/mysqladmin.1
+usr/share/man/man1/mysqlbug.1
usr/share/man/man1/mysqlcheck.1
usr/share/man/man1/mysqldump.1
usr/share/man/man1/mysqldumpslow.1
usr/sbin/mysqld-debug
# man pages
usr/share/man/man1/innochecksum.1
+usr/share/man/man1/msql2mysql.1
+usr/share/man/man1/mysqlhotcopy.1
usr/share/man/man1/comp_err.1
usr/share/man/man1/myisamchk.1
usr/share/man/man1/myisamlog.1
usr/share/man/man1/myisampack.1
usr/share/man/man1/my_print_defaults.1
-usr/share/man/man1/mysql.server.1
usr/share/man/man1/mysql-stress-test.pl.1
+usr/share/man/man1/mysql_convert_table_format.1
+usr/share/man/man1/mysql_install_db.1
usr/share/man/man1/mysql_secure_installation.1
+@DEB_MAN_SETPERMISSION@
usr/share/man/man1/mysql_tzinfo_to_sql.1
usr/share/man/man1/mysql_upgrade.1
+usr/share/man/man1/mysql_zap.1
usr/share/man/man1/mysqlbinlog.1
usr/share/man/man1/mysqld_multi.1
usr/share/man/man1/mysqld_safe.1
touch $@
override_dh_install:
- dh_install --list-missing
- -Xusr/bin/i_mysql_client_test
- -Xusr/share/mysql/mysql.server
- -Xusr/share/mysql/COPYING
- -Xusr/share/mysql/README
- -Xusr/share/mysql/docs/mysql.info
- -Xusr/share/man/man1/mysqlman.1
+ dh_install --fail-missing \
+ -Xusr/bin/i_mysql_client_test \
+ -Xusr/share/mysql/mysql.server \
+ -Xusr/share/man/man1/mysql.server.1 \
+ -Xusr/share/mysql/binary-configure \
+ -Xusr/share/mysql/@DEB_INSTALL_LICENSEFILE@ \
+ -Xusr/share/mysql/README \
+ -Xusr/share/mysql/docs/mysql.info \
+ -Xusr/share/man/man1/mysqlman.1 \
+ -X.h.pp
-# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
rm -f %{buildroot}%{_bindir}/$f
done
-for f in innochecksum myisamchk myisam_ftdump myisamlog myisampack mysqladmin \
+for f in innochecksum myisamchk myisam_ftdump myisamlog myisampack \
mysqlbinlog mysqlcheck mysql_client_test mysql_config_editor \
mysqld_multi mysqld_safe mysqldumpslow mysql_embedded mysqlimport \
mysql_plugin mysql_secure_installation mysqlshow mysqlslap mysqltest \
# No need for these scripts
rm -f %{buildroot}%{_datadir}/mysql/{mysql.server,mysqld_multi.server,mysql-log-rotate,binary-configure}
+# Remove files pages we explicitly do not want to package
+rm -rf %{buildroot}%{_infodir}/mysql.info*
+rm -f %{buildroot}%{_datadir}/mysql/win_install_firewall.sql
+
%check
%if 0%{?runselftest}
pushd release
%dir %{_sysconfdir}/my.cnf.d
%attr(755, root, root) %{_sbindir}/mysqld
%attr(755, root, root) %{_bindir}/mysql
+%attr(755, root, root) %{_bindir}/mysqladmin
%attr(755, root, root) %{_bindir}/mysqldump
%attr(755, root, root) %{_bindir}/mysql_config
%attr(755, root, root) %{_bindir}/mysql_install_db
%attr(644, root, root) %{_datadir}/mysql/dictionary.txt
%attr(644, root, root) %{_datadir}/mysql/innodb_memcached_config.sql
%attr(644, root, root) %{_datadir}/mysql/magic
+
+%if 0%{?commercial}
+%attr(755, root, root) %{_libdir}/mysql/plugin/audit_log.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/authentication_pam.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/thread_pool.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/openssl_udf.so
+%attr(755, root, root) %{_libdir}/mysql/plugin/firewall.so
+%attr(644, root, root) %{_datadir}/mysql/linux_install_firewall.sql
+%endif
+
%dir %attr(750, mysql, mysql) /var/lib/mysql
%dir %attr(755, mysql, mysql) /var/run/mysqld
%dir %attr(750, mysql, mysql) /var/lib/mysql-files
-# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
STRING(REPLACE "-grecord-gcc-switches" "" CXXFLAGS "${CXXFLAGS}")
STRING(REPLACE "-pipe" "" CXXFLAGS "${CXXFLAGS}")
+IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ SET (PERL_PATH "/usr/local/bin/perl")
+ELSE()
+ SET (PERL_PATH "/usr/bin/perl")
+ENDIF()
+
IF(UNIX)
# SHELL_PATH, FIND_PROC, CHECK_PID are used by mysqld_safe
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
-#!/usr/bin/perl -w
-
-#
-# Copyright (c) 2008, 2009 Sun Microsystems, Inc.
-# Use is subject to license terms.
-#
-
+# Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
--- /dev/null
+#! /usr/bin/perl
+#
+# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+#
+
+#
+# Take the given GCC command line and run it with all absolute paths
+# changed to relative paths. This makes sure that no part of the build
+# path leaks into the .o files, which it normally would through the
+# contents of __FILE__. (Debug information is also affected, but that
+# is already fixed through -fdebug-prefix-map=.)
+#
+# A more elegant solution would be -ffile-prefix-map=, but this is
+# not currently supported in GCC; see
+# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70268.
+#
+
+use strict;
+use warnings;
+use Cwd;
+
+my $cwd = getcwd();
+
+my @newarg = ();
+for my $i (0..$#ARGV) {
+ my $arg = $ARGV[$i];
+ if ($arg =~ /-I(.+)$/) {
+ $arg = '-I' . relativize($1, $cwd);
+ } elsif ($arg =~ /^\//) {
+ $arg = relativize($arg, $cwd);
+ }
+ push @newarg, $arg;
+}
+
+exec(@newarg);
+
+# /a/b/c/foo from /a/b/d = ../c/foo
+sub relativize {
+ my ($dir1, $dir2) = @_;
+
+ if ($dir1 !~ /^\//) {
+ # Not an absolute path.
+ return $dir1;
+ }
+
+ if (! -e $dir1) {
+# print STDERR "Unknown file/directory $dir1.\n";
+ return $dir1;
+ }
+ # Resolve symlinks and such, because getcwd() does.
+ $dir1 = Cwd::abs_path($dir1);
+
+ if ($dir1 =~ /^\/(lib|tmp|usr)/) {
+ # Not related to our source code.
+ return $dir1;
+ }
+
+ if ($dir1 eq $dir2) {
+ return ".";
+ }
+
+ my (@dir1_components) = split /\//, $dir1;
+ my (@dir2_components) = split /\//, $dir2;
+
+ # Remove common leading components.
+ while (scalar @dir1_components > 0 && scalar @dir2_components > 0 &&
+ $dir1_components[0] eq $dir2_components[0]) {
+ shift @dir1_components;
+ shift @dir2_components;
+ }
+
+ my $ret = "";
+ for my $i (0..$#dir2_components) {
+ $ret .= '../';
+ }
+ $ret .= join('/', @dir1_components);
+
+ # print STDERR "[$dir1] from [$dir2] => [$ret]\n";
+
+ return $ret;
+}
+
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-#!/usr/bin/perl
-# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-#!/usr/bin/perl
-# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-#!/usr/bin/perl
+#!@PERL_PATH@
# -*- cperl -*-
#
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-#!/usr/bin/perl
+#!@PERL_PATH@
## Emacs, this is -*- perl -*- mode? :-)
-# Copyright (c) 2000, 2014 Oracle and/or its affiliates. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
-#!/usr/bin/perl
-# Copyright (c) 2000, 2014 Oracle and/or its affiliates. All rights reserved.
-# Use is subject to license terms.
+#!@PERL_PATH@
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# *****************************
# Read configuration-file
MySQLaccess::Debug::Print(1, "Reading configuration file...");
- if (-f "./$script_conf") {
- require "./$script_conf";
- }
- elsif (-f "@sysconfdir@/$script_conf") {
+ if (-f "@sysconfdir@/$script_conf") {
+ print "Configuration file '$script_conf' is found in '@sysconfdir@/'\n";
require "@sysconfdir@/$script_conf";
}
elsif (-f "/etc/$script_conf") {
+ print "Configuration file '$script_conf' is found in '/etc/'\n";
require "/etc/$script_conf";
}
+ elsif (-f "./$script_conf") {
+ print "\nERROR! Configuration file '$script_conf' is found in the current ";
+ print "directory.\nThe permissible locations for this file are either ";
+ print "@sysconfdir@/ or /etc/\n";
+ print "Please move it to one of these locations and retry.\n\n";
+ exit 0;
+ }
+
# ****************************
# Read in all parameters
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
syslog_tag=
user='@MYSQLD_USER@'
pid_file=
+pid_file_append=
err_log=
+err_log_append=
syslog_tag_mysqld=mysqld
syslog_tag_mysqld_safe=mysqld_safe
err_log="$err_log".err
fi
+ err_log_append="$err_log"
case "$err_log" in
/* ) ;;
* ) err_log="$DATADIR/$err_log" ;;
esac
else
err_log=$DATADIR/`@HOSTNAME@`.err
+ err_log_append=`@HOSTNAME@`.err
fi
- append_arg_to_args "--log-error=$err_log"
+ append_arg_to_args "--log-error=$err_log_append"
if [ $want_syslog -eq 1 ]
then
if test -z "$pid_file"
then
pid_file="$DATADIR/`@HOSTNAME@`.pid"
+ pid_file_append="`@HOSTNAME@`.pid"
else
+ pid_file_append="$pid_file"
case "$pid_file" in
/* ) ;;
* ) pid_file="$DATADIR/$pid_file" ;;
esac
fi
-append_arg_to_args "--pid-file=$pid_file"
+append_arg_to_args "--pid-file=$pid_file_append"
if test -n "$mysql_unix_port"
then
-#!/usr/bin/perl
+#!@PERL_PATH@
-# Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
-#!/usr/bin/env perl
+#!@PERL_PATH@
# Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
#
-/* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
if (inited)
{
inited= 0;
- close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT);
+ close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT, true /*need_lock_log=true*/,
+ true /*need_lock_index=true*/);
mysql_mutex_destroy(&LOCK_log);
mysql_mutex_destroy(&LOCK_index);
mysql_mutex_destroy(&LOCK_commit);
bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg,
const char *log_name, bool need_lock_index)
{
+ bool error= false;
File index_file_nr= -1;
- DBUG_ASSERT(!my_b_inited(&index_file));
+
+ if (need_lock_index)
+ mysql_mutex_lock(&LOCK_index);
+ else
+ mysql_mutex_assert_owner(&LOCK_index);
/*
First open of this class instance
Add new entries to the end of it.
*/
myf opt= MY_UNPACK_FILENAME;
+
+ if (my_b_inited(&index_file))
+ goto end;
+
if (!index_file_name_arg)
{
index_file_name_arg= log_name; // Use same basename for index file
if (set_crash_safe_index_file_name(index_file_name_arg))
{
sql_print_error("MYSQL_BIN_LOG::set_crash_safe_index_file_name failed.");
- return TRUE;
+ error= true;
+ goto end;
}
/*
{
sql_print_error("MYSQL_BIN_LOG::open_index_file failed to "
"move crash_safe_index_file to index file.");
- return TRUE;
+ error= true;
+ goto end;
}
if ((index_file_nr= mysql_file_open(m_key_file_log_index,
*/
if (index_file_nr >= 0)
mysql_file_close(index_file_nr, MYF(0));
- return TRUE;
+ error= true;
+ goto end;
}
#ifdef HAVE_REPLICATION
if (set_purge_index_file_name(index_file_name_arg) ||
open_purge_index_file(FALSE) ||
- purge_index_entry(NULL, NULL, need_lock_index) ||
+ purge_index_entry(NULL, NULL, false) ||
close_purge_index_file() ||
DBUG_EVALUATE_IF("fault_injection_recovering_index", 1, 0))
{
sql_print_error("MYSQL_BIN_LOG::open_index_file failed to sync the index "
"file.");
- return TRUE;
+ error= TRUE;
+ goto end;
}
#endif
-
- return FALSE;
+end:
+ if (need_lock_index)
+ mysql_mutex_unlock(&LOCK_index);
+ return error;
}
enum cache_type io_cache_type_arg,
ulong max_size_arg,
bool null_created_arg,
+ bool need_lock_log,
bool need_lock_index,
bool need_sid_lock,
Format_description_log_event *extra_description_event)
{
- File file= -1;
// lock_index must be acquired *before* sid_lock.
DBUG_ASSERT(need_sid_lock || !need_lock_index);
purge_index_entry(NULL, NULL, need_lock_index);
close_purge_index_file();
#endif
- if (file >= 0)
- mysql_file_close(file, MYF(0));
- end_io_cache(&log_file);
- end_io_cache(&index_file);
- my_free(name);
- name= NULL;
- log_state= LOG_CLOSED;
+
if (binlog_error_action == ABORT_SERVER)
{
exec_binlog_error_action_abort("Either disk is full or file system is read "
" server.");
}
else
+ {
sql_print_error("Could not use %s for logging (error %d). "
"Turning logging off for the whole duration of the MySQL "
"server process. To turn it on again: fix the cause, "
- "shutdown the MySQL server and restart it.", name, errno);
+ "shutdown the MySQL server and restart it.",
+ (new_name) ? new_name : name, errno);
+ close(LOG_CLOSE_INDEX, need_lock_log, need_lock_index);
+ }
DBUG_RETURN(1);
}
else
mysql_mutex_assert_owner(&LOCK_index);
+ if (!my_b_inited(&index_file))
+ {
+ error= LOG_INFO_IO;
+ goto end;
+ }
+
// extend relative paths for log_name to be searched
if (log_name)
{
else
mysql_mutex_assert_owner(&LOCK_index);
+ if (!my_b_inited(&index_file))
+ {
+ error= LOG_INFO_IO;
+ goto err;
+ }
/* As the file is flushed, we can't get an error here */
my_b_seek(&index_file, linfo->index_file_offset);
/* Save variables so that we can reopen the log */
save_name=name;
name=0; // Protect against free
- close(LOG_CLOSE_TO_BE_OPENED);
+ close(LOG_CLOSE_TO_BE_OPENED, false/*need_lock_log=false*/,
+ false/*need_lock_index=false*/);
/*
First delete all old log files and then update the index file.
}
/* Start logging with a new file */
- close(LOG_CLOSE_INDEX | LOG_CLOSE_TO_BE_OPENED);
+ close(LOG_CLOSE_INDEX | LOG_CLOSE_TO_BE_OPENED,
+ false/*need_lock_log=false*/,
+ false/*need_lock_index=false*/);
if ((error= my_delete_allow_opened(index_file_name, MYF(0)))) // Reset (open will update)
{
if (my_errno == ENOENT)
if (!open_index_file(index_file_name, 0, false/*need_lock_index=false*/))
if ((error= open_binlog(save_name, 0, io_cache_type,
max_size, false,
+ false/*need_lock_log=false*/,
false/*need_lock_index=false*/,
false/*need_sid_lock=false*/,
NULL)))
old_name=name;
name=0; // Don't free name
- close(LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX);
+ close(LOG_CLOSE_TO_BE_OPENED | LOG_CLOSE_INDEX,
+ false/*need_lock_log=false*/,
+ false/*need_lock_index=false*/);
if (checksum_alg_reset != BINLOG_CHECKSUM_ALG_UNDEF)
{
file_to_open= new_name_ptr;
error= open_binlog(old_name, new_name_ptr, io_cache_type,
max_size, true/*null_created_arg=true*/,
+ false/*need_lock_log=false*/,
false/*need_lock_index=false*/,
true/*need_sid_lock=true*/,
extra_description_event);
- switch server to protected/readonly mode
- ...
*/
- close(LOG_CLOSE_INDEX);
if (binlog_error_action == ABORT_SERVER)
{
exec_binlog_error_action_abort("Either disk is full or file system is"
"again: fix the cause, shutdown the MySQL "
"server and restart it.",
new_name_ptr, errno);
+ close(LOG_CLOSE_INDEX, false /*need_lock_log=false*/,
+ false/*need_lock_index=false*/);
}
mysql_mutex_unlock(&LOCK_index);
if (need_lock_log)
mysql_mutex_unlock(&LOCK_log);
+ DEBUG_SYNC(current_thd, "after_disable_binlog");
DBUG_RETURN(error);
}
at once after close.
- LOG_CLOSE_STOP_EVENT : write a 'stop' event to the log
+ @param need_lock_log If true, this function acquires LOCK_log;
+ otherwise the caller should already have acquired it.
+
+ @param need_lock_index If true, this function acquires LOCK_index;
+ otherwise the caller should already have acquired it.
+
@note
One can do an open on the object at once after doing a close.
The internal structures are not freed until cleanup() is called
*/
-void MYSQL_BIN_LOG::close(uint exiting)
+void MYSQL_BIN_LOG::close(uint exiting, bool need_lock_log,
+ bool need_lock_index)
{ // One can't set log_type here!
DBUG_ENTER("MYSQL_BIN_LOG::close");
DBUG_PRINT("enter",("exiting: %d", (int) exiting));
+
+ if (need_lock_log)
+ mysql_mutex_lock(&LOCK_log);
+ else
+ mysql_mutex_assert_owner(&LOCK_log);
+
if (log_state == LOG_OPENED)
{
#ifdef HAVE_REPLICATION
called a not complete close earlier and the index file is still open.
*/
+ if (need_lock_index)
+ mysql_mutex_lock(&LOCK_index);
+ else
+ mysql_mutex_assert_owner(&LOCK_index);
+
if ((exiting & LOG_CLOSE_INDEX) && my_b_inited(&index_file))
{
end_io_cache(&index_file);
errno, my_strerror(errbuf, sizeof(errbuf), errno));
}
}
+
+ if (need_lock_index)
+ mysql_mutex_unlock(&LOCK_index);
+
log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED;
my_free(name);
name= NULL;
+
+ if (need_lock_log)
+ mysql_mutex_unlock(&LOCK_log);
+
DBUG_VOID_RETURN;
}
{
/* generate a new binlog to mask a corrupted one */
open_binlog(opt_name, 0, WRITE_CACHE, max_binlog_size, false,
+ true/*need_lock_log=true*/,
true/*need_lock_index=true*/,
true/*need_sid_lock=true*/,
NULL);
"the cause, shutdown the MySQL server and restart it.",
errmsg);
}
- close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT);
+ close(LOG_CLOSE_INDEX|LOG_CLOSE_STOP_EVENT, false/*need_lock_log=false*/,
+ true/*need_lock_index=true*/);
if (need_lock_log)
mysql_mutex_unlock(&LOCK_log);
DEBUG_SYNC(thd, "after_binlog_closed_due_to_error");
#ifndef BINLOG_H_INCLUDED
-/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
enum cache_type io_cache_type_arg,
ulong max_size,
bool null_created,
+ bool need_lock_log,
bool need_lock_index, bool need_sid_lock,
Format_description_log_event *extra_description_event);
bool open_index_file(const char *index_file_name_arg,
int purge_index_entry(THD *thd, ulonglong *decrease_log_space,
bool need_lock_index);
bool reset_logs(THD* thd);
- void close(uint exiting);
+ void close(uint exiting, bool need_lock_log, bool need_lock_index);
// iterating through the log index file
int find_log_pos(LOG_INFO* linfo, const char* log_name,
/*
- Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Filesort_info *table_sort);
static uint suffix_length(ulong string_length);
static SORT_ADDON_FIELD *get_addon_fields(ulong max_length_for_sort_data,
+ TABLE *const table,
Field **ptabfield,
uint sortlength, uint *plength);
static void unpack_addon_fields(struct st_sort_addon_field *addon_field,
to sorted fields and get its total length in addon_length.
*/
addon_field= get_addon_fields(max_length_for_sort_data,
+ table,
table->field, sort_length, &addon_length);
}
if (addon_field)
static SORT_ADDON_FIELD *
get_addon_fields(ulong max_length_for_sort_data,
+ TABLE *const table,
Field **ptabfield, uint sortlength, uint *plength)
{
Field **pfield;
uint length= 0;
uint fields= 0;
uint null_fields= 0;
- MY_BITMAP *read_set= (*ptabfield)->table->read_set;
+ MY_BITMAP *read_set= table->read_set;
/*
If there is a reference to a field in the query add it
/*
- Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
uchar *rec_buffer= key_buffer + m_rec_offset;
part_id= uint2korr(key_buffer);
- memcpy(buf, rec_buffer, m_rec_length);
+ /* Do column copy to avoid overwriting of non read columns
+ specific to table with innodb engine */
+ handler *file= m_file[part_id];
+ file->copy_cached_row(buf, rec_buffer, m_rec_length);
m_last_part= part_id;
m_top_entry= part_id;
}
#define HANDLER_INCLUDED
/*
- Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
by another transaction, the engine may try an optimistic read of
the last committed row value under the cursor.
*/
+ /**
+ Copy a cached row.
+ This is currently implemented only in innodb for supporting
+ HA_EXTRA_KEYREAD_PRESERVE_FIELDS.
+ Used when copying a row from the record priority queue to
+ the return buffer. For some engines, like InnoDB, only
+ marked columns must be copied,to preserve non-read columns.
+
+ @param[out] to_rec Buffer to copy to.
+ @param[in] from_rec Buffer to copy from.
+ @param[in] rec_length Record length
+ */
+ virtual void copy_cached_row(uchar *to_rec, const uchar *from_rec, uint rec_length)
+ { memcpy(to_rec, from_rec, rec_length); }
virtual void try_semi_consistent_read(bool) {}
virtual void unlock_row() {}
virtual int start_stmt(THD *thd, thr_lock_type lock_type) {return 0;}
item_equal(0), no_const_subst(0),
have_privileges(0), any_privileges(0)
{
+ if (f->table->pos_in_table_list != NULL)
+ context= &(f->table->pos_in_table_list->select_lex->context);
+
set_field(f);
/*
field_name and table_name should not point to garbage
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Hence we clear the previous errors and push one critical error message to
clients.
*/
- thd->clear_error();
- /*
- Adding ME_NOREFRESH flag will ensure that the error is sent to both
- client and to the server error log as well.
- */
- my_error(ER_BINLOG_LOGGING_IMPOSSIBLE, MYF(ME_NOREFRESH + ME_FATALERROR),
- err_string);
- thd->protocol->end_statement();
+ if (thd)
+ {
+ if (thd->is_error())
+ thd->clear_error();
+ /*
+ Adding ME_NOREFRESH flag will ensure that the error is sent to both
+ client and to the server error log as well.
+ */
+ my_error(ER_BINLOG_LOGGING_IMPOSSIBLE, MYF(ME_NOREFRESH + ME_FATALERROR),
+ err_string);
+ thd->protocol->end_statement();
+ }
+ else
+ sql_print_error("%s",err_string);
abort();
}
/*
- Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
DBUG_PRINT("info",("m_table_id: %llu m_flags: %d m_width: %lu data_size: %lu",
m_table_id.id(), m_flags, m_width, (ulong) data_size));
- // Allocate one extra byte, in case we have to do uint3korr!
- m_rows_buf= (uchar*) my_malloc(data_size + 1, MYF(MY_WME)); // didrik
+ m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME));
if (likely((bool)m_rows_buf))
{
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
ulong const new_alloc=
block_size * ((cur_size + length + block_size - 1) / block_size);
- // Allocate one extra byte, in case we have to do uint3korr!
uchar* const new_buf=
- (uchar*)my_realloc((uchar*)m_rows_buf, (uint) new_alloc + 1,
+ (uchar*)my_realloc((uchar*)m_rows_buf, (uint) new_alloc,
MYF(MY_ALLOW_ZERO_PTR|MY_WME));
if (unlikely(!new_buf))
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
thd->db, thd->db_length,
thd->charset());
+ /*
+ Starts a new stage in performance schema, if compiled in and enabled.
+ Also sets THD::proc_info (used by SHOW PROCESSLIST, column STATE)
+ */
THD_STAGE_INFO(thd, stage_init);
}
void init_net_server_extension(THD *thd)
{
-#ifdef HAVE_PSI_INTERFACE
/* Start with a clean state for connection events. */
thd->m_idle_psi= NULL;
thd->m_statement_psi= NULL;
thd->m_server_idle= false;
+
/* Hook up the NET_SERVER callback in the net layer. */
thd->m_net_server_extension.m_user_data= thd;
thd->m_net_server_extension.m_before_header= net_before_header_psi;
thd->m_net_server_extension.m_after_header= net_after_header_psi;
/* Activate this private extension for the mysqld server. */
thd->net.extension= & thd->m_net_server_extension;
-#else
- thd->net.extension= NULL;
-#endif
}
#endif /* EMBEDDED_LIBRARY */
const_cast<Gtid_set*>(gtid_state->get_logged_gtids()));
if (mysql_bin_log.open_binlog(opt_bin_logname, 0,
WRITE_CACHE, max_binlog_size, false,
+ true/*need_lock_log=true*/,
true/*need_lock_index=true*/,
true/*need_sid_lock=true*/,
NULL))
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#endif
DBUG_RETURN(1);
}
- pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1);
+ pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1);
/*
- We must allocate some extra bytes for the end 0 and to be able to
- read big compressed blocks + 1 safety byte since uint3korr() in
- net_read_packet() may actually read 4 bytes depending on build flags and
- platform.
+ We must allocate some extra bytes for the end 0 and to be able to
+ read big compressed blocks in net_read_packet().
*/
if (!(buff= (uchar*) my_realloc((char*) net->buff, pkt_length +
- NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
+ NET_HEADER_SIZE + COMP_HEADER_SIZE,
MYF(MY_WME))))
{
/* @todo: 1 and 2 codes are identical. */
if (net->compress)
{
/*
- The following uint3korr() may read 4 bytes, so make sure we don't
- read unallocated or uninitialized memory. The right-hand expression
- must match the size of the buffer allocated in net_realloc().
+ The right-hand expression must match the size of the buffer
+ allocated in net_realloc().
*/
DBUG_ASSERT(net->where_b + NET_HEADER_SIZE + sizeof(uint32) <=
- net->max_packet + NET_HEADER_SIZE + COMP_HEADER_SIZE + 1);
+ net->max_packet + NET_HEADER_SIZE + COMP_HEADER_SIZE);
/*
If the packet is compressed then complen > 0 and contains the
-/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
rec_cache_size= info->cache_records*info->reclength;
info->rec_cache_size= info->cache_records*info->ref_length;
- // We have to allocate one more byte to use uint3korr (see comments for it)
if (info->cache_records <= 2 ||
!(info->cache=(uchar*) my_malloc_lock(rec_cache_size+info->cache_records*
- info->struct_length+1,
+ info->struct_length,
MYF(0))))
{
*info= info_copy;
-/* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
enum_sql_command sql_command= thd->lex->sql_command;
if (sql_command == SQLCOM_COMMIT || sql_command == SQLCOM_BEGIN ||
sql_command == SQLCOM_ROLLBACK ||
+ sql_command == SQLCOM_CHANGE_DB ||
((sql_command == SQLCOM_SELECT ||
(sql_command == SQLCOM_SET_OPTION && !thd->lex->is_set_password_sql)) &&
!thd->lex->uses_stored_routines()))
-/* Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
char *log_file_name = linfo.log_file_name;
char search_file_name[FN_REFLEN], *name;
+ bool is_index_file_reopened_on_binlog_disable= false;
ulong ev_offset;
bool using_gtid_protocol= slave_gtid_executed != NULL;
bool searching_first_gtid= using_gtid_protocol;
if (goto_next_binlog)
{
+ DBUG_EXECUTE_IF("waiting_for_disable_binlog",
+ {
+ const char act[]= "now "
+ "signal dump_thread_reached_wait_point "
+ "wait_for continue_dump_thread no_clear_event";
+ DBUG_ASSERT(!debug_sync_set_action(current_thd,
+ STRING_WITH_LEN(act)));
+ };);
+
// clear flag because we open a new binlog
binlog_has_previous_gtids_log_event= false;
THD_STAGE_INFO(thd, stage_finished_reading_one_binlog_switching_to_next_binlog);
- switch (mysql_bin_log.find_next_log(&linfo, 1)) {
- case 0:
- break;
- default:
+ /*
+ When moving to next binlog, always check if binlog is enabled or not.
+ There can be critical errors like for example out of memory scenarios
+ which prevent mysqld server from writing to binlog. In those cases
+ server refers to binlog_error_action variable and takes the appropriate
+ action. If users choose to ignore the error then binary log will be
+ disabled and server will continue to do its work. In such cases dump
+ thread which is trying to move to the next log will fail as binlog index
+ file and binlog file are already closed and their corresponding caches
+ are also cleared.
+
+ Hence first check if binary log is enabled or not. If enabled look for
+ the next binary log in the index file. If it is disabled open the index
+ file once again and check if there any more binary logs that needs to be
+ sent. Keep reading binary log files until find_next_log returns empty.
+ If there is an error during open index file or we sent all binary logs
+ then ER_MASTER_FATAL_ERROR_READING_BINLOG is raised.
+ */
+ mysql_bin_log.lock_index();
+ if (!mysql_bin_log.is_open())
+ {
+ if (mysql_bin_log.open_index_file(mysql_bin_log.get_index_fname(),
+ linfo.log_file_name,FALSE))
+ {
+ errmsg = "Binary log is not open and failed to open index file to "
+ "retrieve next file.";
+ my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
+ mysql_bin_log.unlock_index();
+ GOTO_ERR;
+ }
+ is_index_file_reopened_on_binlog_disable= true;
+ }
+ if (mysql_bin_log.find_next_log(&linfo, 0))
+ {
+ DBUG_EXECUTE_IF("waiting_for_disable_binlog",
+ {
+ const char act[]= "now signal consumed_binlog";
+ DBUG_ASSERT(!debug_sync_set_action(current_thd,
+ STRING_WITH_LEN(act)));
+ };);
errmsg = "could not find next log";
my_errno= ER_MASTER_FATAL_ERROR_READING_BINLOG;
+ mysql_bin_log.unlock_index();
GOTO_ERR;
}
+ mysql_bin_log.unlock_index();
end_io_cache(&log);
mysql_file_close(file, MYF(MY_WME));
error_text[sizeof(error_text) - 1]= '\0';
}
end_io_cache(&log);
+ if (is_index_file_reopened_on_binlog_disable)
+ mysql_bin_log.close(LOG_CLOSE_INDEX, true/*need_lock_log=true*/,
+ true/*need_lock_index=true*/);
if (has_transmit_started)
(void) RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
/*
const char** errmsg)
{
int error=0;
+ const char *ln;
+ char name_buf[FN_REFLEN];
DBUG_ENTER("Relay_log_info::purge_relay_logs");
/*
if (!inited)
{
DBUG_PRINT("info", ("inited == 0"));
- DBUG_RETURN(0);
- }
+ if (error_on_rli_init_info)
+ {
+ ln= relay_log.generate_name(opt_relay_logname, "-relay-bin",
+ 1, name_buf);
+ if (relay_log.open_index_file(opt_relaylog_index_name, ln, TRUE))
+ {
+ sql_print_error("Unable to purge relay log files. Failed to open relay "
+ "log index file:%s.", relay_log.get_index_fname());
- DBUG_ASSERT(slave_running == 0);
- DBUG_ASSERT(mi->slave_running == 0);
+ DBUG_RETURN(1);
+ }
+ mysql_mutex_lock(&mi->data_lock);
+ if (relay_log.open_binlog(ln, 0, SEQ_READ_APPEND,
+ (max_relay_log_size ? max_relay_log_size :
+ max_binlog_size), true,
+ true/*need_lock_log=true*/,
+ true/*need_lock_index=true*/,
+ true/*need_sid_lock=true*/,
+ mi->get_mi_description_event()))
+ {
+ sql_print_error("Unable to purge relay log files. Failed to open relay "
+ "log file:%s.", relay_log.get_log_fname());
+ mysql_mutex_unlock(&mi->data_lock);
+ DBUG_RETURN(1);
+ }
+ mysql_mutex_unlock(&mi->data_lock);
+ }
+ else
+ DBUG_RETURN(0);
+ }
+ else
+ {
+ DBUG_ASSERT(slave_running == 0);
+ DBUG_ASSERT(mi->slave_running == 0);
+ }
slave_skip_counter= 0;
mysql_mutex_lock(&data_lock);
group_relay_log_pos,
false/*need_data_lock=false*/, errmsg, 0);
+ if (!inited && error_on_rli_init_info)
+ relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT,
+ true/*need_lock_log=true*/,
+ true/*need_lock_index=true*/);
+
err:
#ifndef DBUG_OFF
char buf[22];
if (relay_log.open_binlog(ln, 0, SEQ_READ_APPEND,
(max_relay_log_size ? max_relay_log_size :
max_binlog_size), true,
+ true/*need_lock_log=true*/,
true/*need_lock_index=true*/,
true/*need_sid_lock=true*/,
mi->get_mi_description_event()))
error_on_rli_init_info= true;
if (msg)
sql_print_error("%s.", msg);
- relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
+ relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT,
+ true/*need_lock_log=true*/,
+ true/*need_lock_index=true*/);
DBUG_RETURN(error);
}
cur_log_fd= -1;
}
inited = 0;
- relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT);
+ relay_log.close(LOG_CLOSE_INDEX | LOG_CLOSE_STOP_EVENT,
+ true/*need_lock_log=true*/,
+ true/*need_lock_index=true*/);
relay_log.harvest_bytes_written(&log_space_total);
/*
Delete the slave's temporary tables from memory.
-/* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
ulonglong new_pend_size;
PSI_stage_info old_stage;
-
DBUG_ASSERT(thd == current_thd);
- if (ev_size > rli->mts_pending_jobs_size_max)
- {
- char llbuff[22];
- llstr(rli->get_event_relay_log_pos(), llbuff);
- my_error(ER_MTS_EVENT_BIGGER_PENDING_JOBS_SIZE_MAX, MYF(0),
- ((Log_event*) (job_item->data))->get_type_str(),
- rli->get_event_relay_log_name(), llbuff, ev_size,
- rli->mts_pending_jobs_size_max);
- /* Waiting in slave_stop_workers() avoidance */
- rli->mts_group_status= Relay_log_info::MTS_KILLED_GROUP;
- return ret;
- }
-
mysql_mutex_lock(&rli->pending_jobs_lock);
new_pend_size= rli->mts_pending_jobs_size + ev_size;
- // C waits basing on *data* sizes in the queues
- while (new_pend_size > rli->mts_pending_jobs_size_max)
+ bool big_event= (ev_size > rli->mts_pending_jobs_size_max);
+ /*
+ C waits basing on *data* sizes in the queues.
+ If it is a big event (event size is greater than
+ slave_pending_jobs_size_max but less than slave_max_allowed_packet),
+ it will wait for all the jobs in the workers's queue to be
+ completed. If it is normal event (event size is less than
+ slave_pending_jobs_size_max), then it will wait for
+ enough empty memory to keep the event in one of the workers's
+ queue.
+ NOTE: Receiver thread (I/O thread) is taking care of restricting
+ the event size to slave_max_allowed_packet. If an event from
+ the master is bigger than this value, IO thread will be stopped
+ with error ER_NET_PACKET_TOO_LARGE.
+ */
+ while ( (!big_event && new_pend_size > rli->mts_pending_jobs_size_max)
+ || (big_event && rli->mts_pending_jobs_size != 0 ))
{
rli->mts_wq_oversize= TRUE;
rli->wq_size_waits_cnt++; // waiting due to the total size
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
-sql_authenticate
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
* An empty password is considered to be of mysql_native type.
*/
- if (combo->plugin.str == NULL || combo->plugin.str == '\0')
+ if (combo->plugin.str == NULL || combo->plugin.str[0] == '\0')
{
if (combo->uses_identified_by_password_clause)
{
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights
reserved.
This program is free software; you can redistribute it and/or modify
if (tables_used->uses_materialization())
{
/*
- Currently all result tables are MyISAM or HEAP. MyISAM allows caching
- unless table is under in a concurrent insert (which never could
- happen to a derived table). HEAP always allows caching.
+ Skip the derived table itself, but process its underlying tables and
+ other tables that follow.
*/
- DBUG_ASSERT(table->s->db_type() == heap_hton ||
- table->s->db_type() == myisam_hton);
- DBUG_RETURN(0);
+ continue;
}
/*
/*
- Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
case '>': /* end tag - read tag value */
in_tag= false;
+ /* Skip all whitespaces */
+ while (' ' == (chr= my_tospace(GET)))
+ {
+ }
+ /*
+ Push the first non-whitespace char back to Stack. This char would be
+ read in the upcoming call to read_value()
+ */
+ PUSH(chr);
chr= read_value('<', &value);
if(chr == my_b_EOF)
goto found_eof;
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
}
-/*
- Check if given expression uses only table fields covered by the given index
-
- SYNOPSIS
- uses_index_fields_only()
- item Expression to check
- tbl The table having the index
- keyno The index number
- other_tbls_ok TRUE <=> Fields of other non-const tables are allowed
-
- DESCRIPTION
- Check if given expression only uses fields covered by index #keyno in the
- table tbl. The expression can use any fields in any other tables.
-
- The expression is guaranteed not to be AND or OR - those constructs are
- handled outside of this function.
-
- RETURN
- TRUE Yes
- FALSE No
+/**
+ Check if given expression only uses fields covered by index #keyno in the
+ table tbl. The expression can use any fields in any other tables.
+
+ The expression is guaranteed not to be AND or OR - those constructs are
+ handled outside of this function.
+
+ Restrict some function types from being pushed down to storage engine:
+ a) Don't push down the triggered conditions. Nested outer joins execution
+ code may need to evaluate a condition several times (both triggered and
+ untriggered).
+ b) Stored functions contain a statement that might start new operations (like
+ DML statements) from within the storage engine. This does not work against
+ all SEs.
+ c) Subqueries might contain nested subqueries and involve more tables.
+
+ @param item Expression to check
+ @param tbl The table having the index
+ @param keyno The index number
+ @param other_tbls_ok TRUE <=> Fields of other non-const tables are allowed
+
+ @return false if No, true if Yes
*/
bool uses_index_fields_only(Item *item, TABLE *tbl, uint keyno,
bool other_tbls_ok)
{
+ // Restrictions b and c.
+ if (item->has_stored_program() || item->has_subquery())
+ return false;
+
if (item->const_item())
- {
- /*
- const_item() might not return correct value if the item tree
- contains a subquery. If this is the case we do not include this
- part of the condition.
- */
- return !item->has_subquery();
- }
+ return true;
const Item::Type item_type= item->type();
const Item_func::Functype func_type= item_func->functype();
/*
- Avoid some function types from being pushed down to storage engine:
- - Don't push down the triggered conditions. Nested outer joins
- execution code may need to evaluate a condition several times
- (both triggered and untriggered).
- TODO: Consider cloning the triggered condition and using the
- copies for:
- 1. push the first copy down, to have most restrictive
- index condition possible.
- 2. Put the second copy into tab->m_condition.
- - Stored functions contain a statement that might start new operations
- against the storage engine. This does not work against all storage
- engines.
+ Restriction a.
+ TODO: Consider cloning the triggered condition and using the copies
+ for:
+ 1. push the first copy down, to have most restrictive index condition
+ possible.
+ 2. Put the second copy into tab->m_condition.
*/
- if (func_type == Item_func::TRIG_COND_FUNC ||
- func_type == Item_func::FUNC_SP)
+ if (func_type == Item_func::TRIG_COND_FUNC)
return false;
/* This is a function, apply condition recursively to arguments */
(lex->sql_command == SQLCOM_CREATE_TABLE) &&
(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
+ const my_bool create_real_tables=
+ (lex->sql_command == SQLCOM_CREATE_TABLE) &&
+ !(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
+
const my_bool drop_temp_tables=
(lex->sql_command == SQLCOM_DROP_TABLE) &&
lex->drop_temporary;
const my_bool update_real_tables=
- some_non_temp_table_to_be_updated(thd, all_tables) &&
- !(create_temp_tables || drop_temp_tables);
-
+ ((create_real_tables ||
+ some_non_temp_table_to_be_updated(thd, all_tables)) &&
+ !(create_temp_tables || drop_temp_tables));
const my_bool create_or_drop_databases=
(lex->sql_command == SQLCOM_CREATE_DB) ||
-/* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Item *item_tmp;
while ((item_tmp= it++))
{
+ /*
+ If the outer query has a GROUP BY clause, an outer reference to this
+ query block may have been wrapped in a Item_outer_ref, which has not
+ been fixed yet. An Item_type_holder must be created based on a fixed
+ Item, so use the inner Item instead.
+ */
+ DBUG_ASSERT(item_tmp->fixed ||
+ (item_tmp->type() == Item::REF_ITEM &&
+ ((Item_ref *)(item_tmp))->ref_type() ==
+ Item_ref::OUTER_REF));
+ if (!item_tmp->fixed)
+ item_tmp= item_tmp->real_item();
+
/* Error's in 'new' will be detected after loop */
types.push_back(new Item_type_holder(thd_arg, item_tmp));
}
/*****************************************************************************
-Copyright (c) 2008, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2008, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
page_format = static_cast<ib_bool_t>(
dict_table_is_comp(tuple->index->table));
+
rec = btr_pcur_get_rec(pcur);
- if (prebuilt->innodb_api_rec &&
- prebuilt->innodb_api_rec != rec) {
- rec = prebuilt->innodb_api_rec;
+ if (!rec_get_deleted_flag(rec, page_format)) {
+ if (prebuilt->innodb_api &&
+ prebuilt->innodb_api_rec != NULL) {
+ rec =prebuilt->innodb_api_rec;
+ }
}
if (!rec_get_deleted_flag(rec, page_format)) {
buf = static_cast<unsigned char*>(mem_alloc(UNIV_PAGE_SIZE));
+ if (prebuilt->innodb_api) {
+ prebuilt->cursor_heap = cursor->heap;
+ }
+
/* We want to position at one of the ends, row_search_for_mysql()
uses the search_tuple fields to work out what to do. */
dtuple_set_n_fields(prebuilt->search_tuple, 0);
row_prebuilt_t* prebuilt = cursor->prebuilt;
byte buf[UNIV_PAGE_SIZE_MAX];
+ if (prebuilt->innodb_api) {
+ prebuilt->cursor_heap = cursor->heap;
+ }
/* We want to move to the next record */
dtuple_set_n_fields(prebuilt->search_tuple, 0);
buf = static_cast<unsigned char*>(mem_alloc(UNIV_PAGE_SIZE));
+ if (prebuilt->innodb_api) {
+ prebuilt->cursor_heap = cursor->heap;
+ }
err = static_cast<ib_err_t>(row_search_for_mysql(
buf, ib_srch_mode, prebuilt, cursor->match_mode, 0));
return((FT_INFO*) fts_hdl);
}
+/*****************************************************************//**
+Copy a cached MySQL row.
+If requested, also avoids overwriting non-read columns.
+@param[out] buf Row in MySQL format.
+@param[in] cached_row Which row to copy.
+@param[in] rec_len Record length. */
+void
+ha_innobase::copy_cached_row(
+ uchar* buf,
+ const uchar* cached_row,
+ uint rec_len)
+{
+ if (prebuilt->keep_other_fields_on_keyread) {
+ row_sel_copy_cached_fields_for_mysql(buf, cached_row,
+ prebuilt);
+ } else {
+ memcpy(buf, cached_row, rec_len);
+ }
+}
+
+
/*****************************************************************//**
Set up search tuple for a query through FTS_DOC_ID_INDEX on
supplied Doc ID. This is used by MySQL to retrieve the documents
/*****************************************************************************
-Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
int index_first(uchar * buf);
int index_last(uchar * buf);
+ /* Copy a cached MySQL row. If requested, also avoids
+ overwriting non-read columns. */
+ void copy_cached_row(uchar *to_rec, const uchar *from_rec,
+ uint rec_length);
int rnd_init(bool scan);
int rnd_end();
int rnd_next(uchar *buf);
/*****************************************************************************
-Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
mem_heap_t* heap; /*!< memory heap from which
these auxiliary structures are
allocated when needed */
+ mem_heap_t* cursor_heap; /*!< memory heap from which
+ innodb_api_buf is allocated per session*/
ins_node_t* ins_node; /*!< Innobase SQL insert node
used to perform inserts
to the table */
unsigned innodb_api:1; /*!< whether this is a InnoDB API
query */
const rec_t* innodb_api_rec; /*!< InnoDB API search result */
+ void* innodb_api_buf; /*!< Buffer holding copy of the physical
+ Innodb API search record */
+ ulint innodb_api_rec_size; /*!< Size of the Innodb API record */
byte* srch_key_val1; /*!< buffer used in converting
search key values from MySQL format
to InnoDB format.*/
/*****************************************************************************
-Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
when data != NULL */
};
+/** Copy used fields from cached row.
+Copy cache record field by field, don't touch fields that
+are not covered by current key.
+@param[out] buf Where to copy the MySQL row.
+@param[in] cached_rec What to copy (in MySQL row format).
+@param[in] prebuilt prebuilt struct. */
+void
+row_sel_copy_cached_fields_for_mysql(
+ byte* buf,
+ const byte* cached_rec,
+ row_prebuilt_t* prebuilt);
+
/** Query plan */
struct plan_t{
dict_table_t* table; /*!< table struct in the dictionary
/*****************************************************************************
-Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2005, 2017, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
row_ext_t* ext;
page_cur_t* cur = btr_pcur_get_page_cur(&pcur);
+ mem_heap_empty(row_heap);
+
page_cur_move_to_next(cur);
if (page_cur_is_after_last(cur)) {
if (err != DB_SUCCESS) {
goto func_exit;
}
-
- mem_heap_empty(row_heap);
}
func_exit:
/*****************************************************************************
-Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
#ifdef UNIV_DEBUG
/** Convert a non-SQL-NULL field from Innobase format to MySQL format. */
-# define row_sel_field_store_in_mysql_format(dest,templ,idx,field,src,len) \
- row_sel_field_store_in_mysql_format_func(dest,templ,idx,field,src,len)
+# define row_sel_field_store_in_mysql_format(dest,templ,idx,field,src,len,sec) \
+ row_sel_field_store_in_mysql_format_func(dest,templ,idx,field,src,len,sec)
#else /* UNIV_DEBUG */
/** Convert a non-SQL-NULL field from Innobase format to MySQL format. */
-# define row_sel_field_store_in_mysql_format(dest,templ,idx,field,src,len) \
- row_sel_field_store_in_mysql_format_func(dest,templ,src,len)
+# define row_sel_field_store_in_mysql_format(dest,templ,idx,field,src,len,sec) \
+ row_sel_field_store_in_mysql_format_func(dest,templ,src,len,sec)
#endif /* UNIV_DEBUG */
-/**************************************************************//**
-Stores a non-SQL-NULL field in the MySQL format. The counterpart of this
-function is row_mysql_store_col_in_innobase_format() in row0mysql.cc. */
+/** Stores a non-SQL-NULL field in the MySQL format. The counterpart of this
+function is row_mysql_store_col_in_innobase_format() in row0mysql.cc.
+@param[in,out] dest buffer where to store; NOTE
+ that BLOBs are not in themselves stored
+ here: the caller must allocate and copy
+ the BLOB into buffer before, and pass
+ the pointer to the BLOB in 'data'
+@param[in] templ MySQL column template. Its following fields
+ are referenced: type, is_unsigned, mysql_col_len,
+ mbminlen, mbmaxlen
+@param[in] index InnoDB index
+@param[in] field_no templ->rec_field_no or templ->clust_rec_field_no
+ or templ->icp_rec_field_no
+@param[in] data data to store
+@param[in] len length of the data
+@param[in] sec_field secondary index field no if the secondary index
+ record but the prebuilt template is in
+ clustered index format and used only for end
+ range comparison. */
static MY_ATTRIBUTE((nonnull))
void
row_sel_field_store_in_mysql_format_func(
-/*=====================================*/
- byte* dest, /*!< in/out: buffer where to store; NOTE
- that BLOBs are not in themselves
- stored here: the caller must allocate
- and copy the BLOB into buffer before,
- and pass the pointer to the BLOB in
- 'data' */
+ byte* dest,
const mysql_row_templ_t* templ,
- /*!< in: MySQL column template.
- Its following fields are referenced:
- type, is_unsigned, mysql_col_len,
- mbminlen, mbmaxlen */
#ifdef UNIV_DEBUG
const dict_index_t* index,
- /*!< in: InnoDB index */
ulint field_no,
- /*!< in: templ->rec_field_no or
- templ->clust_rec_field_no or
- templ->icp_rec_field_no */
#endif /* UNIV_DEBUG */
- const byte* data, /*!< in: data to store */
- ulint len) /*!< in: length of the data */
+ const byte* data,
+ ulint len,
+ ulint sec_field)
{
byte* ptr;
#ifdef UNIV_DEBUG
const dict_field_t* field
= dict_index_get_nth_field(index, field_no);
+ bool clust_templ_for_sec = (sec_field != ULINT_UNDEFINED);
#endif /* UNIV_DEBUG */
ut_ad(len != UNIV_SQL_NULL);
containing UTF-8 ENUM columns due to Bug #9526. */
ut_ad(!templ->mbmaxlen
|| !(templ->mysql_col_len % templ->mbmaxlen));
- ut_ad(len * templ->mbmaxlen >= templ->mysql_col_len
+ ut_ad(clust_templ_for_sec
+ || len * templ->mbmaxlen >= templ->mysql_col_len
|| (field_no == templ->icp_rec_field_no
&& field->prefix_len > 0));
ut_ad(!(field->prefix_len % templ->mbmaxlen));
case DATA_DECIMAL:
/* Above are the valid column types for MySQL data. */
#endif /* UNIV_DEBUG */
+ /* If sec_field value is present then mapping of
+ secondary index records to clustered index template
+ happens for end range comparison. So length can
+ vary according to secondary index record length. */
ut_ad(field->prefix_len
? field->prefix_len == len
- : templ->mysql_col_len == len);
+ : (clust_templ_for_sec ?
+ 1 : (templ->mysql_col_len == len)));
memcpy(dest, data, len);
}
}
#ifdef UNIV_DEBUG
/** Convert a field from Innobase format to MySQL format. */
-# define row_sel_store_mysql_field(m,p,r,i,o,f,t,c) \
- row_sel_store_mysql_field_func(m,p,r,i,o,f,t,c)
+# define row_sel_store_mysql_field(m,p,r,i,o,f,t,s) \
+ row_sel_store_mysql_field_func(m,p,r,i,o,f,t,s)
#else /* UNIV_DEBUG */
/** Convert a field from Innobase format to MySQL format. */
-# define row_sel_store_mysql_field(m,p,r,i,o,f,t,c) \
- row_sel_store_mysql_field_func(m,p,r,o,f,t,c)
+# define row_sel_store_mysql_field(m,p,r,i,o,f,t,s) \
+ row_sel_store_mysql_field_func(m,p,r,o,f,t,s)
#endif /* UNIV_DEBUG */
/** Convert a field in the Innobase format to a field in the MySQL format.
@param[out] mysql_rec record in the MySQL format
or sec field no if clust_templ_for_sec
is TRUE
@param[in] templ row template
-@param[in] clust_templ_for_sec TRUE if rec belongs to secondary index
+@param[in] sec_field_no field_no if rec belongs to secondary index
but prebuilt template is in clustered
index format and used only for end
range comparison. */
const ulint* offsets,
ulint field_no,
const mysql_row_templ_t*templ,
- bool clust_templ_for_sec)
+ ulint sec_field_no)
{
const byte* data;
ulint len;
+ ulint clust_field_no;
+ bool clust_templ_for_sec = (sec_field_no != ULINT_UNDEFINED);
ut_ad(prebuilt->default_rec);
ut_ad(templ);
|| field_no == templ->rec_field_no
|| field_no == templ->icp_rec_field_no);
ut_ad(rec_offs_validate(rec,
- clust_templ_for_sec == true ? prebuilt->index : index, offsets));
+ clust_templ_for_sec ? prebuilt->index : index, offsets));
+
+ /* If sec_field_no is present then extract the data from record
+ using secondary field no. */
+ if (clust_templ_for_sec) {
+ clust_field_no = field_no;
+ field_no = sec_field_no;
+ }
if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, field_no))) {
row_sel_field_store_in_mysql_format(
mysql_rec + templ->mysql_col_offset,
- templ, index, field_no, data, len);
+ templ, index, field_no, data, len,
+ ULINT_UNDEFINED);
if (heap != prebuilt->blob_heap) {
mem_heap_free(heap);
mem_heap_dup(prebuilt->blob_heap, data, len));
}
+ /* Reassign the clustered index field no. */
+ if (clust_templ_for_sec) {
+ field_no = clust_field_no;
+ }
+
row_sel_field_store_in_mysql_format(
mysql_rec + templ->mysql_col_offset,
- templ, index, field_no, data, len);
+ templ, index, field_no, data, len, sec_field_no);
}
ut_ad(len != UNIV_SQL_NULL);
= rec_clust
? templ->clust_rec_field_no
: templ->rec_field_no;
+ ulint sec_field_no = ULINT_UNDEFINED;
+
/* We should never deliver column prefixes to MySQL,
except for evaluating innobase_index_cond(). */
ut_ad(dict_index_get_nth_field(index, field_no)->prefix_len
ut_ad(templ->rec_field_no == templ->clust_rec_field_no);
- field_no = it - template_col.begin();
+ sec_field_no = it - template_col.begin();
}
if (!row_sel_store_mysql_field(mysql_rec, prebuilt,
rec, index, offsets,
field_no, templ,
- clust_templ_for_sec)) {
+ sec_field_no)) {
return(FALSE);
}
}
NOTE, the record must be cluster index record. Secondary index
might not have the Doc ID */
if (dict_table_has_fts_index(prebuilt->table)
- && dict_index_is_clust(index)) {
+ && dict_index_is_clust(index)
+ && !clust_templ_for_sec) {
prebuilt->fts_doc_id = fts_get_doc_id_from_rec(
prebuilt->table, rec, NULL);
ut_memcpy(buf, cache, len);
}
+/** Copy used fields from cached row.
+Copy cache record field by field, don't touch fields that
+are not covered by current key.
+@param[out] buf Where to copy the MySQL row.
+@param[in] cached_rec What to copy (in MySQL row format).
+@param[in] prebuilt prebuilt struct. */
+void
+row_sel_copy_cached_fields_for_mysql(
+ byte* buf,
+ const byte* cached_rec,
+ row_prebuilt_t* prebuilt)
+{
+ const mysql_row_templ_t*templ;
+ ulint i;
+ for (i = 0; i < prebuilt->n_template; i++) {
+ templ = prebuilt->mysql_template + i;
+
+ row_sel_copy_cached_field_for_mysql(
+ buf, cached_rec, templ);
+ /* Copy NULL bit of the current field from cached_rec
+ to buf */
+ if (templ->mysql_null_bit_mask) {
+ buf[templ->mysql_null_byte_offset]
+ ^= (buf[templ->mysql_null_byte_offset]
+ ^ cached_rec[templ->mysql_null_byte_offset])
+ & (byte) templ->mysql_null_bit_mask;
+ }
+ }
+}
+
/********************************************************************//**
Pops a cached row for MySQL from the fetch cache. */
UNIV_INLINE
if (!row_sel_store_mysql_field(mysql_rec, prebuilt,
rec, prebuilt->index, offsets,
templ->icp_rec_field_no,
- templ, false)) {
+ templ, ULINT_UNDEFINED)) {
return(ICP_NO_MATCH);
}
}
btr_pcur_store_position(pcur, &mtr);
- if (prebuilt->innodb_api) {
- prebuilt->innodb_api_rec = result_rec;
+ if (prebuilt->innodb_api
+ && (btr_pcur_get_rec(pcur) != result_rec)) {
+ ulint rec_size = rec_offs_size(offsets);
+ if (!prebuilt->innodb_api_rec_size ||
+ (prebuilt->innodb_api_rec_size < rec_size)) {
+ prebuilt->innodb_api_buf =
+ static_cast<byte*>
+ (mem_heap_alloc(prebuilt->cursor_heap,rec_size));
+ prebuilt->innodb_api_rec_size = rec_size;
+ }
+ prebuilt->innodb_api_rec =
+ rec_copy(
+ prebuilt->innodb_api_buf, result_rec, offsets);
}
}
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#endif
fn_format(from,name,"",MI_NAME_IEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
- if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from))
+ if (my_is_symlink(from, NULL) && (*myisam_test_invalid_symlink)(from))
{
/*
Symlink is pointing to file in data directory.
DBUG_RETURN(my_errno);
}
fn_format(from,name,"",MI_NAME_DEXT,MY_UNPACK_FILENAME|MY_APPEND_EXT);
- if (my_is_symlink(from) && (*myisam_test_invalid_symlink)(from))
+ if (my_is_symlink(from, NULL) && (*myisam_test_invalid_symlink)(from))
{
/*
Symlink is pointing to file in data directory.
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
ulong rec_per_key_part[HA_MAX_POSSIBLE_KEY*MI_MAX_KEY_SEG];
my_off_t key_root[HA_MAX_POSSIBLE_KEY],key_del[MI_MAX_KEY_BLOCK_SIZE];
ulonglong max_key_file_length, max_data_file_length;
+ ST_FILE_ID file_id= {0, 0};
DBUG_ENTER("mi_open");
LINT_INIT(m_info);
realpath_err= my_realpath(name_buff,
fn_format(org_name,name,"",MI_NAME_IEXT,4),MYF(0));
- if (my_is_symlink(org_name) &&
- (realpath_err || (*myisam_test_invalid_symlink)(name_buff)))
+ if (my_is_symlink(name_buff, &file_id))
{
- my_errno= HA_WRONG_CREATE_OPTION;
- DBUG_RETURN (NULL);
+ if (realpath_err ||
+ (*myisam_test_invalid_symlink)(name_buff) ||
+ my_is_symlink(name_buff, &file_id))
+ {
+ my_errno= HA_WRONG_CREATE_OPTION;
+ DBUG_RETURN (NULL);
+ }
}
if (!internal_table)
my_errno= HA_ERR_CRASHED;
goto err;
});
+ DEBUG_SYNC_C("before_opening_indexfile");
if ((kfile= mysql_file_open(mi_key_file_kfile,
name_buff,
- (open_mode= O_RDWR) | O_SHARE, MYF(0))) < 0)
+ (open_mode= O_RDWR) | O_SHARE | O_NOFOLLOW,
+ MYF(0))) < 0)
{
if ((errno != EROFS && errno != EACCES) ||
mode != O_RDONLY ||
(kfile= mysql_file_open(mi_key_file_kfile,
name_buff,
- (open_mode= O_RDONLY) | O_SHARE, MYF(0))) < 0)
+ (open_mode= O_RDONLY) | O_SHARE | O_NOFOLLOW,
+ MYF(0))) < 0)
goto err;
}
+
+ if (!my_is_same_file(kfile, &file_id))
+ {
+ mysql_file_close(kfile, MYF(0));
+ my_errno= HA_WRONG_CREATE_OPTION;
+ goto err;
+ }
+
share->mode=open_mode;
errpos=1;
if (mysql_file_read(kfile, share->state.header.file_version, head_length,
{
char *data_name= share->data_file_name;
char real_data_name[FN_REFLEN];
+ ST_FILE_ID file_id= {0, 0};
if (org_name)
{
fn_format(real_data_name,org_name,"",MI_NAME_DEXT,4);
- if (my_is_symlink(real_data_name))
+ if (my_is_symlink(real_data_name, &file_id))
{
if (my_realpath(real_data_name, real_data_name, MYF(0)) ||
- (*myisam_test_invalid_symlink)(real_data_name))
+ (*myisam_test_invalid_symlink)(real_data_name) ||
+ my_is_symlink(real_data_name, &file_id))
{
my_errno= HA_WRONG_CREATE_OPTION;
return 1;
data_name= real_data_name;
}
}
+ DEBUG_SYNC_C("before_opening_datafile");
info->dfile= mysql_file_open(mi_key_file_dfile,
- data_name, share->mode | O_SHARE, MYF(MY_WME));
- return info->dfile >= 0 ? 0 : 1;
+ data_name, share->mode | O_SHARE | O_NOFOLLOW,
+ MYF(MY_WME));
+ if (info->dfile < 0)
+ return 1;
+ if (org_name && !my_is_same_file(info->dfile, &file_id))
+ {
+ mysql_file_close(info->dfile, MYF(0));
+ my_errno= HA_WRONG_CREATE_OPTION;
+ return 1;
+ }
+ return 0;
}
-/* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
write_set= &write_set_struct;
read_set= NULL;
next_number_field= NULL; // No autoinc column
-
+ pos_in_table_list= NULL;
EXPECT_EQ(0, bitmap_init(write_set, &write_set_buf, s->fields, false));
static const char *table_name= "Fake";
-/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
1, // packlength_arg
tl, // typelib_arg
&my_charset_latin1); // charset_arg
- f->table= new Fake_TABLE(f);
+ f->table= ::new Fake_TABLE(f);
return f;
}
// Copy_field DTOR is not invoked in all contexts, so we may leak memory.
EXPECT_FALSE(cf->tmp.is_alloced());
- delete f_to->table;
- delete f_from->table;
+ ::delete static_cast<Fake_TABLE*>(f_to->table);
+ ::delete static_cast<Fake_TABLE*>(f_from->table);
}
-/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
uchar null_byte;
void initialize()
{
- table = new Fake_TABLE(this);
+ table = ::new Fake_TABLE(this);
EXPECT_FALSE(table == NULL) << "Out of memory";
ptr= buffer;
memset(buffer, 0, PACK_LENGTH);
store_timestamp_called= true;
}
- ~Mock_field_timestamp() { delete table; }
+ ~Mock_field_timestamp() { ::delete static_cast<Fake_TABLE*>(table); }
};
#endif // MOCK_FIELD_TIMESTAMP_H
-/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
uchar null_byte;
void initialize()
{
- table = new Fake_TABLE(this);
+ table = ::new Fake_TABLE(this);
EXPECT_FALSE(table == NULL) << "Out of memory";
ptr= buffer;
memset(buffer, 0, PACK_LENGTH);
return Field_timestampf::store_timestamp_internal(tm);
}
- ~Mock_field_timestampf() { delete table; }
+ ~Mock_field_timestampf() { ::delete static_cast<Fake_TABLE*>(table); }
};
#endif // MOCK_FIELD_TIMESTAMPF_H
-/* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
TEST_F(FatalSignalDeathTest, Segfault)
{
- int *pint= NULL;
#if defined(__WIN__)
+ int *pint= NULL;
/*
After upgrading from gtest 1.5 to 1.6 this segfault is no longer
caught by handle_fatal_signal(). We get an empty error message from the
EXPECT_DEATH_IF_SUPPORTED(*pint= 42, "");
#elif defined(__SANITIZE_ADDRESS__)
/* gcc 4.8.1 with '-fsanitize=address -O1' */
- EXPECT_DEATH_IF_SUPPORTED(*pint= 42, ".*ASAN:SIGSEGV.*");
+ /* Newer versions of ASAN give other error message, disable it */
+ // EXPECT_DEATH_IF_SUPPORTED(*pint= 42, ".*ASAN:SIGSEGV.*");
#else
+ int *pint= NULL;
/*
On most platforms we get SIGSEGV == 11, but SIGBUS == 10 is also possible.
And on Mac OsX we can get SIGILL == 4 (but only in optmized mode).