Skip to content

Commit 3d0fb15

Browse files
committed
Merge branch '10.6' into 10.11
2 parents db3be9b + f00711b commit 3d0fb15

File tree

655 files changed

+8056
-3537
lines changed

Some content is hidden

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

655 files changed

+8056
-3537
lines changed

client/mysqltest.cc

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3933,9 +3933,9 @@ void do_move_file(struct st_command *command)
39333933
is_sub_path(ds_to_file.str, to_plen, vardir)) ||
39343934
(is_sub_path(ds_from_file.str, from_plen, tmpdir) &&
39353935
is_sub_path(ds_to_file.str, to_plen, tmpdir)))) {
3936-
report_or_die("Paths '%s' and '%s' are not both under MYSQLTEST_VARDIR '%s'"
3937-
"or both under MYSQL_TMP_DIR '%s'",
3938-
ds_from_file, ds_to_file, vardir, tmpdir);
3936+
report_or_die("Paths '%s' and '%s' are not both under "
3937+
"MYSQLTEST_VARDIR '%s' or both under MYSQL_TMP_DIR '%s'",
3938+
ds_from_file.str, ds_to_file.str, vardir, tmpdir);
39393939
DBUG_VOID_RETURN;
39403940
}
39413941

@@ -7974,18 +7974,37 @@ static const char *trking_info_desc[SESSION_TRACK_END + 1]=
79747974
/**
79757975
@brief Append state change information (received through Ok packet) to the output.
79767976
7977+
@details The appended string is lines prefixed with "-- ". Only
7978+
tracking types with info sent from the server are displayed. For
7979+
each tracking type, the first line is the type name e.g.
7980+
"-- Tracker : SESSION_TRACK_SYSTEM_VARIABLES".
7981+
7982+
The subsequent lines are the actual tracking info. When type is
7983+
SESSION_TRACK_SYSTEM_VARIABLES, the actual tracking info is a list
7984+
of name-value pairs of lines, sorted by name, e.g. if the info
7985+
received from the server is "autocommit=ON;time_zone=SYSTEM", the
7986+
corresponding string is
7987+
7988+
-- autocommit: ON
7989+
-- time_zone: SYSTEM
7990+
79777991
@param [in,out] ds Dynamic string to hold the content to be printed.
79787992
@param [in] mysql Connection handle.
79797993
*/
79807994

