Skip to content

Commit b36d6f9

Browse files
committed
Merge 10.6 into 10.7
2 parents 8dd4794 + a49e394 commit b36d6f9

Some content is hidden

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

80 files changed

+1876
-834
lines changed

.gitlab-ci.yml

+152-49
Large diffs are not rendered by default.

client/mysqltest.cc

+47-53
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@ static my_bool non_blocking_api_enabled= 0;
7171
#include "../tests/nonblock-wrappers.h"
7272
#endif
7373

74-
/* Use cygwin for --exec and --system before 5.0 */
75-
#if MYSQL_VERSION_ID < 50000
76-
#define USE_CYGWIN
77-
#endif
7874

7975
#define MAX_VAR_NAME_LENGTH 256
8076
#define MAX_COLUMNS 256
@@ -619,7 +615,6 @@ const char *get_errname_from_code (uint error_code);
619615
int multi_reg_replace(struct st_replace_regex* r,char* val);
620616

621617
#ifdef _WIN32
622-
void free_tmp_sh_file();
623618
void free_win_path_patterns();
624619
#endif
625620

@@ -1457,7 +1452,6 @@ void free_used_memory()
14571452
free_re();
14581453
my_free(read_command_buf);
14591454
#ifdef _WIN32
1460-
free_tmp_sh_file();
14611455
free_win_path_patterns();
14621456
#endif
14631457
DBUG_VOID_RETURN;
@@ -3199,33 +3193,6 @@ void do_source(struct st_command *command)
31993193
}
32003194

32013195

3202-
#if defined _WIN32
3203-
3204-
#ifdef USE_CYGWIN
3205-
/* Variables used for temporary sh files used for emulating Unix on Windows */
3206-
char tmp_sh_name[64], tmp_sh_cmd[70];
3207-
#endif
3208-
3209-
void init_tmp_sh_file()
3210-
{
3211-
#ifdef USE_CYGWIN
3212-
/* Format a name for the tmp sh file that is unique for this process */
3213-
my_snprintf(tmp_sh_name, sizeof(tmp_sh_name), "tmp_%d.sh", getpid());
3214-
/* Format the command to execute in order to run the script */
3215-
my_snprintf(tmp_sh_cmd, sizeof(tmp_sh_cmd), "sh %s", tmp_sh_name);
3216-
#endif
3217-
}
3218-
3219-
3220-
void free_tmp_sh_file()
3221-
{
3222-
#ifdef USE_CYGWIN
3223-
my_delete(tmp_sh_name, MYF(0));
3224-
#endif
3225-
}
3226-
#endif
3227-
3228-
32293196
static void init_builtin_echo(void)
32303197
{
32313198
#ifdef _WIN32
@@ -3341,14 +3308,12 @@ void do_exec(struct st_command *command)
33413308
}
33423309

33433310
#ifdef _WIN32
3344-
#ifndef USE_CYGWIN
33453311
/* Replace /dev/null with NUL */
33463312
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
33473313
;
33483314
/* Replace "closed stdout" with non existing output fd */
33493315
while(replace(&ds_cmd, ">&-", 3, ">&4", 3) == 0)
33503316
;
3351-
#endif
33523317
#endif
33533318

