Skip to content

Commit

Permalink
Merge remote-tracking branch 'server/5.7' into 2.4-xb-rebase-5.7.13
Browse files Browse the repository at this point in the history
  • Loading branch information
gl-sergei committed Jun 23, 2016
2 parents 4cdbfff + e0e0ae2 commit c3f543b
Show file tree
Hide file tree
Showing 2,022 changed files with 327,350 additions and 8,733 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -2842,7 +2842,6 @@ strings/test_decimal
support-files/*.ini
support-files/MacOSX/Description.plist
support-files/MacOSX/Info.plist
support-files/MacOSX/ReadMe.txt
support-files/MacOSX/StartupParameters.plist
support-files/MacOSX/postflight
support-files/MacOSX/postinstall
Expand Down
35 changes: 29 additions & 6 deletions CMakeLists.txt
Expand Up @@ -197,6 +197,7 @@ INCLUDE(lz4)
INCLUDE(libevent)
INCLUDE(ssl)
INCLUDE(readline)
INCLUDE(protobuf)
INCLUDE(mysql_version)
INCLUDE(libutils)
INCLUDE(dtrace)
Expand All @@ -206,6 +207,13 @@ INCLUDE(install_layout)
INCLUDE(mysql_add_executable)

# Handle options
IF(EXISTS ${CMAKE_SOURCE_DIR}/rapid)
OPTION(WITH_RAPID
"Build additonal code(plugins) that is located in rapid directory" ON)
ELSE()
OPTION(WITH_RAPID
"Build additonal code(plugins) that is located in rapid directory" OFF)
ENDIF()
OPTION(DISABLE_SHARED
"Don't build shared libraries, compile code as position-dependent" OFF)
IF(DISABLE_SHARED)
Expand Down Expand Up @@ -486,6 +494,10 @@ MYSQL_CHECK_EDITLINE()
MYSQL_CHECK_LIBEVENT()
# Add lz4 library
MYSQL_CHECK_LZ4()
# Add protoc and libprotobuf
IF(NOT WITHOUT_SERVER)
MYSQL_CHECK_PROTOBUF()
ENDIF()

# Check for SYS_thread_selfid system call
CHECK_C_SOURCE_COMPILES("
Expand All @@ -511,6 +523,19 @@ int main(int ac, char **av)
}"
HAVE_SYS_GETTID)

IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# Check for pthread_setname_np
CHECK_C_SOURCE_COMPILES("
#include <pthread.h>
int main(int ac, char **av)
{
const char *thread_name= 0;
int ret = pthread_setname_np(pthread_self(), thread_name);
return ret;
}"
HAVE_PTHREAD_SETNAME_NP)
ENDIF()

# Check for pthread_getthreadid_np()
CHECK_C_SOURCE_COMPILES("
#include <pthread_np.h>
Expand Down Expand Up @@ -552,8 +577,6 @@ IF(WITH_UNIT_TESTS)
ENDIF()

IF(NOT WITHOUT_SERVER)
# Set default keyring plugin information
SET(KEYRING_PLUGIN_INFO "" CACHE INTERNAL "")
SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "")
SET (MYSQLD_STATIC_EMBEDDED_PLUGIN_LIBS "" CACHE INTERNAL "")
# Add storage engines and plugins.
Expand Down Expand Up @@ -590,6 +613,10 @@ IF(WITH_UNIT_TESTS)
ADD_DEFINITIONS(-DGTEST_USE_OWN_TR1_TUPLE=1)
ENDIF()
ADD_SUBDIRECTORY(unittest/gunit)

IF(WITH_RAPID AND EXISTS ${CMAKE_SOURCE_DIR}/rapid/unittest/gunit)
ADD_SUBDIRECTORY(rapid/unittest/gunit)
ENDIF()
ENDIF()

ADD_SUBDIRECTORY(sql/share)
Expand All @@ -612,10 +639,6 @@ IF(NOT WITHOUT_SERVER)
IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
ADD_SUBDIRECTORY(internal)
ENDIF()
# Set default value for --early_load_plugin.
# KEYRING_PLUGIN_INFO should have been set to appropriate default
# by keyring plugin
SET(DEFAULT_EARLY_PLUGIN_LOAD "\"${KEYRING_PLUGIN_INFO}\"" CACHE INTERNAL "Default value for --early_plugin_load" FORCE)
ADD_SUBDIRECTORY(packaging/rpm-oel)
ADD_SUBDIRECTORY(packaging/rpm-fedora)
ADD_SUBDIRECTORY(packaging/rpm-sles)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1,4 +1,4 @@
MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=7
MYSQL_VERSION_PATCH=11
MYSQL_VERSION_PATCH=13
MYSQL_VERSION_EXTRA=
4 changes: 2 additions & 2 deletions client/base/abstract_program.cc
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
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
Expand Down Expand Up @@ -28,7 +28,7 @@ extern const char *load_default_groups[];

my_bool Abstract_program::callback_option_parsed(
int optid,
const struct my_option *opt __attribute__((unused)),
const struct my_option *opt MY_ATTRIBUTE((unused)),
char *argument)
{
// Check if option uses My::Tools::Base::Options, and it should.
Expand Down
8 changes: 6 additions & 2 deletions client/base/abstract_program.h
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
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
Expand Down Expand Up @@ -83,6 +83,10 @@ class Abstract_program : public Options::Composite_options_provider
Prints program invocation message.
*/
virtual void short_usage()= 0;
/**
Return error code
*/
virtual int get_error_code()= 0;