79817995
static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
79827996
{
79837997
#ifndef EMBEDDED_LIBRARY
7998+
DYNAMIC_STRING ds_sort, *ds_type= NULL;
79847999
for (unsigned int type= SESSION_TRACK_BEGIN; type <= SESSION_TRACK_END; type++)
79858000
{
79868001
const char *data;
79878002
size_t data_length;
79888003

8004+
/*
8005+
Append the tracking type line, if any corresponding tracking
8006+
info is received.
8007+
*/
79898008
if (!mysql_session_track_get_first(mysql,
79908009
(enum_session_state_type) type,
79918010
&data, &data_length))
@@ -8001,26 +8020,56 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
80018020
DBUG_ASSERT(0);
80028021
dynstr_append_mem(ds, STRING_WITH_LEN("Tracker???\n"));
80038022
}
8004-
8005-
dynstr_append_mem(ds, STRING_WITH_LEN("-- "));
8006-
dynstr_append_mem(ds, data, data_length);
80078023
}
80088024
else
80098025
continue;
8026+
8027+
/*
8028+
The remaining of this function: format and append the actual
8029+
tracking info.
8030+
*/
8031+
if (type == SESSION_TRACK_SYSTEM_VARIABLES)
8032+
{
8033+
/* Prepare a string to be sorted before being appended. */
8034+
if (init_dynamic_string(&ds_sort, "", 1024, 1024))
8035+
die("Out of memory");
8036+
ds_type= &ds_sort;
8037+
}
8038+
else
8039+
ds_type= ds;
8040+
/* Append the first piece of info */
8041+
dynstr_append_mem(ds_type, STRING_WITH_LEN("-- "));
8042+
dynstr_append_mem(ds_type, data, data_length);
8043+
/* Whether we are appending the value of a variable */
8044+
bool appending_value= type == SESSION_TRACK_SYSTEM_VARIABLES;
8045+
/* Append remaining pieces */
80108046
while (!mysql_session_track_get_next(mysql,
80118047
(enum_session_state_type) type,
80128048
&data, &data_length))
80138049
{
8014-
dynstr_append_mem(ds, STRING_WITH_LEN("\n-- "));
8050+
if (appending_value)
8051+
dynstr_append_mem(ds_type, STRING_WITH_LEN(": "));
8052+
else
8053+
dynstr_append_mem(ds_type, STRING_WITH_LEN("\n-- "));
8054+
appending_value= !appending_value && type == SESSION_TRACK_SYSTEM_VARIABLES;
80158055
if (data == NULL)
80168056
{
80178057
DBUG_ASSERT(data_length == 0);
8018-
dynstr_append_mem(ds, STRING_WITH_LEN("<NULL>"));
8058+
dynstr_append_mem(ds_type, STRING_WITH_LEN("<NULL>"));
80198059
}
80208060
else
8021-
dynstr_append_mem(ds, data, data_length);
8061+
dynstr_append_mem(ds_type, data, data_length);
8062+
}
8063+
DBUG_ASSERT(!appending_value);
8064+
if (type == SESSION_TRACK_SYSTEM_VARIABLES)
8065+
{
8066+
dynstr_append_mem(ds_type, STRING_WITH_LEN("\n"));
8067+
dynstr_append_sorted(ds, ds_type, false);
8068+
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
8069+
dynstr_free(&ds_sort);
80228070
}
8023-
dynstr_append_mem(ds, STRING_WITH_LEN("\n\n"));
8071+
else
8072+
dynstr_append_mem(ds, STRING_WITH_LEN("\n\n"));
80248073
}
80258074
#endif /* EMBEDDED_LIBRARY */
80268075
}
@@ -12174,7 +12223,8 @@ void replace_dynstr_append_uint(DYNAMIC_STRING *ds, uint val)
1217412223
/*
1217512224
Build a list of pointer to each line in ds_input, sort
1217612225
the list and use the sorted list to append the strings
12177-
sorted to the output ds
12226+
sorted to the output ds. The string ds_input needs to
12227+
end with a newline.
1217812228
1217912229
SYNOPSIS
1218012230
dynstr_append_sorted()

cmake/build_configurations/mysql_release.cmake

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ ELSEIF(RPM)
113113
IF(RPM MATCHES "opensuse|sles|centos|rhel|rocky|alma")
114114
SET(WITH_ROCKSDB_LZ4 OFF CACHE STRING "")
115115
ENDIF()
116+
IF(RPM MATCHES "rhel8")
117+
SET(WITH_READLINE ON CACHE BOOL "")
118+
ENDIF()
116119
ELSEIF(DEB)
117120
SET(WITH_SSL system CACHE STRING "")
118121
SET(WITH_ZLIB system CACHE STRING "")
@@ -172,12 +175,12 @@ IF(UNIX)
172175

173176
# Default GCC flags
174177
IF(CMAKE_COMPILER_IS_GNUCC)
175-
SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized")
178+
SET(COMMON_C_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized")
176179
SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}")
177180
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}")
178181
ENDIF()
179182
IF(CMAKE_COMPILER_IS_GNUCXX)
180-
SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized")
183+
SET(COMMON_CXX_FLAGS "-g -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized")
181184
SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}")
182185
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}")
183186
ENDIF()

cmake/cpack_rpm.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ IF(WITH_WSREP)
229229
SETA(CPACK_RPM_server_PACKAGE_REQUIRES
230230
"galera-4" "rsync" "grep" "gawk" "iproute"
231231
"coreutils" "findutils" "tar")
232-
SETA(CPACK_RPM_server_PACKAGE_RECOMMENDS "lsof" "pv")
232+
SETA(CPACK_RPM_server_PACKAGE_RECOMMENDS "lsof" "socat" "pv")
233+
SETA(CPACK_RPM_test_PACKAGE_REQUIRES "socat")
233234
ENDIF()
234235

235236
SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)

cmake/libutils.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ MACRO(CREATE_EXPORTS_FILE VAR TARGET API_FUNCTIONS)
8989
CONFIGURE_FILE_CONTENT(${CONTENT} ${EXPORTS})
9090
# Avoid "function redeclared as variable" error
9191
# when using gcc/clang option -flto(link time optimization)
92-
IF(" ${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} " MATCHES " -flto")
92+
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
9393
SET_SOURCE_FILES_PROPERTIES(${EXPORTS} PROPERTIES COMPILE_FLAGS "-fno-lto")
9494
ENDIF()
9595
SET(${VAR} ${EXPORTS})

cmake/mariadb_connector_c.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ ELSE()
3232
SET(CONC_INSTALL_LAYOUT "DEFAULT")
3333
ENDIF()
3434

35+
IF(WITH_BOOST_CONTEXT)
36+
SET(CONC_WITH_BOOST_CONTEXT ON)
37+
ENDIF()
38+
3539
SET(PLUGIN_INSTALL_DIR ${INSTALL_PLUGINDIR})
3640
SET(MARIADB_UNIX_ADDR ${MYSQL_UNIX_ADDR})
3741

config.h.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
#cmakedefine HAVE_PTHREAD_ATTR_GETSTACKSIZE 1
196196
#cmakedefine HAVE_PTHREAD_ATTR_SETSCOPE 1
197197
#cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
198+
#cmakedefine HAVE_PTHREAD_GETATTR_NP 1
198199
#cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1
199200
#cmakedefine HAVE_PTHREAD_GETAFFINITY_NP 1
200201
#cmakedefine HAVE_PTHREAD_KEY_DELETE 1

configure.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ CHECK_FUNCTION_EXISTS (pthread_attr_getguardsize HAVE_PTHREAD_ATTR_GETGUARDSIZE)
380380
CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE)
381381
CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE)
382382
CHECK_FUNCTION_EXISTS (pthread_getaffinity_np HAVE_PTHREAD_GETAFFINITY_NP)
383+
CHECK_FUNCTION_EXISTS (pthread_getattr_np HAVE_PTHREAD_GETATTR_NP)
383384
CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE)
384385
CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK)
385386
CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK)

debian/rules

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
# https://wiki.debian.org/Hardening
55
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
66

7-
# Disable LTO on Ubuntu, see LP: #1970634 and https://jira.mariadb.org/browse/MDEV-25633
8-
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes), yes)
9-
export DEB_BUILD_MAINT_OPTIONS += optimize=-lto
10-
endif
11-
127
DPKG_EXPORT_BUILDFLAGS = 1
138
# Include all defaults, including buildflags.mk
149
include /usr/share/dpkg/default.mk

extra/mariabackup/xtrabackup.cc

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2662,7 +2662,7 @@ static bool innodb_init()
26622662
const std::string ib_logfile0{get_log_file_path()};
26632663
os_file_delete_if_exists_func(ib_logfile0.c_str(), nullptr);
26642664
os_file_t file= os_file_create_func(ib_logfile0.c_str(),
2665-
OS_FILE_CREATE, OS_FILE_NORMAL,
2665+
OS_FILE_CREATE,
26662666
#if defined _WIN32 || defined O_DIRECT
26672667
OS_DATA_FILE_NO_O_DIRECT,
26682668
#else
@@ -2687,13 +2687,9 @@ static bool innodb_init()
26872687
mach_write_to_4(b + 12, my_crc32c(0, b, 11));
26882688
static_assert(12 + 4 == SIZE_OF_FILE_CHECKPOINT, "compatibility");
26892689

2690-
#ifdef _WIN32
2691-
DWORD len;
2692-
ret= WriteFile(file, log_hdr_buf, sizeof log_hdr_buf,
2693-
&len, nullptr) && len == sizeof log_hdr_buf;
2694-
#else
2695-
ret= sizeof log_hdr_buf == write(file, log_hdr_buf, sizeof log_hdr_buf);
2696-
#endif
2690+
ret = os_file_write_func(IORequestWrite, ib_logfile0.c_str(), file,
2691+
log_hdr_buf, 0,
2692+
sizeof(log_hdr_buf)) == DB_SUCCESS;
26972693
if (!os_file_close_func(file) || !ret)
26982694
goto invalid_log;
26992695
return false;
@@ -7536,7 +7532,6 @@ void handle_options(int argc, char **argv, char ***argv_server,
75367532
}
75377533

75387534
static int main_low(char** argv);
7539-
static int get_exepath(char *buf, size_t size, const char *argv0);
75407535

75417536
/* ================= main =================== */
75427537
int main(int argc, char **argv)
@@ -7547,8 +7542,8 @@ int main(int argc, char **argv)
75477542

