Skip to content

Commit de36dc5

Browse files
committed
wl#8338 MySQLng Plugin
wl#8639 X Protocol Approved by Vinay Fisrekar <[email protected]> Approved by Prabeen Pradhan <[email protected]>
1 parent 0dd6a42 commit de36dc5

File tree

953 files changed

+298110
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

953 files changed

+298110
-124
lines changed

CMakeLists.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ INCLUDE(lz4)
197197
INCLUDE(libevent)
198198
INCLUDE(ssl)
199199
INCLUDE(readline)
200+
INCLUDE(protobuf)
200201
INCLUDE(mysql_version)
201202
INCLUDE(libutils)
202203
INCLUDE(dtrace)
@@ -206,6 +207,7 @@ INCLUDE(install_layout)
206207
INCLUDE(mysql_add_executable)
207208

208209
# Handle options
210+
OPTION(WITH_RAPID "Build additonal code(plugins) that is located in rapid directory" ON)
209211
OPTION(DISABLE_SHARED
210212
"Don't build shared libraries, compile code as position-dependent" OFF)
211213
IF(DISABLE_SHARED)
@@ -473,6 +475,10 @@ MYSQL_CHECK_EDITLINE()
473475
MYSQL_CHECK_LIBEVENT()
474476
# Add lz4 library
475477
MYSQL_CHECK_LZ4()
478+
# Add protoc and libprotobuf
479+
IF(NOT WITHOUT_SERVER)
480+
MYSQL_CHECK_PROTOBUF()
481+
ENDIF()
476482

477483
# Check for SYS_thread_selfid system call
478484
CHECK_C_SOURCE_COMPILES("
@@ -498,6 +504,19 @@ int main(int ac, char **av)
498504
}"
499505
HAVE_SYS_GETTID)
500506

