+mysql-wsrep-5.6 (5.6.36-0~u14.04+mos0) mos; urgency=medium
+
+ * Update mysql to 5.6.36
+ * d/p/* - quilt refresh to avoid fuzz
+ * d/rules - switch to bundled editline instead of system to avoid broken
+ build
+
+ -- Dmitry Teselkin <mos-linux@mirantis.com> Thu, 25 May 2017 18:02:02 +0300
+
mysql-wsrep-5.6 (5.6.35-0~u14.04+mos2) mos; urgency=low
* Add libmysqlclient18 metapackage
--- a/mysql-test/lib/mtr_cases.pm
+++ b/mysql-test/lib/mtr_cases.pm
-@@ -287,7 +287,8 @@ sub collect_one_suite($)
+@@ -287,7 +287,8 @@
else
{
$suitedir= my_find_dir($::basedir,
+ ["lib/mysql-testsuite/suite",
+ "share/mysql-test/suite",
"mysql-test/suite",
+ "lib/mysql-test/suite",
"internal/mysql-test/suite",
- "mysql-test",
+SET(_FILE_OFFSET_BITS 64)
--- a/mysql-test/lib/My/Platform.pm
+++ b/mysql-test/lib/My/Platform.pm
-@@ -110,6 +110,9 @@ sub check_socket_path_length {
+@@ -110,6 +110,9 @@
# This may not be true, but we can't test for it on AIX due to Perl bug
# See Bug #45771
return 0 if ($^O eq 'aix');
Last-Update: 2012-04-28
--- a/mysql-test/lib/My/Platform.pm
+++ b/mysql-test/lib/My/Platform.pm
-@@ -113,6 +113,8 @@ sub check_socket_path_length {
+@@ -113,6 +113,8 @@
# Similarly the path length is hidden.
# See Debian bug #651002
return 0 if ($^O eq 'gnu');
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
-@@ -29,9 +29,6 @@ err_log=
+@@ -29,9 +29,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,
-@@ -154,7 +151,7 @@ eval_log_error () {
+@@ -169,7 +166,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):" \
-@@ -815,6 +815,13 @@ mysqld daemon not started"
+@@ -891,6 +888,13 @@
fi
#
-DWITH_WSREP=1 \
-DWITH_LIBWRAP=ON \
-DWITH_ZLIB=system \
- -DWITH_EDITLINE=system \
+ -DWITH_EDITLINE=bundled \
$(USE_STATIC_MYSQLD) \
-DWITH_SSL=system \
-DCOMPILATION_COMMENT="($(DISTRIBUTION))" \
-# 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
ENDIF()
ENDIF()
-
-OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON)
-IF(ENABLE_DEBUG_SYNC)
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
-ENDIF()
+# Always enable debug sync for debug builds.
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
# Older versions of ccache must be disabled: export CCACHE_DISABLE=1
# See http://www.cmake.org/Wiki/CTest/Coverage
ADD_SUBDIRECTORY(packaging/rpm-fedora)
ADD_SUBDIRECTORY(packaging/rpm-sles)
ADD_SUBDIRECTORY(packaging/rpm-docker)
+ ADD_SUBDIRECTORY(packaging/deb-in)
ENDIF()
INCLUDE(cmake/abi_check.cmake)
is released under the version 2 of the GNU General Public License.
MySQL is brought to you by Oracle.
-Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
License information can be found in the COPYING file.
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=6
-MYSQL_VERSION_PATCH=35
+MYSQL_VERSION_PATCH=36
MYSQL_VERSION_EXTRA=
/*
- 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
/**
Wrapper for mysql_real_connect() that checks if SSL connection is establised.
- The function calls mysql_real_connect() first, then if given ssl_required==TRUE
- argument (i.e. --ssl-mode=REQUIRED option used) checks current SSL chiper to
- ensure that SSL is used for current connection.
- Otherwise it returns NULL and sets errno to CR_SSL_CONNECTION_ERROR.
+ The function calls mysql_real_connect() first. Then, if the ssl_required
+ argument is TRUE (i.e., the --ssl-mode=REQUIRED option was specified), it
+ checks the current SSL cipher to ensure that SSL is used for the current
+ connection. Otherwise, it returns NULL and sets errno to
+ CR_SSL_CONNECTION_ERROR.
- All clients (except mysqlbinlog which disregards SSL options) use this function
- instead of mysql_real_connect() to handle --ssl-mode=REQUIRED option.
+ All clients (except mysqlbinlog, which disregards SSL options) use this
+ function instead of mysql_real_connect() to handle the --ssl-mode=REQUIRED
+ option.
*/
MYSQL *mysql_connect_ssl_check(MYSQL *mysql_arg, const char *host,
const char *user, const char *passwd,
const char *unix_socket, ulong client_flag,
my_bool ssl_required MY_ATTRIBUTE((unused)))
{
- MYSQL *mysql= mysql_real_connect(mysql_arg, host, user, passwd, db, port,
- unix_socket, client_flag);
+ MYSQL *mysql;
+
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
+ enum mysql_ssl_mode opt_ssl_mode= SSL_MODE_REQUIRED;
+ if (ssl_required &&
+ mysql_options(mysql_arg, MYSQL_OPT_SSL_MODE, (char *) &opt_ssl_mode))
+ {
+ NET *net= &mysql_arg->net;
+ net->last_errno= CR_SSL_CONNECTION_ERROR;
+ strmov(net->last_error, "Client library doesn't support MYSQL_SSL_REQUIRED option");
+ strmov(net->sqlstate, "HY000");
+ return NULL;
+ }
+#endif
+ mysql= mysql_real_connect(mysql_arg, host, user, passwd, db, port,
+ unix_socket, client_flag);
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
if (mysql && /* connection established. */
ssl_required && /* --ssl-mode=REQUIRED. */
/*
- 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
"program_name", "mysql");
if (!mysql_connect_ssl_check(kill_mysql, current_host, current_user,
opt_password, "", opt_mysql_port,
- opt_mysql_unix_port, 0, opt_ssl_required))
+ opt_mysql_unix_port, 0,
+ opt_ssl_mode == SSL_MODE_REQUIRED))
{
tee_fprintf(stdout, "%s -- sorry, cannot connect to server to kill query, giving up ...\n", reason);
goto err;
if not.
*/
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_EDITLINE_INTERFACE)
static int fake_magic_space(int, int);
extern "C" char *no_completion(const char*,int)
#elif defined(USE_LIBEDIT_INTERFACE)
}
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_EDITLINE_INTERFACE)
static int fake_magic_space(int, int)
#else
static int fake_magic_space(const char *, int)
rl_readline_name = name;
/* Tell the completer that we want a crack first. */
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_EDITLINE_INTERFACE)
rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
int end MY_ATTRIBUTE((unused)))
{
if (!status.batch && !quick)
-#if defined(USE_NEW_READLINE_INTERFACE)
+#if defined(USE_NEW_EDITLINE_INTERFACE)
return rl_completion_matches(text, new_command_generator);
#else
return completion_matches((char *)text, (CPFunction *)new_command_generator);
if (!mysql_connect_ssl_check(&mysql, host, user, password,
database, opt_mysql_port, opt_mysql_unix_port,
connect_flag | CLIENT_MULTI_STATEMENTS,
- opt_ssl_required))
+ opt_ssl_mode == SSL_MODE_REQUIRED))
{
if (!silent ||
(mysql_errno(&mysql) != CR_CONN_HOST_ERROR &&
/*
- 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
va_end(args);
+#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
/* If given --ssl-mode=REQUIRED propagate it to the tool. */
- if (opt_ssl_required)
+ if (opt_ssl_mode == SSL_MODE_REQUIRED)
dynstr_append(&ds_cmdline, "--ssl-mode=REQUIRED");
+#endif
#ifdef __WIN__
dynstr_append(&ds_cmdline, "\"");
/*
- 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
for (;;)
{
if (mysql_connect_ssl_check(mysql, host, user, opt_password, NullS,
- tcp_port, unix_port,
- CLIENT_REMEMBER_OPTIONS, opt_ssl_required))
+ tcp_port, unix_port, CLIENT_REMEMBER_OPTIONS,
+ opt_ssl_mode == SSL_MODE_REQUIRED))
{
mysql->reconnect= 1;
if (info)
/*
- 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
if (!(sock = mysql_connect_ssl_check(&mysql_connection, host, user, passwd,
NULL, opt_mysql_port,
opt_mysql_unix_port, 0,
- opt_ssl_required)))
+ opt_ssl_mode == SSL_MODE_REQUIRED)))
{
DBerror(&mysql_connection, "when trying to connect");
DBUG_RETURN(1);
/*
- 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
static int dump_tablespaces(char* ts_where);
static void print_comment(FILE *sql_file, my_bool is_error, const char *format,
...);
+static const char* fix_identifier_with_newline(char*);
/*
MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
current_host ? current_host : "localhost",
- db_name ? db_name : "");
+ db_name ? fix_identifier_with_newline(db_name) : "");
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"
);
if (!(mysql= mysql_connect_ssl_check(&mysql_connection, host, user,
passwd, NULL, opt_mysql_port,
opt_mysql_unix_port, 0,
- opt_ssl_required)))
+ opt_ssl_mode == SSL_MODE_REQUIRED)))
{
DB_error(&mysql_connection, "when trying to connect");
DBUG_RETURN(1);
print_xml_comment(sql_file, strlen(comment_buff), comment_buff);
}
+/*
+ This function accepts object names and prefixes -- wherever \n
+ character is found.
+
+ @param[in] object_name
+
+ @return
+ @retval fixed object name.
+*/
+
+static const char* fix_identifier_with_newline(char* object_name)
+{
+ static char buff[COMMENT_LENGTH]= {0};
+ char *ptr= buff;
+ memset(buff, 0, 255);
+ while(*object_name)
+ {
+ *ptr++ = *object_name;
+ if (*object_name == '\n')
+ ptr= strmov(ptr, "-- ");
+ object_name++;
+ }
+ return buff;
+}
/*
create_delimiter
/* nice comments */
print_comment(sql_file, 0,
- "\n--\n-- Dumping events for database '%s'\n--\n", db);
+ "\n--\n-- Dumping events for database '%s'\n--\n",
+ fix_identifier_with_newline(db));
/*
not using "mysql_query_with_error_report" because we may have not
/* nice comments */
print_comment(sql_file, 0,
- "\n--\n-- Dumping routines for database '%s'\n--\n", db);
+ "\n--\n-- Dumping routines for database '%s'\n--\n",
+ fix_identifier_with_newline(db));
/*
not using "mysql_query_with_error_report" because we may have not
query_buff);
print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n",
- current_user);
+ fix_identifier_with_newline(current_user));
maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!", current_user, query_buff);
}
else if (strlen(row[2]))
if (strcmp (table_type, "VIEW") == 0) /* view */
print_comment(sql_file, 0,
- "\n--\n-- Temporary view structure for view %s\n--\n\n",
- result_table);
+ "\n--\n-- Temporary table structure for view %s\n--\n\n",
+ fix_identifier_with_newline(result_table));
else
print_comment(sql_file, 0,
"\n--\n-- Table structure for table %s\n--\n\n",
- result_table);
+ fix_identifier_with_newline(result_table));
if (opt_drop)
{
print_comment(sql_file, 0,
"\n--\n-- Table structure for table %s\n--\n\n",
- result_table);
+ fix_identifier_with_newline(result_table));
if (opt_drop)
fprintf(sql_file, "DROP TABLE IF EXISTS %s;\n", result_table);
if (!opt_xml)
{
print_comment(md_result_file, 0,
"\n--\n-- Dumping data for table %s\n--\n",
- result_table);
+ fix_identifier_with_newline(result_table));
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ * FROM ");
dynstr_append_checked(&query_string, result_table);
if (where)
{
- print_comment(md_result_file, 0, "-- WHERE: %s\n", where);
+ print_comment(md_result_file, 0, "-- WHERE: %s\n",
+ fix_identifier_with_newline(where));
dynstr_append_checked(&query_string, " WHERE ");
dynstr_append_checked(&query_string, where);
}
if (order_by)
{
- print_comment(md_result_file, 0, "-- ORDER BY: %s\n", order_by);
+ print_comment(md_result_file, 0, "-- ORDER BY: %s\n",
+ fix_identifier_with_newline(order_by));
dynstr_append_checked(&query_string, " ORDER BY ");
dynstr_append_checked(&query_string, order_by);
char *qdatabase= quote_name(database,quoted_database_buf,opt_quoted);
print_comment(md_result_file, 0,
- "\n--\n-- Current Database: %s\n--\n", qdatabase);
+ "\n--\n-- Current Database: %s\n--\n",
+ fix_identifier_with_newline(qdatabase));
/* Call the view or table specific function */
init_func(qdatabase);
print_comment(sql_file, 0,
"\n--\n-- Final view structure for view %s\n--\n\n",
- result_table);
+ fix_identifier_with_newline(result_table));
verbose_msg("-- Dropping the temporary view structure created\n");
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", opt_quoted_table);
/*
- 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
"program_name", "mysqlimport");
if (!(mysql_connect_ssl_check(mysql, host, user, passwd, database,
opt_mysql_port, opt_mysql_unix_port,
- 0, opt_ssl_required)))
+ 0, opt_ssl_mode == SSL_MODE_REQUIRED)))
{
ignore_errors=0; /* NO RETURN FROM db_error */
db_error(mysql);
/*
- 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
if (!(mysql_connect_ssl_check(&mysql, host, user, opt_password,
(first_argument_uses_wildcards) ? "" :
argv[0], opt_mysql_port, opt_mysql_unix_port,
- 0, opt_ssl_required)))
+ 0, opt_ssl_mode == SSL_MODE_REQUIRED)))
{
fprintf(stderr,"%s: %s\n",my_progname,mysql_error(&mysql));
exit(1);
/*
- 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
{
if (!(mysql_connect_ssl_check(&mysql, host, user, opt_password,
NULL, opt_mysql_port, opt_mysql_unix_port,
- connect_flags, opt_ssl_required)))
+ connect_flags,
+ opt_ssl_mode == SSL_MODE_REQUIRED)))
{
fprintf(stderr,"%s: Error when connecting to server: %s\n",
my_progname,mysql_error(&mysql));
-/* 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
#include <my_dir.h>
#include <hash.h>
#include <stdarg.h>
+#include <string>
#include <violite.h>
#include "my_regex.h" /* Our own version of regex */
#ifdef HAVE_SYS_WAIT_H
using std::min;
using std::max;
+using std::string;
#ifdef __WIN__
#include <crtdbg.h>
die("Failed to create temporary file for perl command");
my_close(fd, MYF(0));
- str_to_file(temp_file_path, ds_script.str, ds_script.length);
+ /* Compatibility for Perl 5.24 and newer. */
+ string script = "push @INC, \".\";\n";
+ script.append(ds_script.str, ds_script.length);
+
+ str_to_file(temp_file_path, &script[0], script.size());
/* Format the "perl <filename>" command */
my_snprintf(buf, sizeof(buf), "perl %s", temp_file_path);
&can_handle_expired_passwords);
while(!mysql_connect_ssl_check(mysql, host,user, pass, db, port, sock,
CLIENT_MULTI_STATEMENTS | CLIENT_REMEMBER_OPTIONS,
- opt_ssl_required))
+ opt_ssl_mode == SSL_MODE_REQUIRED))
{
/*
Connect failed
&can_handle_expired_passwords);
while (!mysql_connect_ssl_check(con, host, user, pass, db, port,
sock ? sock: 0, CLIENT_MULTI_STATEMENTS,
- opt_ssl_required))
+ opt_ssl_mode == SSL_MODE_REQUIRED))
{
/*
If we have used up all our connections check whether this
-# 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
IF(NOT FORCE_UNSUPPORTED_COMPILER)
IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
# CC -V yields
+ # CC: Studio 12.6 Sun C++ 5.15 SunOS_sparc Beta 2016/12/19
# CC: Studio 12.5 Sun C++ 5.14 SunOS_sparc Dodona 2016/04/04
# CC: Sun C++ 5.13 SunOS_sparc Beta 2014/03/11
# CC: Sun C++ 5.11 SunOS_sparc 2010/08/13
)
STRING(REGEX MATCH "CC: Sun C\\+\\+ 5\\.([0-9]+)" VERSION_STRING ${stderr})
IF (NOT CMAKE_MATCH_1 OR CMAKE_MATCH_1 STREQUAL "")
- STRING(REGEX MATCH "CC: Studio 12\\.5 Sun C\\+\\+ 5\\.([0-9]+)"
+ STRING(REGEX MATCH "CC: Studio 12\\.[56] Sun C\\+\\+ 5\\.([0-9]+)"
VERSION_STRING ${stderr})
ENDIF()
SET(CC_MINOR_VERSION ${CMAKE_MATCH_1})
-# 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
ENDIF()
IF(MSVC)
+ OPTION(LINK_STATIC_RUNTIME_LIBRARIES "Link with /MT" OFF)
# Enable debug info also in Release build,
# and create PDB to be able to analyze crashes.
FOREACH(type EXE SHARED MODULE)
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
- STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
+ IF(LINK_STATIC_RUNTIME_LIBRARIES)
+ STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
+ ENDIF()
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
SET("${flag}" "${${flag}} /EHsc")
ENDFOREACH()
-# Copyright (c) 2009, 2013, 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
completion_matches(0,0);
return res;
}"
- EDITLINE_HAVE_COMPLETION)
+ EDITLINE_HAVE_COMPLETION_INT)
- IF(EDITLINE_HAVE_COMPLETION)
+ CHECK_CXX_SOURCE_COMPILES("
+ #include <stdio.h>
+ #include <readline.h>
+ int main(int argc, char **argv)
+ {
+ typedef char* MYFunction(const char*, int);
+ MYFunction* myf= rl_completion_entry_function;
+ char *res= (myf)(NULL, 0);
+ completion_matches(0,0);
+ return res != NULL;
+ }"
+ EDITLINE_HAVE_COMPLETION_CHAR)
+
+ IF(EDITLINE_HAVE_COMPLETION_INT OR EDITLINE_HAVE_COMPLETION_CHAR)
SET(HAVE_HIST_ENTRY ${EDITLINE_HAVE_HIST_ENTRY})
SET(USE_LIBEDIT_INTERFACE 1)
SET(EDITLINE_FOUND 1)
+ IF(EDITLINE_HAVE_COMPLETION_CHAR)
+ SET(USE_NEW_EDITLINE_INTERFACE 1)
+ ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
-/* 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
/* Readline */
#cmakedefine HAVE_HIST_ENTRY 1
+#cmakedefine USE_NEW_EDITLINE_INTERFACE 1
#cmakedefine USE_LIBEDIT_INTERFACE 1
#cmakedefine FIONREAD_IN_SYS_IOCTL 1
-# 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
GET_FILENAME_COMPONENT(CXX_REALPATH ${CMAKE_CXX_COMPILER} REALPATH)
# CC -V yields
+ # CC: Studio 12.6 Sun C++ 5.15 SunOS_sparc Beta 2016/12/19
# CC: Studio 12.5 Sun C++ 5.14 SunOS_sparc Dodona 2016/04/04
# CC: Sun C++ 5.13 SunOS_sparc Beta 2014/03/11
# CC: Sun C++ 5.11 SunOS_sparc 2010/08/13
STRING(REGEX MATCH "CC: Sun C\\+\\+ 5\\.([0-9]+)" VERSION_STRING ${stderr})
IF (NOT CMAKE_MATCH_1 OR CMAKE_MATCH_1 STREQUAL "")
- STRING(REGEX MATCH "CC: Studio 12\\.5 Sun C\\+\\+ 5\\.([0-9]+)"
+ STRING(REGEX MATCH "CC: Studio 12\\.[56] Sun C\\+\\+ 5\\.([0-9]+)"
VERSION_STRING ${stderr})
ENDIF()
SET(CC_MINOR_VERSION ${CMAKE_MATCH_1})
-/* Copyright (c) 2000, 2012, 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_OPT_CONNECT_ATTR_DELETE,
MYSQL_SERVER_PUBLIC_KEY,
MYSQL_ENABLE_CLEARTEXT_PLUGIN,
- MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
+ MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
+ MYSQL_OPT_SSL_MODE
};
/**
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
+enum mysql_ssl_mode
+{
+ SSL_MODE_REQUIRED= 3
+};
+
typedef struct character_set
{
unsigned int number; /* character set number */
MYSQL_OPT_CONNECT_ATTR_DELETE,
MYSQL_SERVER_PUBLIC_KEY,
MYSQL_ENABLE_CLEARTEXT_PLUGIN,
- MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS
+ MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
+ MYSQL_OPT_SSL_MODE
};
struct st_mysql_options_extention;
struct st_mysql_options {
MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET,
MYSQL_PROTOCOL_PIPE, MYSQL_PROTOCOL_MEMORY
};
+enum mysql_ssl_mode
+{
+ SSL_MODE_REQUIRED= 3
+};
typedef struct character_set
{
unsigned int number;
-/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2016, 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 USERNAME_CHAR_LENGTH 16
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
+#define CONNECT_STRING_MAXLEN 1024
#define MYSQL_AUTODETECT_CHARSET_NAME "auto"
#ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED
-/* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2003, 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 *server_public_key_path;
size_t connection_attributes_length;
my_bool enable_cleartext_plugin;
+ unsigned int ssl_mode;
};
typedef struct st_mysql_methods
#ifndef SSLOPT_CASE_INCLUDED
#define SSLOPT_CASE_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 as published by
exit(1);
}
else
- opt_ssl_required= 1;
+ opt_ssl_mode= SSL_MODE_REQUIRED;
break;
#endif /* MYSQL_CLIENT */
#endif
#ifndef SSLOPT_VARS_INCLUDED
#define SSLOPT_VARS_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 as published by
#ifdef MYSQL_CLIENT
SSL_STATIC my_bool opt_ssl_verify_server_cert= 0;
-SSL_STATIC my_bool opt_ssl_required= 0;
+SSL_STATIC uint opt_ssl_mode= 0;
#endif /* MYSQL_CLIENT */
#else /* HAVE_OPENSSL */
-#define opt_ssl_required 0
+#define opt_ssl_mode 0
#endif /* HAVE_OPENSSL */
#endif /* SSLOPT_VARS_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
#ifndef _welcome_copyright_notice_h_
#define _welcome_copyright_notice_h_
-#define COPYRIGHT_NOTICE_CURRENT_YEAR "2016"
+#define COPYRIGHT_NOTICE_CURRENT_YEAR "2017"
/*
This define specifies copyright notice which is displayed by every MySQL
# Smaller batch of weekly run for tier2 platforms
# Same as default.weekly, but all tests are run without big-test option.
# big-test runs were leading to sporadic failures in tier2 platforms
-# Comprises of the following
-# 1. Repeat of daily runs
-# 2. All suites in normal mode
-# 3. nist suite
-# 4. engine independant suite
-# 5. Covers debug and non-debug runs
-# 6. Covers all suites with Multi-Threaded-Slave and MIXED binlog-format
-# 7. Covers all suites with innodb-page-size=4k and 8k
-# Repeat daily run
-# big-test option for normal runs
-# Default suites (in modes binlog format stmt/mixed/row, parts), embedded and ps-protocol
+# Default suites (in modes binlog format stmt/mixed/row, parts)
perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal-debug --vardir=var-normal-debug --report-features --skip-test-list=collections/disabled-daily.list --mysqld=--innodb_autoextend_increment=64 --unit-tests-report
# Run all default suites with embedded server
-# --debug-server is not used for embedded runs since debug build of embedded server is not available
+# --debug-server is not used for embedded runs
+# since debug build of embedded server is not available
perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded-server
# Run default suites with ps protocol
#Memcached tests
perl mysql-test-run.pl --timer --force --debug-server --comment=memcached-debug --vardir=var-debug-memcached --experimental=collections/default.experimental --parallel=1 --retry=0 --suite=memcached --skip-test-list=collections/disabled-weekly.list
-# Non debug runs of default suites in normal modes
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal-non-debug --vardir=var-normal-non-debug --report-features --skip-test-list=collections/disabled-daily.list
-
-
-
-# Multi-Thread Slave
-perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=MTS-debug --vardir=var-MTS-debug --suite=rpl --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list --mysqld=--slave-parallel-workers=4 --mysqld=--slave-transaction-retries=0 --skip-test-list=collection/disabled-weekly.list
-
-# Run all default suites with 4K page size
-perl mysql-test-run.pl --debug-server --timer --force --parallel=auto --comment=all_4k_size --vardir=var_all_4k_size --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list --mysqld=--innodb-page-size=4k
-
-# Run all default suites with 8K page size
-perl mysql-test-run.pl --debug-server --timer --force --parallel=auto --comment=all_8k_size --vardir=var-all_8k_size --experimental=collections/default.experimental --skip-test-list=collections/disabled-per-push.list --mysqld=--innodb-page-size=8k
-
-
-
-# Additional run to test rpl HASH_SCAN & INDEX_SCAN
-perl mysql-test-run.pl --force --debug-server --timer --parallel=auto --experimental=collections/default.experimental --comment=binlog_rpl_row_hash_scan --vardir=var-binlog_rpl_row_hash_scan --mysqld=--binlog-format=row --suite=binlog,rpl --mysqld=--slave-rows-search-algorithms=HASH_SCAN,INDEX_SCAN --skip-test-list=collection/disabled-weekly.list
-perl mysql-test-run.pl --debug-server --timer --force --parallel=auto --comment=rpl_binlog_row_hash_MTS --vardir=var-mts-rpl-binlog-hash-n_mix --mysqld=--binlog-format=row --experimental=collections/default.experimental --mysqld=--slave-parallel-workers=4 --mysqld=--slave-transaction-retries=0 --suite=rpl,binlog -mysqld=--slave-rows-search-algorithms=HASH_SCAN,INDEX_SCAN --skip-test-list=collection/disabled-weekly.list
-
# -*- cperl -*-
-# Copyright (c) 2005, 2014, 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
$suitedir= my_find_dir($::basedir,
["share/mysql-test/suite",
"mysql-test/suite",
+ "lib/mysql-test/suite",
"internal/mysql-test/suite",
"mysql-test",
# Look in storage engine specific suite dirs
#!/usr/bin/perl
# -*- cperl -*-
-# Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 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
use IO::Socket::INET;
use IO::Select;
+push @INC, ".";
+
require "lib/mtr_process.pl";
require "lib/mtr_io.pl";
require "lib/mtr_gcov.pl";
my $mysqld_basedir= $mysqld->value('basedir');
if ( $basedir eq $mysqld_basedir )
{
- if (! $opt_start_dirty) # If dirty, keep possibly grown system db
+ if (!$opt_start_dirty) # If dirty, keep possibly grown system db
{
- # Copy datadir from installed system db
- for my $path ( "$opt_vardir", "$opt_vardir/..") {
- my $install_db= "$path/install.db";
- copytree($install_db, $datadir)
- if -d $install_db;
- }
- mtr_error("Failed to copy system db to '$datadir'")
- unless -d $datadir;
+ # Copy datadir from installed system db
+ my $path= ($opt_parallel == 1) ? "$opt_vardir" : "$opt_vardir/..";
+ my $install_db= "$path/install.db";
+ copytree($install_db, $datadir) if -d $install_db;
+ mtr_error("Failed to copy system db to '$datadir'")
+ unless -d $datadir;
}
}
else
t3_date
NULL
DROP TABLE t1,t2,t3;
+#
+# Bug#22686994 REGRESSION FOR A GROUPING QUERY WITH DISTINCT
+#
+CREATE TABLE t1 (a INTEGER, b INTEGER);
+INSERT INTO t1 VALUES (1,3), (2,4), (1,5),
+(1,3), (2,1), (1,5), (1,7), (3,1),
+(3,2), (3,1), (2,4);
+SELECT DISTINCT (COUNT(DISTINCT b) + 1) AS c FROM t1 GROUP BY a;
+c
+4
+3
+DROP TABLE t1;
+# End of test for Bug#22686994
drop database if exists events_test;
create database events_test;
use events_test;
-create event e_26 on schedule at '2038-01-19 03:14:07' disable do set @a = 5;
+create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
-events_test e_26 set @a = 5 root@localhost 2038-01-19 03:14:07 DROP
+events_test e_26 set @a = 5 root@localhost 2037-01-01 00:00:00 DROP
drop event e_26;
create event e_26 on schedule at NULL disable do set @a = 5;
ERROR HY000: Incorrect AT value: 'NULL'
SET optimizer_trace=DEFAULT;
SET end_markers_in_json=DEFAULT;
DROP TABLE t0,t1,t2;
+#
+# Bug #21749123: SELECT DISTINCT, WRONG RESULTS COMBINED WITH
+# USE_INDEX_EXTENSIONS=OFF
+#
+CREATE TABLE t1 (
+pk_col INT AUTO_INCREMENT PRIMARY KEY,
+a1 CHAR(64),
+KEY a1_idx (a1)
+) ENGINE=INNODB;
+INSERT INTO t1 (a1) VALUES ('a'),('a'),('a'),('a'),('a'),('a'),('a'),('a');
+CREATE TABLE t2 (
+pk_col1 INT NOT NULL,
+pk_col2 INT NOT NULL,
+a1 CHAR(64),
+a2 CHAR(64),
+PRIMARY KEY(pk_col1, pk_col2),
+KEY a1_idx (a1),
+KEY a1_a2_idx (a1, a2)
+) ENGINE=INNODB;
+INSERT INTO t2 (pk_col1, pk_col2, a1, a2) VALUES (1,1,'a','b'),(1,2,'a','b'),
+(1,3,'a','c'),(1,4,'a','c'),
+(2,1,'a','d');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+ANALYZE TABLE t2;
+Table Op Msg_type Msg_text
+test.t2 analyze status OK
+EXPLAIN SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref PRIMARY,a1_idx a1_idx 65 const 4 Using where; Using index
+SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+a1
+a
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range a1_idx a1_idx 69 NULL 9 Using index for group-by (scanning)
+SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+COUNT(DISTINCT a1)
+1
+1
+1
+1
+1
+1
+1
+1
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range a1_idx,a1_a2_idx a1_idx 69 NULL 6 Using index for group-by (scanning)
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+COUNT(DISTINCT a1)
+1
+1
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range a1_a2_idx a1_a2_idx 130 NULL 6 Using index for group-by (scanning)
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+COUNT(DISTINCT a1)
+1
+1
+1
+SET @optimizer_switch_save=@@optimizer_switch;
+SET @@optimizer_switch= "use_index_extensions=off";
+EXPLAIN SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref PRIMARY,a1_idx a1_idx 65 const 8 Using where; Using index
+SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+a1
+a
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index a1_idx a1_idx 65 NULL 8 Using index
+SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+COUNT(DISTINCT a1)
+1
+1
+1
+1
+1
+1
+1
+1
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 index a1_idx,a1_a2_idx a1_idx 65 NULL 5 Using index
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+COUNT(DISTINCT a1)
+1
+1
+EXPLAIN SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t2 range a1_a2_idx a1_a2_idx 130 NULL 6 Using index for group-by (scanning)
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+COUNT(DISTINCT a1)
+1
+1
+1
+SET @@optimizer_switch= @optimizer_switch_save;
+DROP TABLE t1, t2;
+#
+# Bug #24671968: WHEN THE OPTIMISER IS USING INDEX FOR GROUP-BY IT OFTEN
+# OFTEN GIVES WRONG RESULTS
+#
+CREATE TABLE t1 (
+id int NOT NULL,
+c1 int NOT NULL,
+c2 int,
+PRIMARY KEY(id),
+INDEX c1_c2_idx(c1, c2));
+INSERT INTO t1 (id, c1, c2) VALUES (1,1,1), (2,2,2), (10,10,1), (11,10,8),
+(12,10,1), (13,10,2), (3,1,1), (4,10,1),
+(5,10,1), (6,10,8), (7,1,1), (8,10,1);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
+EXPLAIN SELECT DISTINCT c1
+FROM t1
+WHERE EXISTS (SELECT *
+FROM DUAL
+WHERE (c2 = 2));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index c1_c2_idx c1_c2_idx 9 NULL # Using where; Using index
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL # No tables used
+EXPLAIN SELECT DISTINCT c1
+FROM t1
+WHERE 1 IN (2,
+(SELECT 1
+FROM DUAL
+WHERE (c2 = 2)),
+3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 index c1_c2_idx c1_c2_idx 9 NULL # Using where; Using index
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL # No tables used
+EXPLAIN SELECT DISTINCT c1
+FROM t1
+WHERE c2 = 2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range c1_c2_idx c1_c2_idx 9 NULL # Using where; Using index for group-by
+EXPLAIN SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE EXISTS (SELECT *
+FROM DUAL
+WHERE (c2 = 2));
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL c1_c2_idx NULL NULL NULL # Using where; Using temporary
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL # No tables used
+EXPLAIN SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE 1 IN (2,
+(SELECT 1
+FROM DUAL
+WHERE (c2 = 2)),
+3);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL c1_c2_idx NULL NULL NULL # Using where; Using temporary
+2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL # No tables used
+SET optimizer_trace="enabled=on";
+SELECT DISTINCT c1
+FROM t1
+WHERE EXISTS (SELECT *
+FROM DUAL
+WHERE (c2 = 2));
+c1
+2
+10
+SELECT TRACE INTO @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "keypart_reference_from_where_clause";
+@trace RLIKE "keypart_reference_from_where_clause"
+1
+SET optimizer_trace="enabled=off";
+SELECT DISTINCT c1
+FROM t1
+WHERE 1 IN (2,
+(SELECT 1
+FROM DUAL
+WHERE (c2 = 2)),
+3);
+c1
+2
+10
+SELECT DISTINCT c1
+FROM t1
+WHERE c2 = 2;
+c1
+2
+10
+SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE EXISTS (SELECT *
+FROM DUAL
+WHERE (c2 = 2));
+c1
+2
+10
+SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE 1 IN (2,
+(SELECT 1
+FROM DUAL
+WHERE (c2 = 2)),
+3);
+c1
+2
+10
+DROP TABLE t1;
TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n' (c0, c2);
-ERROR HY000: Invalid column reference (v2.c0) in LOAD DATA
+ERROR HY000: Column 'c0' is not updatable
LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v3
FIELDS ESCAPED BY '\\'
+set @@global.log_output = 'TABLE';
set session long_query_time=10;
select get_lock('bug27638', 1);
get_lock('bug27638', 1)
1
set session long_query_time=1;
-truncate table mysql.slow_log;
select get_lock('bug27638', 2);
get_lock('bug27638', 2)
0
-select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+where sql_text = 'select get_lock(\'bug27638\', 2)';
qt sql_text
OK select get_lock('bug27638', 2)
-truncate table mysql.slow_log;
select get_lock('bug27638', 60);
get_lock('bug27638', 60)
0
-select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+where sql_text = 'select get_lock(\'bug27638\', 60)';
qt sql_text
OK select get_lock('bug27638', 60)
-truncate table mysql.slow_log;
select get_lock('bug27638', 101);
get_lock('bug27638', 101)
0
-select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+where sql_text = 'select get_lock(\'bug27638\', 101)';
qt sql_text
OK select get_lock('bug27638', 101)
select release_lock('bug27638');
release_lock('bug27638')
1
+set @@global.log_output=default;
##############################################
# Tests for mysql_config_editor's help command
##############################################
-Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db_20772273;
+#
+# Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
+#
+CREATE DATABASE bug25717383;
+use bug25717383;
+CREATE TABLE `tab
+one` (a int);
+CREATE VIEW `view
+one` as SELECT * FROM `tab
+one`;
+CREATE PROCEDURE `proc
+one`() SELECT * from `tab
+one`;
+CREATE TEMPORARY TABLE `temp
+one` (id INT);
+CREATE TRIGGER `trig
+one` BEFORE INSERT ON `tab
+one` FOR EACH ROW SET NEW.a = 1;
+CREATE EVENT `event
+one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
+SHOW TABLES FROM bug25717383;
+Tables_in_bug25717383
+tab
+one
+view
+one
+SHOW TRIGGERS FROM bug25717383;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+trig
+one INSERT tab
+one SET NEW.a = 1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+SHOW EVENTS FROM bug25717383;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+bug25717383 event
+one root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
+ ORDER BY ROUTINE_NAME;
+ROUTINE_NAME
+proc
+one
+SHOW TABLES FROM bug25717383;
+Tables_in_bug25717383
+tab
+one
+view
+one
+SHOW TRIGGERS FROM bug25717383;
+Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation
+trig
+one INSERT tab
+one SET NEW.a = 1 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
+SHOW EVENTS FROM bug25717383;
+Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
+bug25717383 event
+one root@localhost SYSTEM ONE TIME # NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
+ ORDER BY ROUTINE_NAME;
+ROUTINE_NAME
+proc
+one
+DROP DATABASE bug25717383;
ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
select master_pos_wait(1, 2, 3, 4);
ERROR 42000: Incorrect parameter count in the call to native function 'master_pos_wait'
+SET @save_sql_mode_before_master_pos_wait=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+select master_pos_wait('master-bin.999999', 4, -1);
+SET @@SESSION.SQL_MODE=@save_sql_mode_before_master_pos_wait;
select rand(1, 2, 3);
ERROR 42000: Incorrect parameter count in the call to native function 'rand'
select round(1, 2, 3);
ERROR 70100: Query execution was interrupted
# Connection default
DROP TABLE t1;
+#
+# Bug#19894382 - SERVER SIDE PREPARED STATEMENTS LEADS TO POTENTIAL OFF-BY-SECOND
+# TIMESTAMP ON SLAVE.
+#
+CREATE TABLE bug19894382(f1 CHAR(64) DEFAULT 'slave',
+f2 TIME, f3 TIMESTAMP NULL, f4 DATETIME,
+f5 TIME(3), f6 TIMESTAMP(3) NULL, f7 DATETIME(3));
+# Execute prepared statements from mysql_client_test.
+# Insert tuples from the client_test_db.bug19894382 to the test.bug19894382.
+# Tuples in the client_test_db.bug19894382 are inserted from the mysql_client_test.
+INSERT INTO bug19894382 SELECT * FROM client_test_db.bug19894382;
+# Replay binlog events
+# Insert tuples from the client_test_db.bug19894382 to the test.bug19894382.
+# Tuples in the client_test_db.bug19894382 are inserted from the binlog.
+INSERT INTO bug19894382(f2, f3, f4, f5, f6, f7)
+SELECT f2, f3, f4, f5, f6, f7 FROM client_test_db.bug19894382;
+# With fix, tuples of "master" and "slave" will be same. There will not be any difference
+# in values inserted for time, timestamp and datetime type columns.
+SELECT * FROM bug19894382 ORDER BY f2;
+f1 f2 f3 f4 f5 f6 f7
+master 07:30:30 2015-04-24 13:30:30 2015-04-24 07:30:30 07:30:30.005 2015-04-24 13:30:30.005 2015-04-24 07:30:30.005
+slave 07:30:30 2015-04-24 13:30:30 2015-04-24 07:30:30 07:30:30.005 2015-04-24 13:30:30.005 2015-04-24 07:30:30.005
+master 07:30:31 2015-04-24 13:30:31 2015-04-24 07:30:31 07:30:30.502 2015-04-24 13:30:30.502 2015-04-24 07:30:30.502
+slave 07:30:31 2015-04-24 13:30:31 2015-04-24 07:30:31 07:30:30.502 2015-04-24 13:30:30.502 2015-04-24 07:30:30.502
+# Cleanup
+DROP DATABASE client_test_db;
+DROP TABLE bug19894382;
# mysql
Unknown value to --ssl-mode: ''. Use --ssl-mode=REQUIRED
Unknown value to --ssl-mode: 'DERIUQER'. Use --ssl-mode=REQUIRED
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
+ERROR 2026 (HY000): SSL connection error: Client is not configured to use SSL
+ERROR 2026 (HY000): SSL connection error: Client is not configured to use SSL
+ERROR 2026 (HY000): SSL connection error: Client is not configured to use SSL
End of tests
# negative client tests
# mysql
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
-ERROR 2026 (HY000): --ssl-mode=REQUIRED option forbids non SSL connections
+ERROR 2026 (HY000): SSL connection error: Server doesn't support SSL
+ERROR 2026 (HY000): SSL connection error: Server doesn't support SSL
+ERROR 2026 (HY000): SSL connection error: Server doesn't support SSL
+ERROR 2026 (HY000): SSL connection error: Server doesn't support SSL
# mysqldump
-mysqldump: Got error: 2026: --ssl-mode=REQUIRED option forbids non SSL connections when trying to connect
+mysqldump: Got error: 2026: SSL connection error: Server doesn't support SSL when trying to connect
# mysqladmin
Warning: Using a password on the command line interface can be insecure.
-mysqladmin: error: '--ssl-mode=REQUIRED option forbids non SSL connections'
+mysqladmin: error: 'SSL connection error: Server doesn't support SSL'
# mysqlcheck
-mysqlcheck: Got error: 2026: --ssl-mode=REQUIRED option forbids non SSL connections when trying to connect
+mysqlcheck: Got error: 2026: SSL connection error: Server doesn't support SSL when trying to connect
# mysqlimport
-mysqlimport: Error: 2026 --ssl-mode=REQUIRED option forbids non SSL connections
+mysqlimport: Error: 2026 SSL connection error: Server doesn't support SSL
# mysqlshow
-mysqlshow: --ssl-mode=REQUIRED option forbids non SSL connections
+mysqlshow: SSL connection error: Server doesn't support SSL
# mysqlslap
-mysqlslap: Error when connecting to server: --ssl-mode=REQUIRED option forbids non SSL connections
+mysqlslap: Error when connecting to server: SSL connection error: Server doesn't support SSL
# mysqltest
-mysqltest: Could not open connection 'default': 2026 --ssl-mode=REQUIRED option forbids non SSL connections
+mysqltest: Could not open connection 'default': 2026 SSL connection error: Server doesn't support SSL
End of tests
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop tables t1, t2;
+#
+# Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
+# WITH DATA DIRECTORY
+#
+# Make sure we have no current database
+CREATE DATABASE x;
+USE x;
+DROP DATABASE x;
+CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
+DATA DIRECTORY "MYSQLTEST_VARDIR/tmp";
+DROP TABLE test.t1;
-#!/usr/bin/perl
+#!/usr/bin/env perl
-# Copyright (c) 2011, 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 Library General Public
--- /dev/null
+# Bug #23481444 OPTIMISER CALL ROW_SEARCH_MVCC() AND READ
+# THE INDEX APPLIED BY UNCOMMITTED ROWS.
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+f2 INT NOT NULL, f3 INT NOT NULL,
+KEY(f2, f3))ENGINE=INNODB;
+CREATE PROCEDURE populate_t1(IN BASE INT, IN SIZE INT)
+BEGIN
+DECLARE i INT DEFAULT BASE;
+WHILE (i <= SIZE) DO
+INSERT INTO t1(f2, f3) values (i, i);
+SET i = i + 1;
+END WHILE;
+END|
+CALL populate_t1(1, 10000);
+INSERT INTO t1(f2, f3) VALUES(10000, 10000);
+BEGIN;
+CALL populate_t1(10001, 20000);
+SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
+f2 f3
+10000 10000
+10000 10000
+DROP TABLE t1;
+CREATE TABLE t1(f2 INT NOT NULL, f3 INT NOT NULL,
+PRIMARY KEY(f2, f3))ENGINE=INNODB;
+CALL populate_t1(1, 10000);
+BEGIN;
+CALL populate_t1(10001, 20000);
+SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
+f2 f3
+10000 10000
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+f2 INT NOT NULL, f3 INT NOT NULL,
+KEY(f2), KEY(f3))ENGINE=INNODB;
+CALL populate_t1(1, 10000);
+BEGIN;
+CALL populate_t1(10001, 20000);
+SELECT count(*) FROM t1 FORCE INDEX(f2, f3) WHERE f2 < 10000 or f3 < 10000;
+count(*)
+9999
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+f2 INT NOT NULL, f3 INT NOT NULL,
+KEY(f2, f3))ENGINE=INNODB;
+CALL populate_t1(1, 10000);
+CALL populate_t1(100000, 100200);
+BEGIN;
+CALL populate_t1(10001, 20000);
+SELECT SQL_NO_CACHE COUNT(*) FROM t1
+WHERE f2 BETWEEN 9999 AND 10000 OR f2 >= 100000;
+COUNT(*)
+203
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
--- /dev/null
+call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'".*".".*"\' in the cache');
+call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
+CREATE TABLE t1(
+a INT AUTO_INCREMENT PRIMARY KEY,
+b CHAR(1),
+c INT,
+INDEX(b))
+ENGINE=InnoDB STATS_PERSISTENT=0;
+SET GLOBAL innodb_change_buffering_debug = 1;
+INSERT INTO t1 VALUES(0,'x',1);
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+# Stop server
+# Restart server.
+insert into t1 values(0,'y',1);
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+# Stop server
+# Restart server.
+DROP TABLE t1;
call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'".*".".*"\' in the cache');
call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
+create table t2(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
insert into t1 values(1, 2);
+insert into t2 values(1, 2);
SET GLOBAL innodb_fast_shutdown = 0;
# Stop server
# Restart server.
drop table t1;
show tables;
Tables_in_test
+t2
+# Stop server
+# Restart server.
+select * from t2;
+f1 f2
+1 2
+insert into t2 values(2, 3);
+ERROR HY000: Table 't2' is read only
+alter table t2 add f3 int not null, algorithm=copy;
+ERROR HY000: InnoDB is in read only mode.
+alter table t2 add f3 int not null, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY.
+drop index idx on t2;
+ERROR HY000: InnoDB is in read only mode.
+update t2 set f1=3 where f2=2;
+ERROR HY000: Table 't2' is read only
+create table t4(f1 int not null)engine=innodb;
+ERROR HY000: InnoDB is in read only mode.
+drop table t4;
+ERROR 42S02: Unknown table 'test.t4'
+rename table t2 to t3;
+ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 - Table is read only)
+truncate table t2;
+ERROR HY000: Table 't2' is read only
+drop table t2;
+ERROR 42S02: Unknown table 'test.t2'
+show tables;
+Tables_in_test
+t2
+# Stop server
+# Restart server.
+select * from t2;
+f1 f2
+1 2
+insert into t2 values(2, 3);
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+alter table t2 add f3 int not null, algorithm=copy;
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+alter table t2 add f3 int not null, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY.
+drop index idx on t2;
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+update t2 set f1=3 where f2=2;
+ERROR HY000: Can't lock file (errno: 165 - Table is read only)
+create table t4(f1 int not null)engine=innodb;
+ERROR HY000: InnoDB is in read only mode.
+drop table t4;
+ERROR 42S02: Unknown table 'test.t4'
+rename table t2 to t3;
+ERROR HY000: Error on rename of './test/t2' to './test/t3' (errno: 165 - Table is read only)
+truncate table t2;
+ERROR HY000: Table 't2' is read only
+drop table t2;
+ERROR 42S02: Unknown table 'test.t2'
+show tables;
+Tables_in_test
+t2
+# Stop server
+# Restart server.
+drop table t2;
+show tables;
+Tables_in_test
--- /dev/null
+USE test;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
+SELECT * FROM t1;
+id
+1
+2
+3
+4
+5
+USE performance_schema;
+SELECT EVENT_NAME,COUNT_STAR FROM performance_schema.file_summary_by_event_name
+WHERE EVENT_NAME like "%inno%";
+EVENT_NAME COUNT_STAR
+wait/io/file/innodb/innodb_data_file 5
+wait/io/file/innodb/innodb_log_file 5
+wait/io/file/innodb/innodb_temp_file 5
+USE test;
+DROP table t1;
--- /dev/null
+# Start mysqld to create tablespaces according to my.cnf
+ib_logfile0
+ib_logfile1
+ib_logfile2
+ibdata1
+ibdata2
+my.cnf
+my_restart.err
+undo003
+undo004
+undo005
--- /dev/null
+--source include/have_innodb.inc
+--source include/not_embedded.inc
+--source include/big_test.inc
+
+--echo # Bug #23481444 OPTIMISER CALL ROW_SEARCH_MVCC() AND READ
+--echo # THE INDEX APPLIED BY UNCOMMITTED ROWS.
+
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ f2 INT NOT NULL, f3 INT NOT NULL,
+ KEY(f2, f3))ENGINE=INNODB;
+
+DELIMITER |;
+CREATE PROCEDURE populate_t1(IN BASE INT, IN SIZE INT)
+BEGIN
+ DECLARE i INT DEFAULT BASE;
+ WHILE (i <= SIZE) DO
+ INSERT INTO t1(f2, f3) values (i, i);
+ SET i = i + 1;
+ END WHILE;
+END|
+DELIMITER ;|
+CALL populate_t1(1, 10000);
+INSERT INTO t1(f2, f3) VALUES(10000, 10000);
+
+BEGIN;
+CALL populate_t1(10001, 20000);
+
+connect (con1,localhost,root,,);
+connection con1;
+SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
+connection default;
+DROP TABLE t1;
+
+CREATE TABLE t1(f2 INT NOT NULL, f3 INT NOT NULL,
+ PRIMARY KEY(f2, f3))ENGINE=INNODB;
+
+CALL populate_t1(1, 10000);
+
+BEGIN;
+CALL populate_t1(10001, 20000);
+
+connection con1;
+SELECT SQL_NO_CACHE f2, f3 FROM t1 WHERE f2=10000 and f3 between 9999 and 10000;
+connection default;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ f2 INT NOT NULL, f3 INT NOT NULL,
+ KEY(f2), KEY(f3))ENGINE=INNODB;
+CALL populate_t1(1, 10000);
+
+BEGIN;
+CALL populate_t1(10001, 20000);
+
+connection con1;
+SELECT count(*) FROM t1 FORCE INDEX(f2, f3) WHERE f2 < 10000 or f3 < 10000;
+connection default;
+DROP TABLE t1;
+
+CREATE TABLE t1(f1 INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ f2 INT NOT NULL, f3 INT NOT NULL,
+ KEY(f2, f3))ENGINE=INNODB;
+
+CALL populate_t1(1, 10000);
+CALL populate_t1(100000, 100200);
+
+BEGIN;
+CALL populate_t1(10001, 20000);
+
+connection con1;
+SELECT SQL_NO_CACHE COUNT(*) FROM t1
+WHERE f2 BETWEEN 9999 AND 10000 OR f2 >= 100000;
+disconnect con1;
+connection default;
+
+DROP TABLE t1;
+DROP PROCEDURE populate_t1;
--- /dev/null
+--innodb_buffer_pool_size=24M
--- /dev/null
+--source include/have_innodb.inc
+# innodb_change_buffering_debug option is debug only
+--source include/have_debug.inc
+# Embedded server does not support crashing
+--source include/not_embedded.inc
+
+
+call mtr.add_suppression('InnoDB: Failed to find tablespace for table \'".*".".*"\' in the cache');
+call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
+
+CREATE TABLE t1(
+ a INT AUTO_INCREMENT PRIMARY KEY,
+ b CHAR(1),
+ c INT,
+ INDEX(b))
+ENGINE=InnoDB STATS_PERSISTENT=0;
+
+# The flag innodb_change_buffering_debug is only available in debug builds.
+# It instructs InnoDB to try to evict pages from the buffer pool when
+# change buffering is possible, so that the change buffer will be used
+# whenever possible.
+SET GLOBAL innodb_change_buffering_debug = 1;
+
+# Create enough rows for the table, so that the change buffer will be
+# used for modifying the secondary index page. There must be multiple
+# index pages, because changes to the root page are never buffered.
+INSERT INTO t1 VALUES(0,'x',1);
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+INSERT INTO t1 SELECT 0,b,c FROM t1;
+
+# Restart the server in force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart:--innodb-force-recovery=6" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+--error ER_CANT_LOCK
+insert into t1 values(0,'y',1);
+
+# Restart the server in force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+# Cleanup
+DROP TABLE t1;
call mtr.add_suppression('InnoDB: Allocated tablespace [0-9]+, old maximum was [0-9]+');
create table t1(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
+create table t2(f1 int not null, f2 int not null, index idx(f2))engine=innodb;
insert into t1 values(1, 2);
+insert into t2 values(1, 2);
SET GLOBAL innodb_fast_shutdown = 0;
drop table t1;
show tables;
+
+# Restart the server in force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart:--innodb-force-recovery=5" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+select * from t2;
+
+--error ER_OPEN_AS_READONLY
+insert into t2 values(2, 3);
+
+--error ER_INNODB_READ_ONLY
+alter table t2 add f3 int not null, algorithm=copy;
+
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+alter table t2 add f3 int not null, algorithm=inplace;
+
+--error ER_INNODB_READ_ONLY
+drop index idx on t2;
+
+--error ER_OPEN_AS_READONLY
+update t2 set f1=3 where f2=2;
+
+--error ER_INNODB_READ_ONLY
+create table t4(f1 int not null)engine=innodb;
+
+--error ER_BAD_TABLE_ERROR
+drop table t4;
+
+--error ER_ERROR_ON_RENAME
+rename table t2 to t3;
+
+--error ER_OPEN_AS_READONLY
+truncate table t2;
+
+--error ER_BAD_TABLE_ERROR
+drop table t2;
+show tables;
+
+# Restart the server in force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart:--innodb-force-recovery=6" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+select * from t2;
+
+--error ER_CANT_LOCK
+insert into t2 values(2, 3);
+
+--error ER_CANT_LOCK
+alter table t2 add f3 int not null, algorithm=copy;
+
+--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
+alter table t2 add f3 int not null, algorithm=inplace;
+
+--error ER_CANT_LOCK
+drop index idx on t2;
+
+--error ER_CANT_LOCK
+update t2 set f1=3 where f2=2;
+
+--error ER_INNODB_READ_ONLY
+create table t4(f1 int not null)engine=innodb;
+
+--error ER_BAD_TABLE_ERROR
+drop table t4;
+
+--error ER_ERROR_ON_RENAME
+rename table t2 to t3;
+
+--error ER_OPEN_AS_READONLY
+truncate table t2;
+
+--error ER_BAD_TABLE_ERROR
+drop table t2;
+show tables;
+
+# Restart the server without force recovery mode
+--echo # Stop server
+
+# Write file to make mysql-test-run.pl wait for the server to stop
+-- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Request shutdown
+-- send_shutdown
+
+# Call script that will poll the server waiting for it to disapear
+-- source include/wait_until_disconnected.inc
+
+--echo # Restart server.
+
+# Write file to make mysql-test-run.pl start up the server again, ensure
+# that no background threads are started, so that we can check that it
+# shuts down properly.
+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+
+# Turn on reconnect
+--enable_reconnect
+
+# Call script that will poll the server waiting for it to be back online again
+--source include/wait_until_connected_again.inc
+
+# Turn off reconnect again
+--disable_reconnect
+
+drop table t2;
+show tables;
--- /dev/null
+--source include/have_innodb.inc
+--source include/have_perfschema.inc
+--source include/not_embedded.inc
+
+USE test;
+CREATE TABLE t1(id INT);
+INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
+SELECT * FROM t1;
+
+USE performance_schema;
+--replace_column 2 5
+SELECT EVENT_NAME,COUNT_STAR FROM performance_schema.file_summary_by_event_name
+ WHERE EVENT_NAME like "%inno%";
+USE test;
+DROP table t1;
--- /dev/null
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+let bugdir= $MYSQLTEST_VARDIR/tmp/datadir1;
+--mkdir $bugdir
+
+let SEARCH_FILE = $bugdir/my_restart.err;
+let $args=--defaults-file=$bugdir/my.cnf --datadir=$bugdir --secure-file-priv="" --loose-console > $SEARCH_FILE 2>&1 ;
+
+--write_file $bugdir/my.cnf
+[mysqld]
+EOF
+
+--exec echo "innodb_data_home_dir = $bugdir" >> $bugdir/my.cnf
+
+--append_file $bugdir/my.cnf
+innodb_data_file_path = ibdata1:10M;ibdata2:10M:autoextend
+innodb_undo_tablespaces = 3
+innodb_log_files_in_group = 3
+EOF
+
+# Innodb creates system tablespaces according to my.cnf and aborts
+# after creating undo tablespace.
+--echo # Start mysqld to create tablespaces according to my.cnf
+--error 2
+--exec $MYSQLD $args --skip-grant-tables --debug=d,innodb_undo_upgrade --innodb-unknown-parameter
+
+--list_files $bugdir
+--remove_files_wildcard $bugdir
+--rmdir $bugdir
) ENGINE=INNODB;
INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
SET @optimizer_switch_saved=@@session.optimizer_switch;
SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
# Uses "access_type_changed" to use range over ref despite b_idx not being the
# cheapest in range.
EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
# Output of table_scan in test_quick_select is not always reliable.
---replace_regex /"rows": 12/"rows": 11/ /"cost": 5.5/"cost": 5.3/
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
-SET optimizer_trace="enabled=off";
SET @@session.optimizer_switch=@optimizer_switch_saved;
DROP TABLE t1;
) ENGINE=INNODB;
INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
SET @optimizer_switch_saved=@@session.optimizer_switch;
SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b_idx b_idx 35 NULL 2 Using index condition; Using where
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
-QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
-EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2 {
- "steps": [
- {
- "join_preparation": {
- "select#": 1,
- "steps": [
- {
- "expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where ((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))"
- }
- ] /* steps */
- } /* join_preparation */
- },
- {
- "join_optimization": {
- "select#": 1,
- "steps": [
- {
- "condition_processing": {
- "condition": "WHERE",
- "original_condition": "((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))",
- "steps": [
- {
- "transformation": "equality_propagation",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- },
- {
- "transformation": "constant_propagation",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- },
- {
- "transformation": "trivial_condition_removal",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- }
- ] /* steps */
- } /* condition_processing */
- },
- {
- "table_dependencies": [
- {
- "table": "`t1`",
- "row_may_be_null": false,
- "map_bit": 0,
- "depends_on_map_bits": [
- ] /* depends_on_map_bits */
- }
- ] /* table_dependencies */
- },
- {
- "ref_optimizer_key_uses": [
- {
- "table": "`t1`",
- "field": "b",
- "equals": "2",
- "null_rejecting": false
- }
- ] /* ref_optimizer_key_uses */
- },
- {
- "rows_estimation": [
- {
- "table": "`t1`",
- "range_analysis": {
- "table_scan": {
- "rows": 11,
- "cost": 5.3
- } /* table_scan */,
- "potential_range_indices": [
- {
- "index": "PRIMARY",
- "usable": true,
- "key_parts": [
- "a",
- "b"
- ] /* key_parts */
- },
- {
- "index": "b_idx",
- "usable": true,
- "key_parts": [
- "b",
- "a"
- ] /* key_parts */
- }
- ] /* potential_range_indices */,
- "setup_range_conditions": [
- ] /* setup_range_conditions */,
- "group_index_range": {
- "chosen": false,
- "cause": "not_group_by_or_distinct"
- } /* group_index_range */,
- "analyzing_range_alternatives": {
- "range_scan_alternatives": [
- {
- "index": "PRIMARY",
- "ranges": [
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": true,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 2.41,
- "chosen": true
- },
- {
- "index": "b_idx",
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": false,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 4.41,
- "chosen": false,
- "cause": "cost"
- }
- ] /* range_scan_alternatives */,
- "analyzing_roworder_intersect": {
- "usable": false,
- "cause": "too_few_roworder_scans"
- } /* analyzing_roworder_intersect */
- } /* analyzing_range_alternatives */,
- "chosen_range_access_summary": {
- "range_access_plan": {
- "type": "range_scan",
- "index": "PRIMARY",
- "rows": 2,
- "ranges": [
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
- ] /* ranges */
- } /* range_access_plan */,
- "rows_for_plan": 2,
- "cost_for_plan": 2.41,
- "chosen": true
- } /* chosen_range_access_summary */
- } /* range_analysis */
- }
- ] /* rows_estimation */
- },
- {
- "considered_execution_plans": [
- {
- "plan_prefix": [
- ] /* plan_prefix */,
- "table": "`t1`",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "b_idx",
- "rows": 2,
- "cost": 2.4,
- "chosen": true
- },
- {
- "access_type": "range",
- "rows": 2,
- "cost": 2.81,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */,
- "cost_for_plan": 2.4,
- "rows_for_plan": 2,
- "chosen": true
- }
- ] /* considered_execution_plans */
- },
- {
- "attaching_conditions_to_tables": {
- "original_condition": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))",
- "attached_conditions_computation": [
- {
- "rerunning_range_optimizer_for_single_index": [
- {
- "table_scan": {
- "rows": 11,
- "cost": 5.3
- } /* table_scan */,
- "potential_range_indices": [
- {
- "index": "PRIMARY",
- "usable": false,
- "cause": "not_applicable"
- },
- {
- "index": "b_idx",
- "usable": true,
- "key_parts": [
- "b",
- "a"
- ] /* key_parts */
- }
- ] /* potential_range_indices */,
- "setup_range_conditions": [
- ] /* setup_range_conditions */,
- "group_index_range": {
- "chosen": false,
- "cause": "not_group_by_or_distinct"
- } /* group_index_range */,
- "analyzing_range_alternatives": {
- "range_scan_alternatives": [
- {
- "index": "b_idx",
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": false,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 4.41,
- "chosen": true
- }
- ] /* range_scan_alternatives */,
- "analyzing_roworder_intersect": {
- "usable": false,
- "cause": "too_few_roworder_scans"
- } /* analyzing_roworder_intersect */
- } /* analyzing_range_alternatives */,
- "chosen_range_access_summary": {
- "range_access_plan": {
- "type": "range_scan",
- "index": "b_idx",
- "rows": 2,
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */
- } /* range_access_plan */,
- "rows_for_plan": 2,
- "cost_for_plan": 4.41,
- "chosen": true
- } /* chosen_range_access_summary */
- } /* range_analysis */
- ] /* rerunning_range_optimizer_for_single_index */
- },
- {
- "access_type_changed": {
- "table": "`t1`",
- "index": "b_idx",
- "old_type": "ref",
- "new_type": "range",
- "cause": "uses_more_keyparts"
- } /* access_type_changed */
- }
- ] /* attached_conditions_computation */,
- "attached_conditions_summary": [
- {
- "table": "`t1`",
- "attached": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))"
- }
- ] /* attached_conditions_summary */
- } /* attaching_conditions_to_tables */
- },
- {
- "refine_plan": [
- {
- "table": "`t1`",
- "pushed_index_condition": "(`t1`.`b` = 2)",
- "table_condition_attached": "(`t1`.`a` in ('a','b'))",
- "access_type": "range"
- }
- ] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_explain": {
- "select#": 1,
- "steps": [
- ] /* steps */
- } /* join_explain */
- }
- ] /* steps */
-} 0 0
-SET optimizer_trace="enabled=off";
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
+@trace RLIKE "rerunning_range_optimizer_for_single_index"
+1
SET @@session.optimizer_switch=@optimizer_switch_saved;
DROP TABLE t1;
) ENGINE=INNODB;
INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
SET @optimizer_switch_saved=@@session.optimizer_switch;
SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b_idx b_idx 35 NULL 2 Using index condition; Using where
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
-QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
-EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2 {
- "steps": [
- {
- "join_preparation": {
- "select#": 1,
- "steps": [
- {
- "expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where ((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))"
- }
- ] /* steps */
- } /* join_preparation */
- },
- {
- "join_optimization": {
- "select#": 1,
- "steps": [
- {
- "condition_processing": {
- "condition": "WHERE",
- "original_condition": "((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))",
- "steps": [
- {
- "transformation": "equality_propagation",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- },
- {
- "transformation": "constant_propagation",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- },
- {
- "transformation": "trivial_condition_removal",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- }
- ] /* steps */
- } /* condition_processing */
- },
- {
- "table_dependencies": [
- {
- "table": "`t1`",
- "row_may_be_null": false,
- "map_bit": 0,
- "depends_on_map_bits": [
- ] /* depends_on_map_bits */
- }
- ] /* table_dependencies */
- },
- {
- "ref_optimizer_key_uses": [
- {
- "table": "`t1`",
- "field": "b",
- "equals": "2",
- "null_rejecting": false
- }
- ] /* ref_optimizer_key_uses */
- },
- {
- "rows_estimation": [
- {
- "table": "`t1`",
- "range_analysis": {
- "table_scan": {
- "rows": 11,
- "cost": 5.3
- } /* table_scan */,
- "potential_range_indices": [
- {
- "index": "PRIMARY",
- "usable": true,
- "key_parts": [
- "a",
- "b"
- ] /* key_parts */
- },
- {
- "index": "b_idx",
- "usable": true,
- "key_parts": [
- "b",
- "a"
- ] /* key_parts */
- }
- ] /* potential_range_indices */,
- "setup_range_conditions": [
- ] /* setup_range_conditions */,
- "group_index_range": {
- "chosen": false,
- "cause": "not_group_by_or_distinct"
- } /* group_index_range */,
- "analyzing_range_alternatives": {
- "range_scan_alternatives": [
- {
- "index": "PRIMARY",
- "ranges": [
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": true,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 2.41,
- "chosen": true
- },
- {
- "index": "b_idx",
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": false,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 4.41,
- "chosen": false,
- "cause": "cost"
- }
- ] /* range_scan_alternatives */,
- "analyzing_roworder_intersect": {
- "usable": false,
- "cause": "too_few_roworder_scans"
- } /* analyzing_roworder_intersect */
- } /* analyzing_range_alternatives */,
- "chosen_range_access_summary": {
- "range_access_plan": {
- "type": "range_scan",
- "index": "PRIMARY",
- "rows": 2,
- "ranges": [
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
- ] /* ranges */
- } /* range_access_plan */,
- "rows_for_plan": 2,
- "cost_for_plan": 2.41,
- "chosen": true
- } /* chosen_range_access_summary */
- } /* range_analysis */
- }
- ] /* rows_estimation */
- },
- {
- "considered_execution_plans": [
- {
- "plan_prefix": [
- ] /* plan_prefix */,
- "table": "`t1`",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "b_idx",
- "rows": 2,
- "cost": 2.4,
- "chosen": true
- },
- {
- "access_type": "range",
- "rows": 2,
- "cost": 2.81,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */,
- "cost_for_plan": 2.4,
- "rows_for_plan": 2,
- "chosen": true
- }
- ] /* considered_execution_plans */
- },
- {
- "attaching_conditions_to_tables": {
- "original_condition": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))",
- "attached_conditions_computation": [
- {
- "rerunning_range_optimizer_for_single_index": [
- {
- "table_scan": {
- "rows": 11,
- "cost": 5.3
- } /* table_scan */,
- "potential_range_indices": [
- {
- "index": "PRIMARY",
- "usable": false,
- "cause": "not_applicable"
- },
- {
- "index": "b_idx",
- "usable": true,
- "key_parts": [
- "b",
- "a"
- ] /* key_parts */
- }
- ] /* potential_range_indices */,
- "setup_range_conditions": [
- ] /* setup_range_conditions */,
- "group_index_range": {
- "chosen": false,
- "cause": "not_group_by_or_distinct"
- } /* group_index_range */,
- "analyzing_range_alternatives": {
- "range_scan_alternatives": [
- {
- "index": "b_idx",
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": false,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 4.41,
- "chosen": true
- }
- ] /* range_scan_alternatives */,
- "analyzing_roworder_intersect": {
- "usable": false,
- "cause": "too_few_roworder_scans"
- } /* analyzing_roworder_intersect */
- } /* analyzing_range_alternatives */,
- "chosen_range_access_summary": {
- "range_access_plan": {
- "type": "range_scan",
- "index": "b_idx",
- "rows": 2,
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */
- } /* range_access_plan */,
- "rows_for_plan": 2,
- "cost_for_plan": 4.41,
- "chosen": true
- } /* chosen_range_access_summary */
- } /* range_analysis */
- ] /* rerunning_range_optimizer_for_single_index */
- },
- {
- "access_type_changed": {
- "table": "`t1`",
- "index": "b_idx",
- "old_type": "ref",
- "new_type": "range",
- "cause": "uses_more_keyparts"
- } /* access_type_changed */
- }
- ] /* attached_conditions_computation */,
- "attached_conditions_summary": [
- {
- "table": "`t1`",
- "attached": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))"
- }
- ] /* attached_conditions_summary */
- } /* attaching_conditions_to_tables */
- },
- {
- "refine_plan": [
- {
- "table": "`t1`",
- "pushed_index_condition": "(`t1`.`b` = 2)",
- "table_condition_attached": "(`t1`.`a` in ('a','b'))",
- "access_type": "range"
- }
- ] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_explain": {
- "select#": 1,
- "steps": [
- ] /* steps */
- } /* join_explain */
- }
- ] /* steps */
-} 0 0
-SET optimizer_trace="enabled=off";
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
+@trace RLIKE "rerunning_range_optimizer_for_single_index"
+1
SET @@session.optimizer_switch=@optimizer_switch_saved;
DROP TABLE t1;
) ENGINE=INNODB;
INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
SET @optimizer_switch_saved=@@session.optimizer_switch;
SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b_idx b_idx 35 NULL 2 Using index condition; Using where
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
-QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
-EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2 {
- "steps": [
- {
- "join_preparation": {
- "select#": 1,
- "steps": [
- {
- "expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where ((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))"
- }
- ] /* steps */
- } /* join_preparation */
- },
- {
- "join_optimization": {
- "select#": 1,
- "steps": [
- {
- "condition_processing": {
- "condition": "WHERE",
- "original_condition": "((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))",
- "steps": [
- {
- "transformation": "equality_propagation",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- },
- {
- "transformation": "constant_propagation",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- },
- {
- "transformation": "trivial_condition_removal",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- }
- ] /* steps */
- } /* condition_processing */
- },
- {
- "table_dependencies": [
- {
- "table": "`t1`",
- "row_may_be_null": false,
- "map_bit": 0,
- "depends_on_map_bits": [
- ] /* depends_on_map_bits */
- }
- ] /* table_dependencies */
- },
- {
- "ref_optimizer_key_uses": [
- {
- "table": "`t1`",
- "field": "b",
- "equals": "2",
- "null_rejecting": false
- }
- ] /* ref_optimizer_key_uses */
- },
- {
- "rows_estimation": [
- {
- "table": "`t1`",
- "range_analysis": {
- "table_scan": {
- "rows": 11,
- "cost": 5.3
- } /* table_scan */,
- "potential_range_indices": [
- {
- "index": "PRIMARY",
- "usable": true,
- "key_parts": [
- "a",
- "b"
- ] /* key_parts */
- },
- {
- "index": "b_idx",
- "usable": true,
- "key_parts": [
- "b",
- "a"
- ] /* key_parts */
- }
- ] /* potential_range_indices */,
- "setup_range_conditions": [
- ] /* setup_range_conditions */,
- "group_index_range": {
- "chosen": false,
- "cause": "not_group_by_or_distinct"
- } /* group_index_range */,
- "analyzing_range_alternatives": {
- "range_scan_alternatives": [
- {
- "index": "PRIMARY",
- "ranges": [
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": true,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 2.41,
- "chosen": true
- },
- {
- "index": "b_idx",
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": false,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 4.41,
- "chosen": false,
- "cause": "cost"
- }
- ] /* range_scan_alternatives */,
- "analyzing_roworder_intersect": {
- "usable": false,
- "cause": "too_few_roworder_scans"
- } /* analyzing_roworder_intersect */
- } /* analyzing_range_alternatives */,
- "chosen_range_access_summary": {
- "range_access_plan": {
- "type": "range_scan",
- "index": "PRIMARY",
- "rows": 2,
- "ranges": [
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
- ] /* ranges */
- } /* range_access_plan */,
- "rows_for_plan": 2,
- "cost_for_plan": 2.41,
- "chosen": true
- } /* chosen_range_access_summary */
- } /* range_analysis */
- }
- ] /* rows_estimation */
- },
- {
- "considered_execution_plans": [
- {
- "plan_prefix": [
- ] /* plan_prefix */,
- "table": "`t1`",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "b_idx",
- "rows": 2,
- "cost": 2.4,
- "chosen": true
- },
- {
- "access_type": "range",
- "rows": 2,
- "cost": 2.81,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */,
- "cost_for_plan": 2.4,
- "rows_for_plan": 2,
- "chosen": true
- }
- ] /* considered_execution_plans */
- },
- {
- "attaching_conditions_to_tables": {
- "original_condition": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))",
- "attached_conditions_computation": [
- {
- "rerunning_range_optimizer_for_single_index": [
- {
- "table_scan": {
- "rows": 11,
- "cost": 5.3
- } /* table_scan */,
- "potential_range_indices": [
- {
- "index": "PRIMARY",
- "usable": false,
- "cause": "not_applicable"
- },
- {
- "index": "b_idx",
- "usable": true,
- "key_parts": [
- "b",
- "a"
- ] /* key_parts */
- }
- ] /* potential_range_indices */,
- "setup_range_conditions": [
- ] /* setup_range_conditions */,
- "group_index_range": {
- "chosen": false,
- "cause": "not_group_by_or_distinct"
- } /* group_index_range */,
- "analyzing_range_alternatives": {
- "range_scan_alternatives": [
- {
- "index": "b_idx",
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": false,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 4.41,
- "chosen": true
- }
- ] /* range_scan_alternatives */,
- "analyzing_roworder_intersect": {
- "usable": false,
- "cause": "too_few_roworder_scans"
- } /* analyzing_roworder_intersect */
- } /* analyzing_range_alternatives */,
- "chosen_range_access_summary": {
- "range_access_plan": {
- "type": "range_scan",
- "index": "b_idx",
- "rows": 2,
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */
- } /* range_access_plan */,
- "rows_for_plan": 2,
- "cost_for_plan": 4.41,
- "chosen": true
- } /* chosen_range_access_summary */
- } /* range_analysis */
- ] /* rerunning_range_optimizer_for_single_index */
- },
- {
- "access_type_changed": {
- "table": "`t1`",
- "index": "b_idx",
- "old_type": "ref",
- "new_type": "range",
- "cause": "uses_more_keyparts"
- } /* access_type_changed */
- }
- ] /* attached_conditions_computation */,
- "attached_conditions_summary": [
- {
- "table": "`t1`",
- "attached": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))"
- }
- ] /* attached_conditions_summary */
- } /* attaching_conditions_to_tables */
- },
- {
- "refine_plan": [
- {
- "table": "`t1`",
- "pushed_index_condition": "(`t1`.`b` = 2)",
- "table_condition_attached": "(`t1`.`a` in ('a','b'))",
- "access_type": "range"
- }
- ] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_explain": {
- "select#": 1,
- "steps": [
- ] /* steps */
- } /* join_explain */
- }
- ] /* steps */
-} 0 0
-SET optimizer_trace="enabled=off";
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
+@trace RLIKE "rerunning_range_optimizer_for_single_index"
+1
SET @@session.optimizer_switch=@optimizer_switch_saved;
DROP TABLE t1;
) ENGINE=INNODB;
INSERT INTO t1 VALUES ('a',1),('a',2),('a',3),('b',1),('b',4),('c',1),('d',1),
('c',4),('d',3),('e',2),('f',2);
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status OK
SET @optimizer_switch_saved=@@session.optimizer_switch;
SET @@session.optimizer_switch=default;
-SET optimizer_trace="enabled=on";
EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b_idx b_idx 35 NULL 2 Using index condition; Using where
-SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
-QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
-EXPLAIN SELECT * FROM t1 WHERE a IN ('a', 'b') AND b = 2 {
- "steps": [
- {
- "join_preparation": {
- "select#": 1,
- "steps": [
- {
- "expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where ((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))"
- }
- ] /* steps */
- } /* join_preparation */
- },
- {
- "join_optimization": {
- "select#": 1,
- "steps": [
- {
- "condition_processing": {
- "condition": "WHERE",
- "original_condition": "((`t1`.`a` in ('a','b')) and (`t1`.`b` = 2))",
- "steps": [
- {
- "transformation": "equality_propagation",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- },
- {
- "transformation": "constant_propagation",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- },
- {
- "transformation": "trivial_condition_removal",
- "resulting_condition": "((`t1`.`a` in ('a','b')) and multiple equal(2, `t1`.`b`))"
- }
- ] /* steps */
- } /* condition_processing */
- },
- {
- "table_dependencies": [
- {
- "table": "`t1`",
- "row_may_be_null": false,
- "map_bit": 0,
- "depends_on_map_bits": [
- ] /* depends_on_map_bits */
- }
- ] /* table_dependencies */
- },
- {
- "ref_optimizer_key_uses": [
- {
- "table": "`t1`",
- "field": "b",
- "equals": "2",
- "null_rejecting": false
- }
- ] /* ref_optimizer_key_uses */
- },
- {
- "rows_estimation": [
- {
- "table": "`t1`",
- "range_analysis": {
- "table_scan": {
- "rows": 11,
- "cost": 5.3
- } /* table_scan */,
- "potential_range_indices": [
- {
- "index": "PRIMARY",
- "usable": true,
- "key_parts": [
- "a",
- "b"
- ] /* key_parts */
- },
- {
- "index": "b_idx",
- "usable": true,
- "key_parts": [
- "b",
- "a"
- ] /* key_parts */
- }
- ] /* potential_range_indices */,
- "setup_range_conditions": [
- ] /* setup_range_conditions */,
- "group_index_range": {
- "chosen": false,
- "cause": "not_group_by_or_distinct"
- } /* group_index_range */,
- "analyzing_range_alternatives": {
- "range_scan_alternatives": [
- {
- "index": "PRIMARY",
- "ranges": [
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": true,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 2.41,
- "chosen": true
- },
- {
- "index": "b_idx",
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": false,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 4.41,
- "chosen": false,
- "cause": "cost"
- }
- ] /* range_scan_alternatives */,
- "analyzing_roworder_intersect": {
- "usable": false,
- "cause": "too_few_roworder_scans"
- } /* analyzing_roworder_intersect */
- } /* analyzing_range_alternatives */,
- "chosen_range_access_summary": {
- "range_access_plan": {
- "type": "range_scan",
- "index": "PRIMARY",
- "rows": 2,
- "ranges": [
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2",
- "unprintable_blob_value <= a <= unprintable_blob_value AND 2 <= b <= 2"
- ] /* ranges */
- } /* range_access_plan */,
- "rows_for_plan": 2,
- "cost_for_plan": 2.41,
- "chosen": true
- } /* chosen_range_access_summary */
- } /* range_analysis */
- }
- ] /* rows_estimation */
- },
- {
- "considered_execution_plans": [
- {
- "plan_prefix": [
- ] /* plan_prefix */,
- "table": "`t1`",
- "best_access_path": {
- "considered_access_paths": [
- {
- "access_type": "ref",
- "index": "b_idx",
- "rows": 2,
- "cost": 2.4,
- "chosen": true
- },
- {
- "access_type": "range",
- "rows": 2,
- "cost": 2.81,
- "chosen": false
- }
- ] /* considered_access_paths */
- } /* best_access_path */,
- "cost_for_plan": 2.4,
- "rows_for_plan": 2,
- "chosen": true
- }
- ] /* considered_execution_plans */
- },
- {
- "attaching_conditions_to_tables": {
- "original_condition": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))",
- "attached_conditions_computation": [
- {
- "rerunning_range_optimizer_for_single_index": [
- {
- "table_scan": {
- "rows": 11,
- "cost": 5.3
- } /* table_scan */,
- "potential_range_indices": [
- {
- "index": "PRIMARY",
- "usable": false,
- "cause": "not_applicable"
- },
- {
- "index": "b_idx",
- "usable": true,
- "key_parts": [
- "b",
- "a"
- ] /* key_parts */
- }
- ] /* potential_range_indices */,
- "setup_range_conditions": [
- ] /* setup_range_conditions */,
- "group_index_range": {
- "chosen": false,
- "cause": "not_group_by_or_distinct"
- } /* group_index_range */,
- "analyzing_range_alternatives": {
- "range_scan_alternatives": [
- {
- "index": "b_idx",
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */,
- "index_dives_for_eq_ranges": true,
- "rowid_ordered": false,
- "using_mrr": false,
- "index_only": false,
- "rows": 2,
- "cost": 4.41,
- "chosen": true
- }
- ] /* range_scan_alternatives */,
- "analyzing_roworder_intersect": {
- "usable": false,
- "cause": "too_few_roworder_scans"
- } /* analyzing_roworder_intersect */
- } /* analyzing_range_alternatives */,
- "chosen_range_access_summary": {
- "range_access_plan": {
- "type": "range_scan",
- "index": "b_idx",
- "rows": 2,
- "ranges": [
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value",
- "2 <= b <= 2 AND unprintable_blob_value <= a <= unprintable_blob_value"
- ] /* ranges */
- } /* range_access_plan */,
- "rows_for_plan": 2,
- "cost_for_plan": 4.41,
- "chosen": true
- } /* chosen_range_access_summary */
- } /* range_analysis */
- ] /* rerunning_range_optimizer_for_single_index */
- },
- {
- "access_type_changed": {
- "table": "`t1`",
- "index": "b_idx",
- "old_type": "ref",
- "new_type": "range",
- "cause": "uses_more_keyparts"
- } /* access_type_changed */
- }
- ] /* attached_conditions_computation */,
- "attached_conditions_summary": [
- {
- "table": "`t1`",
- "attached": "((`t1`.`b` = 2) and (`t1`.`a` in ('a','b')))"
- }
- ] /* attached_conditions_summary */
- } /* attaching_conditions_to_tables */
- },
- {
- "refine_plan": [
- {
- "table": "`t1`",
- "pushed_index_condition": "(`t1`.`b` = 2)",
- "table_condition_attached": "(`t1`.`a` in ('a','b'))",
- "access_type": "range"
- }
- ] /* refine_plan */
- }
- ] /* steps */
- } /* join_optimization */
- },
- {
- "join_explain": {
- "select#": 1,
- "steps": [
- ] /* steps */
- } /* join_explain */
- }
- ] /* steps */
-} 0 0
-SET optimizer_trace="enabled=off";
+SELECT TRACE into @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "rerunning_range_optimizer_for_single_index";
+@trace RLIKE "rerunning_range_optimizer_for_single_index"
+1
SET @@session.optimizer_switch=@optimizer_switch_saved;
DROP TABLE t1;
--- /dev/null
+SELECT "Digest table has a size 1 and is full already." as use_case;
+use_case
+Digest table has a size 1 and is full already.
+select SCHEMA_NAME, DIGEST, DIGEST_TEXT
+from performance_schema.events_statements_summary_by_digest;
+SCHEMA_NAME DIGEST DIGEST_TEXT
+NULL NULL NULL
--- /dev/null
+--performance-schema-digests-size=1
--- /dev/null
+# -----------------------------------------------------------------------
+# Tests for the performance schema statement Digests.
+# -----------------------------------------------------------------------
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source include/no_protocol.inc
+
+SELECT "Digest table has a size 1 and is full already." as use_case;
+
+select SCHEMA_NAME, DIGEST, DIGEST_TEXT
+ from performance_schema.events_statements_summary_by_digest;
+
+
+
--- /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]
+SET @old_sql_mode_master= @@session.sql_mode;
+SET @@session.sql_mode= (select replace(@@session.sql_mode,'NO_BACKSLASH_ESCAPES',''));
+SET @old_sql_mode_slave= @@session.sql_mode;
+SET @@session.sql_mode= (select replace(@@session.sql_mode,'NO_BACKSLASH_ESCAPES',''));
+SET GLOBAL DEBUG= '+d,force_hash_string_with_quote';
+CREATE USER 'user1'@'localhost' IDENTIFIED WITH sha256_password;
+SET old_passwords= 2;
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret');
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; SET PASSWORD FOR 'user1'@'localhost'='$5$BVZy9O>\'a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4'
+include/sync_slave_sql_with_master.inc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; SET PASSWORD FOR 'user1'@'localhost'='$5$BVZy9O>\'a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4'
+SET GLOBAL DEBUG= '-d,force_hash_string_with_quote';
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret1');
+include/sync_slave_sql_with_master.inc
+SELECT USER();
+USER()
+user1@localhost
+SET GLOBAL DEBUG= '+d,force_hash_string_with_quote';
+SET @@session.sql_mode= 'NO_BACKSLASH_ESCAPES';
+SET @@session.sql_mode= 'NO_BACKSLASH_ESCAPES';
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret');
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+master-bin.000001 # Query # # use `test`; SET PASSWORD FOR 'user1'@'localhost'='$5$BVZy9O>''a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4'
+include/sync_slave_sql_with_master.inc
+include/show_binlog_events.inc
+Log_name Pos Event_type Server_id End_log_pos Info
+slave-bin.000001 # Query # # use `test`; SET PASSWORD FOR 'user1'@'localhost'='$5$BVZy9O>''a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4'
+SET GLOBAL DEBUG= '-d,force_hash_string_with_quote';
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret2');
+include/sync_slave_sql_with_master.inc
+SELECT USER();
+USER()
+user1@localhost
+SET @@session.sql_mode= @old_sql_mode_slave;
+SET @@session.sql_mode= @old_sql_mode_master;
+DROP USER 'user1'@'localhost';
+include/rpl_end.inc
include/start_slave.inc
SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('MASTER_UUID:10');
include/assert.inc [Rows until 10 in t1 must be replicated now]
+Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with negative timeout
+value. When SQL_MODE is strict, then it will throw
+WRONG_ARGUMENTS error.
+SET @save_sql_mode=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('MASTER_UUID:100', -1);;
+ERROR HY000: Incorrect arguments to WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.
+When SQL_MODE is non-strict mode, then it will return NULL immediately
+without doing any work and generates WRONG_ARGUMENTS warning.
+SET @@SESSION.SQL_MODE="";
+SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('MASTER_UUID:100', -1);;
+WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('MASTER_UUID:100', -1)
+NULL
+Warnings:
+Warning 1210 Incorrect arguments to WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.
+SET @@SESSION.SQL_MODE=@save_sql_mode;
+Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with fractional timeout
+value. Earlier(before fix), 0.4 is read as integer value '0' and
+the function hanged forever (or till all the specified gtids are
+executed). Now(after fix) 0.4 will be read as double 0.4 and will waitfor
+atleast 0.4 seconds (or till all the specified gtids are executed).
+Also check that function returns -1 if the timeout has been exceeded.
+include/assert.inc [WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS returns -1 if the timeout has been exceeded.]
DROP TABLE t1;
include/rpl_end.inc
DELETE FROM non_trans_table2;
Got one of the listed errors
DROP TRIGGER trigger1;
+include/sync_slave_sql_with_master.inc
+[connection master]
include/diff_tables.inc [master:trans_table1, slave:trans_table1]
include/diff_tables.inc [master:trans_table2, slave:trans_table2]
include/diff_tables.inc [master:non_trans_table1, slave:non_trans_table1]
select master_pos_wait('foo', 98);
master_pos_wait('foo', 98)
NULL
+include/start_slave_sql.inc
+Test MASTER_POS_WAIT function with negative timeout value.
+When SQL_MODE is strict, then it will throw WRONG_ARGUMENTS
+error.
+SET @save_sql_mode=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+SELECT MASTER_POS_WAIT('master-bin.999999', 4, -1);
+ERROR HY000: Incorrect arguments to MASTER_POS_WAIT.
+SET @@SESSION.SQL_MODE="";
+SELECT MASTER_POS_WAIT('master-bin.999999', 4, -1);
+MASTER_POS_WAIT('master-bin.999999', 4, -1)
+NULL
+Warnings:
+Warning 1210 Incorrect arguments to MASTER_POS_WAIT.
+SET @@SESSION.SQL_MODE=@save_sql_mode;
+Test WAIT_FOR_EXECUTED_GTID_SET function with fractional timeout value.
+Earlier(before fix), 0.4 is read as integer value '0' and the function
+hanged forever (or till all the specified gtids are executed).
+Now(after fix) 0.4 will be read as doube 0.4 and will waitfor
+atleast 0.4 seconds (or till all the specified gtids are executed).
+Also check that in case of timeout, function returns -1.
+include/assert.inc [MASTER_POS_WAIT returns -1 if the timeout has been exceeded.]
include/rpl_end.inc
SET @save_default_storage_engine=@@global.default_storage_engine;
SET @@global.default_storage_engine='innodb';
SET GLOBAL slave_parallel_workers= 4;
+call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
call mtr.add_suppression("Request to stop slave SQL Thread received while applying a group that has non-transactional changes");
include/stop_slave.inc
include/start_slave.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 slave]
+SET @save_global_debug=@@GLOBAL.DEBUG;
+SET @@GLOBAL.DEBUG= '+d,dbug.calculate_sbm_after_fake_rotate_log_event';
+include/start_slave.inc
+[connection master]
+FLUSH LOGS;
+[connection slave]
+SET DEBUG_SYNC="now wait_for signal.reached";
+include/assert.inc [Seconds Behind Master should be less than IO_THREAD's time.]
+SET DEBUG_SYNC="now signal signal.done_sbm_calculation";
+SET DEBUG_SYNC="now wait_for signal.reached";
+include/assert.inc [Seconds Behind Master should be less than IO_THREAD's time.]
+SET DEBUG_SYNC="now signal signal.done_sbm_calculation";
+SET @@GLOBAL.DEBUG=@save_global_debug;
+include/rpl_end.inc
--- /dev/null
+#
+# === Purpose ===
+# This test script verifies that in a replication environment,
+# the slave correctly parses the hash password in ALTER USER or
+# SET PASSWORD query. It verifies that the slave doesn't
+# encounter an error in parsing a hash string which contains a
+# single quote. The fix ensures escaping the hash string correctly
+# depending on the server mode. Since this issue is sporadic,
+# we have used a debug flag to deterministically generate a
+# hash string which contains a single quote.
+#
+# === Related bugs and worklogs ===
+#
+# Bug#20228478: ON REPLICATION SLAVE, ALTER USER FAILING FOR USER
+# WITH SHA256_PASSWORD PLUGIN
+#
+
+--source include/have_ssl_communication.inc
+--source include/have_openssl.inc
+--source include/have_ssl.inc
+--source include/master-slave.inc
+--source include/have_debug.inc
+
+#Scenario 1:
+# When NO_BACKSLASH_ESCAPES mode is not set on both master and the slave.
+SET @old_sql_mode_master= @@session.sql_mode;
+SET @@session.sql_mode= (select replace(@@session.sql_mode,'NO_BACKSLASH_ESCAPES',''));
+
+--connection slave
+SET @old_sql_mode_slave= @@session.sql_mode;
+SET @@session.sql_mode= (select replace(@@session.sql_mode,'NO_BACKSLASH_ESCAPES',''));
+
+--connection master
+SET GLOBAL DEBUG= '+d,force_hash_string_with_quote';
+CREATE USER 'user1'@'localhost' IDENTIFIED WITH sha256_password;
+SET old_passwords= 2;
+# Save master position
+--let $saved_master_pos= query_get_value('SHOW MASTER STATUS', Position, 1)
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret');
+# Check the binlog contents on the master
+--let $binlog_start= $saved_master_pos
+--let $binlog_limit= 2
+--source include/show_binlog_events.inc
+# Check the binlog contents on the slave
+--source include/sync_slave_sql_with_master.inc
+--source include/show_binlog_events.inc
+# Reset the flag
+--connection master
+SET GLOBAL DEBUG= '-d,force_hash_string_with_quote';
+
+# Scenario 2:
+# Make sure that we are successfully able to login to the slave from a
+# user whose password is changed and NO_BACKSLASH_ESCAPES mode is not
+# set on both master and slave. The hash string generated here may or
+# may not contain a single quote within it.
+--connection master
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret1');
+--source include/sync_slave_sql_with_master.inc
+--connect(con1, localhost, user1,'auth_secret1',,,,SSL)
+SELECT USER();
+disconnect con1;
+
+# Scenario 3:
+# When NO_BACKSLASH_ESCAPES mode is set on both master and the slave.
+--connection master
+SET GLOBAL DEBUG= '+d,force_hash_string_with_quote';
+SET @@session.sql_mode= 'NO_BACKSLASH_ESCAPES';
+--connection slave
+SET @@session.sql_mode= 'NO_BACKSLASH_ESCAPES';
+--connection master
+# Save master position
+--let $saved_master_pos= query_get_value('SHOW MASTER STATUS', Position, 1)
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret');
+# Check the binlog contents on the master
+--let $binlog_start= $saved_master_pos
+--let $binlog_limit= 2
+--source include/show_binlog_events.inc
+# Check the binlog contents on the slave
+--source include/sync_slave_sql_with_master.inc
+--source include/show_binlog_events.inc
+# Reset the flag
+--connection master
+SET GLOBAL DEBUG= '-d,force_hash_string_with_quote';
+
+# Scenario 4:
+# Make sure that we are successfully able to login to the slave
+# after the password is changed for a user and NO_BACKSLASH_ESCAPES
+# mode is set on both master and slave. This scenario will generate
+# the hash string which may or may not contain a single quote.
+SET PASSWORD FOR 'user1'@'localhost' = PASSWORD('auth_secret2');
+--source include/sync_slave_sql_with_master.inc
+--connect(con1, localhost, user1,'auth_secret2',,,,SSL)
+SELECT USER();
+disconnect con1;
+
+#Restore the old sql_mode at the master and the slave
+--connection slave
+SET @@session.sql_mode= @old_sql_mode_slave;
+--connection master
+SET @@session.sql_mode= @old_sql_mode_master;
+
+#cleanup
+DROP USER 'user1'@'localhost';
+--source include/rpl_end.inc
--let $assert_text= Rows until 10 in t1 must be replicated now
--source include/assert.inc
+#
+# Bug#24976304 WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS TIMEOUT VALUE HANDLES SOME
+# INPUTS BADLY
+#
+--echo Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with negative timeout
+--echo value. When SQL_MODE is strict, then it will throw
+--echo WRONG_ARGUMENTS error.
+SET @save_sql_mode=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+--replace_result $master_uuid MASTER_UUID
+--error ER_WRONG_ARGUMENTS
+--eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', -1);
+
+--echo When SQL_MODE is non-strict mode, then it will return NULL immediately
+--echo without doing any work and generates WRONG_ARGUMENTS warning.
+SET @@SESSION.SQL_MODE="";
+--replace_result $master_uuid MASTER_UUID
+--eval SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', -1);
+SET @@SESSION.SQL_MODE=@save_sql_mode;
+
+--echo Test WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS function with fractional timeout
+--echo value. Earlier(before fix), 0.4 is read as integer value '0' and
+--echo the function hanged forever (or till all the specified gtids are
+--echo executed). Now(after fix) 0.4 will be read as double 0.4 and will waitfor
+--echo atleast 0.4 seconds (or till all the specified gtids are executed).
+--echo Also check that function returns -1 if the timeout has been exceeded.
+--let $assert_text= WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS returns -1 if the timeout has been exceeded.
+--let $query_result= query_get_value("SELECT WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS('$master_uuid:100', 0.4) AS VALUE", VALUE, 1)
+--let $assert_cond= "$query_result" = "-1"
+--source include/assert.inc
+
+# End of Test Bug#24976304
+
# Cleanup
--connection master
DROP TABLE t1;
--let $func_or_trig_body=CREATE TEMPORARY TABLE tt1(i INT) ENGINE=MyISAM; DROP TEMPORARY TABLE IF EXISTS tt1; INSERT INTO trans_table1 VALUES (12);
--source extra/rpl_tests/rpl_gtid_temp_table_in_func_or_trigger.inc
+# Sync slave with master before checking diff tables
+--source include/sync_slave_sql_with_master.inc
+--source include/rpl_connection_master.inc
+
# Test that all Slave tables are in sync with Master tables
--let $diff_tables=master:trans_table1, slave:trans_table1
--source include/diff_tables.inc
echo "*** must be NULL ***";
select master_pos_wait('foo', 98);
+#
+# Bug#24976304 WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS TIMEOUT VALUE HANDLES SOME
+# INPUTS BADLY
+#
+connection slave;
+--source include/start_slave_sql.inc
+
+--echo Test MASTER_POS_WAIT function with negative timeout value.
+--echo When SQL_MODE is strict, then it will throw WRONG_ARGUMENTS
+--echo error.
+SET @save_sql_mode=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+--error ER_WRONG_ARGUMENTS
+SELECT MASTER_POS_WAIT('master-bin.999999', 4, -1);
+
+#--echo When SQL_MODE is non-strict mode, then it will return NULL immediately
+#--echo without doing any work and generates WRONG_ARGUMENTS warning.
+SET @@SESSION.SQL_MODE="";
+SELECT MASTER_POS_WAIT('master-bin.999999', 4, -1);
+SET @@SESSION.SQL_MODE=@save_sql_mode;
+
+--echo Test WAIT_FOR_EXECUTED_GTID_SET function with fractional timeout value.
+--echo Earlier(before fix), 0.4 is read as integer value '0' and the function
+--echo hanged forever (or till all the specified gtids are executed).
+--echo Now(after fix) 0.4 will be read as doube 0.4 and will waitfor
+--echo atleast 0.4 seconds (or till all the specified gtids are executed).
+--echo Also check that in case of timeout, function returns -1.
+--let $assert_text= MASTER_POS_WAIT returns -1 if the timeout has been exceeded.
+--let $query_result= query_get_value("SELECT MASTER_POS_WAIT('master-bin.999999', 4, 0.4) AS VALUE", VALUE, 1)
+--let $assert_cond= "$query_result" = "-1"
+--source include/assert.inc
+
+# End of Test Bug#24976304
+
# End of 4.1 tests
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc
SET @@global.default_storage_engine='innodb';
eval SET GLOBAL slave_parallel_workers= $max_workers;
-#call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
+# As the test case is not going to do any synchronization with the master
+# before issuing STOP SLAVE in the non-deterministic activity, there is a
+# chance that the slave applier be in MTS mode and in a condition that it
+# will throw the following error message:
+call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
call mtr.add_suppression("Request to stop slave SQL Thread received while applying a group that has non-transactional changes");
--source include/stop_slave.inc
--- /dev/null
+###############################################################################
+# Bug#23532304 SECONDS_BEHIND_MASTER REPORTS IO_THREAD TIME WHEN USING MTS &
+# ROTATING RELAY-LOG
+# Problem: The value of 'Seconds_Behind_Master' (SBM) reports distorted number
+# when rotating a relay-log.
+#
+# Steps to reproduce:
+# 1) Fake that I/O thread is started 3 minutes ago using a debug point.
+# 2) Flush the logs on the master which would have generated fake rotate
+# event
+# 3) While the fake rotate event is getting executing, calculate the SBM
+# 4) Compare the executed SBM that it is not greater than or equal to I/O
+# thread's active time.
+# 5) Clean the debug point.
+#
+###############################################################################
+--source include/have_debug_sync.inc
+--let rpl_skip_start_slave=1
+--source include/master-slave.inc
+
+# Step-1 Set sync debug point to calculate sbm exactly after fake
+# rotate log event.
+--source include/rpl_connection_slave.inc
+SET @save_global_debug=@@GLOBAL.DEBUG;
+# This debug point internally fake that IO thread is started 3 minutes ago.
+SET @@GLOBAL.DEBUG= '+d,dbug.calculate_sbm_after_fake_rotate_log_event';
+# Start slave threads after enabling the debug point.
+--disable_warnings
+--source include/start_slave.inc
+--enable_warnings
+
+# Step-2 Flush logs on master which will generate a fake rotate event.
+--source include/rpl_connection_master.inc
+FLUSH LOGS;
+
+# Step-3 There will be two fake rotate events (first one while the initial setup
+# in master-slave.inc and second one due to FLUSH LOGS execution on master).
+# The following will test SBM calculation while both events are getting
+# executed.
+--source include/rpl_connection_slave.inc
+--let $iter=0
+while ($iter < 2)
+{
+# Step-4: Calcualte SBM while fake rotate log event is getting executed.
+# It should be approximately zero (some times little more than zero
+# if this test is run on a slow pb2 machine). Comparing with the
+# I/O thread age that it should be atleast less
+# than the age of I/O thread.
+SET DEBUG_SYNC="now wait_for signal.reached";
+let $sbm= query_get_value("SHOW SLAVE STATUS", Seconds_Behind_Master, 1);
+--let $assert_text= Seconds Behind Master should be less than IO_THREAD's time.
+--let $assert_cond= $sbm < 180
+--source include/assert.inc
+SET DEBUG_SYNC="now signal signal.done_sbm_calculation";
+--inc $iter
+}
+
+# Step-5: Cleanup
+SET @@GLOBAL.DEBUG=@save_global_debug;
+
+--source include/rpl_end.inc
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
sum_distinct-big : Bug#11764126 2010-11-15 mattiasj was not tested
archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
-log_tables-big : Bug#11756699 2010-11-15 mattiasj report already exists
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_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
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
eval $query;
DROP TABLE t1,t2,t3;
+
+--echo #
+--echo # Bug#22686994 REGRESSION FOR A GROUPING QUERY WITH DISTINCT
+--echo #
+
+CREATE TABLE t1 (a INTEGER, b INTEGER);
+
+INSERT INTO t1 VALUES (1,3), (2,4), (1,5),
+(1,3), (2,1), (1,5), (1,7), (3,1),
+(3,2), (3,1), (2,4);
+
+SELECT DISTINCT (COUNT(DISTINCT b) + 1) AS c FROM t1 GROUP BY a;
+DROP TABLE t1;
+
+--echo # End of test for Bug#22686994
+
# mysql.event intact checking end
#
-create event e_26 on schedule at '2038-01-19 03:14:07' disable do set @a = 5;
+create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
drop event e_26;
--error ER_WRONG_VALUE
SET end_markers_in_json=DEFAULT;
DROP TABLE t0,t1,t2;
+
+--echo #
+--echo # Bug #21749123: SELECT DISTINCT, WRONG RESULTS COMBINED WITH
+--echo # USE_INDEX_EXTENSIONS=OFF
+--echo #
+
+CREATE TABLE t1 (
+ pk_col INT AUTO_INCREMENT PRIMARY KEY,
+ a1 CHAR(64),
+ KEY a1_idx (a1)
+) ENGINE=INNODB;
+INSERT INTO t1 (a1) VALUES ('a'),('a'),('a'),('a'),('a'),('a'),('a'),('a');
+
+CREATE TABLE t2 (
+ pk_col1 INT NOT NULL,
+ pk_col2 INT NOT NULL,
+ a1 CHAR(64),
+ a2 CHAR(64),
+ PRIMARY KEY(pk_col1, pk_col2),
+ KEY a1_idx (a1),
+ KEY a1_a2_idx (a1, a2)
+) ENGINE=INNODB;
+INSERT INTO t2 (pk_col1, pk_col2, a1, a2) VALUES (1,1,'a','b'),(1,2,'a','b'),
+ (1,3,'a','c'),(1,4,'a','c'),
+ (2,1,'a','d');
+ANALYZE TABLE t1;
+ANALYZE TABLE t2;
+
+#Doesn't use loose index scan irrespective of index extensions.
+let query1=
+SELECT DISTINCT a1
+FROM t1
+WHERE (pk_col = 2 OR pk_col = 22) AND a1 = 'a';
+
+#Doesn't use loose index scan when index extensions is off.
+let query2=
+SELECT COUNT(DISTINCT a1)
+FROM t1
+GROUP BY a1,pk_col;
+
+#Doesn't use loose index scan when index extensions is off.
+let query3=
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,pk_col1;
+
+#Uses loose index scan irrespective of index extensions.
+let query4=
+SELECT COUNT(DISTINCT a1)
+FROM t2
+GROUP BY a1,a2;
+
+eval EXPLAIN $query1;
+eval $query1;
+eval EXPLAIN $query2;
+eval $query2;
+eval EXPLAIN $query3;
+eval $query3;
+eval EXPLAIN $query4;
+eval $query4;
+
+SET @optimizer_switch_save=@@optimizer_switch;
+SET @@optimizer_switch= "use_index_extensions=off";
+
+eval EXPLAIN $query1;
+eval $query1;
+eval EXPLAIN $query2;
+eval $query2;
+eval EXPLAIN $query3;
+eval $query3;
+eval EXPLAIN $query4;
+eval $query4;
+
+SET @@optimizer_switch= @optimizer_switch_save;
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug #24671968: WHEN THE OPTIMISER IS USING INDEX FOR GROUP-BY IT OFTEN
+--echo # OFTEN GIVES WRONG RESULTS
+--echo #
+
+CREATE TABLE t1 (
+id int NOT NULL,
+c1 int NOT NULL,
+c2 int,
+PRIMARY KEY(id),
+INDEX c1_c2_idx(c1, c2));
+
+INSERT INTO t1 (id, c1, c2) VALUES (1,1,1), (2,2,2), (10,10,1), (11,10,8),
+ (12,10,1), (13,10,2), (3,1,1), (4,10,1),
+ (5,10,1), (6,10,8), (7,1,1), (8,10,1);
+ANALYZE TABLE t1;
+
+# Query similar to the one mentioned in the bug page. Incorrectly chooses
+# loose index scan.
+let query1=
+SELECT DISTINCT c1
+FROM t1
+WHERE EXISTS (SELECT *
+ FROM DUAL
+ WHERE (c2 = 2));
+
+# IN subquery. Incorrectly chooses loose index scan.
+let query2=
+SELECT DISTINCT c1
+FROM t1
+WHERE 1 IN (2,
+ (SELECT 1
+ FROM DUAL
+ WHERE (c2 = 2)),
+ 3);
+
+# Similar to above queries but without subquery.
+let query3=
+SELECT DISTINCT c1
+FROM t1
+WHERE c2 = 2;
+
+# Same as query1 with IGNORE INDEX. So this will not choose loose index scan.
+let query4=
+SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE EXISTS (SELECT *
+ FROM DUAL
+ WHERE (c2 = 2));
+
+# Same as query2 with IGNORE INDEX. So this will not choose loose index scan.
+let query5=
+SELECT DISTINCT c1
+FROM t1 IGNORE INDEX (c1_c2_idx)
+WHERE 1 IN (2,
+ (SELECT 1
+ FROM DUAL
+ WHERE (c2 = 2)),
+ 3);
+
+--replace_column 9 #
+eval EXPLAIN $query1;
+--replace_column 9 #
+eval EXPLAIN $query2;
+--replace_column 9 #
+eval EXPLAIN $query3;
+--replace_column 9 #
+eval EXPLAIN $query4;
+--replace_column 9 #
+eval EXPLAIN $query5;
+
+# Looking for the tag in optimizer trace: "dependent_subquery_in_where".
+SET optimizer_trace="enabled=on";
+
+eval $query1;
+SELECT TRACE INTO @trace FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
+SELECT @trace RLIKE "keypart_reference_from_where_clause";
+
+SET optimizer_trace="enabled=off";
+
+eval $query2;
+eval $query3;
+eval $query4;
+eval $query5;
+
+DROP TABLE t1;
DELETE FROM t1;
--echo
---error ER_LOAD_DATA_INVALID_COLUMN
+--error ER_NONUPDATEABLE_COLUMN
LOAD DATA INFILE '../../std_data/bug35469.dat' INTO TABLE v2
FIELDS ESCAPED BY '\\'
TERMINATED BY ','
# check that CSV engine was compiled in
--source include/have_csv.inc
+set @@global.log_output = 'TABLE';
+
connect (con1,localhost,root,,);
connect (con2,localhost,root,,);
select get_lock('bug27638', 1);
connection con2;
set session long_query_time=1;
-truncate table mysql.slow_log;
select get_lock('bug27638', 2);
-select if (query_time between '00:00:01' and '00:00:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
-truncate table mysql.slow_log;
+select if (query_time >= '00:00:01', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+ where sql_text = 'select get_lock(\'bug27638\', 2)';
select get_lock('bug27638', 60);
-select if (query_time between '00:00:59' and '00:01:10', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
-truncate table mysql.slow_log;
+select if (query_time >= '00:00:59', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+ where sql_text = 'select get_lock(\'bug27638\', 60)';
select get_lock('bug27638', 101);
-select if (query_time between '00:01:40' and '00:01:50', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log;
+select if (query_time >= '00:01:40', 'OK', 'WRONG') as qt, sql_text from mysql.slow_log
+ where sql_text = 'select get_lock(\'bug27638\', 101)';
connection con1;
select release_lock('bug27638');
connection default;
disconnect con1;
disconnect con2;
+
+set @@global.log_output=default;
DROP TABLE t1;
DROP TABLE t2;
DROP DATABASE db_20772273;
+
+--echo #
+--echo # Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
+--echo #
+
+
+CREATE DATABASE bug25717383;
+use bug25717383;
+
+CREATE TABLE `tab
+one` (a int);
+CREATE VIEW `view
+one` as SELECT * FROM `tab
+one`;
+
+CREATE PROCEDURE `proc
+one`() SELECT * from `tab
+one`;
+
+CREATE TEMPORARY TABLE `temp
+one` (id INT);
+
+CREATE TRIGGER `trig
+one` BEFORE INSERT ON `tab
+one` FOR EACH ROW SET NEW.a = 1;
+
+CREATE EVENT `event
+one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5;
+
+SHOW TABLES FROM bug25717383;
+SHOW TRIGGERS FROM bug25717383;
+--replace_column 6 #
+SHOW EVENTS FROM bug25717383;
+
+SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
+ WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
+ ORDER BY ROUTINE_NAME;
+
+--exec $MYSQL_DUMP --triggers --events --routines --add-drop-database --databases bug25717383 > $MYSQLTEST_VARDIR/tmp/bug25717383.sql
+
+SHOW TABLES FROM bug25717383;
+SHOW TRIGGERS FROM bug25717383;
+--replace_column 6 #
+SHOW EVENTS FROM bug25717383;
+
+SELECT ROUTINE_NAME FROM INFORMATION_SCHEMA.ROUTINES
+ WHERE ROUTINE_SCHEMA='bug25717383' AND ROUTINE_TYPE= 'PROCEDURE'
+ ORDER BY ROUTINE_NAME;
+
+DROP DATABASE bug25717383;
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select master_pos_wait(1, 2, 3, 4);
+--disable_result_log
+SET @save_sql_mode_before_master_pos_wait=@@SESSION.SQL_MODE;
+SET @@SESSION.SQL_MODE="STRICT_ALL_TABLES";
+--error 0, ER_WRONG_ARGUMENTS
+select master_pos_wait('master-bin.999999', 4, -1);
+SET @@SESSION.SQL_MODE=@save_sql_mode_before_master_pos_wait;
+--enable_result_log
+
-- error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT
select rand(1, 2, 3);
--echo # Connection default
connection default;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug#19894382 - SERVER SIDE PREPARED STATEMENTS LEADS TO POTENTIAL OFF-BY-SECOND
+--echo # TIMESTAMP ON SLAVE.
+--echo #
+
+CREATE TABLE bug19894382(f1 CHAR(64) DEFAULT 'slave',
+ f2 TIME, f3 TIMESTAMP NULL, f4 DATETIME,
+ f5 TIME(3), f6 TIMESTAMP(3) NULL, f7 DATETIME(3));
+
+--echo # Execute prepared statements from mysql_client_test.
+--exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/bug19894382.out.log 2>&1
+--exec $MYSQL_CLIENT_TEST -d -u root test_bug19894382 >> $MYSQLTEST_VARDIR/log/bug19894382.out.log 2>&1
+
+--echo # Insert tuples from the client_test_db.bug19894382 to the test.bug19894382.
+--echo # Tuples in the client_test_db.bug19894382 are inserted from the mysql_client_test.
+INSERT INTO bug19894382 SELECT * FROM client_test_db.bug19894382;
+
+--echo # Replay binlog events
+let $MYSQLD_DATADIR= `select @@datadir`;
+--let $master_log_file= query_get_value(SHOW MASTER STATUS, File, 1)
+--exec $MYSQL_BINLOG --force-if-open -d client_test_db $MYSQLD_DATADIR/$master_log_file > $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug19894382.binlog
+--exec $MYSQL -e "source $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug19894382.binlog"
+
+--echo # Insert tuples from the client_test_db.bug19894382 to the test.bug19894382.
+--echo # Tuples in the client_test_db.bug19894382 are inserted from the binlog.
+INSERT INTO bug19894382(f2, f3, f4, f5, f6, f7)
+ SELECT f2, f3, f4, f5, f6, f7 FROM client_test_db.bug19894382;
+--echo # With fix, tuples of "master" and "slave" will be same. There will not be any difference
+--echo # in values inserted for time, timestamp and datetime type columns.
+SELECT * FROM bug19894382 ORDER BY f2;
+
+--echo # Cleanup
+DROP DATABASE client_test_db;
+DROP TABLE bug19894382;
+--remove_file $MYSQLTEST_VARDIR/log/bug19894382.out.log
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug19894382.binlog
create table t2 like t1;
show create table t2;
drop tables t1, t2;
+
+--echo #
+--echo # Test for bug #25514146 DB_NAME IS IGNORED WHEN CREATING TABLE
+--echo # WITH DATA DIRECTORY
+--echo #
+
+--echo # Make sure we have no current database
+CREATE DATABASE x;
+USE x;
+DROP DATABASE x;
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval CREATE TABLE test.t1(id INT(11)) ENGINE MYISAM
+DATA DIRECTORY "$MYSQLTEST_VARDIR/tmp";
+
+DROP TABLE test.t1;
-# 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 Library General Public
fun:kill_server_thread
}
+{
+ Bug#25391948 RPL_CHECK_GTID TEST FAILS SPORADICALLY ON PB2 - WEEKLY-5.6 FOR LINUX-VALGRIND
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ fun:malloc
+ fun:_dl_close_worker
+ fun:_dl_close
+ fun:_dl_catch_error
+ fun:__libc_dlclose
+ ...
+}
+
+{
+ Bug#25391948 RPL_CHECK_GTID TEST FAILS SPORADICALLY ON PB2 - WEEKLY-5.6 FOR LINUX-VALGRIND
+ Memcheck:Leak
+ match-leak-kinds: reachable
+ fun:malloc
+ ...
+ fun:dl_open_worker
+ fun:_dl_catch_error
+ fun:_dl_open
+ fun:do_dlopen
+ fun:_dl_catch_error
+ fun:__libc_dlopen_mode
+ ...
+}
+
#Suppress warnings from glibc implementation of 'malloc_info'
{
Malloc_info uninitialised value of size 8
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
<Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />\r
<Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />\r
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />\r
- <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved." />\r
+ <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved." />\r
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />\r
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />\r
</Dialog>\r
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">\r
\r
<!--\r
- Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.\r
+ Copyright (c) 2012, 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
--- /dev/null
+# Copyright (c) 2016, 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ RETURN()
+ENDIF()
+
+IF (NOT DEFINED DEB_CODENAME)
+ execute_process(
+ COMMAND lsb_release -cs
+ OUTPUT_VARIABLE DEB_CODENAME
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ SET (DEB_CODENAME ${DEB_CODENAME} CACHE STRING "")
+ENDIF()
+# Commercial or community
+IF (DEB_PRODUCT STREQUAL "commercial")
+ SET (DEB_COPYRIGHT_UPSTREAMNAME "MySQL Commercial Server ${MYSQL_BASE_VERSION}")
+ SET (DEB_PRODUCTNAME "commercial")
+ SET (DEB_PRODUCTNAMEC "Commercial")
+ SET (DEB_NOTPRODUCTNAME "community")
+ SET (DEB_LICENSENAME "Advanced")
+ SET (DEB_INSTALL_LICENSEFILE "LICENSE.mysql")
+ SET (DEB_SERVERVERSION "${VERSION}+commercial-1")
+ SET (DEB_PLUGIN_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_INCLUDE_BINARIES_EXTRA
+"
+debian/extra/audit_log-plugin
+debian/extra/authentication_pam-plugin
+debian/extra/firewall-plugin
+debian/extra/openssl_udf-plugin
+debian/extra/thread_pool-plugin
+")
+ SET (DEB_INSTALL_SERVER_PLUGINS
+"
+usr/lib/mysql/plugin/audit_log.so
+usr/lib/mysql/plugin/authentication_pam.so
+usr/lib/mysql/plugin/openssl_udf.so
+usr/lib/mysql/plugin/thread_pool.so
+usr/lib/mysql/plugin/firewall.so
+usr/lib/mysql/plugin/debug/audit_log.so
+usr/lib/mysql/plugin/debug/authentication_pam.so
+usr/lib/mysql/plugin/debug/openssl_udf.so
+usr/lib/mysql/plugin/debug/thread_pool.so
+usr/lib/mysql/plugin/debug/firewall.so
+")
+ SET (DEB_REMOVEPATTERN "gpl.in")
+ELSE()
+ SET (DEB_PRODUCT "community")
+ SET (DEB_COPYRIGHT_UPSTREAMNAME "MySQL Server ${MYSQL_BASE_VERSION}")
+ SET (DEB_PRODUCTNAME "community")
+ SET (DEB_PRODUCTNAMEC "Community")
+ SET (DEB_NOTPRODUCTNAME "commercial")
+ SET (DEB_LICENSENAME "GPL")
+ SET (DEB_INSTALL_LICENSEFILE "COPYING")
+ SET (DEB_SERVERVERSION "${VERSION}-1")
+ SET (DEB_REMOVEPATTERN "com.in")
+ SET (DEB_PLUGIN_SETPERMISSION "usr/bin/mysql_setpermission")
+ENDIF()
+
+# Platform specifics. The differences are generally only distro version
+# and whether or not systemd and/or apparmor are available
+IF (DEB_CODENAME STREQUAL "wheezy")
+ SET (DEB_PLATFORMRELEASE "debian7")
+ SET (DEB_CONTROL_BDEPS "")
+ SET (DEB_INSTALL_SOURCE_XZ "")
+ SET (DEB_RULES_INSTALL_SYSTEMD "")
+ SET (DEB_RULES_INSTALL_APPARMOR "")
+ SET (DEB_RULES_APPARMOR_LOAD "")
+ SET (DEB_RULES_SYSTEMD_ENABLE "")
+ SET (DEB_RULES_SYSTEMD_START "")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "")
+ SET (DEB_INSTALL_SERVER_APPARMOR "")
+ SET (DEB_SERVICE_SERVER_EXECPRE "")
+ SET (DEB_INIT_APPARMOR "")
+ELSEIF(DEB_CODENAME STREQUAL "jessie")
+ SET (DEB_PLATFORMRELEASE "debian8")
+ SET (DEB_CONTROL_BDEPS "dh-systemd")
+ SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+ SET (DEB_RULES_INSTALL_SYSTEMD
+ "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+ SET (DEB_RULES_INSTALL_APPARMOR "")
+ SET (DEB_RULES_APPARMOR_LOAD "")
+ SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+ SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+ SET (DEB_INSTALL_SERVER_APPARMOR "")
+ SET (DEB_SERVICE_SERVER_EXECPRE
+ "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+ SET (DEB_INIT_APPARMOR "")
+ELSEIF(DEB_CODENAME STREQUAL "stretch")
+ SET (DEB_PLATFORMRELEASE "debian9")
+ SET (DEB_CONTROL_BDEPS "dh-systemd")
+ SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+ SET (DEB_RULES_INSTALL_SYSTEMD
+ "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+ SET (DEB_RULES_INSTALL_APPARMOR "")
+ SET (DEB_RULES_APPARMOR_LOAD "")
+ SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+ SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+ SET (DEB_INSTALL_SERVER_APPARMOR "")
+ SET (DEB_SERVICE_SERVER_EXECPRE
+ "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+ SET (DEB_INIT_APPARMOR "")
+ELSEIF(DEB_CODENAME STREQUAL "precise")
+ SET (DEB_PLATFORMRELEASE "ubuntu12.04")
+ SET (DEB_CONTROL_BDEPS "dh-apparmor")
+ SET (DEB_INSTALL_SOURCE_XZ "")
+ SET (DEB_RULES_INSTALL_SYSTEMD "")
+ SET (DEB_RULES_INSTALL_APPARMOR
+ "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_RULES_APPARMOR_LOAD
+ "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+ SET (DEB_RULES_SYSTEMD_ENABLE "")
+ SET (DEB_RULES_SYSTEMD_START "")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "")
+ SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_SERVICE_SERVER_EXECPRE "")
+ SET (DEB_INIT_APPARMOR "/lib/init/apparmor-profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "trusty")
+ SET (DEB_PLATFORMRELEASE "ubuntu14.04")
+ SET (DEB_CONTROL_BDEPS "dh-apparmor")
+ SET (DEB_INSTALL_SOURCE_XZ "")
+ SET (DEB_RULES_INSTALL_SYSTEMD "")
+ SET (DEB_RULES_INSTALL_APPARMOR
+ "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_RULES_APPARMOR_LOAD
+ "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+ SET (DEB_RULES_SYSTEMD_ENABLE "")
+ SET (DEB_RULES_SYSTEMD_START "")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "")
+ SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_SERVICE_SERVER_EXECPRE "")
+ SET (DEB_INIT_APPARMOR "/lib/init/apparmor-profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "wily")
+ SET (DEB_PLATFORMRELEASE "ubuntu15.10")
+ SET (DEB_CONTROL_BDEPS "dh-apparmor, dh-systemd (>=1.5)")
+ SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+ SET (DEB_RULES_INSTALL_SYSTEMD
+ "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+ SET (DEB_RULES_INSTALL_APPARMOR
+ "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_RULES_APPARMOR_LOAD
+ "dh_apparmor -pmysql-community-server --profile-name=usr.sbin.mysqld")
+ SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+ SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+ SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_SERVICE_SERVER_EXECPRE
+ "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+ SET (DEB_INIT_APPARMOR "/lib/init/apparmor-profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "xenial")
+ SET (DEB_PLATFORMRELEASE "ubuntu16.04")
+ SET (DEB_CONTROL_BDEPS "dh-apparmor, dh-systemd (>=1.5)")
+ SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+ SET (DEB_RULES_INSTALL_SYSTEMD
+ "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+ SET (DEB_RULES_INSTALL_APPARMOR
+ "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_RULES_APPARMOR_LOAD
+ "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+ SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+ SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+ SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_SERVICE_SERVER_EXECPRE
+ "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+ SET (DEB_INIT_APPARMOR "/lib/apparmor/profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "yakkety")
+ SET (DEB_PLATFORMRELEASE "ubuntu16.10")
+ SET (DEB_CONTROL_BDEPS "dh-apparmor, dh-systemd (>=1.5)")
+ SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+ SET (DEB_RULES_INSTALL_SYSTEMD
+ "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+ SET (DEB_RULES_INSTALL_APPARMOR
+ "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_RULES_APPARMOR_LOAD
+ "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+ SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+ SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+ SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_SERVICE_SERVER_EXECPRE
+ "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+ SET (DEB_INIT_APPARMOR "/lib/apparmor/profile-load usr.sbin.mysqld")
+ELSEIF(DEB_CODENAME STREQUAL "zesty")
+ SET (DEB_PLATFORMRELEASE "ubuntu17.04")
+ SET (DEB_CONTROL_BDEPS "dh-apparmor, dh-systemd (>=1.5)")
+ SET (DEB_INSTALL_SOURCE_XZ "../*.tar.xz usr/src/mysql/")
+ SET (DEB_RULES_INSTALL_SYSTEMD
+ "install -m 0755 debian/extra/mysql-systemd-start debian/tmp/usr/share/mysql/")
+ SET (DEB_RULES_INSTALL_APPARMOR
+ "install -g root -o root -m 0644 -D debian/extra/apparmor-profile debian/tmp/etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_RULES_APPARMOR_LOAD
+ "dh_apparmor -pmysql-${DEB_PRODUCTNAME}-server --profile-name=usr.sbin.mysqld")
+ SET (DEB_RULES_SYSTEMD_ENABLE "dh_systemd_enable --name=mysql")
+ SET (DEB_RULES_SYSTEMD_START "dh_systemd_start --restart-after-upgrade")
+ SET (DEB_INSTALL_SERVER_SYSTEMD "usr/share/mysql/mysql-systemd-start")
+ SET (DEB_INSTALL_SERVER_APPARMOR "etc/apparmor.d/usr.sbin.mysqld")
+ SET (DEB_SERVICE_SERVER_EXECPRE
+ "ExecStartPre=/usr/share/mysql/mysql-systemd-start pre")
+ SET (DEB_INIT_APPARMOR "/lib/apparmor/profile-load usr.sbin.mysqld")
+ELSE()
+ MESSAGE(STATUS
+ "Skipping deb packaging on unsupported platform ${DEB_CODENAME}.")
+ RETURN()
+ENDIF()
+
+# All files are configured and copied to the debian/ directory, which is used
+# by debuild to make the packages
+SET (DEB_ROOT ${CMAKE_SOURCE_DIR}/packaging/deb-in)
+FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian)
+FILE(GLOB_RECURSE SOURCEFILES RELATIVE "${DEB_ROOT}" "${DEB_ROOT}/*")
+# Skip the copyright file from the "other" product type
+LIST(REMOVE_ITEM SOURCEFILES "copyright.${DEB_REMOVEPATTERN}")
+LIST(REMOVE_ITEM SOURCEFILES "CMakeLists.txt")
+# Don't install systemd file on systems without systemd
+IF(DEB_INSTALL_SERVER_SYSTEMD STREQUAL "")
+ LIST(REMOVE_ITEM SOURCEFILES "mysql-packagesource-server.mysql.service.in")
+ENDIF()
+FOREACH (SOURCEFILE ${SOURCEFILES})
+ STRING(REGEX REPLACE "-packagesource-" "-${DEB_PRODUCTNAME}-"
+ TMPFILE ${SOURCEFILE})
+ # Strip away the input file endings from the destination filenames
+ STRING(REGEX REPLACE ".in$" "" TMPFILE ${TMPFILE})
+ STRING(REGEX REPLACE ".gpl$" "" TMPFILE ${TMPFILE})
+ STRING(REGEX REPLACE ".com$" "" DESTFILE ${TMPFILE})
+ CONFIGURE_FILE("${DEB_ROOT}/${SOURCEFILE}"
+ "${CMAKE_BINARY_DIR}/debian/${DESTFILE}" @ONLY)
+ENDFOREACH()
+EXECUTE_PROCESS(
+ COMMAND chmod +x ${CMAKE_BINARY_DIR}/debian/rules
+)
+
--- /dev/null
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+To override debian platform codename, specify DEB_CODENAME when building with cmake
--- /dev/null
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+TODO: Why /bin/bash for some files and /bin/sh for others (this is also the case in native packaging, so might be a reason)
+TODO: Related to above: Should be POSIX compliant
+TODO: Build with -DWITH_SYSTEMD and related to use inbuilt systemd support (Deb8 and Ubuntu15+)
+TODO: Maybe refactor CMakeLists.txt to remove redundancy
+TODO: Clean up install exception list so --list-missing can be changed to --fail-missing
--- /dev/null
+mysql-@DEB_PRODUCTNAME@ (@DEB_SERVERVERSION@@DEB_PLATFORMRELEASE@) @DEB_CODENAME@; urgency=low
+
+ [ Akhil Mohan ]
+ * new upstream release
+ * Added new libtest_* plugins to source/include-binaries, mysql-*-test.install
+ * added new plugin to source/include-binaries, mysql-*-test.install
+ libtest_framework
+ libtest_services
+ libtest_services_threaded
+ locking_service
+ test_security_context
+ version_token
+ * added support for MECAB in
+ d/{control,rules,mysql-*-server.install,source/include-binaries}
+ (Closes: #20315007)
+ * added automatic setup of ssl certs in
+ d/mysql-*-server.mysql.init
+ d/extra/mysql-systemd-start
+ (Closes: #20650118)
+ * removed pkg mysql-*-bench; sqlbench will not be packaged
+ (Closes: #21303289)
+ * removed cleanup statement for client lib symlinks *_r in d/rules
+ (Closes: #21311067)
+
+ [ Balasubramanian Kandasamy ]
+ * Added mysqlpump man page to d/mysql-*-client.install
+ * Added new decompression utilities lz4_decompress and zlib_decompress
+ binaries.
+ * Added mysqlx plugin
+
+ [ Lars Tangvald ]
+ * Added keyring directory and plugin
+
+ -- Balasubramanian Kandasamy <balasubramanian.kandasamy@oracle.com> Wed, 26 Aug 2015 15:20:12 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.7-rc-3ubuntu15.04) vivid; urgency=low
+
+ * new upstream release
+ * forked packaging source from utopic to vivid
+ * updated Standards-Version to 3.9.6 in d/control
+ * apparmor profile updated to allow read on all files under /etc/mysql
+ * added new conf files under d/extra/*.conf
+ * mysql_plugin moved from client to server pkg
+ * innochecksum moved from client to server pkg
+ * server pkg now replaces client pkg
+ * added systemd service profile and script
+ * new /etc/mysql/my.cnf management scheme added for Ubuntu 15.04
+ as discussed in Dec 2014 for native packaging source
+ * added dh "--with systemd" for enabling systemd
+ * mysql-common now conflicts with
+ mysql-server-5.6, mysql-server-core-5.6
+ mysql-client-5.6, mysql-client-core-5.6
+ * mysql-*-server no more provides
+ mysql-server-5.6, mysql-server-core-5.6
+ * mysql-*-client no more provides
+ mysql-client-5.6, mysql-client-core-5.6
+
+ -- Akhil Mohan <akhil.mohan@oracle.com> Mon, 15 Jun 2015 16:48:05 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.7-rc-2ubuntu15.04) vivid; urgency=low
+
+ * new upstream release
+ * forked packaging source from utopic to vivid
+
+ -- Akhil Mohan <akhil.mohan@oracle.com> Wed, 15 Apr 2015 20:27:33 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.7-rc-1ubuntu14.10) utopic; urgency=low
+
+ * new upstream release
+ * updated d/extra/my.cnf to remove option sql_mode
+ * non-essential tools, files and plugins have been moved to
+ mysql-@DEB_PRODUCTNAME@-test pkg.
+ mysql-@DEB_PRODUCTNAME@-test now replaces mysql-@DEB_PRODUCTNAME@-{server,client}
+ (Closes: #20546298)
+ (Closes: #20636865)
+ * mysql-@DEB_PRODUCTNAME@-test now depends on perl, python, libmysqlclient-dev
+ mysql-@DEB_PRODUCTNAME@-server now depends on psmisc
+ (Closes: #20561621)
+ * mysql-*-server.{mysql.init,postinst,templates} updated to deprecate
+ my_i_db and use msyqld --initialize-insecure to create system tables.
+ Now if user does not provide password or it is not possible to
+ receive password from user then UNIX socket authentication will be
+ enabled to secure the deployment by default.
+ mysql-@DEB_PRODUCTNAME@-server now depends on mysql-@DEB_PRODUCTNAME@-client
+ (Closes: #20613327)
+
+ -- Akhil Mohan <akhil.mohan@oracle.com> Fri, 27 Feb 2015 10:01:55 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.6-m16-1ubuntu14.10) utopic; urgency=low
+
+ * new upstream release
+ * init script will now run my_i_db if data dir is not present or empty
+ * forked packaging source from trusty and rebranded for utopic
+ * updated d/m-c-source.install to pack *.xz packaging source archive
+ * added more system resources to app armor profile
+ * dh_apparmor to now run before dh_installinit in d/rules
+ * libmysqlclient-dev now replaces mysql-client-{,core-}5.6
+ * mysql-@DEB_PRODUCTNAME@-server now recommends mysql-client
+ * mysql-@DEB_PRODUCTNAME@-server now depends on apparmor
+ * d/compat incremented to 9 from 8
+ * d/control updated to build depend on debhelper 9
+ * added d/*.lintian-overrides and d/source/lintian-overrides
+ * d/rules updated to reflect correct file permissions
+ * bumped up libmysqlclient version 18 => 20
+ * added new plugins to source/include-binaries
+ replication_observers_example
+ rewriter
+ rewrite_example
+ * new binary mysql_ssl_rsa_setup added to d/mysql-*-server.install
+ * provisioned handling of data files directory /var/lib/mysql-files
+ * cmake option to specify data dir in d/rules is now removed
+ as default path in cmake layout for DEB is now /var/lib/mysql
+
+ -- Akhil Mohan <akhil.mohan@oracle.com> Fri, 23 Jan 2015 19:59:33 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.5-m15-1ubuntu14.04) trusty; urgency=low
+
+ * new upstream release
+ * added fakeroot as build-dep in d/control
+ * added d/*.dirs for bench, dev and test pkg
+ * updated d/rules to make compilation verbose
+ * removed default CFLAGS, CXXFLAGS in d/rules
+ * removed extra whitespaces in d/*.postrm
+ * added CMake option to download boost if not available
+ * removed extra file modification steps in d/rules
+ * removed hotcopy, mysql_zap from d/mysql-@DEB_PRODUCTNAME@-server
+ * removed mysql_waitpid from d/mysql-@DEB_PRODUCTNAME@-client
+ * added patch for testsuite search paths under d/patches
+ * modified cmake option for testsuite in d/rules
+ * removed patch d/fix-mysql_install_db.patch
+ * enabled one patch in d/patches/series
+ * removed extra permissions check in d/rules when fixed in source
+ * modified d/mysql-*-server.postinst to stop removing /usr/my.cnf
+ * modified d/*-test.* for updated location of testsuite
+ * updated d/{mysql-*-server.install,rules} to include debug plugins
+ * updated d/rules to remove storage engine cmake options
+ * modified data dir permission in d/*server.{pre,post}inst
+ * updated d/source/include-binaries to add debug plugins
+ * updated d/rules to rename debug plugins
+ * updated d/source/include-binaries to add mysql_no_login.so
+ * updated d/rules to increment -j8 as make option
+ * updated CMake option WITH_EXTRA_CHARSETS from complex to all
+ * updated d/*-server.postinst to call m_i_db with --datadir --insecure
+ --mysqld-file
+ * updated d/*-server.postinst to remove manual creation mysql db dir
+ * removed test db prompt in d/*-server.{postinst,templates,config}
+ * updated app armor profile to allow access to socket lock file
+
+ -- Akhil Mohan <akhil.mohan@oracle.com> Fri, 08 Aug 2014 11:27:30 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.4-m14-2ubuntu14.04) trusty; urgency=low
+
+ * modified path for source tar in source pkg
+ * obscured actual filenames in d/source/include-binaries
+ * modified d/rules to handle obscured filenames
+
+ -- Akhil Mohan <akhil.mohan@oracle.com> Mon, 05 May 2014 15:45:10 +0530
+
+mysql-@DEB_PRODUCTNAME@ (5.7.4-m14-1ubuntu14.04) trusty; urgency=low
+
+ * new upstream release
+
+ -- Akhil Mohan <akhil.mohan@oracle.com> Fri, 28 Feb 2014 18:06:30 +0530
--- /dev/null
+Source: mysql-@DEB_PRODUCTNAME@
+Maintainer: MySQL Release Engineering <mysql-build@oss.oracle.com>
+Section: database
+Priority: optional
+Standards-Version: 3.9.6
+Homepage: http://www.mysql.com/
+Build-Depends: debhelper (>= 9.0.0), libaio-dev[linux-any], libncurses5-dev (>= 5.0-6), perl, zlib1g-dev (>= 1:1.1.3-5), po-debconf, psmisc, bison, lsb-release, cmake, fakeroot, libnuma-dev, @DEB_CONTROL_BDEPS@
+
+
+Package: mysql-server
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-server (= ${binary:Version}), ${misc:Depends}
+Description: MySQL Server meta package depending on latest version
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This is a meta package that depends on the latest mysql server
+ package available in the repository.
+
+Package: mysql-@DEB_PRODUCTNAME@-server
+Architecture: any
+Pre-depends: debconf (>= 0.2.17), adduser
+Depends: mysql-common (>= ${binary:Version}), mysql-client (= ${binary:Version}), perl, psmisc,
+ ${shlibs:Depends}, ${misc:Depends}
+Breaks: mysql-common (<< 5.6.36)
+Conflicts: mysql,
+ 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-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-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,
+ mysql-common (<< 5.6.36)
+Provides: virtual-mysql-server, virtual-mysql-server-core
+Description: MySQL Server
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package includes the MySQL server binary as well as related
+ utilities to run and administer a MySQL server.
+
+Package: mysql-client
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-client (= ${binary:Version}), ${misc:Depends}
+Description: MySQL Client meta package depending on latest version
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This is a meta package that depends on the latest mysql client
+ package available in the repository.
+
+Package: mysql-@DEB_PRODUCTNAME@-client
+Architecture: any
+Depends: mysql-common (>= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Breaks: mysql-common (<< 5.6.36), libmysqlclient-dev (<< 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-@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
+Replaces: 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-@DEB_NOTPRODUCTNAME@-client,
+ mysql-common (<< 5.6.36),
+ libmysqlclient-dev (<< 5.6.36)
+Provides: virtual-mysql-client, virtual-mysql-client-core
+Description: MySQL Client
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the standard MySQL clients and
+ administration tools.
+
+Package: libmysqlclient18
+Architecture: any
+Section: libs
+Pre-Depends: ${misc:Pre-Depends}
+Multi-Arch: same
+Depends: mysql-common (>= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Description: MySQL shared client libraries
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the shared libraries for MySQL client
+ applications.
+
+Package: mysql-common
+Architecture: any
+Pre-depends: debconf (>= 0.2.17), ${misc:Pre-Depends}
+Multi-Arch: foreign
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Conflicts: mysql, mysql-server-5.6, mysql-server-core-5.6,
+ mysql-client-5.6, mysql-client-core-5.6,
+ mysql-server-5.7, mysql-server-core-5.7,
+ mysql-client-5.7, mysql-client-core-5.7,
+ mariadb-server-5.5, percona-xtradb-cluster-common-5.5,
+ mysql-common (<< 5.6.36)
+Replaces: mysql, mysql-server-5.5, mysql-server-core-5.5, libmysqlclient-dev,
+ mysql-server-5.6, mysql-server-core-5.6,
+ mysql-server-5.7, mysql-server-core-5.7,
+ mariadb-server-5.5, percona-xtradb-cluster-common-5.5,
+ mysql-common (<< 5.6.36)
+Provides: mysql-common
+Description: MySQL Common
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains common files needed by MySQL client
+ library, MySQL database server, and MySQL embedded server.
+
+Package: libmysqlclient-dev
+Architecture: any
+Section: libdevel
+Depends: libmysqlclient18 (= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Replaces: mysql-client-5.6, mysql-client-core-5.6,
+ mysql-client-5.7, mysql-client-core-5.7
+Description: MySQL development headers
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the development header files necessary
+ to develop MySQL client applications.
+
+Package: libmysqld-dev
+Architecture: any
+Section: libdevel
+Depends: libmysqlclient-dev (= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Description: MySQL embedded server library
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the MySQL server as an embedded library.
+
+Package: mysql-testsuite
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-test (= ${binary:Version}), ${misc:Depends}
+Description: MySQL Testsuite meta package depending on latest version
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This is a meta package that depends on the latest mysql test
+ package available in the repository.
+
+Package: mysql-@DEB_PRODUCTNAME@-test
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-server (= ${binary:Version}),
+ mysql-@DEB_PRODUCTNAME@-client (= ${binary:Version}), python,
+ libmysqlclient-dev, ${shlibs:Depends}, ${misc:Depends}
+Breaks: mysql-@DEB_PRODUCTNAME@-server (<< 5.6.36),
+ mysql-@DEB_PRODUCTNAME@-client (<< 5.6.36)
+Conflicts: mysql,
+ mysql-testsuite-5.0, mysql-testsuite-5.1, mysql-testsuite-5.5,
+ mysql-testsuite-5.6, mysql-testsuite-5.7, mysql-@DEB_NOTPRODUCTNAME@-test,
+ mariadb-test, mariadb-test-data
+Description: MySQL Test Run MTR - The MySQL testsuite
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle. This package contains the MySQL regression test suite for MySQL
+ database server.
+
+Package: mysql-@DEB_PRODUCTNAME@-bench
+Architecture: any
+Depends: mysql-@DEB_PRODUCTNAME@-server (= ${binary:Version}),
+ ${shlibs:Depends}, ${misc:Depends}
+Conflicts: mysql, mysql-@DEB_NOTPRODUCTNAME@-bench
+Description: MySQL Bench
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle.
+
+Package: mysql-@DEB_PRODUCTNAME@-source
+Architecture: any
+Depends: ${misc:Depends}, ${shlibs:Depends}
+Description: MySQL source
+ The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
+ and robust SQL (Structured Query Language) database server. MySQL Server
+ is intended for mission-critical, heavy-load production systems as well
+ as for embedding into mass-deployed software. MySQL is a trademark of
+ Oracle.
--- /dev/null
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: @DEB_COPYRIGHT_UPSTREAMNAME@
+Upstream-Contact: MySQL Release Engineering <mysql-build@oss.oracle.com>
+Source: http://dev.mysql.com/
+
+Files: *
+Copyright: 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+License: Commercial
+ This is a release of MySQL, a dual-license SQL database server.
+ For the avoidance of doubt, this particular copy of the software
+ is released under a commercial license and the GNU General Public
+ License does not apply. MySQL is brought to you by Oracle.
+ .
+ This distribution may include materials developed by third
+ parties. For license and attribution notices for these
+ materials, please refer to the documentation that accompanies
+ this distribution (see the "Licenses for Third-Party Components"
+ appendix) or view the online documentation at
+ <http://dev.mysql.com/doc/>.
+ .
+ This software and related documentation are provided under a license
+ agreement containing restrictions on use and disclosure and are protected by
+ intellectual property laws. Except as expressly permitted in your license
+ agreement or allowed by law, you may not use, copy, reproduce, translate,
+ broadcast, modify, license, transmit, distribute, exhibit, perform, publish,
+ or display any part, in any form, or by any means. Reverse engineering,
+ disassembly, or decompilation of this software, unless required by law for
+ interoperability, is prohibited.
+ .
+ If this software or related documentation is delivered to the U.S.
+ Government or anyone licensing it on behalf of the U.S. Government, the
+ following notice is applicable:
+ .
+ U.S. GOVERNMENT RIGHTS Programs, software, databases, and related
+ documentation and technical data delivered to U.S. Government customers are
+ "commercial computer software" or "commercial technical data" pursuant to
+ the applicable Federal Acquisition Regulation and agency-specific
+ supplemental regulations. As such, the use, duplication, disclosure,
+ modification, and adaptation shall be subject to the restrictions and
+ license terms set forth in the applicable Government contract, and, to the
+ extent applicable by the terms of the Government contract, the additional
+ rights set forth in FAR 52.227-19, Commercial Computer Software License
+ (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA
+ 94065.
+ .
+ This software is developed for general use in a variety of information
+ management applications. It is not developed or intended for use in any
+ inherently dangerous applications, including applications which may create a
+ risk of personal injury. If you use this software in dangerous applications,
+ then you shall be responsible to take all appropriate fail-safe, backup,
+ redundancy, and other measures to ensure the safe use of this software.
+ Oracle Corporation and its affiliates disclaim any liability for any damages
+ caused by use of this software in dangerous applications.
+ .
+ Oracle is a registered trademark of Oracle Corporation and/or its
+ affiliates. Other names may be trademarks of their respective owners.
+ .
+ This software and documentation may provide access to or information on
+ content, products, and services from third parties. Oracle Corporation and
+ its affiliates are not responsible for and expressly disclaim all warranties
+ of any kind with respect to third-party content, products, and services.
+ Oracle Corporation and its affiliates will not be responsible for any loss,
+ costs, or damages incurred due to your access to or use of third-party
+ content, products, or services.
--- /dev/null
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: @DEB_COPYRIGHT_UPSTREAMNAME@
+Upstream-Contact: MySQL Release Engineering <mysql-build@oss.oracle.com>
+Source: http://dev.mysql.com/
+
+Copyright: 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+License:
+ This is a release of MySQL, a dual-license SQL database server.
+ For the avoidance of doubt, this particular copy of the software
+ is released under the version 2 of the GNU General Public License.
+ MySQL is brought to you by Oracle.
+ .
+ MySQL FOSS License Exception
+ We want free and open source software applications under certain
+ licenses to be able to use specified GPL-licensed MySQL client
+ libraries despite the fact that not all such FOSS licenses are
+ compatible with version 2 of the GNU General Public License.
+ Therefore there are special exceptions to the terms and conditions
+ of the GPLv2 as applied to these client libraries, which are
+ identified and described in more detail in the FOSS License
+ Exception at
+ <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
+ .
+ This distribution may include materials developed by third
+ parties. For license and attribution notices for these
+ materials, please refer to the documentation that accompanies
+ this distribution (see the "Licenses for Third-Party Components"
+ appendix) or view the online documentation at
+ <http://dev.mysql.com/doc/>.
+ .
+ GPLv2 Disclaimer
+ For the avoidance of doubt, except that if any license choice
+ other than GPL or LGPL is available it will apply instead,
+ Oracle elects to use only the General Public License version 2
+ (GPLv2) at this time for any software where a choice of GPL
+ license versions is made available with the language indicating
+ that GPLv2 or any later version may be used, or where a choice
+ .
+ The full text of the GNU General Public License version 2 can
+ be found in the file
+ `/usr/share/mysql/doc/@DEB_INSTALL_LICENSEFILE@'.
--- /dev/null
+#include <tunables/global>
+
+/usr/sbin/mysqld {
+ #include <abstractions/base>
+ #include <abstractions/nameservice>
+ #include <abstractions/user-tmp>
+ #include <abstractions/mysql>
+ #include <abstractions/winbind>
+
+# Allow system resource access
+ /sys/devices/system/cpu/ r,
+ /sys/devices/system/node/ r,
+ /sys/devices/system/node/** r,
+ /proc/*/status r,
+ capability sys_resource,
+ capability dac_override,
+ capability setuid,
+ capability setgid,
+
+# Allow network access
+ network tcp,
+
+ /etc/hosts.allow r,
+ /etc/hosts.deny r,
+
+# Allow config access
+ /etc/mysql/** r,
+
+# Allow pid, socket, socket lock file access
+ /var/run/mysqld/mysqld.pid rw,
+ /var/run/mysqld/mysqld.sock rw,
+ /var/run/mysqld/mysqld.sock.lock rw,
+ /run/mysqld/mysqld.pid rw,
+ /run/mysqld/mysqld.sock rw,
+ /run/mysqld/mysqld.sock.lock rw,
+
+# Allow execution of server binary
+ /usr/sbin/mysqld mr,
+ /usr/sbin/mysqld-debug mr,
+
+# Allow plugin access
+ /usr/lib/mysql/plugin/ r,
+ /usr/lib/mysql/plugin/*.so* mr,
+
+# Allow error msg and charset access
+ /usr/share/mysql/ r,
+ /usr/share/mysql/** r,
+
+# Allow data dir access
+ /var/lib/mysql/ r,
+ /var/lib/mysql/** rwk,
+
+# Allow data files dir access
+ /var/lib/mysql-files/ r,
+ /var/lib/mysql-files/** rwk,
+
+# Allow keyring dir access
+ /var/lib/mysql-keyring/ r,
+ /var/lib/mysql-keyring/** rwk,
+
+# Allow log file access
+ /var/log/mysql/ r,
+ /var/log/mysql/** rw,
+
+ # Site-specific additions and overrides. See local/README for details.
+ #include <local/usr.sbin.mysqld>
+}
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#
+# The MySQL @PRODUCTNAMEC@ Client configuration file.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+[mysql]
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#
+# The MySQL @DEB_PRODUCTNAMEC@ Server configuration file.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+# * IMPORTANT: Additional settings that can override those from this file!
+# The files must end with '.cnf', otherwise they'll be ignored.
+#
+!includedir /etc/mysql/conf.d/
--- /dev/null
+# 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, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Wait for server to start up (this requires the client package)
+pinger () {
+ while /bin/true ; do
+ sleep 1
+ mysqladmin ping >/dev/null 2>&1 && break
+ done
+}
+
+# To avoid having hardcoded paths in the script, we do a search on the path, as suggested at:
+# https://www.debian.org/doc/manuals/developers-reference/ch06.en.html#bpp-debian-maint-scripts
+pathfind() {
+ OLDIFS="$IFS"
+ IFS=:
+ for p in $PATH; do
+ if [ -x "$p/$*" ]; then
+ IFS="$OLDIFS"
+ return 0
+ fi
+ done
+ IFS="$OLDIFS"
+ return 1
+}
+
+# Fetch value from config files
+# Usage: get_mysql_option [section] [option] [default value]
+get_mysql_option() {
+ if pathfind my_print_defaults; then
+ RESULT=$(my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1)
+ fi
+ if [ -z "$RESULT" ]; then
+ RESULT="$3"
+ fi
+ echo $RESULT
+}
+
+# Check if server is running
+get_running () {
+ MYSQLDATA=$(get_mysql_option mysqld datadir "/var/lib/mysql")
+ PIDFILE=$(get_mysql_option mysqld_safe pid-file "")
+ if [ -z "$PIDFILE" ]; then
+ PIDFILE=$(get_mysql_option mysqld pid-file "$MYSQLDATA/$(hostname).pid")
+ fi
+ if [ -e "$PIDFILE" ] && [ -d "/proc/$(cat "$PIDFILE")" ]; then
+ echo 1
+ else
+ echo 0
+ fi
+}
+
+# Runs an arbitrary init sql file supplied in $1. Does not require login access
+run_init_sql() {
+ tmpdir=$(mktemp -d)
+ chown mysql:mysql "$tmpdir"
+ mysqld --bootstrap --user=mysql --socket="$tmpdir/mysqld.sock" --pid-file="$tmpdir/mysqld.pid" > /dev/null 2>&1 < "$1"
+ result=$?
+ rm -rf "$tmpdir"
+ return $result
+}
+
+# Verify that everything the server needs to run is set up
+verify_ready() {
+
+ MYSQLDATA=$(get_mysql_option mysqld datadir "/var/lib/mysql")
+ MYSQLFILES=$(get_mysql_option mysqld secure-file-priv "/var/lib/mysql-files")
+ MYSQLKEYRING=$(dirname $(get_mysql_option mysqld keyring-file-data "/var/lib/mysql-keyring/keyring"))
+ MYSQLLOG=$(dirname $(get_mysql_option mysqld log-error "/var/log/mysql/error.log"))
+ MYSQLRUN=/var/run/mysqld
+
+ if ! getent group mysql >/dev/null; then
+ addgroup --system mysql >/dev/null
+ fi
+
+ if ! getent passwd mysql >/dev/null; then
+ adduser --ingroup mysql --system --disabled-login --no-create-home --home ${MYSQLDATA} --shell /bin/false --gecos "MySQL Server" mysql >/dev/null
+ fi
+ ERROR_FLAG=0
+ if [ ! -d ${MYSQLDATA} -a ! -L ${MYSQLDATA} ]; then
+ if [ "$(dirname "${MYSQLDATA}")" = "/var/lib" ]; then
+ install -d -m0750 -omysql -gmysql ${MYSQLDATA}
+ else
+ echo "Error: Datadir ${MYSQLDATA} does not exist. For security reasons the service will not automatically create directories outside /var/lib.."
+ ERROR_FLAG=1
+ fi
+ fi
+
+ if [ ! -d ${MYSQLFILES} -a ! -L ${MYSQLFILES} ]; then
+ if [ "$(dirname "${MYSQLFILES}")" = "/var/lib" -o ${MYSQLFILES} = NULL ]; then
+ install -d -m0770 -omysql -gmysql ${MYSQLFILES}
+ else
+ echo "Error: Secure-file-priv dir ${MYSQLFILES} does not exist. For security reasons the service will not automatically create directories outside /var/lib."
+ ERROR_FLAG=1
+ fi
+ fi
+
+ if [ ! -d ${MYSQLKEYRING} -a ! -L ${MYSQLKEYRING} ]; then
+ if [ "$(dirname "${MYSQLKEYRING}")" = "/var/lib" ]; then
+ install -d -m0750 -omysql -gmysql ${MYSQLKEYRING}
+ else
+ echo "Warning: Keyring dir ${MYSQLKEYRING}Â does not exist. For security reasons the service will not automatically create directories outside /var/lib. The server may not start correctly."
+ fi
+ fi
+
+ if [ ! -d ${MYSQLLOG} -a ! -L ${MYSQLLOG} ]; then
+ if [ "$(dirname "${MYSQLLOG}")" = "/var/log" ]; then
+ install -d -m0750 -omysql -gadm ${MYSQLLOG}
+ install /dev/null -m0640 -omysql -gadm ${MYSQLLOG}/error.log
+ else
+ echo "Error: Log dir ${MYSQLLOG} does not exist. For security reasons the service will not automatically create directories outside /var/log."
+ ERROR_FLAG=1
+ fi
+ fi
+
+ if [ ${ERROR_FLAG} = 1 ]; then
+ echo "Errors found. Aborting."
+ exit 1
+ fi
+
+ if [ ! -d ${MYSQLRUN} -a ! -L ${MYSQLRUN} ]; then
+ install -d -m0755 -omysql -gmysql ${MYSQLRUN}
+ fi
+}
+
+# Verify the database exists and is ssl ready
+verify_database() {
+ MYSQLDATA=$(get_mysql_option mysqld datadir "/var/lib/mysql")
+ MYSQLFILES=$(get_mysql_option mysqld secure-file-priv "/var/lib/mysql-files")
+
+ if [ ! -d "${MYSQLDATA}/mysql" ] && [ -d "${MYSQLFILES}" ]; then
+ su - mysql -s /bin/bash -c "mysql_install_db --user=mysql > /dev/null"
+ fi
+
+ if [ -x /usr/bin/mysql_ssl_rsa_setup -a ! -e "${MYSQLDATA}/server-key.pem" ]; then
+ mysql_ssl_rsa_setup --datadir="${MYSQLDATA}" --uid=mysql >/dev/null 2>&1
+ fi
+}
+
+verify_server () {
+ TIMEOUT=0
+ if [ "${1}" = "start" ]; then
+ TIMEOUT=${STARTTIMEOUT}
+ elif [ "${1}" = "stop" ]; then
+ TIMEOUT=${STOPTIMEOUT}
+ fi
+
+ COUNT=0
+ while [ ${COUNT} -lt ${TIMEOUT} ];
+ do
+ COUNT=$(( COUNT+1 ))
+ echo -n .
+ if [ "${1}" = "start" ] && [ "$(get_running)" = 1 ]; then
+ if [ -z ${2} ]; then
+ echo
+ fi
+ return 0
+ fi
+ if [ "${1}" = "stop" ] && [ "$(get_running)" = 0 ]; then
+ if [ -z ${2} ]; then
+ echo
+ fi
+ return 0
+ fi
+ sleep 1
+ done
+ return 1
+}
+
--- /dev/null
+#!/bin/bash
+
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Scripts to run by MySQL systemd service
+#
+# Needed argument: pre
+#
+# pre mode : try to perform sanity check for configuration, log, data
+# post mode : ping server until answer is received
+
+# Include helper functions
+. /usr/share/mysql/mysql-helpers
+
+sanity () {
+# Make sure database and required directories exist
+ verify_ready
+ verify_database
+
+
+ @DEB_INIT_APPARMOR@
+
+ if [ ! -r /etc/mysql/my.cnf ]; then
+ echo "MySQL configuration not found at /etc/mysql/my.cnf. Please install one using update-alternatives."
+ exit 1
+ fi
+}
+
+case $1 in
+ "pre") sanity ;;
+ "post") pinger ;;
+esac
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#
+# The MySQL @PRODUCTNAMEC@ Server configuration file.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+# * IMPORTANT: Additional settings that can override those from this file!
+# The files must end with '.cnf', otherwise they'll be ignored.
+#
+!includedir /etc/mysql/conf.d/
+!includedir /etc/mysql/mysql.conf.d/
--- /dev/null
+.so man1/mysql.1
--- /dev/null
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#
+# The MySQL @PRODUCTNAMEC@ Server configuration file.
+#
+# For explanations see
+# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
+
+[mysqld]
+pid-file = /var/run/mysqld/mysqld.pid
+socket = /var/run/mysqld/mysqld.sock
+datadir = /var/lib/mysql
+log-error = /var/log/mysql/error.log
+# Disabling symbolic-links is recommended to prevent assorted security risks
+symbolic-links=0
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+usr/include/mysql/*.h
+usr/include/mysql/mysql/*.h
+usr/include/mysql/mysql/psi/*.h
+usr/lib/*/libmysqlclient.a
+usr/lib/*/libmysqlclient.so
+usr/lib/*/libmysqlservices.a
+usr/bin/mysql_config
+usr/share/man/man1/mysql_config.1
+usr/share/aclocal/mysql.m4
+# legal
+usr/share/doc/libmysqlclient-dev/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/libmysqlclient-dev/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+libmysqlclient-dev: extra-license-file usr/share/doc/libmysqlclient-dev/LICENSE.mysql
+libmysqlclient-dev: extra-license-file usr/share/doc/libmysqlclient-dev/@DEB_INSTALL_LICENSEFILE@.gz
+libmysqlclient-dev: copyright-should-refer-to-common-license-file-for-lgpl
+# Due to static linking this cannot be avoided and hence being overridden
+libmysqlclient-dev: embedded-library
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+usr/lib/*/libmysqlclient.so.18*
+# legal
+usr/share/doc/libmysqlclient18/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/libmysqlclient18/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+libmysqlclient18: extra-license-file usr/share/doc/libmysqlclient18/@DEB_INSTALL_LICENSEFILE@.gz
+libmysqlclient18: copyright-should-refer-to-common-license-file-for-lgpl
+# Due to static linking this cannot be avoided and hence being overridden
+libmysqlclient18: embedded-library
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+usr/lib/*/libmysqld.a
+usr/lib/*/libmysqld-debug.a
+# legal
+usr/share/doc/libmysqld-dev/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/libmysqld-dev/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+libmysqld-dev: extra-license-file usr/share/doc/libmysqld-dev/LICENSE.mysql
+libmysqld-dev: extra-license-file usr/share/doc/libmysqld-dev/@DEB_INSTALL_LICENSEFILE@.gz
+libmysqld-dev: copyright-should-refer-to-common-license-file-for-lgpl
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# legal
+usr/share/doc/mysql-client/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-client/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-client: extra-license-file usr/share/doc/mysql-client/LICENSE.mysql
+mysql-client: extra-license-file usr/share/doc/mysql-client/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-client: copyright-should-refer-to-common-license-file-for-lgpl
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+etc/mysql/conf.d
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# configuration file and script
+debian/extra/conf.d etc/mysql/
+debian/extra/my.cnf.fallback etc/mysql/
+
+usr/share/mysql/docs/ChangeLog
+usr/share/mysql/docs/INFO_SRC
+usr/share/mysql/docs/INFO_BIN
+# legal
+usr/share/doc/mysql-common/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-common/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-common: extra-license-file usr/share/doc/mysql-common/LICENSE.mysql
+mysql-common: extra-license-file usr/share/doc/mysql-common/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-common: copyright-should-refer-to-common-license-file-for-lgpl
--- /dev/null
+#!/bin/bash
+
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+set -e
+
+if [ "$1" = "configure" ]; then
+ # Low priority fallback for client use when no server is installed.
+ update-alternatives --install /etc/mysql/my.cnf my.cnf /etc/mysql/my.cnf.fallback 100
+fi
+
+#DEBHELPER#
--- /dev/null
+#!/bin/bash
+
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+set -e
+
+if [ "$1" = "purge" ]; then
+ rmdir /etc/mysql 2>/dev/null || true
+ update-alternatives --remove-all my.cnf
+fi
+
+#DEBHELPER#
--- /dev/null
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+usr/lib/mysql/sql-bench/*
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/README
--- /dev/null
+# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-bench: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-community-bench: copyright-should-refer-to-common-license-file-for-lgpl
--- /dev/null
+/usr/share/mysql/charsets/armscii8.xml
+/usr/share/mysql/charsets/ascii.xml
+/usr/share/mysql/charsets/cp1250.xml
+/usr/share/mysql/charsets/cp1251.xml
+/usr/share/mysql/charsets/cp1256.xml
+/usr/share/mysql/charsets/cp1257.xml
+/usr/share/mysql/charsets/cp850.xml
+/usr/share/mysql/charsets/cp852.xml
+/usr/share/mysql/charsets/cp866.xml
+/usr/share/mysql/charsets/dec8.xml
+/usr/share/mysql/charsets/geostd8.xml
+/usr/share/mysql/charsets/greek.xml
+/usr/share/mysql/charsets/hebrew.xml
+/usr/share/mysql/charsets/hp8.xml
+/usr/share/mysql/charsets/Index.xml
+/usr/share/mysql/charsets/keybcs2.xml
+/usr/share/mysql/charsets/koi8r.xml
+/usr/share/mysql/charsets/koi8u.xml
+/usr/share/mysql/charsets/latin1.xml
+/usr/share/mysql/charsets/latin2.xml
+/usr/share/mysql/charsets/latin5.xml
+/usr/share/mysql/charsets/latin7.xml
+/usr/share/mysql/charsets/macce.xml
+/usr/share/mysql/charsets/macroman.xml
+/usr/share/mysql/charsets/swe7.xml
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# binaries
+usr/bin/myisam_ftdump
+usr/bin/mysql
+usr/bin/mysql_config_editor
+usr/bin/mysql_embedded
+usr/bin/mysql_find_rows
+usr/bin/mysql_fix_extensions
+usr/bin/mysql_plugin
+usr/bin/mysql_waitpid
+usr/bin/mysqlaccess
+usr/bin/mysqlaccess.conf
+usr/bin/mysqladmin
+usr/bin/mysqlbug
+usr/bin/mysqlcheck
+usr/bin/mysqldump
+usr/bin/mysqldumpslow
+usr/bin/mysqlimport
+usr/bin/mysqlshow
+usr/bin/mysqlslap
+# charsets
+usr/share/mysql/charsets/*.xml
+usr/share/mysql/charsets/README
+# man pages
+usr/share/man/man1/myisam_ftdump.1
+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_plugin.1
+usr/share/man/man1/mysqlaccess.1
+usr/share/man/man1/mysqladmin.1
+usr/share/man/man1/mysqlcheck.1
+usr/share/man/man1/mysqldump.1
+usr/share/man/man1/mysqldumpslow.1
+usr/share/man/man1/mysqlimport.1
+usr/share/man/man1/mysqlman.1
+usr/share/man/man1/mysqlshow.1
+usr/share/man/man1/mysqlslap.1
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-client: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/LICENSE.mysql
+mysql-@DEB_PRODUCTNAME@-client: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-@DEB_PRODUCTNAME@-client: copyright-should-refer-to-common-license-file-for-lgpl
+# Due to static linking this cannot be avoided and hence being overridden
+mysql-@DEB_PRODUCTNAME@-client: embedded-library
--- /dev/null
+#!/bin/bash
+
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+. /usr/share/debconf/confmodule
+
+get_root_pass(){
+ while :; do
+ PASSWD=""
+ db_input high mysql-@DEB_PRODUCTNAME@-server/root-pass || true
+ db_go
+
+ db_get mysql-@DEB_PRODUCTNAME@-server/root-pass
+ if [ -z "${RET}" ];
+ then
+ db_fset mysql-@DEB_PRODUCTNAME@-server/root-pass seen true
+ db_fset mysql-@DEB_PRODUCTNAME@-server/re-root-pass seen true
+ break
+ fi
+ PASSWD="${RET}"
+
+ db_input high mysql-@DEB_PRODUCTNAME@-server/re-root-pass || true
+ db_go
+
+ db_get mysql-@DEB_PRODUCTNAME@-server/re-root-pass
+ if [ "${RET}" == "${PASSWD}" ];
+ then
+ PASSWD=""
+ break
+ fi
+
+ db_fset mysql-@DEB_PRODUCTNAME@-server/root-pass-mismatch seen false
+ db_input critical mysql-@DEB_PRODUCTNAME@-server/root-pass-mismatch
+ db_set mysql-@DEB_PRODUCTNAME@-server/root-pass ""
+ db_set mysql-@DEB_PRODUCTNAME@-server/re-root-pass ""
+ done
+}
+if [ "$1" = "configure" ] && [ -z "$2" ];
+then
+
+ set -e
+
+ PKG_LIST=mysql-server-5.5:mysql-server-5.6:mysql-server-5.7:mysql-community-server:mysql-commercial-server
+ INSTALLED_PKG=none
+ MYSQLDATA=/var/lib/mysql
+
+ IFS_BACKUP=${IFS}
+ IFS=":"
+ for PKG in ${PKG_LIST};
+ do
+ STATUS=$(dpkg -s ${PKG} 2> /dev/null | grep Status: | cut -d' ' -f4)
+ if [ "${STATUS}" = "installed" ];
+ then
+ INSTALLED_PKG=${PKG}
+ break
+ fi
+ done
+ IFS=${IFS_BACKUP}
+
+ if [ "${INSTALLED_PKG}" = "none" ];
+ then
+ if [ -d ${MYSQLDATA} -o -L ${MYSQLDATA} ];
+ then
+ db_input high mysql-@DEB_PRODUCTNAME@-server/data-dir || true
+ else
+ db_fset mysql-@DEB_PRODUCTNAME@-server/data-dir seen true
+ fi
+
+ get_root_pass
+
+ else
+ db_fset mysql-@DEB_PRODUCTNAME@-server/data-dir seen true
+ # If datadir is missing, ask for root password even with existing packages
+ if [ ! -d ${MYSQLDATA} -a ! -L ${MYSQLDATA} ];
+ then
+ get_root_pass
+ else
+ db_fset mysql-@DEB_PRODUCTNAME@-server/root-pass seen true
+ db_fset mysql-@DEB_PRODUCTNAME@-server/re-root-pass seen true
+ fi
+ fi
+
+ set +e
+fi
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+etc/mysql/mysql.conf.d
--- /dev/null
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# binaries
+usr/bin/innochecksum
+usr/bin/msql2mysql
+usr/bin/myisamchk
+usr/bin/myisamlog
+usr/bin/myisampack
+usr/bin/my_print_defaults
+usr/bin/mysql_convert_table_format
+usr/bin/mysql_install_db
+usr/bin/mysql_secure_installation
+@DEB_PLUGIN_SETPERMISSION@
+usr/bin/mysql_tzinfo_to_sql
+usr/bin/mysql_upgrade
+usr/bin/mysql_zap
+usr/bin/mysqld_multi
+usr/bin/mysqld_safe
+usr/bin/mysqlbinlog
+usr/bin/mysqlhotcopy
+usr/bin/perror
+usr/bin/replace
+usr/bin/resolveip
+usr/bin/resolve_stack_dump
+usr/sbin/mysqld
+# debug binary
+usr/sbin/mysqld-debug
+# man pages
+usr/share/man/man1/innochecksum.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_secure_installation.1
+usr/share/man/man1/mysql_tzinfo_to_sql.1
+usr/share/man/man1/mysql_upgrade.1
+usr/share/man/man1/mysqlbinlog.1
+usr/share/man/man1/mysqld_multi.1
+usr/share/man/man1/mysqld_safe.1
+usr/share/man/man1/perror.1
+usr/share/man/man1/replace.1
+usr/share/man/man1/resolveip.1
+usr/share/man/man1/resolve_stack_dump.1
+usr/share/man/man8/mysqld.8
+# confguration files
+usr/share/mysql/my-default.cnf
+debian/extra/mysql.cnf etc/mysql/
+debian/extra/mysqld.cnf /etc/mysql/mysql.conf.d/
+# app armor profile
+@DEB_INSTALL_SERVER_APPARMOR@
+# SQL files
+usr/share/mysql/*.sql
+# plugins
+usr/lib/mysql/plugin/adt_null.so
+usr/lib/mysql/plugin/auth_socket.so
+usr/lib/mysql/plugin/connection_control.so
+usr/lib/mysql/plugin/innodb_engine.so
+usr/lib/mysql/plugin/libmemcached.so
+usr/lib/mysql/plugin/mypluglib.so
+usr/lib/mysql/plugin/mysql_no_login.so
+usr/lib/mysql/plugin/semisync_master.so
+usr/lib/mysql/plugin/semisync_slave.so
+usr/lib/mysql/plugin/validate_password.so
+usr/lib/mysql/plugin/debug/adt_null.so
+usr/lib/mysql/plugin/debug/auth_socket.so
+usr/lib/mysql/plugin/debug/connection_control.so
+usr/lib/mysql/plugin/debug/innodb_engine.so
+usr/lib/mysql/plugin/debug/libmemcached.so
+usr/lib/mysql/plugin/debug/mypluglib.so
+usr/lib/mysql/plugin/debug/mysql_no_login.so
+usr/lib/mysql/plugin/debug/semisync_master.so
+usr/lib/mysql/plugin/debug/semisync_slave.so
+usr/lib/mysql/plugin/debug/validate_password.so
+@DEB_INSTALL_SERVER_PLUGINS@
+# support files
+usr/share/mysql/dictionary.txt
+usr/share/mysql/magic
+usr/share/mysql/mysql-log-rotate
+usr/share/mysql/mysql-helpers
+# localized error msgs
+usr/share/mysql/*/errmsg.sys
+usr/share/mysql/errmsg-utf8.txt
+@DEB_INSTALL_SERVER_SYSTEMD@
+usr/share/mysql/mysqld_multi.server
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-server: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/LICENSE.mysql
+mysql-@DEB_PRODUCTNAME@-server: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-@DEB_PRODUCTNAME@-server: copyright-should-refer-to-common-license-file-for-lgpl
+# Due to static linking this cannot be avoided and hence being overridden
+mysql-@DEB_PRODUCTNAME@-server: embedded-library
+# Since we ship debug plugins so this error is overridden
+mysql-@DEB_PRODUCTNAME@-server: unstripped-binary-or-object usr/lib/mysql/plugin/debug/*
--- /dev/null
+#!/bin/bash
+#
+### BEGIN INIT INFO
+# Provides: mysql
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Should-Start: $network $time
+# Should-Stop: $network $time
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start/ Stop MySQL @DEB_PRODUCTNAMEC@ Server daemon
+# Description: This service script facilitates startup and shutdown of
+# mysqld daemon throught its wrapper script mysqld_safe
+### END INIT INFO
+#
+
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+. /lib/lsb/init-functions
+. /usr/share/mysql/mysql-helpers
+cd /
+umask 077
+
+# In case server is taking more to start or stop increase the timeout here
+STARTTIMEOUT=180
+STOPTIMEOUT=60
+
+# We need to check that the binaries exist; When upgrading from community to commercial this
+# script will be run after community is removed but before commercial is installed
+VERSION="unknown"
+if pathfind mysqld; then
+ VERSION=$(mysqld --version | grep mysqld | cut -d' ' -f4)
+fi
+
+MYSQLRUN=/var/run/mysqld
+MYSQLDATA=$(get_mysql_option mysqld datadir "/var/lib/mysql")
+MYSQLFILES=/var/lib/mysql-files
+MYSQLKEYRING=/var/lib/mysql-keyring
+MYSQLLOG=/var/log/mysql
+
+case "$1" in
+ 'start')
+ if [ "$(get_running)" -eq 1 ];
+ then
+ log_action_msg "A MySQL Server is already started"
+ else
+ verify_ready
+ verify_database
+
+ @DEB_INIT_APPARMOR@
+
+ su - mysql -s /bin/bash -c "mysqld_safe > /dev/null &"
+ verify_server start
+ if [ "$?" -eq 0 ];
+ then
+ log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is started"
+ else
+ log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} did not start. Please check logs for more details."
+ fi
+ fi
+ ;;
+
+ 'stop')
+ if [ "$(get_running)" -eq 1 ];
+ then
+ killall -u mysql
+ verify_server stop
+ if [ "$?" -eq 0 ];
+ then
+ log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is stopped"
+ else
+ log_action_msg "Attempt to shutdown MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} timed out"
+ fi
+ else
+ log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is already stopped"
+ fi
+ ;;
+
+ 'restart'|'reload'|'force-reload')
+ log_action_msg "Stopping MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION}"
+ $0 stop
+ log_action_msg "Re-starting MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION}"
+ $0 start
+ ;;
+
+ 'status')
+ if [ "$(get_running)" -eq 1 ];
+ then
+ log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is running"
+ else
+ log_action_msg "MySQL @DEB_PRODUCTNAMEC@ Server ${VERSION} is not running"
+ exit 3
+ fi
+ ;;
+
+ *)
+ echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# MySQL systemd service file
+
+[Unit]
+Description=MySQL @DEB_PRODUCTNAMEC@ Server
+After=network.target
+
+[Install]
+WantedBy=multi-user.target
+
+[Service]
+User=mysql
+Group=mysql
+PermissionsStartOnly=true
+@DEB_SERVICE_SERVER_EXECPRE@
+ExecStart=/usr/bin/mysqld_safe
+ExecStartPost=/usr/share/mysql/mysql-systemd-start post
+TimeoutSec=600
+LimitNOFILE = 5000
+Restart=on-failure
--- /dev/null
+#!/bin/bash
+
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+. /usr/share/debconf/confmodule
+. /usr/share/mysql/mysql-helpers
+take_upstart_job_backup () {
+ if [ -e "/etc/init/mysql.conf" ] && [ -d "/var/lib/mysql" ];
+ then
+ mysql_install_db --user=mysql > /dev/null
+ mv /etc/init/mysql.conf /var/lib/mysql/.mysql.conf.backup
+ fi
+}
+
+invoke() {
+ if pathfind invoke-rc.d; then
+ invoke-rc.d mysql
+ else
+ /etc/init.d/mysql $1
+ fi
+}
+case "$1" in
+ configure)
+
+ if [ -z "$2" ];
+ then
+
+ set -e
+ # If the existing config file is a proper file, we back it up
+ if [ -f "/etc/mysql/my.cnf" ] && [ ! -L "/etc/mysql/my.cnf" ]; then
+ cp /etc/mysql/my.cnf /etc/mysql/my.cnf.bak
+ fi
+ update-alternatives --force --install /etc/mysql/my.cnf my.cnf "/etc/mysql/mysql.cnf" 200
+
+ verify_ready
+ MYSQLDATA=/var/lib/mysql
+ MYSQLFILES=/var/lib/mysql-files
+ if aa-status --enabled 2>/dev/null; then
+ apparmor_parser -r -T -W /etc/apparmor.d/usr.sbin.mysqld 2>/dev/null || true
+ fi
+ if [ ! "$(ls -A ${MYSQLDATA})" ] && [ -d ${MYSQLFILES} ];
+ then
+ db_get mysql-@DEB_PRODUCTNAME@-server/root-pass && PASSWD=${RET}
+ db_set mysql-@DEB_PRODUCTNAME@-server/root-pass ""
+ db_set mysql-@DEB_PRODUCTNAME@-server/re-root-pass ""
+ SQL=$(mktemp -u ${MYSQLFILES}/XXXXXXXXXX)
+ install /dev/null -m0600 -omysql -gmysql "${SQL}"
+ if [ ! -z "${PASSWD}" ];
+ then
+ PASSWD=$(printf %q "${PASSWD}")
+ cat << EOF > ${SQL}
+USE mysql;
+UPDATE user SET password=PASSWORD('${PASSWD}') WHERE user='root';
+DELETE FROM user WHERE user='';
+FLUSH PRIVILEGES;
+EOF
+ PASSWD=""
+ fi
+ mysql_install_db --user=mysql > /dev/null
+ run_init_sql "$SQL"
+ rm -f "$SQL"
+ fi
+
+ set +e
+
+ fi
+
+ ;;
+
+ abort-upgrade|abort-remove|abort-configure)
+
+ ;;
+
+ *)
+ exit 1
+ ;;
+esac
+
+db_stop
+
+take_upstart_job_backup
+
+#DEBHELPER#
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ];
+then
+. /usr/share/debconf/confmodule
+fi
+
+place_upstart_job_back () {
+ if [ -e "/var/lib/mysql/.mysql.conf.backup" ];
+ then
+ mv /var/lib/mysql/.mysql.conf.backup /etc/init/mysql.conf
+ fi
+}
+
+get_pcount () {
+ PSCOUNT=$(ps -ef | grep "/usr/sbin/mysqld" | wc -l)
+ echo "${PSCOUNT}"
+}
+
+server_stop () {
+ PSCOUNT=$(get_pcount)
+ COUNT=0
+ while :; do
+ COUNT=$(( COUNT+1 ))
+ echo -n .
+ if [ "${PSCOUNT}" -eq 1 ];
+ then
+ echo
+ break
+ fi
+ if [ "${COUNT}" -gt 15 ];
+ then
+ echo
+ return 1
+ fi
+ PSCOUNT=$(get_pcount)
+ sleep 1
+ done
+ return 0
+}
+
+case "$1" in
+ remove)
+
+ set -e
+
+ place_upstart_job_back
+ update-alternatives --remove my.cnf "/etc/mysql/mysql.cnf"
+
+ set +e
+
+ ;;
+
+ purge)
+
+ set -e
+
+ place_upstart_job_back
+
+ MYSQLDATA=/var/lib/mysql
+ MYSQLFILES=/var/lib/mysql-files
+ MYSQLKEYRING=/var/lib/mysql-keyring
+ MYSQLLOG=/var/log/mysql
+ MYSQLRUN=/var/run/mysqld
+
+ server_stop
+
+ db_input high mysql-@DEB_PRODUCTNAME@-server/remove-data-dir || true
+ db_go
+ db_get mysql-@DEB_PRODUCTNAME@-server/remove-data-dir && RMDATADIR=${RET}
+ if [ "${RMDATADIR}" = "true" ];
+ then
+ if [ -d ${MYSQLRUN} ] || [ -L ${MYSQLRUN} ];
+ then
+ rm -rf ${MYSQLRUN}
+ fi
+
+ if [ -d ${MYSQLLOG} ] || [ -L ${MYSQLLOG} ];
+ then
+ rm -rf ${MYSQLLOG}
+ fi
+
+ if [ -d ${MYSQLDATA} ] || [ -L ${MYSQLDATA} ];
+ then
+ rm -rf ${MYSQLDATA}
+ fi
+
+ if [ -d ${MYSQLFILES} ] || [ -L ${MYSQLFILES} ];
+ then
+ rm -rf ${MYSQLFILES}
+ fi
+
+ if [ -d ${MYSQLKEYRING} ] || [ -L ${MYSQLKEYRING} ];
+ then
+ rm -rf ${MYSQLKEYRING}
+ fi
+
+ if getent passwd mysql >/dev/null;
+ then
+ userdel mysql
+ fi
+ fi
+
+ set +e
+ ;;
+
+ abort-install)
+
+ set -e
+
+ place_upstart_job_back
+
+ if [ -x "/etc/init.d/mysql" ];
+ then
+ invoke-rc.d mysql start || exit $?
+ else
+ if [ -d ${MYSQLRUN} ] || [ -L ${MYSQLRUN} ];
+ then
+ rm -rf ${MYSQLRUN}
+ fi
+
+ if [ -d ${MYSQLLOG} ] || [ -L ${MYSQLLOG} ];
+ then
+ rm -rf ${MYSQLLOG}
+ fi
+
+ if [ -d ${MYSQLDATA} ] || [ -L ${MYSQLDATA} ];
+ then
+ rm -rf ${MYSQLDATA}
+ fi
+
+ if [ -d ${MYSQLFILES} ] || [ -L ${MYSQLFILES} ];
+ then
+ rm -rf ${MYSQLFILES}
+ fi
+
+ if getent passwd mysql >/dev/null;
+ then
+ userdel mysql
+ fi
+ fi
+
+ set +e
+ ;;
+
+ upgrade|abort-upgrade)
+
+ ;;
+
+ *)
+ exit 1
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+get_pcount () {
+ PSCOUNT=$(ps -ef | grep "/usr/sbin/mysqld" | wc -l)
+ echo "${PSCOUNT}"
+}
+
+server_stop () {
+ PSCOUNT=$(get_pcount)
+ COUNT=0
+ while :; do
+ COUNT=$(( COUNT+1 ))
+ echo -n .
+ if [ "${PSCOUNT}" -eq 1 ];
+ then
+ echo
+ break
+ fi
+ if [ "${COUNT}" -gt 15 ];
+ then
+ echo
+ return 1
+ fi
+ PSCOUNT=$(get_pcount)
+ sleep 1
+ done
+ return 0
+}
+
+case "$1" in
+ install)
+
+ if [ -z "$2" ];
+ then
+
+ set -e
+
+ if [ -x "/etc/init.d/mysql" ];
+ then
+ invoke-rc.d mysql stop || exit $?
+ server_stop
+ fi
+
+ set +e
+
+ fi
+
+ ;;
+
+ upgrade)
+
+ set -e
+
+ #DEBHELPER#
+ server_stop
+
+ set +e
+
+ ;;
+
+ abort-upgrade)
+
+ ;;
+
+ *)
+ exit 1
+ ;;
+esac
+
+exit 0
--- /dev/null
+#!/bin/bash
+
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+set -e
+
+#DEBHELPER#
+
+set +e
+
+exit 0
--- /dev/null
+Template: mysql-@DEB_PRODUCTNAME@-server/root-pass
+Type: password
+Description: Enter root password:
+ Please provide a strong password that will be set for the root account of your MySQL database.
+ Leave it blank to enable password less login using UNIX socket based authentication.
+
+Template: mysql-@DEB_PRODUCTNAME@-server/re-root-pass
+Type: password
+Description: Re-enter root password:
+ Now that you have selected a password for the root account, please confirm by typing it again. Do not share the password with anyone.
+
+Template: mysql-@DEB_PRODUCTNAME@-server/root-pass-mismatch
+Type: error
+Description: The two passwords did not match
+ Please try again. Make sure you type the exact same password twice.
+
+Template: mysql-@DEB_PRODUCTNAME@-server/remove-data-dir
+Type: boolean
+Default: false
+Description: Remove data directories ?
+ This operation will remove the data directory at '/var/lib/mysql' that stores all the databases, tables and related meta-data.
+ Additionally, any import or export files stored at '/var/lib/mysql-files' will be removed along with directory.
+ Finally, any files in '/var/lib/mysql-keyring' will be deleted.
+ It is highly recommended to take data backup before removing the data directories.
+
+Template: mysql-@DEB_PRODUCTNAME@-server/data-dir
+Type: note
+Description: Data directory found when no MySQL server package is installed
+ A data directory '/var/lib/mysql' is present on this system when no MySQL server
+ package is currently installed on the system. The directory may be under control of
+ server package received from third-party vendors. It may also be an unclaimed data
+ directory from previous removal of mysql packages.
+ .
+ It is highly recommended to take data backup. If you have not done so, now would be
+ the time to take backup in another shell. Once completed, press 'Ok' to continue.
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+../*.dsc usr/src/mysql/
+../*.tar.gz usr/src/mysql/
+@DEB_INSTALL_SOURCE_XZ@
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-source: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/LICENSE.mysql
+mysql-@DEB_PRODUCTNAME@-source: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-@DEB_PRODUCTNAME@-source: copyright-should-refer-to-common-license-file-for-lgpl
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# binaries
+usr/bin/mysql_client_test
+usr/bin/mysql_client_test_embedded
+usr/bin/mysqltest
+usr/bin/mysqltest_embedded
+# manpages
+usr/share/man/man1/mysql_client_test.1
+usr/share/man/man1/mysql_client_test_embedded.1
+usr/share/man/man1/mysql-test-run.pl.1
+usr/share/man/man1/mysqltest.1
+usr/share/man/man1/mysqltest_embedded.1
+# plugins
+usr/lib/mysql/plugin/auth.so
+usr/lib/mysql/plugin/auth_test_plugin.so
+usr/lib/mysql/plugin/daemon_example.ini
+usr/lib/mysql/plugin/libdaemon_example.so
+usr/lib/mysql/plugin/qa_auth_client.so
+usr/lib/mysql/plugin/qa_auth_interface.so
+usr/lib/mysql/plugin/qa_auth_server.so
+usr/lib/mysql/plugin/test_udf_services.so
+usr/lib/mysql/plugin/debug/auth.so
+usr/lib/mysql/plugin/debug/auth_test_plugin.so
+usr/lib/mysql/plugin/debug/daemon_example.ini
+usr/lib/mysql/plugin/debug/libdaemon_example.so
+usr/lib/mysql/plugin/debug/qa_auth_client.so
+usr/lib/mysql/plugin/debug/qa_auth_interface.so
+usr/lib/mysql/plugin/debug/qa_auth_server.so
+usr/lib/mysql/plugin/debug/test_udf_services.so
+# test suite
+usr/lib/mysql-test/*
+# legal
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+usr/lib/mysql-test/mysql-test-run.pl usr/lib/mysql-test/mysql-test-run
+usr/lib/mysql-test/mysql-test-run.pl usr/lib/mysql-test/mtr
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-@DEB_PRODUCTNAME@-test: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/LICENSE.mysql
+mysql-@DEB_PRODUCTNAME@-test: extra-license-file usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-@DEB_PRODUCTNAME@-test: copyright-should-refer-to-common-license-file-for-lgpl
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# legal
+usr/share/doc/mysql-server/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-server/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-server: extra-license-file usr/share/doc/mysql-server/LICENSE.mysql
+mysql-server: extra-license-file usr/share/doc/mysql-server/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-server: copyright-should-refer-to-common-license-file-for-lgpl
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# legal
+usr/share/doc/mysql-testsuite/@DEB_INSTALL_LICENSEFILE@
+usr/share/doc/mysql-testsuite/README
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Additional license file is needed so overriding this warning
+mysql-testsuite: extra-license-file usr/share/doc/mysql-testsuite/LICENSE.mysql
+mysql-testsuite: extra-license-file usr/share/doc/mysql-testsuite/@DEB_INSTALL_LICENSEFILE@.gz
+mysql-testsuite: copyright-should-refer-to-common-license-file-for-lgpl
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
--- /dev/null
+#!/usr/bin/make -f
+
+# 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
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+%:
+ dh $@
+
+export DH_VERBOSE=1
+export CFLAGS=
+export CXXFLAGS=
+
+override_dh_auto_configure:
+ @echo "RULES.$@"
+ cmake . \
+ -DBUILD_CONFIG=mysql_release \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DINSTALL_DOCDIR=share/mysql/docs \
+ -DINSTALL_DOCREADMEDIR=share/mysql \
+ -DINSTALL_INCLUDEDIR=include/mysql \
+ -DINSTALL_INFODIR=share/mysql/docs \
+ -DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
+ -DINSTALL_MANDIR=share/man \
+ -DINSTALL_MYSQLSHAREDIR=share/mysql \
+ -DINSTALL_MYSQLTESTDIR=lib/mysql-test \
+ -DINSTALL_PLUGINDIR=lib/mysql/plugin \
+ -DINSTALL_SBINDIR=sbin \
+ -DINSTALL_SCRIPTDIR=bin \
+ -DINSTALL_SQLBENCHDIR=lib/mysql \
+ -DINSTALL_SUPPORTFILESDIR=share/mysql \
+ -DSYSCONFDIR=/etc/mysql \
+ -DMYSQL_UNIX_ADDR=/var/run/mysqld/mysqld.sock \
+ -DWITH_SSL=bundled \
+ -DWITH_INNODB_MEMCACHED=1 \
+ -DWITH_MECAB=system \
+ -DCOMPILATION_COMMENT="MySQL @DEB_PRODUCTNAMEC@ Server (@DEB_LICENSENAME@)" \
+ -DINSTALL_LAYOUT=DEB \
+ -DDEB_PRODUCT=@DEB_PRODUCT@ \
+ @DEB_CMAKE_EXTRAS@
+ touch $@
+
+override_dh_auto_build:
+ @echo "RULES.$@"
+ $(MAKE) -j8 VERBOSE=1
+ touch $@
+
+override_dh_auto_test:
+ @echo "RULES.$@"
+ touch $@
+
+override_dh_auto_install:
+
+ @echo "RULES.$@"
+ # complete install first
+ $(MAKE) install DESTDIR=debian/tmp
+ # remove all redundant files
+ rm debian/tmp/usr/lib/*/*_r*
+ rm debian/tmp/usr/lib/mysql-test/cmake_install.cmake
+ rm debian/tmp/usr/lib/mysql-test/CTestTestfile.cmake
+ rm debian/tmp/usr/lib/mysql-test/Makefile
+ # add missing man pages
+ install -g root -o root -m 0644 debian/extra/mysql_embedded.1 debian/tmp/usr/share/man/man1
+ # add MySQL Server debug binary and library to package
+ install -g root -o root -m 0755 debian/extra/server-binary debian/tmp/usr/sbin/mysqld-debug
+ install -g root -o root -m 0755 debian/extra/embedded-server debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libmysqld-debug.a
+ # add debug plugin libraries to package
+ install -g root -o root -m 0755 -d debian/tmp/usr/lib/mysql/plugin/debug
+ for file in debian/extra/*-plugin; do NEW=`echo $$file | cut -d- -f1`; mv $$file $$NEW.so; done
+ install -g root -o root -m 0755 debian/extra/*.so debian/tmp/usr/lib/mysql/plugin/debug
+ install -g root -o root -m 0755 debian/extra/daemon_example.ini debian/tmp/usr/lib/mysql/plugin/debug
+ # Add helper functions for maintainer scripts
+ install -m 0644 debian/extra/mysql-helpers debian/tmp/usr/share/mysql/
+ # add apparmor profile
+ @DEB_RULES_INSTALL_APPARMOR@
+ # add systemd script
+ @DEB_RULES_INSTALL_SYSTEMD@
+ # add directory for legal docs
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-server
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-server
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-client
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-client
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-common
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/libmysqlclient18
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/libmysqlclient-dev
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/libmysqld-dev
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-testsuite
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-test
+ install -g root -o root -m 0755 -d debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-source
+ # add @DEB_INSTALL_LICENSEFILE@ file to each package
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-server/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-client/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-common/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/libmysqlclient18/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/libmysqlclient-dev/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/libmysqld-dev/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-testsuite/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/@DEB_INSTALL_LICENSEFILE@
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/@DEB_INSTALL_LICENSEFILE@ debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/@DEB_INSTALL_LICENSEFILE@
+ # add README file to each package
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-server/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-server/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-client/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-client/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-common/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/libmysqlclient18/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/libmysqlclient-dev/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/libmysqld-dev/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-bench/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-testsuite/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-test/README
+ install -g root -o root -m 0644 debian/tmp/usr/share/mysql/README debian/tmp/usr/share/doc/mysql-@DEB_PRODUCTNAME@-source/README
+ touch $@
+
+override_dh_installinit:
+ @echo "RULES.$@"
+ @DEB_RULES_APPARMOR_LOAD@
+ @DEB_RULES_SYSTEMD_ENABLE@
+ dh_installinit --name=mysql -- defaults 19 21
+ @DEB_RULES_SYSTEMD_START@
+ 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
--- /dev/null
+3.0 (quilt)
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# obscured filename for mysqld-debug, libmysqld-debug.a
+debian/extra/server-binary
+debian/extra/embedded-server
+# obscured filenames for debug plugins
+debian/extra/adt_null-plugin
+debian/extra/auth-plugin
+debian/extra/auth_socket-plugin
+debian/extra/auth_test_plugin-plugin
+debian/extra/component_example_component1-plugin
+debian/extra/component_example_component2-plugin
+debian/extra/component_example_component3-plugin
+debian/extra/connection_control-plugin
+debian/extra/ha_example-plugin
+debian/extra/innodb_engine-plugin
+debian/extra/keyring_file-plugin
+debian/extra/keyring_udf-plugin
+debian/extra/libdaemon_example-plugin
+debian/extra/libmemcached-plugin
+debian/extra/libpluginmecab-plugin
+debian/extra/libtest_framework-plugin
+debian/extra/libtest_services-plugin
+debian/extra/libtest_services_threaded-plugin
+debian/extra/libtest_session_detach-plugin
+debian/extra/libtest_session_info-plugin
+debian/extra/libtest_session_in_thd-plugin
+debian/extra/libtest_sql_2_sessions-plugin
+debian/extra/libtest_sql_all_col_types-plugin
+debian/extra/libtest_sql_cmds_1-plugin
+debian/extra/libtest_sql_commit-plugin
+debian/extra/libtest_sql_complex-plugin
+debian/extra/libtest_sql_errors-plugin
+debian/extra/libtest_sql_lock-plugin
+debian/extra/libtest_sql_processlist-plugin
+debian/extra/libtest_sql_replication-plugin
+debian/extra/libtest_sql_shutdown-plugin
+debian/extra/libtest_sql_sqlmode-plugin
+debian/extra/libtest_sql_stored_procedures_functions-plugin
+debian/extra/libtest_sql_views_triggers-plugin
+debian/extra/libtest_x_sessions_deinit-plugin
+debian/extra/libtest_x_sessions_init-plugin
+debian/extra/locking_service-plugin
+debian/extra/mypluglib-plugin
+debian/extra/mysql_no_login-plugin
+debian/extra/mysqlx-plugin
+debian/extra/qa_auth_client-plugin
+debian/extra/qa_auth_interface-plugin
+debian/extra/qa_auth_server-plugin
+debian/extra/replication_observers_example_plugin-plugin
+debian/extra/rewriter-plugin
+debian/extra/rewrite_example-plugin
+debian/extra/semisync_master-plugin
+debian/extra/semisync_slave-plugin
+debian/extra/test_udf_services-plugin
+debian/extra/test_security_context-plugin
+debian/extra/test_services_plugin_registry-plugin
+debian/extra/validate_password-plugin
+debian/extra/version_token-plugin
+@DEB_INCLUDE_BINARIES_EXTRA@
--- /dev/null
+# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# We provide our own versioning scheme so this warning is overridden
+mysql-@DEB_PRODUCTNAME@ source: changelog-should-mention-nmu
+mysql-@DEB_PRODUCTNAME@ source: source-nmu-has-incorrect-version-number
--- /dev/null
+version=3
+https://cdn.mysql.com/Downloads/MySQL-@MYSQL_BASE_VERSION@//mysql-([\d.]+).tar.gz
-# 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
Requires: mysql-community-common%{?_isa} = %{version}-%{release}
%endif
Obsoletes: mariadb-server
+Obsoletes: mariadb-server-utils
Obsoletes: mariadb-galera-server
Obsoletes: mariadb-server-galera
Obsoletes: community-mysql-server < %{version}-%{release}
STARTTIMEOUT=120
STOPTIMEOUT=60
+# Set in /etc/sysconfig/mysqld, will be passed to mysqld_safe
+MYSQLD_OPTS=
+
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
lockfile=/var/lock/subsys/$prog
-# extract value of a MySQL option from config files
-# Usage: get_mysql_option SECTION VARNAME DEFAULT
-# result is returned in $result
+# Extract value of a MySQL option from config files
+# Usage: get_mysql_option OPTION DEFAULT SECTION1 SECTION2 SECTIONN
+# Result is returned in $result
# We use my_print_defaults which prints all options from multiple files,
# with the more specific ones later; hence take the last match.
-get_mysql_option(){
- result=$(/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1)
- if [ -z "$result" ]; then
- # not found, use default
- result="$3"
- fi
+get_mysql_option () {
+ option=$1
+ default=$2
+ shift 2
+ result=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
+ if [ -z "$result" ]; then
+ # not found, use default
+ result="${default}"
+ fi
}
-get_mysql_option mysqld datadir "/var/lib/mysql"
+get_mysql_option datadir "/var/lib/mysql" mysqld
datadir="$result"
-get_mysql_option mysqld socket "$datadir/mysql.sock"
+get_mysql_option socket "$datadir/mysql.sock" mysqld
socketfile="$result"
-get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
+get_mysql_option log-error "/var/log/mysqld.log" mysqld mysqld_safe
errlogfile="$result"
-get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
+get_mysql_option pid-file "/var/run/mysqld/mysqld.pid" mysqld mysqld_safe
mypidfile="$result"
case $socketfile in
# and some users might prefer to configure logging to syslog.)
# Note: set --basedir to prevent probes that might trigger SELinux
# alarms, per bug #547485
- $exec --datadir="$datadir" --socket="$socketfile" \
+ $exec $MYSQLD_OPTS --datadir="$datadir" --socket="$socketfile" \
--pid-file="$mypidfile" \
--basedir=/usr --user=mysql >/dev/null &
safe_pid=$!
lockfile=/var/lock/subsys/mysql
get_option () {
- local section=$1
- local option=$2
- local default=$3
- ret=$(/usr/bin/my_print_defaults $section | grep '^--'${option}'=' | cut -d= -f2- | tail -n 1)
- [ -z $ret ] && ret=$default
+ local option=$1
+ local default=$2
+ shift 2
+ ret=$(/usr/bin/my_print_defaults "$@" | sed -n "s/^--${option}=//p" | tail -n 1)
+ [ -z $ret ] && ret=${default}
echo $ret
}
-datadir=$(get_option mysqld datadir "/var/lib/mysql")
-socket=$(get_option mysqld socket "$datadir/mysql.sock")
-pidfile=$(get_option mysqld_safe pid-file "/var/run/mysql/mysqld.pid")
+datadir=$(get_option datadir "/var/lib/mysql" mysqld)
+socket=$(get_option socket "$datadir/mysql.sock" mysqld)
+pidfile=$(get_option pid-file "/var/run/mysql/mysqld.pid" mysqld mysqld_safe)
install_db () {
# Note: something different than datadir=/var/lib/mysql requires
# SELinux policy changes (in enforcing mode)
- datadir=$(get_option mysqld datadir "/var/lib/mysql")
- logfile=$(get_option mysqld_safe log-error "/var/log/mysql/mysqld.log")
+ datadir=$(get_option datadir "/var/lib/mysql" mysqld)
+ logfile=$(get_option log-error "/var/log/mysql/mysqld.log" mysqld mysqld_safe)
# Restore log, dir, perms and SELinux contexts
if [ ! -d "$datadir" -a ! -h "$datadir" -a "x$(dirname "$datadir")" = "x/var/lib" ]; then
connection_control.cc
security_context_wrapper.cc
connection_delay.cc
- MODULE_ONLY)
+ MODULE_ONLY)
For connection event, notify Connection_event_coordinator
which in turn will notify subscribers.
- @param thd [in] Handle to THD
- @param event_class [in] Event class.
+ @param [in] thd Handle to THD
+ @param [in] event_class Event class.
We are interested in MYSQL_AUDIT_CONNECTION_CLASS.
- @param event [in] mysql_event_connection handle
+ @param [in] event mysql_event_connection handle
*/
static void
/**
Plugin initialization function
- @param plugin_info [in] MYSQL_PLUGIN information
+ @param [in] plugin_info MYSQL_PLUGIN information
@returns initialization status
@retval 0 Success
2. Set of variables for which subscriber would like to receive update
3. Set of stats for which subscriber would like to send update
- @param subscriber [in] Handle to Connection_event_observers
- @param events [in] Event mask supplied by subscriber
- @param sys_vars [in] opt_connection_control vector
- @param status_vars [in] stats_connection_control vector
+ @param [in] subscriber Handle to Connection_event_observers
+ @param [in] events Event mask supplied by subscriber
+ @param [in] sys_vars opt_connection_control vector
+ @param [in] status_vars stats_connection_control vector
@returns subscription status
@retval false Subscription successful
Note : If we receive error from a subscriber, we log it and move on.
- @param thd [in] THD handle
- @param error_handler [in] Error handler class
- @param connection_event [in] Event information
+ @param [in] thd THD handle
+ @param [in] error_handler Error handler class
+ @param [in] connection_event Event information
*/
void
Note : If we receive error from a subscriber, we log it and move on.
- @param error_hanlder [in] Error handler class
- @param opt_connection_control Variable information
- @param new_value [in] New value for variable
+ @param [in] error_hanlder Error handler class
+ @param [in] opt_connection_control Variable information
+ @param [in] new_value New value for variable
*/
void
/**
Update a status variable
- @param observer [in] Requestor
- @param status_var [in] Status variable to be updated
- @param action [in] Operation to be performed on status variable
+ @param [in] observer Requestor
+ @param [in] status_var Status variable to be updated
+ @param [in] action Operation to be performed on status variable
@returns status of the operation
@retval false Success
/** variables used by connection_delay.cc */
static mysql_rwlock_t connection_event_delay_lock;
+
+#ifdef HAVE_PSI_INTERFACE
static PSI_rwlock_key key_connection_event_delay_lock;
static PSI_rwlock_info all_rwlocks[]=
{
{&key_connection_event_delay_lock, "connection_event_delay_lock", 0}
};
+#endif /* HAVE_PSI_INTERFACE */
static opt_connection_control opt_enums[]=
{
/**
Helper function for Connection_delay_event::reset_all
- @param ptr [in] Pointer to an entry in hash
+ @param [in] ptr Pointer to an entry in hash
@returns 1 to indicate that entry is a match
*/
fed to an internal calc_hash() which use the defined charset to
calculate a hash from the key buffer (in most cases a murmur)
- @param el [in] Pointer to an element in the hash
- @param length [out] The length of the key belonging to the element
+ @param [in] el Pointer to an element in the hash
+ @param [out] length The length of the key belonging to the element
@returns Pointer to key buffer
*/
/**
Creates or updates an entry in hash
- @param s [in] User information in '<user'@'<host>' format
+ @param [in] s User information in '<user'@'<host>' format
@returns status of insertion/update
@retval false Insertion/Update successful
/**
Resets count stored against given user entry
- @param s [in] User information in '<user'@'<host>' format
+ @param [in] s User information in '<user'@'<host>' format
@returns status of reset operation
@retval false Reset successful
/**
Retrieve stored value for given user entry
- @param s [in] User information in '<user'@'<host>' format
+ @param [in] s User information in '<user'@'<host>' format
@param value [out] Buffer to hold value stored against given user
@returns whether given entry is present in hash or not
/**
Function to populate information_schema view.
- @param ptr [in] Entry from LF hash
+ @param [in] ptr Entry from LF hash
@returns status of row insertion
@retval 0 Success
/**
Function to dump LF hash data to IS table.
- @param thd [in] THD handle
- @param tables [in] Handle to
+ @param [in] thd THD handle
+ @param [in] tables Handle to
information_schema.connection_control_failed_attempts
*/
2. Use priv_user/priv_host if either of them is not empty. Else,
3. Use user/host
- @param thd [in] THD pointer for getting security context
- @param s [out] Hash key is stored here
+ @param [in] thd THD pointer for getting security context
+ @param [out] s Hash key is stored here
*/
void
/**
Wait till the wait_time expires or thread is killed
- @param thd [in] Handle to MYSQL_THD object
- @param wait_time [in] Maximum time to wait
+ @param [in] thd Handle to MYSQL_THD object
+ @param [in] wait_time Maximum time to wait
*/
void
ulonglong wait_time)
{
DBUG_ENTER("Connection_delay_action::conditional_wait");
- const char * category= "connection_delay";
/** mysql_cond_timedwait requires wait time in timespec format */
struct timespec abstime;
/** Initialize mutex required for mysql_cond_timedwait */
mysql_mutex_t connection_delay_mutex;
+#ifdef HAVE_PSI_INTERFACE
+ const char * category= "conn_delay";
PSI_mutex_key key_connection_delay_mutex;
PSI_mutex_info connection_delay_mutex_info[]=
{
};
int count_mutex= array_elements(connection_delay_mutex_info);
PSI_server->register_mutex(category, connection_delay_mutex_info, count_mutex);
+#endif /* HAVE_PSI_INTERFACE */
mysql_mutex_init(key_connection_delay_mutex, &connection_delay_mutex,
MY_MUTEX_INIT_FAST);
/* Initialize condition to wait for */
mysql_cond_t connection_delay_wait_condition;
+#ifdef HAVE_PSI_INTERFACE
PSI_cond_key key_connection_delay_wait;
PSI_cond_info connection_delay_wait_info[]=
{
};
int count_cond= array_elements(connection_delay_wait_info);
PSI_server->register_cond(category, connection_delay_wait_info, count_cond);
+#endif /* HAVE_PSI_INTERFACE */
mysql_cond_init(key_connection_delay_wait, &connection_delay_wait_condition, NULL);
/** Register wait condition with THD */
We only care about CONNECT and CHANGE_USER sub events.
- @param thd [in] THD pointer
- @param coordinator [in] Connection_event_coordinator
- @param connection_event [in] Connection event to be handled
- @param error_handler [in] Error handler object
+ @param [in] thd THD pointer
+ @param [in] coordinator Connection_event_coordinator
+ @param [in] connection_event Connection event to be handled
+ @param [in] error_handler Error handler object
@returns status of connection event handling
@retval false Successfully handled an event.
/**
Notification of a change in system variable value
- @param coordinator [in] Handle to coordinator
- @param variable [in] Enum of variable
- @param new_value [in] New value for variable
- @param error_buffer [out] Buffer to log error message if any
- @param error_buffer_size [in] Size of error buffer
+ @param [in] coordinator Handle to coordinator
+ @param [in] variable Enum of variable
+ @param [in] new_value New value for variable
+ @param [out] error_buffer Buffer to log error message if any
+ @param [in] error_buffer_size Size of error buffer
@returns processing status
@retval false Change in variable value processed successfully
/**
Subscribe with coordinator for connection events
- @param coordinator [in] Handle to Connection_event_coordinator_services
+ @param [in] coordinator Handle to Connection_event_coordinator_services
for registration
*/
void
/**
Get user information from "where userhost = <value>"
- @param cond [in] Equality condition structure
- @param eq_arg [out] Sql_string handle to store user information
- @param field_name [in] userhost field
+ @param [in] cond Equality condition structure
+ @param [out] eq_arg Sql_string handle to store user information
+ @param [in] field_name userhost field
@returns whether a value was found or not
@retval false Found a value. Check eq_arg
Permission : SUPER_ACL is required.
- @param thd [in] THD handle.
- @param tables [in] Handle to
+ @param [in] thd THD handle.
+ @param [in] tables Handle to
information_schema.connection_control_failed_attempts.
- @param cond [in] Condition if any.
+ @param [in] cond Condition if any.
*/
void
/**
Initializes required objects for handling connection events.
- @param coordinator [in] Connection_event_coordinator_services handle.
+ @param [in] coordinator Connection_event_coordinator_services handle.
*/
bool init_connection_delay_event(Connection_event_coordinator_services *coordinator,
/*
1. Initialize lock(s)
*/
+#ifdef HAVE_PSI_INTERFACE
const char *category= "conn_control";
int count= array_elements(all_rwlocks);
mysql_rwlock_register(category, all_rwlocks, count);
+#endif /* HAVE_PSI_INTERFACE */
mysql_rwlock_init(key_connection_event_delay_lock,
&connection_event_delay_lock);
g_max_failed_connection_handler= new Connection_delay_action(g_variables.failed_connections_threshold,
/**
Function to fill information_schema.connection_control_failed_attempts.
- @param thd [in] THD handle.
- @param tables [in] Handle to
+ @param [in] thd THD handle.
+ @param [in] tables Handle to
information_schema.connection_control_failed_attempts.
- @param cond [in] Condition if any.
+ @param [in] cond Condition if any.
@returns Always returns FALSE.
*/
/**
View init function
- @param ptr [in] Handle to
+ @param [in] ptr Handle to
information_schema.connection_control_failed_attempts.
@returns Always returns 0.
/**
Security_context_wrapper constructor.
- @param thd [in] Handle to THD
+ @param [in] thd Handle to THD
Get security context from thd.
*/
/**
Get value for given property from security context
- @param property [in] Property to be checked
- @param value [out] Value of the property
+ @param [in] property Property to be checked
+ @param [out] value Value of the property
@returns status of property check
@retval true Error fetching property value
/* binlog is running, make the thread
attach to conn_data->thd for binlog
committing */
- if (thd) {
+ if (thd && conn_data->thd) {
handler_thd_attach(
conn_data->thd, NULL);
}
assert(OP(p->strip[p->pbegin[i]]) == OLPAREN);
assert(OP(p->strip[p->pend[i]]) == ORPAREN);
(void) dupl(p, p->pbegin[i]+1, p->pend[i]);
+ if (p->error != 0)
+ break; /* purecov: inspected */
EMIT(O_BACK, i);
} else
SETERROR(MY_REG_ESUBREG);
AHEAD(THERE()); /* ...so fix it */
ASTERN(O_CH, THERETHERE());
copy = dupl(p, start+1, finish+1);
+ if (p->error != 0)
+ return; /* purecov: inspected */
assert(copy == finish+4);
repeat(p, copy, 1, to-1);
break;
break;
case REP(N, N): /* as xx{m-1,n-1} */
copy = dupl(p, start, finish);
+ if (p->error != 0)
+ return;
repeat(p, copy, from-1, to-1);
break;
case REP(N, INF): /* as xx{n-1,INF} */
copy = dupl(p, start, finish);
+ if (p->error != 0)
+ return; /* purecov: inspected */
repeat(p, copy, from-1, to);
break;
default: /* "can't happen" */
if (len == 0)
return(ret);
enlarge(p, p->ssize + len); /* this many unexpected additions */
+ if (p->error != 0)
+ return(p->error);
+
assert(p->ssize >= p->slen + len);
(void) memcpy((char *)(p->strip + p->slen),
(char *)(p->strip + start), (size_t)len*sizeof(sop));
}
}
{
- int length=(HERE()-pos-1)*sizeof(sop);
+ size_t length=(HERE()-pos-1)*sizeof(sop);
bmove_upp((uchar *) &p->strip[pos+1]+length,
(uchar *) &p->strip[pos]+length,
length);
if (p->ssize >= size)
return;
+ DBUG_EXECUTE_IF("bug24449090_simulate_oom",
+ {
+ free(p->strip);
+ p->strip= NULL;
+ p->ssize= 0;
+ SETERROR(MY_REG_ESPACE);
+ return;
+ });
+
sp = (sop *)realloc(p->strip, size*sizeof(sop));
if (sp == NULL) {
SETERROR(MY_REG_ESPACE);
#!/bin/sh
-# Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2016, 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
esac
}
+validate_reply () {
+ ret=0
+ if [ -z "$1" ]; then
+ reply=y
+ return $ret
+ fi
+ case $1 in
+ y|Y|yes|Yes|YES) reply=y ;;
+ n|N|no|No|NO) reply=n ;;
+ *) ret=1 ;;
+ esac
+ return $ret
+}
+
prepare() {
touch $config $command
chmod 600 $config $command
echo "root user without the proper authorisation."
echo
-if [ $hadpass -eq 0 ]; then
- echo $echo_n "Set root password? [Y/n] $echo_c"
-else
- echo "You already have a root password set, so you can safely answer 'n'."
- echo
- echo $echo_n "Change the root password? [Y/n] $echo_c"
-fi
+while true ; do
+ if [ $hadpass -eq 0 ]; then
+ echo $echo_n "Set root password? [Y/n] $echo_c"
+ else
+ echo "You already have a root password set, so you can safely answer 'n'."
+ echo
+ echo $echo_n "Change the root password? [Y/n] $echo_c"
+ fi
+ read reply
+ validate_reply $reply && break
+done
-read reply
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
echo "production environment."
echo
-echo $echo_n "Remove anonymous users? [Y/n] $echo_c"
-
-read reply
+while true ; do
+ echo $echo_n "Remove anonymous users? [Y/n] $echo_c"
+ read reply
+ validate_reply $reply && break
+done
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
echo "Normally, root should only be allowed to connect from 'localhost'. This"
echo "ensures that someone cannot guess at the root password from the network."
echo
-
-echo $echo_n "Disallow root login remotely? [Y/n] $echo_c"
-read reply
+while true ; do
+ echo $echo_n "Disallow root login remotely? [Y/n] $echo_c"
+ read reply
+ validate_reply $reply && break
+done
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
echo "before moving into a production environment."
echo
-echo $echo_n "Remove test database and access to it? [Y/n] $echo_c"
-read reply
+while true ; do
+ echo $echo_n "Remove test database and access to it? [Y/n] $echo_c"
+ read reply
+ validate_reply $reply && break
+done
+
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
echo "will take effect immediately."
echo
-echo $echo_n "Reload privilege tables now? [Y/n] $echo_c"
-read reply
+while true ; do
+ echo $echo_n "Reload privilege tables now? [Y/n] $echo_c"
+ read reply
+ validate_reply $reply && break
+done
+
if [ "$reply" = "n" ]; then
echo " ... skipping."
else
usage () {
cat <<EOF
Usage: $0 [OPTIONS]
+ The following options may be given as the first argument:
--no-defaults Don't read the system defaults file
--defaults-file=FILE Use the specified defaults file
--defaults-extra-file=FILE Also use defaults from the specified file
+
+ Other options:
--ledir=DIRECTORY Look for mysqld in the specified directory
--open-files-limit=LIMIT Limit the number of open files
--core-file-size=LIMIT Limit core files to the specified size
case "$arg" in
# these get passed explicitly to mysqld
--basedir=*) MY_BASEDIR_VERSION="$val" ;;
- --datadir=*) DATADIR="$val" ;;
+ --datadir=*)
+ case $val in
+ /) DATADIR=$val ;;
+ *) DATADIR="`echo $val | sed 's;/*$;;'`" ;;
+ esac
+ ;;
--pid-file=*) pid_file="$val" ;;
--plugin-dir=*) PLUGIN_DIR="$val" ;;
--user=*) user="$val"; SET_USER=1 ;;
add_mysqld_ld_preload "$malloc_lib"
}
+find_basedir_from_cmdline () {
+ for arg in "$@"; do
+ case $arg in
+ --basedir=*)
+ MY_BASEDIR_VERSION="`echo "$arg" | sed -e 's;^--[^=]*=;;'`"
+ # Convert to full path
+ cd "$MY_BASEDIR_VERSION"
+ if [ $? -ne 0 ] ; then
+ log_error "--basedir set to '$MY_BASEDIR_VERSION', however could not access directory"
+ exit 1
+ fi
+ MY_BASEDIR_VERSION="`pwd`"
+ ;;
+ esac
+ done
+}
#
# First, try to find BASEDIR and ledir (where mysqld is)
#
-if echo '@pkgdatadir@' | grep '^@prefix@' > /dev/null
-then
- relpkgdata=`echo '@pkgdatadir@' | sed -e 's,^@prefix@,,' -e 's,^/,,' -e 's,^,./,'`
+oldpwd="`pwd`"
+
+# Args not parsed yet, check if --basedir was given on command line
+find_basedir_from_cmdline "$@"
+
+# --basedir is already overridden on command line
+if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION" ; then
+ # Search for mysqld and set ledir
+ for dir in @INSTALL_SBINDIR@ libexec sbin bin ; do
+ if test -x "$MY_BASEDIR_VERSION/$dir/mysqld" ; then
+ ledir="$MY_BASEDIR_VERSION/$dir"
+ break
+ fi
+ done
+
else
- # pkgdatadir is not relative to prefix
- relpkgdata='@pkgdatadir@'
-fi
+ # Basedir should be parent dir of bindir, unless some non-standard
+ # layout is used
-case "$0" in
- /*)
- MY_PWD='@prefix@'
- ;;
- *)
- MY_PWD=`dirname $0`
- MY_PWD=`dirname $MY_PWD`
- ;;
-esac
-# Check for the directories we would expect from a binary release install
-if test -n "$MY_BASEDIR_VERSION" -a -d "$MY_BASEDIR_VERSION"
-then
- # BASEDIR is already overridden on command line. Do not re-set.
+ cd "`dirname $0`"
+ if [ -h "$0" ] ; then
+ realpath="`ls -l "$0" | awk '{print $NF}'`"
+ cd "`dirname "$realpath"`"
+ fi
+ cd ..
+ MY_PWD="`pwd`"
+
+ # Search for mysqld and set ledir and BASEDIR
+ for dir in @INSTALL_SBINDIR@ libexec sbin bin ; do
+ if test -x "$MY_PWD/$dir/mysqld" ; then
+ MY_BASEDIR_VERSION="$MY_PWD"
+ ledir="$MY_BASEDIR_VERSION/$dir"
+ break
+ fi
+ done
- # Use BASEDIR to discover le.
- if test -x "$MY_BASEDIR_VERSION/libexec/mysqld"
- then
- ledir="$MY_BASEDIR_VERSION/libexec"
- elif test -x "$MY_BASEDIR_VERSION/sbin/mysqld"
- then
- ledir="$MY_BASEDIR_VERSION/sbin"
- else
- ledir="$MY_BASEDIR_VERSION/bin"
+ # If we still didn't find anything, use the compiled-in defaults
+ if test -z "$MY_BASEDIR_VERSION" ; then
+ MY_BASEDIR_VERSION='@prefix@'
+ ledir='@libexecdir@'
fi
-elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/bin/mysqld"
-then
- MY_BASEDIR_VERSION="$MY_PWD" # Where bin, share and data are
- ledir="$MY_PWD/bin" # Where mysqld is
-# Check for the directories we would expect from a source install
-elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld"
-then
- MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are
- ledir="$MY_PWD/libexec" # Where mysqld is
-elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/sbin/mysqld"
-then
- MY_BASEDIR_VERSION="$MY_PWD" # Where sbin, share and var are
- ledir="$MY_PWD/sbin" # Where mysqld is
-# Since we didn't find anything, used the compiled-in defaults
-else
- MY_BASEDIR_VERSION='@prefix@'
- ledir='@libexecdir@'
fi
-
#
# Second, try to find the data directory
#
then
defaults="--defaults-extra-file=$DATADIR/my.cnf"
fi
-# Next try where the source installs put it
-elif test -d $MY_BASEDIR_VERSION/var/mysql
-then
- DATADIR=$MY_BASEDIR_VERSION/var
# Or just give up and use our compiled-in default
else
DATADIR=@localstatedir@
# Get first arguments from the my.cnf file, groups [mysqld] and [mysqld_safe]
# and then merge with the command line arguments
-if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults"
-then
+if test -x "$MY_BASEDIR_VERSION/bin/my_print_defaults" ; then
print_defaults="$MY_BASEDIR_VERSION/bin/my_print_defaults"
-elif test -x `dirname $0`/my_print_defaults
-then
- print_defaults="`dirname $0`/my_print_defaults"
-elif test -x ./bin/my_print_defaults
-then
- print_defaults="./bin/my_print_defaults"
-elif test -x @bindir@/my_print_defaults
-then
+elif test -x "@bindir@/my_print_defaults" ; then
print_defaults="@bindir@/my_print_defaults"
-elif test -x @bindir@/mysql_print_defaults
-then
- print_defaults="@bindir@/mysql_print_defaults"
else
print_defaults="my_print_defaults"
fi
args=
+cd "$oldpwd"
+
SET_USER=2
parse_arguments `$print_defaults $defaults --loose-verbose mysqld server`
if test $SET_USER -eq 2
logdir=`dirname "$err_log"`
# Change the err log to the right user, if possible and it is in use
if [ $logging = "file" -o $logging = "both" ]; then
- if [ ! -f "$err_log" -a ! -h "$err_log" ]; then
+ if [ ! -e "$err_log" -a ! -h "$err_log" ]; then
if test -w / -o "$USER" = "root"; then
case $logdir in
/var/log)
fi
fi
- if [ -f "$err_log" ]; then # Log to err_log file
+ if [ -f "$err_log" -o -p "$err_log" ]; then # Log to err_log file
log_notice "Logging to '$err_log'."
elif [ "x$user" = "xroot" ]; then # running as root, mysqld can create log file; continue
echo "Logging to '$err_log'." >&2
fi
if [ ! -h "$pid_file" ]; then
rm -f "$pid_file"
+ if test -f "$pid_file"; then
+ log_error "Fatal error: Can't remove the pid file:
+$pid_file.
+Please remove the file manually and start $0 again;
+mysqld daemon not started"
+ exit 1
+ fi
fi
- if test -f "$pid_file"
- then
- log_error "Fatal error: Can't remove the pid file:
-$pid_file
-Please remove it manually and start $0 again;
+ if [ ! -h "$safe_mysql_unix_port" ]; then
+ rm -f "$safe_mysql_unix_port"
+ if test -f "$safe_mysql_unix_port"; then
+ log_error "Fatal error: Can't remove the socket file:
+$safe_mysql_unix_port.
+Please remove the file manually and start $0 again;
mysqld daemon not started"
- exit 1
+ exit 1
+ fi
fi
fi
while true
do
- # Some extra safety
- if [ ! -h "$safe_mysql_unix_port" ]; then
- rm -f "$safe_mysql_unix_port"
- fi
- if [ ! -h "$pid_file" ]; then
- rm -f "$pid_file"
- fi
-
start_time=`date +%M%S`
# this sets wsrep_start_position_opt
if test ! -f "$pid_file" # This is removed if normal shutdown
then
break
+ else # self's mysqld crashed or other's mysqld running
+ PID=`cat "$pid_file"`
+ if @CHECK_PID@
+ then # true when above pid belongs to a running mysqld process
+ log_error "A mysqld process with pid=$PID is already running. Aborting!!"
+ exit 1
+ fi
fi
done
fi
+ if [ ! -h "$pid_file" ]; then
+ rm -f "$pid_file"
+ fi
+ if [ ! -h "$safe_mysql_unix_port" ]; then
+ rm -f "$safe_mysql_unix_port"
+ fi
+
if [ -n "$wsrep_restart" ]
then
if [ $wsrep_restart -le $max_wsrep_restarts ]
-#!/usr/bin/perl
+#!/usr/bin/env perl
-# 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 Library General Public
-/* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2003, 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
"multi-results", "multi-statements", "multi-queries", "secure-auth",
"report-data-truncation", "plugin-dir", "default-auth",
"bind-address", "ssl-crl", "ssl-crlpath", "enable-cleartext-plugin",
+ "ssl-mode",
NullS
};
enum option_id {
OPT_multi_results, OPT_multi_statements, OPT_multi_queries, OPT_secure_auth,
OPT_report_data_truncation, OPT_plugin_dir, OPT_default_auth,
OPT_bind_address, OPT_ssl_crl, OPT_ssl_crlpath, OPT_enable_cleartext_plugin,
+ OPT_ssl_mode,
OPT_keep_this_one_last
};
case OPT_ssl_crlpath:
EXTENSION_SET_SSL_STRING(options, ssl_crlpath, opt_arg);
break;
+ case OPT_ssl_mode:
+ if (opt_arg &&
+ !my_strcasecmp(&my_charset_latin1, opt_arg, "required"))
+ {
+ ENSURE_EXTENSIONS_PRESENT(options);
+ options->extension->ssl_mode= SSL_MODE_REQUIRED;
+ }
+ else
+ {
+ fprintf(stderr, "Unknown option to ssl-mode: %s\n", opt_arg);
+ exit(1);
+ }
+ break;
#else
case OPT_ssl_key:
case OPT_ssl_cert:
case OPT_ssl_cipher:
case OPT_ssl_crl:
case OPT_ssl_crlpath:
+ case OPT_ssl_mode:
break;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY */
case OPT_character_sets_dir:
{
mysql->options.extension->ssl_crl = 0;
mysql->options.extension->ssl_crlpath = 0;
+ mysql->options.extension->ssl_mode= 0;
}
mysql->options.use_ssl = FALSE;
mysql->connector_fd = 0;
end= buff+5;
}
#ifdef HAVE_OPENSSL
+ /*
+ If SSL connection is required we'll:
+ 1. check if the server supports SSL;
+ 2. check if the client is properly configured;
+ 3. try to use SSL no matter the other options given.
+ */
+ if (mysql->options.extension &&
+ mysql->options.extension->ssl_mode == SSL_MODE_REQUIRED)
+ {
+ if (!(mysql->server_capabilities & CLIENT_SSL))
+ {
+ set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+ ER(CR_SSL_CONNECTION_ERROR),
+ "Server doesn't support SSL");
+ goto error;
+ }
+ if (!mysql->options.use_ssl)
+ {
+ set_mysql_extended_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate,
+ ER(CR_SSL_CONNECTION_ERROR),
+ "Client is not configured to use SSL");
+ goto error;
+ }
+ mysql->client_flag|= CLIENT_SSL;
+ }
if (mysql->client_flag & CLIENT_SSL)
{
/* Do the SSL layering. */
else
mysql->options.client_flag&= ~CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS;
break;
+ case MYSQL_OPT_SSL_MODE:
+ if (*(uint *) arg == SSL_MODE_REQUIRED)
+ {
+ ENSURE_EXTENSIONS_PRESENT(&mysql->options);
+ mysql->options.extension->ssl_mode= SSL_MODE_REQUIRED;
+ }
+ break;
default:
DBUG_RETURN(1);
set_warning(level, code, cut_increment))
make_truncated_value_warning(thd, level, val, ts_type, field_name);
}
+
+bool Field::is_part_of_actual_key(THD *thd, uint cur_index)
+{
+ return thd->optimizer_switch_flag(OPTIMIZER_SWITCH_USE_INDEX_EXTENSIONS) ?
+ part_of_key.is_set(cur_index) :
+ part_of_key_not_extended.is_set(cur_index);
+}
/* Field is part of the following keys */
key_map key_start; /* Keys that starts with this field */
key_map part_of_key; /* All keys that includes this field */
- key_map part_of_key_not_clustered;/* ^ but only for non-clustered keys */
key_map part_of_sortkey; /* ^ but only keys usable for sorting */
+ /**
+ All keys that include this field, but not extended by the storage engine to
+ include primary key columns.
+ */
+ key_map part_of_key_not_extended;
+
/*
We use three additional unireg types for TIMESTAMP to overcome limitation
of current binary format of .frm file. We'd like to be able to support
*/
virtual bool is_updatable() const { return FALSE; }
+ /**
+ Check whether field is part of the index taking the index extensions flag
+ into account.
+
+ @param[in] thd THD object
+ @param[in] cur_index Index of the key
+
+ @retval true Field is part of the key
+ @retval false otherwise
+
+ */
+ bool is_part_of_actual_key(THD *thd, uint cur_index);
+
friend int cre_myisam(char * name, register TABLE *form, uint options,
ulonglong auto_increment_value);
friend class Copy_field;
return cmp;
}
+/**
+ Change the offsets of all the fields in a key range.
+
+ @param range the key range
+ @param key_part the first key part
+ @param diff how much to change the offsets with
+*/
+static inline void
+move_key_field_offsets(const key_range *range, const KEY_PART_INFO *key_part,
+ my_ptrdiff_t diff)
+{
+ for (size_t len= 0; len < range->length;
+ len+= key_part->store_length, ++key_part)
+ key_part->field->move_field_offset(diff);
+}
+
+/**
+ Check if the key in the given buffer (which is not necessarily
+ TABLE::record[0]) is within range. Called by the storage engine to
+ avoid reading too many rows.
+
+ @param buf the buffer that holds the key
+ @retval -1 if the key is within the range
+ @retval 0 if the key is equal to the end_range key, and
+ key_compare_result_on_equal is 0
+ @retval 1 if the key is outside the range
+*/
+int handler::compare_key_in_buffer(const uchar *buf) const
+{
+ DBUG_ASSERT(end_range != NULL);
+
+ /*
+ End range on descending scans is only checked with ICP for now, and then we
+ check it with compare_key_icp() instead of this function.
+ */
+ DBUG_ASSERT(range_scan_direction == RANGE_SCAN_ASC);
+
+ // Make the fields in the key point into the buffer instead of record[0].
+ const my_ptrdiff_t diff= buf - table->record[0];
+ if (diff != 0)
+ move_key_field_offsets(end_range, range_key_part, diff);
+
+ // Compare the key in buf against end_range.
+ int cmp= key_cmp(range_key_part, end_range->key, end_range->length);
+ if (cmp == 0)
+ cmp= key_compare_result_on_equal;
+
+ // Reset the field offsets.
+ if (diff != 0)
+ move_key_field_offsets(end_range, range_key_part, -diff);
+
+ return cmp;
+}
+
int handler::index_read_idx_map(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
#include <my_compare.h>
#include <ft_global.h>
#include <keycache.h>
+#include "xa.h"
class Alter_info;
};
-typedef ulonglong my_xid; // this line is the same as in log_event.h
-#define MYSQL_XID_PREFIX "MySQLXid"
-#define MYSQL_XID_PREFIX_LEN 8 // must be a multiple of 8
-#define MYSQL_XID_OFFSET (MYSQL_XID_PREFIX_LEN+sizeof(server_id))
-#define MYSQL_XID_GTRID_LEN (MYSQL_XID_OFFSET+sizeof(my_xid))
-
-#define XIDDATASIZE MYSQL_XIDDATASIZE
#define MAXGTRIDSIZE 64
#define MAXBQUALSIZE 64
class Join_plan;
};
-/**
- struct xid_t is binary compatible with the XID structure as
- in the X/Open CAE Specification, Distributed Transaction Processing:
- The XA Specification, X/Open Company Ltd., 1991.
- http://www.opengroup.org/bookstore/catalog/c193.htm
-
- @see MYSQL_XID in mysql/plugin.h
-*/
-struct xid_t {
- long formatID;
- long gtrid_length;
- long bqual_length;
- char data[XIDDATASIZE]; // not \0-terminated !
-
- xid_t() {} /* Remove gcc warning */
- bool eq(struct xid_t *xid)
- { return eq(xid->gtrid_length, xid->bqual_length, xid->data); }
- bool eq(long g, long b, const char *d)
- { return g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); }
- void set(struct xid_t *xid)
- { memcpy(this, xid, xid->length()); }
- void set(long f, const char *g, long gl, const char *b, long bl)
- {
- formatID= f;
- memcpy(data, g, gtrid_length= gl);
- memcpy(data+gl, b, bqual_length= bl);
- }
- void set(ulonglong xid)
- {
- my_xid tmp;
- formatID= 1;
- set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX);
- memcpy(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id));
- tmp= xid;
- memcpy(data+MYSQL_XID_OFFSET, &tmp, sizeof(tmp));
- gtrid_length=MYSQL_XID_GTRID_LEN;
- }
- void set(long g, long b, const char *d)
- {
- formatID= 1;
- gtrid_length= g;
- bqual_length= b;
- memcpy(data, d, g+b);
- }
- bool is_null() { return formatID == -1; }
- void null() { formatID= -1; }
- my_xid quick_get_my_xid()
- {
- my_xid tmp;
- memcpy(&tmp, data+MYSQL_XID_OFFSET, sizeof(tmp));
- return tmp;
- }
- my_xid get_my_xid()
- {
- return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
- !memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
- quick_get_my_xid() : 0;
- }
- uint length()
- {
- return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+
- gtrid_length+bqual_length;
- }
- uchar *key()
- {
- return (uchar *)>rid_length;
- }
- uint key_length()
- {
- return sizeof(gtrid_length)+sizeof(bqual_length)+gtrid_length+bqual_length;
- }
-};
typedef struct xid_t XID;
/* for recover() handlerton call */
enum_range_scan_direction direction);
int compare_key(key_range *range);
int compare_key_icp(const key_range *range) const;
+ int compare_key_in_buffer(const uchar *buf) const;
virtual int ft_init() { return HA_ERR_WRONG_COMMAND; }
void ft_end() { ft_handler=NULL; }
virtual FT_INFO *ft_init_ext(uint flags, uint inx,String *key)
/*
- 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
value.time= *tm;
value.time.time_type= time_type;
+ decimals= tm->second_part ? DATETIME_MAX_DECIMALS : 0;
if (check_datetime_range(&value.time))
{
- make_truncated_value_warning(ErrConvString(&value.time,
- MY_MIN(decimals,
- DATETIME_MAX_DECIMALS)),
+ make_truncated_value_warning(ErrConvString(&value.time, decimals),
time_type);
set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR);
}
state= TIME_VALUE;
maybe_null= 0;
max_length= max_length_arg;
- decimals= 0;
DBUG_VOID_RETURN;
}
-/* 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 HAVE_REPLICATION
longlong pos = (ulong)args[1]->val_int();
- longlong timeout = (arg_count==3) ? args[2]->val_int() : 0 ;
+ double timeout = (arg_count == 3) ? args[2]->val_real() : 0;
+ if (timeout < 0)
+ {
+ if (thd->is_strict_mode())
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "MASTER_POS_WAIT.");
+ }
+ else
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ ER(ER_WRONG_ARGUMENTS),
+ "MASTER_POS_WAIT.");
+ null_value= 1;
+ }
+ return 0;
+ }
+
if (active_mi == NULL ||
(event_count = active_mi->rli->wait_for_pos(thd, log_name, pos, timeout)) == -2)
{
}
#if defined(HAVE_REPLICATION)
- longlong timeout = (arg_count== 2) ? args[1]->val_int() : 0;
+ double timeout = (arg_count == 2) ? args[1]->val_real() : 0;
+ if (timeout < 0)
+ {
+ if (thd->is_strict_mode())
+ {
+ my_error(ER_WRONG_ARGUMENTS, MYF(0), "WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.");
+ }
+ else
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ ER(ER_WRONG_ARGUMENTS),
+ "WAIT_UNTIL_SQL_THREAD_AFTER_GTIDS.");
+ null_value= 1;
+ }
+ return 0;
+ }
+
if (active_mi && active_mi->rli)
{
if ((event_count = active_mi->rli->wait_for_gtid_set(thd, gtid, timeout))
/*
- 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
*to= '\'';
ret:
+ if (new_length > current_thd->variables.max_allowed_packet)
+ {
+ push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WARN_ALLOWED_PACKET_OVERFLOWED,
+ ER_THD(current_thd, ER_WARN_ALLOWED_PACKET_OVERFLOWED),
+ func_name(),
+ current_thd->variables.max_allowed_packet);
+ null_value= true;
+ return NULL;
+ }
+
tmp_value.length(new_length);
tmp_value.set_charset(collation.collation);
null_value= 0;
-/* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights
+/* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights
reserved.
This program is free software; you can redistribute it and/or modify
free_tmp_table(thd, tmp_table);
delete result;
result= NULL;
+ thd->raise_error_printf(ER_INTERNAL_ERROR, "Failed to create MyISAM temporary table for query processing, key too large");
DBUG_RETURN(TRUE);
}
result= tmp_result_sink;
{
DBUG_ENTER("subselect_hash_sj_engine::cleanup");
is_materialized= false;
- result->cleanup(); /* Resets the temp table as well. */
+
+ if (result)
+ result->cleanup(); /* Resets the temp table as well. */
THD * const thd= item->unit->thd;
DEBUG_SYNC(thd, "before_index_end_in_subselect");
- if (tab->table->file->inited)
+ if (tab && tab->table->file->inited)
tab->table->file->ha_index_end(); // Close the scan over the index
- free_tmp_table(thd, tab->table);
+ if (tab)
+ free_tmp_table(thd, tab->table);
tab= NULL;
materialize_engine->cleanup();
DBUG_VOID_RETURN;
node.parent= data->parent; // Set parent for the new node to old parent
data->parent= numnodes; // Remember current node as new parent
- DBUG_ASSERT(data->level <= MAX_LEVEL);
+ DBUG_ASSERT(data->level < MAX_LEVEL);
data->pos[data->level]= numnodes;
- if (data->level < MAX_LEVEL)
+ if (data->level < MAX_LEVEL - 1)
node.level= data->level++;
else
return MY_XML_ERROR;
(ulong) rli->get_group_master_log_pos()));
mysql_mutex_unlock(&rli->data_lock);
if (rli->is_parallel_exec())
+ {
+ bool real_event= server_id && !is_artificial_event();
rli->reset_notified_checkpoint(0,
- server_id ? when.tv_sec + (time_t) exec_time : 0,
+ real_event ? when.tv_sec + (time_t) exec_time : 0,
true/*need_data_lock=true*/);
+ }
/*
Reset thd->variables.option_bits and sql_mode etc, because this could be the signal of
-/* 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
#ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
#include "../storage/perfschema/pfs_server.h"
+#else
+#include "lf.h"
+int dummy_variable_to_pull_in_lf_hash_functions= LF_HASH_OVERHEAD;
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
+
#include <mysql/psi/mysql_idle.h>
#include <mysql/psi/mysql_socket.h>
#include <mysql/psi/mysql_statement.h>
-/* 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
part of 'cur_index'
*/
if (bitmap_is_set(table->read_set, cur_field->field_index) &&
- !cur_field->part_of_key_not_clustered.is_set(cur_index))
+ !cur_field->is_part_of_actual_key(thd, cur_index))
{
cause= "not_covering";
goto next_index; // Field was not part of key
key_part_range[1]= last_part;
/* Check if cur_part is referenced in the WHERE clause. */
- if (join->conds->walk(&Item::find_item_in_field_list_processor, 0,
+ if (join->conds->walk(&Item::find_item_in_field_list_processor, 1,
(uchar*) key_part_range))
{
cause= "keypart_reference_from_where_clause";
-/* 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
@param shift number of bits to shift by Worker due to the
current checkpoint change.
@param new_ts new seconds_behind_master timestamp value
- unless zero. Zero could be due to FD event.
+ unless zero. Zero could be due to FD event
+ or fake rotate event.
@param need_data_lock False if caller has locked @c data_lock
*/
void Relay_log_info::reset_notified_checkpoint(ulong shift, time_t new_ts,
@param[in] log_name log name to wait for,
@param[in] log_pos position to wait for,
@param[in] timeout @c timeout in seconds before giving up waiting.
- @c timeout is longlong whereas it should be ulong; but this is
+ @c timeout is double whereas it should be ulong; but this is
to catch if the user submitted a negative timeout.
@retval -2 improper arguments (log_pos<0)
int Relay_log_info::wait_for_pos(THD* thd, String* log_name,
longlong log_pos,
- longlong timeout)
+ double timeout)
{
int event_count = 0;
ulong init_abort_pos_wait;
DBUG_PRINT("enter",("log_name: '%s' log_pos: %lu timeout: %lu",
log_name->c_ptr_safe(), (ulong) log_pos, (ulong) timeout));
- set_timespec(abstime,timeout);
+ set_timespec_nsec(abstime, (ulonglong) timeout * 1000000000ULL);
mysql_mutex_lock(&data_lock);
thd->ENTER_COND(&data_cond, &data_lock,
&stage_waiting_for_the_slave_thread_to_advance_position,
/Alfranio
*/
int Relay_log_info::wait_for_gtid_set(THD* thd, String* gtid,
- longlong timeout)
+ double timeout)
{
int event_count = 0;
ulong init_abort_pos_wait;
if (!inited)
DBUG_RETURN(-2);
- DBUG_PRINT("info", ("Waiting for %s timeout %lld", gtid->c_ptr_safe(),
+ DBUG_PRINT("info", ("Waiting for %s timeout %f", gtid->c_ptr_safe(),
timeout));
- set_timespec(abstime, timeout);
+ set_timespec_nsec(abstime, (ulonglong) timeout * 1000000000ULL);
mysql_mutex_lock(&data_lock);
thd->ENTER_COND(&data_cond, &data_lock,
&stage_waiting_for_the_slave_thread_to_advance_position,
-/* 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
bool need_data_lock);
int wait_for_pos(THD* thd, String* log_name, longlong log_pos,
- longlong timeout);
- int wait_for_gtid_set(THD* thd, String* gtid, longlong timeout);
+ double timeout);
+ int wait_for_gtid_set(THD* thd, String* gtid, double timeout);
void close_temporary_tables();
/* Check if UNTIL condition is satisfied. See slave.cc for more. */
DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(act)));
}
};);
+ DBUG_EXECUTE_IF("dbug.calculate_sbm_after_fake_rotate_log_event",
+ {
+ if (ev->get_type_code() == ROTATE_EVENT && ev->is_artificial_event())
+ {
+ const char act[]= "now signal signal.reached wait_for signal.done_sbm_calculation";
+ DBUG_ASSERT(opt_debug_sync_timeout > 0);
+ DBUG_ASSERT(!debug_sync_set_action(thd,
+ STRING_WITH_LEN(act)));
+ }
+ };);
/*
Format_description_log_event should not be deleted because it will be
used to read info about the relay log's format; it will be deleted when
};);
DBUG_EXECUTE_IF("dbug.calculate_sbm_after_previous_gtid_log_event",
{
- /* Fake that thread started 3 mints ago */
+ /* Fake that thread started 3 minutes ago */
thd->start_time.tv_sec-=180;
};);
+ DBUG_EXECUTE_IF("dbug.calculate_sbm_after_fake_rotate_log_event",
+ {
+ /* Fake that thread started 3 minutes ago */
+ thd->start_time.tv_sec-=180;
+ };);
mysql_mutex_lock(&mi->run_lock);
mi->slave_running= MYSQL_SLAVE_RUN_CONNECT;
mysql_mutex_unlock(&mi->run_lock);
my_vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
- if (code)
+ if (code == ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2)
my_message(code, buf, MYF(0));
else
my_error(ER_CANNOT_LOAD_FROM_TABLE_V2, MYF(0), "mysql", "proc");
-/* Copyright (c) 2012, 2015, 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
thd->rollback_item_tree_changes();
/*
- Update the state of the active arena if no errors on
- open_tables stage.
+ Change state of current arena according to outcome of execution.
+
+ When entering this function, state is STMT_INITIALIZED_FOR_SP if this is
+ the first execution, otherwise it is STMT_EXECUTED.
+
+ When an error occurs during opening tables, no execution takes place and
+ no state change will take place.
+
+ When a re-prepare error is raised, the next execution will re-prepare the
+ statement. To make sure that items are created in the statement mem_root,
+ change state to STMT_INITIALIZED_FOR_SP.
+
+ In other cases, the state should become (or remain) STMT_EXECUTED.
+ See Query_arena->state definition for explanation.
+
+ Some special handling of CREATE TABLE .... SELECT in an SP is required. The
+ state is always set to STMT_INITIALIZED_FOR_SP in such a case.
+
+ Why is this necessary? A useful pointer would be to note how
+ PREPARE/EXECUTE uses functions like select_like_stmt_test to implement
+ CREATE TABLE .... SELECT. The SELECT part of the DDL is resolved first.
+ Then there is an attempt to create the table. So in the execution phase,
+ if "table exists" error occurs or flush table preceeds the execute, the
+ item tree of the select is re-created and followed by an attempt to create
+ the table.
+
+ But SP uses mysql_execute_command (which is used by the conventional
+ execute) after doing a parse. This creates a problem for SP since it
+ tries to preserve the item tree from the previous execution.
*/
- if (!rc || !thd->is_error() ||
- (thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
- thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
- thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
+ bool reprepare_error=
+ rc && thd->get_stmt_da()->sql_errno() == ER_NEED_REPREPARE;
+ bool is_create_table_select=
+ thd->lex && thd->lex->sql_command == SQLCOM_CREATE_TABLE &&
+ thd->lex->select_lex.item_list.elements > 0;
+
+ if (reprepare_error || is_create_table_select)
+ thd->stmt_arena->state= Query_arena::STMT_INITIALIZED_FOR_SP;
+ else if (!rc || !thd->is_error() ||
+ (thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
+ thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
+ thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
/*
initiated. Also set the statement query arena to the lex mem_root.
*/
MEM_ROOT *execution_mem_root= thd->mem_root;
- Query_arena parse_arena(&m_lex_mem_root, STMT_INITIALIZED_FOR_SP);
+ Query_arena parse_arena(&m_lex_mem_root, thd->stmt_arena->state);
thd->mem_root= &m_lex_mem_root;
thd->stmt_arena->set_query_arena(&parse_arena);
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+/* 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
#include <openssl/err.h>
#endif
+#ifndef DBUG_OFF
+#define HASH_STRING_WITH_QUOTE \
+ "$5$BVZy9O>'a+2MH]_?$fpWyabcdiHjfCVqId/quykZzjaA7adpkcen/uiQrtmOK4p4"
+#endif
+
using std::min;
using std::max;
}
};
+static const
+TABLE_FIELD_TYPE mysql_user_table_fields[MYSQL_USER_FIELD_COUNT] = {
+ {
+ { C_STRING_WITH_LEN("Host") },
+ { C_STRING_WITH_LEN("char(60)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("User") },
+ { C_STRING_WITH_LEN("char(16)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Password") },
+ { C_STRING_WITH_LEN("char(41)") },
+ { C_STRING_WITH_LEN("latin1") }
+ },
+ {
+ { C_STRING_WITH_LEN("Select_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Insert_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Update_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Delete_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Create_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Drop_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Reload_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Shutdown_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Process_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("File_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Grant_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("References_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Index_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Alter_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Show_db_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Super_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Create_tmp_table_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Lock_tables_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Execute_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Repl_slave_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Repl_client_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Create_view_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Show_view_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Create_routine_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Alter_routine_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Create_user_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Event_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Trigger_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Create_tablespace_priv") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("ssl_type") },
+ { C_STRING_WITH_LEN("enum('','ANY','X509','SPECIFIED')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("ssl_cipher") },
+ { C_STRING_WITH_LEN("blob") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("x509_issuer") },
+ { C_STRING_WITH_LEN("blob") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("x509_subject") },
+ { C_STRING_WITH_LEN("blob") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("max_questions") },
+ { C_STRING_WITH_LEN("int(11)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("max_updates") },
+ { C_STRING_WITH_LEN("int(11)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("max_connections") },
+ { C_STRING_WITH_LEN("int(11)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("max_user_connections") },
+ { C_STRING_WITH_LEN("int(11)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("plugin") },
+ { C_STRING_WITH_LEN("char(64)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("authentication_string") },
+ { C_STRING_WITH_LEN("text") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("password_expired") },
+ { C_STRING_WITH_LEN("enum('N','Y')") },
+ { C_STRING_WITH_LEN("utf8") }
+ }
+};
+
+static const
+TABLE_FIELD_TYPE mysql_proxies_priv_table_fields[MYSQL_PROXIES_PRIV_FIELD_COUNT] = {
+ {
+ { C_STRING_WITH_LEN("Host") },
+ { C_STRING_WITH_LEN("char(60)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("User") },
+ { C_STRING_WITH_LEN("char(16)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Proxied_host") },
+ { C_STRING_WITH_LEN("char(60)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Proxied_user") },
+ { C_STRING_WITH_LEN("char(16)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("With_grant") },
+ { C_STRING_WITH_LEN("tinyint(1)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Grantor") },
+ { C_STRING_WITH_LEN("char(77)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Timestamp") },
+ { C_STRING_WITH_LEN("timestamp") },
+ {NULL, 0}
+ }
+};
+
+static const
+TABLE_FIELD_TYPE mysql_procs_priv_table_fields[MYSQL_PROCS_PRIV_FIELD_COUNT] = {
+ {
+ { C_STRING_WITH_LEN("Host") },
+ { C_STRING_WITH_LEN("char(60)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Db") },
+ { C_STRING_WITH_LEN("char(64)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("User") },
+ { C_STRING_WITH_LEN("char(16)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Routine_name") },
+ { C_STRING_WITH_LEN("char(64)") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Routine_type") },
+ { C_STRING_WITH_LEN("enum('FUNCTION','PROCEDURE')") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Grantor") },
+ { C_STRING_WITH_LEN("char(77)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Proc_priv") },
+ { C_STRING_WITH_LEN("set('Execute','Alter Routine','Grant')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Timestamp") },
+ { C_STRING_WITH_LEN("timestamp") },
+ {NULL, 0}
+ }
+};
+
+static const
+TABLE_FIELD_TYPE mysql_columns_priv_table_fields[MYSQL_COLUMNS_PRIV_FIELD_COUNT] = {
+ {
+ { C_STRING_WITH_LEN("Host") },
+ { C_STRING_WITH_LEN("char(60)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Db") },
+ { C_STRING_WITH_LEN("char(64)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("User") },
+ { C_STRING_WITH_LEN("char(16)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Table_name") },
+ { C_STRING_WITH_LEN("char(64)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Column_name") },
+ { C_STRING_WITH_LEN("char(64)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Timestamp") },
+ { C_STRING_WITH_LEN("timestamp") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Column_priv") },
+ { C_STRING_WITH_LEN("set('Select','Insert','Update','References')") },
+ { C_STRING_WITH_LEN("utf8") }
+ }
+};
+
+static const
+TABLE_FIELD_TYPE mysql_tables_priv_table_fields[MYSQL_TABLES_PRIV_FIELD_COUNT] = {
+ {
+ { C_STRING_WITH_LEN("Host") },
+ { C_STRING_WITH_LEN("char(60)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Db") },
+ { C_STRING_WITH_LEN("char(64)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("User") },
+ { C_STRING_WITH_LEN("char(16)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Table_name") },
+ { C_STRING_WITH_LEN("char(64)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Grantor") },
+ { C_STRING_WITH_LEN("char(77)") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Timestamp") },
+ { C_STRING_WITH_LEN("timestamp") },
+ {NULL, 0}
+ },
+ {
+ { C_STRING_WITH_LEN("Table_priv") },
+ { C_STRING_WITH_LEN("set('Select','Insert','Update','Delete','Create',"
+ "'Drop','Grant','References','Index','Alter',"
+ "'Create View','Show view','Trigger')") },
+ { C_STRING_WITH_LEN("utf8") }
+ },
+ {
+ { C_STRING_WITH_LEN("Column_priv") },
+ { C_STRING_WITH_LEN("set('Select','Insert','Update','References')") },
+ { C_STRING_WITH_LEN("utf8") }
+ }
+};
+
+
const TABLE_FIELD_DEF
mysql_db_table_def= {MYSQL_DB_FIELD_COUNT, mysql_db_table_fields};
+const TABLE_FIELD_DEF
+ mysql_user_table_def= {MYSQL_USER_FIELD_COUNT, mysql_user_table_fields};
+
+const TABLE_FIELD_DEF
+ mysql_proxies_priv_table_def= {MYSQL_PROXIES_PRIV_FIELD_COUNT,
+ mysql_proxies_priv_table_fields};
+
+const TABLE_FIELD_DEF
+ mysql_procs_priv_table_def= {MYSQL_PROCS_PRIV_FIELD_COUNT,
+ mysql_procs_priv_table_fields};
+
+const TABLE_FIELD_DEF
+ mysql_columns_priv_table_def= {MYSQL_COLUMNS_PRIV_FIELD_COUNT,
+ mysql_columns_priv_table_fields};
+
+const TABLE_FIELD_DEF
+ mysql_tables_priv_table_def= {MYSQL_TABLES_PRIV_FIELD_COUNT,
+ mysql_tables_priv_table_fields};
+
static LEX_STRING native_password_plugin_name= {
C_STRING_WITH_LEN("mysql_native_password")
};
return (uchar*) entry->key;
}
+
+/**
+ Class to validate the flawlessness of ACL table
+ before performing ACL operations.
+*/
+class Acl_table_intact : public Table_check_intact
+{
+protected:
+ void report_error(uint code, const char *fmt, ...)
+ {
+ va_list args;
+ va_start(args, fmt);
+
+ if (code == 0)
+ error_log_print(WARNING_LEVEL, fmt, args);
+ else if (code == ER_CANNOT_LOAD_FROM_TABLE_V2)
+ {
+ char *db_name, *table_name;
+ db_name= va_arg(args, char *);
+ table_name= va_arg(args, char *);
+ my_error(code, MYF(ME_NOREFRESH), db_name, table_name);
+ }
+ else
+ my_printv_error(code, ER(code), MYF(ME_NOREFRESH), args);
+
+ va_end(args);
+ }
+};
+
#define IP_ADDR_STRLEN (3 + 1 + 3 + 1 + 3 + 1 + 3)
#define ACL_KEY_LENGTH (IP_ADDR_STRLEN + 1 + NAME_LEN + \
1 + USERNAME_LENGTH + 1)
static my_bool acl_load(THD *thd, TABLE_LIST *tables);
static my_bool grant_load(THD *thd, TABLE_LIST *tables);
static inline void get_grantor(THD *thd, char* grantor);
+
+/**
+ Escapes special characters in the unescaped string, taking into account
+ the current character set and sql mode.
+
+ @param thd [in] The thd structure.
+ @param to [out] Escaped string output buffer.
+ @param from [in] String to escape.
+ @param length [in] String to escape length.
+
+ @return Result value.
+ @retval != (ulong)-1 Succeeded. Number of bytes written to the output
+ buffer without the '\0' character.
+ @retval (ulong)-1 Failed.
+*/
+
+inline ulong escape_string_mysql(THD *thd, char *to, const char *from,
+ ulong length)
+{
+ if (!(thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES))
+ return (uint)escape_string_for_mysql(system_charset_info, to, 0, from,
+ length);
+ else
+ return (uint)escape_quotes_for_mysql(system_charset_info, to, 0, from,
+ length);
+}
+
/*
Enumeration of various ACL's and Hashes used in handle_grant_struct()
*/
{
TABLE_LIST tables;
TABLE *table;
+ Acl_table_intact table_intact;
/* Buffer should be extended when password length is extended. */
- char buff[512];
+ char buff[2048];
ulong query_length=0;
bool save_binlog_row_based;
uchar user_key[MAX_KEY_LENGTH];
char *plugin_temp= NULL;
bool plugin_empty;
+ char *new_escaped_password= NULL;
uint new_password_len= (uint) strlen(new_password);
bool result= 1;
enum mysql_user_table_field password_field= MYSQL_USER_FIELD_PASSWORD;
if (!(table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(1);
+ if (table_intact.check(table, &mysql_user_table_def))
+ DBUG_RETURN(1);
+
if (!table->key_info)
{
my_error(ER_TABLE_CORRUPT, MYF(0), table->s->db.str,
acl_cache->clear(1); // Clear locked hostname cache
mysql_mutex_unlock(&acl_cache->lock);
result= 0;
+ /*
+ Before writing the query to binlog, correctly escape the password
+ string so that the slave can parse it correctly.
+ */
+
+ new_escaped_password= (char *)alloc_root(thd->mem_root, (new_password_len*2+1));
+ if (!new_escaped_password)
+ {
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 0);
+ result= 1;
+ goto end;
+ }
+
+ DBUG_EXECUTE_IF("force_hash_string_with_quote",
+ strcpy(new_password, HASH_STRING_WITH_QUOTE);
+ );
+
+ escape_string_mysql(thd, new_escaped_password, new_password, new_password_len);
+
query_length= sprintf(buff, "SET PASSWORD FOR '%-.120s'@'%-.120s'='%-.120s'",
acl_user->user ? acl_user->user : "",
acl_user->host.get_host() ? acl_user->host.get_host() : "",
- new_password);
+ new_escaped_password);
result= write_bin_log(thd, true, buff, query_length,
table->file->has_transactions());
end:
char what= (revoke_grant) ? 'N' : 'Y';
uchar user_key[MAX_KEY_LENGTH];
LEX *lex= thd->lex;
+ Acl_table_intact table_intact;
DBUG_ENTER("replace_user_table");
mysql_mutex_assert_owner(&acl_cache->lock);
-
+
+ if (table_intact.check(table, &mysql_user_table_def))
+ goto end;
+
if (!table->key_info)
{
my_error(ER_TABLE_CORRUPT, MYF(0), table->s->db.str,
int error;
char what= (revoke_grant) ? 'N' : 'Y';
uchar user_key[MAX_KEY_LENGTH];
+ Acl_table_intact table_intact;
DBUG_ENTER("replace_db_table");
if (!initialized)
DBUG_RETURN(-1);
}
+ if (table_intact.check(table, &mysql_db_table_def))
+ DBUG_RETURN(-1);
+
/* Check if there is such a user in user table in memory? */
if (!find_acl_user(combo.host.str,combo.user.str, FALSE))
{
uchar user_key[MAX_KEY_LENGTH];
ACL_PROXY_USER new_grant;
char grantor[USER_HOST_BUFF_SIZE];
+ Acl_table_intact table_intact;
DBUG_ENTER("replace_proxies_priv_table");
DBUG_RETURN(-1);
}
+ if (table_intact.check(table, &mysql_proxies_priv_table_def))
+ DBUG_RETURN(-1);
+
/* Check if there is such a user in user table in memory? */
if (!find_acl_user(user->host.str,user->user.str, FALSE))
{
int result=0;
uchar key[MAX_KEY_LENGTH];
uint key_prefix_length;
+ KEY_PART_INFO *key_part;
+ Acl_table_intact table_intact;
DBUG_ENTER("replace_column_table");
+ if (table_intact.check(table, &mysql_columns_priv_table_def))
+ DBUG_RETURN(-1);
+
if (!table->key_info)
{
my_error(ER_TABLE_CORRUPT, MYF(0), table->s->db.str,
DBUG_RETURN(-1);
}
- KEY_PART_INFO *key_part= table->key_info->key_part;
+ key_part= table->key_info->key_part;
table->use_all_columns();
table->field[0]->store(combo.host.str,combo.host.length,
int error=0;
ulong store_table_rights, store_col_rights;
uchar user_key[MAX_KEY_LENGTH];
+ Acl_table_intact table_intact;
DBUG_ENTER("replace_table_table");
+ if (table_intact.check(table, &mysql_tables_priv_table_def))
+ DBUG_RETURN(-1);
+
get_grantor(thd, grantor);
/*
The following should always succeed as new users are created before
int old_row_exists= 1;
int error=0;
ulong store_proc_rights;
+ Acl_table_intact table_intact;
DBUG_ENTER("replace_routine_table");
if (!initialized)
DBUG_RETURN(-1);
}
+ if (table_intact.check(table, &mysql_procs_priv_table_def))
+ DBUG_RETURN(-1);
+
get_grantor(thd, grantor);
/*
New users are created before this function is called.
int result= 0;
int found;
int ret;
+ Acl_table_intact table_intact;
DBUG_ENTER("handle_grant_data");
/* Handle user table. */
+ if (table_intact.check(tables[0].table, &mysql_user_table_def))
+ {
+ result= -1;
+ goto end;
+ }
+
if ((found= handle_grant_table(tables, 0, drop, user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
}
/* Handle db table. */
+ if (table_intact.check(tables[1].table, &mysql_db_table_def))
+ {
+ result= -1;
+ goto end;
+ }
+
if ((found= handle_grant_table(tables, 1, drop, user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
}
/* Handle stored routines table. */
+ if (table_intact.check(tables[4].table, &mysql_procs_priv_table_def))
+ {
+ result= -1;
+ goto end;
+ }
+
if ((found= handle_grant_table(tables, 4, drop, user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch in-memory array. */
}
/* Handle tables table. */
+ if (table_intact.check(tables[2].table, &mysql_tables_priv_table_def))
+ {
+ result= -1;
+ goto end;
+ }
+
if ((found= handle_grant_table(tables, 2, drop, user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch columns and in-memory array. */
}
/* Handle columns table. */
+ if (table_intact.check(tables[3].table, &mysql_columns_priv_table_def))
+ {
+ result= -1;
+ goto end;
+ }
+
if ((found= handle_grant_table(tables, 3, drop, user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
/* Handle proxies_priv table. */
if (tables[5].table)
{
+ if (table_intact.check(tables[5].table, &mysql_proxies_priv_table_def))
+ {
+ result= -1;
+ goto end;
+ }
+
if ((found= handle_grant_table(tables, 5, drop, user_from, user_to)) < 0)
{
/* Handle of table failed, don't touch the in-memory array. */
TABLE *table;
bool some_passwords_expired= false;
bool save_binlog_row_based;
+ Acl_table_intact table_intact;
DBUG_ENTER("mysql_user_password_expire");
if (!initialized)
if (!(table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(true);
+ if (table_intact.check(table, &mysql_user_table_def))
+ DBUG_RETURN(true);
+
if (!table->key_info)
{
my_error(ER_TABLE_CORRUPT, MYF(0), table->s->db.str,
{
static char empty_string[1]= { '\0' };
char *begin= *buffer;
+ uchar *pos= (uchar *)begin;
+ size_t required_length= 9;
+
if (*max_bytes_available == 0)
return NULL;
return empty_string;
}
+ /* Make sure we have enough bytes available for net_field_length_ll */
+ {
+ DBUG_EXECUTE_IF("buffer_too_short_3",
+ *pos= 252; *max_bytes_available= 2;
+ );
+ DBUG_EXECUTE_IF("buffer_too_short_4",
+ *pos= 253; *max_bytes_available= 3;
+ );
+ DBUG_EXECUTE_IF("buffer_too_short_9",
+ *pos= 254; *max_bytes_available= 8;
+ );
+
+ if (*pos <= 251)
+ required_length= 1;
+ if (*pos == 252)
+ required_length= 3;
+ if (*pos == 253)
+ required_length= 4;
+
+ if (*max_bytes_available < required_length)
+ return NULL;
+ }
+
*string_length= (size_t)net_field_length_ll((uchar **)buffer);
DBUG_EXECUTE_IF("sha256_password_scramble_too_long",
);
size_t len_len= (size_t)(*buffer - begin);
+
+ DBUG_ASSERT((*max_bytes_available >= len_len) &&
+ (len_len == required_length));
if (*string_length > *max_bytes_available - len_len)
return NULL;
#ifndef SQL_ACL_INCLUDED
#define SQL_ACL_INCLUDED
-/* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2000, 2016, 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_USER_FIELD_COUNT
};
+enum mysql_proxies_priv_table_feild
+{
+ MYSQL_PROXIES_PRIV_FIELD_HOST = 0,
+ MYSQL_PROXIES_PRIV_FIELD_USER,
+ MYSQL_PROXIES_PRIV_FIELD_PROXIED_HOST,
+ MYSQL_PROXIES_PRIV_FIELD_PROXIED_USER,
+ MYSQL_PROXIES_PRIV_FIELD_WITH_GRANT,
+ MYSQL_PROXIES_PRIV_FIELD_GRANTOR,
+ MYSQL_PROXIES_PRIV_FIELD_TIMESTAMP,
+ MYSQL_PROXIES_PRIV_FIELD_COUNT
+};
+
+enum mysql_procs_priv_table_field
+{
+ MYSQL_PROCS_PRIV_FIELD_HOST = 0,
+ MYSQL_PROCS_PRIV_FIELD_DB,
+ MYSQL_PROCS_PRIV_FIELD_USER,
+ MYSQL_PROCS_PRIV_FIELD_ROUTINE_NAME,
+ MYSQL_PROCS_PRIV_FIELD_ROUTINE_TYPE,
+ MYSQL_PROCS_PRIV_FIELD_GRANTOR,
+ MYSQL_PROCS_PRIV_FIELD_PROC_PRIV,
+ MYSQL_PROCS_PRIV_FIELD_TIMESTAMP,
+ MYSQL_PROCS_PRIV_FIELD_COUNT
+};
+
+enum mysql_columns_priv_table_field
+{
+ MYSQL_COLUMNS_PRIV_FIELD_HOST = 0,
+ MYSQL_COLUMNS_PRIV_FIELD_DB,
+ MYSQL_COLUMNS_PRIV_FIELD_USER,
+ MYSQL_COLUMNS_PRIV_FIELD_TABLE_NAME,
+ MYSQL_COLUMNS_PRIV_FIELD_COLUMN_NAME,
+ MYSQL_COLUMNS_PRIV_FIELD_TIMESTAMP,
+ MYSQL_COLUMNS_PRIV_FIELD_COLUMN_PRIV,
+ MYSQL_COLUMNS_PRIV_FIELD_COUNT
+};
+
+enum mysql_tables_priv_table_field
+{
+ MYSQL_TABLES_PRIV_FIELD_HOST = 0,
+ MYSQL_TABLES_PRIV_FIELD_DB,
+ MYSQL_TABLES_PRIV_FIELD_USER,
+ MYSQL_TABLES_PRIV_FIELD_TABLE_NAME,
+ MYSQL_TABLES_PRIV_FIELD_GRANTOR,
+ MYSQL_TABLES_PRIV_FIELD_TIMESTAMP,
+ MYSQL_TABLES_PRIV_FIELD_TABLE_PRIV,
+ MYSQL_TABLES_PRIV_FIELD_COLUMN_PRIV,
+ MYSQL_TABLES_PRIV_FIELD_COUNT
+};
+
extern const TABLE_FIELD_DEF mysql_db_table_def;
extern bool mysql_user_table_is_in_short_password_format;
extern my_bool disconnect_on_expired_password;
-/* 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
Use own arena for Prepared Statements or data will be freed after
PREPARE.
*/
- Prepared_stmt_arena_holder ps_arena_holder(thd, register_tree_change);
+ Prepared_stmt_arena_holder ps_arena_holder(
+ thd,
+ register_tree_change &&
+ thd->stmt_arena->is_stmt_prepare_or_first_stmt_execute());
/*
create_item() may, or may not create a new Item, depending on
/*
- 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
thd_new_connection_setup
- @note Must be called with LOCK_thread_count locked.
-
@param thd THD object
@param stack_start Start of stack for connection
*/
void thd_new_connection_setup(THD *thd, char *stack_start)
{
DBUG_ENTER("thd_new_connection_setup");
- mysql_mutex_assert_owner(&LOCK_thread_count);
+ mysql_mutex_lock(&LOCK_thread_count);
#ifdef HAVE_PSI_INTERFACE
thd_set_psi(thd,
PSI_THREAD_CALL(new_thread)
-/* 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
STMT_CONVENTIONAL_EXECUTION= 3, STMT_EXECUTED= 4, STMT_ERROR= -1
};
+ /*
+ State and state changes in SP:
+ 1) When state is STMT_INITIALIZED_FOR_SP, objects in the item tree are
+ created on the statement memroot. This is enforced through
+ ps_arena_holder checking the state.
+ 2) After the first execute (call p1()), this state should change to
+ STMT_EXECUTED. Objects will be created on the execution memroot and will
+ be destroyed at the end of each execution.
+ 3) In case an ER_NEED_REPREPARE error occurs, state should be changed to
+ STMT_INITIALIZED_FOR_SP and objects will again be created on the
+ statement memroot. At the end of this execution, state should change to
+ STMT_EXECUTED.
+ */
enum_state state;
/* We build without RTTI, so dynamic_cast can't be used. */
-/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2016, 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
state->m_last_id_index= (int)digest_storage->m_byte_count;
break;
}
+ case 0:
+ {
+ unsigned int temp_tok;
+ read_token(digest_storage,
+ digest_storage->m_byte_count-SIZE_OF_A_TOKEN,
+ & temp_tok);
+ if (temp_tok == ';')
+ digest_storage->m_byte_count-= SIZE_OF_A_TOKEN;
+ break;
+ }
default:
{
/* Add this token to digest storage. */
set_fields, MARK_COLUMNS_WRITE, 0, 0) ||
check_that_all_fields_are_given_values(thd, table, table_list))
DBUG_RETURN(TRUE);
+
+ /*
+ Special updatability test is needed because fields_vars may contain
+ a mix of column references and user variables.
+ */
+ Item *item;
+ List_iterator<Item> it(fields_vars);
+ while ((item= it++))
+ {
+ if ((item->type() == Item::FIELD_ITEM ||
+ item->type() == Item::REF_ITEM) &&
+ item->field_for_view_update() == NULL)
+ {
+ my_error(ER_NONUPDATEABLE_COLUMN, MYF(0), item->item_name.ptr());
+ DBUG_RETURN(true);
+ }
+ }
+
/* Fix the expressions in SET clause */
if (setup_fields(thd, Ref_ptr_array(), set_values, MARK_COLUMNS_READ, 0, 0))
DBUG_RETURN(TRUE);
-/* 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
/* PSI begin */
thd->m_digest= & thd->m_digest_state;
+ thd->m_digest->reset(thd->m_token_array, max_digest_length);
thd->m_statement_psi= MYSQL_START_STATEMENT(&thd->m_statement_state,
com_statement_info[command].m_key,
if (((lex->create_info.used_fields & HA_CREATE_USED_DATADIR) != 0 ||
(lex->create_info.used_fields & HA_CREATE_USED_INDEXDIR) != 0) &&
- check_access(thd, FILE_ACL, NULL, NULL, NULL, FALSE, FALSE))
+ check_access(thd, FILE_ACL, any_db, NULL, NULL, FALSE, FALSE))
{
res= 1;
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "FILE");
{
partition_info *part_info= thd->lex->part_info;
if (part_info != NULL && has_external_data_or_index_dir(*part_info) &&
- check_access(thd, FILE_ACL, NULL, NULL, NULL, FALSE, FALSE))
+ check_access(thd, FILE_ACL, any_db, NULL, NULL, FALSE, FALSE))
{
res= -1;
goto end_with_restore_list;
-/* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 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
else
set_zero_time(&tm, MYSQL_TIMESTAMP_DATETIME);
param->set_time(&tm, MYSQL_TIMESTAMP_DATETIME,
- MAX_DATETIME_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
+ MAX_DATETIME_FULL_WIDTH * MY_CHARSET_BIN_MB_MAXLEN);
*pos+= length;
}
select_distinct && !group_list);
tmp_table_param.hidden_field_count=
tmp_all_fields1.elements - tmp_fields_list1.elements;
-
+ sort_and_group= false;
if (!exec_tmp_table->group && !exec_tmp_table->distinct)
{
// 1st tmp table were materializing join result
uint total_uneven_bit_length= 0;
DBUG_ENTER("mysql_prepare_create_table");
+ LEX_STRING* connect_string = &create_info->connect_string;
+ if (connect_string->length != 0 &&
+ connect_string->length > CONNECT_STRING_MAXLEN &&
+ (system_charset_info->cset->charpos(system_charset_info,
+ connect_string->str,
+ (connect_string->str +
+ connect_string->length),
+ CONNECT_STRING_MAXLEN)
+ < connect_string->length))
+ {
+ my_error(ER_WRONG_STRING_LENGTH, MYF(0),
+ connect_string->str, "CONNECTION", CONNECT_STRING_MAXLEN);
+ DBUG_RETURN(TRUE);
+ }
+
select_field_pos= alter_info->create_list.elements - select_field_count;
null_fields=blob_columns=0;
create_info->varchar= 0;
/**
Setup key-related fields of Field object for given key and key part.
- @param[in] share Pointer to TABLE_SHARE
- @param[in] handler Pointer to handler
- @param[in] primary_key_n Primary key number
- @param[in] keyinfo Pointer to processed key
- @param[in] key_n Processed key number
- @param[in] key_part_n Processed key part number
- @param[in,out] usable_parts Pointer to usable_parts variable
+ @param[in] share Pointer to TABLE_SHARE
+ @param[in] handler_file Pointer to handler
+ @param[in] primary_key_n Primary key number
+ @param[in] keyinfo Pointer to processed key
+ @param[in] key_n Processed key number
+ @param[in] key_part_n Processed key part number
+ @param[in,out] usable_parts Pointer to usable_parts variable
+ @param[in] part_of_key_not_extended Set when column is part of the Key
+ and not appended by the storage
+ engine from primary key columns.
*/
static void setup_key_part_field(TABLE_SHARE *share, handler *handler_file,
uint primary_key_n, KEY *keyinfo, uint key_n,
- uint key_part_n, uint *usable_parts)
+ uint key_part_n, uint *usable_parts,
+ bool part_of_key_not_extended)
{
KEY_PART_INFO *key_part= &keyinfo->key_part[key_part_n];
Field *field= key_part->field;
{
share->keys_for_keyread.set_bit(key_n);
field->part_of_key.set_bit(key_n);
- field->part_of_key_not_clustered.set_bit(key_n);
+ if (part_of_key_not_extended)
+ field->part_of_key_not_extended.set_bit(key_n);
}
if (handler_file->index_flags(key_n, key_part_n, 1) & HA_READ_ORDER)
field->part_of_sortkey.set_bit(key_n);
*current_key_part= *pk_key_part;
setup_key_part_field(share, handler_file, pk_n, sk, sk_n,
- sk->actual_key_parts, usable_parts);
+ sk->actual_key_parts, usable_parts, false);
*current_rec_per_key++= 0;
sk->actual_key_parts++;
sk->unused_key_parts--;
key_part->init_flags();
setup_key_part_field(share, handler_file, primary_key,
- keyinfo, key, i, &usable_parts);
+ keyinfo, key, i, &usable_parts, true);
field->flags|= PART_KEY_FLAG;
if (key == primary_key)
and type)
@retval FALSE OK
- @retval TRUE There was an error. An error message is output
- to the error log. We do not push an error
- message into the error stack because this
- function is currently only called at start up,
- and such errors never reach the user.
+ @retval TRUE There was an error.
*/
bool
if (strncmp(sql_type.c_ptr_safe(), field_def->type.str,
field_def->type.length - 1))
{
- report_error(0, "Incorrect definition of table %s.%s: "
- "expected column '%s' at position %d to have type "
- "%s, found type %s.", table->s->db.str, table->alias,
- field_def->name.str, i, field_def->type.str,
+ report_error(ER_CANNOT_LOAD_FROM_TABLE_V2, "Incorrect definition of "
+ "table %s.%s: expected column '%s' at position %d to "
+ "have type %s, found type %s.", table->s->db.str,
+ table->alias, field_def->name.str, i, field_def->type.str,
sql_type.c_ptr_safe());
error= TRUE;
}
else if (field_def->cset.str && !field->has_charset())
{
- report_error(0, "Incorrect definition of table %s.%s: "
- "expected the type of column '%s' at position %d "
- "to have character set '%s' but the type has no "
- "character set.", table->s->db.str, table->alias,
+ report_error(ER_CANNOT_LOAD_FROM_TABLE_V2, "Incorrect definition of "
+ "table %s.%s: expected the type of column '%s' at "
+ "position %d to have character set '%s' but the type "
+ "has no character set.", table->s->db.str, table->alias,
field_def->name.str, i, field_def->cset.str);
error= TRUE;
}
else if (field_def->cset.str &&
strcmp(field->charset()->csname, field_def->cset.str))
{
- report_error(0, "Incorrect definition of table %s.%s: "
- "expected the type of column '%s' at position %d "
- "to have character set '%s' but found "
+ report_error(ER_CANNOT_LOAD_FROM_TABLE_V2, "Incorrect definition of "
+ "table %s.%s: expected the type of column '%s' at "
+ "position %d to have character set '%s' but found "
"character set '%s'.", table->s->db.str, table->alias,
field_def->name.str, i, field_def->cset.str,
field->charset()->csname);
}
else
{
- report_error(0, "Incorrect definition of table %s.%s: "
- "expected column '%s' at position %d to have type %s "
- " but the column is not found.",
- table->s->db.str, table->alias,
- field_def->name.str, i, field_def->type.str);
+ report_error(ER_CANNOT_LOAD_FROM_TABLE_V2, "Incorrect definition of "
+ "table %s.%s: expected column '%s' at position %d to "
+ "have type %s but the column is not found.",
+ table->s->db.str, table->alias, field_def->name.str, i,
+ field_def->type.str);
error= TRUE;
}
}
--- /dev/null
+/* Copyright (c) 2016, 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 */
+
+#ifndef XA_H_INCLUDED
+#define XA_H_INCLUDED
+
+#include <string.h>
+#include <sys/types.h>
+
+#include "mysqld.h"
+#include "m_string.h"
+#include "my_dbug.h"
+#include "my_global.h"
+#include "sql_cmd.h" // Sql_cmd
+
+typedef ulonglong my_xid; // this line is the same as in log_event.h
+#define XIDDATASIZE 128
+#define MYSQL_XID_PREFIX "MySQLXid"
+#define MYSQL_XID_PREFIX_LEN 8
+#define MYSQL_XID_OFFSET (MYSQL_XID_PREFIX_LEN+sizeof(server_id))
+#define MYSQL_XID_GTRID_LEN (MYSQL_XID_OFFSET+sizeof(my_xid))
+
+/**
+ struct xid_t is binary compatible with the XID structure as
+ in the X/Open CAE Specification, Distributed Transaction Processing:
+ The XA Specification, X/Open Company Ltd., 1991.
+ http://www.opengroup.org/bookstore/catalog/c193.htm
+
+ @see MYSQL_XID in mysql/plugin.h
+*/
+struct xid_t {
+ long formatID;
+ long gtrid_length;
+ long bqual_length;
+ char data[XIDDATASIZE]; // not \0-terminated !
+
+ xid_t() {} /* Remove gcc warning */
+ bool eq(struct xid_t *xid)
+ { return eq(xid->gtrid_length, xid->bqual_length, xid->data); }
+ bool eq(long g, long b, const char *d)
+ { return g == gtrid_length && b == bqual_length && !memcmp(d, data, g+b); }
+ void set(struct xid_t *xid)
+ { memcpy(this, xid, xid->length()); }
+ void set(long f, const char *g, long gl, const char *b, long bl)
+ {
+ formatID= f;
+ memcpy(data, g, gtrid_length= gl);
+ memcpy(data+gl, b, bqual_length= bl);
+ }
+ void set(ulonglong xid)
+ {
+ my_xid tmp;
+ formatID= 1;
+ set(MYSQL_XID_PREFIX_LEN, 0, MYSQL_XID_PREFIX);
+ memcpy(data+MYSQL_XID_PREFIX_LEN, &server_id, sizeof(server_id));
+ tmp= xid;
+ memcpy(data+MYSQL_XID_OFFSET, &tmp, sizeof(tmp));
+ gtrid_length=MYSQL_XID_GTRID_LEN;
+ }
+ void set(long g, long b, const char *d)
+ {
+ formatID= 1;
+ gtrid_length= g;
+ bqual_length= b;
+ memcpy(data, d, g+b);
+ }
+ bool is_null() { return formatID == -1; }
+ void null() { formatID= -1; }
+ my_xid quick_get_my_xid()
+ {
+ my_xid tmp;
+ memcpy(&tmp, data+MYSQL_XID_OFFSET, sizeof(tmp));
+ return tmp;
+ }
+ my_xid get_my_xid()
+ {
+ return gtrid_length == MYSQL_XID_GTRID_LEN && bqual_length == 0 &&
+ !memcmp(data, MYSQL_XID_PREFIX, MYSQL_XID_PREFIX_LEN) ?
+ quick_get_my_xid() : 0;
+ }
+ uint length()
+ {
+ return sizeof(formatID)+sizeof(gtrid_length)+sizeof(bqual_length)+
+ gtrid_length+bqual_length;
+ }
+ uchar *key()
+ {
+ return (uchar *)>rid_length;
+ }
+ uint key_length()
+ {
+ return sizeof(gtrid_length)+sizeof(bqual_length)+gtrid_length+bqual_length;
+ }
+};
+typedef struct xid_t XID;
+#endif
btr_search_sys = (btr_search_sys_t*)
mem_alloc(sizeof(btr_search_sys_t));
- btr_search_sys->hash_index = ha_create(hash_size, 0,
+ btr_search_sys->hash_index = ib_create(hash_size, 0,
MEM_HEAP_FOR_BTR_SEARCH, 0);
#if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
btr_search_sys->hash_index->adaptive = TRUE;
ut_a(srv_n_page_hash_locks != 0);
ut_a(srv_n_page_hash_locks <= MAX_PAGE_HASH_LOCKS);
- buf_pool->page_hash = ha_create(2 * buf_pool->curr_size,
+ buf_pool->page_hash = ib_create(2 * buf_pool->curr_size,
srv_n_page_hash_locks,
MEM_HEAP_FOR_PAGE_HASH,
SYNC_BUF_PAGE_HASH);
/*****************************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 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
void
buf_dblwr_init_or_load_pages(
/*=========================*/
- os_file_t file,
+ pfs_os_file_t file,
char* path,
bool load_corrupt_pages)
{
/*****************************************************************************
-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 the Free Software
void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter
required by os_thread_create */
{
+ my_thread_init();
ut_ad(!srv_read_only_mode);
srv_buf_dump_thread_active = TRUE;
srv_buf_dump_thread_active = FALSE;
+ my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL);
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 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
/*!< in: a dummy parameter required by
os_thread_create */
{
+ my_thread_init();
ulint next_loop_time = ut_time_ms() + 1000;
ulint n_flushed = 0;
ulint last_activity = srv_get_activity_count();
thread_exit:
buf_page_cleaner_is_active = FALSE;
+ my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL);
/*****************************************************************************
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
dberr_t err = DB_SUCCESS;
- if (srv_read_only_mode && !ibuf_is_empty()) {
+ /** If innodb_force_recovery is set to 6 then allow
+ the server to start even though ibuf is not empty. */
+ if (srv_force_recovery != SRV_FORCE_NO_LOG_REDO
+ && srv_read_only_mode && !ibuf_is_empty()) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Change buffer must be empty when --innodb-read-only "
/*****************************************************************************
-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 the Free Software
&& (src_idx = dict_table_get_next_index(src_idx)))) {
if (dict_stats_should_ignore_index(dst_idx)) {
+ if (!(dst_idx->type & DICT_FTS)) {
+ dict_stats_empty_index(dst_idx);
+ }
continue;
}
leaf-level delete marks because delete marks on
non-leaf level do not make sense. */
- if (level == 0 && srv_stats_include_delete_marked? 0:
+ if (level == 0 && (srv_stats_include_delete_marked ? 0:
rec_get_deleted_flag(
rec,
- page_is_comp(btr_pcur_get_page(&pcur)))) {
+ page_is_comp(btr_pcur_get_page(&pcur))))) {
if (rec_is_last_on_page
&& !prev_rec_is_copied
dict_table_stats_lock(table, RW_X_LATCH);
- /* Initialize all stats to dummy values before
- copying because dict_stats_table_clone_create() does
- skip corrupted indexes so our dummy object 't' may
- have less indexes than the real object 'table'. */
- dict_stats_empty_table(table);
-
dict_stats_copy(table, t);
dict_stats_assert_initialized(table);
/*****************************************************************************
-Copyright (c) 2012, 2016, 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 the Free Software
void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter
required by os_thread_create */
{
+ my_thread_init();
ut_a(!srv_read_only_mode);
srv_dict_stats_thread_active = TRUE;
srv_dict_stats_thread_active = FALSE;
+ my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit instead of return(). */
os_thread_exit(NULL);
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 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
belongs */
char* name; /*!< path to the file */
ibool open; /*!< TRUE if file open */
- os_file_t handle; /*!< OS handle to the file, if file open */
+ pfs_os_file_t handle; /*!< OS handle to the file, if file open */
os_event_t sync_event;/*!< Condition event to group and
serialize calls to fsync */
ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw
static fil_system_t* fil_system = NULL;
/** Determine if (i) is a user tablespace id or not. */
-# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
+# define fil_is_user_tablespace_id(i) (i != 0 \
+ && !srv_is_undo_tablespace(i))
/** Determine if user has explicitly disabled fsync(). */
#ifndef __WIN__
const char*
fil_read_first_page(
/*================*/
- os_file_t data_file, /*!< in: open data file */
+ pfs_os_file_t data_file, /*!< in: open data file */
ibool one_read_already, /*!< in: TRUE if min and max
parameters below already
contain sensible data */
/*===============*/
const char* tablename, /*!< in: database/tablename */
char** remote_filepath,/*!< out: remote filepath */
- os_file_t* remote_file) /*!< out: remote file handle */
+ pfs_os_file_t* remote_file) /*!< out: remote file handle */
{
ibool success;
tablespace file in pages,
must be >= FIL_IBD_FILE_INITIAL_SIZE */
{
- os_file_t file;
+ pfs_os_file_t file;
+
ibool ret;
dberr_t err;
byte* buf2;
{
fil_space_t* space;
fil_node_t* node;
- os_file_t file;
+ pfs_os_file_t file;
mutex_enter(&fil_system->mutex);
}
struct fil_iterator_t {
- os_file_t file; /*!< File handle */
+ pfs_os_file_t file; /*!< File handle */
const char* filepath; /*!< File path name */
os_offset_t start; /*!< From where to start */
os_offset_t end; /*!< Where to stop */
PageCallback& callback)
{
dberr_t err;
- os_file_t file;
+ pfs_os_file_t file;
char* filepath;
ut_a(n_io_buffers > 0);
/*****************************************************************************
-Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2000, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
prebuilt->default_rec = table->s->default_values;
ut_ad(prebuilt->default_rec);
+ prebuilt->mysql_handler = this;
+
/* Looks like MySQL-3.23 sometimes has primary key number != 0 */
primary_key = table->s->primary_key;
key_used_on_scan = primary_key;
extension, in contrast to ::create */
normalize_table_name(norm_name, name);
- if (srv_read_only_mode) {
+ if (srv_read_only_mode
+ || srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN) {
DBUG_RETURN(HA_ERR_TABLE_READONLY);
} else if (row_is_magic_monitor_table(norm_name)
&& check_global_access(thd, PROCESS_ACL)) {
/*****************************************************************************
-Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 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
void
buf_dblwr_init_or_load_pages(
/*=========================*/
- os_file_t file,
+ pfs_os_file_t file,
char* path,
bool load_corrupt_pages);
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 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
ibool success; /*!< Has the tablespace been opened? */
const char* check_msg; /*!< fil_check_first_page() message */
ibool valid; /*!< Is the tablespace valid? */
- os_file_t file; /*!< File handle */
+ pfs_os_file_t file; /*!< File handle */
char* filepath; /*!< File path to open */
lsn_t lsn; /*!< Flushed LSN from header page */
ulint id; /*!< Space ID */
const char*
fil_read_first_page(
/*================*/
- os_file_t data_file, /*!< in: open data file */
+ pfs_os_file_t data_file, /*!< in: open data file */
ibool one_read_already, /*!< in: TRUE if min and max
parameters below already
contain sensible data */
Called for every page in the tablespace. If the page was not
updated then its state must be set to BUF_PAGE_NOT_USED. For
compressed tables the page descriptor memory will be at offset:
- block->frame + UNIV_PAGE_SIZE;
+ block->frame + UNIV_PAGE_SIZE;
@param offset - physical offset within the file
@param block - block read from file, note it is not from the buffer pool
@retval DB_SUCCESS or error code. */
virtual dberr_t operator()(
- os_offset_t offset,
+ os_offset_t offset,
buf_block_t* block) UNIV_NOTHROW = 0;
/**
to open it for the file that is being iterated over.
@param filename - then physical name of the tablespace file.
@param file - OS file handle */
- void set_file(const char* filename, os_file_t file) UNIV_NOTHROW
+ void set_file(const char* filename, pfs_os_file_t file) UNIV_NOTHROW
{
m_file = file;
m_filepath = filename;
ulint m_page_size;
/** File handle to the tablespace */
- os_file_t m_file;
+ pfs_os_file_t m_file;
/** Physical file path. */
const char* m_filepath;
/*****************************************************************************
-Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1994, 2016, 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
@param level in: level of the mutexes in the latching order
@param n_m in: number of mutexes to protect the hash table;
must be a power of 2, or 0 */
-# define ha_create(n_c,n_m,type,level) ha_create_func(n_c,level,n_m,type)
+# define ib_create(n_c,n_m,type,level) ha_create_func(n_c,level,n_m,type)
#else /* UNIV_SYNC_DEBUG */
/** Creates a hash table.
@return own: created table
@param level in: level of the mutexes in the latching order
@param n_m in: number of mutexes to protect the hash table;
must be a power of 2, or 0 */
-# define ha_create(n_c,n_m,type,level) ha_create_func(n_c,n_m,type)
+# define ib_create(n_c,n_m,type,level) ha_create_func(n_c,n_m,type)
#endif /* UNIV_SYNC_DEBUG */
/*************************************************************//**
/***********************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
# define OS_FILE_FROM_FD(fd) fd
#endif
+/*Common file descriptor for file IO instrumentation with PFS
+on windows and other platforms */
+struct pfs_os_file_t
+{
+ os_file_t m_file;
+#ifdef UNIV_PFS_IO
+ struct PSI_file *m_psi;
+#endif
+};
+
/** Umask for creating files */
extern ulint os_innodb_umask;
various file I/O operations with performance schema.
1) register_pfs_file_open_begin() and register_pfs_file_open_end() are
used to register file creation, opening, closing and renaming.
+2) register_pfs_file_rename_begin() and register_pfs_file_rename_end()
+are used to register file renaming
2) register_pfs_file_io_begin() and register_pfs_file_io_end() are
used to register actual file read, write and flush
3) register_pfs_file_close_begin() and register_pfs_file_close_end()
do { \
locker = PSI_FILE_CALL(get_thread_file_name_locker)( \
state, key, op, name, &locker); \
- if (UNIV_LIKELY(locker != NULL)) { \
+ if (locker != NULL) { \
PSI_FILE_CALL(start_file_open_wait)( \
locker, src_file, src_line); \
} \
} while (0)
-# define register_pfs_file_open_end(locker, file) \
+# define register_pfs_file_open_end(locker, file, result) \
do { \
- if (UNIV_LIKELY(locker != NULL)) { \
- PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(\
- locker, file); \
+ if (locker != NULL) { \
+ file.m_psi = PSI_FILE_CALL( \
+ end_file_open_wait)( \
+ locker, result); \
+ } \
+} while (0)
+
+# define register_pfs_file_rename_begin(state, locker, key, op, name, \
+ src_file, src_line) \
+ register_pfs_file_open_begin(state, locker, key, op, name, \
+ src_file, src_line) \
+
+# define register_pfs_file_rename_end(locker, result) \
+do { \
+ if (locker != NULL) { \
+ PSI_FILE_CALL(end_file_open_wait)(locker, result); \
} \
} while (0)
# define register_pfs_file_io_begin(state, locker, file, count, op, \
src_file, src_line) \
do { \
- locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)( \
- state, file, op); \
- if (UNIV_LIKELY(locker != NULL)) { \
+ locker = PSI_FILE_CALL(get_thread_file_stream_locker)( \
+ state, file.m_psi, op); \
+ if (locker != NULL) { \
PSI_FILE_CALL(start_file_wait)( \
locker, count, src_file, src_line); \
} \
# define register_pfs_file_io_end(locker, count) \
do { \
- if (UNIV_LIKELY(locker != NULL)) { \
+ if (locker != NULL) { \
PSI_FILE_CALL(end_file_wait)(locker, count); \
} \
} while (0)
os_aio
os_file_read
os_file_read_no_error_handling
+os_file_read_no_error_handling_int_fd
os_file_write
+os_file_write_int_fd
The wrapper functions have the prefix of "innodb_". */
pfs_os_file_create_simple_no_error_handling_func( \
key, name, create_mode, access, success, __FILE__, __LINE__)
-# define os_file_close(file) \
+# define os_file_close_pfs(file) \
pfs_os_file_close_func(file, __FILE__, __LINE__)
# define os_aio(type, mode, name, file, buf, offset, \
pfs_os_aio_func(type, mode, name, file, buf, offset, \
n, message1, message2, __FILE__, __LINE__)
-# define os_file_read(file, buf, offset, n) \
+# define os_file_read_pfs(file, buf, offset, n) \
pfs_os_file_read_func(file, buf, offset, n, __FILE__, __LINE__)
# define os_file_read_no_error_handling(file, buf, offset, n) \
pfs_os_file_read_no_error_handling_func(file, buf, offset, n, \
__FILE__, __LINE__)
-# define os_file_write(name, file, buf, offset, n) \
+# define os_file_read_no_error_handling_int_fd( \
+ file, buf, offset, n) \
+ pfs_os_file_read_no_error_handling_int_fd_func( \
+ file, buf, offset, n, __FILE__, __LINE__)
+
+# define os_file_write_pfs(name, file, buf, offset, n) \
pfs_os_file_write_func(name, file, buf, offset, \
n, __FILE__, __LINE__)
-# define os_file_flush(file) \
+# define os_file_write_int_fd(name, file, buf, offset, n) \
+ pfs_os_file_write_int_fd_func(name, file, buf, offset, \
+ n, __FILE__, __LINE__)
+
+# define os_file_flush_pfs(file) \
pfs_os_file_flush_func(file, __FILE__, __LINE__)
# define os_file_rename(key, oldpath, newpath) \
os_file_create_simple_no_error_handling_func( \
name, create_mode, access, success)
-# define os_file_close(file) os_file_close_func(file)
+# define os_file_close_pfs(file) \
+ os_file_close_func(file)
# define os_aio(type, mode, name, file, buf, offset, n, message1, message2) \
os_aio_func(type, mode, name, file, buf, offset, n, \
message1, message2)
-# define os_file_read(file, buf, offset, n) \
+# define os_file_read_pfs(file, buf, offset, n) \
os_file_read_func(file, buf, offset, n)
# define os_file_read_no_error_handling(file, buf, offset, n) \
os_file_read_no_error_handling_func(file, buf, offset, n)
+# define os_file_read_no_error_handling_int_fd( \
+ file, buf, offset, n) \
+ os_file_read_no_error_handling_func(file, buf, offset, n)
-# define os_file_write(name, file, buf, offset, n) \
+# define os_file_write_int_fd(name, file, buf, offset, n) \
+ os_file_write_func(name, file, buf, offset, n)
+# define os_file_write_pfs(name, file, buf, offset, n) \
os_file_write_func(name, file, buf, offset, n)
-# define os_file_flush(file) os_file_flush_func(file)
+
+# define os_file_flush_pfs(file) os_file_flush_func(file)
# define os_file_rename(key, oldpath, newpath) \
os_file_rename_func(oldpath, newpath)
#endif /* UNIV_PFS_IO */
+#ifdef UNIV_PFS_IO
+ #define os_file_close(file) os_file_close_pfs(file)
+#else
+ #define os_file_close(file) os_file_close_pfs((file).m_file)
+#endif
+
+#ifdef UNIV_PFS_IO
+ #define os_file_read(file, buf, offset, n) \
+ os_file_read_pfs(file, buf, offset, n)
+#else
+ #define os_file_read(file, buf, offset, n) \
+ os_file_read_pfs(file.m_file, buf, offset, n)
+#endif
+
+#ifdef UNIV_PFS_IO
+ #define os_file_flush(file) os_file_flush_pfs(file)
+#else
+ #define os_file_flush(file) os_file_flush_pfs(file.m_file)
+#endif
+
+#ifdef UNIV_PFS_IO
+ #define os_file_write(name, file, buf, offset, n) \
+ os_file_write_pfs(name, file, buf, offset, n)
+#else
+ #define os_file_write(name, file, buf, offset, n) \
+ os_file_write_pfs(name, file.m_file, buf, offset, n)
+#endif
/* File types for directory entry data type */
enum os_file_type_t {
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
-os_file_t
+pfs_os_file_t
os_file_create_simple_no_error_handling_func(
/*=========================================*/
const char* name, /*!< in: name of the file or path as a
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
-os_file_t
+pfs_os_file_t
os_file_create_func(
/*================*/
const char* name, /*!< in: name of the file or path as a
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INLINE
-os_file_t
+pfs_os_file_t
pfs_os_file_create_simple_func(
/*===========================*/
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INLINE
-os_file_t
+pfs_os_file_t
pfs_os_file_create_simple_no_error_handling_func(
/*=============================================*/
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INLINE
-os_file_t
+pfs_os_file_t
pfs_os_file_create_func(
/*====================*/
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
ibool
pfs_os_file_close_func(
/*===================*/
- os_file_t file, /*!< in, own: handle to a file */
+ pfs_os_file_t file, /*!< in, own: handle to a file */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
/*******************************************************************//**
ibool
pfs_os_file_read_func(
/*==================*/
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
os_offset_t offset, /*!< in: file offset where to read */
ulint n, /*!< in: number of bytes to read */
ibool
pfs_os_file_read_no_error_handling_func(
/*====================================*/
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
os_offset_t offset, /*!< in: file offset where to read */
ulint n, /*!< in: number of bytes to read */
ulint mode, /*!< in: OS_AIO_NORMAL etc. I/O mode */
const char* name, /*!< in: name of the file or path as a
null-terminated string */
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read or from which
to write */
os_offset_t offset, /*!< in: file offset where to read or write */
/*===================*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
const void* buf, /*!< in: buffer from which to write */
os_offset_t offset, /*!< in: file offset where to write */
ulint n, /*!< in: number of bytes to write */
ibool
pfs_os_file_flush_func(
/*===================*/
- os_file_t file, /*!< in, own: handle to a file */
+ pfs_os_file_t file, /*!< in, own: handle to a file */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line);/*!< in: line where the func invoked */
os_offset_t
os_file_get_size(
/*=============*/
- os_file_t file) /*!< in: handle to a file */
+ pfs_os_file_t file) /*!< in: handle to a file */
MY_ATTRIBUTE((warn_unused_result));
/***********************************************************************//**
Write the specified number of zeros to a newly created file.
/*=============*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
os_offset_t size) /*!< in: file size */
MY_ATTRIBUTE((nonnull, warn_unused_result));
/***********************************************************************//**
caution! */
const char* name, /*!< in: name of the file or path as a
null-terminated string */
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read or from which
to write */
os_offset_t offset, /*!< in: file offset where to read or write */
/*****************************************************************************
-Copyright (c) 2010, 2011, 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 the Free Software
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INLINE
-os_file_t
+pfs_os_file_t
pfs_os_file_create_simple_func(
/*===========================*/
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
{
- os_file_t file;
+ pfs_os_file_t file;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
: PSI_FILE_OPEN),
name, src_file, src_line);
- file = os_file_create_simple_func(name, create_mode,
+ file.m_file = os_file_create_simple_func(name, create_mode,
access_type, success);
+ file.m_psi = NULL;
- /* Regsiter the returning "file" value with the system */
- register_pfs_file_open_end(locker, file);
+ /* Regsiter psi value for the file */
+ register_pfs_file_open_end(locker, file,
+ (*success == TRUE ? success : 0));
return(file);
}
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INLINE
-os_file_t
+pfs_os_file_t
pfs_os_file_create_simple_no_error_handling_func(
/*=============================================*/
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
{
- os_file_t file;
+ pfs_os_file_t file;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
file = os_file_create_simple_no_error_handling_func(
name, create_mode, access_type, success);
+ file.m_psi = NULL;
- register_pfs_file_open_end(locker, file);
+ register_pfs_file_open_end(locker, file,
+ (*success == TRUE ? success : 0));
return(file);
}
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INLINE
-os_file_t
+pfs_os_file_t
pfs_os_file_create_func(
/*====================*/
mysql_pfs_key_t key, /*!< in: Performance Schema Key */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
{
- os_file_t file;
+ pfs_os_file_t file;
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
name, src_file, src_line);
file = os_file_create_func(name, create_mode, purpose, type, success);
+ file.m_psi = NULL;
- register_pfs_file_open_end(locker, file);
+ register_pfs_file_open_end(locker, file,
+ (*success == TRUE ? success : 0));
return(file);
}
ibool
pfs_os_file_close_func(
/*===================*/
- os_file_t file, /*!< in, own: handle to a file */
+ pfs_os_file_t file, /*!< in, own: handle to a file */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
{
register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_CLOSE,
src_file, src_line);
- result = os_file_close_func(file);
+ result = os_file_close_func(file.m_file);
register_pfs_file_io_end(locker, 0);
ulint mode, /*!< in: OS_AIO_NORMAL etc. I/O mode */
const char* name, /*!< in: name of the file or path as a
null-terminated string */
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read or from which
to write */
os_offset_t offset, /*!< in: file offset where to read or write */
ibool
pfs_os_file_read_func(
/*==================*/
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
os_offset_t offset, /*!< in: file offset where to read */
ulint n, /*!< in: number of bytes to read */
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
src_file, src_line);
- result = os_file_read_func(file, buf, offset, n);
+ result = os_file_read_func(file.m_file, buf, offset, n);
register_pfs_file_io_end(locker, n);
ibool
pfs_os_file_read_no_error_handling_func(
/*====================================*/
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read */
os_offset_t offset, /*!< in: file offset where to read */
ulint n, /*!< in: number of bytes to read */
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_READ,
src_file, src_line);
- result = os_file_read_no_error_handling_func(file, buf, offset, n);
+ result = os_file_read_no_error_handling_func(file.m_file, buf, offset, n);
register_pfs_file_io_end(locker, n);
return(result);
}
+/** NOTE! Please use the corresponding macro
+os_file_read_no_error_handling_int_fd(), not directly this function!
+This is the performance schema instrumented wrapper function for
+os_file_read_no_error_handling_int_fd_func() which requests a
+synchronous read operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_read_no_error_handling_int_fd_func(
+ int file, /*!< in: handle to a file */
+ void* buf, /*!< in: buffer where to read */
+ os_offset_t offset, /*!< in: file offset where to read */
+ ulint n, /*!< in: number of bytes to read */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+
+ PSI_file_locker_state state;
+ struct PSI_file_locker* locker = NULL;
+
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(
+ &state, file, PSI_FILE_READ);
+ if (locker != NULL) {
+ PSI_FILE_CALL(start_file_wait)(
+ locker, n,
+ __FILE__, __LINE__);
+ }
+ ibool result = os_file_read_no_error_handling_func(
+ OS_FILE_FROM_FD(file), buf, offset, n);
+
+ if (locker != NULL) {
+ PSI_FILE_CALL(end_file_wait)(locker, n);
+ }
+
+ return(result);
+}
+
/*******************************************************************//**
NOTE! Please use the corresponding macro os_file_write(), not directly
this function!
/*===================*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
const void* buf, /*!< in: buffer from which to write */
os_offset_t offset, /*!< in: file offset where to write */
ulint n, /*!< in: number of bytes to write */
register_pfs_file_io_begin(&state, locker, file, n, PSI_FILE_WRITE,
src_file, src_line);
- result = os_file_write_func(name, file, buf, offset, n);
+ result = os_file_write_func(name, file.m_file, buf, offset, n);
register_pfs_file_io_end(locker, n);
return(result);
}
+/** NOTE! Please use the corresponding macro os_file_write(), not
+directly this function!
+This is the performance schema instrumented wrapper function for
+os_file_write() which requests a synchronous write operation.
+@return TRUE if request was successful, FALSE if fail */
+UNIV_INLINE
+ibool
+pfs_os_file_write_int_fd_func(
+ const char* name, /*!< in: name of the file or path as a
+ null-terminated string */
+ int file, /*!< in: handle to a file */
+ const void* buf, /*!< in: buffer from which to write */
+ os_offset_t offset, /*!< in: file offset where to write */
+ ulint n, /*!< in: number of bytes to write */
+ const char* src_file,/*!< in: file name where func invoked */
+ ulint src_line)/*!< in: line where the func invoked */
+{
+ PSI_file_locker_state state;
+ struct PSI_file_locker* locker = NULL;
+
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(
+ &state, file, PSI_FILE_WRITE);
+ if (locker != NULL) {
+ PSI_FILE_CALL(start_file_wait)(
+ locker, n,
+ __FILE__, __LINE__);
+ }
+ ibool result = os_file_write_func(
+ name, OS_FILE_FROM_FD(file), buf, offset, n);
+
+ if (locker != NULL) {
+ PSI_FILE_CALL(end_file_wait)(locker, n);
+ }
+
+ return(result);
+}
+
/***********************************************************************//**
NOTE! Please use the corresponding macro os_file_flush(), not directly
this function!
ibool
pfs_os_file_flush_func(
/*===================*/
- os_file_t file, /*!< in, own: handle to a file */
+ pfs_os_file_t file, /*!< in, own: handle to a file */
const char* src_file,/*!< in: file name where func invoked */
ulint src_line)/*!< in: line where the func invoked */
{
register_pfs_file_io_begin(&state, locker, file, 0, PSI_FILE_SYNC,
src_file, src_line);
- result = os_file_flush_func(file);
+ result = os_file_flush_func(file.m_file);
register_pfs_file_io_end(locker, 0);
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
- register_pfs_file_open_begin(&state, locker, key, PSI_FILE_RENAME, newpath,
+ register_pfs_file_rename_begin(&state, locker, key, PSI_FILE_RENAME, newpath,
src_file, src_line);
result = os_file_rename_func(oldpath, newpath);
- register_pfs_file_open_end(locker, 0);
+ register_pfs_file_rename_end(locker, 0);
return(result);
}
#define ROW_PREBUILT_ALLOCATED 78540783
#define ROW_PREBUILT_FREED 26423527
+class ha_innobase;
+
/** A struct for (sometimes lazily) prebuilt structures in an Innobase table
handle used within MySQL; these are used to save CPU time. */
to InnoDB format.*/
uint srch_key_val_len; /*!< Size of search key */
+ /** MySQL handler object. */
+ ha_innobase* mysql_handler;
+
+ /** True if exceeded the end_range while filling the prefetch cache. */
+ bool end_range;
+
};
/** Callback for row_mysql_sys_index_iterate() */
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, 2009, Google Inc.
Copyright (c) 2009, Percona Inc.
srv_purge_wakeup(void);
/*==================*/
+/** Check whether given space id is undo tablespace id
+@param[in] space_id space id to check
+@return true if it is undo tablespace else false. */
+bool
+srv_is_undo_tablespace(
+ ulint space_id);
+
/** Status variables to be passed to MySQL */
struct export_var_t{
ulint innodb_data_pending_reads; /*!< Pending reads */
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 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
/** TRUE if a raw partition is in use */
extern ibool srv_start_raw_disk_in_use;
+/** Undo tablespaces starts with space_id. */
+extern ulint srv_undo_space_id_start;
/** Shutdown state */
enum srv_shutdown_state {
/*****************************************************************************
-Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2016, 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
#ifndef XA_H
#define XA_H
+#include "xa.h"
+
/*
* Transaction branch identification: XID and NULLXID:
*/
#define MAXGTRIDSIZE 64 /*!< maximum size in bytes of gtrid */
#define MAXBQUALSIZE 64 /*!< maximum size in bytes of bqual */
-/** X/Open XA distributed transaction identifier */
-struct xid_t {
- long formatID; /*!< format identifier; -1
- means that the XID is null */
- long gtrid_length; /*!< value from 1 through 64 */
- long bqual_length; /*!< value from 1 through 64 */
- char data[XIDDATASIZE]; /*!< distributed transaction
- identifier */
-};
-/** X/Open XA distributed transaction identifier */
-typedef struct xid_t XID;
#endif
/** X/Open XA distributed transaction status codes */
/* @{ */
#if defined HAVE_PSI_INTERFACE && !defined UNIV_HOTBACKUP
# define UNIV_PFS_MUTEX
# define UNIV_PFS_RWLOCK
-/* For I/O instrumentation, performance schema rely
-on a native descriptor to identify the file, this
-descriptor could conflict with our OS level descriptor.
-Disable IO instrumentation on Windows until this is
-resolved */
-# ifndef __WIN__
-# define UNIV_PFS_IO
-# endif
+
+# define UNIV_PFS_IO
# define UNIV_PFS_THREAD
/* There are mutexes/rwlocks that we want to exclude from
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Google Inc.
Portions of this file contain modifications contributed and copyrighted by
lsn = log_sys->lsn;
- if (lsn != log_sys->last_checkpoint_lsn
+ const bool is_last = ((srv_force_recovery == SRV_FORCE_NO_LOG_REDO
+ && lsn == log_sys->last_checkpoint_lsn
+ + LOG_BLOCK_HDR_SIZE)
+ || lsn == log_sys->last_checkpoint_lsn);
+
+ if (!is_last
#ifdef UNIV_LOG_ARCHIVE
|| (srv_log_archive_on
&& lsn != log_sys->archived_lsn + LOG_BLOCK_HDR_SIZE)
/*****************************************************************************
-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) 2012, Facebook Inc.
This program is free software; you can redistribute it and/or modify it under
/*!< in: a dummy parameter required by
os_thread_create */
{
+ my_thread_init();
ut_ad(!srv_read_only_mode);
#ifdef UNIV_PFS_THREAD
recv_writer_thread_active = false;
+ my_thread_end();
/* We count the number of threads in os_thread_exit().
A created thread should always use that to exit and not
use return() to exit. */
/***********************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Portions of this file contain modifications contributed and copyrighted
byte* buf; /*!< buffer used in i/o */
ulint type; /*!< OS_FILE_READ or OS_FILE_WRITE */
os_offset_t offset; /*!< file offset in bytes */
- os_file_t file; /*!< file where to read or write */
+ pfs_os_file_t file; /*!< file where to read or write */
const char* name; /*!< file name or path */
ibool io_already_done;/*!< used only in simulated aio:
TRUE if the physical i/o already
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
-os_file_t
+pfs_os_file_t
os_file_create_simple_no_error_handling_func(
/*=========================================*/
const char* name, /*!< in: name of the file or path as a
used by a backup program reading the file */
ibool* success)/*!< out: TRUE if succeed, FALSE if error */
{
- os_file_t file;
+ pfs_os_file_t file;
*success = FALSE;
#ifdef __WIN__
DWORD create_flag;
DWORD attributes = 0;
DWORD share_mode = FILE_SHARE_READ;
-
ut_a(name);
ut_a(!(create_mode & OS_FILE_ON_ERROR_SILENT));
ib_logf(IB_LOG_LEVEL_ERROR,
"Unknown file create mode (%lu) for file '%s'",
create_mode, name);
-
- return((os_file_t) -1);
+ file.m_file = (os_file_t)-1;
+ return(file);
}
if (access_type == OS_FILE_READ_ONLY) {
ib_logf(IB_LOG_LEVEL_ERROR,
"Unknown file access type (%lu) for file '%s'",
access_type, name);
-
- return((os_file_t) -1);
+ file.m_file = (os_file_t)-1;
+ return(file);
}
- file = CreateFile((LPCTSTR) name,
+ file.m_file = CreateFile((LPCTSTR) name,
access,
share_mode,
NULL, // Security attributes
attributes,
NULL); // No template file
- *success = (file != INVALID_HANDLE_VALUE);
+ *success = (file.m_file != INVALID_HANDLE_VALUE);
#else /* __WIN__ */
int create_flag;
const char* mode_str = NULL;
-
ut_a(name);
if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW)
WAIT_ALLOW_WRITES();
ib_logf(IB_LOG_LEVEL_ERROR,
"Unknown file create mode (%lu) for file '%s'",
create_mode, name);
-
- return((os_file_t) -1);
+ file.m_file = -1;
+ return(file);
}
- file = ::open(name, create_flag, os_innodb_umask);
+ file.m_file = ::open(name, create_flag, os_innodb_umask);
- *success = file == -1 ? FALSE : TRUE;
+ *success = file.m_file == -1 ? FALSE : TRUE;
/* This function is always called for data files, we should disable
OS caching (O_DIRECT) here as we do in os_file_create_func(), so
&& (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
|| srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
- os_file_set_nocache(file, name, mode_str);
+ os_file_set_nocache(file.m_file, name, mode_str);
}
#ifdef USE_FILE_LOCK
if (!srv_read_only_mode
&& *success
&& access_type == OS_FILE_READ_WRITE
- && os_file_lock(file, name)) {
+ && os_file_lock(file.m_file, name)) {
*success = FALSE;
- close(file);
- file = -1;
+ close(file.m_file);
+ file.m_file = -1;
}
#endif /* USE_FILE_LOCK */
@return own: handle to the file, not defined if error, error number
can be retrieved with os_file_get_last_error */
UNIV_INTERN
-os_file_t
+pfs_os_file_t
os_file_create_func(
/*================*/
const char* name, /*!< in: name of the file or path as a
ulint type, /*!< in: OS_DATA_FILE or OS_LOG_FILE */
ibool* success)/*!< out: TRUE if succeed, FALSE if error */
{
- os_file_t file;
+ pfs_os_file_t file;
ibool retry;
ibool on_error_no_exit;
ibool on_error_silent;
-
#ifdef __WIN__
DBUG_EXECUTE_IF(
"ib_create_table_fail_disk_full",
*success = FALSE;
SetLastError(ERROR_DISK_FULL);
- return((os_file_t) -1);
+ file.m_file = (os_file_t)-1;
+ return(file);
);
#else /* __WIN__ */
DBUG_EXECUTE_IF(
"ib_create_table_fail_disk_full",
*success = FALSE;
errno = ENOSPC;
- return((os_file_t) -1);
+ file.m_file = -1;
+ return(file);
);
#endif /* __WIN__ */
"Unknown file create mode (%lu) for file '%s'",
create_mode, name);
- return((os_file_t) -1);
+ file.m_file = (os_file_t)-1;
+ return(file);
}
DWORD attributes = 0;
ib_logf(IB_LOG_LEVEL_ERROR,
"Unknown purpose flag (%lu) while opening file '%s'",
purpose, name);
-
- return((os_file_t)(-1));
+ file.m_file = (os_file_t)-1;
+ return(file);
}
#ifdef UNIV_NON_BUFFERED_IO
do {
/* Use default security attributes and no template file. */
- file = CreateFile(
+ file.m_file = CreateFile(
(LPCTSTR) name, access, share_mode, NULL,
create_flag, attributes, NULL);
- if (file == INVALID_HANDLE_VALUE) {
+ if (file.m_file == INVALID_HANDLE_VALUE) {
const char* operation;
operation = (create_mode == OS_FILE_CREATE
#else /* __WIN__ */
int create_flag;
const char* mode_str = NULL;
- if (create_mode != OS_FILE_OPEN && create_mode != OS_FILE_OPEN_RAW)
- WAIT_ALLOW_WRITES();
-
on_error_no_exit = create_mode & OS_FILE_ON_ERROR_NO_EXIT
? TRUE : FALSE;
on_error_silent = create_mode & OS_FILE_ON_ERROR_SILENT
"Unknown file create mode (%lu) for file '%s'",
create_mode, name);
- return((os_file_t) -1);
+ file.m_file = -1;
+ return(file);
}
ut_a(type == OS_LOG_FILE || type == OS_DATA_FILE);
#endif /* O_SYNC */
do {
- file = ::open(name, create_flag, os_innodb_umask);
+ file.m_file = ::open(name, create_flag, os_innodb_umask);
- if (file == -1) {
+ if (file.m_file == -1) {
const char* operation;
operation = (create_mode == OS_FILE_CREATE
&& (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
|| srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
- os_file_set_nocache(file, name, mode_str);
+ os_file_set_nocache(file.m_file, name, mode_str);
}
#ifdef USE_FILE_LOCK
if (!srv_read_only_mode
&& *success
&& create_mode != OS_FILE_OPEN_RAW
- && os_file_lock(file, name)) {
+ && os_file_lock(file.m_file, name)) {
if (create_mode == OS_FILE_OPEN_RETRY) {
for (int i = 0; i < 100; i++) {
os_thread_sleep(1000000);
- if (!os_file_lock(file, name)) {
+ if (!os_file_lock(file.m_file, name)) {
*success = TRUE;
return(file);
}
}
*success = FALSE;
- close(file);
- file = -1;
+ close(file.m_file);
+ file.m_file = -1;
}
#endif /* USE_FILE_LOCK */
os_offset_t
os_file_get_size(
/*=============*/
- os_file_t file) /*!< in: handle to a file */
+ pfs_os_file_t file) /*!< in: handle to a file */
{
#ifdef __WIN__
os_offset_t offset;
DWORD high;
DWORD low;
- low = GetFileSize(file, &high);
+ low = GetFileSize(file.m_file, &high);
if ((low == 0xFFFFFFFF) && (GetLastError() != NO_ERROR)) {
return((os_offset_t) -1);
return(offset);
#else
- return((os_offset_t) lseek(file, 0, SEEK_END));
+ return((os_offset_t) lseek(file.m_file, 0, SEEK_END));
+
#endif /* __WIN__ */
}
/*=============*/
const char* name, /*!< in: name of the file or path as a
null-terminated string */
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
os_offset_t size) /*!< in: file size */
{
os_offset_t current_size;
the aio operation */
void* message2,/*!< in: message to be passed along with
the aio operation */
- os_file_t file, /*!< in: file handle */
+ pfs_os_file_t file, /*!< in: file handle */
const char* name, /*!< in: name of the file or path as a
null-terminated string */
void* buf, /*!< in: buffer where to read or from which
iocb = &slot->control;
if (type == OS_FILE_READ) {
- io_prep_pread(iocb, file, buf, len, aio_offset);
+ io_prep_pread(iocb, file.m_file, buf, len, aio_offset);
} else {
ut_a(type == OS_FILE_WRITE);
- io_prep_pwrite(iocb, file, buf, len, aio_offset);
+ io_prep_pwrite(iocb, file.m_file, buf, len, aio_offset);
}
iocb->data = (void*) slot;
caution! */
const char* name, /*!< in: name of the file or path as a
null-terminated string */
- os_file_t file, /*!< in: handle to a file */
+ pfs_os_file_t file, /*!< in: handle to a file */
void* buf, /*!< in: buffer where to read or from which
to write */
os_offset_t offset, /*!< in: file offset where to read or write */
ulint dummy_type;
#endif /* WIN_ASYNC_IO */
ulint wake_later;
-
- ut_ad(file);
+ ut_ad(file.m_file);
ut_ad(buf);
ut_ad(n > 0);
ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0);
and os_file_write_func() */
if (type == OS_FILE_READ) {
- return(os_file_read_func(file, buf, offset, n));
+ return(os_file_read_func(file.m_file, buf, offset, n));
}
-
ut_ad(!srv_read_only_mode);
ut_a(type == OS_FILE_WRITE);
-
- return(os_file_write_func(name, file, buf, offset, n));
+ return(os_file_write_func(name, file.m_file, buf, offset, n));
}
try_again:
os_n_file_reads++;
os_bytes_read_since_printout += n;
#ifdef WIN_ASYNC_IO
- ret = ReadFile(file, buf, (DWORD) n, &len,
+ ret = ReadFile(file.m_file, buf, (DWORD) n, &len,
&(slot->control));
-
#elif defined(LINUX_NATIVE_AIO)
if (!os_aio_linux_dispatch(array, slot)) {
goto err_exit;
if (srv_use_native_aio) {
os_n_file_writes++;
#ifdef WIN_ASYNC_IO
- ret = WriteFile(file, buf, (DWORD) n, &len,
+ ret = WriteFile(file.m_file, buf, (DWORD) n, &len,
&(slot->control));
-
#elif defined(LINUX_NATIVE_AIO)
if (!os_aio_linux_dispatch(array, slot)) {
goto err_exit;
srv_set_io_thread_op_info(
orig_seg, "get windows aio return value");
}
-
- ret = GetOverlappedResult(slot->file, &(slot->control), &len, TRUE);
+ ret = GetOverlappedResult(slot->file.m_file, &(slot->control), &len, TRUE);
*message1 = slot->message1;
*message2 = slot->message2;
and os_file_write APIs, need to register with
performance schema explicitly here. */
struct PSI_file_locker* locker = NULL;
- register_pfs_file_io_begin(locker, slot->file, slot->len,
+ PSI_file_locker_state state;
+ register_pfs_file_io_begin(&state, locker, slot->file, slot->len,
(slot->type == OS_FILE_WRITE)
? PSI_FILE_WRITE
: PSI_FILE_READ,
switch (slot->type) {
case OS_FILE_WRITE:
- ret = WriteFile(slot->file, slot->buf,
+ ret = WriteFile(slot->file.m_file, slot->buf,
(DWORD) slot->len, &len,
&(slot->control));
-
break;
case OS_FILE_READ:
- ret = ReadFile(slot->file, slot->buf,
+ ret = ReadFile(slot->file.m_file, slot->buf,
(DWORD) slot->len, &len,
&(slot->control));
-
break;
default:
ut_error;
file where we also use async i/o: in Windows
we must use the same wait mechanism as for
async i/o */
-
- ret = GetOverlappedResult(slot->file,
+ ret = GetOverlappedResult(slot->file.m_file,
&(slot->control),
&len, TRUE);
}
os_aio_slot_t* slot;
slot = os_aio_array_get_nth_slot(array, i + segment * n);
-
if (slot->reserved
&& slot != aio_slot
&& slot->offset == aio_slot->offset + aio_slot->len
&& slot->type == aio_slot->type
- && slot->file == aio_slot->file) {
+ && slot->file.m_file == aio_slot->file.m_file) {
/* Found a consecutive i/o request */
goto err_exit;
}
- ret = os_file_write(
+ ret = os_file_write_int_fd(
"(modification log)",
- OS_FILE_FROM_FD(log->fd),
+ log->fd,
log->tail.block, byte_offset, srv_sort_buf_size);
log->tail.blocks++;
if (!ret) {
goto err_exit;
}
- ret = os_file_write(
+ ret = os_file_write_int_fd(
"(modification log)",
- OS_FILE_FROM_FD(log->fd),
+ log->fd,
log->tail.block, byte_offset, srv_sort_buf_size);
log->tail.blocks++;
if (!ret) {
goto func_exit;
}
- success = os_file_read_no_error_handling(
- OS_FILE_FROM_FD(index->online_log->fd),
+ success = os_file_read_no_error_handling_int_fd(
+ index->online_log->fd,
index->online_log->head.block, ofs,
srv_sort_buf_size);
-
if (!success) {
fprintf(stderr, "InnoDB: unable to read temporary file"
" for table %s\n", index->table_name);
goto func_exit;
}
- success = os_file_read_no_error_handling(
- OS_FILE_FROM_FD(index->online_log->fd),
+ success = os_file_read_no_error_handling_int_fd(
+ index->online_log->fd,
index->online_log->head.block, ofs,
srv_sort_buf_size);
}
#endif /* UNIV_DEBUG */
- success = os_file_read_no_error_handling(OS_FILE_FROM_FD(fd), buf,
+ success = os_file_read_no_error_handling_int_fd(fd, buf,
ofs, srv_sort_buf_size);
+
#ifdef POSIX_FADV_DONTNEED
/* Each block is read exactly once. Free up the file cache. */
posix_fadvise(fd, ofs, srv_sort_buf_size, POSIX_FADV_DONTNEED);
DBUG_EXECUTE_IF("row_merge_write_failure", return(FALSE););
- ret = os_file_write("(merge)", OS_FILE_FROM_FD(fd), buf, ofs, buf_len);
+ ret = os_file_write_int_fd("(merge)", fd, buf, ofs, buf_len);
#ifdef UNIV_DEBUG
if (row_merge_print_block_write) {
performance schema */
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
- register_pfs_file_open_begin(&state, locker, innodb_file_temp_key,
- PSI_FILE_OPEN,
- "Innodb Merge Temp File",
- __FILE__, __LINE__);
+ locker = PSI_FILE_CALL(get_thread_file_name_locker)(
+ &state, innodb_file_temp_key, PSI_FILE_OPEN,
+ "Innodb Merge Temp File", &locker);
+ if (locker != NULL) {
+ PSI_FILE_CALL(start_file_open_wait)(locker,
+ __FILE__,
+ __LINE__);
+ }
#endif
fd = innobase_mysql_tmpfile(path);
#ifdef UNIV_PFS_IO
- register_pfs_file_open_end(locker, fd);
+ if (locker != NULL) {
+ PSI_FILE_CALL(end_file_open_wait_and_bind_to_descriptor)(
+ locker, fd);
+ }
#endif
if (fd < 0) {
#ifdef UNIV_PFS_IO
struct PSI_file_locker* locker = NULL;
PSI_file_locker_state state;
- register_pfs_file_io_begin(&state, locker,
- fd, 0, PSI_FILE_CLOSE,
- __FILE__, __LINE__);
+ locker = PSI_FILE_CALL(get_thread_file_descriptor_locker)(
+ &state, fd, PSI_FILE_CLOSE);
+ if (locker != NULL) {
+ PSI_FILE_CALL(start_file_wait)(
+ locker, 0, __FILE__, __LINE__);
+ }
#endif
if (fd >= 0) {
close(fd);
}
#ifdef UNIV_PFS_IO
- register_pfs_file_io_end(locker, 0);
+ if (locker != NULL) {
+ PSI_FILE_CALL(end_file_wait)(locker, 0);
+ }
#endif
}
/*********************************************************************//**
#include "my_sys.h" /* DEBUG_SYNC_C */
#include "my_compare.h" /* enum icp_result */
+#include "thr_lock.h"
+#include "handler.h"
+#include "ha_innodb.h"
/* Maximum number of rows to prefetch; MySQL interface has another parameter */
#define SEL_MAX_N_PREFETCH 16
#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) \
- row_sel_store_mysql_field_func(m,p,r,i,o,f,t)
+# 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)
#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) \
- row_sel_store_mysql_field_func(m,p,r,o,f,t)
+# 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)
#endif /* UNIV_DEBUG */
-/**************************************************************//**
-Convert a field in the Innobase format to a field in the MySQL format. */
+/** Convert a field in the Innobase format to a field in the MySQL format.
+@param[out] mysql_rec record in the MySQL format
+@param[in,out] prebuilt prebuilt struct
+@param[in] rec InnoDB record; must be protected
+ by a page latch
+@param[in] index index of rec
+@param[in] offsets array returned by rec_get_offsets()
+@param[in] field_no templ->rec_field_no or
+ templ->clust_rec_field_no
+ or templ->icp_rec_field_no
+ 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
+ but prebuilt template is in clustered
+ index format and used only for end
+ range comparison. */
static MY_ATTRIBUTE((warn_unused_result))
ibool
row_sel_store_mysql_field_func(
-/*===========================*/
- byte* mysql_rec, /*!< out: record in the
- MySQL format */
- row_prebuilt_t* prebuilt, /*!< in/out: prebuilt struct */
- const rec_t* rec, /*!< in: InnoDB record;
- must be protected by
- a page latch */
+ byte* mysql_rec,
+ row_prebuilt_t* prebuilt,
+ const rec_t* rec,
#ifdef UNIV_DEBUG
- const dict_index_t* index, /*!< in: index of rec */
+ const dict_index_t* index,
#endif
- const ulint* offsets, /*!< in: array returned by
- rec_get_offsets() */
- ulint field_no, /*!< in: templ->rec_field_no or
- templ->clust_rec_field_no or
- templ->icp_rec_field_no */
- const mysql_row_templ_t*templ) /*!< in: row template */
+ const ulint* offsets,
+ ulint field_no,
+ const mysql_row_templ_t*templ,
+ bool clust_templ_for_sec)
{
const byte* data;
ulint len;
ut_ad(templ);
ut_ad(templ >= prebuilt->mysql_template);
ut_ad(templ < &prebuilt->mysql_template[prebuilt->n_template]);
- ut_ad(field_no == templ->clust_rec_field_no
+ ut_ad(clust_templ_for_sec
+ || field_no == templ->clust_rec_field_no
|| field_no == templ->rec_field_no
|| field_no == templ->icp_rec_field_no);
- ut_ad(rec_offs_validate(rec, index, offsets));
+ ut_ad(rec_offs_validate(rec,
+ clust_templ_for_sec == true ? prebuilt->index : index, offsets));
if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, field_no))) {
return(TRUE);
}
-/**************************************************************//**
-Convert a row in the Innobase format to a row in the MySQL format.
+/** Convert a row in the Innobase format to a row in the MySQL format.
Note that the template in prebuilt may advise us to copy only a few
columns to mysql_rec, other columns are left blank. All columns may not
be needed in the query.
+@param[out] mysql_rec row in the MySQL format
+@param[in] prebuilt prebuilt structure
+@param[in] rec Innobase record in the index
+ which was described in prebuilt's
+ template, or in the clustered index;
+ must be protected by a page latch
+@param[in] rec_clust TRUE if the rec in the clustered index
+@param[in] index index of rec
+@param[in] offsets array returned by rec_get_offsets(rec)
+@param[in] clust_templ_for_sec TRUE if rec belongs to secondary index
+ but the prebuilt->template is in
+ clustered index format and it is
+ used only for end range comparison
@return TRUE on success, FALSE if not all columns could be retrieved */
static MY_ATTRIBUTE((warn_unused_result))
ibool
row_sel_store_mysql_rec(
-/*====================*/
- byte* mysql_rec, /*!< out: row in the MySQL format */
- row_prebuilt_t* prebuilt, /*!< in: prebuilt struct */
- const rec_t* rec, /*!< in: Innobase record in the index
- which was described in prebuilt's
- template, or in the clustered index;
- must be protected by a page latch */
- ibool rec_clust, /*!< in: TRUE if rec is in the
- clustered index instead of
- prebuilt->index */
- const dict_index_t* index, /*!< in: index of rec */
- const ulint* offsets) /*!< in: array returned by
- rec_get_offsets(rec) */
+ byte* mysql_rec,
+ row_prebuilt_t* prebuilt,
+ const rec_t* rec,
+ ibool rec_clust,
+ const dict_index_t* index,
+ const ulint* offsets,
+ bool clust_templ_for_sec)
{
- ulint i;
+ ulint i;
+ std::vector<ulint> template_col;
ut_ad(rec_clust || index == prebuilt->index);
ut_ad(!rec_clust || dict_index_is_clust(index));
prebuilt->blob_heap = NULL;
}
+ if (clust_templ_for_sec) {
+ /* Store all clustered index field of
+ secondary index record. */
+ for (i = 0; i < dict_index_get_n_fields(
+ prebuilt->index); i++) {
+ ulint sec_field = dict_index_get_nth_field_pos(
+ index, prebuilt->index, i);
+ template_col.push_back(sec_field);
+ }
+ }
+
for (i = 0; i < prebuilt->n_template; i++) {
const mysql_row_templ_t*templ = &prebuilt->mysql_template[i];
- const ulint field_no
+ ulint field_no
= rec_clust
? templ->clust_rec_field_no
: templ->rec_field_no;
ut_ad(dict_index_get_nth_field(index, field_no)->prefix_len
== 0);
+ if (clust_templ_for_sec) {
+ std::vector<ulint>::iterator it;
+ it = std::find(template_col.begin(),
+ template_col.end(), field_no);
+
+ if (it == template_col.end()) {
+ continue;
+ }
+
+ ut_ad(templ->rec_field_no == templ->clust_rec_field_no);
+
+ field_no = it - template_col.begin();
+ }
+
if (!row_sel_store_mysql_field(mysql_rec, prebuilt,
rec, index, offsets,
- field_no, templ)) {
+ field_no, templ,
+ clust_templ_for_sec)) {
return(FALSE);
}
}
if (!row_sel_store_mysql_field(mysql_rec, prebuilt,
rec, prebuilt->index, offsets,
templ->icp_rec_field_no,
- templ)) {
+ templ, false)) {
return(ICP_NO_MATCH);
}
}
|| dict_index_is_clust(prebuilt->index)) {
if (!row_sel_store_mysql_rec(
mysql_rec, prebuilt, rec, FALSE,
- prebuilt->index, offsets)) {
+ prebuilt->index, offsets, false)) {
ut_ad(dict_index_is_clust(prebuilt->index));
return(ICP_NO_MATCH);
}
return(result);
}
+/** Check the pushed down end range condition to avoid extra traversal
+if records are not within view and also to avoid prefetching in the
+cache buffer.
+@param[in] mysql_rec record in MySQL format
+@param[in,out] handler the MySQL handler performing the scan
+@retval true if the row in mysql_rec is out of range
+@retval false if the row in mysql_rec is in range */
+static
+bool
+row_search_end_range_check(
+ const byte* mysql_rec,
+ ha_innobase* handler)
+{
+ if (handler->end_range &&
+ handler->compare_key_in_buffer(mysql_rec) > 0) {
+ return(true);
+ }
+
+ return(false);
+}
+
/********************************************************************//**
Searches for rows in the database. This is used in the interface to
MySQL. This function opens a cursor, and also implements fetch next
trx_t* trx = prebuilt->trx;
dict_index_t* clust_index;
que_thr_t* thr;
- const rec_t* rec;
+ const rec_t* prev_rec = NULL;
+ const rec_t* rec = NULL;
+ byte* end_range_cache = NULL;
const rec_t* result_rec = NULL;
const rec_t* clust_rec;
dberr_t err = DB_SUCCESS;
ulint* offsets = offsets_;
ibool table_lock_waited = FALSE;
byte* next_buf = 0;
+ ulint end_loop = 0;
rec_offs_init(offsets_);
err = DB_SUCCESS;
goto func_exit;
+ } else if (prebuilt->end_range == true) {
+ prebuilt->end_range = false;
+ err = DB_RECORD_NOT_FOUND;
+ goto func_exit;
}
if (prebuilt->fetch_cache_first > 0
if (!row_sel_store_mysql_rec(
buf, prebuilt,
- rec, FALSE, index, offsets)) {
+ rec, FALSE, index,
+ offsets, false)) {
/* Only fresh inserts may contain
incomplete externally stored
columns. Pretend that such
and neither can a record lock be placed on it: we skip such
a record. */
+ prev_rec = NULL;
goto next_rec;
}
if (page_rec_is_supremum(rec)) {
+ /** Compare the last record of the page with end range
+ passed to InnoDB when there is no ICP and number of loops
+ in row_search_for_mysql for rows found but not
+ reporting due to search views etc. */
+ if (prev_rec != NULL
+ && prebuilt->mysql_handler->end_range != NULL
+ && prebuilt->idx_cond == NULL
+ && end_loop >= 100) {
+
+ dict_index_t* key_index = prebuilt->index;
+ bool clust_templ_for_sec = false;
+
+ if (end_range_cache == NULL) {
+ end_range_cache = static_cast<byte*>(
+ ut_malloc(prebuilt->mysql_row_len));
+ }
+
+ if (index != clust_index
+ && prebuilt->need_to_access_clustered) {
+ /** Secondary index record but the template
+ based on PK. */
+ key_index = clust_index;
+ clust_templ_for_sec = true;
+ }
+
+ /** Create offsets based on prebuilt index. */
+ offsets = rec_get_offsets(prev_rec, prebuilt->index,
+ offsets, ULINT_UNDEFINED, &heap);
+
+ if (row_sel_store_mysql_rec(
+ end_range_cache, prebuilt, prev_rec,
+ clust_templ_for_sec, key_index, offsets,
+ clust_templ_for_sec)) {
+
+ if (row_search_end_range_check(
+ end_range_cache,
+ prebuilt->mysql_handler)) {
+
+ /** In case of prebuilt->fetch,
+ set the error in prebuilt->end_range. */
+ if (prebuilt->n_fetch_cached > 0) {
+ prebuilt->end_range = true;
+ }
+
+ err = DB_RECORD_NOT_FOUND;
+ goto normal_return;
+ }
+ }
+ }
+
if (set_also_gap_locks
&& !(srv_locks_unsafe_for_binlog
|| trx->isolation_level <= TRX_ISO_READ_COMMITTED)
/* A page supremum record cannot be in the result set: skip
it now that we have placed a possible lock on it */
+ prev_rec = NULL;
goto next_rec;
}
btr_pcur_move_to_last_on_page(pcur, &mtr);
+ prev_rec = NULL;
goto next_rec;
}
}
fputs(". We try to skip the record.\n",
stderr);
+ prev_rec = NULL;
goto next_rec;
}
}
+ prev_rec = rec;
+
/* Note that we cannot trust the up_match value in the cursor at this
place because we can arrive here after moving the cursor! Thus
we have to recompare rec and search_tuple to determine if they
did_semi_consistent_read = TRUE;
rec = old_vers;
+ prev_rec = rec;
break;
default:
}
rec = old_vers;
+ prev_rec = rec;
}
} else {
/* We are looking into a non-clustered index,
appropriate version of the clustered index record. */
if (!row_sel_store_mysql_rec(
buf, prebuilt, result_rec,
- TRUE, clust_index, offsets)) {
+ TRUE, clust_index, offsets, false)) {
goto next_rec;
}
}
next_buf, prebuilt, result_rec,
result_rec != rec,
result_rec != rec ? clust_index : index,
- offsets)) {
+ offsets, false)) {
if (next_buf == buf) {
ut_a(prebuilt->n_fetch_cached == 0);
buf, prebuilt, result_rec,
result_rec != rec,
result_rec != rec ? clust_index : index,
- offsets)) {
+ offsets, false)) {
/* Only fresh inserts may contain
incomplete externally stored
columns. Pretend that such records do
goto normal_return;
next_rec:
+ end_loop++;
+
/* Reset the old and new "did semi-consistent read" flags. */
if (UNIV_UNLIKELY(prebuilt->row_read_type
== ROW_READ_DID_SEMI_CONSISTENT)) {
func_exit:
trx->op_info = "";
+
+ if (end_range_cache != NULL) {
+ ut_free(end_range_cache);
+ }
+
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
/*!< in: a dummy parameter required by
os_thread_create */
{
+ my_thread_init();
+
srv_slot_t* slot;
ulint old_activity_count = srv_get_activity_count();
ib_time_t last_print_time;
os_event_wait(slot->event);
if (srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS) {
+ my_thread_end();
os_thread_exit(NULL);
}
void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter
required by os_thread_create */
{
+ my_thread_init();
+
srv_slot_t* slot;
ut_ad(!srv_read_only_mode);
os_thread_pf(os_thread_get_curr_id()));
#endif /* UNIV_DEBUG_THREAD_CREATION */
+ my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL);
void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter
required by os_thread_create */
{
+ my_thread_init();
+
srv_slot_t* slot;
ulint n_total_purged = ULINT_UNDEFINED;
srv_release_threads(SRV_WORKER, srv_n_purge_threads - 1);
}
+ my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
os_thread_exit(NULL);
}
}
+/** Check whether given space id is undo tablespace id
+@param[in] space_id space id to check
+@return true if it is undo tablespace else false. */
+bool
+srv_is_undo_tablespace(
+ ulint space_id)
+{
+ if (srv_undo_space_id_start == 0) {
+ return (false);
+ }
+
+ return(space_id >= srv_undo_space_id_start
+ && space_id < (srv_undo_space_id_start
+ + srv_undo_tablespaces_open));
+}
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
/** TRUE if a raw partition is in use */
UNIV_INTERN ibool srv_start_raw_disk_in_use = FALSE;
+/** UNDO tablespaces starts with space id. */
+ulint srv_undo_space_id_start;
+
/** TRUE if the server is being started, before rolling back any
incomplete transactions */
UNIV_INTERN ibool srv_startup_is_before_trx_rollback_phase = FALSE;
UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE;
/** Files comprising the system tablespace */
-static os_file_t files[1000];
+static pfs_os_file_t files[1000];
/** io_handler_thread parameters for thread identification */
static ulint n[SRV_MAX_N_IO_THREADS + 6];
dberr_t
create_log_file(
/*============*/
- os_file_t* file, /*!< out: file handle */
+ pfs_os_file_t* file, /*!< out: file handle */
const char* name) /*!< in: log file name */
{
ibool ret;
dberr_t
open_log_file(
/*==========*/
- os_file_t* file, /*!< out: file handle */
+ pfs_os_file_t* file, /*!< out: file handle */
const char* name, /*!< in: log file name */
os_offset_t* size) /*!< out: file size */
{
&& os_file_get_last_error(false)
!= OS_FILE_ALREADY_EXISTS
#ifdef UNIV_AIX
- /* AIX 5.1 after security patch ML7 may have
+ /* AIX 5.1 after security patch ML7 may have
errno set to 0 here, which causes our
function to return 100; work around that
AIX problem */
const char* name, /*!< in: tablespace name */
ulint size) /*!< in: tablespace size in pages */
{
- os_file_t fh;
+ pfs_os_file_t fh;
ibool ret;
dberr_t err = DB_SUCCESS;
const char* name, /*!< in: tablespace name */
ulint space) /*!< in: tablespace id */
{
- os_file_t fh;
+ pfs_os_file_t fh;
dberr_t err = DB_ERROR;
ibool ret;
ulint flags;
for (i = 0; create_new_db && i < n_conf_tablespaces; ++i) {
char name[OS_FILE_MAX_PATH];
+ ulint space_id = i + 1;
+
+ DBUG_EXECUTE_IF("innodb_undo_upgrade",
+ space_id = i + 3;);
ut_snprintf(
name, sizeof(name),
"%s%cundo%03lu",
- srv_undo_dir, SRV_PATH_SEPARATOR, i + 1);
+ srv_undo_dir, SRV_PATH_SEPARATOR, space_id);
+
+ if (i == 0) {
+ srv_undo_space_id_start = space_id;
+ prev_space_id = srv_undo_space_id_start - 1;
+ }
+
+ undo_tablespace_ids[i] = space_id;
- /* Undo space ids start from 1. */
err = srv_undo_tablespace_create(
name, SRV_UNDO_TABLESPACE_SIZE_IN_PAGES);
if (!create_new_db) {
n_undo_tablespaces = trx_rseg_get_n_undo_tablespaces(
undo_tablespace_ids);
- } else {
- n_undo_tablespaces = n_conf_tablespaces;
- for (i = 1; i <= n_undo_tablespaces; ++i) {
- undo_tablespace_ids[i - 1] = i;
+ if (n_undo_tablespaces != 0) {
+ srv_undo_space_id_start = undo_tablespace_ids[0];
+ prev_space_id = srv_undo_space_id_start - 1;
}
- undo_tablespace_ids[i] = ULINT_UNDEFINED;
+ } else {
+ n_undo_tablespaces = n_conf_tablespaces;
+
+ undo_tablespace_ids[n_conf_tablespaces] = ULINT_UNDEFINED;
}
/* Open all the undo tablespaces that are currently in use. If we
ut_a(undo_tablespace_ids[i] != 0);
ut_a(undo_tablespace_ids[i] != ULINT_UNDEFINED);
- /* Undo space ids start from 1. */
-
err = srv_undo_tablespace_open(name, undo_tablespace_ids[i]);
if (err != DB_SUCCESS) {
break;
}
+ /** Note the first undo tablespace id in case of
+ no active undo tablespace. */
+ if (n_undo_tablespaces == 0) {
+ srv_undo_space_id_start = i;
+ }
+
++n_undo_tablespaces;
++*n_opened;
}
+ /** Explictly specify the srv_undo_space_id_start
+ as zero when there are no undo tablespaces. */
+ if (n_undo_tablespaces == 0) {
+ srv_undo_space_id_start = 0;
+ }
+
/* If the user says that there are fewer than what we find we
tolerate that discrepancy but not the inverse. Because there could
be unused undo tablespaces for future use. */
mtr_start(&mtr);
/* The undo log tablespace */
- for (i = 1; i <= n_undo_tablespaces; ++i) {
+ for (i = 0; i < n_undo_tablespaces; ++i) {
fsp_header_init(
- i, SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, &mtr);
+ undo_tablespace_ids[i],
+ SRV_UNDO_TABLESPACE_SIZE_IN_PAGES, &mtr);
}
mtr_commit(&mtr);
char* logfile0 = NULL;
size_t dirnamelen;
+ if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
+ srv_read_only_mode = 1;
+ }
+
high_level_read_only = srv_read_only_mode
|| srv_force_recovery > SRV_FORCE_NO_TRX_UNDO;
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
/* We assume in purge of externally stored fields that space id is
in the range of UNDO tablespace space ids */
- ut_a(purge_sys->rseg->space <= srv_undo_tablespaces_open);
+ ut_a(purge_sys->rseg->space == 0
+ || srv_is_undo_tablespace(purge_sys->rseg->space));
zip_size = purge_sys->rseg->zip_size;
/*****************************************************************************
-Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
/*!< in: a dummy parameter required by
os_thread_create */
{
+ my_thread_init();
ut_ad(!srv_read_only_mode);
#ifdef UNIV_PFS_THREAD
trx_rollback_or_clean_is_active = false;
+ my_thread_end();
/* We count the number of threads in os_thread_exit(). A created
thread should always use that to exit and not use return() to exit. */
/*****************************************************************************
-Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1996, 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
ulint new_rsegs = n_rsegs - n_used;
for (i = 0; i < new_rsegs; ++i) {
- ulint space;
+ ulint space_id;
+ space_id = (n_spaces == 0) ? 0
+ : (srv_undo_space_id_start + i % n_spaces);
- /* Tablespace 0 is the system tablespace. All UNDO
- log tablespaces start from 1. */
-
- if (n_spaces > 0) {
- space = (i % n_spaces) + 1;
- } else {
- space = 0; /* System tablespace */
- }
-
- if (trx_rseg_create(space) != NULL) {
+ /* Tablespace 0 is the system tablespace. */
+ if (trx_rseg_create(space_id) != NULL) {
++n_used;
} else {
break;
switch (state->m_operation)
{
case PSI_FILE_STAT:
+ case PSI_FILE_RENAME:
break;
case PSI_FILE_STREAM_OPEN:
case PSI_FILE_CREATE:
+ case PSI_FILE_OPEN:
if (result != NULL)
{
PFS_file_class *klass= reinterpret_cast<PFS_file_class*> (state->m_class);
state->m_file= reinterpret_cast<PSI_file*> (pfs_file);
}
break;
- case PSI_FILE_OPEN:
default:
DBUG_ASSERT(false);
break;
-/* Copyright (c) 2008, 2016, 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
if (safe_index == 0)
{
/* Record [0] is reserved. */
- safe_index= 1;
+ continue;
}
/* Add a new record in digest stat array. */
+ DBUG_ASSERT(safe_index < digest_max);
pfs= &statements_digest_stat_array[safe_index];
if (pfs->m_lock.is_free())
-/* 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
#include "stub_print_error.h"
#include "stub_pfs_defaults.h"
+void unload_performance_schema();
+
/* test helpers, to simulate the setup */
void setup_thread(PSI_thread *t, bool enabled)
psi_2= boot->get_interface(PSI_VERSION_2);
ok(psi_2 == NULL, "version 2");
- shutdown_performance_schema();
+ unload_performance_schema();
}
/*
return (PSI*) psi;
}
+void unload_performance_schema()
+{
+ cleanup_table_share();
+ cleanup_instruments();
+ cleanup_sync_class();
+ cleanup_thread_class();
+ cleanup_table_share();
+ cleanup_file_class();
+ cleanup_stage_class();
+ cleanup_statement_class();
+ cleanup_socket_class();
+ cleanup_events_waits_history_long();
+ cleanup_events_stages_history_long();
+ cleanup_events_statements_history_long();
+ cleanup_table_share_hash();
+ cleanup_file_hash();
+ cleanup_digest();
+ PFS_atomic::cleanup();
+
+ shutdown_performance_schema();
+}
+
void test_bad_registration()
{
PSI *psi;
psi->register_socket("X", bad_socket_3, 1);
ok(dummy_socket_key == 2, "assigned key");
-
- shutdown_performance_schema();
+ unload_performance_schema();
}
void test_init_disabled()
socket_A1= psi->init_socket(99, NULL, NULL, 0);
ok(socket_A1 == NULL, "broken socket key not instrumented");
- shutdown_performance_schema();
+ unload_performance_schema();
}
void test_locker_disabled()
ok(socket_A1 != NULL, "instrumented");
/* Socket thread owner has not been set */
socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
- ok(socket_locker == NULL, "no locker (no thread owner)");
-
+ ok(socket_locker != NULL, "locker (owner not used)");
+ psi->end_socket_wait(socket_locker, 10);
+
/* Pretend the running thread is not instrumented */
/* ---------------------------------------------- */
socket_locker= psi->start_socket_wait(&socket_state, socket_A1, PSI_SOCKET_SEND, 12, "foo.cc", 12);
ok(socket_locker == NULL, "no locker");
- shutdown_performance_schema();
+ unload_performance_schema();
}
void test_file_instrumentation_leak()
file_locker= psi->get_thread_file_descriptor_locker(&file_state, (File) 12, PSI_FILE_WRITE);
ok(file_locker == NULL, "no locker, no leak");
- shutdown_performance_schema();
+ unload_performance_schema();
}
void test_enabled()
{ & cond_key_B, "C-B", 0}
};
- shutdown_performance_schema();
+ unload_performance_schema();
#endif
}
plan(216);
MY_INIT("pfs-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* Copyright (c) 2011, 2015, 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
plan(6);
MY_INIT("pfs_account-oom-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* Copyright (c) 2008, 2011, 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
diag("skipping the cp1251 tests : missing character set");
plan(59 + (cs_cp1251 ? 10 : 0));
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* Copyright (c) 2011, 2015, 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
plan(6);
MY_INIT("pfs_host-oom-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* 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
rc= init_instruments(& param);
ok(rc == 1, "oom (per thread wait)");
+ cleanup_sync_class();
+ cleanup_thread_class();
+ cleanup_file_class();
+ cleanup_instruments();
+
param.m_enabled= true;
param.m_mutex_class_sizing= 0;
param.m_rwlock_class_sizing= 0;
init_event_name_sizing(& param);
rc= init_instruments(& param);
ok(rc == 1, "oom (thread stages history sizing)");
+
+ cleanup_thread_class();
cleanup_instruments();
param.m_enabled= true;
init_event_name_sizing(& param);
rc= init_instruments(& param);
ok(rc == 1, "oom (per thread stages)");
+
+ cleanup_stage_class();
+ cleanup_thread_class();
cleanup_instruments();
param.m_enabled= true;
init_event_name_sizing(& param);
rc= init_instruments(& param);
ok(rc == 1, "oom (thread statements history sizing)");
+
+ cleanup_thread_class();
cleanup_instruments();
param.m_enabled= true;
init_event_name_sizing(& param);
rc= init_instruments(& param);
ok(rc == 1, "oom (per thread statements)");
+
+ cleanup_statement_class();
+ cleanup_thread_class();
cleanup_instruments();
param.m_enabled= true;
init_event_name_sizing(& param);
rc= init_instruments(& param);
ok(rc == 1, "oom (global waits)");
+
+ cleanup_sync_class();
cleanup_instruments();
param.m_enabled= true;
ok(rc == 0, "init stage class");
rc= init_instruments(& param);
ok(rc == 1, "oom (global stages)");
- cleanup_instruments();
+
+ cleanup_sync_class();
cleanup_stage_class();
+ cleanup_instruments();
param.m_enabled= true;
param.m_mutex_class_sizing= 10;
ok(rc == 0, "init statement class");
rc= init_instruments(& param);
ok(rc == 1, "oom (global statements)");
- cleanup_instruments();
+
+ cleanup_sync_class();
cleanup_statement_class();
+ cleanup_instruments();
}
void do_all_tests()
plan(20);
MY_INIT("pfs_instr-oom-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* 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
#include <memory.h>
+PFS_global_param param;
+
void test_no_instruments()
{
int rc;
- PFS_global_param param;
memset(& param, 0xFF, sizeof(param));
param.m_enabled= true;
PFS_file *file;
PFS_socket *socket;
PFS_table *table;
- PFS_global_param param;
memset(& param, 0xFF, sizeof(param));
param.m_enabled= true;
PFS_socket *socket_2;
PFS_table *table_1;
PFS_table *table_2;
- PFS_global_param param;
memset(& param, 0xFF, sizeof(param));
param.m_enabled= true;
plan(103);
MY_INIT("pfs_instr-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* 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
plan(9);
MY_INIT("pfs_instr_info-oom-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* 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
plan(181);
MY_INIT("pfs_instr_info-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* Copyright (c) 2015, 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
plan(2);
MY_INIT("pfs_misc-t");
do_all_tests();
- return exit_status();
+ return (exit_status());
}
-/* Copyright (c) 2008, 2011, 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
plan(5);
MY_INIT("pfs_timer-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
-/* Copyright (c) 2011, 2015, 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
plan(6);
MY_INIT("pfs_user-oom-t");
do_all_tests();
- return 0;
+ return (exit_status());
}
*/
static size_t
-my_strxfrm_pad_nweights_unicode(uchar *str, uchar *strend, size_t nweights)
+my_strxfrm_pad_nweights_unicode(uchar *str,
+ const uchar *const strend,
+ size_t nweights)
{
- uchar *str0;
- DBUG_ASSERT(str && str <= strend);
- for (str0= str; str < strend && nweights; nweights--)
+ const uchar *const str0 = str;
+ const uchar *const weightend = str + (nweights*2);
+ const uchar *const end = (weightend < strend) ? weightend : strend;
+ DBUG_ASSERT(str && str <= strend);
+
+ while (str < end-3)
+ {
+ *str++= 0x00;
+ *str++= 0x20;
+ *str++= 0x00;
+ *str++= 0x20;
+ }
+ if (str < end-1)
+ {
+ *str++= 0x00;
+ *str++= 0x20;
+ }
+ if (str < end)
{
*str++= 0x00;
- if (str < strend)
- *str++= 0x20;
}
return str - str0;
}
*/
static size_t
-my_strxfrm_pad_unicode(uchar *str, uchar *strend)
+my_strxfrm_pad_unicode(uchar *str, const uchar *const strend)
{
- uchar *str0= str;
+ const uchar *const str0 = str;
DBUG_ASSERT(str && str <= strend);
- for ( ; str < strend ; )
+
+ while (str < strend-3)
+ {
+ *str++= 0x00;
+ *str++= 0x20;
+ *str++= 0x00;
+ *str++= 0x20;
+ }
+ if (str < strend-1)
+ {
+ *str++= 0x00;
+ *str++= 0x20;
+ }
+ if (str < strend)
{
*str++= 0x00;
- if (str < strend)
- *str++= 0x20;
}
return str - str0;
}
{
my_wc_t wc;
int res;
- uchar *dst0= dst;
- uchar *de= dst + dstlen;
- const uchar *se= src + srclen;
+ uchar *const dst0= dst;
+ const uchar *const de= dst + dstlen;
+ const uchar *const se= src + srclen;
MY_UNICASE_INFO *uni_plane= (cs->state & MY_CS_BINSORT) ?
NULL : cs->caseinfo;
LINT_INIT(wc);
const uchar *src, size_t srclen, uint flags)
{
my_wc_t wc;
- uchar *dst0= dst;
- uchar *de= dst + dstlen;
- const uchar *se = src + srclen;
+ uchar *const dst0= dst;
+ const uchar *const de= dst + dstlen;
+ const uchar *const se= src + srclen;
LINT_INIT(wc);
DBUG_ASSERT(src);
if (flags & MY_STRXFRM_PAD_WITH_SPACE)
{
- for ( ; dst < de && nweights; nweights--)
+ const uchar *const weightend = dst + (nweights*3);
+ const uchar *const end = (weightend < de) ? weightend : de;
+
+ while (dst < end-2)
+ {
+ *dst++= 0x00;
+ *dst++= 0x00;
+ *dst++= 0x20;
+ nweights--;
+ }
+ if (dst < de && nweights > 0)
{
*dst++= 0x00;
if (dst < de)
if (flags & MY_STRXFRM_PAD_TO_MAXLEN)
{
- while (dst < de)
+ while (dst < de-2)
+ {
+ *dst++= 0x00;
+ *dst++= 0x00;
+ *dst++= 0x20;
+ }
+ if (dst < de)
{
*dst++= 0x00;
if (dst < de)
-# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2016, 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
DESTINATION ${inst_location} COMPONENT IniFiles)
IF(UNIX)
+ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ SET (PIDOF "pidof")
+ ELSE()
+ SET (PIDOF "pgrep -d' ' -f")
+ ENDIF()
SET(prefix ${CMAKE_INSTALL_PREFIX})
FOREACH(script mysqld_multi.server mysql-log-rotate binary-configure)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh
# Get arguments from the my.cnf file,
# the only group, which is read from now on is [mysqld]
-if test -x ./bin/my_print_defaults
-then
- print_defaults="./bin/my_print_defaults"
-elif test -x $bindir/my_print_defaults
-then
+if test -x "$bindir/my_print_defaults"; then
print_defaults="$bindir/my_print_defaults"
-elif test -x $bindir/mysql_print_defaults
-then
- print_defaults="$bindir/mysql_print_defaults"
else
# Try to find basedir in /etc/my.cnf
conf=/etc/my.cnf
print_defaults="$d/bin/my_print_defaults"
break
fi
- if test -x "$d/bin/mysql_print_defaults"
- then
- print_defaults="$d/bin/mysql_print_defaults"
- break
- fi
done
fi
fi
else
# Try to find appropriate mysqld process
- mysqld_pid=`pidof $libexecdir/mysqld`
+ mysqld_pid=`@PIDOF@ $libexecdir/mysqld`
# test if multiple pids exist
pid_count=`echo $mysqld_pid | wc -w`
-/* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2002, 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 values. */
DIE_UNLESS(bigint == 20011020101100LL);
DIE_UNLESS(real == 20011020101059.5);
- DIE_UNLESS(!strcmp(dec, "20011020101059.5"));
+ DIE_UNLESS(!strcmp(dec, "20011020101059.500000"));
mysql_stmt_close(stmt);
/* Check returned values */
DIE_UNLESS(bigint == 101100);
DIE_UNLESS(real == 101059.5);
- DIE_UNLESS(!strcmp(dec, "101059.5"));
+ DIE_UNLESS(!strcmp(dec, "101059.500000"));
mysql_stmt_close(stmt);
}
3: check that cursors to InnoDB tables are closed (for now) by
COMMIT/ROLLBACK.
*/
- if (! have_innodb)
- {
- if (!opt_silent)
- printf("Testing that cursors are closed at COMMIT/ROLLBACK requires "
- "InnoDB.\n");
- }
- else
- {
stmt_text= "select id from t1 order by 1";
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
check_execute(stmt, rc);
if (!opt_silent)
printf("Got error (as expected): %s\n", mysql_error(mysql));
#endif
- }
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "drop table t1");
myheader("test_bug12243");
- if (! have_innodb)
- {
- if (!opt_silent)
- printf("This test requires InnoDB.\n");
- return;
- }
-
/* create tables */
mysql_query(mysql, "drop table if exists t1");
mysql_query(mysql, "create table t1 (a int) engine=InnoDB");
myquery(rc);
}
+/**
+ BUG#19894382 - SERVER SIDE PREPARED STATEMENTS LEADS TO POTENTIAL OFF-BY-SECOND
+ TIMESTAMP ON SLAVE
+*/
+static void test_bug19894382()
+{
+ MYSQL_STMT *stmt1;
+ const char *stmt1_txt= "INSERT INTO client_test_db.bug19894382 VALUES"
+ " ('master', ?, ?, ?, ?, ?, ?);";
+ my_bool is_null= 0;
+ MYSQL_BIND bind_val[6];
+ MYSQL_TIME tm[6];
+ MYSQL_TIME tm_common;
+ ulong length= sizeof(MYSQL_TIME);
+ int ind;
+ int rc;
+
+ myheader("test_bug19894382");
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS client_test_db.bug19894382;");
+ myquery(rc);
+ rc= mysql_query(mysql, "CREATE TABLE client_test_db.bug19894382(f1 CHAR(64),"
+ " f2 TIME, f3 TIMESTAMP NULL, f4 DATETIME,"
+ " f5 TIME(3), f6 TIMESTAMP(3) NULL,"
+ " f7 DATETIME(3));");
+ myquery(rc);
+
+ stmt1 = mysql_stmt_init(mysql);
+ check_stmt(stmt1);
+
+ // Prepare statement
+ rc= mysql_stmt_prepare(stmt1, stmt1_txt, strlen(stmt1_txt));
+ check_execute(stmt1, rc);
+
+ // Prepare and bind values.
+ tm_common.year= 2015;
+ tm_common.month= 4;
+ tm_common.day= 24;
+ tm_common.hour= 7;
+ tm_common.minute= 30;
+ tm_common.second= 30;
+ tm_common.second_part= 5010;
+ tm_common.neg= 0;
+ tm_common.time_type= MYSQL_TIMESTAMP_NONE;
+
+ memset(bind_val, 0, sizeof(MYSQL_BIND) * 6);
+ for (ind= 0; ind < 6; ind++)
+ {
+ tm[ind]= tm_common;
+ bind_val[ind].buffer= (void *) &tm[ind];
+ bind_val[ind].is_null= &is_null;
+ bind_val[ind].length= &length;
+ bind_val[ind].buffer_length= sizeof(MYSQL_TIME);
+ switch(ind%3)
+ {
+ case 0:
+ tm[ind].year= tm[ind].month= tm[ind].day= 0;
+ bind_val[ind].buffer_type= MYSQL_TYPE_TIME;
+ tm[ind].time_type= MYSQL_TIMESTAMP_TIME;
+ break;
+ case 1:
+ bind_val[ind].buffer_type= MYSQL_TYPE_TIMESTAMP;
+ tm[ind].time_type= MYSQL_TIMESTAMP_DATETIME;
+ break;
+ case 2:
+ bind_val[ind].buffer_type= MYSQL_TYPE_DATETIME;
+ tm[ind].time_type= MYSQL_TIMESTAMP_DATETIME;
+ break;
+ }
+ }
+ rc= mysql_stmt_bind_param(stmt1, bind_val);
+ check_execute(stmt1, rc);
+
+ /* Execute the insert statement */
+ rc= mysql_stmt_execute(stmt1);
+ check_execute(stmt1, rc);
+ for (ind= 0; ind < 6; ind++)
+ {
+ tm[ind].second_part= 501900;
+ }
+ /* Execute the insert statement */
+ rc= mysql_stmt_execute(stmt1);
+ check_execute(stmt1, rc);
+
+ rc= mysql_commit(mysql);
+ myquery(rc);
+
+ mysql_stmt_close(stmt1);
+}
+
static struct my_tests_st my_tests[]= {
{ "disable_query_logs", disable_query_logs },
{ "test_view_sp_list_fields", test_view_sp_list_fields },
{ "test_bug20810928", test_bug20810928 },
{ "test_bug17883203", test_bug17883203 },
{ "test_bug22559575", test_bug22559575 },
+ { "test_bug19894382", test_bug19894382 },
{ 0, 0 }
};
-/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2016, 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
int y= 0;
// This DBUG_PRINT args should never be evaluated.
- DBUG_PRINT("never",("%d",1/y));
+ DBUG_PRINT("never",("%d", y+= 1));
+ EXPECT_EQ(y, 0) << "DBUG_PRINT arg is evaluated.";
}
-TEST(DebugPrintDeathTest, PrintEval)
+TEST(DebugPrintEvalTest, PrintEval)
{
int y= 0;
- ::testing::FLAGS_gtest_death_test_style = "threadsafe";
-
DBUG_SET("+d,never");
- /*
- The DBUG_PRINT would be evaluated resulting in floating point exception
- killing the server.
- */
- EXPECT_DEATH_IF_SUPPORTED(DBUG_PRINT("never",("%d",1/y)), "");
+ DBUG_PRINT("never",("%d", y+= 1));
DBUG_SET("");
+ EXPECT_GE(y, 1) << "DBUG_PRINT arg is not evaluated.";
}