-
Notifications
You must be signed in to change notification settings - Fork 2
Support Percona MySQL 8 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,9 @@ PROJECT (libslave) | |
| OPTION (BUILD_STATIC "Force building static library" ON) | ||
| OPTION (WITH_TESTING "Enable building the tests framework" OFF) | ||
|
|
||
| SET (THREADS_PREFER_PTHREAD_FLAG ON) | ||
| FIND_PACKAGE (Threads REQUIRED) | ||
|
|
||
| # Build flags | ||
| SET (CMAKE_CXX_STANDARD 14) | ||
| SET (CMAKE_CXX_STANDARD_REQUIRED TRUE) | ||
|
|
@@ -21,66 +24,55 @@ IF (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" | |
| ADD_DEFINITIONS (-Wall) | ||
| ENDIF () | ||
|
|
||
| # Fixes a lot of annoying warnings about auto_ptr deprecation | ||
| ADD_DEFINITIONS (-DBOOST_NO_AUTO_PTR) | ||
|
|
||
| SET (BOOST_DIR ${CMAKE_CURRENT_SOURCE_DIR}) | ||
| SET (BOOST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/boost) | ||
| SET (MYSQL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/mysql) | ||
| SET (MYSQL_BIN ${CMAKE_BINARY_DIR}/mysql) | ||
| FILE (MAKE_DIRECTORY ${MYSQL_BIN}) | ||
|
|
||
| INCLUDE_DIRECTORIES ( | ||
| BEFORE SYSTEM | ||
| ${MYSQL_BIN}/include | ||
| ${MYSQL_SRC}/include | ||
| ${MYSQL_SRC}/libbinlogevents/export | ||
| ${BOOST_DIR}/boost_1_69_0/boost | ||
| ) | ||
| ADD_CUSTOM_TARGET ( | ||
| fix_static_build | ||
| WORKING_DIRECTORY ${MYSQL_BIN} | ||
| COMMAND sed -i '/GET_TARGET_PROPERTY.*libmysql/s/libmysql/perconaserverclient/' ${MYSQL_SRC}/scripts/CMakeLists.txt | ||
| ) | ||
| ADD_CUSTOM_TARGET ( | ||
| mysql_configure | ||
| WORKING_DIRECTORY ${MYSQL_BIN} | ||
| DEPENDS fix_static_build | ||
| COMMAND "${CMAKE_COMMAND}" | ||
| mysql_configure | ||
| WORKING_DIRECTORY ${MYSQL_BIN} | ||
| COMMAND "${CMAKE_COMMAND}" | ||
| -DCMAKE_BUILD_TYPE=Release | ||
| -DDISABLE_SHARED=1 | ||
| -DENABLED_PROFILING=0 | ||
| -DWITHOUT_SERVER=1 | ||
| -DWITH_CLIENT_PROTOCOL_TRACING=0 | ||
| -DWITH_DEFAULT_FEATURE_SET=0 | ||
| -DWITH_SSL=bundled | ||
| -DWITH_SSL=system | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the reasons to change it? |
||
| -DWITH_ZLIB=bundled | ||
| -DWITH_LIBEVENT=bundled | ||
| -DWITH_LZ4=bundled | ||
| -DWITH_PROTOBUF=bundled | ||
| -DWITH_EDITLINE=bundled | ||
| -DDOWNLOAD_BOOST=1 -DWITH_BOOST=${BOOST_DIR} | ||
| -DDOWNLOAD_BOOST=1 | ||
| -DDOWNLOAD_BOOST_TIMEOUT=1200 | ||
| -DWITH_BOOST=${BOOST_DIR} | ||
| ${MYSQL_SRC} | ||
| ) | ||
|
|
||
| ADD_CUSTOM_TARGET ( | ||
| mysqlclient_build | ||
| WORKING_DIRECTORY ${MYSQL_BIN} | ||
| DEPENDS mysql_configure | ||
| COMMAND ${CMAKE_COMMAND} --build . --target perconaserverclient | ||
| binlogevents_build | ||
| WORKING_DIRECTORY ${MYSQL_BIN} | ||
| DEPENDS mysql_configure | ||
| COMMAND ${CMAKE_COMMAND} --build . --target binlogevents_static | ||
| ) | ||
|
|
||
| ADD_CUSTOM_TARGET ( | ||
| binlogevents_build | ||
| WORKING_DIRECTORY ${MYSQL_BIN} | ||
| DEPENDS mysql_configure | ||
| COMMAND ${CMAKE_COMMAND} --build . --target binlogevents_static | ||
| mysql_client_build | ||
| WORKING_DIRECTORY ${MYSQL_BIN} | ||
| DEPENDS binlogevents_build | ||
| COMMAND ${CMAKE_COMMAND} --build . --target perconaserverclient | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems it's a formatting change and it is not related to Percona 8 support. Please remove it. |
||
| ) | ||
|
|
||
| ADD_LIBRARY (mysqlclient STATIC IMPORTED) | ||
| ADD_DEPENDENCIES (mysqlclient mysqlclient_build) | ||
| SET_PROPERTY (TARGET mysqlclient PROPERTY IMPORTED_LOCATION ${MYSQL_BIN}/archive_output_directory/libperconaserverclient.a) | ||
|
|
||
| ADD_LIBRARY (binlogevents STATIC IMPORTED) | ||
| ADD_DEPENDENCIES (binlogevents binlogevents_build) | ||
| SET_PROPERTY (TARGET binlogevents PROPERTY IMPORTED_LOCATION ${MYSQL_BIN}/libbinlogevents/lib/libbinlogevents.a) | ||
| SET_PROPERTY (TARGET binlogevents PROPERTY IMPORTED_LOCATION ${MYSQL_BIN}/libbinlogevents/lib/${CMAKE_STATIC_LIBRARY_PREFIX}binlogevents${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
|
|
||
| ADD_LIBRARY (libmysql STATIC IMPORTED) | ||
| ADD_DEPENDENCIES (libmysql mysql_client_build) | ||
| SET_TARGET_PROPERTIES (libmysql PROPERTIES IMPORTED_LOCATION ${MYSQL_BIN}/archive_output_directory/${CMAKE_STATIC_LIBRARY_PREFIX}perconaserverclient${CMAKE_STATIC_LIBRARY_SUFFIX}) | ||
| SET_TARGET_PROPERTIES (libmysql PROPERTIES INTERFACE_LINK_LIBRARIES binlogevents) | ||
|
|
||
| ADD_DEFINITIONS (-DDBUG_OFF) | ||
| SET (LINK_TYPE STATIC) | ||
|
|
@@ -94,9 +86,15 @@ FILE (GLOB HDR "*.h") | |
| INSTALL (FILES ${HDR} DESTINATION include) | ||
| AUX_SOURCE_DIRECTORY (${CMAKE_CURRENT_SOURCE_DIR} SRC) | ||
|
|
||
| # Most probably static mysql is built without fPIC, so, we can't build dynamic library with it | ||
| ADD_LIBRARY (slave ${LINK_TYPE} ${SRC}) | ||
| TARGET_LINK_LIBRARIES (slave ${MYSQL_LIBS} -lpthread) | ||
| TARGET_LINK_LIBRARIES (slave PUBLIC libmysql ssl crypto Threads::Threads m rt dl) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What are the reasons to remove MYSQL_LIBS here? |
||
| TARGET_INCLUDE_DIRECTORIES (slave PUBLIC | ||
| ${MYSQL_BIN}/include | ||
| ${MYSQL_SRC} | ||
| ${MYSQL_SRC}/include | ||
| ${MYSQL_SRC}/libbinlogevents/export | ||
| ${BOOST_DIR}/boost_1_70_0 | ||
| ) | ||
| INSTALL (TARGETS slave DESTINATION lib64) | ||
|
|
||
| IF (WITH_TESTING) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,7 +117,7 @@ const char* Field_decimal::unpack(const char *from) | |
| int value_length = decimal_string_size(&dec); | ||
| char buffer[ value_length ]; | ||
|
|
||
| if (::decimal2string(&dec, (char*)&buffer, &value_length, zerofill ? precision : 0, scale, '0') != E_DEC_OK) { | ||
| if (::decimal2string(&dec, (char*)&buffer, &value_length, zerofill ? precision : 0, scale) != E_DEC_OK) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are at least two supported versions of MySQL: 5.7 and 8.0 [1] [2]. This change will add compatibility with 8.x and will broke compatibility with 5.7. Perhaps we need to introduce a compilation flag (for example |
||
| throw std::runtime_error("Field_decimal::unpack(): decimal2string() failed"); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -381,6 +381,9 @@ bool read_log_event(const char* buf, uint event_len, Basic_event_info& bei, Even | |
| case TRANSACTION_CONTEXT_EVENT: | ||
| case VIEW_CHANGE_EVENT: | ||
| case XA_PREPARE_LOG_EVENT: | ||
| case PARTIAL_UPDATE_ROWS_EVENT: | ||
| case START_5_7_ENCRYPTION_EVENT: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like event |
||
| case MARIA_EVENTS_BEGIN: | ||
| if (event_stat) | ||
| event_stat->tickOther(); | ||
| return false; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,6 +87,29 @@ enum Log_event_type | |
|
|
||
| XA_PREPARE_LOG_EVENT= 38, | ||
|
|
||
| /* | ||
| * Extension of UPDATE_ROWS_EVENT, allowing partial values according | ||
| * to binlog_row_value_options. | ||
| */ | ||
| PARTIAL_UPDATE_ROWS_EVENT = 39, | ||
|
|
||
| /* | ||
| * Add new events here - right above this comment! | ||
| * Existing events (except ENUM_END_EVENT) should never change their numbers | ||
| */ | ||
|
|
||
| /* New MySQL events are to be added right above this comment */ | ||
| MYSQL_END_EVENT, | ||
|
|
||
| /* Add new Percona Server events here - its ids should go downwards | ||
| * starting from MARIA_EVENTS_BEGIN, i.e. 159, 158 .. | ||
| * till MYSQL_END_EVENT | ||
| */ | ||
|
|
||
| START_5_7_ENCRYPTION_EVENT = 159, | ||
|
|
||
| MARIA_EVENTS_BEGIN = 160, | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| ENUM_END_EVENT | ||
| }; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is not related to PR with Percona 8 support. Please remove it.