Skip to content

Commit c4ed889

Browse files
committed
Merge branch '10.11' into 11.4
2 parents ca91bf5 + 053f9bc commit c4ed889

File tree

427 files changed

+9969
-4921
lines changed

Some content is hidden

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

427 files changed

+9969
-4921
lines changed

CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,13 @@ SET(WITH_SAFEMALLOC "AUTO" CACHE STRING "Use safemalloc memory debugger. Will re
347347

348348
IF(WITH_SAFEMALLOC MATCHES "ON")
349349
ADD_DEFINITIONS( -DSAFEMALLOC)
350-
ELSEIF(WITH_SAFEMALLOC MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND)
350+
ELSEIF(WITH_SAFEMALLOC MATCHES "AUTO"
351+
AND NOT WIN32
352+
AND NOT WITH_VALGRIND
353+
AND NOT WITH_ASAN
354+
AND NOT WITH_UBSAN
355+
AND NOT WITH_TSAN
356+
AND NOT WITH_MSAN)
351357
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DSAFEMALLOC")
352358
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DSAFEMALLOC")
353359
ENDIF()

client/mysql.cc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,6 +3208,26 @@ static int reconnect(void)
32083208
return 0;
32093209
}
32103210

3211+
#ifndef EMBEDDED_LIBRARY
3212+
static void status_info_cb(void *data, enum enum_mariadb_status_info type, ...)
3213+
{
3214+
va_list ap;
3215+
va_start(ap, type);
3216+
if (type == SESSION_TRACK_TYPE && va_arg(ap, int) == SESSION_TRACK_SCHEMA)
3217+
{
3218+
MARIADB_CONST_STRING *val= va_arg(ap, MARIADB_CONST_STRING *);
3219+
my_free(current_db);
3220+
if (val->length)
3221+
current_db= my_strndup(PSI_NOT_INSTRUMENTED, val->str, val->length, MYF(MY_FAE));
3222+
else
3223+
current_db= NULL;
3224+
}
3225+
va_end(ap);
3226+
}
3227+
#else
3228+
#define mysql_optionsv(A,B,C,D) do { } while(0)
3229+
#endif
3230+
32113231
static void get_current_db()
32123232
{
32133233
MYSQL_RES *res;
@@ -5021,6 +5041,8 @@ sql_real_connect(char *host,char *database,char *user,char *password,
50215041
mysql_close(&mysql);
50225042
}
50235043
mysql_init(&mysql);
5044+
if (!one_database)
5045+
mysql_optionsv(&mysql, MARIADB_OPT_STATUS_CALLBACK, status_info_cb, NULL);
50245046
if (opt_init_command)
50255047
mysql_options(&mysql, MYSQL_INIT_COMMAND, opt_init_command);
50265048
if (opt_connect_timeout)

client/mysqlbinlog.cc

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,9 +1034,16 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
10341034
binlog, even if they have a server_id. Also, we have to read
10351035
the format_description event so that we can parse subsequent
10361036
events.
1037+
Don't skip Unknown events either since we don't know their `server_id`s.
10371038
*/
1038-
if (ev_type != ROTATE_EVENT && is_server_id_excluded(ev->server_id))
1039-
goto end;
1039+
switch (ev_type) {
1040+
case ROTATE_EVENT:
1041+
case UNKNOWN_EVENT:
1042+
break;
1043+
default:
1044+
if (is_server_id_excluded(ev->server_id))
1045+
goto end;
1046+
}
10401047
}
10411048
if ((ev->when >= stop_datetime)
10421049
|| (pos >= stop_position_mot))
@@ -3394,7 +3401,8 @@ int main(int argc, char** argv)
33943401
}
33953402