507+
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
508+
# Check for pthread_setname_np
509+
CHECK_C_SOURCE_COMPILES("
510+
#include <pthread.h>
511+
int main(int ac, char **av)
512+
{
513+
const char *thread_name= 0;
514+
int ret = pthread_setname_np(pthread_self(), thread_name);
515+
return ret;
516+
}"
517+
HAVE_PTHREAD_SETNAME_NP)
518+
ENDIF()
519+
501520
# Check for pthread_getthreadid_np()
502521
CHECK_C_SOURCE_COMPILES("
503522
#include <pthread_np.h>
@@ -573,6 +592,10 @@ IF(WITH_UNIT_TESTS)
573592
ADD_DEFINITIONS(-DGTEST_USE_OWN_TR1_TUPLE=1)
574593
ENDIF()
575594
ADD_SUBDIRECTORY(unittest/gunit)
595+
596+
IF(WITH_RAPID)
597+
ADD_SUBDIRECTORY(rapid/unittest/gunit)
598+
ENDIF(WITH_RAPID)
576599
ENDIF()
577600

578601
ADD_SUBDIRECTORY(extra)

client/mysqltest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ struct st_match_err
538538

539539
struct st_expected_errors
540540
{
541-
struct st_match_err err[10];
541+
struct st_match_err err[20];
542542
uint count;
543543
};
544544
static struct st_expected_errors saved_expected_errors;

cmake/libutils.cmake

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -292,20 +292,14 @@ FUNCTION(GET_DEPENDEND_OS_LIBS target result)
292292
SET(${result} ${ret} PARENT_SCOPE)
293293
ENDFUNCTION()
294294

295-
# We try to hide the symbols in yassl/zlib to avoid name clashes with
296-
# other libraries like openssl.
297-
FUNCTION(RESTRICT_SYMBOL_EXPORTS target)
295+
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
296+
297+
FUNCTION(RESTRICT_SYMBOL_SOURCE target)
298298
IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
299299
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
300300
CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
301301
IF(HAVE_VISIBILITY_HIDDEN)
302-
GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
303-
IF(NOT COMPILE_FLAGS)
304-
# Avoid COMPILE_FLAGS-NOTFOUND
305-
SET(COMPILE_FLAGS)
306-
ENDIF()
307-
SET_TARGET_PROPERTIES(${target} PROPERTIES
308-
COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden")
302+
ADD_COMPILE_FLAGS(${target} COMPILE_FLAGS "-fvisibility=hidden")
309303
ENDIF()
310304
ENDIF()
311-
ENDFUNCTION()
305+
ENDFUNCTION()

cmake/os/Windows.cmake

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -98,18 +98,20 @@ IF(MSVC)
9898
FOREACH(lang C CXX)
9999
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7")
100100
ENDFOREACH()
101-
FOREACH(flag
102-
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
103-
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
104-
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
105-
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
106-
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
107-
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
108-
IF (NOT WIN_DEBUG_NO_INLINE)
109-
STRING(REPLACE "/Ob0" "/Ob1" "${flag}" "${${flag}}")
110-
ENDIF()
111-
SET("${flag}" "${${flag}} /EHsc")
112-
ENDFOREACH()
101+
IF(NOT WINDOWS_RUNTIME_MD)
102+
FOREACH(flag
103+
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
104+
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
105+
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
106+
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
107+
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
108+
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
109+
IF (NOT WIN_DEBUG_NO_INLINE)
110+
STRING(REPLACE "/Ob0" "/Ob1" "${flag}" "${${flag}}")
111+
ENDIF()
112+
SET("${flag}" "${${flag}} /EHsc")
113+
ENDFOREACH()
114+
ENDIF()
113115

114116
# Fix CMake's predefined huge stack size
115117
FOREACH(type EXE SHARED MODULE)

cmake/plugin.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -216,6 +216,7 @@ MACRO(MYSQL_ADD_PLUGIN)
216216
# executable to the linker command line (it would result into link error).
217217
# Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
218218
# an additional dependency.
219+
# Use MYSQL_PLUGIN_IMPORT for static data symbols to be exported.
219220
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
220221
TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES})
221222
ENDIF()
@@ -269,7 +270,11 @@ ENDMACRO()
269270
MACRO(CONFIGURE_PLUGINS)
270271
FILE(GLOB dirs_storage ${CMAKE_SOURCE_DIR}/storage/*)
271272
FILE(GLOB dirs_plugin ${CMAKE_SOURCE_DIR}/plugin/*)
272-
FOREACH(dir ${dirs_storage} ${dirs_plugin})
273+
IF(WITH_RAPID)
274+
FILE(GLOB dirs_rapid_plugin ${CMAKE_SOURCE_DIR}/rapid/plugin/*)
275+
ENDIF(WITH_RAPID)
276+
277+
FOREACH(dir ${dirs_storage} ${dirs_plugin} ${dirs_rapid_plugin})
273278
IF (EXISTS ${dir}/CMakeLists.txt)
274279
ADD_SUBDIRECTORY(${dir})
275280
ENDIF()

cmake/protobuf.cmake

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
2+
#
3+
# This program is free software; you can redistribute it and/or modify
4+
# it under the terms of the GNU General Public License as published by
5+
# the Free Software Foundation; version 2 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful,
8+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
# GNU General Public License for more details.
11+
#
12+
# You should have received a copy of the GNU General Public License
13+
# along with this program; if not, write to the Free Software
14+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
15+
16+
#
17+
# Usage:
18+
#
19+
# cmake -DWITH_PROTOBUF="bundled"|"system"
20+
#
21+
# Default is "bundled"
22+
# Other values will be ignored, and we fall back to "bundled"
23+
#
24+
25+
MACRO(RESET_PROTOBUF_VARIABLES)
26+
UNSET(PROTOBUF_INCLUDE_DIR CACHE)
27+
UNSET(PROTOBUF_INCLUDE_DIR)
28+
UNSET(PROTOBUF_INCLUDE_DIRS CACHE)
29+
UNSET(PROTOBUF_INCLUDE_DIRS)
30+
UNSET(PROTOBUF_LIBRARIES CACHE)
31+
UNSET(PROTOBUF_LIBRARIES)
32+
UNSET(PROTOBUF_LIBRARY CACHE)
33+
UNSET(PROTOBUF_LIBRARY)
34+
UNSET(PROTOBUF_LIBRARY_DEBUG CACHE)
35+
UNSET(PROTOBUF_LIBRARY_DEBUG)
36+
UNSET(PROTOBUF_LITE_LIBRARY CACHE)
37+
UNSET(PROTOBUF_LITE_LIBRARY)
38+
UNSET(PROTOBUF_LITE_LIBRARY_DEBUG CACHE)
39+
UNSET(PROTOBUF_LITE_LIBRARY_DEBUG)
40+
UNSET(PROTOBUF_PROTOC_EXECUTABLE CACHE)
41+
UNSET(PROTOBUF_PROTOC_EXECUTABLE)
42+
UNSET(PROTOBUF_PROTOC_LIBRARY_DEBUG CACHE)
43+
UNSET(PROTOBUF_PROTOC_LIBRARY_DEBUG)
44+
ENDMACRO()
45+
46+
MACRO(ECHO_PROTOBUF_VARIABLES)
47+
MESSAGE(STATUS "PROTOBUF_INCLUDE_DIR ${PROTOBUF_INCLUDE_DIR}")
48+
MESSAGE(STATUS "PROTOBUF_LIBRARY ${PROTOBUF_LIBRARY}")
49+
MESSAGE(STATUS "PROTOBUF_PROTOC_EXECUTABLE ${PROTOBUF_PROTOC_EXECUTABLE}")
50+
ENDMACRO()
51+
52+
MACRO(COULD_NOT_FIND_PROTOBUF)
53+
ECHO_PROTOBUF_VARIABLES()
54+
MESSAGE(STATUS "Could not find (the correct version of) protobuf.")
55+
MESSAGE(STATUS "MySQL currently requires at least protobuf version 2.5")
56+
MESSAGE(FATAL_ERROR
57+
"You can build with the bundled sources"
58+
)
59+
ENDMACRO()
60+
61+
SET(BUNDLED_PROTO_SRCDIR ${CMAKE_SOURCE_DIR}/extra/protobuf/protobuf-2.6.0/src)
62+
63+
MACRO(MYSQL_USE_BUNDLED_PROTOBUF)
64+
SET(WITH_PROTOBUF "bundled" CACHE INTERNAL
65+
"Bundled protoc and protobuf library")
66+
# Set the same variables as FindProtobuf.cmake
67+
SET(PROTOBUF_FOUND 1 CACHE INTERNAL "")
68+
SET(PROTOBUF_INCLUDE_DIR ${BUNDLED_PROTO_SRCDIR} CACHE INTERNAL "")
69+
SET(PROTOBUF_INCLUDE_DIRS ${BUNDLED_PROTO_SRCDIR} CACHE INTERNAL "")
70+
SET(PROTOBUF_LIBRARY protobuf CACHE INTERNAL "")
71+
SET(PROTOBUF_LIBRARY_DEBUG protobuf CACHE INTERNAL "")
72+
SET(PROTOBUF_LIBRARIES protobuf CACHE INTERNAL "")
73+
SET(PROTOBUF_PROTOC_EXECUTABLE protoc CACHE INTERNAL "")
74+
SET(PROTOBUF_PROTOC_LIBRARY protoclib CACHE INTERNAL "")
75+
SET(PROTOBUF_PROTOC_LIBRARY_DEBUG protoclib CACHE INTERNAL "")
76+
SET(PROTOBUF_LITE_LIBRARY protobuf-lite CACHE INTERNAL "")
77+
SET(PROTOBUF_LITE_LIBRARY_DEBUG protobuf-lite CACHE INTERNAL "")
78+
ADD_SUBDIRECTORY(extra/protobuf)
79+
ENDMACRO()
80+
81+
MACRO(MYSQL_CHECK_PROTOBUF)
82+
IF (NOT WITH_PROTOBUF OR
83+
NOT WITH_PROTOBUF STREQUAL "system")
84+
SET(WITH_PROTOBUF "bundled")
85+
ENDIF()
86+
MESSAGE(STATUS "WITH_PROTOBUF=${WITH_PROTOBUF}")
87+
IF(WITH_PROTOBUF STREQUAL "bundled")
88+
MYSQL_USE_BUNDLED_PROTOBUF()
89+
ELSE()
90+
FIND_PACKAGE(Protobuf)
91+
ENDIF()
92+
93+
IF(NOT PROTOBUF_FOUND)
94+
MESSAGE(WARNING "Protobuf could not be found")
95+
ENDIF()
96+
97+
IF(PROTOBUF_FOUND)
98+
# Verify protobuf version number. Version information looks like:
99+
# // The current version, represented as a single integer to make comparison
100+
# // easier: major * 10^6 + minor * 10^3 + micro
101+
# #define GOOGLE_PROTOBUF_VERSION 2006000
102+
FILE(STRINGS "${PROTOBUF_INCLUDE_DIR}/google/protobuf/stubs/common.h"
103+
PROTOBUF_VERSION_NUMBER
104+
REGEX "^#define[\t ]+GOOGLE_PROTOBUF_VERSION[\t ][0-9]+.*"
105+
)
106+
STRING(REGEX REPLACE
107+
"^.*GOOGLE_PROTOBUF_VERSION[\t ]([0-9])[0-9][0-9]([0-9])[0-9][0-9].*$"
108+
"\\1"
109+
PROTOBUF_MAJOR_VERSION "${PROTOBUF_VERSION_NUMBER}")
110+
STRING(REGEX REPLACE
111+
"^.*GOOGLE_PROTOBUF_VERSION[\t ]([0-9])[0-9][0-9]([0-9])[0-9][0-9].*$"
112+
"\\2"
113+
PROTOBUF_MINOR_VERSION "${PROTOBUF_VERSION_NUMBER}")
114+
115+
MESSAGE(STATUS
116+
"protobuf version is ${PROTOBUF_MAJOR_VERSION}.${PROTOBUF_MINOR_VERSION}")
117+
118+
IF("${PROTOBUF_MAJOR_VERSION}.${PROTOBUF_MINOR_VERSION}" VERSION_LESS "2.5")
119+
COULD_NOT_FIND_PROTOBUF()
120+
ENDIF()
121+
ENDIF()
122+
ENDMACRO()

cmake/ssl.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -193,13 +193,13 @@ MACRO (MYSQL_CHECK_SSL)
193193
IF (WITH_SSL_PATH)
194194
GET_FILENAME_COMPONENT(CRYPTO_EXT "${CRYPTO_LIBRARY}" EXT)
195195
GET_FILENAME_COMPONENT(OPENSSL_EXT "${OPENSSL_LIBRARY}" EXT)
196-
IF (CRYPTO_EXT STREQUAL ".a")
196+
IF (CRYPTO_EXT STREQUAL ".a" OR OPENSSL_EXT STREQUAL ".lib")
197197
SET(MY_CRYPTO_LIBRARY imported_crypto)
198198
ADD_LIBRARY(imported_crypto STATIC IMPORTED)
199199
SET_TARGET_PROPERTIES(imported_crypto
200200
PROPERTIES IMPORTED_LOCATION "${CRYPTO_LIBRARY}")
201201
ENDIF()
202-
IF (OPENSSL_EXT STREQUAL ".a")
202+
IF (OPENSSL_EXT STREQUAL ".a" OR OPENSSL_EXT STREQUAL ".lib")
203203
SET(MY_OPENSSL_LIBRARY imported_openssl)
204204
ADD_LIBRARY(imported_openssl STATIC IMPORTED)
205205
SET_TARGET_PROPERTIES(imported_openssl

config.h.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@
362362
#cmakedefine HAVE_SYS_THREAD_SELFID 1
363363
#cmakedefine HAVE_SYS_GETTID 1
364364
#cmakedefine HAVE_PTHREAD_GETTHREADID_NP 1
365+
#cmakedefine HAVE_PTHREAD_SETNAME_NP 1
365366
#cmakedefine HAVE_INTEGER_PTHREAD_SELF 1
366367

367368
/* Platform-specific C++ compiler behaviors we rely upon */
@@ -417,7 +418,10 @@
417418
#define HAVE_FCNTL_H 1
418419
#define HAVE_GETADDRINFO 1
419420
#define HAVE_INTTYPES_H 1
421+
/* libevent's select.c is not Windows compatible */
422+
#ifndef _WIN32
420423
#define HAVE_SELECT 1
424+
#endif
421425
#define HAVE_SIGNAL_H 1
422426
#define HAVE_STDARG_H 1
423427
#define HAVE_STDINT_H 1
@@ -429,6 +433,11 @@
429433
#define HAVE_SYS_TYPES_H 1
430434
#define SIZEOF_CHAR 1
431435

436+
/*
437+
* Needed by libevent
438+
*/
439+
#cmakedefine HAVE_SOCKLEN_T 1
440+
432441
/* For --secure-file-priv */
433442
#cmakedefine DEFAULT_SECURE_FILE_PRIV_DIR @DEFAULT_SECURE_FILE_PRIV_DIR@
434443
#cmakedefine DEFAULT_SECURE_FILE_PRIV_EMBEDDED_DIR @DEFAULT_SECURE_FILE_PRIV_EMBEDDED_DIR@

configure.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -844,3 +844,9 @@ IF(HAVE_NUMAIF_H AND WITH_NUMA)
844844
HAVE_LIBNUMA)
845845
SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES})
846846
ENDIF()
847+
848+
# needed for libevent
849+
CHECK_TYPE_SIZE("socklen_t" SIZEOF_SOCKLEN_T)
850+
IF(SIZEOF_SOCKLEN_T)
851+
SET(HAVE_SOCKLEN_T 1)
852+
ENDIF()

0 commit comments

Comments
 (0)