protected:
Abstract_program();
Expand All @@ -108,7 +112,7 @@ class Abstract_program : public Options::Composite_options_provider
If we have anonymous functions or binding this should be removed.
*/
static my_bool callback_option_parsed(int optid,
const struct my_option *opt __attribute__((unused)),
const struct my_option *opt MY_ATTRIBUTE((unused)),
char *argument);

Options::Debug_options m_debug_options;
Expand Down
4 changes: 2 additions & 2 deletions client/base/debug_options.cc
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
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
Expand Down Expand Up @@ -72,7 +72,7 @@ void Debug_options::create_options()
}


void Debug_options::debug_option_callback(char *argument __attribute__((unused)))
void Debug_options::debug_option_callback(char *argument MY_ATTRIBUTE((unused)))
{
if (this->m_dbug_option.has_value())
{
Expand Down
4 changes: 2 additions & 2 deletions client/base/debug_options.h
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
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
Expand Down Expand Up @@ -52,7 +52,7 @@ class Debug_options : public Abstract_options_provider

private:

void debug_option_callback(char *argument __attribute__((unused)));
void debug_option_callback(char *argument MY_ATTRIBUTE((unused)));

Abstract_program* m_program;
bool m_debug_info_flag;
Expand Down
6 changes: 3 additions & 3 deletions client/base/help_options.cc
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, 2015 Oracle and/or its affiliates. All rights reserved.
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
Expand Down Expand Up @@ -46,13 +46,13 @@ void Help_options::create_options()
this, &Help_options::version_callback));
}

void Help_options::help_callback(char* argument __attribute__((unused)))
void Help_options::help_callback(char* argument MY_ATTRIBUTE((unused)))
{
this->print_usage();
exit(0);
}

void Help_options::version_callback(char* argument __attribute__((unused)))
void Help_options::version_callback(char* argument MY_ATTRIBUTE((unused)))
{
this->print_version_line();
exit(0);
Expand Down
6 changes: 3 additions & 3 deletions client/base/help_options.h
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
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
Expand Down Expand Up @@ -51,8 +51,8 @@ class Help_options : public Abstract_options_provider
virtual void print_usage();

private:
void help_callback(char* argument __attribute__((unused)));
void version_callback(char* argument __attribute__((unused)));
void help_callback(char* argument MY_ATTRIBUTE((unused)));
void version_callback(char* argument MY_ATTRIBUTE((unused)));

void print_version_line();

Expand Down
30 changes: 6 additions & 24 deletions client/base/mysql_connection_options.cc
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
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
Expand Down Expand Up @@ -50,19 +50,6 @@ Mysql_connection_options::Mysql_connection_options(Abstract_program *program)
this->add_provider(&this->m_ssl_options_provider);
}

Mysql_connection_options::~Mysql_connection_options()
{
my_boost::mutex::scoped_lock lock(m_connection_mutex);
for (vector<MYSQL*>::iterator it= this->m_allocated_connections.begin();
it != this->m_allocated_connections.end(); it++)
{
if (*it)
{
mysql_close(*it);
}
}
}