33963403
/*
3397-
Emit a warning if we finished processing input before reaching the stop
3404+
Emit warning(s) (in Gtid_event_filter::verify_completed_state() for GTID(s))
3405+
if we finished processing input before reaching the stop
33983406
boundaries indicated by --stop-datetime or --stop-position.
33993407
*/
34003408
if (stop_datetime != MY_TIME_T_MAX &&
@@ -3405,6 +3413,8 @@ int main(int argc, char** argv)
34053413
stop_position > last_processed_ev.position)
34063414
warning("Did not reach stop position %llu before end of input",
34073415
stop_position);
3416+
if (position_gtid_filter)
3417+
position_gtid_filter->verify_final_state();
34083418

34093419
/*
34103420
If enable flashback, need to print the events from the end to the

client/mysqldump.cc

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ static DYNAMIC_STRING extended_row;
184184
static DYNAMIC_STRING dynamic_where;
185185
static MYSQL_RES *get_table_name_result= NULL;
186186
static MEM_ROOT glob_root;
187-
static MYSQL_RES *routine_res, *routine_list_res;
187+
static MYSQL_RES *routine_res, *routine_list_res, *slave_status_res= NULL;
188188

189189

190190
#include <sslopt-vars.h>
@@ -1910,6 +1910,8 @@ static void free_resources()
19101910
mysql_free_result(routine_res);
19111911
if (routine_list_res)
19121912
mysql_free_result(routine_list_res);
1913+
if (slave_status_res)
1914+
mysql_free_result(slave_status_res);
19131915
if (mysql)
19141916
{
19151917
mysql_close(mysql);
@@ -6291,17 +6293,19 @@ static int do_show_master_status(MYSQL *mysql_con, int consistent_binlog_pos,
62916293

62926294
static int do_stop_slave_sql(MYSQL *mysql_con)
62936295
{
6294-
MYSQL_RES *slave;
62956296
MYSQL_ROW row;
6297+
DBUG_ASSERT(
6298+
!slave_status_res // do_stop_slave_sql() should only be called once
6299+
);
62966300

6297-
if (mysql_query_with_error_report(mysql_con, &slave,
6301+
if (mysql_query_with_error_report(mysql_con, &slave_status_res,
62986302
multi_source ?
62996303
"SHOW ALL SLAVES STATUS" :
63006304
"SHOW SLAVE STATUS"))
63016305
return(1);
63026306

63036307
/* Loop over all slaves */
6304-
while ((row= mysql_fetch_row(slave)))
6308+
while ((row= mysql_fetch_row(slave_status_res)))
63056309
{
63066310
if (row[11 + multi_source])
63076311
{
@@ -6316,13 +6320,11 @@ static int do_stop_slave_sql(MYSQL *mysql_con)
63166320

63176321
if (mysql_query_with_error_report(mysql_con, 0, query))
63186322
{
6319-
mysql_free_result(slave);
63206323
return 1;
63216324
}
63226325
}
63236326
}
63246327
}
6325-
mysql_free_result(slave);
63266328
return(0);
63276329
}
63286330