33543319
if (disable_result_log)
@@ -3507,13 +3472,7 @@ int do_modify_var(struct st_command *command,
35073472

35083473
int my_system(DYNAMIC_STRING* ds_cmd)
35093474
{
3510-
#if defined _WIN32 && defined USE_CYGWIN
3511-
/* Dump the command into a sh script file and execute with system */
3512-
str_to_file(tmp_sh_name, ds_cmd->str, ds_cmd->length);
3513-
return system(tmp_sh_cmd);
3514-
#else
35153475
return system(ds_cmd->str);
3516-
#endif
35173476
}
35183477

35193478

@@ -3547,12 +3506,10 @@ void do_system(struct st_command *command)
35473506
do_eval(&ds_cmd, command->first_argument, command->end, !is_windows);
35483507

35493508
#ifdef _WIN32
3550-
#ifndef USE_CYGWIN
35513509
/* Replace /dev/null with NUL */
35523510
while(replace(&ds_cmd, "/dev/null", 9, "NUL", 3) == 0)
35533511
;
35543512
#endif
3555-
#endif
35563513

35573514

35583515
DBUG_PRINT("info", ("running system command '%s' as '%s'",
@@ -5022,13 +4979,34 @@ int query_get_string(MYSQL* mysql, const char* query,
50224979
}
50234980

50244981

4982+
#ifdef _WIN32
4983+
#define SIGKILL 9
4984+
#include <my_minidump.h>
50254985
static int my_kill(int pid, int sig)
50264986
{
5027-
DBUG_PRINT("info", ("Killing server, pid: %d", pid));
5028-
#ifdef _WIN32
5029-
#define SIGKILL 9 /* ignored anyway, see below */
50304987
HANDLE proc;
5031-
if ((proc= OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pid)) == NULL)
4988+
if (sig == SIGABRT)
4989+
{
4990+
/*
4991+
Create a minidump. If process is being debugged, debug break
4992+
Otherwise, terminate.
4993+
*/
4994+
verbose_msg("Aborting %d",pid);
4995+
my_create_minidump(pid,TRUE);
4996+
proc= OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
4997+
if(!proc)
4998+
return -1;
4999+
BOOL debugger_present;
5000+
if (CheckRemoteDebuggerPresent(proc,&debugger_present) && debugger_present)
5001+
{
5002+
if (DebugBreakProcess(proc))
5003+
{
5004+
CloseHandle(proc);
5005+
return 0;
5006+
}
5007+
}
5008+
}
5009+
else if ((proc= OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pid)) == NULL)
50325010
return -1;
50335011
if (sig == 0)
50345012
{
@@ -5039,12 +5017,30 @@ static int my_kill(int pid, int sig)
50395017
(void)TerminateProcess(proc, 201);
50405018
CloseHandle(proc);
50415019
return 1;
5042-
#else
5043-
return kill(pid, sig);
5044-
#endif
50455020
}
50465021

50475022

5023+
/* Wait until process is gone, with timeout */
5024+
static int wait_until_dead(int pid, int timeout)
5025+
{
5026+
HANDLE proc= OpenProcess(SYNCHRONIZE, FALSE, pid);
5027+
if (!proc)
5028+
return 0; /* already dead */
5029+
DBUG_ASSERT(timeout >= 0);
5030+
DBUG_ASSERT(timeout <= UINT_MAX/1000);
5031+
DWORD wait_result= WaitForSingleObject(proc, (DWORD)timeout*1000);
5032+
CloseHandle(proc);
5033+
return (int)wait_result;
5034+
}
5035+
5036+
#else /* !_WIN32 */
5037+
5038+
5039+
static int my_kill(int pid, int sig)
5040+
{
5041+
DBUG_PRINT("info", ("Killing server, pid: %d", pid));
5042+
return kill(pid, sig);
5043+
}
50485044

50495045
/*
50505046
Shutdown the server of current connection and
@@ -5079,6 +5075,7 @@ static int wait_until_dead(int pid, int timeout)
50795075
}
50805076
DBUG_RETURN(1); // Did not die
50815077
}
5078+
#endif /* _WIN32 */
50825079

50835080

50845081
void do_shutdown_server(struct st_command *command)
@@ -9231,10 +9228,7 @@ int main(int argc, char **argv)
92319228

92329229
init_builtin_echo();
92339230
#ifdef _WIN32
9234-
#ifndef USE_CYGWIN
92359231
is_windows= 1;
9236-
#endif
9237-
init_tmp_sh_file();
92389232
init_win_path_patterns();
92399233
#endif
92409234

cmake/cpack_rpm.cmake

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
IF(RPM)
22

3+
MESSAGE(STATUS "CPackRPM building with RPM configuration: ${RPM}")
4+
35
SET(CPACK_GENERATOR "RPM")
46
SET(CPACK_RPM_PACKAGE_DEBUG 1)
57
SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
@@ -274,7 +276,7 @@ FILE(GLOB compat101 RELATIVE ${CMAKE_SOURCE_DIR}
274276
"${CMAKE_SOURCE_DIR}/../MariaDB-shared-10.1.*.rpm")
275277
IF(compat53 AND compat101)
276278
FOREACH(compat_rpm "${compat53}" "${compat101}")
277-
MESSAGE("Using ${compat_rpm} to build MariaDB-compat")
279+
MESSAGE(STATUS "Using ${compat_rpm} to build MariaDB-compat")
278280
INSTALL(CODE "EXECUTE_PROCESS(
279281
COMMAND rpm2cpio ${CMAKE_SOURCE_DIR}/${compat_rpm}
280282
COMMAND cpio --extract --make-directories */libmysqlclient*.so.* -

include/m_ctype.h

+34-3
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,12 @@ struct my_collation_handler_st
377377
void (*hash_sort)(CHARSET_INFO *cs, const uchar *key, size_t len,
378378
ulong *nr1, ulong *nr2);
379379
my_bool (*propagate)(CHARSET_INFO *cs, const uchar *str, size_t len);
380+
/*
381+
Make minimum and maximum strings for the collation.
382+
Put not more than "nchars" characters.
383+
*/
384+
size_t (*min_str)(CHARSET_INFO *cs, uchar *dst, size_t dstlen, size_t nchars);
385+
size_t (*max_str)(CHARSET_INFO *cs, uchar *dst, size_t dstlen, size_t nchars);
380386
};
381387

382388
extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
@@ -589,8 +595,23 @@ struct charset_info_st
589595
uchar casedn_multiply;
590596
uint mbminlen;
591597
uint mbmaxlen;
598+
/*
599+
min_sort_char and max_sort_char represent the minimum
600+
and the maximum character in the collation respectively.
601+
602+
For Unicode collations, these numbers are Unicode code points.
603+
For non-Unicode collations these numbers are native character codes.
604+
For example, in all 8bit collations these numbers are
605+
in the range 0x00..0xFF.
606+
607+
min_sort_char and max_sort_char normally should not be used directly.
608+
They are used internally in the following virtual functions:
609+
- MY_COLLATION_HANDLER::like_range()
610+
- MY_COLLATION_HANDLER::min_str()
611+
- MY_COLLATION_HANDLER::max_str()
612+
*/
592613
my_wc_t min_sort_char;
593-
my_wc_t max_sort_char; /* For LIKE optimization */
614+
my_wc_t max_sort_char;
594615
uchar pad_char;
595616
my_bool escape_with_backslash_is_dangerous;
596617
uchar levels_for_order;
@@ -852,6 +873,16 @@ struct charset_info_st
852873
return (coll->propagate)(this, str, len);
853874
}
854875

876+
size_t min_str(uchar *dst, size_t dstlen, size_t nchars) const
877+
{
878+
return (coll->min_str)(this, dst, dstlen, nchars);
879+
}
880+
881+
size_t max_str(uchar *dst, size_t dstlen, size_t nchars) const
882+
{
883+
return (coll->max_str)(this, dst, dstlen, nchars);
884+
}
885+
855886
#endif /* __cplusplus */
856887
};
857888