void Mysql_connection_options::create_options()
{
this->create_new_option(&this->m_bind_addr, "bind-address",
Expand Down Expand Up @@ -129,13 +116,7 @@ void Mysql_connection_options::create_options()

MYSQL* Mysql_connection_options::create_connection()
{
MYSQL *connection = new MYSQL;

{
my_boost::mutex::scoped_lock lock(m_connection_mutex);
this->m_allocated_connections.push_back(connection);
}
mysql_init(connection);
MYSQL *connection= mysql_init(NULL);
if (this->m_compress)
mysql_options(connection, MYSQL_OPT_COMPRESS, NullS);

Expand Down Expand Up @@ -184,6 +165,7 @@ MYSQL* Mysql_connection_options::create_connection()
this->get_null_or_string(this->m_mysql_unix_port), 0))
{
this->db_error(connection, "while connecting to the MySQL server");
mysql_close(connection);
return NULL;
}

Expand Down Expand Up @@ -218,22 +200,22 @@ const char* Mysql_connection_options::get_null_or_string(

#ifdef _WIN32
void Mysql_connection_options::pipe_protocol_callback(
char* not_used __attribute__((unused)))
char* not_used MY_ATTRIBUTE((unused)))
{
this->m_protocol= MYSQL_PROTOCOL_PIPE;
}
#endif

void Mysql_connection_options::protocol_callback(
char* not_used __attribute__((unused)))
char* not_used MY_ATTRIBUTE((unused)))
{
this->m_protocol=
find_type_or_exit(this->m_protocol_string.value().c_str(),
&sql_protocol_typelib, "protocol");
}

void Mysql_connection_options::secure_auth_callback(
char* not_used __attribute__((unused)))
char* not_used MY_ATTRIBUTE((unused)))
{
/* --secure-auth is a zombie option. */
if (!this->m_secure_auth)
Expand Down
13 changes: 3 additions & 10 deletions client/base/mysql_connection_options.h
Expand Up @@ -74,7 +74,6 @@ class Mysql_connection_options
@param program Pointer to main program class.
*/
Mysql_connection_options(Abstract_program *program);
~Mysql_connection_options();

/**
Creates all options that will be provided.
Expand Down Expand Up @@ -111,19 +110,13 @@ class Mysql_connection_options
*/
void db_error(MYSQL* connection, const char* when);
#ifdef _WIN32
void pipe_protocol_callback(char* not_used __attribute__((unused)));
void pipe_protocol_callback(char* not_used MY_ATTRIBUTE((unused)));
#endif
void protocol_callback(char* not_used __attribute__((unused)));
void secure_auth_callback(char* argument __attribute__((unused)));
void protocol_callback(char* not_used MY_ATTRIBUTE((unused)));
void secure_auth_callback(char* argument MY_ATTRIBUTE((unused)));

static bool mysql_inited;

/*
List of created connections. As we don't have memory management for
C structs we must clear it by options provider destruction.
*/
std::vector<MYSQL*> m_allocated_connections;
my_boost::mutex m_connection_mutex;
Ssl_options m_ssl_options_provider;
Abstract_program *m_program;
Nullable<std::string> m_protocol_string;
Expand Down
27 changes: 25 additions & 2 deletions client/base/mysql_query_runner.cc
@@ -1,5 +1,5 @@
/*
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
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
Expand Down Expand Up @@ -28,17 +28,40 @@ using std::string;

Mysql_query_runner::Mysql_query_runner(MYSQL* connection)
: m_is_processing(new my_boost::atomic<bool>(false)),
m_is_original_runner(true),
m_connection(connection)
{}

Mysql_query_runner::Mysql_query_runner(const Mysql_query_runner& source)
: m_result_callbacks(source.m_result_callbacks),
m_message_callbacks(source.m_message_callbacks),
m_is_processing(source.m_is_processing),
m_is_original_runner(false),
m_connection(source.m_connection)
{
}

Mysql_query_runner::~Mysql_query_runner()
{
if (m_is_original_runner)
{
for (std::vector<I_callable<int64, const Row&>*>::iterator
it= m_result_callbacks.begin(); it != m_result_callbacks.end(); ++it)
{
delete *it;
}
for (std::vector<I_callable<int64, const Message_data&>*>::iterator
it= m_message_callbacks.begin(); it != m_message_callbacks.end(); ++it)
{
delete *it;
}

delete m_is_processing;

mysql_close(this->m_connection);
}
}

Mysql_query_runner& Mysql_query_runner::add_result_callback(
I_callable<int64, const Row& >* result_callback)
{
Expand Down Expand Up @@ -280,7 +303,7 @@ void Mysql_query_runner::append_escape_string(

int length = mysql_real_escape_string_quote(
m_connection, &((*destination_string)[0]) + start_lenght, original,
original_length, '"');
(ulong)original_length, '"');
destination_string->resize(start_lenght + length);
}

Expand Down

0 comments on commit c3f543b

Please sign in to comment.