75487543
my_getopt_prefix_matching= 0;
75497544

7550-
if (get_exepath(mariabackup_exe,FN_REFLEN, argv[0]))
7551-
strncpy(mariabackup_exe,argv[0], FN_REFLEN-1);
7545+
if (my_get_exepath(mariabackup_exe, FN_REFLEN, argv[0]))
7546+
strncpy(mariabackup_exe, argv[0], FN_REFLEN-1);
75527547

75537548

75547549
if (argc > 1 )
@@ -7845,32 +7840,6 @@ static int main_low(char** argv)
78457840
}
78467841

78477842

7848-
static int get_exepath(char *buf, size_t size, const char *argv0)
7849-
{
7850-
#ifdef _WIN32
7851-
DWORD ret = GetModuleFileNameA(NULL, buf, (DWORD)size);
7852-
if (ret > 0)
7853-
return 0;
7854-
#elif defined(__linux__)
7855-
ssize_t ret = readlink("/proc/self/exe", buf, size-1);
7856-
if(ret > 0)
7857-
return 0;
7858-
#elif defined(__APPLE__)
7859-
size_t ret = proc_pidpath(getpid(), buf, static_cast<uint32_t>(size));
7860-
if (ret > 0) {
7861-
buf[ret] = 0;
7862-
return 0;
7863-
}
7864-
#elif defined(__FreeBSD__)
7865-
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
7866-
if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) {
7867-
return 0;
7868-
}
7869-
#endif
7870-
7871-
return my_realpath(buf, argv0, 0);
7872-
}
7873-
78747843