@@ -1110,7 +1141,7 @@ extern struct charset_info_st my_charset_big5_bin;
11101141
extern struct charset_info_st my_charset_big5_chinese_ci;
11111142
extern struct charset_info_st my_charset_big5_nopad_bin;
11121143
extern struct charset_info_st my_charset_big5_chinese_nopad_ci;
1113-
extern struct charset_info_st my_charset_cp1250_czech_ci;
1144+
extern struct charset_info_st my_charset_cp1250_czech_cs;
11141145
extern struct charset_info_st my_charset_cp932_bin;
11151146
extern struct charset_info_st my_charset_cp932_japanese_ci;
11161147
extern struct charset_info_st my_charset_cp932_nopad_bin;
@@ -1134,7 +1165,7 @@ extern struct charset_info_st my_charset_gbk_chinese_nopad_ci;
11341165
extern struct charset_info_st my_charset_latin1_bin;
11351166
extern struct charset_info_st my_charset_latin1_nopad_bin;
11361167
extern struct charset_info_st my_charset_latin1_german2_ci;
1137-
extern struct charset_info_st my_charset_latin2_czech_ci;
1168+
extern struct charset_info_st my_charset_latin2_czech_cs;
11381169
extern struct charset_info_st my_charset_sjis_bin;
11391170
extern struct charset_info_st my_charset_sjis_japanese_ci;
11401171
extern struct charset_info_st my_charset_sjis_nopad_bin;

include/my_minidump.h

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/* Copyright (c) 2021, MariaDB Corporation
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-1335 USA */
15+
16+
#include <windows.h>
17+
#ifdef __cplusplus
18+
extern "C" {
19+
#endif
20+
21+
BOOL my_create_minidump(DWORD pid, BOOL verbose);
22+
23+
#ifdef __cplusplus
24+
}
25+
#endif

libmysqld/CMakeLists.txt

+3
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
145145
ADD_CONVENIENCE_LIBRARY(sql_embedded ${SQL_EMBEDDED_SOURCES})
146146
DTRACE_INSTRUMENT(sql_embedded)
147147
ADD_DEPENDENCIES(sql_embedded GenError GenServerSource)
148+
IF(TARGET pcre2)
149+
ADD_DEPENDENCIES(sql_embedded pcre2)
150+
ENDIF()
148151

149152
# On Windows, static embedded server library is called mysqlserver.lib
150153
# On Unix, it is libmysqld.a

mysql-test/lib/My/SafeProcess/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
1919
IF (WIN32)
2020
ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
2121
ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
22-
TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi)
22+
TARGET_INCLUDE_DIRECTORIES(my_safe_kill PRIVATE ${CMAKE_SOURCE_DIR}/include)
23+
TARGET_LINK_LIBRARIES(my_safe_kill mysys psapi)
2324
ELSE()
2425
ADD_EXECUTABLE(my_safe_process safe_process.cc)
2526
ENDIF()

0 commit comments

Comments
 (0)