Merge branch '10.11' into 11.0

This commit is contained in:
Sergei Golubchik 2024-05-11 13:23:27 +02:00
commit f9807aadef
820 changed files with 18746 additions and 6295 deletions
.clang-format
BUILD
CMakeLists.txtREADME.md
client
cmake
config.h.cmakeconfigure.cmake
debian
extra
include
libmariadb
libmysqld
mysql-test

View file

@ -70,7 +70,6 @@ IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
Language: Cpp
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1

View file

@ -267,6 +267,12 @@ if test `$CC -v 2>&1 | tail -1 | sed 's/ .*$//'` = 'gcc' ; then
fi
fi
if test `$CC -v 2>&1 | head -1 | sed 's/ .*$//'` = 'clang' ; then
dbug_cflags="$dbug_cflags -Wframe-larger-than=16384 -fno-inline"
c_warnings="$c_warnings -Wframe-larger-than=16384"
cxx_warnings="$cxx_warnings -Wframe-larger-than=16384"
fi
# If ccache (a compiler cache which reduces build time)
# (http://samba.org/ccache) is installed, use it.

View file

@ -31,7 +31,7 @@ ENDIF()
# in RPM's:
#set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0075 CMP0069 CMP0135)
FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0074 CMP0075 CMP0069 CMP0135)
IF(POLICY ${p})
CMAKE_POLICY(SET ${p} NEW)
ENDIF()
@ -188,7 +188,7 @@ ENDIF()
OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
IF (WITHOUT_SERVER)
SET (SKIP_COMPONENTS "Server|IniFiles|SuportFiles|Readme")
SET (SKIP_COMPONENTS "Server|IniFiles|SupportFiles|Readme")
ELSE()
SET (SKIP_COMPONENTS "N-O-N-E")
ENDIF()
@ -200,8 +200,9 @@ OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system librar
# Can be switched on only for debug build.
#
OPTION(WITH_PROTECT_STATEMENT_MEMROOT "Enable protection of statement's memory root after first SP/PS execution. Turned into account only for debug build" OFF)
IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND WITH_PROTECT_STATEMENT_MEMROOT)
ADD_DEFINITIONS(-DPROTECT_STATEMENT_MEMROOT)
IF (WITH_PROTECT_STATEMENT_MEMROOT)
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DPROTECT_STATEMENT_MEMROOT")
ENDIF()
INCLUDE(check_compiler_flag)
@ -265,8 +266,6 @@ IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND
MY_CHECK_AND_SET_COMPILER_FLAG("-D_FORTIFY_SOURCE=2" RELEASE RELWITHDEBINFO)
ENDIF()
INCLUDE(wsrep)
OPTION(WITH_DBUG_TRACE "Enable DBUG_ENTER()/DBUG_RETURN()/DBUG_PRINT()" ON)
IF(WITH_DBUG_TRACE)
FOREACH(LANG C CXX)
@ -277,7 +276,12 @@ ENDIF()
# Always enable debug sync for debug builds.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
IF(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "10")
# Enable extra checks when using a recent enough version of GNU libstdc++
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_ASSERTIONS")
ENDIF()
OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" OFF)
IF (ENABLE_GCOV)
MY_CHECK_AND_SET_COMPILER_FLAG("-DHAVE_gcov -fprofile-arcs -ftest-coverage -lgcov" DEBUG)
@ -338,6 +342,8 @@ ELSEIF(TRASH_FREED_MEMORY MATCHES "AUTO" AND NOT WIN32 AND NOT WITH_VALGRIND AND
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTRASH_FREED_MEMORY")
ENDIF()
INCLUDE(wsrep)
# Set commonly used variables
IF(WIN32)
SET(DEFAULT_MYSQL_HOME "C:/Program Files/MariaDB ${MYSQL_BASE_VERSION}")

View file

@ -3,7 +3,7 @@ Code status:
* [![Appveyor CI status](https://ci.appveyor.com/api/projects/status/4u6pexmtpuf8jq66?svg=true)](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com
## MariaDB: The open source relational database
## MariaDB: The innovative open source database
MariaDB was designed as a drop-in replacement of MySQL(R) with more
features, new storage engines, fewer bugs, and better performance.
@ -33,28 +33,23 @@ https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/
https://mariadb.com/kb/en/new-and-old-releases/
Getting the code, building it and testing it
---------------------------------------------------------------
Refer to the following guide: https://mariadb.org/get-involved/getting-started-for-developers/get-code-build-test/ which outlines how to correctly build the source code and run the MariaDB testing framework.
Help
-----
More help is available from the Maria Discuss mailing list
https://launchpad.net/~maria-discuss, MariaDB's Zulip
https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/ and MariaDB's Zulip
instance, https://mariadb.zulipchat.com/
Live QA for beginner contributors
----
MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip.
From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays,
anyone can ask any questions theyd like, and a live developer will be available to assist.
New contributors can ask questions any time, but we will provide immediate feedback during that interval.
Licensing
---------
***************************************************************************
NOTE:
MariaDB is specifically available only under version 2 of the GNU
General Public License (GPLv2). (I.e. Without the "any later version"
clause.) This is inherited from MySQL. Please see the README file in

View file

@ -18,7 +18,7 @@ INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/include
${PCRE_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/mysys_ssl
${ZLIB_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/strings

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2022, MariaDB
Copyright (c) 2009, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -38,75 +38,34 @@ enum options_client
{
OPT_CHARSETS_DIR=256, OPT_DEFAULT_CHARSET,
OPT_PAGER, OPT_TEE,
OPT_LOW_PRIORITY, OPT_AUTO_REPAIR, OPT_COMPRESS,
OPT_DROP, OPT_LOCKS, OPT_KEYWORDS, OPT_DELAYED, OPT_OPTIMIZE,
OPT_FTB, OPT_LTB, OPT_ENC, OPT_O_ENC, OPT_ESC, OPT_TABLES,
OPT_MASTER_DATA, OPT_AUTOCOMMIT, OPT_AUTO_REHASH,
OPT_LINE_NUMBERS, OPT_COLUMN_NAMES, OPT_CONNECT_TIMEOUT,
OPT_MAX_ALLOWED_PACKET, OPT_NET_BUFFER_LENGTH,
OPT_SELECT_LIMIT, OPT_MAX_JOIN_SIZE, OPT_SSL_SSL,
OPT_OPTIMIZE,
OPT_TABLES,
OPT_MASTER_DATA,
OPT_SSL_KEY, OPT_SSL_CERT, OPT_SSL_CA, OPT_SSL_CAPATH,
OPT_SSL_CIPHER, OPT_TLS_VERSION, OPT_SHUTDOWN_TIMEOUT, OPT_LOCAL_INFILE,
OPT_DELETE_MASTER_LOGS, OPT_COMPACT,
OPT_PROMPT, OPT_IGN_LINES,OPT_TRANSACTION,OPT_MYSQL_PROTOCOL,
OPT_FRM, OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_RECONNECT, OPT_DELIMITER, OPT_SECURE_AUTH,
OPT_OPEN_FILES_LIMIT, OPT_SET_CHARSET, OPT_SERVER_ARG,
OPT_STOP_POSITION, OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_SIGINT_IGNORE, OPT_HEXBLOB, OPT_ORDER_BY_PRIMARY, OPT_COUNT,
OPT_FLUSH_TABLES,
OPT_TRIGGERS,
OPT_MYSQL_ONLY_PRINT,
OPT_MYSQL_LOCK_DIRECTORY,
OPT_USE_THREADS,
OPT_IMPORT_USE_THREADS,
OPT_MYSQL_NUMBER_OF_QUERY,
OPT_SSL_CIPHER, OPT_LOCAL_INFILE,
OPT_COMPACT,
OPT_MYSQL_PROTOCOL,
OPT_SKIP_OPTIMIZATION,
OPT_COMPATIBLE, OPT_DELIMITER,
OPT_SERVER_ARG,
OPT_START_DATETIME, OPT_STOP_DATETIME,
OPT_IGNORE_DATABASE,
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_TZ_UTC, OPT_CREATE_SLAP_SCHEMA,
OPT_MYSQLDUMP_SLAVE_APPLY,
OPT_IGNORE_TABLE,
OPT_MYSQLDUMP_SLAVE_DATA,
OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT,
#ifdef WHEN_FLASHBACK_REVIEW_READY
OPT_REVIEW,
OPT_REVIEW_DBNAME, OPT_REVIEW_TABLENAME,
#endif
OPT_SLAP_CSV, OPT_SLAP_CREATE_STRING,
OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE, OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
OPT_SLAP_PRE_QUERY,
OPT_SLAP_POST_QUERY,
OPT_SLAP_PRE_SYSTEM,
OPT_SLAP_POST_SYSTEM,
OPT_SLAP_COMMIT,
OPT_SLAP_DETACH,
OPT_SLAP_NO_DROP,
OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT_MODE, OPT_SERVER_ID,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES, OPT_SSL_VERIFY_SERVER_CERT,
OPT_AUTO_VERTICAL_OUTPUT,
OPT_DEBUG_INFO, OPT_DEBUG_CHECK, OPT_COLUMN_TYPES, OPT_ERROR_LOG_FILE,
OPT_WRITE_BINLOG, OPT_DUMP_DATE,
OPT_INIT_COMMAND,
OPT_SLAP_CSV,
OPT_BASE64_OUTPUT_MODE,
OPT_FIX_TABLE_NAMES, OPT_FIX_DB_NAMES,
OPT_WRITE_BINLOG,
OPT_PLUGIN_DIR,
OPT_DEFAULT_AUTH,
OPT_ABORT_SOURCE_ON_ERROR,
OPT_REWRITE_DB,
OPT_REPORT_PROGRESS,
OPT_SKIP_ANNOTATE_ROWS_EVENTS,
OPT_SSL_CRL, OPT_SSL_CRLPATH,
OPT_IGNORE_DATA,
OPT_PRINT_ROW_COUNT, OPT_PRINT_ROW_EVENT_POSITIONS,
OPT_CHECK_IF_UPGRADE_NEEDED,
OPT_COMPATIBILTY_CLEARTEXT_PLUGIN,
OPT_SHUTDOWN_WAIT_FOR_SLAVES,
OPT_COPY_S3_TABLES,
OPT_PRINT_TABLE_METADATA,
OPT_ASOF_TIMESTAMP,
OPT_STOP_POSITION,
OPT_SERVER_ID,
OPT_IGNORE_DOMAIN_IDS,
OPT_DO_DOMAIN_IDS,
OPT_IGNORE_SERVER_IDS,

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2022, MariaDB Corporation.
Copyright (c) 2009, 2024, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -226,7 +226,7 @@ typedef struct st_status
ulong query_start_line;
char *file_name;
LINE_BUFFER *line_buff;
bool batch,add_to_history;
bool batch, add_to_history, sandbox;
} STATUS;
@ -244,7 +244,7 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
vertical=0, line_numbers=1, column_names=1,opt_html=0,
opt_xml=0,opt_nopager=1, opt_outfile=0, named_cmds= 0,
tty_password= 0, opt_nobeep=0, opt_reconnect=1,
opt_secure_auth= 0,
opt_secure_auth= 0,
default_pager_set= 0, opt_sigint_ignore= 0,
auto_vertical_output= 0, show_query_cost= 0,
show_warnings= 0, executing_query= 0,
@ -324,7 +324,8 @@ static int com_quit(String *str,char*),
com_rehash(String *str, char*), com_tee(String *str, char*),
com_notee(String *str, char*), com_charset(String *str,char*),
com_prompt(String *str, char*), com_delimiter(String *str, char*),
com_warnings(String *str, char*), com_nowarnings(String *str, char*);
com_warnings(String *str, char*), com_nowarnings(String *str, char*),
com_sandbox(String *str, char*);
static int com_query_cost(String *str, char*);
#ifdef USE_POPEN
@ -373,11 +374,12 @@ typedef struct {
static COMMANDS commands[] = {
{ "?", '?', com_help, 1, "Synonym for `help'." },
{ "charset", 'C', com_charset, 1,
"Switch to another charset. Might be needed for processing binlog with multi-byte charsets." },
{ "clear", 'c', com_clear, 0, "Clear the current input statement."},
{ "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host." },
{ "delimiter", 'd', com_delimiter, 1,
"Set statement delimiter." },
{ "delimiter", 'd', com_delimiter, 1, "Set statement delimiter." },
#ifdef USE_POPEN
{ "edit", 'e', com_edit, 0, "Edit command with $EDITOR."},
#endif
@ -390,6 +392,8 @@ static COMMANDS commands[] = {
{ "nopager",'n', com_nopager,0, "Disable pager, print to stdout." },
#endif
{ "notee", 't', com_notee, 0, "Don't write into outfile." },
{ "nowarning", 'w', com_nowarnings, 0,
"Don't show warnings after every statement." },
#ifdef USE_POPEN
{ "pager", 'P', com_pager, 1,
"Set PAGER [to_pager]. Print the query results via PAGER." },
@ -400,6 +404,8 @@ static COMMANDS commands[] = {
{ "costs", 'Q', com_query_cost, 0,
"Toggle showing query costs after each query" },
{ "rehash", '#', com_rehash, 0, "Rebuild completion hash." },
{ "sandbox", '-', com_sandbox, 0,
"Disallow commands that access the file system (except \\P without an argument and \\e)." },
{ "source", '.', com_source, 1,
"Execute an SQL script file. Takes a file name as an argument."},
{ "status", 's', com_status, 0, "Get status information from the server."},
@ -410,12 +416,8 @@ static COMMANDS commands[] = {
"Set outfile [to_outfile]. Append everything into given outfile." },
{ "use", 'u', com_use, 1,
"Use another database. Takes database name as argument." },
{ "charset", 'C', com_charset, 1,
"Switch to another charset. Might be needed for processing binlog with multi-byte charsets." },
{ "warnings", 'W', com_warnings, 0,
"Show warnings after every statement." },
{ "nowarning", 'w', com_nowarnings, 0,
"Don't show warnings after every statement." },
/* Get bash-like expansion for some commands */
{ "create table", 0, 0, 0, ""},
{ "create database", 0, 0, 0, ""},
@ -1652,35 +1654,47 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0},
{"help", 'I', "Synonym for -?", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"abort-source-on-error", OPT_ABORT_SOURCE_ON_ERROR,
{"abort-source-on-error", 0,
"Abort 'source filename' operations in case of errors",
&batch_abort_on_error, &batch_abort_on_error, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-rehash", OPT_AUTO_REHASH,
{"auto-rehash", 0,
"Enable automatic rehashing. One doesn't need to use 'rehash' to get table "
"and field completion, but startup and reconnecting may take a longer time. "
"Disable with --disable-auto-rehash.",
&opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
"and field completion, but startup and reconnecting may take a longer time.",
&opt_rehash, &opt_rehash, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"no-auto-rehash", 'A',
"No automatic rehashing. One has to use 'rehash' to get table and field "
"completion. This gives a quicker start of mysql and disables rehashing "
"on reconnect.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-vertical-output", OPT_AUTO_VERTICAL_OUTPUT,
{"auto-vertical-output", 0,
"Automatically switch to vertical output mode if the result is wider "
"than the terminal width.",
&auto_vertical_output, &auto_vertical_output, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
"than the terminal width.", &auto_vertical_output, &auto_vertical_output,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"batch", 'B',
"Don't use history file. Disable interactive behavior. (Enables --silent.)",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"binary-as-hex", 0, "Print binary data as hex", &opt_binhex, &opt_binhex,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"binary-mode", 0,
"Binary mode allows certain character sequences to be processed as data "
"that would otherwise be treated with a special meaning by the parser. "
"Specifically, this switch turns off parsing of all client commands except "
"\\C and DELIMITER in non-interactive mode (i.e., when binary mode is "
"combined with either 1) piped input, 2) the --batch mysql option, or 3) "
"the 'source' command). Also, in binary mode, occurrences of '\\r\\n' and "
"ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is "
"translated to '\\n' and '\\0' is disallowed in user input.",
&opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"column-type-info", OPT_COLUMN_TYPES, "Display column type information.",
{"column-names", 0, "Write column names in results.",
&column_names, &column_names, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-column-names", 'N', "Don't write column names in results.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"column-type-info", 0, "Display column type information.",
&column_types_flag, &column_types_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"comments", 'c', "Preserve comments. Send comments to the server."
@ -1690,6 +1704,16 @@ static struct my_option my_long_options[] =
{"compress", 'C', "Use compression in server/client protocol.",
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"connect-expired-password", 0,
"Notify the server that this client is prepared to handle expired "
"password sandbox mode even if --batch was specified.",
&opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", 0, "Number of seconds before connection timeout.",
&opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG,
0, 0, 3600*12, 0, 0, 0},
{"database", 'D', "Database to use.", &current_db,
&current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -1697,70 +1721,64 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log.", &default_dbug_option,
&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
{"debug-check", 0, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
&debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'D', "Database to use.", &current_db,
&current_db, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
{"default-auth", 0, "Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", 0,
"Set the default character set.", &default_charset,
&default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delimiter", OPT_DELIMITER, "Delimiter to be used.", &delimiter_str,
&delimiter_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN,
"Obsolete option. Exists only for MySQL compatibility.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"execute", 'e', "Execute command and quit. (Disables --force and history file.)", 0,
0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"enable-cleartext-plugin", OPT_COMPATIBILTY_CLEARTEXT_PLUGIN, "Obsolete option. Exists only for MySQL compatibility.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E', "Print the output of a query (rows) vertically.",
&vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"force", 'f', "Continue even if we get an SQL error. Sets abort-source-on-error to 0",
&ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"force", 'f',
"Continue even if we get an SQL error. Sets abort-source-on-error to 0",
&ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &current_host,
&current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"html", 'H', "Produce HTML output.", &opt_html, &opt_html,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"ignore-spaces", 'i', "Ignore space after function names.",
&ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"init-command", 0,
"SQL Command to execute when connecting to MariaDB server. Will "
"automatically be re-executed when reconnecting.", &opt_init_command,
&opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"line-numbers", 0, "Write line numbers for errors.",
&line_numbers, &line_numbers, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable LOAD DATA LOCAL INFILE.",
&opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"max-allowed-packet", 0,
"The maximum packet length to send to or receive from server.",
&opt_max_allowed_packet, &opt_max_allowed_packet, 0, GET_ULONG,
REQUIRED_ARG, 16*1024LL*1024LL, 4096, 2*1024LL*1024LL*1024LL, 0, 1024, 0},
{"max-join-size", 0,
"Automatic limit for rows in a join when using --safe-updates.",
&max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L,
1, ULONG_MAX, 0, 1, 0},
{"named-commands", 'G',
"Enable named commands. Named commands mean this program's internal "
"commands; see mysql> help . When enabled, the named commands can be "
"used from any line of the query, otherwise only from the first line, "
"before an enter. Disable with --disable-named-commands. This option "
"is disabled by default.",
&named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"ignore-spaces", 'i', "Ignore space after function names.",
&ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"init-command", OPT_INIT_COMMAND,
"SQL Command to execute when connecting to MariaDB server. Will "
"automatically be re-executed when reconnecting.",
&opt_init_command, &opt_init_command, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.",
&opt_local_infile, &opt_local_infile, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
&named_cmds, &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"net-buffer-length", 0,
"The buffer size for TCP/IP and socket communication.",
&opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG,
REQUIRED_ARG, 16384, 1024, 512*1024ULL*1024ULL, MALLOC_OVERHEAD, 1024, 0},
{"no-beep", 'b', "Turn off beep on error.", &opt_nobeep,
&opt_nobeep, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &current_host,
&current_host, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"html", 'H', "Produce HTML output.", &opt_html, &opt_html,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"line-numbers", OPT_LINE_NUMBERS, "Write line numbers for errors.",
&line_numbers, &line_numbers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-line-numbers", 'L', "Don't write line number for errors.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", &unbuffered,
&unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"column-names", OPT_COLUMN_NAMES, "Write column names in results.",
&column_names, &column_names, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"skip-column-names", 'N',
"Don't write column names in results.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sigint-ignore", OPT_SIGINT_IGNORE, "Ignore SIGINT (CTRL-C).",
&opt_sigint_ignore, &opt_sigint_ignore, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"one-database", 'o',
"Ignore statements except those that occur while the default "
"database is the one named at the command line.",
@ -1781,19 +1799,20 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"plugin-dir", 0, "Directory for client-side plugins.", &opt_plugin_dir,
&opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
"order of preference, my.cnf, $MYSQL_TCP_PORT, "
#if MYSQL_PORT_DEFAULT == 0
"/etc/services, "
#endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
&opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"progress-reports", OPT_REPORT_PROGRESS,
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", &opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"progress-reports", 0,
"Get progress reports for long running commands (like ALTER TABLE)",
&opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0,
0, 0, 0, 0},
{"prompt", OPT_PROMPT, "Set the command line prompt to this value.",
{"prompt", 0, "Set the command line prompt to this value.",
&current_prompt, &current_prompt, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).",
@ -1804,11 +1823,29 @@ static struct my_option my_long_options[] =
"if the output is suspended. Doesn't use history file.",
&quick, &quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"raw", 'r', "Write fields without conversion. Used with --batch.",
&opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"reconnect", OPT_RECONNECT, "Reconnect if the connection is lost. Disable "
"with --disable-reconnect. This option is enabled by default.",
&opt_raw_data, &opt_raw_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"reconnect", 0, "Reconnect if the connection is lost.",
&opt_reconnect, &opt_reconnect, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
&safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.",
&safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sandbox", 0, "Disallow commands that access the file system (except \\P without an argument and \\e).",
&status.sandbox, &status.sandbox, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"secure-auth", 0, "Refuse client connecting to server if it"
" uses old (pre-4.1.1) protocol.", &opt_secure_auth,
&opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"select-limit", 0,
"Automatic limit for SELECT when using --safe-updates.", &select_limit,
&select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L, 1, ULONG_MAX, 0, 1, 0},
{"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-query-costs", 0, "Show query cost after every statement.",
&show_query_cost, &show_query_cost, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"show-warnings", 0, "Show warnings after every statement.",
&show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"sigint-ignore", 0, "Ignore SIGINT (CTRL-C).", &opt_sigint_ignore,
&opt_sigint_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"silent", 's', "Be more silent. Print results with a tab as separator, "
"each row on new line.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"socket", 'S', "The socket file to use for connection.",
@ -1822,77 +1859,22 @@ static struct my_option my_long_options[] =
"Does not work in batch mode. Disable with --disable-tee. "
"This option is disabled by default.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"unbuffered", 'n', "Flush buffer after each query.", &unbuffered,
&unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.", &current_user,
&current_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"safe-updates", 'U', "Only allow UPDATE and DELETE that uses keys.",
&safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"i-am-a-dummy", 'U', "Synonym for option --safe-updates, -U.",
&safe_updates, &safe_updates, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
{"verbose", 'v', "Write more. (-v -v -v gives the table output format).", 0,
0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"vertical", 'E', "Print the output of a query (rows) vertically.",
&vertical, &vertical, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT,
"Number of seconds before connection timeout.",
&opt_connect_timeout, &opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG,
0, 0, 3600*12, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
"The maximum packet length to send to or receive from server.",
&opt_max_allowed_packet, &opt_max_allowed_packet, 0,
GET_ULONG, REQUIRED_ARG, 16 *1024L*1024L, 4096,
(longlong) 2*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"The buffer size for TCP/IP and socket communication.",
&opt_net_buffer_length, &opt_net_buffer_length, 0, GET_ULONG,
REQUIRED_ARG, 16384, 1024, 512*1024*1024L, MALLOC_OVERHEAD, 1024, 0},
{"select_limit", OPT_SELECT_LIMIT,
"Automatic limit for SELECT when using --safe-updates.",
&select_limit, &select_limit, 0, GET_ULONG, REQUIRED_ARG, 1000L,
1, ULONG_MAX, 0, 1, 0},
{"max_join_size", OPT_MAX_JOIN_SIZE,
"Automatic limit for rows in a join when using --safe-updates.",
&max_join_size, &max_join_size, 0, GET_ULONG, REQUIRED_ARG, 1000000L,
1, ULONG_MAX, 0, 1, 0},
{"secure-auth", OPT_SECURE_AUTH, "Refuse client connecting to server if it"
" uses old (pre-4.1.1) protocol.", &opt_secure_auth,
&opt_secure_auth, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"server-arg", OPT_SERVER_ARG, "Send embedded server this as a parameter.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"show-warnings", OPT_SHOW_WARNINGS, "Show warnings after every statement.",
&show_warnings, &show_warnings, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"show-query-costs", OPT_SHOW_WARNINGS,
"Show query cost after every statement.",
&show_query_cost, &show_query_cost, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"binary-mode", 0,
"Binary mode allows certain character sequences to be processed as data "
"that would otherwise be treated with a special meaning by the parser. "
"Specifically, this switch turns off parsing of all client commands except "
"\\C and DELIMITER in non-interactive mode (i.e., when binary mode is "
"combined with either 1) piped input, 2) the --batch mysql option, or 3) "
"the 'source' command). Also, in binary mode, occurrences of '\\r\\n' and "
"ASCII '\\0' are preserved within strings, whereas by default, '\\r\\n' is "
"translated to '\\n' and '\\0' is disallowed in user input.",
&opt_binary_mode, &opt_binary_mode, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"connect-expired-password", 0,
"Notify the server that this client is prepared to handle expired "
"password sandbox mode even if --batch was specified.",
&opt_connect_expired_password, &opt_connect_expired_password, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"xml", 'X', "Produce XML output.", &opt_xml, &opt_xml, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@ -2944,9 +2926,7 @@ static void initialize_readline ()
array of matches, or NULL if there aren't any.
*/
static char **new_mysql_completion(const char *text,
int start __attribute__((unused)),
int end __attribute__((unused)))
static char **new_mysql_completion(const char *text, int, int)
{
if (!status.batch && !quick)
#if defined(USE_NEW_READLINE_INTERFACE)
@ -3269,8 +3249,7 @@ static void print_help_item(MYSQL_ROW *cur, int num_name, int num_cat, char *las
}
static int com_server_help(String *buffer __attribute__((unused)),
char *line __attribute__((unused)), char *help_arg)
static int com_server_help(String *buffer, char *, char *help_arg)
{
MYSQL_ROW cur;
const char *server_cmd;
@ -3372,18 +3351,16 @@ err:
return error;
}
static int
com_help(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_help(String *buffer, char *line)
{
int i, j;
char * help_arg= strchr(line,' '), buff[32], *end;
if (help_arg)
{
while (my_isspace(charset_info,*help_arg))
while (my_isspace(charset_info, *help_arg))
help_arg++;
if (*help_arg)
return com_server_help(buffer,line,help_arg);
return com_server_help(buffer, line, help_arg);
}
put_info("\nGeneral information about MariaDB can be found at\n"
@ -3406,9 +3383,7 @@ com_help(String *buffer __attribute__((unused)),
}
/* ARGSUSED */
static int
com_clear(String *buffer,char *line __attribute__((unused)))
static int com_clear(String *buffer,char *)
{
#ifdef HAVE_READLINE
if (status.add_to_history)
@ -3433,9 +3408,7 @@ static void adjust_console_codepage(const char *name __attribute__((unused)))
}
/* ARGSUSED */
static int
com_charset(String *buffer __attribute__((unused)), char *line)
static int com_charset(String *, char *line)
{
char buff[256], *param;
CHARSET_INFO * new_cs;
@ -3468,8 +3441,7 @@ com_charset(String *buffer __attribute__((unused)), char *line)
*/
static int
com_go(String *buffer,char *line __attribute__((unused)))
static int com_go(String *buffer, char *)
{
char buff[200]; /* about 110 chars used so far */
char time_buff[53+3+1]; /* time max + space & parens + NUL */
@ -4054,9 +4026,7 @@ tee_print_sized_data(const char *data, unsigned int data_length, unsigned int to
}
static void
print_table_data_html(MYSQL_RES *result)
static void print_table_data_html(MYSQL_RES *result)
{
MYSQL_ROW cur;
MYSQL_FIELD *field;
@ -4379,15 +4349,15 @@ print_tab_data(MYSQL_RES *result)
}
}
static int
com_tee(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_tee(String *, char *line)
{
char file_name[FN_REFLEN], *end, *param;
if (status.sandbox)
return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0);
if (status.batch)
return 0;
while (my_isspace(charset_info,*line))
while (my_isspace(charset_info, *line))
line++;
if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default
{
@ -4424,9 +4394,7 @@ com_tee(String *buffer __attribute__((unused)),
}
static int
com_notee(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_notee(String *, char *)
{
if (opt_outfile)
end_tee();
@ -4439,9 +4407,7 @@ com_notee(String *buffer __attribute__((unused)),
*/
#ifdef USE_POPEN
static int
com_pager(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_pager(String *, char *line)
{
char pager_name[FN_REFLEN], *end, *param;
@ -4469,6 +4435,8 @@ com_pager(String *buffer __attribute__((unused)),
}
else
{
if (status.sandbox)
return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0);
end= strmake_buf(pager_name, param);
while (end > pager_name && (my_isspace(charset_info,end[-1]) ||
my_iscntrl(charset_info,end[-1])))
@ -4483,9 +4451,7 @@ com_pager(String *buffer __attribute__((unused)),
}
static int
com_nopager(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_nopager(String *, char *)
{
strmov(pager, "stdout");
opt_nopager=1;
@ -4497,7 +4463,7 @@ com_nopager(String *buffer __attribute__((unused)),
#ifdef USE_POPEN
static int
com_edit(String *buffer,char *line __attribute__((unused)))
com_edit(String *buffer,char *)
{
char filename[FN_REFLEN],buff[160];
int fd,tmp,error;
@ -4544,17 +4510,15 @@ err:
/* If arg is given, exit without errors. This happens on command 'quit' */
static int
com_quit(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_quit(String *, char *)
{
status.exit_status=0;
return 1;
}
static int
com_rehash(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
com_rehash(String *,
char *)
{
#ifdef HAVE_READLINE
build_completion_hash(1, 0);
@ -4564,12 +4528,13 @@ com_rehash(String *buffer __attribute__((unused)),
#ifdef USE_POPEN
static int
com_shell(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_shell(String *, char *line)
{
char *shell_cmd;
if (status.sandbox)
return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0);
/* Skip space from line begin */
while (my_isspace(charset_info, *line))
line++;
@ -4592,8 +4557,7 @@ com_shell(String *buffer __attribute__((unused)),
#endif
static int
com_print(String *buffer,char *line __attribute__((unused)))
static int com_print(String *buffer,char *)
{
tee_puts("--------------", stdout);
(void) tee_fputs(buffer->c_ptr(), stdout);
@ -4603,9 +4567,8 @@ com_print(String *buffer,char *line __attribute__((unused)))
return 0; /* If empty buffer */
}
/* ARGSUSED */
static int
com_connect(String *buffer, char *line)
static int com_connect(String *buffer, char *line)
{
char *tmp, buff[256];
my_bool save_rehash= opt_rehash;
@ -4658,8 +4621,7 @@ com_connect(String *buffer, char *line)
}
static int com_source(String *buffer __attribute__((unused)),
char *line)
static int com_source(String *, char *line)
{
char source_name[FN_REFLEN], *end, *param;
LINE_BUFFER *line_buff;
@ -4668,6 +4630,9 @@ static int com_source(String *buffer __attribute__((unused)),
FILE *sql_file;
my_bool save_ignore_errors;
if (status.sandbox)
return put_info("Not allowed in the sandbox mode", INFO_ERROR, 0);
/* Skip space from file name */
while (my_isspace(charset_info,*line))
line++;
@ -4702,6 +4667,7 @@ static int com_source(String *buffer __attribute__((unused)),
bfill((char*) &status,sizeof(status),(char) 0);
status.batch=old_status.batch; // Run in batch mode
status.sandbox=old_status.sandbox;
status.line_buff=line_buff;
status.file_name=source_name;
glob_buffer.length(0); // Empty command buffer
@ -4723,9 +4689,7 @@ static int com_source(String *buffer __attribute__((unused)),
}
/* ARGSUSED */
static int
com_delimiter(String *buffer __attribute__((unused)), char *line)
static int com_delimiter(String *, char *line)
{
char buff[256], *tmp;
@ -4752,9 +4716,7 @@ com_delimiter(String *buffer __attribute__((unused)), char *line)
return 0;
}
/* ARGSUSED */
static int
com_use(String *buffer __attribute__((unused)), char *line)
static int com_use(String *, char *line)
{
char *tmp, buff[FN_REFLEN + 1];
int select_db;
@ -4827,18 +4789,21 @@ com_use(String *buffer __attribute__((unused)), char *line)
return 0;
}
static int
com_warnings(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_sandbox(String *, char *)
{
status.sandbox= 1;
put_info("Sandbox mode.", INFO_INFO);
return 0;
}
static int com_warnings(String *, char *)
{
show_warnings = 1;
put_info("Show warnings enabled.",INFO_INFO);
return 0;
}
static int
com_nowarnings(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_nowarnings(String *, char *)
{
show_warnings = 0;
put_info("Show warnings disabled.",INFO_INFO);
@ -5102,10 +5067,7 @@ sql_connect(char *host,char *database,char *user,char *password,uint silent)
}
static int
com_status(String *buffer __attribute__((unused)),
char *line __attribute__((unused)))
static int com_status(String *, char *)
{
const char *status_str;
char buff[40];
@ -5230,8 +5192,7 @@ select_limit, max_join_size);
return 0;
}
static const char *
server_version_string(MYSQL *con)
static const char * server_version_string(MYSQL *con)
{
/* Only one thread calls this, so no synchronization is needed */
if (server_version == NULL)
@ -5356,8 +5317,7 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
}
static int
put_error(MYSQL *con)
static int put_error(MYSQL *con)
{
return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con),
mysql_sqlstate(con));
@ -5423,7 +5383,7 @@ void tee_putc(int c, FILE *file)
len("4294967296 days, 23 hours, 59 minutes, 60.000 seconds") -> 53
*/
static void nice_time(double sec,char *buff,bool part_second)
static void nice_time(double sec, char *buff, bool part_second)
{
ulong tmp;
if (sec >= 3600.0*24)
@ -5704,8 +5664,7 @@ static void init_username()
}
}
static int com_prompt(String *buffer __attribute__((unused)),
char *line)
static int com_prompt(String *, char *line)
{
char *ptr=strchr(line, ' ');
prompt_counter = 0;

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2006, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2017, MariaDB
Copyright (c) 2010, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -86,10 +86,10 @@ static struct my_option my_long_options[]=
{"basedir", 'b',
"Not used by mysql_upgrade. Only for backward compatibility.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
{"character-sets-dir", 0,
"Not used by mysql_upgrade. Only for backward compatibility.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
{"compress", OPT_COMPRESS,
{"compress", 0,
"Not used by mysql_upgrade. Only for backward compatibility.",
&not_used, &not_used, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"datadir", 'd',
@ -102,12 +102,12 @@ static struct my_option my_long_options[]=
{"debug", '#', "Output debug log.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
{"debug-check", 0, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
&debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
{"default-character-set", 0,
"Not used by mysql_upgrade. Only for backward compatibility.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2019, MariaDB
Copyright (c) 2010, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -141,10 +141,10 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
{"debug-check", 0, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
{"debug-info", 0, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force", 'f',
@ -158,7 +158,7 @@ static struct my_option my_long_options[] =
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
{"default-character-set", 0,
"Set the default character set.", &default_charset,
&default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG,
@ -216,21 +216,21 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"connect_timeout", OPT_CONNECT_TIMEOUT, "", &opt_connect_timeout,
{"connect_timeout", 0, "", &opt_connect_timeout,
&opt_connect_timeout, 0, GET_ULONG, REQUIRED_ARG, 3600*12, 0,
3600*12, 0, 1, 0},
{"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", &opt_shutdown_timeout,
{"shutdown_timeout", 0, "", &opt_shutdown_timeout,
&opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
{"wait_for_all_slaves", OPT_SHUTDOWN_WAIT_FOR_SLAVES,
{"wait_for_all_slaves", 0,
"Defers shutdown until after all binlogged events have been sent to "
"all connected slaves", &opt_shutdown_wait_for_slaves,
&opt_shutdown_wait_for_slaves, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
{"default_auth", 0,
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -1398,7 +1398,9 @@ static void usage(void)
refresh Flush all tables and close and open logfiles\n\
shutdown Take server down\n\
status Gives a short status message from the server\n\
start-all-slaves Start all slaves\n\
start-slave Start slave\n\
stop-all-slaves Stop all slaves\n\
stop-slave Stop slave\n\
variables Prints variables available\n\
version Get version info from server");

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2009, 2020, MariaDB
Copyright (c) 2009, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1440,7 +1440,7 @@ static struct my_option my_options[] =
like this:
SET @`a`:=_cp850 0x4DFC6C6C6572 COLLATE `cp850_general_ci`;
*/
{"character-sets-dir", OPT_CHARSETS_DIR,
{"character-sets-dir", 0,
"Directory for character set files.", &charsets_dir,
&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"database", 'd', "List entries for just this database (local log only).",
@ -1450,13 +1450,13 @@ static struct my_option my_options[] =
{"debug", '#', "Output debug log.", &current_dbug_option,
&current_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit .",
{"debug-check", 0, "Check memory and open file usage at exit .",
&debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
{"debug-info", 0, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
{"default_auth", 0,
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -1492,7 +1492,7 @@ static struct my_option my_options[] =
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p', "Password to connect to remote server.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugindir, &opt_plugindir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
@ -1518,14 +1518,14 @@ static struct my_option my_options[] =
&result_file_name, &result_file_name, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef WHEN_FLASHBACK_REVIEW_READY
{"review", opt_flashback_review, "Print review sql in output file.",
{"review", 0, "Print review sql in output file.",
&opt_flashback_review, &opt_flashback_review, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"review-dbname", opt_flashback_flashback_review_dbname,
{"review-dbname", 0,
"Writing flashback original row data into this db",
&flashback_review_dbname, &flashback_review_dbname,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"review-tablename", opt_flashback_flashback_review_tablename,
{"review-tablename", 0,
"Writing flashback original row data into this table",
&flashback_review_tablename, &flashback_review_tablename,
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -1575,7 +1575,7 @@ static struct my_option my_options[] =
"Alias for --do-server-ids.",
&server_id_str, &server_id_str, 0, GET_STR_ALLOC,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
{"set-charset", 0,
"Add 'SET NAMES character_set' to the output.", &charset,
&charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"short-form", 's', "Just show regular queries: no extra info, no "
@ -1658,7 +1658,7 @@ that may lead to an endless loop.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"version", 'V', "Print version and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
0, 0, 0, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT,
{"open_files_limit", 0,
"Used to reserve file descriptors for use by this program.",
&open_files_limit, &open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, MY_NFILE, 8, OS_FILE_LIMIT, 0, 1, 0},
@ -1684,12 +1684,12 @@ that may lead to an endless loop.",
"Updates to a database with a different name than the original. \
Example: rewrite-db='from->to'.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"skip-annotate-row-events", OPT_SKIP_ANNOTATE_ROWS_EVENTS,
{"skip-annotate-row-events", 0,
"Don't print Annotate_rows events stored in the binary log.",
(uchar**) &opt_skip_annotate_row_events,
(uchar**) &opt_skip_annotate_row_events,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"print-table-metadata", OPT_PRINT_TABLE_METADATA,
{"print-table-metadata", 0,
"Print metadata stored in Table_map_log_event",
&opt_print_table_metadata, &opt_print_table_metadata, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -2114,11 +2114,6 @@ get_one_option(const struct my_option *opt, const char *argument,
die(1);
}
break;
#ifdef WHEN_FLASHBACK_REVIEW_READY
case opt_flashback_review:
opt_flashback_review= 1;
break;
#endif
case OPT_START_DATETIME:
start_datetime= convert_str_to_timestamp(start_datetime_str);
break;
@ -3242,7 +3237,8 @@ int main(int argc, char** argv)
{
if (!opt_version)
{
usage();
error("Please provide the log file(s). Run with '--help' for usage "
"instructions.");
retval= ERROR_STOP;
}
goto err;

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, MariaDB
Copyright (c) 2010, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -82,11 +82,11 @@ static struct my_option my_long_options[] =
"Instead of issuing one query for each table, use one query per database, naming all tables in the database in a comma-separated list.",
&opt_all_in_1, &opt_all_in_1, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"auto-repair", OPT_AUTO_REPAIR,
{"auto-repair", 0,
"If a checked table is corrupted, automatically fix it. Repairing will be done after all tables have been checked, if corrupted ones were found.",
&opt_auto_repair, &opt_auto_repair, 0, GET_BOOL, NO_ARG, 0,
0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
{"character-sets-dir", 0,
"Directory for character set files.", (char**) &charsets_dir,
(char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"check", 'c', "Check table for errors.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0,
@ -97,7 +97,7 @@ static struct my_option my_long_options[] =
{"check-upgrade", 'g',
"Check tables for version-dependent changes. May be used with --auto-repair to correct tables requiring version-dependent updates.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", OPT_COMPRESS, "Use compression in server/client protocol.",
{"compress", 0, "Use compression in server/client protocol.",
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"databases", 'B',
@ -111,16 +111,16 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
{"debug-check", 0, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
{"debug-info", 0, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
{"default-character-set", 0,
"Set the default character set.", &default_charset,
&default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
{"default_auth", 0,
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -140,7 +140,7 @@ static struct my_option my_long_options[] =
"If you are using this option with CHECK TABLE, it will ensure that the table is 100 percent consistent, but will take a long time. If you are using this option with REPAIR TABLE, it will force using old slow repair with keycache method, instead of much faster repair by sorting.",
&opt_extended, &opt_extended, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"flush", OPT_FLUSH_TABLES, "Flush each table after check. This is useful if you don't want to have the checked tables take up space in the caches after the check",
{"flush", 0, "Flush each table after check. This is useful if you don't want to have the checked tables take up space in the caches after the check",
&opt_flush_tables, &opt_flush_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0 },
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
@ -150,7 +150,7 @@ static struct my_option my_long_options[] =
{"medium-check", 'm',
"Faster than extended-check, but only finds 99.99 percent of all errors. Should be good enough for most cases.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"write-binlog", OPT_WRITE_BINLOG,
{"write-binlog", 0,
"Log ANALYZE, OPTIMIZE and REPAIR TABLE commands. Use --skip-write-binlog "
"when commands should not be sent to replication slaves.",
&opt_write_binlog, &opt_write_binlog, 0, GET_BOOL, NO_ARG,
@ -168,7 +168,7 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
@ -199,7 +199,7 @@ static struct my_option my_long_options[] =
#include <sslopt-longopts.h>
{"tables", OPT_TABLES, "Overrides option --databases (-B).", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"use-frm", OPT_FRM,
{"use-frm", 0,
"When used with REPAIR, get table structure from .frm file, so the table can be repaired even if .MYI header is corrupted.",
&opt_frm, &opt_frm, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
@ -889,6 +889,7 @@ static int disable_binlog()
return run_query("SET SQL_LOG_BIN=0", 0);
}
static int handle_request_for_tables(char *tables, size_t length,
my_bool view, my_bool dont_quote)
{
@ -1020,7 +1021,10 @@ static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen)
insert_dynamic(arr, (uchar*) buf);
}
static void print_result()
/* Ok as mysqlcheck is not multi threaded */
PRAGMA_DISABLE_CHECK_STACK_FRAME
static void __attribute__((noinline)) print_result()
{
MYSQL_RES *res;
MYSQL_ROW row;
@ -1111,6 +1115,7 @@ static void print_result()
mysql_free_result(res);
DBUG_VOID_RETURN;
}
PRAGMA_REENABLE_CHECK_STACK_FRAME
static int dbConnect(char *host, char *user, char *passwd)

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2020, MariaDB Corporation.
Copyright (c) 2010, 2024, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -166,7 +166,6 @@ static my_bool server_supports_switching_charsets= TRUE;
static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
#define MYSQL_OPT_MAX_STATEMENT_TIME 0
#define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2
static uint opt_mysql_port= 0, opt_master_data;
@ -250,41 +249,36 @@ static struct my_option my_long_options[] =
{
{"all-databases", 'A',
"Dump all the databases. This will be same as --databases with all databases selected.",
&opt_alldbs, &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
&opt_alldbs, &opt_alldbs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"all-tablespaces", 'Y',
"Dump all the tablespaces.",
&opt_alltspcs, &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
&opt_alltspcs, &opt_alltspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-tablespaces", 'y',
"Do not dump any tablespace information.",
&opt_notspcs, &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"add-drop-database", OPT_DROP_DATABASE, "Add a DROP DATABASE before each create.",
&opt_notspcs, &opt_notspcs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"add-drop-database", 0, "Add a DROP DATABASE before each create.",
&opt_drop_database, &opt_drop_database, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"add-drop-table", OPT_DROP, "Add a DROP TABLE before each create.",
&opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"add-drop-table", 0, "Add a DROP TABLE before each create.",
&opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"add-drop-trigger", 0, "Add a DROP TRIGGER before each create.",
&opt_drop_trigger, &opt_drop_trigger, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"add-locks", OPT_LOCKS, "Add locks around INSERT statements.",
&opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"allow-keywords", OPT_KEYWORDS,
{"add-locks", 0, "Add locks around INSERT statements.",
&opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"allow-keywords", 0,
"Allow creation of column names that are keywords.", &opt_keywords,
&opt_keywords, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"apply-slave-statements", OPT_MYSQLDUMP_SLAVE_APPLY,
{"apply-slave-statements", 0,
"Adds 'STOP SLAVE' prior to 'CHANGE MASTER' and 'START SLAVE' to bottom of dump.",
&opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"as-of", OPT_ASOF_TIMESTAMP,
&opt_slave_apply, &opt_slave_apply, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"as-of", 0,
"Dump system versioned table(s) as of specified timestamp. "
"Argument is interpreted according to the --tz-utc setting. "
"Table structures are always dumped as of current timestamp.",
&opt_asof_timestamp, &opt_asof_timestamp, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
&opt_asof_timestamp, &opt_asof_timestamp, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"character-sets-dir", 0,
"Directory for character set files.", (char **)&charsets_dir,
(char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"comments", 'i', "Write additional information.",
@ -309,21 +303,18 @@ static struct my_option my_long_options[] =
&opt_complete_insert, &opt_complete_insert, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"copy_s3_tables", OPT_COPY_S3_TABLES,
&opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"copy_s3_tables", 0,
"If 'no' S3 tables will be ignored, otherwise S3 tables will be copied as "
" Aria tables and then altered to S3",
&opt_copy_s3_tables, &opt_copy_s3_tables, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
{"create-options", 'a',
"Include all MariaDB specific create options.",
&create_options, &create_options, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
&create_options, &create_options, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"databases", 'B',
"Dump several databases. Note the difference in usage; in this case no tables are given. All name arguments are regarded as database names. 'USE db_name;' will be included in the output.",
&opt_databases, &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0,
0, 0, 0, 0},
&opt_databases, &opt_databases, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.",
0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
@ -331,19 +322,17 @@ static struct my_option my_long_options[] =
{"debug", '#', "Output debug log.", (char *)&default_dbug_option,
(char *)&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
{"debug-check", 0, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", 0, "Print some debug info at exit.", &debug_info_flag,
&debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
"Set the default character set.", &default_charset,
&default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.",
&opt_delayed, &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"delete-master-logs", OPT_DELETE_MASTER_LOGS,
{"delayed-insert", 0, "Insert rows with INSERT DELAYED.",
&opt_delayed, &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"delete-master-logs", 0,
"Delete logs on master after backup. This automatically enables --master-data.",
&opt_delete_master_logs, &opt_delete_master_logs, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -351,9 +340,8 @@ static struct my_option my_long_options[] =
"'/*!40000 ALTER TABLE tb_name DISABLE KEYS */; and '/*!40000 ALTER "
"TABLE tb_name ENABLE KEYS */; will be put in the output.", &opt_disable_keys,
&opt_disable_keys, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"dump-date", OPT_DUMP_DATE, "Put a dump date to the end of the output.",
&opt_dump_date, &opt_dump_date, 0,
GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"dump-date", 0, "Put a dump date to the end of the output.",
&opt_dump_date, &opt_dump_date, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"dump-history", 'H', "Dump system-versioned tables with history (only for "
"timestamp based versioning)", &opt_dump_history,
&opt_dump_history, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -370,24 +358,23 @@ static struct my_option my_long_options[] =
"Option automatically turns --lock-tables off.",
&opt_slave_data, &opt_slave_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL, 0, 0, 0},
{"events", 'E', "Dump events.",
&opt_events, &opt_events, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"events", 'E', "Dump events.", &opt_events, &opt_events, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"extended-insert", 'e',
"Use multiple-row INSERT syntax that include several VALUES lists.",
&extended_insert, &extended_insert, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
{"fields-terminated-by", 0,
"Fields in the output file are terminated by the given string.",
&fields_terminated, &fields_terminated, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-enclosed-by", OPT_ENC,
{"fields-enclosed-by", 0,
"Fields in the output file are enclosed by the given character.",
&enclosed, &enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-optionally-enclosed-by", OPT_O_ENC,
{"fields-optionally-enclosed-by", 0,
"Fields in the output file are optionally enclosed by the given character.",
&opt_enclosed, &opt_enclosed, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0 ,0, 0},
{"fields-escaped-by", OPT_ESC,
{"fields-escaped-by", 0,
"Fields in the output file are escaped by the given character.",
&escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"flush-logs", 'F', "Flush logs file in server before starting dump. "
@ -399,29 +386,26 @@ static struct my_option my_long_options[] =
"to the moment all tables are locked. So if you want your dump and "
"the log flush to happen at the same exact moment you should use "
"--lock-all-tables or --master-data with --flush-logs.",
&flush_logs, &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"flush-privileges", OPT_ESC, "Emit a FLUSH PRIVILEGES statement "
&flush_logs, &flush_logs, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"flush-privileges", 0, "Emit a FLUSH PRIVILEGES statement "
"after dumping the mysql database. This option should be used any "
"time the dump contains the mysql database and any other database "
"that depends on the data in the mysql database for proper restore. ",
&flush_privileges, &flush_privileges, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"force", 'f', "Continue even if we get an SQL error.",
&ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
&ignore_errors, &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"gtid", 0, "Used together with --master-data=1 or --dump-slave=1."
"When enabled, the output from those options will set the GTID position "
"instead of the binlog file and offset; the file/offset will appear only as "
"a comment. When disabled, the GTID position will still appear in the "
"output, but only commented.",
&opt_use_gtid, &opt_use_gtid, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
&opt_use_gtid, &opt_use_gtid, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"header", 0, "Used together with --tab. When enabled, adds header with column names to the top of output txt files.",
&opt_header, &opt_header, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"hex-blob", OPT_HEXBLOB, "Dump binary strings (BINARY, "
{"hex-blob", 0, "Dump binary strings (BINARY, "
"VARBINARY, BLOB) in hexadecimal format.",
&opt_hex_blob, &opt_hex_blob, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &current_host,
@ -443,15 +427,13 @@ static struct my_option my_long_options[] =
"be specified with both database and table names, e.g., "
"--ignore-table=database.table.",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"include-master-host-port", OPT_MYSQLDUMP_INCLUDE_MASTER_HOST_PORT,
{"include-master-host-port", 0,
"Adds 'MASTER_HOST=<host>, MASTER_PORT=<port>' to 'CHANGE MASTER TO..' "
"in dump produced with --dump-slave.", &opt_include_master_host_port,
&opt_include_master_host_port, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"insert-ignore", OPT_INSERT_IGNORE, "Insert rows with INSERT IGNORE.",
&opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"lines-terminated-by", OPT_LTB,
&opt_include_master_host_port, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"insert-ignore", 0, "Insert rows with INSERT IGNORE.",
&opt_ignore, &opt_ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"lines-terminated-by", 0,
"Lines in the output file are terminated by the given string.",
&lines_terminated, &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -462,7 +444,7 @@ static struct my_option my_long_options[] =
0, 0, 0, 0, 0, 0},
{"lock-tables", 'l', "Lock all tables for read.", &lock_tables,
&lock_tables, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"log-error", OPT_ERROR_LOG_FILE, "Append warnings and errors to given file.",
{"log-error", 0, "Append warnings and errors to given file.",
&log_error_file, &log_error_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"log-queries", 0, "When restoring the dump, the server will, if logging turned on, log the queries to the general and slow query log.",
@ -479,30 +461,28 @@ static struct my_option my_long_options[] =
"Option automatically turns --lock-tables off.",
&opt_master_data, &opt_master_data, 0,
GET_UINT, OPT_ARG, 0, 0, MYSQL_OPT_MASTER_DATA_COMMENTED_SQL, 0, 0, 0},
{"max_allowed_packet", OPT_MAX_ALLOWED_PACKET,
{"max_allowed_packet", 0,
"The maximum packet length to send to or receive from server.",
&opt_max_allowed_packet, &opt_max_allowed_packet, 0,
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
(longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
{"max-statement-time", MYSQL_OPT_MAX_STATEMENT_TIME,
{"max-statement-time", 0,
"Max statement execution time. If unset, overrides server default with 0.",
&opt_max_statement_time, &opt_max_statement_time, 0, GET_DOUBLE,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
{"net_buffer_length", 0,
"The buffer size for TCP/IP and socket communication.",
&opt_net_buffer_length, &opt_net_buffer_length, 0,
GET_ULONG, REQUIRED_ARG, 1024*1024L-1025, 4096, 16*1024L*1024L,
MALLOC_OVERHEAD-1024, 1024, 0},
{"no-autocommit", OPT_AUTOCOMMIT,
{"no-autocommit", 0,
"Wrap tables with autocommit/commit statements.",
&opt_autocommit, &opt_autocommit, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
&opt_autocommit, &opt_autocommit, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-create-db", 'n',
"Suppress the CREATE DATABASE ... IF EXISTS statement that normally is "
"output for each dumped database if --all-databases or --databases is "
"given.",
&opt_create_db, &opt_create_db, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
&opt_create_db, &opt_create_db, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-create-info", 't', "Don't write table creation info.",
&opt_no_create_info, &opt_no_create_info, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
@ -516,7 +496,7 @@ static struct my_option my_long_options[] =
{"opt", OPT_OPTIMIZE,
"Same as --add-drop-table, --add-locks, --create-options, --quick, --extended-insert, --lock-tables, --set-charset, and --disable-keys. Enabled by default, disable with --skip-opt.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"order-by-primary", OPT_ORDER_BY_PRIMARY,
{"order-by-primary", 0,
"Sorts each table's rows by primary key, or first unique key, if such a key exists. Useful when dumping a MyISAM table to be loaded into an InnoDB table, but will make the dump itself take considerably longer.",
&opt_order_by_primary, &opt_order_by_primary, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"order-by-size", 0,
@ -541,27 +521,24 @@ static struct my_option my_long_options[] =
{"quote-names",'Q', "Quote table and column names with backticks (`).",
&opt_quoted, &opt_quoted, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0,
0, 0},
{"replace", OPT_MYSQL_REPLACE_INTO, "Use REPLACE INTO instead of INSERT INTO.",
&opt_replace_into, &opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
0, 0},
{"replace", 0, "Use REPLACE INTO instead of INSERT INTO.", &opt_replace_into,
&opt_replace_into, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"result-file", 'r',
"Direct output to a given file. This option should be used in systems "
"(e.g., DOS, Windows) that use carriage-return linefeed pairs (\\r\\n) "
"to separate text lines. This option ensures that only a single newline "
"is used.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"routines", 'R', "Dump stored routines (functions and procedures).",
&opt_routines, &opt_routines, 0, GET_BOOL,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", OPT_SET_CHARSET,
"Add 'SET NAMES default_character_set' to the output.",
&opt_set_charset, &opt_set_charset, 0, GET_BOOL, NO_ARG, 1,
0, 0, 0, 0, 0},
&opt_routines, &opt_routines, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"set-charset", 0,
"Add 'SET NAMES default_character_set' to the output.", &opt_set_charset,
&opt_set_charset, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
/*
Note that the combination --single-transaction --master-data
will give bullet-proof binlog position only if server >=4.1.3. That's the
old "FLUSH TABLES WITH READ LOCK does not block commit" fixed bug.
*/
{"single-transaction", OPT_TRANSACTION,
{"single-transaction", 0,
"Creates a consistent snapshot by dumping all tables in a single "
"transaction. Works ONLY for tables stored in storage engines which "
"support multiversioning (currently only InnoDB does); the dump is NOT "
@ -580,7 +557,7 @@ static struct my_option my_long_options[] =
&opt_mysql_unix_port, &opt_mysql_unix_port, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"system", 256, "Dump system tables as portable SQL",
{"system", 0, "Dump system tables as portable SQL",
&opt_system, &opt_system, &opt_system_types, GET_SET, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tab",'T',
"Create tab-separated textfile for each table to given path. (Create .sql "
@ -589,17 +566,16 @@ static struct my_option my_long_options[] =
&path, &path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"tables", OPT_TABLES, "Overrides option --databases (-B).",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"triggers", OPT_TRIGGERS, "Dump triggers for each dumped table.",
{"triggers", 0, "Dump triggers for each dumped table.",
&opt_dump_triggers, &opt_dump_triggers, 0, GET_BOOL,
NO_ARG, 1, 0, 0, 0, 0, 0},
{"tz-utc", OPT_TZ_UTC,
{"tz-utc", 0,
"Set connection time zone to UTC before commencing the dump and add "
"SET TIME_ZONE=´+00:00´ to the top of the dump file.",
&opt_tz_utc, &opt_tz_utc, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
#ifndef DONT_ALLOW_USER_CHANGE
{"user", 'u', "User for login if not current user.",
&current_user, &current_user, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"user", 'u', "User for login if not current user.", &current_user,
&current_user, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Print info about the various stages.",
&verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
@ -609,11 +585,10 @@ static struct my_option my_long_options[] =
&where, &where, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"xml", 'X', "Dump a database as well formed XML.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
"Default authentication client-side plugin to use.",
{"default_auth", 0, "Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
@ -763,56 +738,57 @@ static void write_header(FILE *sql_file, const char *db_name)
fputs(">\n", sql_file);
check_io(sql_file);
}
else if (!opt_compact)
else
{
print_comment(sql_file, 0,
"-- MariaDB dump %s-%s, for %s (%s)\n--\n",
VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s ",
fix_for_comment(current_host ? current_host : "localhost"));
print_comment(sql_file, 0, "Database: %s\n",
fix_for_comment(db_name ? db_name : ""));
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"
);
print_comment(sql_file, 0, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
if (!opt_logging)
fprintf(sql_file,
"\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL LOG_SLOW_QUERY=0 */;");
if (opt_set_charset)
fprintf(sql_file,
"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"
"\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"
"\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"
"\n/*!40101 SET NAMES %s */;\n",default_charset);
if (opt_tz_utc)
fprintf(sql_file, "/*!999999\\- enable the sandbox mode */ \n");
if (!opt_compact)
{
fprintf(sql_file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n");
fprintf(sql_file, "/*!40103 SET TIME_ZONE='+00:00' */;\n");
}
print_comment(sql_file, 0, "-- MariaDB dump %s-%s, for %s (%s)\n--\n",
VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
print_comment(sql_file, 0, "-- Host: %s ",
fix_for_comment(current_host ? current_host : "localhost"));
print_comment(sql_file, 0, "Database: %s\n",
fix_for_comment(db_name ? db_name : ""));
print_comment(sql_file, 0,
"-- ------------------------------------------------------\n"
);
print_comment(sql_file, 0, "-- Server version\t%s\n",
mysql_get_server_info(&mysql_connection));
if (!path)
{
if (!opt_no_create_info)
if (!opt_logging)
fprintf(sql_file,
"\n/*M!100101 SET LOCAL SQL_LOG_OFF=0, LOCAL LOG_SLOW_QUERY=0 */;");
if (opt_set_charset)
fprintf(sql_file,
"\n/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;"
"\n/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;"
"\n/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;"
"\n/*!40101 SET NAMES %s */;\n",default_charset);
if (opt_tz_utc)
{
/* We don't need unique checks as the table is created just before */
fprintf(md_result_file,"\
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n");
fprintf(sql_file, "/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;\n");
fprintf(sql_file, "/*!40103 SET TIME_ZONE='+00:00' */;\n");
}
fprintf(md_result_file,"\
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n\
");
if (!path)
{
if (!opt_no_create_info)
{
/* We don't need unique checks as the table is created just before */
fprintf(md_result_file,
"/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n");
}
fprintf(md_result_file,
"/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n");
}
fprintf(sql_file,
"/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n"
"/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n",
path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",",
compatible_mode_normal_str);
}
fprintf(sql_file,
"/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='%s%s%s' */;\n"
"/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n",
path?"":"NO_AUTO_VALUE_ON_ZERO",compatible_mode_normal_str[0]==0?"":",",
compatible_mode_normal_str);
check_io(sql_file);
}
} /* write_header */
@ -3116,8 +3092,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
if (opt_header)
dynstr_set_checked(&select_field_names_for_header, "");
}
insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " :
delayed ? " DELAYED " : opt_ignore ? " IGNORE " : "");
insert_option= ((delayed && opt_ignore) ? "DELAYED IGNORE " :
delayed ? "DELAYED " : opt_ignore ? "IGNORE " : "");
verbose_msg("-- Retrieving table structure for table %s...\n", table);

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2022, MariaDB
Copyright (c) 2011, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -70,10 +70,10 @@ static char **argv_to_free;
static struct my_option my_long_options[] =
{
{"character-sets-dir", OPT_CHARSETS_DIR,
{"character-sets-dir", 0,
"Directory for character set files.", (char**) &charsets_dir,
(char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
{"default-character-set", 0,
"Set the default character set.", &default_charset,
&default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"columns", 'c',
@ -85,31 +85,31 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"debug",'#', "Output debug log. Often this is 'd:t:o,filename'.", 0, 0, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
{"debug-check", 0, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
{"debug-info", 0, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
{"default_auth", 0,
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"delete", 'd', "First delete all rows from table.", &opt_delete,
&opt_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"fields-terminated-by", OPT_FTB,
{"fields-terminated-by", 0,
"Fields in the input file are terminated by the given string.",
&fields_terminated, &fields_terminated, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-enclosed-by", OPT_ENC,
{"fields-enclosed-by", 0,
"Fields in the import file are enclosed by the given character.",
&enclosed, &enclosed, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-optionally-enclosed-by", OPT_O_ENC,
{"fields-optionally-enclosed-by", 0,
"Fields in the input file are optionally enclosed by the given character.",
&opt_enclosed, &opt_enclosed, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"fields-escaped-by", OPT_ESC,
{"fields-escaped-by", 0,
"Fields in the input file are escaped by the given character.",
&escaped, &escaped, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0,
0, 0},
@ -126,10 +126,10 @@ static struct my_option my_long_options[] =
"Disable foreign key checks while importing the data.",
&ignore_foreign_keys, &ignore_foreign_keys, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
{"ignore-lines", 0, "Ignore first n lines of data infile.",
&opt_ignore_lines, &opt_ignore_lines, 0, GET_LL,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"lines-terminated-by", OPT_LTB,
{"lines-terminated-by", 0,
"Lines in the input file are terminated by the given string.",
&lines_terminated, &lines_terminated, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -138,7 +138,7 @@ static struct my_option my_long_options[] =
{"lock-tables", 'l', "Lock all tables for write (this disables threads).",
&lock_tables, &lock_tables, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
{"low-priority", OPT_LOW_PRIORITY,
{"low-priority", 0,
"Use LOW_PRIORITY when updating the table.", &opt_low_priority,
&opt_low_priority, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"password", 'p',
@ -148,7 +148,7 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
@ -170,7 +170,7 @@ static struct my_option my_long_options[] =
&opt_mysql_unix_port, &opt_mysql_unix_port, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#include <sslopt-longopts.h>
{"use-threads", OPT_USE_THREADS,
{"use-threads", 0,
"Load files in parallel. The argument is the number "
"of threads to use for loading data.",
&opt_use_threads, &opt_use_threads, 0,

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2019, MariaDB
Copyright (c) 2010, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -191,10 +191,10 @@ static struct my_option my_long_options[] =
{"character-sets-dir", 'c', "Directory for character set files.",
(char**) &charsets_dir, (char**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0,
0, 0, 0, 0, 0},
{"default-character-set", OPT_DEFAULT_CHARSET,
{"default-character-set", 0,
"Set the default character set.", &default_charset,
&default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"count", OPT_COUNT,
{"count", 0,
"Show number of rows per table (may be slow for non-MyISAM tables).",
&opt_count, &opt_count, 0, GET_BOOL, NO_ARG, 0, 0, 0,
0, 0, 0},
@ -203,13 +203,13 @@ static struct my_option my_long_options[] =
0, 0, 0},
{"debug", '#', "Output debug log. Often this is 'd:t:o,filename'.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
{"debug-check", 0, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", OPT_DEBUG_INFO, "Print some debug info at exit.",
{"debug-info", 0, "Print some debug info at exit.",
&debug_info_flag, &debug_info_flag,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
{"default_auth", 0,
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -226,7 +226,7 @@ static struct my_option my_long_options[] =
"Password to use when connecting to server. If password is not given, it's "
"solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 2022, MariaDB
Copyright (c) 2010, 2024, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -535,50 +535,45 @@ static struct my_option my_long_options[] =
"Generate SQL where not supplied by file or command line.",
&auto_generate_sql, &auto_generate_sql,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-add-autoincrement", OPT_SLAP_AUTO_GENERATE_ADD_AUTO,
{"auto-generate-sql-add-autoincrement", 0,
"Add an AUTO_INCREMENT column to auto-generated tables.",
&auto_generate_sql_autoincrement,
&auto_generate_sql_autoincrement,
&auto_generate_sql_autoincrement, &auto_generate_sql_autoincrement,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-execute-number", OPT_SLAP_AUTO_GENERATE_EXECUTE_QUERIES,
{"auto-generate-sql-execute-number", 0,
"Set this number to generate a set number of queries to run.",
&auto_actual_queries, &auto_actual_queries,
0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-guid-primary", OPT_SLAP_AUTO_GENERATE_GUID_PRIMARY,
{"auto-generate-sql-guid-primary", 0,
"Add GUID based primary keys to auto-generated tables.",
&auto_generate_sql_guid_primary,
&auto_generate_sql_guid_primary,
&auto_generate_sql_guid_primary, &auto_generate_sql_guid_primary,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-load-type", OPT_SLAP_AUTO_GENERATE_SQL_LOAD_TYPE,
{"auto-generate-sql-load-type", 0,
"Specify test load type: mixed, update, write, key, or read; default is mixed.",
(char**) &auto_generate_sql_type, (char**) &auto_generate_sql_type,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-secondary-indexes",
OPT_SLAP_AUTO_GENERATE_SECONDARY_INDEXES,
{"auto-generate-sql-secondary-indexes", 0,
"Number of secondary indexes to add to auto-generated tables.",
&auto_generate_sql_secondary_indexes,
&auto_generate_sql_secondary_indexes, 0,
GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-query-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_QUERY_NUM,
{"auto-generate-sql-unique-query-number", 0,
"Number of unique queries to generate for automatic tests.",
&auto_generate_sql_unique_query_number,
&auto_generate_sql_unique_query_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-unique-write-number",
OPT_SLAP_AUTO_GENERATE_UNIQUE_WRITE_NUM,
{"auto-generate-sql-unique-write-number", 0,
"Number of unique queries to generate for auto-generate-sql-write-number.",
&auto_generate_sql_unique_write_number,
&auto_generate_sql_unique_write_number,
0, GET_ULL, REQUIRED_ARG, 10, 0, 0, 0, 0, 0},
{"auto-generate-sql-write-number", OPT_SLAP_AUTO_GENERATE_WRITE_NUM,
{"auto-generate-sql-write-number", 0,
"Number of row inserts to perform for each thread (default is 100).",
&auto_generate_sql_number, &auto_generate_sql_number,
0, GET_ULL, REQUIRED_ARG, 100, 0, 0, 0, 0, 0},
{"character-sets-dir", OPT_CHARSETS_DIR,
"Directory for character set files.", (char **)&charsets_dir,
(char **)&charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"commit", OPT_SLAP_COMMIT, "Commit records every X number of statements.",
{"commit", 0, "Commit records every X number of statements.",
&commit_rate, &commit_rate, 0, GET_UINT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"compress", 'C', "Use compression in server/client protocol.",
@ -587,10 +582,10 @@ static struct my_option my_long_options[] =
{"concurrency", 'c', "Number of clients to simulate for query to run.",
(char**) &concurrency_str, (char**) &concurrency_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"create", OPT_SLAP_CREATE_STRING, "File or string to use create tables.",
{"create", 0, "File or string to use create tables.",
&create_string, &create_string, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"create-schema", OPT_CREATE_SLAP_SCHEMA, "Schema to run tests in.",
{"create-schema", 0, "Schema to run tests in.",
(char**) &create_schema_string, (char**) &create_schema_string, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"csv", OPT_SLAP_CSV,
@ -604,12 +599,12 @@ static struct my_option my_long_options[] =
(char**) &default_dbug_option, (char**) &default_dbug_option, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"debug-check", OPT_DEBUG_CHECK, "Check memory and open file usage at exit.",
{"debug-check", 0, "Check memory and open file usage at exit.",
&debug_check_flag, &debug_check_flag, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"debug-info", 'T', "Print some debug info at exit.", &debug_info_flag,
&debug_info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"default_auth", OPT_DEFAULT_AUTH,
{"default_auth", 0,
"Default authentication client-side plugin to use.",
&opt_default_auth, &opt_default_auth, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -617,7 +612,7 @@ static struct my_option my_long_options[] =
"Delimiter to use in SQL statements supplied in file or command line.",
(char**) &delimiter, (char**) &delimiter, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"detach", OPT_SLAP_DETACH,
{"detach", 0,
"Detach (close and reopen) connections after X number of requests.",
&detach_rate, &detach_rate, 0, GET_UINT, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
@ -629,14 +624,14 @@ static struct my_option my_long_options[] =
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"host", 'h', "Connect to host.", &host, &host, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"init-command", OPT_INIT_COMMAND,
{"init-command", 0,
"SQL Command to execute when connecting to MariaDB server. Will "
"automatically be re-executed when reconnecting.",
&opt_init_command, &opt_init_command, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"iterations", 'i', "Number of times to run the tests.", &iterations,
&iterations, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
{"no-drop", OPT_SLAP_NO_DROP, "Do not drop the schema after the test.",
{"no-drop", 0, "Do not drop the schema after the test.",
&opt_no_drop, &opt_no_drop, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"number-char-cols", 'x',
"Number of VARCHAR columns to create in table if specifying --auto-generate-sql.",
@ -646,11 +641,11 @@ static struct my_option my_long_options[] =
"Number of INT columns to create in table if specifying --auto-generate-sql.",
(char**) &num_int_cols_opt, (char**) &num_int_cols_opt, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"number-of-queries", OPT_MYSQL_NUMBER_OF_QUERY,
{"number-of-queries", 0,
"Limit each client to this number of queries (this is not exact).",
&num_of_query, &num_of_query, 0,
GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"only-print", OPT_MYSQL_ONLY_PRINT,
{"only-print", 0,
"Do not connect to the databases, but instead print out what would have "
"been done.",
&opt_only_print, &opt_only_print, 0, GET_BOOL, NO_ARG,
@ -662,25 +657,25 @@ static struct my_option my_long_options[] =
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"plugin_dir", OPT_PLUGIN_DIR, "Directory for client-side plugins.",
{"plugin_dir", 0, "Directory for client-side plugins.",
&opt_plugin_dir, &opt_plugin_dir, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection.", &opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0,
0},
{"post-query", OPT_SLAP_POST_QUERY,
{"post-query", 0,
"Query to run or file containing query to execute after tests have completed.",
&user_supplied_post_statements, &user_supplied_post_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"post-system", OPT_SLAP_POST_SYSTEM,
{"post-system", 0,
"system() string to execute after tests have completed.",
&post_system, &post_system,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"pre-query", OPT_SLAP_PRE_QUERY,
{"pre-query", 0,
"Query to run or file containing query to execute before running tests.",
&user_supplied_pre_statements, &user_supplied_pre_statements,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"pre-system", OPT_SLAP_PRE_SYSTEM,
{"pre-system", 0,
"system() string to execute before running tests.",
&pre_system, &pre_system,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@ -1642,6 +1637,9 @@ drop_primary_key_list(void)
return 0;
}
PRAGMA_DISABLE_CHECK_STACK_FRAME
static int
create_schema(MYSQL *mysql, const char *db, statement *stmt,
option_string *engine_stmt)
@ -1737,6 +1735,7 @@ limit_not_met:
DBUG_RETURN(0);
}
PRAGMA_REENABLE_CHECK_STACK_FRAME
static int
drop_schema(MYSQL *mysql, const char *db)

View file

@ -78,7 +78,7 @@ static my_bool non_blocking_api_enabled= 0;
#define MAX_DELIMITER_LENGTH 16
#define DEFAULT_MAX_CONN 64
#define DIE_BUFF_SIZE 256*1024
#define DIE_BUFF_SIZE 15*1024
#define RESULT_STRING_INIT_MEM 2048
#define RESULT_STRING_INCREMENT_MEM 2048
@ -397,7 +397,7 @@ enum enum_commands {
Q_IF,
Q_DISABLE_PARSING, Q_ENABLE_PARSING,
Q_REPLACE_REGEX, Q_REMOVE_FILE, Q_FILE_EXIST,
Q_WRITE_FILE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
Q_WRITE_FILE, Q_WRITE_LINE, Q_COPY_FILE, Q_PERL, Q_DIE, Q_EXIT, Q_SKIP,
Q_CHMOD_FILE, Q_APPEND_FILE, Q_CAT_FILE, Q_DIFF_FILES,
Q_SEND_QUIT, Q_CHANGE_USER, Q_MKDIR, Q_RMDIR,
Q_LIST_FILES, Q_LIST_FILES_WRITE_FILE, Q_LIST_FILES_APPEND_FILE,
@ -500,6 +500,7 @@ const char *command_names[]=
"remove_file",
"file_exists",
"write_file",
"write_line",
"copy_file",
"perl",
"die",
@ -1534,7 +1535,6 @@ void free_used_memory()
void ha_pre_shutdown();
#endif
ATTRIBUTE_NORETURN static void cleanup_and_exit(int exit_code,
bool called_from_die)
{
@ -4369,6 +4369,49 @@ void do_write_file(struct st_command *command)
do_write_file_command(command, FALSE);
}
/**
Write a line to the start of the file.
Truncates existing file, creates new one if it doesn't exist.
Usage
write_line <line> <filename>;
Example
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
@note Both the file and the line parameters are evaluated
(can be variables).
@note This is a better alternative to
exec echo > file, as it doesn't depend on shell,
and can better handle sporadic file access errors caused
by antivirus or backup software on Windows.
*/
void do_write_line(struct st_command *command)
{
DYNAMIC_STRING ds_line;
DYNAMIC_STRING ds_filename;
struct command_arg write_line_args[] = {
{ "line", ARG_STRING, FALSE, &ds_line, "line to add" },
{ "filename", ARG_STRING, TRUE, &ds_filename, "File to write to" },
};
DBUG_ENTER("do_write_line");
check_command_args(command,
command->first_argument,
write_line_args,
sizeof(write_line_args)/sizeof(struct command_arg),
' ');
if (bad_path(ds_filename.str))
DBUG_VOID_RETURN;
dynstr_append_mem(&ds_line, "\n", 1);
str_to_file2(ds_filename.str, ds_line.str, ds_line.length, FALSE);
dynstr_free(&ds_filename);
dynstr_free(&ds_line);
DBUG_VOID_RETURN;
}
/*
SYNOPSIS
@ -5286,7 +5329,11 @@ void do_shutdown_server(struct st_command *command)
*/
if (timeout && mysql_shutdown(mysql, SHUTDOWN_DEFAULT))
die("mysql_shutdown failed");
{
handle_error(command, mysql_errno(mysql), mysql_error(mysql),
mysql_sqlstate(mysql), &ds_res);
DBUG_VOID_RETURN;
}
if (!timeout || wait_until_dead(pid, timeout))
{
@ -7489,7 +7536,7 @@ void str_to_file2(const char *fname, char *str, size_t size, my_bool append)
die("Could not open '%s' for writing, errno: %d", buff, errno);
if (append && my_seek(fd, 0, SEEK_END, MYF(0)) == MY_FILEPOS_ERROR)
die("Could not find end of file '%s', errno: %d", buff, errno);
if (my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP)))
if (size > 0 && my_write(fd, (uchar*)str, size, MYF(MY_WME|MY_FNABP)))
die("write failed, errno: %d", errno);
my_close(fd, MYF(0));
}
@ -8284,7 +8331,7 @@ static int match_expected_error(struct st_command *command,
SYNOPSIS
handle_error()
q - query context
command - command
err_errno - error number
err_error - error message
err_sqlstate - sql state
@ -10286,6 +10333,7 @@ int main(int argc, char **argv)
break;
case Q_FILE_EXIST: do_file_exist(command); break;
case Q_WRITE_FILE: do_write_file(command); break;
case Q_WRITE_LINE: do_write_line(command); break;
case Q_APPEND_FILE: do_append_file(command); break;
case Q_DIFF_FILES: do_diff_files(command); break;
case Q_SEND_QUIT: do_send_quit(command); break;

View file

@ -1,18 +0,0 @@
if(PMEM_LIBRARIES)
set(PMEM_FOUND TRUE)
return()
endif()
if(DEFINED PMEM_LIBRARIES)
set(PMEM_FOUND FALSE)
return()
endif()
find_path(PMEM_INCLUDE_DIRS NAMES libpmem.h)
find_library(PMEM_LIBRARIES NAMES pmem)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
PMEM DEFAULT_MSG
PMEM_LIBRARIES PMEM_INCLUDE_DIRS)
mark_as_advanced(PMEM_INCLUDE_DIRS PMEM_LIBRARIES)

View file

@ -379,5 +379,11 @@ FUNCTION (MAYBE_DISABLE_IPO target)
INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO OFF
INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL OFF)
IF(CMAKE_CONFIGURATION_TYPES)
FOREACH(cfg ${CMAKE_CONFIGURATION_TYPES})
STRING(TOUPPER "${cfg}" cfg_upper)
SET_TARGET_PROPERTIES(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_${cfg_upper} OFF)
ENDFOREACH()
ENDIF()
ENDIF()
ENDFUNCTION()

View file

@ -40,6 +40,13 @@ SET(CLIENT_PLUGIN_PVIO_SOCKET STATIC)
MESSAGE("== Configuring MariaDB Connector/C")
ADD_SUBDIRECTORY(libmariadb)
IF(MSVC AND TARGET mariadb_obj AND TARGET mariadbclient)
# With MSVC, do not produce LTCG-compiled static client libraries.
# They are not usable by end-users, being tied to exact compiler version
MAYBE_DISABLE_IPO(mariadb_obj)
MAYBE_DISABLE_IPO(mariadbclient)
ENDIF()
IF(UNIX)
INSTALL(CODE "EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E make_directory \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR})

View file

@ -44,21 +44,21 @@ MACRO(BUNDLE_PCRE2)
SET(byproducts ${byproducts} BUILD_BYPRODUCTS ${file} ${file_d})
SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${file})
ENDFOREACH()
FOREACH(v "" "_DEBUG" "_RELWITHDEBINFO" "_RELEASE" "_MINSIZEREL")
STRING(REPLACE "/WX" "" pcre2_flags${v} "${CMAKE_C_FLAGS${v}}")
SET(pcre2_flags${v} "${pcre2_flags${v}} -std=c99 ")
SET(pcre2_flags${v} "${CMAKE_C_FLAGS${v}}")
IF(MSVC)
STRING(REPLACE "/WX" "" pcre2_flags${v} "${pcre2_flags${v}}")
# Suppress a warning
STRING(APPEND pcre2_flags${v} " /wd4244 " )
# Disable asan support
STRING(REPLACE "-fsanitize=address" "" pcre2_flags${v} "${CMAKE_C_FLAGS${v}}")
STRING(APPEND pcre2_flags${v} " /wd4244 /wd4267 " )
ENDIF()
ENDFOREACH()
ExternalProject_Add(
pcre2
PREFIX "${dir}"
URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.zip"
URL_MD5 fe90992fbfb03f854bd9f344074f49eb
URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.43/pcre2-10.43.zip"
URL_MD5 b58f050f2fdd6f2ca5774a2975377a85
INSTALL_COMMAND ""
CMAKE_ARGS
"-DCMAKE_WARN_DEPRECATED=FALSE"

View file

@ -46,7 +46,7 @@ MACRO(MYSQL_ADD_PLUGIN)
${CMAKE_SOURCE_DIR}/sql
${PCRE_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR})
${ZLIB_INCLUDE_DIRS})
LIST(GET ARG_UNPARSED_ARGUMENTS 0 plugin)
SET(SOURCES ${ARG_UNPARSED_ARGUMENTS})

View file

@ -60,6 +60,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL)
SET(HAVE_EncryptAes128Ctr OFF CACHE INTERNAL "wolfssl does support AES-CTR, but differently from openssl")
SET(HAVE_EncryptAes128Gcm OFF CACHE INTERNAL "wolfssl does not support AES-GCM")
SET(HAVE_X509_check_host ON CACHE INTERNAL "wolfssl does support X509_check_host")
SET(HAVE_des ON CACHE INTERNAL "wolfssl does support DES API")
CHANGE_SSL_SETTINGS("bundled")
ADD_SUBDIRECTORY(extra/wolfssl)
MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}")
@ -158,6 +159,8 @@ MACRO (MYSQL_CHECK_SSL)
HAVE_EncryptAes128Gcm)
CHECK_SYMBOL_EXISTS(X509_check_host "openssl/x509v3.h"
HAVE_X509_check_host)
CHECK_SYMBOL_EXISTS(DES_set_key_unchecked "openssl/des.h"
HAVE_des)
SET(CMAKE_REQUIRED_INCLUDES)
SET(CMAKE_REQUIRED_LIBRARIES)
SET(CMAKE_REQUIRED_DEFINITIONS)

View file

@ -14,9 +14,12 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
MACRO (MYSQL_USE_BUNDLED_ZLIB)
SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib)
SET(ZLIB_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib)
SET(BUILD_BUNDLED_ZLIB 1)
SET(ZLIB_LIBRARY zlib CACHE INTERNAL "Bundled zlib library")
SET(ZLIB_LIBRARIES zlib CACHE INTERNAL "Bundled zlib library")
# temporarily define ZLIB_LIBRARY and ZLIB_INCLUDE_DIR for libmariadb
SET(ZLIB_LIBRARY ${ZLIB_LIBRARIES})
SET(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS})
SET(ZLIB_FOUND TRUE)
SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib")
ADD_SUBDIRECTORY(zlib)
@ -29,7 +32,7 @@ ENDMACRO()
# If this is set,we use bundled zlib
# If this is not set,search for system zlib.
# if system zlib is not found, use bundled copy
# ZLIB_LIBRARIES, ZLIB_INCLUDE_DIR and ZLIB_SOURCES
# ZLIB_LIBRARIES, ZLIB_INCLUDE_DIRS
# are set after this macro has run
MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
@ -37,10 +40,14 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB()
ELSE()
INCLUDE(FindZLIB)
FIND_PACKAGE(PkgConfig QUIET)
IF(PKG_CONFIG_FOUND AND (COMMAND PKG_GET_VARIABLE) AND (NOT WIN32))
PKG_GET_VARIABLE(ZLIB_ROOT zlib prefix)
ENDIF()
FIND_PACKAGE(ZLIB)
IF(ZLIB_FOUND)
INCLUDE(CheckFunctionExists)
SET(CMAKE_REQUIRED_LIBRARIES z)
SET(CMAKE_REQUIRED_LIBRARIES ${ZLIB_LIBRARIES})
CHECK_FUNCTION_EXISTS(crc32 HAVE_CRC32)
CHECK_FUNCTION_EXISTS(compressBound HAVE_COMPRESSBOUND)
CHECK_FUNCTION_EXISTS(deflateBound HAVE_DEFLATEBOUND)
@ -48,7 +55,6 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
IF(HAVE_CRC32 AND HAVE_COMPRESSBOUND AND HAVE_DEFLATEBOUND)
SET(WITH_ZLIB "system" CACHE STRING
"Which zlib to use (possible values are 'bundled' or 'system')")
SET(ZLIB_SOURCES "")
ELSE()
SET(ZLIB_FOUND FALSE CACHE INTERNAL "Zlib found but not usable")
MESSAGE(STATUS "system zlib found but not usable")

View file

@ -499,6 +499,7 @@
#cmakedefine HAVE_COMPRESS 1
#cmakedefine HAVE_EncryptAes128Ctr 1
#cmakedefine HAVE_EncryptAes128Gcm 1
#cmakedefine HAVE_des 1
/*
Stuff that always need to be defined (compile breaks without it)

View file

@ -60,15 +60,6 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND (NOT MSVC))
ENDIF()
ENDIF()
# workaround for old gcc on x86, gcc atomic ops only work under -march=i686
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND
CMAKE_C_COMPILER_VERSION VERSION_LESS "4.4.0")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
# query_response_time.cc causes "error: unable to find a register to spill"
SET(PLUGIN_QUERY_RESPONSE_TIME NO CACHE BOOL "Disabled, gcc is too old")
ENDIF()
# use runtime atomic-support detection in aarch64
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
MY_CHECK_AND_SET_COMPILER_FLAG("-moutline-atomics")
@ -984,3 +975,8 @@ IF(have_C__Werror)
)
SET(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
ENDIF()
IF(CMAKE_C_COMPILER_ID MATCHES "Intel")
MY_CHECK_AND_SET_COMPILER_FLAG("-no-ansi-alias")
MY_CHECK_AND_SET_COMPILER_FLAG("-fp-model precise")
ENDIF()

View file

@ -71,12 +71,6 @@ replace_uring_with_aio()
-e '/-DWITH_URING=ON/d' -i debian/rules
}
disable_pmem()
{
sed '/libpmem-dev/d' -i debian/control
sed '/-DWITH_PMEM=ON/d' -i debian/rules
}
disable_libfmt()
{
# 7.0+ required
@ -116,10 +110,6 @@ in
"buster")
disable_libfmt
replace_uring_with_aio
if [ ! "$architecture" = amd64 ]
then
disable_pmem
fi
;&
"bullseye")
add_lsb_base_depends
@ -127,10 +117,6 @@ in
"bookworm")
# mariadb-plugin-rocksdb in control is 4 arches covered by the distro rocksdb-tools
# so no removal is necessary.
if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]]
then
disable_pmem
fi
if [[ ! "$architecture" =~ amd64|arm64|armel|armhf|i386|mips64el|mipsel|ppc64el|s390x ]]
then
replace_uring_with_aio
@ -149,10 +135,6 @@ in
add_lsb_base_depends
;&
"lunar"|"mantic")
if [[ ! "$architecture" =~ amd64|arm64|ppc64el ]]
then
disable_pmem
fi
if [[ ! "$architecture" =~ amd64|arm64|armhf|ppc64el|s390x ]]
then
replace_uring_with_aio

3
debian/control vendored
View file

@ -5,7 +5,7 @@ Maintainer: MariaDB Developers <developers@lists.mariadb.org>
Build-Depends: bison,
cmake,
cracklib-runtime <!nocheck>,
debhelper (>= 10),
debhelper (>= 11),
dh-exec,
flex [amd64],
gdb <!nocheck>,
@ -34,7 +34,6 @@ Build-Depends: bison,
libnuma-dev [linux-any],
libpam0g-dev,
libpcre2-dev,
libpmem-dev [amd64 arm64 ppc64el riscv64],
libsnappy-dev,
libssl-dev,
libssl-dev:native,

View file

@ -20,7 +20,6 @@ usr/include/mariadb/mysql.h
usr/include/mariadb/mysql/
usr/include/mariadb/mysql/client_plugin.h
usr/include/mariadb/mysql/plugin_auth.h
usr/include/mariadb/mysql/plugin_auth_common.h
usr/include/mariadb/mysql_com.h
usr/include/mariadb/mysql_version.h
usr/include/mariadb/mysqld_error.h

View file

@ -9,6 +9,10 @@ etc/logrotate.d/mariadb
etc/security/user_map.conf
lib/*/security/pam_user_map.so
lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
lib/systemd/system/mariadb-extra@.socket
lib/systemd/system/mariadb.service
lib/systemd/system/mariadb@.service
lib/systemd/system/mariadb@.socket
lib/systemd/system/mysql.service
lib/systemd/system/mysqld.service
support-files/rpm/enable_encryption.preset etc/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset

View file

@ -285,28 +285,5 @@ esac
db_stop # in case invoke fails
# dh_systemd_start doesn't emit anything since we still ship /etc/init.d/mariadb.
# Thus MariaDB server is started via init.d script, which in turn redirects to
# systemctl. If we upgrade from MySQL mysql.service may be masked, which also
# means init.d script is disabled. Unmask mysql service explicitly.
# Check first that the command exists, to avoid emitting any warning messages.
if [ -x "$(command -v deb-systemd-helper)" ]
then
deb-systemd-helper unmask mysql.service > /dev/null
fi
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
if [ -d /run/systemd/system ]
then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start mariadb.service >/dev/null || true
# Modified dh_installinit snippet to only run with sysvinit
elif [ -x "/etc/init.d/mariadb" ]
then
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]
then
invoke-rc.d mariadb start || exit $?
fi
fi

View file

@ -12,50 +12,7 @@ fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# Try to stop the server in a sane way. If it does not success let the admin
# do it himself. No database directories should be removed while the server
# is running! Another mariadbd in e.g. a different chroot is fine for us.
stop_server() {
# Return immediately if there are no mysqld processes running
# as there is no point in trying to shutdown in that case.
if ! pgrep -x --nslist pid --ns $$ "mysqld|mariadbd" > /dev/null
then
return
fi
set +e
invoke-rc.d mariadb stop
invoke-rc.d mysql stop # Backwards compatibility
errno=$?
set -e
# systemctl could emit exit code 100=no init script (fresh install)
if [ "$errno" != 0 ] && [ "$errno" != 100 ]
then
echo "Attempt to stop MariaDB/MySQL server returned exitcode $errno" 1>&2
echo "There is a MariaDB/MySQL server running, but we failed in our attempts to stop it." 1>&2
echo "Stop it yourself and try again!" 1>&2
db_stop
exit 1
fi
}
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
if [ -n "$($MYADMIN ping 2>/dev/null)" ]
then
stop_server
sleep 2
fi
;;
*)
echo "postrm called with unknown argument '$1'" 1>&2
exit 1
;;
esac
#DEBHELPER#
#
# - Purge logs and data only if they are ours (#307473)

View file

@ -1,14 +0,0 @@
#!/bin/sh
set -e
#DEBHELPER#
# Modified dh_systemd_start snippet that's not added automatically
if [ -d /run/systemd/system ]
then
deb-systemd-invoke stop mariadb.service >/dev/null
# Modified dh_installinit snippet to only run with sysvinit
elif [ -x "/etc/init.d/mariadb" ]
then
invoke-rc.d mariadb stop || exit $?
fi

View file

@ -5,11 +5,7 @@ etc/mysql/mariadb.conf.d/enable_encryption.preset # Debian packaging uses files
etc/mysql/mariadb.conf.d/mysql-clients.cnf # Debian packaging uses files from debian/additions/mariadb.cnf.d/
etc/mysql/mariadb.conf.d/server.cnf # Debian packaging uses files from debian/additions/mariadb.cnf.d/
lib/systemd/system/mariadb-extra.socket # Installed by rules file
lib/systemd/system/mariadb-extra@.socket # Installed by rules file
lib/systemd/system/mariadb.service # Installed by rules file
lib/systemd/system/mariadb.socket # Installed by rules file
lib/systemd/system/mariadb@.service # Installed by rules file
lib/systemd/system/mariadb@.socket # Installed by rules file
usr/bin/mariadb-embedded # Shipping the embedded server in distro packaging does not make sense
usr/bin/mysql_config # Debian packaging has mysql_config as symlink to mariadb_config
usr/bin/mysql_embedded # Symlink to mariadb-embedded which is intentionally not included

24
debian/rules vendored
View file

@ -24,7 +24,7 @@ ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
endif
BUILDDIR := builddir
DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*-//')
DEB_VERSION_REVISION := $(shell echo $(DEB_VERSION) | sed -e 's/.*[~-]\(.*\)/\1/')
DEB_VERSION_VERSION := $(shell echo $(DEB_VERSION) | sed -e 's/^.*:\(.*\)\(-\|+\).*/\1/')
DEB_VERSION_MAJOR := $(shell echo $(DEB_VERSION_VERSION) | sed -e 's/^\(.*\)\..*$$/\1/')
RELEASE := $(shell lsb_release -r -s) # Use changelog based DEB_DISTRIBUTION instead?
@ -51,12 +51,6 @@ ifeq (32,$(DEB_HOST_ARCH_BITS))
CMAKEFLAGS += -DPLUGIN_ROCKSDB=NO
endif
# Only attempt to build with PMEM on archs that have package libpmem-dev available
# See https://packages.debian.org/search?searchon=names&keywords=libpmem-dev
ifneq (,$(filter $(DEB_HOST_ARCH),amd64 arm64 ppc64el riscv64))
CMAKEFLAGS += -DWITH_PMEM=ON
endif
# Add support for verbose builds
MAKEFLAGS += VERBOSE=1
@ -132,16 +126,6 @@ override_dh_auto_install:
dh_testdir
dh_testroot
ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS)))
# Copy systemd files to a location available for dh_installinit
cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server.mariadb.service
cp $(BUILDDIR)/support-files/mariadb.socket debian/mariadb-server.mariadb.socket
cp $(BUILDDIR)/support-files/mariadb-extra.socket debian/mariadb-server.mariadb-extra.socket
cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server.mariadb@.service
cp $(BUILDDIR)/support-files/mariadb@.socket debian/mariadb-server.mariadb@.socket
cp $(BUILDDIR)/support-files/mariadb-extra@.socket debian/mariadb-server.mariadb-extra@.socket
endif
# Run 'make install' without output since it is uninteresting and
# silencing it helps to make overall build log shorter and more readable
@echo "Running $(MAKE) install DESTDIR=$(TMP) ..."
@ -184,8 +168,8 @@ endif
# Move test plugins that are only needed by the client to the libmariadb path
mv -v $(TMP)/usr/lib/mysql/plugin/qa_auth_client.so $(TMP)/usr/lib/$(DEB_HOST_MULTIARCH)/libmariadb3/plugin/
override_dh_systemd_enable:
dh_systemd_enable --name=mariadb
override_dh_installsystemd:
dh_systemd_enable --name=mariadb mariadb.service
dh_systemd_enable --no-enable --name=mariadb mariadb.socket
dh_systemd_enable --no-enable --name=mariadb-extra mariadb-extra.socket
dh_systemd_enable --no-enable --name=mariadb@ mariadb.socket
@ -195,7 +179,7 @@ override_dh_systemd_enable:
# Start MariaDB at sequence number 19 before 20 where apache, proftpd etc gets
# started which might depend on a running database server.
override_dh_installinit-arch:
dh_installinit --name=mariadb --no-start -- defaults 19 21
dh_installinit --name=mariadb -- defaults 19 21
dh_systemd_start --restart-after-upgrade
# Use custom server version string variable

View file

@ -13,7 +13,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${ZLIB_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${ZLIB_INCLUDE_DIRS})
# Default install component for the files is Server here
SET(MYSQL_INSTALL_COMPONENT Server)

View file

@ -50,10 +50,6 @@ ADD_DEFINITIONS(-UMYSQL_SERVER)
ADD_DEFINITIONS(-DPCRE_STATIC=1)
ADD_DEFINITIONS(${SSL_DEFINES})
IF(PMEM_FOUND)
ADD_COMPILE_FLAGS(xtrabackup.cc COMPILE_FLAGS "-DHAVE_PMEM")
ENDIF()
MYSQL_ADD_EXECUTABLE(mariadb-backup
xtrabackup.cc
innobackupex.cc

View file

@ -752,7 +752,7 @@ repeat:
goto exit;
}
DBUG_ASSERT(file_offset <= static_cast<my_off_t>(stat_info.st_size));
to_copy_size = static_cast<my_off_t>(stat_info.st_size) - file_offset;
to_copy_size = static_cast<size_t>(stat_info.st_size - file_offset);
to_copy_size = to_copy_size >= TRANSLOG_PAGE_SIZE ?
(align_down(to_copy_size, TRANSLOG_PAGE_SIZE) - TRANSLOG_PAGE_SIZE) : 0;
}

View file

@ -1356,7 +1356,7 @@ out:
lsn_t server_lsn_after_lock;
extern void backup_wait_for_lsn(lsn_t lsn);
/** Release resources after backup_start() */
/** Release resources after backup_files() */
void backup_release()
{
if (opt_lock_ddl_per_table) {
@ -1372,7 +1372,7 @@ void backup_release()
static const char *default_buffer_pool_file = "ib_buffer_pool";
/** Finish after backup_start() and backup_release() */
/** Finish after backup_files() and backup_release() */
bool backup_finish(ds_ctxt *ds_data)
{
/* Copy buffer pool dump or LRU dump */

View file

@ -23,9 +23,9 @@ equal_paths(const char *first, const char *second);
/** Start --backup */
bool backup_files(ds_ctxt *ds_data, const char *from);
/** Release resources after backup_start() */
/** Release resources after backup_files() */
void backup_release();
/** Finish after backup_start() and backup_release() */
/** Finish after backup_files() and backup_release() */
bool backup_finish(ds_ctxt *ds_data);
bool
apply_log_finish();

View file

@ -67,7 +67,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "backup_debug.h"
char *tool_name;
char tool_args[2048];
char tool_args[8192];
ulong mysql_server_version;
@ -1939,9 +1939,11 @@ char *make_argv(char *buf, size_t len, int argc, char **argv)
if (strncmp(*argv, "--password", strlen("--password")) == 0) {
arg = "--password=...";
}
left-= snprintf(buf + len - left, left,
uint l= snprintf(buf + len - left, left,
"%s%c", arg, argc > 1 ? ' ' : 0);
++argv; --argc;
if (l < left)
left-= l;
}
return buf;

View file

@ -72,7 +72,16 @@ static std::string get_encryption_plugin_from_cnf()
plugin_load = line + 12;
// remote \n at the end of string
plugin_load.resize(plugin_load.size() - 1);
break;
}
if (strncmp(line, "innodb_encrypt_tables=", 22) == 0)
{
if (!strncmp(line + 22, "ON", 2) ||
!strncmp(line + 22, "1", 1))
srv_encrypt_tables= 1;
else if (!strncmp(line + 22, "FORCE", 5) ||
!strncmp(line + 22, "2", 1))
srv_encrypt_tables= 2;
}
}
fclose(f);
@ -163,6 +172,17 @@ void encryption_plugin_backup_init(MYSQL *mysql)
mysql_free_result(result);
}
result = xb_mysql_query(mysql, "select @@innodb_encrypt_tables", true, true);
row = mysql_fetch_row(result);
if (!row);
else if (const char *r= row[0])
{
if (!strcmp(r, "ON")) srv_encrypt_tables= 1;
else if (!strcmp(r, "FORCE")) srv_encrypt_tables= 2;
oss << "innodb_encrypt_tables=" << r << std::endl;
}
mysql_free_result(result);
encryption_plugin_config = oss.str();
argc = 0;

View file

@ -236,6 +236,9 @@ xb_fil_cur_open(
return(XB_FIL_CUR_SUCCESS);
}
/* Stack usage 131224 with clang */
PRAGMA_DISABLE_CHECK_STACK_FRAME
static bool page_is_corrupted(const byte *page, ulint page_no,
const xb_fil_cur_t *cursor,
const fil_space_t *space)
@ -339,6 +342,7 @@ static bool page_is_corrupted(const byte *page, ulint page_no,
return buf_page_is_corrupted(true, page, space->flags);
}
PRAGMA_REENABLE_CHECK_STACK_FRAME
/** Reads and verifies the next block of pages from the source
file. Positions the cursor after the last read non-corrupted page.

View file

@ -4,7 +4,7 @@ MariaBackup: hot backup tool for InnoDB
Originally Created 3/3/2009 Yasufumi Kinoshita
Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko,
Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz.
(c) 2017, 2022, MariaDB Corporation.
(c) 2017, 2024, MariaDB Corporation.
Portions written by Marko Mäkelä.
This program is free software; you can redistribute it and/or modify
@ -1892,8 +1892,8 @@ struct my_option xb_server_options[] =
{"innodb_log_buffer_size", OPT_INNODB_LOG_BUFFER_SIZE,
"Redo log buffer size in bytes.",
(G_PTR*) &log_sys.buf_size, (G_PTR*) &log_sys.buf_size, 0,
IF_WIN(GET_ULL,GET_ULONG), REQUIRED_ARG, 2U << 20,
2U << 20, SIZE_T_MAX, 0, 4096, 0},
GET_UINT, REQUIRED_ARG, 2U << 20,
2U << 20, log_sys.buf_size_max, 0, 4096, 0},
#if defined __linux__ || defined _WIN32
{"innodb_log_file_buffering", OPT_INNODB_LOG_FILE_BUFFERING,
"Whether the file system cache for ib_logfile0 is enabled during --backup",
@ -1989,7 +1989,7 @@ struct my_option xb_server_options[] =
&aria_log_dir_path, &aria_log_dir_path,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"open_files_limit", OPT_OPEN_FILES_LIMIT, "the maximum number of file "
{"open_files_limit", 0, "the maximum number of file "
"descriptors to reserve with setrlimit().",
(G_PTR*) &xb_open_files_limit, (G_PTR*) &xb_open_files_limit, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, UINT_MAX, 0, 1, 0},

@ -1 +1 @@
Subproject commit 66596ad9e1d7efa8479656872cf09c9c1870a02e
Subproject commit 8970ff4c34034dbb3594943d11f8c9d4c5512bd5

View file

@ -70,5 +70,19 @@
# endif /* GNUC >= 3.1 */
#endif
/* Define pragmas to disable warnings for stack frame checking */
#if defined(__clang__)
#define PRAGMA_DISABLE_CHECK_STACK_FRAME \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wframe-larger-than=\"")
#define PRAGMA_REENABLE_CHECK_STACK_FRAME \
_Pragma("clang diagnostic pop")
#else
#define PRAGMA_DISABLE_CHECK_STACK_FRAME
#define PRAGMA_REENABLE_CHECK_STACK_FRAME
#endif
#endif /* _my_attribute_h */

View file

@ -154,7 +154,7 @@ char *guess_malloc_library();
void sf_report_leaked_memory(my_thread_id id);
int sf_sanity();
extern my_thread_id (*sf_malloc_dbug_id)(void);
#define SAFEMALLOC_REPORT_MEMORY(X) sf_report_leaked_memory(X)
#define SAFEMALLOC_REPORT_MEMORY(X) if (!sf_leaking_memory) sf_report_leaked_memory(X)
#else
#define SAFEMALLOC_REPORT_MEMORY(X) do {} while(0)
#endif
@ -663,6 +663,7 @@ extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count,
myf MyFlags);
extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
extern my_off_t my_ftell(FILE *stream,myf MyFlags);
extern void (*my_sleep_for_space)(unsigned int seconds);
/* implemented in my_memmem.c */
extern void *my_memmem(const void *haystack, size_t haystacklen,

View file

@ -19,13 +19,12 @@
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
{"ssl", OPT_SSL_SSL,
{"ssl", 0,
"Enable SSL for connection (automatically enabled with other flags).",
&opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"ssl-ca", OPT_SSL_CA,
"CA file in PEM format (check OpenSSL docs, implies --ssl).",
&opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
&opt_ssl_ca, &opt_ssl_ca, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ssl-capath", OPT_SSL_CAPATH,
"CA directory (check OpenSSL docs, implies --ssl).",
&opt_ssl_capath, &opt_ssl_capath, 0, GET_STR, REQUIRED_ARG,
@ -46,13 +45,12 @@
"Certificate revocation list path (implies --ssl).",
&opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
{"tls-version", OPT_TLS_VERSION,
"TLS protocol version for secure connection.",
{"tls-version", 0, "TLS protocol version for secure connection.",
&opt_tls_version, &opt_tls_version, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0},
#ifdef MYSQL_CLIENT
{"ssl-verify-server-cert", OPT_SSL_VERIFY_SERVER_CERT,
{"ssl-verify-server-cert", 0,
"Verify server's \"Common Name\" in its cert against hostname used "
"when connecting. This option is disabled by default.",
&opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert,

@ -1 +1 @@
Subproject commit e714a674827fbb8373dd71da634dd04736d7b5a6
Subproject commit 923a0092e3508b9567b0d695e72eb4d58bf15c8f

View file

@ -25,7 +25,7 @@ ${CMAKE_SOURCE_DIR}/tpool
${CMAKE_BINARY_DIR}/sql
${PCRE_INCLUDE_DIRS}
${LIBFMT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
${SSL_INCLUDE_DIRS}
${SSL_INTERNAL_INCLUDE_DIRS}
)
@ -180,7 +180,7 @@ ENDIF()
SET(LIBS
dbug strings mysys mysys_ssl pcre2-8 vio
${ZLIB_LIBRARY} ${SSL_LIBRARIES}
${ZLIB_LIBRARIES} ${SSL_LIBRARIES}
${LIBWRAP} ${LIBCRYPT} ${CMAKE_DL_LIBS}
${EMBEDDED_PLUGIN_LIBS}
sql_embedded

View file

@ -1,5 +1,5 @@
if "%MTR_PARALLEL%"=="" set MTR_PARALLEL=%NUMBER_OF_PROCESSORS%
perl mysql-test-run.pl --verbose-restart --force --suite-timeout=120 --max-test-fail=10 --retry=3 --suite=^
perl mysql-test-run.pl --force --suite-timeout=120 --max-test-fail=10 --retry=3 --suite=^
vcol,gcol,perfschema,^
main,^
innodb,^

View file

@ -112,8 +112,7 @@ sub print_gcov_for_diff {
$acc.=sprintf '%9s:%5s:%s', '', $lnum, $' if /^ /;
++$printme, $acc.=sprintf '%9s:%5s:%s', gcov_prefix($fcov->{$lnum}), $lnum, $' if /^\+/;
die "$_^^^ dying", unless /^[- +]/;
++$lnum;
--$cnt;
++$lnum, --$cnt unless /^-/;
}
print $acc if $printme;
close PIPE or die "command '$cmd' failed: $!: $?";

View file

@ -613,13 +613,17 @@ call p_verify_status_increment(2, 0, 2, 0);
drop table t2;
set sql_mode=no_engine_substitution;
create temporary table t2 (a int);
call p_verify_status_increment(1, 0, 0, 0);
# One commit for the create temporary table, and two for committing the
# read of the stored procedure from Aria table (creating temporary table
# clears the sp cache).
call p_verify_status_increment(3, 0, 2, 0);
set sql_mode=default;
--echo # 19. A function changes temp-trans-table.
--echo #
select f1();
--echo # Two commits because a binary log record is written
call p_verify_status_increment(2, 0, 1, 0);
--echo # Two commits because a binary log record is written, and another two
--echo # as the function f1() is reloaded after creating temporary table.
call p_verify_status_increment(4, 0, 3, 0);
commit;
call p_verify_status_increment(2, 0, 1, 0);
@ -672,9 +676,11 @@ call p_verify_status_increment(2, 0, 1, 0);
--echo # 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
--echo #
drop temporary table t2;
call p_verify_status_increment(1, 0, 1, 0);
# Dropping temporary table clears SP caches, so get another two commit
# increments from loading the p_verify_status_increment procedure.
call p_verify_status_increment(3, 0, 2, 0);
commit;
call p_verify_status_increment(1, 0, 1, 0);
call p_verify_status_increment(1, 0, 0, 0);
--echo # 26. Verify that SET AUTOCOMMIT issues an implicit commit
--echo #
@ -721,7 +727,9 @@ call p_verify_status_increment(1, 0, 1, 0);
create table t2 (a int);
call p_verify_status_increment(0, 0, 0, 0);
do (select f1() from t1 where a=2);
call p_verify_status_increment(2, 2, 2, 2);
# Again extra 2 commit increments from re-loading function f1 after
# dropping temporary table.
call p_verify_status_increment(4, 2, 4, 2);
commit;
call p_verify_status_increment(2, 2, 2, 2);

View file

@ -4,7 +4,7 @@
--source include/not_embedded.inc
# Write file to make mysql-test-run.pl expect crash and restart
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Setup the mysqld to crash at shutdown
SET debug_dbug="d,crash_shutdown";

View file

@ -71,7 +71,7 @@ loose-performance-schema-hosts-size=100
loose-performance-schema-users-size=100
loose-performance-schema-max-mutex-instances=5000
loose-performance-schema-max-rwlock-instances=5000
loose-performance-schema-max-cond-instances=1000
loose-performance-schema-max-cond-instances=1500
loose-performance-schema-max-file-instances=10000
loose-performance-schema-max-socket-instances=1000
loose-performance-schema-max-table-instances=500
@ -91,7 +91,7 @@ loose-performance-schema-events-statements-history-size=10
loose-performance-schema-events-statements-history-long-size=1000
loose-performance-schema-events-transactions-history-size=10
loose-performance-schema-events-transactions-history-long-size=1000
loose-performance-schema-max-thread-instances=200
loose-performance-schema-max-thread-instances=400
loose-performance-schema-session-connect-attrs-size=2048
loose-performance-schema-max-metadata-locks=10000

View file

@ -2,4 +2,4 @@
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
# There should be a debug crash after using this .inc file
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name

View file

@ -1,39 +0,0 @@
[innodb_plugin]
ignore-builtin-innodb
plugin-load-add=$HA_INNODB_SO
innodb
innodb-cmpmem
innodb-cmp-per-index
innodb-trx
innodb-locks
innodb-lock-waits
innodb-buffer-pool-stats
innodb-buffer-page
innodb-buffer-page-lru
innodb-sys-columns
innodb-sys-fields
innodb-sys-foreign
innodb-sys-foreign-cols
innodb-sys-indexes
innodb-sys-tables
innodb-sys-virtual
innodb-metrics
[innodb]
innodb
innodb-cmpmem
innodb-cmp-per-index
innodb-trx
innodb-locks
innodb-lock-waits
innodb-metrics
innodb-buffer-pool-stats
innodb-buffer-page
innodb-buffer-page-lru
innodb-sys-columns
innodb-sys-fields
innodb-sys-foreign
innodb-sys-foreign-cols
innodb-sys-indexes
innodb-sys-tables
innodb-sys-virtual

View file

@ -3,6 +3,11 @@
# will be skipped unless innodb is enabled
#
--disable_query_log
if (`select version() like '%debug%'`)
{
SET STATEMENT sql_log_bin=0 FOR
call mtr.add_suppression("InnoDB: Trying to delete tablespace.*pending operations");
}
if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like 'MSAN%'`)
{
SET STATEMENT sql_log_bin=0 FOR

View file

@ -0,0 +1,17 @@
--innodb
--innodb-cmpmem
--innodb-cmp-per-index
--innodb-trx
--innodb-locks
--innodb-lock-waits
--innodb-metrics
--innodb-buffer-pool-stats
--innodb-buffer-page
--innodb-buffer-page-lru
--innodb-sys-columns
--innodb-sys-fields
--innodb-sys-foreign
--innodb-sys-foreign-cols
--innodb-sys-indexes
--innodb-sys-tables
--innodb-sys-virtual

View file

@ -1,4 +1,3 @@
--source include/have_innodb.inc
#
# Bug #24200: Provide backwards compatibility mode for 4.x "rollback on
# transaction timeout"

View file

@ -7,7 +7,7 @@ if (!$restart_parameters)
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect
--echo # Kill and $restart_parameters
--exec echo "$restart_parameters" > $_expect_file_name
--write_line "$restart_parameters" $_expect_file_name
--shutdown_server 0
--source include/wait_until_disconnected.inc
--enable_reconnect

View file

@ -3,7 +3,7 @@
# Write file to make mysql-test-run.pl expect the crash, but don't start it
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
# Kill the connected server
--disable_reconnect

View file

@ -2,6 +2,6 @@
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--echo # Kill the server
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
--shutdown_server 0
--source include/wait_until_disconnected.inc

View file

@ -96,10 +96,11 @@
# Remove whitespace from $rpl_topology
--let $rpl_topology= `SELECT REPLACE('$rpl_topology', ' ', '')`
--source include/slow_environ.inc
--let $include_filename= rpl_change_topology.inc [new topology=$rpl_topology]
--source include/begin_include_file.inc
if ($rpl_debug)
{
--echo ---- Check input ----
@ -235,11 +236,11 @@ if (!$rpl_skip_change_master)
}
if ($rpl_master_log_file)
{
eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1, MASTER_USE_GTID=NO;
eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_LOG_FILE = '$_rpl_master_log_file'$_rpl_master_log_pos, MASTER_CONNECT_RETRY = 1$_timeout_adjustment, MASTER_USE_GTID=NO;
}
if (!$rpl_master_log_file)
{
eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_CONNECT_RETRY=1;
eval CHANGE MASTER TO MASTER_HOST = '127.0.0.1', MASTER_PORT = $_rpl_port, MASTER_USER = 'root', MASTER_CONNECT_RETRY=1$_timeout_adjustment;
}
}
if ($_rpl_master == '')

View file

@ -49,7 +49,7 @@ if ($rpl_server_parameters)
--source include/rpl_connection.inc
# Write file to make mysql-test-run.pl start up the server again
--exec echo "$_rpl_start_server_command" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--write_line "$_rpl_start_server_command" $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
if (!$rpl_server_error)
{

View file

@ -44,7 +44,7 @@ if ($rpl_debug)
# Write file to make mysql-test-run.pl expect the "crash", but don't start
# it until it's told to
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.$rpl_server_number.expect
# Send shutdown to the connected server and give
# it 60 seconds (of mysqltest's default) to die before zapping it

View file

@ -36,7 +36,7 @@
# let SEARCH_FILE= $error_log;
# # Stop the server
# let $restart_file= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect;
# --exec echo "wait" > $restart_file
# --write_line wait $restart_file
# --shutdown_server
# --source include/wait_until_disconnected.inc
#

View file

@ -24,18 +24,15 @@ if ($rpl_inited)
# Write file to make mysql-test-run.pl expect the "crash", but don't start it
--let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')`
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect
--exec echo "wait" > $_expect_file_name
--write_line wait $_expect_file_name
# Avoid warnings from connection threads that does not have time to exit
--disable_query_log
set @@global.log_warnings=0;
--enable_query_log
--let $server_shutdown_timeout= 60
if ($VALGRIND_TEST)
{
--let $server_shutdown_timeout= 300
}
--source include/slow_environ.inc
--let $server_shutdown_timeout= 60$_timeout_adjustment
if ($shutdown_timeout)
{

View file

@ -0,0 +1,9 @@
if (!$slow_environ_check)
{
let $_timeout_adjustment=;
if (`select $VALGRIND_TEST + count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like '%SAN%'`)
{
let $_timeout_adjustment=0;
}
let $slow_environ_check=1;
}

View file

@ -21,7 +21,7 @@ if ($restart_bindir)
if ($restart_parameters)
{
--exec echo "$restart_cmd: $restart_parameters" > $_expect_file_name
--write_line "$restart_cmd: $restart_parameters" $_expect_file_name
if (!$restart_noprint)
{
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
@ -34,7 +34,7 @@ if ($restart_parameters)
}
if (!$restart_parameters)
{
--exec echo "$restart_cmd" > $_expect_file_name
--write_line "$restart_cmd" $_expect_file_name
if ($restart_noprint < 2)
{
--exec echo "# $restart_cmd"

View file

@ -34,8 +34,17 @@ if (!$rpl_debug)
--disable_query_log
}
let $_enable_warnings=0;
if ($rpl_allow_error) {
if ($ENABLED_WARNINGS) {
let $_enable_warnings=1;
disable_warnings;
}
}
STOP SLAVE IO_THREAD;
if ($_enable_warnings) {
enable_warnings;
}
--source include/wait_for_slave_io_to_stop.inc

View file

@ -25,11 +25,8 @@
let $_slave_timeout= $slave_timeout;
if (!$_slave_timeout)
{
let $_slave_timeout= 300;
if ($VALGRIND_TEST)
{
let $_slave_timeout= 1500;
}
source include/slow_environ.inc;
let $_slave_timeout= 300$_timeout_adjustment;
}
--let $_master_log_file= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1)

View file

@ -33,11 +33,8 @@
let $_slave_timeout= $slave_timeout;
if (!$_slave_timeout)
{
let $_slave_timeout= 120;
if ($VALGRIND_TEST)
{
let $_slave_timeout= 1200;
}
source include/slow_environ.inc;
let $_slave_timeout= 120$_timeout_adjustment;
}
--let $_result= `SELECT master_gtid_wait('$master_pos', $_slave_timeout)`

View file

@ -49,11 +49,8 @@
let $_slave_timeout= $slave_timeout;
if (!$_slave_timeout)
{
let $_slave_timeout= 300;
if ($VALGRIND_TEST)
{
let $_slave_timeout= 1500;
}
source include/slow_environ.inc;
let $_slave_timeout= 300$_timeout_adjustment;
}
let $_slave_param_comparison= $slave_param_comparison;

View file

@ -263,6 +263,7 @@ sub pre_setup() {
$::opt_suite_timeout= 24 * 60; # in minutes
$::opt_shutdown_timeout= ($interactive ? 24 * 60 : 3) * 60; # in seconds
$::opt_start_timeout= $::opt_shutdown_timeout; # in seconds
$::opt_debug_sync_timeout= 3000; # in seconds
}
}

View file

@ -23,7 +23,7 @@ use File::Path;
use Carp;
use base qw(Exporter);
our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX
our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX IS_MAC
native_path posix_path mixed_path
check_socket_path_length process_alive open_for_append);
@ -70,6 +70,14 @@ BEGIN {
}
}
BEGIN {
if ($^O eq "darwin") {
eval 'sub IS_MAC { 1 }';
}
else {
eval 'sub IS_MAC { 0 }';
}
}
#
# native_path

View file

@ -634,7 +634,7 @@ SUCCESS
drop table t2;
set sql_mode=no_engine_substitution;
create temporary table t2 (a int);
call p_verify_status_increment(1, 0, 0, 0);
call p_verify_status_increment(3, 0, 2, 0);
SUCCESS
set sql_mode=default;
@ -643,8 +643,9 @@ set sql_mode=default;
select f1();
f1()
2
# Two commits because a binary log record is written
call p_verify_status_increment(2, 0, 1, 0);
# Two commits because a binary log record is written, and another two
# as the function f1() is reloaded after creating temporary table.
call p_verify_status_increment(4, 0, 3, 0);
SUCCESS
commit;
@ -715,11 +716,11 @@ SUCCESS
# 25. DDL: DROP TEMPORARY TABLE, does not start a transaction
#
drop temporary table t2;
call p_verify_status_increment(1, 0, 1, 0);
call p_verify_status_increment(3, 0, 2, 0);
SUCCESS
commit;
call p_verify_status_increment(1, 0, 1, 0);
call p_verify_status_increment(1, 0, 0, 0);
SUCCESS
# 26. Verify that SET AUTOCOMMIT issues an implicit commit
@ -801,7 +802,7 @@ call p_verify_status_increment(0, 0, 0, 0);
SUCCESS
do (select f1() from t1 where a=2);
call p_verify_status_increment(2, 2, 2, 2);
call p_verify_status_increment(4, 2, 4, 2);
SUCCESS
commit;

View file

@ -235,3 +235,16 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop procedure sp;
drop table t1;
#
# MDEV-33768: Memory leak found in the test main.constraints run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT
# This test case was added by reviewer's request.
#
PREPARE stmt FROM 'CREATE TABLE t1 (a INT)';
EXECUTE stmt;
DROP TABLE t1;
EXECUTE stmt;
EXECUTE stmt;
ERROR 42S01: Table 't1' already exists
# Clean up
DROP TABLE t1;
DEALLOCATE PREPARE stmt;

View file

@ -189,3 +189,18 @@ call sp;
show create table t1;
drop procedure sp;
drop table t1;
--echo #
--echo # MDEV-33768: Memory leak found in the test main.constraints run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT
--echo # This test case was added by reviewer's request.
--echo #
PREPARE stmt FROM 'CREATE TABLE t1 (a INT)';
EXECUTE stmt;
DROP TABLE t1;
EXECUTE stmt;
--error ER_TABLE_EXISTS_ERROR
EXECUTE stmt;
--echo # Clean up
DROP TABLE t1;
DEALLOCATE PREPARE stmt;

View file

@ -17,7 +17,7 @@ insert into t1 values(9);
SET GLOBAL debug_dbug="d,crash_commit_before";
# Write file to make mysql-test-run.pl expect crash and restart
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
# Run the crashing query
--error 2013

View file

@ -1803,7 +1803,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`color` char(32) GENERATED ALWAYS AS (column_get(`dynamic_cols`,1 as char charset latin1)) STORED,
`cl` char(32) GENERATED ALWAYS AS (column_get(column_add(column_create(1,'blue' AS char charset latin1 ),2,'ttt'),`i` as char charset latin1)) STORED,
`cl` char(32) GENERATED ALWAYS AS (column_get(column_add(column_create(1,'blue' AS char charset latin1 collate latin1_swedish_ci ),2,'ttt'),`i` as char charset latin1)) STORED,
`item_name` varchar(32) NOT NULL,
`i` int(11) DEFAULT NULL,
`dynamic_cols` blob DEFAULT NULL,

View file

@ -719,6 +719,7 @@ ca cb
utf8mb3_general_ci utf8mb3_general_ci
---> Dump of mysqltest1
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -795,6 +796,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest1 to ddl_i18n_koi8r.sp.mysqltest1.sql
---> Dump of mysqltest2
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -1723,6 +1725,7 @@ koi8r_general_ci utf8mb3_general_ci koi8r_general_ci koi8r_general_ci utf8mb3_ge
DELETE FROM mysqltest2.log|
---> Dump of mysqltest1
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -1805,6 +1808,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest1 to ddl_i18n_koi8r.triggers.mysqltest1.sql
---> Dump of mysqltest2
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -2491,6 +2495,7 @@ COLLATION( '
END ONE TIME 1970-01-02 00:00:00 NULL NULL NULL NULL DISABLED PRESERVE CREATED LAST_ALTERED NULL 1 koi8r koi8r_general_ci utf8mb3_unicode_ci
---> Dump of mysqltest1
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -2558,6 +2563,7 @@ DELIMITER ;
---> Dumping mysqltest1 to ddl_i18n_koi8r.events.mysqltest1.sql
---> Dump of mysqltest2
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;

View file

@ -719,6 +719,7 @@ ca cb
utf8mb3_general_ci utf8mb3_general_ci
---> Dump of mysqltest1
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -795,6 +796,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest1 to ddl_i18n_utf8sp.mysqltest1.sql
---> Dump of mysqltest2
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -1723,6 +1725,7 @@ utf8mb3_general_ci utf8mb3_general_ci koi8r_general_ci utf8mb3_general_ci utf8mb
DELETE FROM mysqltest2.log|
---> Dump of mysqltest1
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -1805,6 +1808,7 @@ ALTER DATABASE `mysqltest1` CHARACTER SET cp866 COLLATE cp866_general_ci ;
---> Dumping mysqltest1 to ddl_i18n_utf8triggers.mysqltest1.sql
---> Dump of mysqltest2
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -2491,6 +2495,7 @@ COLLATION( 'текст') AS c4,
END ONE TIME 1970-01-02 00:00:00 NULL NULL NULL NULL DISABLED PRESERVE CREATED LAST_ALTERED NULL 1 utf8mb3 utf8mb3_general_ci utf8mb3_unicode_ci
---> Dump of mysqltest1
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;
@ -2558,6 +2563,7 @@ DELIMITER ;
---> Dumping mysqltest1 to ddl_i18n_utf8events.mysqltest1.sql
---> Dump of mysqltest2
/*!999999\- enable the sandbox mode */
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysqltest2` /*!40100 DEFAULT CHARACTER SET cp866 COLLATE cp866_general_ci */;

View file

@ -906,5 +906,61 @@ SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM
(SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq);
a
DROP TABLE t1, t2, t3;
#
# MDEV-23878: Wrong result with semi-join and splittable derived table
#
CREATE TABLE t1 (
groupId int,
id int unsigned,
PRIMARY KEY (groupId, id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES
(8,1),(8,2),(8,3),(8,4),(8,5),(8,6),(8,7),(8,8),(8,9),(8,10),
(8,11),(8,12),(8,13),(8,14),(8,15),(8,16),(8,17),(8,18),(8,19);
set statement in_predicate_conversion_threshold=2 for SELECT COUNT(*) AS cnt FROM t1
JOIN
(
SELECT groupId, id
FROM t1
WHERE id IN (1,2,3,4,5,6)
GROUP BY groupId, id
) AS t2
USING (groupId, id)
WHERE id IN (1,2,3,4,5,6,7,8);
cnt
6
set statement in_predicate_conversion_threshold=2 for EXPLAIN SELECT COUNT(*) AS cnt FROM t1
JOIN
(
SELECT groupId, id
FROM t1
WHERE id IN (1,2,3,4,5,6)
GROUP BY groupId, id
) AS t2
USING (groupId, id)
WHERE id IN (1,2,3,4,5,6,7,8);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 19
1 PRIMARY <derived3> ref key0 key0 8 test.t1.groupId,test.t1.id 1
1 PRIMARY <derived5> eq_ref distinct_key distinct_key 4 test.t1.id 1 Using where
5 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
3 LATERAL DERIVED t1 eq_ref PRIMARY PRIMARY 8 test.t1.groupId,test.t1.id 1
3 LATERAL DERIVED <derived7> eq_ref distinct_key distinct_key 4 test.t1.id 1 Using where
7 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
set statement optimizer_switch='split_materialized=off, loosescan=off' for
set statement in_predicate_conversion_threshold=2 for
SELECT COUNT(*) AS cnt FROM t1
JOIN
(
SELECT groupId, id
FROM t1
WHERE id IN (1,2,3,4,5,6)
GROUP BY groupId, id
) AS t2
USING (groupId, id)
WHERE id IN (1,2,3,4,5,6,7,8);
cnt
6
DROP TABLE t1;
# End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View file

@ -517,6 +517,48 @@ SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM
DROP TABLE t1, t2, t3;
--echo #
--echo # MDEV-23878: Wrong result with semi-join and splittable derived table
--echo #
CREATE TABLE t1 (
groupId int,
id int unsigned,
PRIMARY KEY (groupId, id)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES
(8,1),(8,2),(8,3),(8,4),(8,5),(8,6),(8,7),(8,8),(8,9),(8,10),
(8,11),(8,12),(8,13),(8,14),(8,15),(8,16),(8,17),(8,18),(8,19);
let $query=
SELECT COUNT(*) AS cnt FROM t1
JOIN
(
SELECT groupId, id
FROM t1
WHERE id IN (1,2,3,4,5,6)
GROUP BY groupId, id
) AS t2
USING (groupId, id)
WHERE id IN (1,2,3,4,5,6,7,8);
let $tvc_conversion_threshold =
set statement in_predicate_conversion_threshold=2 for;
eval $tvc_conversion_threshold $query;
eval $tvc_conversion_threshold EXPLAIN $query;
let $no_split_materialized_loosescan=
set statement optimizer_switch='split_materialized=off, loosescan=off' for;
# Correct result with split materializied optimization disabled
eval $no_split_materialized_loosescan
$tvc_conversion_threshold
$query;
DROP TABLE t1;
--echo # End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View file

@ -150,7 +150,7 @@ select hex(COLUMN_CREATE(1, "afaf" AS char character set utf8,
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select hex(column_create(1,'afaf' AS char charset utf8mb3 ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,4 + 1,12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `ex`
Note 1003 select hex(column_create(1,'afaf' AS char charset utf8mb3 collate utf8mb3_general_ci ,2,1212 AS unsigned int,3,1212 AS int,4,12.12 AS double,4 + 1,12.12 AS decimal,6,'2011-04-05' AS date,7,'- 0:45:49.000001' AS time,8,'2011-04-05 0:45:49.000001' AS datetime)) AS `ex`
select hex(column_create(1, 0.0 AS decimal));
hex(column_create(1, 0.0 AS decimal))
000100010004
@ -354,7 +354,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 ),1 as char charset utf8mb3) AS `ex`
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 collate utf8mb3_general_ci ),1 as char charset utf8mb3) AS `ex`
select column_get(column_create(1, 1212 AS unsigned int), 1 as char charset utf8) as ex;
ex
1212
@ -414,7 +414,7 @@ select column_get(column_create(1, "1212" AS char charset utf8), 1 as char chars
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 ),1 as char charset binary) AS `ex`
Note 1003 select column_get(column_create(1,'1212' AS char charset utf8mb3 collate utf8mb3_general_ci ),1 as char charset binary) AS `ex`
#
# column get real
#
@ -1882,7 +1882,7 @@ drop table t1;
create view v1 as select column_get(column_add(column_create(1 , 'blue' as char), 2, 'ttt'), 1 as char);
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select column_get(column_add(column_create(1,'blue' AS char charset utf8mb3 ),2,'ttt'),1 as char charset utf8mb3) AS `Name_exp_1` utf8mb3 utf8mb3_general_ci
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select column_get(column_add(column_create(1,'blue' AS char charset utf8mb3 collate utf8mb3_general_ci ),2,'ttt'),1 as char charset utf8mb3) AS `Name_exp_1` utf8mb3 utf8mb3_general_ci
select * from v1;
Name_exp_1
blue
@ -1949,3 +1949,23 @@ ex
#
# End of 10.4 tests
#
#
# Start of 10.5 tests
#
#
# Start of 10.5 tests
#
#
# MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol
#
SELECT hex(column_create(1,'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)) AS ex;
ex
0001000100035361
SELECT hex(column_add(column_create(
1, 'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin),
2, 'b' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci)) AS ex;
ex
00020001000302001353612162
#
# Start of 10.5 tests
#

View file

@ -1000,3 +1000,24 @@ SELECT HEX(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL)) as ex;
--echo #
--echo # End of 10.4 tests
--echo #
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol
--echo #
SELECT hex(column_create(1,'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)) AS ex;
SELECT hex(column_add(column_create(
1, 'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin),
2, 'b' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci)) AS ex;
--echo #
--echo # Start of 10.5 tests
--echo #

View file

@ -3,10 +3,10 @@
#
--source include/not_embedded.inc
create server '' foreign data wrapper w2 options (host '127.0.0.1');
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line wait $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--write_line restart $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
-- enable_reconnect
-- source include/wait_until_connected_again.inc

View file

@ -208,12 +208,13 @@ t1 CREATE TABLE `t1` (
KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
set sql_mode= default;
#
# MDEV-33460 select '123' 'x'; unexpected result
#
SELECT '';
NULL
NULL
SELECT '' 'b' 'c';
bc
bc

View file

@ -25,12 +25,15 @@ flush tables;
update t1 set a = 2;
show create table t1;
drop table t1;
set sql_mode= default;
--echo #
--echo # MDEV-33460 select '123' 'x'; unexpected result
--echo #
--disable_view_protocol
SELECT '';
--enable_view_protocol
SELECT '' 'b' 'c';
SELECT '' '' 'c';
SELECT 'a' '' 'c';

View file

@ -3,56 +3,56 @@ des_encrypt("test", 'akeystr')
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_encrypt("test", 1);
des_encrypt("test", 1)
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_encrypt("test", 9);
des_encrypt("test", 9)
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_encrypt("test", 100);
des_encrypt("test", 100)
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_encrypt("test", NULL);
des_encrypt("test", NULL)
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_encrypt(NULL, NULL);
des_encrypt(NULL, NULL)
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_decrypt("test", 'anotherkeystr');
des_decrypt("test", 'anotherkeystr')
NULL
Warnings:
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_decrypt(1, 1);
des_decrypt(1, 1)
NULL
Warnings:
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_decrypt(des_encrypt("test", 'thekey'));
des_decrypt(des_encrypt("test", 'thekey'))
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select hex(des_encrypt("hello")),des_decrypt(des_encrypt("hello"));
hex(des_encrypt("hello")) des_decrypt(des_encrypt("hello"))
NULL NULL
@ -60,22 +60,22 @@ Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_decrypt(des_encrypt("hello",4));
des_decrypt(des_encrypt("hello",4))
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_decrypt(des_encrypt("hello",'test'),'test');
des_decrypt(des_encrypt("hello",'test'),'test')
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select hex(des_encrypt("hello")),hex(des_encrypt("hello",5)),hex(des_encrypt("hello",'default_password'));
hex(des_encrypt("hello")) hex(des_encrypt("hello",5)) hex(des_encrypt("hello",'default_password'))
NULL NULL NULL
@ -83,28 +83,28 @@ Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
Warning 1289 The 'des_encrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_decrypt(des_encrypt("hello"),'default_password');
des_decrypt(des_encrypt("hello"),'default_password')
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select des_decrypt(des_encrypt("hello",4),'password4');
des_decrypt(des_encrypt("hello",4),'password4')
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
SET @a=des_decrypt(des_encrypt("hello"));
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
flush des_key_file;
select @a = des_decrypt(des_encrypt("hello"));
@a = des_decrypt(des_encrypt("hello"))
@ -121,11 +121,11 @@ NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working
select hex(des_decrypt(des_encrypt("hello","hidden")));
hex(des_decrypt(des_encrypt("hello","hidden")))
NULL
Warnings:
Note 1287 'des_encrypt' is deprecated and will be removed in a future release
Note 1287 'des_decrypt' is deprecated and will be removed in a future release
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with '--with-ssl' to have it working
Warning 1289 The 'des_decrypt' feature is disabled; you need MariaDB built with 'openssl des cipher (HAVE_des)' to have it working

View file

@ -4313,5 +4313,30 @@ ERROR HY000: Illegal parameter data types bigint unsigned and row for operation
SELECT @@max_allowed_packet=ROW(1,1);
ERROR HY000: Illegal parameter data types bigint unsigned and row for operation '='
#
# MDEV-21034 GREATEST() and LEAST() malfunction for NULL
#
SELECT 5 AS c1 FROM dual WHERE GREATEST(1, NULL);
c1
SELECT 5 AS c1 FROM dual WHERE LEAST(1, NULL);
c1
CREATE TABLE t0 (c0 INT);
INSERT INTO t0 VALUES (1);
SELECT * FROM t0 WHERE GREATEST(c0, NULL);
c0
SELECT * FROM t0 WHERE LEAST(c0, NULL);
c0
DROP TABLE t0;
SELECT 5 AS c1 FROM dual WHERE GREATEST(1e0, NULL);
c1
SELECT 5 AS c1 FROM dual WHERE LEAST(1e0, NULL);
c1
CREATE TABLE t0 (c0 DOUBLE);
INSERT INTO t0 VALUES (1);
SELECT * FROM t0 WHERE GREATEST(c0, NULL);
c0
SELECT * FROM t0 WHERE LEAST(c0, NULL);
c0
DROP TABLE t0;
#
# End of 10.5 tests
#

View file

@ -1115,6 +1115,29 @@ SELECT 0x20+ROW(1,1);
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT @@max_allowed_packet=ROW(1,1);
--echo #
--echo # MDEV-21034 GREATEST() and LEAST() malfunction for NULL
--echo #
SELECT 5 AS c1 FROM dual WHERE GREATEST(1, NULL);
SELECT 5 AS c1 FROM dual WHERE LEAST(1, NULL);
CREATE TABLE t0 (c0 INT);
INSERT INTO t0 VALUES (1);
SELECT * FROM t0 WHERE GREATEST(c0, NULL);
SELECT * FROM t0 WHERE LEAST(c0, NULL);
DROP TABLE t0;
SELECT 5 AS c1 FROM dual WHERE GREATEST(1e0, NULL);
SELECT 5 AS c1 FROM dual WHERE LEAST(1e0, NULL);
CREATE TABLE t0 (c0 DOUBLE);
INSERT INTO t0 VALUES (1);
SELECT * FROM t0 WHERE GREATEST(c0, NULL);
SELECT * FROM t0 WHERE LEAST(c0, NULL);
DROP TABLE t0;
--echo #
--echo # End of 10.5 tests
--echo #

View file

@ -971,6 +971,84 @@ c1
9223372036854775808
drop table `a`;
#
# MDEV-18319 BIGINT UNSIGNED Performance issue
#
CREATE OR REPLACE TABLE t1 (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
);
FOR i IN 0..255
DO
INSERT INTO t1 VALUES ();
END FOR
$$
SELECT MIN(id), MAX(id), COUNT(*) FROM t1;
MIN(id) MAX(id) COUNT(*)
1 256 256
EXPLAIN SELECT id FROM t1 WHERE id IN (1,2);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 2 Using where; Using index
EXPLAIN SELECT id FROM t1 WHERE id IN (9223372036854775806, 9223372036854775807);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 2 Using where; Using index
EXPLAIN SELECT id FROM t1 WHERE id IN (9223372036854775807, 9223372036854775808);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 2 Using where; Using index
DROP TABLE t1;
#
# MDEV-18898 SELECT using wrong index when using operator IN with mixed types
#
CREATE TEMPORARY TABLE t1 (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
name varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
);
FOR i IN 1..255
DO
INSERT INTO t1 VALUES (i, MD5(i));
END FOR
$$
#
# Constants alone
#
ANALYZE SELECT id, name FROM t1 WHERE id = 1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 NULL 100.00 NULL
ANALYZE SELECT id, name FROM t1 WHERE id = '2';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 NULL 100.00 NULL
#
# Two constants using IN
#
ANALYZE SELECT id, name FROM t1 WHERE id IN (1, 2);
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition
ANALYZE SELECT id, name FROM t1 WHERE id IN ('1', 2) /* Used a wrong index */;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition
ANALYZE SELECT id, name FROM t1 WHERE id IN (1, '2') /* Used a wrong index */;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition
ANALYZE SELECT id, name FROM t1 WHERE id IN ('1', '2');
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition
#
# Two constants using OR
#
ANALYZE SELECT id, name FROM t1 WHERE id = 1 OR id = 2;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition
ANALYZE SELECT id, name FROM t1 WHERE id = '1' OR id = '2';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition
ANALYZE SELECT id, name FROM t1 WHERE id = 1 OR id = '2';
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition
ANALYZE SELECT id, name FROM t1 WHERE id = '1' OR id = 2;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 2.00 100.00 100.00 Using index condition
DROP TABLE t1;
#
# End of 10.5 tests
#
#

View file

@ -742,6 +742,66 @@ SELECT c1 FROM a WHERE c1 IN ( 1, 9223372036854775807 );
SELECT c1 FROM a WHERE c1 IN ( 1, 9223372036854775808 );
drop table `a`;
--echo #
--echo # MDEV-18319 BIGINT UNSIGNED Performance issue
--echo #
CREATE OR REPLACE TABLE t1 (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY
);
DELIMITER $$;
FOR i IN 0..255
DO
INSERT INTO t1 VALUES ();
END FOR
$$
DELIMITER ;$$
SELECT MIN(id), MAX(id), COUNT(*) FROM t1;
EXPLAIN SELECT id FROM t1 WHERE id IN (1,2);
EXPLAIN SELECT id FROM t1 WHERE id IN (9223372036854775806, 9223372036854775807);
EXPLAIN SELECT id FROM t1 WHERE id IN (9223372036854775807, 9223372036854775808);
DROP TABLE t1;
--echo #
--echo # MDEV-18898 SELECT using wrong index when using operator IN with mixed types
--echo #
CREATE TEMPORARY TABLE t1 (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
name varchar(100) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
);
DELIMITER $$;
FOR i IN 1..255
DO
INSERT INTO t1 VALUES (i, MD5(i));
END FOR
$$
DELIMITER ;$$
--echo #
--echo # Constants alone
--echo #
ANALYZE SELECT id, name FROM t1 WHERE id = 1;
ANALYZE SELECT id, name FROM t1 WHERE id = '2';
--echo #
--echo # Two constants using IN
--echo #
ANALYZE SELECT id, name FROM t1 WHERE id IN (1, 2);
ANALYZE SELECT id, name FROM t1 WHERE id IN ('1', 2) /* Used a wrong index */;
ANALYZE SELECT id, name FROM t1 WHERE id IN (1, '2') /* Used a wrong index */;
ANALYZE SELECT id, name FROM t1 WHERE id IN ('1', '2');
--echo #
--echo # Two constants using OR
--echo #
ANALYZE SELECT id, name FROM t1 WHERE id = 1 OR id = 2;
ANALYZE SELECT id, name FROM t1 WHERE id = '1' OR id = '2';
ANALYZE SELECT id, name FROM t1 WHERE id = 1 OR id = '2';
ANALYZE SELECT id, name FROM t1 WHERE id = '1' OR id = 2;
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #

View file

@ -1690,6 +1690,33 @@ select json_arrayagg('ä'), json_objectagg(1, 'ä');
json_arrayagg('ä') json_objectagg(1, 'ä')
["ä"] {"1":"ä"}
#
# MDEV-32287: JSON_EXTRACT not returning multiple values for same path
#
select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]');
JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]')
[40, 40]
#
# MDEV-31402: SIGSEGV in json_get_path_next | Item_func_json_extract::read_json
#
CREATE TABLE t (id CHAR AS (JSON_COMPACT (JSON_EXTRACT(doc,"$._id"))) UNIQUE KEY,doc JSON,CONSTRAINT notnu CHECK (id IS NOT NULL));
INSERT INTO t (doc) VALUES ('{ "_id" : { "$oid" : "0ca0b0f0" },"a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" :0} ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] }');
ERROR 22001: Data too long for column 'id' at row 1
DROP TABLE t;
#
# MDEV-19487: JSON_TYPE doesnt detect the type of String Values (returns NULL) and for Date/DateTime returns "INTEGER"
#
SELECT JSON_TYPE(json_value(JSON_OBJECT("id", 1, "name", 'Monty', "date", Cast('2019-01-01' as Date) ), '$.date')) as x;
x
NULL
Warnings:
Warning 4038 Syntax error in JSON text in argument 1 to function 'json_type' at position 5
#
# MDEV-22141: JSON_REMOVE returns NULL on valid arguments
#
SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D');
JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D')
{"A": {"B": 1}}
#
# End of 10.5 tests
#
#

View file

@ -1118,6 +1118,38 @@ set names latin1;
select json_arrayagg('ä'), json_objectagg(1, 'ä');
--enable_service_connection
--echo #
--echo # MDEV-32287: JSON_EXTRACT not returning multiple values for same path
--echo #
select JSON_EXTRACT("[1, 2, [30, 40]]", '$[2][1]', '$[2][1]');
--echo #
--echo # MDEV-31402: SIGSEGV in json_get_path_next | Item_func_json_extract::read_json
--echo #
CREATE TABLE t (id CHAR AS (JSON_COMPACT (JSON_EXTRACT(doc,"$._id"))) UNIQUE KEY,doc JSON,CONSTRAINT notnu CHECK (id IS NOT NULL));
--error ER_DATA_TOO_LONG
INSERT INTO t (doc) VALUES ('{ "_id" : { "$oid" : "0ca0b0f0" },"a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" : [ { "a" :0} ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] } ] }');
DROP TABLE t;
--echo #
--echo # MDEV-19487: JSON_TYPE doesnt detect the type of String Values (returns NULL) and for Date/DateTime returns "INTEGER"
--echo #
SELECT JSON_TYPE(json_value(JSON_OBJECT("id", 1, "name", 'Monty', "date", Cast('2019-01-01' as Date) ), '$.date')) as x;
--echo #
--echo # MDEV-22141: JSON_REMOVE returns NULL on valid arguments
--echo #
SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D');
--echo #
--echo # End of 10.5 tests
--echo #

View file

@ -10,6 +10,8 @@ select length(@obj), length(@arr);
length(@obj) length(@arr)
5000009 5000009
set max_statement_time=0.0001;
SET @old_debug= @@debug_dbug;
SET debug_dbug='+d,debug_max_statement_time exceeded';
select json_array_append(@arr, '$[0]', 1);
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
select json_array_insert(@arr, '$[0]', 1);
@ -34,6 +36,7 @@ select json_replace(@obj,'$.foo',1);
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
select json_set(@arr,'$[1000]',1);
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
SET debug_dbug= @old_debug;
disconnect u;
connection default;
set global max_allowed_packet=default;

View file

@ -1,6 +1,7 @@
source include/have_profiling.inc;
source include/not_embedded.inc;
source include/no_valgrind_without_big.inc;
source include/have_debug.inc;
set global max_allowed_packet=1073741824;
connect u,localhost,root;
@ -16,6 +17,8 @@ select length(@obj), length(@arr);
set max_statement_time=0.0001;
disable_abort_on_error;
SET @old_debug= @@debug_dbug;
SET debug_dbug='+d,debug_max_statement_time exceeded';
select json_array_append(@arr, '$[0]', 1);
select json_array_insert(@arr, '$[0]', 1);
select json_insert(@obj, '$.meta', 1);
@ -29,6 +32,7 @@ select json_remove(@obj,'$.foo');
select json_replace(@obj,'$.foo',1);
select json_set(@arr,'$[1000]',1);
enable_abort_on_error;
SET debug_dbug= @old_debug;
disconnect u;
connection default;
set global max_allowed_packet=default;

View file

@ -3711,5 +3711,20 @@ SELECT CRC32(ExtractValue('<a><b/></a>', '/a/b')) AS f;
f
0
#
# MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_double_round from sql/item_func.cc|
#
SELECT TRUNCATE(EXP(-1.e-2),-1.e+30) AS c1;
c1
0
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1;
c1
0
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
c1
0
SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
c1
NULL
#
# End of 10.5 tests
#

View file

@ -1980,6 +1980,16 @@ DROP TABLE t2, t1;
SELECT CRC32(ExtractValue('<a><b/></a>', '/a/b')) AS f;
--echo #
--echo # MDEV-33534 UBSAN: Negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_double_round from sql/item_func.cc|
--echo #
SELECT TRUNCATE(EXP(-1.e-2),-1.e+30) AS c1;
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1;
SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1;
--echo #
--echo # End of 10.5 tests
--echo #

Some files were not shown because too many files have changed in this diff Show more