@@ -6446,32 +6448,35 @@ static int do_show_slave_status(MYSQL *mysql_con, int have_mariadb_gtid,
64466448

64476449
static int do_start_slave_sql(MYSQL *mysql_con)
64486450
{
6449-
MYSQL_RES *slave;
64506451
MYSQL_ROW row;
64516452
int error= 0;
64526453
DBUG_ENTER("do_start_slave_sql");
64536454

6454-
/* We need to check if the slave sql is stopped in the first place */
6455-
if (mysql_query_with_error_report(mysql_con, &slave,
6456-
multi_source ?
6457-
"SHOW ALL SLAVES STATUS" :
6458-
"SHOW SLAVE STATUS"))
6459-
DBUG_RETURN(1);
6455+
/*
6456+
do_start_slave_sql() should normally be called
6457+
sometime after do_stop_slave_sql() succeeds
6458+
*/
6459+
if (!slave_status_res)
6460+
DBUG_RETURN(error);
6461+
mysql_data_seek(slave_status_res, 0);
64606462

6461-
while ((row= mysql_fetch_row(slave)))
6463+
while ((row= mysql_fetch_row(slave_status_res)))
64626464
{
64636465
DBUG_PRINT("info", ("Connection: '%s' status: '%s'",
64646466
multi_source ? row[0] : "", row[11 + multi_source]));
64656467
if (row[11 + multi_source])
64666468
{
6467-
/* if SLAVE SQL is not running, we don't start it */
6468-
if (strcmp(row[11 + multi_source], "Yes"))
6469+
/*
6470+
If SLAVE_SQL was not running but is now,
6471+
we start it anyway to warn the unexpected state change.
6472+
*/
6473+
if (strcmp(row[11 + multi_source], "No"))
64696474
{
64706475
char query[160];
64716476
if (multi_source)
6472-
sprintf(query, "START SLAVE '%.80s'", row[0]);
6477+
sprintf(query, "START SLAVE '%.80s' SQL_THREAD", row[0]);
64736478
else
6474-
strmov(query, "START SLAVE");
6479+
strmov(query, "START SLAVE SQL_THREAD");
64756480

64766481
if (mysql_query_with_error_report(mysql_con, 0, query))
64776482
{
@@ -6482,7 +6487,6 @@ static int do_start_slave_sql(MYSQL *mysql_con)
64826487
}
64836488
}
64846489
}
6485-
mysql_free_result(slave);
64866490
DBUG_RETURN(error);
64876491
}
64886492

client/mysqltest.cc

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8733,7 +8733,7 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
87338733
DYNAMIC_STRING ds_res_1st_execution;
87348734
my_bool ds_res_1st_execution_init = FALSE;
87358735
my_bool compare_2nd_execution = TRUE;
8736-
int query_match_ps2_re;
8736+
int query_match_ps2_re, query_match_cursor_re;
87378737
MYSQL_RES *res;
87388738
DBUG_ENTER("run_query_stmt");
87398739
DBUG_PRINT("query", ("'%-.60s'", query));
@@ -8792,6 +8792,9 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
87928792
parameter markers.
87938793
*/
87948794

8795+
query_match_cursor_re= cursor_protocol_enabled && cn->stmt->field_count &&
8796+
match_re(&cursor_re, query);
8797+
87958798
if (cursor_protocol_enabled)
87968799
{
87978800
ps2_protocol_enabled = 0;
@@ -8800,7 +8803,7 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
88008803
Use cursor for queries matching the filter,
88018804
else reset cursor type
88028805
*/
8803-
if (match_re(&cursor_re, query))
8806+
if (query_match_cursor_re)
88048807
{
88058808
/*
88068809
Use cursor when retrieving result
@@ -8812,12 +8815,13 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
88128815
}
88138816
}
88148817

8815-
query_match_ps2_re = match_re(&ps2_re, query);
8818+
query_match_ps2_re = ps2_protocol_enabled && cn->stmt->field_count &&
8819+
match_re(&ps2_re, query);
88168820

88178821
/*
88188822
Execute the query first time if second execution enable
88198823
*/
8820-
if (ps2_protocol_enabled && query_match_ps2_re)
8824+
if (query_match_ps2_re)
88218825
{
88228826
if (do_stmt_execute(cn))
88238827
{
@@ -8873,8 +8877,7 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
88738877
and keep them in a separate string for later. Cursor_protocol is used
88748878
only for queries matching the filter "cursor_re".
88758879
*/
8876-
if (cursor_protocol_enabled && match_re(&cursor_re, query) &&
8877-
!disable_warnings)
8880+
if (query_match_cursor_re && !disable_warnings)
88788881
append_warnings(&ds_execute_warnings, mysql);
88798882

88808883
if (read_stmt_results(stmt, ds, command))
@@ -8886,7 +8889,7 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
88868889
The results of the first and second execution are compared
88878890
only if result logging is enabled
88888891
*/
8889-
if (compare_2nd_execution && ps2_protocol_enabled && query_match_ps2_re)
8892+
if (compare_2nd_execution && query_match_ps2_re)
88908893
{
88918894
if (ds->length != ds_res_1st_execution.length ||
88928895
!(memcmp(ds_res_1st_execution.str, ds->str, ds->length) == 0))

cmake/aws_sdk.cmake

Lines changed: 30 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,27 @@ MACRO (SKIP_AWS_SDK MSG)
44
RETURN()
55
ENDMACRO()
66

7-
FUNCTION (CHECK_AWS_SDK RETVAL REASON)
7+
FUNCTION (CHECK_AWS_SDK COMPONENTS RETVAL REASON)
88
# AWS_SDK_EXTERNAL_PROJECT must be ON
99
IF(NOT AWS_SDK_EXTERNAL_PROJECT)
10-
SKIP_AWS_SDK("AWS_SDK_EXTERNAL_PROJECT is not ON")
10+
FOREACH(comp ${COMPONENTS})
11+
FIND_PACKAGE(aws-cpp-sdk-${comp} CONFIG QUIET)
12+
IF (NOT aws-cpp-sdk-${comp}_FOUND)
13+
SKIP_AWS_SDK("AWS_SDK_EXTERNAL_PROJECT is not ON and aws-cpp-sdk-${comp} not found")
14+
ENDIF()
15+
ENDFOREACH()
16+
SET(${RETVAL} ON PARENT_SCOPE)
1117
ENDIF()
1218
IF(NOT NOT_FOR_DISTRIBUTION)
1319
SKIP_AWS_SDK("AWS SDK has Apache 2.0 License which is not compatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need it")
1420
ENDIF()
21+
IF(CMAKE_VERSION VERSION_LESS "3.15")
22+
SKIP_AWS_SDK("CMake too old")
23+
ENDIF()
1524
# Check compiler support
1625
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
17-
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
18-
IF (GCC_VERSION VERSION_LESS 4.8)
19-
SKIP_AWS_SDK("GCC VERSION too old (${GCC_VERSION}, required is 4.8 or later")
26+
IF (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
27+
SKIP_AWS_SDK("GCC VERSION too old (${GCC_VERSION}, required is 4.9 or later")
2028
ENDIF()
2129
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
2230
IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
@@ -36,35 +44,27 @@ FUNCTION (CHECK_AWS_SDK RETVAL REASON)
3644
SKIP_AWS_SDK("OS unsupported by AWS SDK")
3745
ENDIF()
3846

39-
# Build from source, using ExternalProject_Add
40-
# AWS C++ SDK requires cmake 2.8.12
41-
IF(CMAKE_VERSION VERSION_LESS "2.8.12")
42-
SKIP_AWS_SDK("CMake is too old")
43-
ENDIF()
44-
4547
IF(UNIX)
46-
# Check librairies required for building SDK
47-
FIND_PACKAGE(CURL)
48-
SET_PACKAGE_PROPERTIES(CURL PROPERTIES TYPE REQUIRED)
49-
IF(NOT CURL_FOUND)
50-
SKIP_AWS_SDK("AWS C++ SDK requires libcurl development package")
48+
IF("${WITH_ZLIB}" STREQUAL "bundled")
49+
# Breaks FIND_PACKAGE(ZLIB)
50+
SKIP_AWS_SDK("Incompatible with WITH_ZLIB=bundled")
5151
ENDIF()
52-
FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h)
53-
IF(NOT UUID_INCLUDE_DIR)
54-
SKIP_AWS_SDK("AWS C++ SDK requires uuid development package")
55-
ENDIF()
56-
IF(NOT APPLE)
57-
FIND_LIBRARY(UUID_LIBRARIES uuid)
58-
SET_PACKAGE_PROPERTIES(UUID_LIBRARIES PROPERTIES TYPE REQUIRED)
59-
IF(NOT UUID_LIBRARIES)
60-
SKIP_AWS_SDK("AWS C++ SDK requires uuid development package")
52+
# Check libraries required for building SDK
53+
FOREACH(pkg CURL ZLIB OpenSSL)
54+
FIND_PACKAGE(${pkg})
55+
IF(NOT ${pkg}_FOUND)
56+
SKIP_AWS_SDK("AWS C++ SDK requires ${pkg}")
6157
ENDIF()
62-
FIND_PACKAGE(OpenSSL)
63-
SET_PACKAGE_PROPERTIES(OpenSSL PROPERTIES TYPE REQUIRED)
64-
IF(NOT OPENSSL_FOUND)
65-
SKIP_AWS_SDK("AWS C++ SDK requires openssl development package")
58+
SET_PACKAGE_PROPERTIES(${pkg} PROPERTIES TYPE REQUIRED)
59+
ENDFOREACH()
60+
# Also check for required libraries explicitely - they might be
61+
# missing, even if check above succeeds, e.g when using own copy
62+
# of zlib
63+
FOREACH(lib OpenSSL::Crypto ZLIB::ZLIB CURL::libcurl)
64+
IF(NOT TARGET ${lib})
65+
SKIP_AWS_SDK("AWS C++ SDK requires ${lib}")
6666
ENDIF()
67-
ENDIF()
67+
ENDFOREACH()
6868
ENDIF()
6969
SET(${RETVAL} ON PARENT_SCOPE)
7070
ENDFUNCTION()
@@ -85,14 +85,4 @@ FUNCTION(USE_AWS_SDK_LIBS)
8585
SET_PROPERTY(GLOBAL PROPERTY AWS_SDK_LIBS ${comp} APPEND)
8686
TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-${comp})
8787
ENDFOREACH()
88-
TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-core)
89-
TARGET_INCLUDE_DIRECTORIES(${target} PRIVATE ${PROJECT_BINARY_DIR}/extra/aws_sdk/aws_sdk_cpp/include)
90-
# Link OS libraries that AWS SDK depends on
91-
IF(WIN32)
92-
TARGET_LINK_LIBRARIES(${target} bcrypt winhttp wininet userenv version)
93-
ELSE()
94-
FIND_PACKAGE(CURL REQUIRED)
95-
FIND_PACKAGE(OpenSSL REQUIRED)
96-
TARGET_LINK_LIBRARIES(${target} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES})
97-
ENDIF()
9888
ENDFUNCTION()

cmake/build_configurations/mysql_release.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ ELSEIF(DEB)
118118
SET(WITH_ZLIB system CACHE STRING "")
119119
SET(WITH_LIBWRAP ON)
120120
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
121-
SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
121+
# No hurd implementation
122+
IF(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL "i686-AT386")
123+
SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
124+
ENDIF()
122125
SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "")
123126
SET(WITH_PCRE system CACHE STRING "")
124127
SET(CLIENT_PLUGIN_ZSTD OFF)

cmake/os/WindowsCache.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,5 @@ SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "")
361361
SET(OFF64_T CACHE INTERNAL "")
362362
SET(Z_HAVE_UNISTD_H CACHE INTERNAL "")
363363
SET(HAVE_OFF64_T CACHE FALSE INTERNAL "")
364+
SET(HAVE_AUXV_GETAUXVAL CACHE INTERNAL "")
364365
ENDIF(MSVC)

cmake/plugin.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@ MACRO(MYSQL_ADD_PLUGIN)
161161
PROPERTIES COMPILE_DEFINITIONS "EMBEDDED_LIBRARY${version_string}")
162162
ENDIF()
163163
ADD_DEPENDENCIES(${target}_embedded GenError ${ARG_DEPENDS})
164+
IF(ARG_LINK_LIBRARIES)
165+
TARGET_LINK_LIBRARIES (${target}_embedded ${ARG_LINK_LIBRARIES})
166+
ENDIF()
164167
ENDIF()
165168
ENDIF()
166169

0 commit comments

Comments
 (0)