78757844
#if defined (__SANITIZE_ADDRESS__) && defined (__linux__)
78767845
/* Avoid LeakSanitizer's false positives. */

include/m_string.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,19 @@ static inline void safe_strcpy(char *dst, size_t dst_size, const char *src)
285285
static inline int safe_strcpy_truncated(char *dst, size_t dst_size,
286286
const char *src)
287287
{
288-
DBUG_ASSERT(dst_size > 0);
289288

290-
strncpy(dst, src, dst_size);
291-
if (dst[dst_size - 1])
289+
DBUG_ASSERT(dst_size > 0);
290+
if (dst_size == 0)
291+
return 1;
292+
/*
293+
We do not want to use strncpy() as we do not want to rely on
294+
strncpy() filling the unused dst with 0.
295+
We cannot use strmake() here as it in debug mode fills the buffers
296+
with 'Z'.
297+
*/
298+
if (strnmov(dst, src, dst_size) == dst+dst_size)
292299
{
293-
dst[dst_size - 1]= 0;
300+
dst[dst_size-1]= 0;
294301
return 1;
295302
}
296303
return 0;
@@ -306,7 +313,7 @@ static inline int safe_strcpy_truncated(char *dst, size_t dst_size,
306313
static inline int safe_strcat(char *dst, size_t dst_size, const char *src)
307314
{
308315
size_t init_len= strlen(dst);
309-
if (init_len > dst_size)
316+
if (init_len >= dst_size)
310317
return 1;
311318
return safe_strcpy_truncated(dst + init_len, dst_size - init_len, src);
312319
}

0 commit comments

Comments
 (0)