1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '11.8' into main

This commit is contained in:
Sergei Golubchik
2025-04-18 12:07:02 +02:00
871 changed files with 11314 additions and 6371 deletions

View File

@@ -31,7 +31,7 @@ ENDIF()
# in RPM's: # in RPM's:
#set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true") #set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true")
FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135) FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0056 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135)
IF(POLICY ${p}) IF(POLICY ${p})
CMAKE_POLICY(SET ${p} NEW) CMAKE_POLICY(SET ${p} NEW)
ENDIF() ENDIF()
@@ -241,7 +241,7 @@ ENDIF()
OPTION(WITH_MSAN "Enable memory sanitizer" OFF) OPTION(WITH_MSAN "Enable memory sanitizer" OFF)
IF (WITH_MSAN) IF (WITH_MSAN)
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE")
IF(NOT (have_C__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE IF(NOT (have_C__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE
AND have_CXX__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE)) AND have_CXX__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE))
MESSAGE(FATAL_ERROR "Compiler doesn't support -fsanitize=memory flags") MESSAGE(FATAL_ERROR "Compiler doesn't support -fsanitize=memory flags")
@@ -251,7 +251,7 @@ IF (WITH_MSAN)
MESSAGE(FATAL_ERROR "C++ Compiler requires support for -stdlib=libc++") MESSAGE(FATAL_ERROR "C++ Compiler requires support for -stdlib=libc++")
ENDIF() ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory" DEBUG RELWITHDEBINFO) MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory")
IF(NOT HAVE_LINK_FLAG__fsanitize_memory) IF(NOT HAVE_LINK_FLAG__fsanitize_memory)
MESSAGE(FATAL_ERROR "Linker doesn't support -fsanitize=memory flags") MESSAGE(FATAL_ERROR "Linker doesn't support -fsanitize=memory flags")
ENDIF() ENDIF()
@@ -635,7 +635,7 @@ IF(NOT WITHOUT_SERVER)
perror perror
replace) replace)
IF(WIN32) IF(WIN32)
ADD_DEPENDENCIES(minbuild echo mariadb-install-db my_safe_kill) ADD_DEPENDENCIES(minbuild echo mariadb-install-db my_safe_kill mariadb-upgrade-service)
ENDIF() ENDIF()
ADD_CUSTOM_TARGET(smoketest ADD_CUSTOM_TARGET(smoketest
COMMAND perl ./mysql-test-run.pl main.1st COMMAND perl ./mysql-test-run.pl main.1st

View File

@@ -862,8 +862,7 @@ static int upgrade_already_done(int silent)
s= strchr(version, '.'); s= strchr(version, '.');
s= strchr(s + 1, '.'); s= strchr(s + 1, '.');
if (strncmp(upgrade_from_version, version, if (strncmp(upgrade_from_version, version, (size_t)(s - version + 1)))
(size_t)(s - version + 1)))
{ {
if (calc_server_version(upgrade_from_version) <= MYSQL_VERSION_ID) if (calc_server_version(upgrade_from_version) <= MYSQL_VERSION_ID)
{ {
@@ -877,9 +876,14 @@ static int upgrade_already_done(int silent)
} }
if (!silent) if (!silent)
{ {
verbose("This installation of MariaDB is already upgraded to %s.\n" if (strcmp(upgrade_from_version, version))
"There is no need to run mariadb-upgrade again for %s.", verbose("This installation of MariaDB is already upgraded to %s.\n"
upgrade_from_version, version); "There is no need to run mariadb-upgrade again for %s, because "
"they're both %.*s.",
upgrade_from_version, version, (int)(s - version), version);
else
verbose("This installation of MariaDB is already upgraded to %s.\n"
"There is no need to run mariadb-upgrade again.", version);
if (!opt_check_upgrade) if (!opt_check_upgrade)
verbose("You can use --force if you still want to run mariadb-upgrade"); verbose("You can use --force if you still want to run mariadb-upgrade");
} }

View File

@@ -2253,7 +2253,7 @@ static char *quote_for_equal(const char *name, char *buff)
*to++='\\'; *to++='\\';
} }
if (*name == '\'') if (*name == '\'')
*to++= '\\'; *to++= '\'';
*to++= *name++; *to++= *name++;
} }
to[0]= '\''; to[0]= '\'';
@@ -3853,7 +3853,7 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs,
fprintf(sql_file, fprintf(sql_file,
"DELIMITER ;;\n" "DELIMITER ;;\n"
"/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n" "/*!50003 SET SESSION SQL_MODE='%s' */;;\n"
"/*!50003 CREATE */ ", "/*!50003 CREATE */ ",
(*show_trigger_row)[6]); (*show_trigger_row)[6]);
@@ -4907,17 +4907,19 @@ static int dump_all_users_roles_and_grants()
return 1; return 1;
while ((row= mysql_fetch_row(tableres))) while ((row= mysql_fetch_row(tableres)))
{ {
char buf[200];
if (opt_replace_into) if (opt_replace_into)
/* Protection against removing the current import user */ /* Protection against removing the current import user */
/* MySQL-8.0 export capability */ /* MySQL-8.0 export capability */
fprintf(md_result_file, fprintf(md_result_file,
"DELIMITER |\n" "DELIMITER |\n"
"/*M!100101 IF current_user()=\"%s\" THEN\n" "/*M!100101 IF current_user()=%s THEN\n"
" SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001," " SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001,"
" MESSAGE_TEXT=\"Don't remove current user %s'\";\n" " MESSAGE_TEXT=\"Don't remove current user %s'\";\n"
"END IF */|\n" "END IF */|\n"
"DELIMITER ;\n" "DELIMITER ;\n"
"/*!50701 DROP USER IF EXISTS %s */;\n", row[0], row[0], row[0]); "/*!50701 DROP USER IF EXISTS %s */;\n",
quote_for_equal(row[0],buf), row[0], row[0]);
if (dump_create_user(row[0])) if (dump_create_user(row[0]))
result= 1; result= 1;
/* if roles exist, defer dumping grants until after roles created */ /* if roles exist, defer dumping grants until after roles created */
@@ -7033,6 +7035,7 @@ static my_bool get_view_structure(char *table, char* db)
char *result_table, *opt_quoted_table; char *result_table, *opt_quoted_table;
char table_buff[NAME_LEN*2+3]; char table_buff[NAME_LEN*2+3];
char table_buff2[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3];
char temp_buff[NAME_LEN*2 + 3], temp_buff2[NAME_LEN*2 + 3];
char query[QUERY_LENGTH]; char query[QUERY_LENGTH];
FILE *sql_file= md_result_file; FILE *sql_file= md_result_file;
DBUG_ENTER("get_view_structure"); DBUG_ENTER("get_view_structure");
@@ -7093,7 +7096,9 @@ static my_bool get_view_structure(char *table, char* db)
"SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, " "SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, "
" CHARACTER_SET_CLIENT, COLLATION_CONNECTION " " CHARACTER_SET_CLIENT, COLLATION_CONNECTION "
"FROM information_schema.views " "FROM information_schema.views "
"WHERE table_name=\"%s\" AND table_schema=\"%s\"", table, db); "WHERE table_name=%s AND table_schema=%s",
quote_for_equal(table, temp_buff2),
quote_for_equal(db, temp_buff));
if (mysql_query(mysql, query)) if (mysql_query(mysql, query))
{ {

View File

@@ -2223,6 +2223,13 @@ generate_stats(conclusions *con, option_string *eng, stats *sptr)
stats *ptr; stats *ptr;
unsigned int x; unsigned int x;
if (eng && eng->string)
con->engine= eng->string;
/* Early return when iterations is 0 to avoid accessing uninitialized sptr */
if (iterations == 0)
return;
con->min_timing= sptr->timing; con->min_timing= sptr->timing;
con->max_timing= sptr->timing; con->max_timing= sptr->timing;
con->min_rows= sptr->rows; con->min_rows= sptr->rows;
@@ -2243,11 +2250,6 @@ generate_stats(conclusions *con, option_string *eng, stats *sptr)
con->min_timing= ptr->timing; con->min_timing= ptr->timing;
} }
con->avg_timing= con->avg_timing/iterations; con->avg_timing= con->avg_timing/iterations;
if (eng && eng->string)
con->engine= eng->string;
else
con->engine= NULL;
} }
void void

View File

@@ -6807,7 +6807,7 @@ int read_line()
my_bool have_slash= FALSE; my_bool have_slash= FALSE;
enum {R_NORMAL, R_Q, R_SLASH_IN_Q, enum {R_NORMAL, R_Q, R_SLASH_IN_Q,
R_COMMENT, R_LINE_START} state= R_LINE_START; R_COMMENT, R_LINE_START, R_CSTYLE_COMMENT} state= R_LINE_START;
DBUG_ENTER("read_line"); DBUG_ENTER("read_line");
*p= 0; *p= 0;
@@ -6894,9 +6894,23 @@ int read_line()
state= R_Q; state= R_Q;
} }
} }
else if (c == '*' && last_char == '/')
{
state= R_CSTYLE_COMMENT;
break;
}
have_slash= is_escape_char(c, last_quote); have_slash= is_escape_char(c, last_quote);
break; break;
case R_CSTYLE_COMMENT:
if (c == '!')
// Got the hint introducer '/*!'. Switch to normal processing of
// next following characters
state= R_NORMAL;
else if (c == '/' && last_char == '*')
state= R_NORMAL;
break;
case R_COMMENT: case R_COMMENT:
if (c == '\n') if (c == '\n')
{ {

View File

@@ -28,15 +28,14 @@ MACRO (CHECK_LIBFMT)
IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto") IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto")
SET(CMAKE_REQUIRED_INCLUDES ${LIBFMT_INCLUDE_DIR}) SET(CMAKE_REQUIRED_INCLUDES ${LIBFMT_INCLUDE_DIR})
CHECK_CXX_SOURCE_RUNS( CHECK_CXX_SOURCE_RUNS(
"#define FMT_STATIC_THOUSANDS_SEPARATOR ',' "#define FMT_HEADER_ONLY 1
#define FMT_HEADER_ONLY 1
#include <fmt/args.h> #include <fmt/args.h>
int main() { int main() {
using ArgStore= fmt::dynamic_format_arg_store<fmt::format_context>; using ArgStore= fmt::dynamic_format_arg_store<fmt::format_context>;
ArgStore arg_store; ArgStore arg_store;
int answer= 4321; int answer= 4321;
arg_store.push_back(answer); arg_store.push_back(answer);
return fmt::vformat(\"{:L}\", arg_store).compare(\"4,321\"); return fmt::vformat(\"{}\", arg_store).compare(\"4321\");
}" HAVE_SYSTEM_LIBFMT) }" HAVE_SYSTEM_LIBFMT)
SET(CMAKE_REQUIRED_INCLUDES) SET(CMAKE_REQUIRED_INCLUDES)
ENDIF() ENDIF()

View File

@@ -121,7 +121,7 @@ IF(MSVC)
# Disable mingw based pkg-config found in Strawberry perl # Disable mingw based pkg-config found in Strawberry perl
SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "") SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "")
SET(MSVC_CRT_TYPE /MT CACHE STRING SET(MSVC_CRT_TYPE /MD CACHE STRING
"Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)"
) )
SET(VALID_CRT_TYPES /MTd /MDd /MD /MT) SET(VALID_CRT_TYPES /MTd /MDd /MD /MT)
@@ -129,6 +129,25 @@ IF(MSVC)
MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ") MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ")
ENDIF() ENDIF()
# CMake version 3.15 and later uses CMAKE_MSVC_RUNTIME_LIBRARY
# variable for our MSVC_CRT_TYPE.
# Set CMAKE_MSVC_RUNTIME_LIBRARY and pass to external projects
# it is important to keep the same CRT type when linking
#
# Translation rules MSVC_CRT_TYPE -> CMAKE_MSVC_RUNTIME_LIBRARY
# /MT -> MultiThreaded
# /MTd -> MultiThreadedDebug
# /MD -> MultiThreadedDLL
# /MDd -> MultiThreadedDebugDLL
SET(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
IF(MSVC_CRT_TYPE MATCHES "d$")
STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY Debug)
ENDIF()
IF(MSVC_CRT_TYPE MATCHES "D")
STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY DLL)
ENDIF()
IF(MSVC_CRT_TYPE MATCHES "/MD") IF(MSVC_CRT_TYPE MATCHES "/MD")
# Dynamic runtime (DLLs), need to install CRT libraries. # Dynamic runtime (DLLs), need to install CRT libraries.
SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT) SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT)
@@ -282,6 +301,7 @@ STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " ws2_32.lib synchronization.lib")
# System checks # System checks
SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs
SET(HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1)
# IPv6 constants appeared in Vista SDK first. We need to define them in any case if they are # IPv6 constants appeared in Vista SDK first. We need to define them in any case if they are
# not in headers, to handle dual mode sockets correctly. # not in headers, to handle dual mode sockets correctly.

View File

@@ -54,11 +54,18 @@ MACRO(BUNDLE_PCRE2)
ENDIF() ENDIF()
ENDFOREACH() ENDFOREACH()
IF(CMAKE_MSVC_RUNTIME_LIBRARY)
SET(CMAKE_MSVC_RUNTIME_LIBRARY_ARG
"-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}")
ELSE()
SET(CMAKE_MSVC_RUNTIME_LIBRARY_ARG)
ENDIF()
ExternalProject_Add( ExternalProject_Add(
pcre2 pcre2
PREFIX "${dir}" PREFIX "${dir}"
URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.zip" URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.zip"
URL_MD5 dfab8313154b3377a6959c3b6377841e URL_MD5 873da56c6469ec207ca5c5ae9688b83a
INSTALL_COMMAND "" INSTALL_COMMAND ""
CMAKE_ARGS CMAKE_ARGS
"-DCMAKE_WARN_DEPRECATED=FALSE" "-DCMAKE_WARN_DEPRECATED=FALSE"
@@ -72,6 +79,7 @@ MACRO(BUNDLE_PCRE2)
"-DCMAKE_C_FLAGS_RELEASE=${pcre2_flags_RELEASE}" "-DCMAKE_C_FLAGS_RELEASE=${pcre2_flags_RELEASE}"
"-DCMAKE_C_FLAGS_MINSIZEREL=${pcre2_flags_MINSIZEREL}" "-DCMAKE_C_FLAGS_MINSIZEREL=${pcre2_flags_MINSIZEREL}"
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
${CMAKE_MSVC_RUNTIME_LIBRARY_ARG}
${stdlibs} ${stdlibs}
${byproducts} ${byproducts}
) )

View File

@@ -457,6 +457,11 @@
/* This should mean case insensitive file system */ /* This should mean case insensitive file system */
#cmakedefine FN_NO_CASE_SENSE 1 #cmakedefine FN_NO_CASE_SENSE 1
/* Whether an anonymous private mapping is unaccessible after
madvise(MADV_DONTNEED) or madvise(MADV_FREE) or similar has been invoked;
this is the case with Microsoft Windows VirtualFree(MEM_DECOMMIT) */
#cmakedefine HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1
#cmakedefine HAVE_CHARSET_armscii8 1 #cmakedefine HAVE_CHARSET_armscii8 1
#cmakedefine HAVE_CHARSET_ascii 1 #cmakedefine HAVE_CHARSET_ascii 1
#cmakedefine HAVE_CHARSET_big5 1 #cmakedefine HAVE_CHARSET_big5 1

View File

@@ -1895,7 +1895,7 @@ bool write_backup_config_file(ds_ctxt *datasink)
srv_log_file_size, srv_log_file_size,
srv_page_size, srv_page_size,
srv_undo_dir, srv_undo_dir,
(uint) srv_undo_tablespaces, srv_undo_tablespaces,
page_zip_level, page_zip_level,
innobase_buffer_pool_filename ? innobase_buffer_pool_filename ?
"innodb_buffer_pool_filename=" : "", "innodb_buffer_pool_filename=" : "",

View File

@@ -64,8 +64,10 @@ Table::copy(ds_ctxt_t *ds, MYSQL *con, bool no_lock, bool, unsigned thread_num)
for (const auto &fname : m_fnames) { for (const auto &fname : m_fnames) {
File file = mysql_file_open(0, fname.c_str(),O_RDONLY | O_SHARE, MYF(0)); File file = mysql_file_open(0, fname.c_str(),O_RDONLY | O_SHARE, MYF(0));
if (file < 0) { if (file < 0) {
msg(thread_num, "Error on file %s open during %s table copy", char buf[MYSYS_STRERROR_SIZE];
fname.c_str(), full_tname.c_str()); msg(thread_num, "Error %i on file %s open during %s table copy: %s",
errno, fname.c_str(), full_tname.c_str(),
my_strerror(buf, sizeof(buf), errno));
goto exit; goto exit;
} }
files.push_back(file); files.push_back(file);

View File

@@ -44,8 +44,8 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
#include <string.h> #include <string.h>
#include <mysql.h> #include <mysql.h>
#include <my_dir.h> #include <my_dir.h>
#include <ut0mem.h>
#include <os0file.h> #include <os0file.h>
#include "buf0buf.h"
#include <srv0start.h> #include <srv0start.h>
#include <algorithm> #include <algorithm>
#include <mysqld.h> #include <mysqld.h>
@@ -594,8 +594,9 @@ static struct my_option ibx_long_options[] =
"--apply-log.", "--apply-log.",
(uchar*) &ibx_xtrabackup_use_memory, (uchar*) &ibx_xtrabackup_use_memory,
(uchar*) &ibx_xtrabackup_use_memory, (uchar*) &ibx_xtrabackup_use_memory,
0, GET_LL, REQUIRED_ARG, 100*1024*1024L, 1024*1024L, LONGLONG_MAX, 0, 0, GET_LL, REQUIRED_ARG, 96 << 20,
1024*1024L, 0}, innodb_buffer_pool_extent_size, SIZE_T_MAX, 0,
innodb_buffer_pool_extent_size, 0},
{"innodb-force-recovery", OPT_INNODB_FORCE_RECOVERY, {"innodb-force-recovery", OPT_INNODB_FORCE_RECOVERY,
"This option starts up the embedded InnoDB instance in crash " "This option starts up the embedded InnoDB instance in crash "

View File

@@ -144,18 +144,6 @@ wf_incremental_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile)
return false; return false;
} }
/* Check whether TRX_SYS page has been changed */
if (mach_read_from_4(page + FIL_PAGE_SPACE_ID)
== TRX_SYS_SPACE
&& mach_read_from_4(page + FIL_PAGE_OFFSET)
== TRX_SYS_PAGE_NO) {
msg(cursor->thread_n,
"--incremental backup is impossible if "
"the server had been restarted with "
"different innodb_undo_tablespaces.");
return false;
}
/* updated page */ /* updated page */
if (cp->npages == page_size / 4) { if (cp->npages == page_size / 4) {
/* flush buffer */ /* flush buffer */

View File

@@ -201,8 +201,6 @@ struct xb_filter_entry_t{
xb_filter_entry_t *name_hash; xb_filter_entry_t *name_hash;
}; };
lsn_t checkpoint_lsn_start;
lsn_t checkpoint_no_start;
/** whether log_copying_thread() is active; protected by recv_sys.mutex */ /** whether log_copying_thread() is active; protected by recv_sys.mutex */
static bool log_copying_running; static bool log_copying_running;
/** for --backup, target LSN to copy the log to; protected by recv_sys.mutex */ /** for --backup, target LSN to copy the log to; protected by recv_sys.mutex */
@@ -1386,6 +1384,7 @@ enum options_xtrabackup
OPT_XTRA_MYSQLD_ARGS, OPT_XTRA_MYSQLD_ARGS,
OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION, OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION,
OPT_INNODB_FORCE_RECOVERY, OPT_INNODB_FORCE_RECOVERY,
OPT_INNODB_CHECKPOINT,
OPT_ARIA_LOG_DIR_PATH OPT_ARIA_LOG_DIR_PATH
}; };
@@ -1417,8 +1416,9 @@ struct my_option xb_client_options[]= {
"The value is used in place of innodb_buffer_pool_size. " "The value is used in place of innodb_buffer_pool_size. "
"This option is only relevant when the --prepare option is specified.", "This option is only relevant when the --prepare option is specified.",
(G_PTR *) &xtrabackup_use_memory, (G_PTR *) &xtrabackup_use_memory, 0, (G_PTR *) &xtrabackup_use_memory, (G_PTR *) &xtrabackup_use_memory, 0,
GET_LL, REQUIRED_ARG, 100 * 1024 * 1024L, 1024 * 1024L, LONGLONG_MAX, 0, GET_ULL, REQUIRED_ARG, 96 << 20, innodb_buffer_pool_extent_size,
1024 * 1024L, 0}, size_t(-ssize_t(innodb_buffer_pool_extent_size)),
0, innodb_buffer_pool_extent_size, 0},
{"throttle", OPT_XTRA_THROTTLE, {"throttle", OPT_XTRA_THROTTLE,
"limit count of IO operations (pairs of read&write) per second to IOS " "limit count of IO operations (pairs of read&write) per second to IOS "
"values (for '--backup')", "values (for '--backup')",
@@ -1795,6 +1795,8 @@ extern const char *io_uring_may_be_unsafe;
bool innodb_use_native_aio_default(); bool innodb_use_native_aio_default();
#endif #endif
static my_bool innodb_log_checkpoint_now;
struct my_option xb_server_options[] = struct my_option xb_server_options[] =
{ {
{"datadir", 'h', "Path to the database root.", (G_PTR*) &mysql_data_home, {"datadir", 'h', "Path to the database root.", (G_PTR*) &mysql_data_home,
@@ -2032,6 +2034,12 @@ struct my_option xb_server_options[] =
(G_PTR*)&srv_force_recovery, (G_PTR*)&srv_force_recovery,
0, GET_ULONG, OPT_ARG, 0, 0, SRV_FORCE_IGNORE_CORRUPT, 0, 0, 0}, 0, GET_ULONG, OPT_ARG, 0, 0, SRV_FORCE_IGNORE_CORRUPT, 0, 0, 0},
{"innodb_log_checkpoint_now", OPT_INNODB_CHECKPOINT,
"(for --backup): Force an InnoDB checkpoint",
(G_PTR*)&innodb_log_checkpoint_now,
(G_PTR*)&innodb_log_checkpoint_now,
0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
{"mysqld-args", OPT_XTRA_MYSQLD_ARGS, {"mysqld-args", OPT_XTRA_MYSQLD_ARGS,
"All arguments that follow this argument are considered as server " "All arguments that follow this argument are considered as server "
"options, and if some of them are not supported by mariabackup, they " "options, and if some of them are not supported by mariabackup, they "
@@ -2118,7 +2126,7 @@ static int prepare_export()
if (strncmp(orig_argv1,"--defaults-file=", 16) == 0) if (strncmp(orig_argv1,"--defaults-file=", 16) == 0)
{ {
snprintf(cmdline, sizeof cmdline, snprintf(cmdline, sizeof cmdline,
IF_WIN("\"","") "\"%s\" --mysqld \"%s\"" IF_WIN("\"","") "\"%s\" --mariadbd \"%s\""
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb-buffer-pool-size=%llu" " --innodb-buffer-pool-size=%llu"
@@ -2132,7 +2140,7 @@ static int prepare_export()
else else
{ {
snprintf(cmdline, sizeof cmdline, snprintf(cmdline, sizeof cmdline,
IF_WIN("\"","") "\"%s\" --mysqld" IF_WIN("\"","") "\"%s\" --mariadbd"
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb-buffer-pool-size=%llu" " --innodb-buffer-pool-size=%llu"
@@ -2476,7 +2484,7 @@ static bool innodb_init_param()
} }
srv_sys_space.normalize_size(); srv_sys_space.normalize_size();
srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift); srv_lock_table_size = 5 * buf_pool.curr_size();
/* -------------- Log files ---------------------------*/ /* -------------- Log files ---------------------------*/
@@ -2498,11 +2506,8 @@ static bool innodb_init_param()
srv_adaptive_flushing = FALSE; srv_adaptive_flushing = FALSE;
/* We set srv_pool_size here in units of 1 kB. InnoDB internally buf_pool.size_in_bytes_max = size_t(xtrabackup_use_memory);
changes the value so that it becomes the number of database pages. */ buf_pool.size_in_bytes_requested = buf_pool.size_in_bytes_max;
srv_buf_pool_size = (ulint) xtrabackup_use_memory;
srv_buf_pool_chunk_unit = srv_buf_pool_size;
srv_n_read_io_threads = (uint) innobase_read_io_threads; srv_n_read_io_threads = (uint) innobase_read_io_threads;
srv_n_write_io_threads = (uint) innobase_write_io_threads; srv_n_write_io_threads = (uint) innobase_write_io_threads;
@@ -2968,6 +2973,15 @@ my_bool regex_list_check_match(
const regex_list_t& list, const regex_list_t& list,
const char* name) const char* name)
{ {
if (list.empty()) return (FALSE);
/*
regexec/pcre2_regexec is not threadsafe, also documented.
Serialize access from multiple threads to compiled regexes.
*/
static std::mutex regex_match_mutex;
std::lock_guard<std::mutex> lock(regex_match_mutex);
regmatch_t tables_regmatch[1]; regmatch_t tables_regmatch[1];
for (regex_list_t::const_iterator i = list.begin(), end = list.end(); for (regex_list_t::const_iterator i = list.begin(), end = list.end();
i != end; ++i) { i != end; ++i) {
@@ -5427,6 +5441,14 @@ static bool xtrabackup_backup_func()
} }
msg("cd to %s", mysql_real_data_home); msg("cd to %s", mysql_real_data_home);
encryption_plugin_backup_init(mysql_connection); encryption_plugin_backup_init(mysql_connection);
if (innodb_log_checkpoint_now != false && mysql_send_query(
mysql_connection,
C_STRING_WITH_LEN("SET GLOBAL "
"innodb_log_checkpoint_now=ON;"))) {
msg("initiating checkpoint failed");
return(false);
}
msg("open files limit requested %lu, set to %lu", msg("open files limit requested %lu, set to %lu",
xb_open_files_limit, xb_open_files_limit,
xb_set_max_open_files(xb_open_files_limit)); xb_set_max_open_files(xb_open_files_limit));
@@ -5539,6 +5561,11 @@ fail:
goto fail; goto fail;
} }
/* try to wait for a log checkpoint, but do not fail if the
server does not support this */
if (innodb_log_checkpoint_now != false) {
mysql_read_query_result(mysql_connection);
}
/* label it */ /* label it */
recv_sys.file_checkpoint = log_sys.next_checkpoint_lsn; recv_sys.file_checkpoint = log_sys.next_checkpoint_lsn;
log_hdr_init(); log_hdr_init();
@@ -6252,9 +6279,22 @@ xtrabackup_apply_delta(
buf + FSP_HEADER_OFFSET + FSP_SIZE); buf + FSP_HEADER_OFFSET + FSP_SIZE);
if (mach_read_from_4(buf if (mach_read_from_4(buf
+ FIL_PAGE_SPACE_ID)) { + FIL_PAGE_SPACE_ID)) {
#ifdef _WIN32
os_offset_t last_page =
os_file_get_size(dst_file) /
page_size;
/* os_file_set_size() would
shrink the size of the file */
if (last_page < n_pages &&
!os_file_set_size(
dst_path, dst_file,
n_pages * page_size))
#else
if (!os_file_set_size( if (!os_file_set_size(
dst_path, dst_file, dst_path, dst_file,
n_pages * page_size)) n_pages * page_size))
#endif /* _WIN32 */
goto error; goto error;
} else if (fil_space_t* space } else if (fil_space_t* space
= fil_system.sys_space) { = fil_system.sys_space) {
@@ -7530,9 +7570,9 @@ int main(int argc, char **argv)
{ {
/* In "prepare export", we need to start mysqld /* In "prepare export", we need to start mysqld
Since it is not always be installed on the machine, Since it is not always be installed on the machine,
we start "mariabackup --mysqld", which acts as mysqld we start "mariabackup --mariadbd", which acts as mysqld
*/ */
if (strcmp(argv[1], "--mysqld") == 0) if (strcmp(argv[1], "--mariadbd") == 0)
{ {
srv_operation= SRV_OPERATION_EXPORT_RESTORED; srv_operation= SRV_OPERATION_EXPORT_RESTORED;
extern int mysqld_main(int argc, char **argv); extern int mysqld_main(int argc, char **argv);

View File

@@ -82,3 +82,5 @@
{ "HA_ERR_PARTITION_LIST", HA_ERR_PARTITION_LIST, ""}, { "HA_ERR_PARTITION_LIST", HA_ERR_PARTITION_LIST, ""},
{ "HA_ERR_NO_ENCRYPTION", HA_ERR_NO_ENCRYPTION, ""}, { "HA_ERR_NO_ENCRYPTION", HA_ERR_NO_ENCRYPTION, ""},
{ "HA_ERR_ROLLBACK", HA_ERR_ROLLBACK, "" }, { "HA_ERR_ROLLBACK", HA_ERR_ROLLBACK, "" },
{ "HA_ERR_LOCAL_TMP_SPACE_FULL", HA_ERR_LOCAL_TMP_SPACE_FULL, ""},
{ "HA_ERR_GLOBAL_TMP_SPACE_FULL", HA_ERR_GLOBAL_TMP_SPACE_FULL, ""},

View File

@@ -97,7 +97,12 @@ static inline void MY_RELAX_CPU(void)
/* Changed from __ppc_get_timebase for musl and clang compatibility */ /* Changed from __ppc_get_timebase for musl and clang compatibility */
__builtin_ppc_get_timebase(); __builtin_ppc_get_timebase();
#elif defined __GNUC__ && defined __riscv #elif defined __GNUC__ && defined __riscv
__builtin_riscv_pause(); /* The GCC-only __builtin_riscv_pause() or the pause instruction is
encoded like a fence instruction with special parameters. On RISC-V
implementations that do not support arch=+zihintpause this
instruction could be interpreted as a more expensive memory fence;
it should not be an illegal instruction. */
__asm__ volatile(".long 0x0100000f" ::: "memory");
#elif defined __GNUC__ #elif defined __GNUC__
/* Mainly, prevent the compiler from optimizing away delay loops */ /* Mainly, prevent the compiler from optimizing away delay loops */
__asm__ __volatile__ ("":::"memory"); __asm__ __volatile__ ("":::"memory");

View File

@@ -175,9 +175,13 @@ extern void my_free(void *ptr);
extern void *my_memdup(PSI_memory_key key, const void *from,size_t length,myf MyFlags); extern void *my_memdup(PSI_memory_key key, const void *from,size_t length,myf MyFlags);
extern char *my_strdup(PSI_memory_key key, const char *from,myf MyFlags); extern char *my_strdup(PSI_memory_key key, const char *from,myf MyFlags);
extern char *my_strndup(PSI_memory_key key, const char *from, size_t length, myf MyFlags); extern char *my_strndup(PSI_memory_key key, const char *from, size_t length, myf MyFlags);
extern my_bool my_use_large_pages;
int my_init_large_pages(my_bool super_large_pages); int my_init_large_pages(void);
uchar *my_large_malloc(size_t *size, myf my_flags); uchar *my_large_malloc(size_t *size, myf my_flags);
#if defined _WIN32 || defined HAVE_MMAP
char *my_large_virtual_alloc(size_t *size);
#endif
void my_large_free(void *ptr, size_t size); void my_large_free(void *ptr, size_t size);
void my_large_page_truncate(size_t *size); void my_large_page_truncate(size_t *size);

35
include/my_virtual_mem.h Normal file
View File

@@ -0,0 +1,35 @@
/* Copyright (c) 2025, 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
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#pragma once
/*
Functionality for handling virtual memory
(reserve, commit, decommit, release)
*/
#include <stddef.h> /*size_t*/
#ifdef __cplusplus
extern "C" {
#endif
char *my_virtual_mem_reserve(size_t *size);
char *my_virtual_mem_commit(char *ptr, size_t size);
void my_virtual_mem_decommit(char *ptr, size_t size);
void my_virtual_mem_release(char *ptr, size_t size);
#ifdef __cplusplus
}
#endif

View File

@@ -14,7 +14,7 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
INSTALL_MYSQL_TEST("." ".") INSTALL_MYSQL_TEST("." "")
IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
# Enable running mtr from build directory # Enable running mtr from build directory

View File

@@ -1 +1 @@
--plugin-load=$HA_ROCKSDB_SO --plugin-load-add=$HA_ROCKSDB_SO

View File

@@ -1,6 +1,6 @@
# We use this --source include to mark a test as taking long to run. # We use this --source include to mark a test as taking long to run.
# We can use this to schedule such test early (to not be left with # We can use this to schedule such test early (to not be left with
# only one or two long tests running, and rests of works idle), or to # only one or two long tests running, and rests of workers idle), or to
# run a quick test skipping long-running test cases. # run a quick test skipping long-running test cases.
--source include/no_valgrind_without_big.inc --source include/no_valgrind_without_big.inc

View File

@@ -2,6 +2,7 @@
# Tests BACKUP STAGE locking # Tests BACKUP STAGE locking
######################################################################## ########################################################################
--source include/long_test.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_metadata_lock_info.inc --source include/have_metadata_lock_info.inc
--source include/not_embedded.inc --source include/not_embedded.inc

View File

@@ -2129,3 +2129,32 @@ EXECUTE stmt USING 4;
ERROR 22007: Truncated incorrect DECIMAL value: '' ERROR 22007: Truncated incorrect DECIMAL value: ''
DROP TABLE t; DROP TABLE t;
# End of 11.7 Test # End of 11.7 Test
#
# MDEV-36104 Server crashes when reading information_schema.COLUMNS after creating a table with virtual columns using the GIS data type
#
create table t (a point generated always as (1) stored,b int generated always as (1) virtual);
ERROR HY000: Cannot cast 'int' as 'point' in assignment of `test`.`t`.`a`
set sql_mode='';
create table t (a point generated always as (1) stored,b int generated always as (1) virtual);
Warnings:
Warning 4078 Cannot cast 'int' as 'point' in assignment of `test`.`t`.`a`
set sql_mode=default;
select column_name,column_type from information_schema.columns where table_name='t';
column_name column_type
a point
b int(11)
Warnings:
Warning 4078 Cannot cast 'int' as 'point' in assignment of `test`.`t`.`a`
show create table t;
Table Create Table
t CREATE TABLE `t` (
`a` point GENERATED ALWAYS AS (1) STORED,
`b` int(11) GENERATED ALWAYS AS (1) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
Warnings:
Warning 4078 Cannot cast 'int' as 'point' in assignment of `test`.`t`.`a`
insert t () values ();
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
alter table t add column c int, drop column a, drop column b;
drop table t;
# End of 11.8 Test

View File

@@ -2002,3 +2002,22 @@ EXECUTE stmt USING 4;
DROP TABLE t; DROP TABLE t;
--echo # End of 11.7 Test --echo # End of 11.7 Test
--echo #
--echo # MDEV-36104 Server crashes when reading information_schema.COLUMNS after creating a table with virtual columns using the GIS data type
--echo #
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
create table t (a point generated always as (1) stored,b int generated always as (1) virtual);
set sql_mode='';
create table t (a point generated always as (1) stored,b int generated always as (1) virtual);
set sql_mode=default;
select column_name,column_type from information_schema.columns where table_name='t';
--enable_prepare_warnings
show create table t;
--disable_prepare_warnings
--error ER_CANT_CREATE_GEOMETRY_OBJECT
insert t () values ();
alter table t add column c int, drop column a, drop column b;
drop table t;
--echo # End of 11.8 Test

View File

@@ -681,10 +681,10 @@ INSERT INTO t1 VALUES
(REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', ''); (REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', '');
SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
Warnings: Warnings:
Warning 4203 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes
SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll;
Warnings: Warnings:
Warning 4203 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes
DROP TABLES t1; DROP TABLES t1;
End of 5.0 tests End of 5.0 tests
# #

View File

@@ -91,7 +91,7 @@ utf8mb4_hu_0900_as_cs utf8mb4 297 Yes 8 Alias for utf8mb4_uca1400_hungarian_nop
utf8mb4_hr_0900_as_cs utf8mb4 298 Yes 8 Alias for utf8mb4_uca1400_croatian_nopad_as_cs utf8mb4_hr_0900_as_cs utf8mb4 298 Yes 8 Alias for utf8mb4_uca1400_croatian_nopad_as_cs
utf8mb4_vi_0900_as_cs utf8mb4 300 Yes 8 Alias for utf8mb4_uca1400_vietnamese_nopad_as_cs utf8mb4_vi_0900_as_cs utf8mb4 300 Yes 8 Alias for utf8mb4_uca1400_vietnamese_nopad_as_cs
utf8mb4_0900_as_ci utf8mb4 305 Yes 8 Alias for utf8mb4_uca1400_nopad_as_ci utf8mb4_0900_as_ci utf8mb4 305 Yes 8 Alias for utf8mb4_uca1400_nopad_as_ci
utf8mb4_0900_bin utf8mb4 309 Yes 1 Alias for utf8mb4_bin utf8mb4_0900_bin utf8mb4 309 Yes 1 Alias for utf8mb4_nopad_bin
# #
# MDEV-20912 Add support for utf8mb4_0900_* collations in MariaDB Server # MDEV-20912 Add support for utf8mb4_0900_* collations in MariaDB Server
# #
@@ -198,3 +198,21 @@ drop table t1,t2;
CREATE OR REPLACE TABLE t1 (p int primary key auto_increment, a VARCHAR(10), key (a)) engine=aria, COLLATE utf8mb4_sv_0900_ai_ci; CREATE OR REPLACE TABLE t1 (p int primary key auto_increment, a VARCHAR(10), key (a)) engine=aria, COLLATE utf8mb4_sv_0900_ai_ci;
alter table t1 modify a varchar(10) collate utf8mb4_uca1400_swedish_nopad_ai_ci, algorithm=nocopy; alter table t1 modify a varchar(10) collate utf8mb4_uca1400_swedish_nopad_ai_ci, algorithm=nocopy;
drop table t1; drop table t1;
#
# MDEV-36361 Wrong utf8mb4_0900_bin alias for utf8mb4_bin (should be utf8mb4_nopad_bin)
#
SELECT collation_name, id, comment
FROM information_schema.collations
WHERE collation_name='utf8mb4_0900_bin';
collation_name id comment
utf8mb4_0900_bin 309 Alias for utf8mb4_nopad_bin
CREATE TABLE t1 (
a VARCHAR(32),
b VARCHAR(32)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin;
INSERT INTO t1 VALUES ('a\t', 'a');
SELECT a<b FROM t1;
a<b
0
DROP TABLE t1;
# End of 11.4 tests

View File

@@ -83,3 +83,21 @@ drop table t1,t2;
CREATE OR REPLACE TABLE t1 (p int primary key auto_increment, a VARCHAR(10), key (a)) engine=aria, COLLATE utf8mb4_sv_0900_ai_ci; CREATE OR REPLACE TABLE t1 (p int primary key auto_increment, a VARCHAR(10), key (a)) engine=aria, COLLATE utf8mb4_sv_0900_ai_ci;
alter table t1 modify a varchar(10) collate utf8mb4_uca1400_swedish_nopad_ai_ci, algorithm=nocopy; alter table t1 modify a varchar(10) collate utf8mb4_uca1400_swedish_nopad_ai_ci, algorithm=nocopy;
drop table t1; drop table t1;
--echo #
--echo # MDEV-36361 Wrong utf8mb4_0900_bin alias for utf8mb4_bin (should be utf8mb4_nopad_bin)
--echo #
SELECT collation_name, id, comment
FROM information_schema.collations
WHERE collation_name='utf8mb4_0900_bin';
CREATE TABLE t1 (
a VARCHAR(32),
b VARCHAR(32)
) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin;
INSERT INTO t1 VALUES ('a\t', 'a');
SELECT a<b FROM t1;
DROP TABLE t1;
--echo # End of 11.4 tests

View File

@@ -248,7 +248,7 @@ format_bytes(1024 * 1024 - 200)
SELECT format_bytes(1024 * 1024 - 1); SELECT format_bytes(1024 * 1024 - 1);
format_bytes(1024 * 1024 - 1) format_bytes(1024 * 1024 - 1)
1024.00 KiB 1.00 MiB
SELECT format_bytes(1024 * 1024); SELECT format_bytes(1024 * 1024);
format_bytes(1024 * 1024) format_bytes(1024 * 1024)
@@ -264,7 +264,7 @@ format_bytes(1024 * 1024 + 200)
SELECT format_bytes(1024 * 1024 * 1024 - 1); SELECT format_bytes(1024 * 1024 * 1024 - 1);
format_bytes(1024 * 1024 * 1024 - 1) format_bytes(1024 * 1024 * 1024 - 1)
1024.00 MiB 1.00 GiB
SELECT format_bytes(1024 * 1024 * 1024); SELECT format_bytes(1024 * 1024 * 1024);
format_bytes(1024 * 1024 * 1024) format_bytes(1024 * 1024 * 1024)
@@ -276,7 +276,7 @@ format_bytes(1024 * 1024 * 1024 + 1)
SELECT format_bytes(1024 * 1024 * 1024 * 1024 - 1); SELECT format_bytes(1024 * 1024 * 1024 * 1024 - 1);
format_bytes(1024 * 1024 * 1024 * 1024 - 1) format_bytes(1024 * 1024 * 1024 * 1024 - 1)
1024.00 GiB 1.00 TiB
SELECT format_bytes(1024 * 1024 * 1024 * 1024); SELECT format_bytes(1024 * 1024 * 1024 * 1024);
format_bytes(1024 * 1024 * 1024 * 1024) format_bytes(1024 * 1024 * 1024 * 1024)
@@ -288,7 +288,7 @@ format_bytes(1024 * 1024 * 1024 * 1024 + 1)
SELECT format_bytes(1024 * 1024 * 1024 * 1024 * 1024 - 1); SELECT format_bytes(1024 * 1024 * 1024 * 1024 * 1024 - 1);
format_bytes(1024 * 1024 * 1024 * 1024 * 1024 - 1) format_bytes(1024 * 1024 * 1024 * 1024 * 1024 - 1)
1024.00 TiB 1.00 PiB
SELECT format_bytes(1024 * 1024 * 1024 * 1024 * 1024); SELECT format_bytes(1024 * 1024 * 1024 * 1024 * 1024);
format_bytes(1024 * 1024 * 1024 * 1024 * 1024) format_bytes(1024 * 1024 * 1024 * 1024 * 1024)

View File

@@ -60,7 +60,7 @@ INSERT INTO t1 VALUES ('1'),('௨');
INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}'); INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}');
INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}'); INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}');
INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}'); INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}');
INSERT INTO t2 VALUES ('\\p{L}'),('\\p{Ll}'),('\\p{Lu}'),('\\p{L&}'); INSERT INTO t2 VALUES ('\\p{L}'), /* buggy before v10.45 ('\\p{Ll}'),('\\p{Lu}'),*/ ('\\p{L&}');
INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]'); INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]');
SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY BINARY class, BINARY ch; SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY BINARY class, BINARY ch;
class ch ch RLIKE class class ch ch RLIKE class
@@ -168,32 +168,6 @@ class ch ch RLIKE class
\p{Latin} ප 0 \p{Latin} ප 0
\p{Latin} 㐗 0 \p{Latin} 㐗 0
\p{Latin} 갷 0 \p{Latin} 갷 0
\p{Ll} 1 0
\p{Ll} A 0
\p{Ll} a 1
\p{Ll} À 0
\p{Ll} à 1
\p{Ll} Σ 0
\p{Ll} σ 1
\p{Ll} Я 0
\p{Ll} я 1
\p{Ll} ௨ 0
\p{Ll} ප 0
\p{Ll} 㐗 0
\p{Ll} 갷 0
\p{Lu} 1 0
\p{Lu} A 1
\p{Lu} a 0
\p{Lu} À 1
\p{Lu} à 0
\p{Lu} Σ 1
\p{Lu} σ 0
\p{Lu} Я 1
\p{Lu} я 0
\p{Lu} ௨ 0
\p{Lu} ප 0
\p{Lu} 㐗 0
\p{Lu} 갷 0
\p{L} 1 0 \p{L} 1 0
\p{L} A 1 \p{L} A 1
\p{L} a 1 \p{L} a 1

View File

@@ -41,7 +41,7 @@ INSERT INTO t1 VALUES ('1'),('௨');
INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}'); INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}');
INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}'); INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}');
INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}'); INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}');
INSERT INTO t2 VALUES ('\\p{L}'),('\\p{Ll}'),('\\p{Lu}'),('\\p{L&}'); INSERT INTO t2 VALUES ('\\p{L}'), /* buggy before v10.45 ('\\p{Ll}'),('\\p{Lu}'),*/ ('\\p{L&}');
INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]'); INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]');
# Use "ORDER BY BINARY" to avoid dependency on the default utf8 collation # Use "ORDER BY BINARY" to avoid dependency on the default utf8 collation
SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY BINARY class, BINARY ch; SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY BINARY class, BINARY ch;

View File

@@ -776,7 +776,7 @@ SELECT ST_DISTANCE_SPHERE(1, 1, NULL);
ST_DISTANCE_SPHERE(1, 1, NULL) ST_DISTANCE_SPHERE(1, 1, NULL)
NULL NULL
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result;
ERROR HY000: Internal error: st_distance_sphere ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments.
# Test Points and radius # Test Points and radius
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')) as result;
result result
@@ -788,9 +788,9 @@ SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(
result result
0.024682056391766436 0.024682056391766436
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result;
ERROR HY000: Internal error: Radius must be greater than zero. ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments.
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result;
ERROR HY000: Internal error: Radius must be greater than zero. ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments.
# Test longitude/lattitude # Test longitude/lattitude
SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) as result; SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) as result;
result result
@@ -843,7 +843,7 @@ SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_G
result result
0.04933028646581131 0.04933028646581131
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result;
ERROR HY000: Internal error: Radius must be greater than zero. ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments.
set @pt1 = ST_GeomFromText('POINT(190 -30)'); set @pt1 = ST_GeomFromText('POINT(190 -30)');
set @pt2 = ST_GeomFromText('POINT(-30 50)'); set @pt2 = ST_GeomFromText('POINT(-30 50)');
SELECT ST_Distance_Sphere(@pt1, @pt2); SELECT ST_Distance_Sphere(@pt1, @pt2);

View File

@@ -422,7 +422,7 @@ SELECT ST_DISTANCE_SPHERE(1, 1, 3);
# Return NULL if radius is NULL # Return NULL if radius is NULL
SELECT ST_DISTANCE_SPHERE(1, 1, NULL); SELECT ST_DISTANCE_SPHERE(1, 1, NULL);
# Wrong geometry # Wrong geometry
--error ER_INTERNAL_ERROR --error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result;
--echo # Test Points and radius --echo # Test Points and radius
@@ -430,9 +430,9 @@ SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(
# make bb x86 happy # make bb x86 happy
SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) as result; SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) as result;
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) as result;
--error ER_INTERNAL_ERROR --error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result;
--error ER_INTERNAL_ERROR --error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result;
--echo # Test longitude/lattitude --echo # Test longitude/lattitude
# make bb x86 happy # make bb x86 happy
@@ -456,7 +456,7 @@ SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_G
SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) as result; SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) as result;
# make bb x86 happy # make bb x86 happy
SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) as result; SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) as result;
--error ER_INTERNAL_ERROR --error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result;
# Longitude out of range [-180,180] # Longitude out of range [-180,180]

View File

@@ -5492,6 +5492,11 @@ MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4,
) AS t; ) AS t;
ST_SRID(g1) ST_SRID(ST_GeomFromWKB(g1, 4326)) ST_SRID(ST_GeomFromWKB(g1)) ST_AsText(g1) ST_SRID(ST_PointFromWKB(g2, 4326)) ST_SRID(g2) ST_SRID(ST_LineStringFromWKB(g3, 3)) ST_SRID(ST_PolygonFromWKB(g4, 4)) ST_SRID(ST_MultiPointFromWKB(g5, 5)) ST_SRID(ST_MultiLineStringFromWKB(g6, 6)) ST_SRID(ST_MultiPolygonFromWKB(g7, 7)) ST_SRID(g1) ST_SRID(ST_GeomFromWKB(g1, 4326)) ST_SRID(ST_GeomFromWKB(g1)) ST_AsText(g1) ST_SRID(ST_PointFromWKB(g2, 4326)) ST_SRID(g2) ST_SRID(ST_LineStringFromWKB(g3, 3)) ST_SRID(ST_PolygonFromWKB(g4, 4)) ST_SRID(ST_MultiPointFromWKB(g5, 5)) ST_SRID(ST_MultiLineStringFromWKB(g6, 6)) ST_SRID(ST_MultiPolygonFromWKB(g7, 7))
0 4326 0 POINT(1 2) 4326 0 3 4 5 6 7 0 4326 0 POINT(1 2) 4326 0 3 4 5 6 7
#
# MDEV-35117 Error message "ERROR 1815 (HY000): Internal error: st_distance_sphere' could be improved
#
SELECT ST_DISTANCE_SPHERE(st_geomfromtext('linestring( 2 2, 2 8) '), ST_GeomFromText('POINT(18.413076 43.856258)')) ;
ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments.
# End of 10.5 tests # End of 10.5 tests
# #
# Start of 11.5 tests # Start of 11.5 tests

View File

@@ -3497,6 +3497,12 @@ FROM (
MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7 MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7
) AS t; ) AS t;
--echo #
--echo # MDEV-35117 Error message "ERROR 1815 (HY000): Internal error: st_distance_sphere' could be improved
--echo #
--error ER_GIS_UNSUPPORTED_ARGUMENT
SELECT ST_DISTANCE_SPHERE(st_geomfromtext('linestring( 2 2, 2 8) '), ST_GeomFromText('POINT(18.413076 43.856258)')) ;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -1919,7 +1919,7 @@ SELECT SUBSTRING(a,1,10), LENGTH(a), GROUP_CONCAT(b) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b) SUBSTRING(a,1,10) LENGTH(a) GROUP_CONCAT(b)
1111111111 1300 one,two 1111111111 1300 one,two
Warnings: Warnings:
Warning 4203 2 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 2 values were longer than max_sort_length. Sorting used only the first 1024 bytes
EXPLAIN EXPLAIN
SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a; SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
id 1 id 1
@@ -1936,7 +1936,7 @@ SELECT SUBSTRING(a,1,10), LENGTH(a) FROM t1 GROUP BY a;
SUBSTRING(a,1,10) LENGTH(a) SUBSTRING(a,1,10) LENGTH(a)
1111111111 1300 1111111111 1300
Warnings: Warnings:
Warning 4203 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 1 values were longer than max_sort_length. Sorting used only the first 1024 bytes
DROP TABLE t1; DROP TABLE t1;
# #
# Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field # Bug#57688 Assertion `!table || (!table->write_set || bitmap_is_set(table->write_set, field
@@ -2733,7 +2733,7 @@ f1 f2
NULL NULL
NULL NULL NULL NULL
Warnings: Warnings:
Warning 4203 116 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 116 values were longer than max_sort_length. Sorting used only the first 1024 bytes
SET @@sort_buffer_size = @old_sort_buff_size; SET @@sort_buffer_size = @old_sort_buff_size;
DROP TABLE t1; DROP TABLE t1;
# #

View File

@@ -4383,3 +4383,27 @@ drop table t1;
# #
# End of 10.6 tests # End of 10.6 tests
# #
#
# MDEV-36118 Wrong result in loose index scan
#
CREATE TABLE t1 (a int, b int, KEY (a, b));
insert into t1 values (1, 3), (1, 1);
SELECT MAX(b) FROM t1 WHERE (b > 2 AND b < 4) OR (b = 5) GROUP BY a;
MAX(b)
3
drop table t1;
#
# MDEV-36220 ASAN unknown-crash in loose index scan of MIN with IS NULL
#
CREATE TABLE t1 (a int, b int, KEY (a, b));
insert into t1 values (4, NULL), (1, 14), (4, 3);
SELECT MIN(b) FROM t1 WHERE b = 3 OR b IS NULL GROUP BY a;
MIN(b)
3
SELECT MIN(b) FROM t1 WHERE b IS NULL GROUP BY a;
MIN(b)
NULL
drop table t1;
#
# End of 10.11 tests
#

View File

@@ -2014,3 +2014,39 @@ drop table t1;
--echo # --echo #
--echo # End of 10.6 tests --echo # End of 10.6 tests
--echo # --echo #
--echo #
--echo # MDEV-36118 Wrong result in loose index scan
--echo #
CREATE TABLE t1 (a int, b int, KEY (a, b));
insert into t1 values (1, 3), (1, 1);
--source include/maybe_debug.inc
if ($have_debug) {
--disable_query_log
set @old_debug=@@debug;
set debug="+d,force_group_by";
--enable_query_log
}
SELECT MAX(b) FROM t1 WHERE (b > 2 AND b < 4) OR (b = 5) GROUP BY a;
if ($have_debug) {
--disable_query_log
set debug=@old_debug;
--enable_query_log
}
drop table t1;
--echo #
--echo # MDEV-36220 ASAN unknown-crash in loose index scan of MIN with IS NULL
--echo #
CREATE TABLE t1 (a int, b int, KEY (a, b));
insert into t1 values (4, NULL), (1, 14), (4, 3);
SELECT MIN(b) FROM t1 WHERE b = 3 OR b IS NULL GROUP BY a;
SELECT MIN(b) FROM t1 WHERE b IS NULL GROUP BY a;
drop table t1;
--echo #
--echo # End of 10.11 tests
--echo #

View File

@@ -36,3 +36,11 @@ index_name comment
a disabled a disabled
drop table t1; drop table t1;
# End of 10.5 tests # End of 10.5 tests
#
# MDEV-36596 Assertion failure in TABLE_SHARE::init_from_sql_statement_string upon returning wrong type from function
#
create function f() returns int return (1>2,1,2);
select * from information_schema.columns where f() is null;
ERROR HY000: Cannot cast 'row' as 'int' in assignment of `f`
drop function f;
# End of 11.8 tests

View File

@@ -28,3 +28,13 @@ select index_name, comment from information_schema.statistics where table_schema
drop table t1; drop table t1;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo #
--echo # MDEV-36596 Assertion failure in TABLE_SHARE::init_from_sql_statement_string upon returning wrong type from function
--echo #
create function f() returns int return (1>2,1,2);
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
select * from information_schema.columns where f() is null;
drop function f;
--echo # End of 11.8 tests

View File

@@ -2051,3 +2051,15 @@ a b c a a b
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
set join_cache_level= @save_join_cache_level; set join_cache_level= @save_join_cache_level;
# end of 10.3 tests # end of 10.3 tests
#
# MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release
#
CREATE TABLE t1 (i int);
INSERT INTO t1 values (1),(2);
SELECT 1 FROM t1 WHERE i IN
(SELECT 1 FROM t1 c
LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i);
1
1
DROP TABLE t1;
# end of 10.11 tests

View File

@@ -1459,3 +1459,16 @@ DROP TABLE t1, t2, t3;
set join_cache_level= @save_join_cache_level; set join_cache_level= @save_join_cache_level;
--echo # end of 10.3 tests --echo # end of 10.3 tests
--echo #
--echo # MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release
--echo #
CREATE TABLE t1 (i int);
INSERT INTO t1 values (1),(2);
SELECT 1 FROM t1 WHERE i IN
(SELECT 1 FROM t1 c
LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i);
DROP TABLE t1;
--echo # end of 10.11 tests

View File

@@ -2060,6 +2060,18 @@ a b c a a b
DROP TABLE t1, t2, t3; DROP TABLE t1, t2, t3;
set join_cache_level= @save_join_cache_level; set join_cache_level= @save_join_cache_level;
# end of 10.3 tests # end of 10.3 tests
#
# MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release
#
CREATE TABLE t1 (i int);
INSERT INTO t1 values (1),(2);
SELECT 1 FROM t1 WHERE i IN
(SELECT 1 FROM t1 c
LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i);
1
1
DROP TABLE t1;
# end of 10.11 tests
CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));
CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b));

View File

@@ -1 +1 @@
--large-pages --large-pages --loose-innodb-buffer-pool-size-max=16m

View File

@@ -1,4 +1,5 @@
call mtr.add_suppression("\\[Warning\\] (mysqld|mariadbd): Couldn't allocate [0-9]+ bytes \\((Large/HugeTLB memory|MEMLOCK) page size [0-9]+\\).*"); call mtr.add_suppression("\\[Warning\\] (mysqld|mariadbd): Couldn't allocate [0-9]+ bytes \\((Large/HugeTLB memory|MEMLOCK) page size [0-9]+\\).*");
call mtr.add_suppression("\\[ERROR\\]*Lock Pages in memory access rights required.*");
create table t1 ( create table t1 (
a int not null auto_increment, a int not null auto_increment,
b char(16) not null, b char(16) not null,

View File

@@ -1,11 +1,9 @@
# Test of large pages (or at least the fallback to conventional allocation) # Test of large pages (or at least the fallback to conventional allocation)
# Windows needs SeLockMemoryPrivilege
--source include/not_windows.inc
--source include/have_innodb.inc --source include/have_innodb.inc
call mtr.add_suppression("\\[Warning\\] (mysqld|mariadbd): Couldn't allocate [0-9]+ bytes \\((Large/HugeTLB memory|MEMLOCK) page size [0-9]+\\).*"); call mtr.add_suppression("\\[Warning\\] (mysqld|mariadbd): Couldn't allocate [0-9]+ bytes \\((Large/HugeTLB memory|MEMLOCK) page size [0-9]+\\).*");
call mtr.add_suppression("\\[ERROR\\]*Lock Pages in memory access rights required.*");
create table t1 ( create table t1 (
a int not null auto_increment, a int not null auto_increment,
b char(16) not null, b char(16) not null,

View File

@@ -1452,4 +1452,26 @@ DROP TABLE t1, t2;
# #
CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam; CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam;
ERROR HY000: AUTO_INCREMENT column `b` cannot be used in the UNIQUE index `a` ERROR HY000: AUTO_INCREMENT column `b` cannot be used in the UNIQUE index `a`
#
# MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin
#
# Disable result log. The exact result is not important.
# We just need to make sure UBSAN nullptr-with-offset is not reported.
SELECT DISTINCT user,authentication_string FROM mysql.user;
SELECT DISTINCT USER,PASSWORD FROM mysql.user;
SELECT DISTINCT USER,plugin FROM mysql.user;
# Enabling result log again.
create or replace table t1 (t text) engine=aria;
insert into t1 values ('');
insert into t1 values (NULL);
select distinct t from t1;
t
NULL
alter table t1 ENGINE=MyISAM;
select distinct t from t1;
t
NULL
DROP TABLE t1;
# End of 10.5 tests # End of 10.5 tests

View File

@@ -552,4 +552,26 @@ DROP TABLE t1, t2;
--error ER_NO_AUTOINCREMENT_WITH_UNIQUE --error ER_NO_AUTOINCREMENT_WITH_UNIQUE
CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam; CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam;
--echo #
--echo # MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin
--echo #
--echo # Disable result log. The exact result is not important.
--echo # We just need to make sure UBSAN nullptr-with-offset is not reported.
--disable_result_log
SELECT DISTINCT user,authentication_string FROM mysql.user;
SELECT DISTINCT USER,PASSWORD FROM mysql.user;
SELECT DISTINCT USER,plugin FROM mysql.user;
--enable_result_log
--echo # Enabling result log again.
create or replace table t1 (t text) engine=aria;
insert into t1 values ('');
insert into t1 values (NULL);
select distinct t from t1;
alter table t1 ENGINE=MyISAM;
select distinct t from t1;
DROP TABLE t1;
--echo # End of 10.5 tests --echo # End of 10.5 tests

View File

@@ -0,0 +1,35 @@
use mysql;
# run mysql_install_db with --service parameter
# Start service
# -- Upgrade service (online) --
Phase 1/10: Stopping service
Phase 2/10: Start and stop server in the old version, to avoid crash recovery (skipped)
Phase 3/10: Fixing server config file
Phase 4/10: Starting mysqld for upgrade
Phase 5/10: Waiting for startup to complete
Phase 6/10: Running mysql_upgrade
Phase 7/10: Changing service configuration
Phase 8/10: Initiating server shutdown
Phase 9/10: Waiting for shutdown to complete
Phase 10/10: Starting service
Service 'SERVICE_NAME' successfully upgraded.
Log file is written to UPGRADE_LOG
# upgrade_success(online)=1
# Service stopped
# -- Upgrade service (offline) --
Phase 1/10: Stopping service
Phase 2/10: Start and stop server in the old version, to avoid crash recovery ,this can take some time
Phase 3/10: Fixing server config file
Phase 4/10: Starting mysqld for upgrade
Phase 5/10: Waiting for startup to complete
Phase 6/10: Running mysql_upgrade
Phase 7/10: Changing service configuration
Phase 8/10: Initiating server shutdown
Phase 9/10: Waiting for shutdown to complete
Phase 10/10: Starting service (skipped)
Service 'SERVICE_NAME' successfully upgraded.
Log file is written to UPGRADE_LOG
# upgrade_success(offline)=1
# Delete service
connection default;
# restart

View File

@@ -0,0 +1,113 @@
source include/windows.inc;
let $datadir_name=data;
let $service_name_prefix=mariadb;
let $password=password;
source include/check_windows_admin.inc;
# The test uses return code from sc.exe utility, which are as follows
let $ERROR_SERVICE_DOES_NOT_EXIST= 1060;
let $ERROR_SERVICE_CANNOT_ACCEPT_CTRL=1061;# intermediate, during start or stop
let $ERROR_SERVICE_NOT_ACTIVE=1062;# service stopped
let $ERROR_INVALID_SERVICE_CONTROL=1052; # The requested control is not valid for this service
let $sc_exe= C:\Windows\System32\sc.exe;
let $ddir= $MYSQLTEST_VARDIR/tmp/$datadir_name;
let $service_name=$service_name_prefix$MASTER_MYPORT;
let TMP= $MYSQLTEST_VARDIR/tmp;
let $upgrade_log=$TMP/mysql_upgrade_service.$service_name.log;
use mysql;
error 0,1;
rmdir $ddir;
--disable_result_log
error 0,$ERROR_SERVICE_DOES_NOT_EXIST;
exec $sc_exe delete $service_name;
--enable_result_log
source include/shutdown_mysqld.inc;
echo # run mysql_install_db with --service parameter;
--disable_result_log
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --port=$MASTER_MYPORT --password=$password --service=$service_name --verbose-bootstrap -R;
--enable_result_log
echo # Start service;
--disable_result_log
exec $sc_exe start $service_name;
--enable_result_log
enable_reconnect;
source include/wait_until_connected_again.inc;
disable_reconnect;
echo # -- Upgrade service (online) --;
--replace_result $upgrade_log UPGRADE_LOG $service_name SERVICE_NAME
let $sys_errno=0;
let $upgrade_success = 1;
error 0,1;
exec $MARIADB_UPGRADE_SERVICE_EXE --service=$service_name;
if($sys_errno != 0)
{
let $upgrade_success = 0;
}
echo # upgrade_success(online)=$upgrade_success;
file_exists $upgrade_log;
if ($upgrade_success == 0)
{
echo --detailed error(online upgrade)--;
cat_file $upgrade_log;
}
# stop service
--disable_result_log
# Wait until stopped
let $sys_errno=0;
while($sys_errno != $ERROR_SERVICE_NOT_ACTIVE)
{
--error 0,$ERROR_SERVICE_CANNOT_ACCEPT_CTRL,$ERROR_SERVICE_NOT_ACTIVE, $ERROR_INVALID_SERVICE_CONTROL
exec $sc_exe stop $service_name;
if($sys_errno != $ERROR_SERVICE_NOT_ACTIVE)
{
--real_sleep 0.1
}
}
--enable_result_log
echo # Service stopped;
echo # -- Upgrade service (offline) --;
--replace_result $upgrade_log UPGRADE_LOG $service_name SERVICE_NAME
let $sys_errno=0;
let $upgrade_success = 1;
error 0,1;
exec $MARIADB_UPGRADE_SERVICE_EXE --service=$service_name;
if($sys_errno != 0)
{
let $upgrade_success = 0;
}
echo # upgrade_success(offline)=$upgrade_success;
file_exists $upgrade_log;
if ($upgrade_success == 0)
{
echo --detailed error(online upgrade)--;
cat_file $upgrade_log;
}
echo # Delete service;
let $sys_errno=0;
--disable_result_log
exec $sc_exe delete $service_name;
--enable_result_log
# Cleanup
source include/wait_until_disconnected.inc;
rmdir $ddir;
remove_file $upgrade_log;
let TEMP=$old_temp;
#restart original server
connection default;
source include/start_mysqld.inc;

View File

@@ -0,0 +1 @@
--slOw_QuEry_loG=OFF

View File

@@ -0,0 +1,8 @@
#
# MDEV-27126: my_getopt compares option names case sensitively
#
# Check if the variable is set correctly from options
SELECT @@GLOBAL.slow_query_log;
@@GLOBAL.slow_query_log
0
# End of test.

View File

@@ -0,0 +1,8 @@
--echo #
--echo # MDEV-27126: my_getopt compares option names case sensitively
--echo #
--echo # Check if the variable is set correctly from options
SELECT @@GLOBAL.slow_query_log;
--echo # End of test.

View File

@@ -1,4 +1,7 @@
drop table if exists t1,t2; drop table if exists t1,t2;
call mtr.add_suppression("Index.*try to repair it");
call mtr.add_suppression("Disk got full");
call mtr.add_suppression("Got an error from thread_id");
create table t1 (id int, sometext varchar(100)) engine=myisam; create table t1 (id int, sometext varchar(100)) engine=myisam;
insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4"); insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4");
create table t2 like t1; create table t2 like t1;
@@ -43,4 +46,9 @@ connection default;
connection con2; connection con2;
disconnect con2; disconnect con2;
connection default; connection default;
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,simulate_file_pwrite_error';
insert into t1 select * from t2;
ERROR HY000: Disk got full writing 'test.t1' (Errcode: 28 "No space left on device")
SET debug_dbug= @saved_dbug;
drop table t1,t2; drop table t1,t2;

View File

@@ -1,12 +1,17 @@
# #
# Test bugs in the MyISAM code that require more space/time # Test bugs in the MyISAM code that require more space/time
--source include/big_test.inc --source include/big_test.inc
--source include/have_debug.inc
# Initialise # Initialise
--disable_warnings --disable_warnings
drop table if exists t1,t2; drop table if exists t1,t2;
--enable_warnings --enable_warnings
call mtr.add_suppression("Index.*try to repair it");
call mtr.add_suppression("Disk got full");
call mtr.add_suppression("Got an error from thread_id");
# #
# BUG#925377: # BUG#925377:
# Querying myisam table metadata while 'alter table..enable keys' is # Querying myisam table metadata while 'alter table..enable keys' is
@@ -61,4 +66,12 @@ connection con2;
reap; reap;
disconnect con2; disconnect con2;
connection default; connection default;
#
# Test error message from disk full
SET @saved_dbug = @@SESSION.debug_dbug;
SET debug_dbug='+d,simulate_file_pwrite_error';
--error ER_DISK_FULL
insert into t1 select * from t2;
SET debug_dbug= @saved_dbug;
drop table t1,t2; drop table t1,t2;

View File

@@ -4,6 +4,7 @@
delimiter $ delimiter $
select 1; select 1;
$ $
exit
Welcome to the MariaDB monitor. Commands end with ; or \g. Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is X Your MariaDB connection id is X
Server version: Y Server version: Y
@@ -21,4 +22,5 @@ MariaDB [(none)]> select 1;
+---+ +---+
1 row in set 1 row in set
MariaDB [(none)]> MariaDB [(none)]> exit
Bye

View File

@@ -6,23 +6,16 @@ source include/not_windows.inc;
# this would need an instrumented ncurses library # this would need an instrumented ncurses library
source include/not_msan.inc; source include/not_msan.inc;
error 0,1;
exec $MYSQL -V|grep -q readline;
if ($sys_errno == 1)
{
# strangely enough
skip does not work with libedit;
}
write_file $MYSQL_TMP_DIR/mysql_in; write_file $MYSQL_TMP_DIR/mysql_in;
delimiter $ delimiter $
select 1; select 1;
$ $
exit
EOF EOF
let TERM=dumb; let TERM=dumb;
replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//; replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//;
error 0,127; error 0,127;
exec socat EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in; exec socat -t10 EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
if ($sys_errno == 127) if ($sys_errno == 127)
{ {
remove_file $MYSQL_TMP_DIR/mysql_in; remove_file $MYSQL_TMP_DIR/mysql_in;

View File

@@ -105,9 +105,9 @@ execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_t
execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0'); execute immediate if(@wsrep_cannot_replicate_tz, concat('ALTER TABLE time_zone_transition_type ENGINE=', @time_zone_transition_type_engine, ', ORDER BY Time_zone_id, Transition_type_id'), 'do 0');
SET session alter_algorithm=@old_alter_alg; SET session alter_algorithm=@old_alter_alg;
Warnings: Warnings:
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warnings: Warnings:
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
2 2
@@ -166,9 +166,9 @@ SET SESSION SQL_LOG_BIN=@save_sql_log_bin;
execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'); execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0');
SET session alter_algorithm=@old_alter_alg; SET session alter_algorithm=@old_alter_alg;
Warnings: Warnings:
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warnings: Warnings:
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
2 2
@@ -490,9 +490,9 @@ execute immediate if(@wsrep_is_on, 'SET SESSION WSREP_ON=@save_wsrep_on', 'do 0'
# #
set sql_mode=only_full_group_by; set sql_mode=only_full_group_by;
Warnings: Warnings:
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warnings: Warnings:
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
SELECT COUNT(*) FROM time_zone; SELECT COUNT(*) FROM time_zone;
COUNT(*) COUNT(*)
2 2

View File

@@ -152,7 +152,8 @@ Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES' Phase 8/8: Running 'FLUSH PRIVILEGES'
OK OK
Run it again - should say already completed Run it again - should say already completed
This installation of MariaDB is already upgraded to VERSION.There is no need to run mariadb-upgrade again for VERSION. This installation of MariaDB is already upgraded to X.Y.Z-MariaDB.
There is no need to run mariadb-upgrade again.
You can use --force if you still want to run mariadb-upgrade You can use --force if you still want to run mariadb-upgrade
Force should run it regardless of whether it has been run before Force should run it regardless of whether it has been run before
Phase 1/8: Checking and upgrading mysql database Phase 1/8: Checking and upgrading mysql database
@@ -1922,11 +1923,11 @@ FLUSH PRIVILEGES;
# #
# MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed # MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed
# #
This installation of MariaDB is already upgraded to MariaDB . This installation of MariaDB is already upgraded to X.Y.Z-MariaDB.
There is no need to run mariadb-upgrade again for MariaDB . There is no need to run mariadb-upgrade again.
Looking for 'mariadb' as: mariadb Looking for 'mariadb' as: mariadb
This installation of MariaDB is already upgraded to MariaDB . This installation of MariaDB is already upgraded to X.Y.Z-MariaDB.
There is no need to run mariadb-upgrade again for MariaDB . There is no need to run mariadb-upgrade again.
# #
# MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it # MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it
# #
@@ -1936,17 +1937,17 @@ Empty or non existent ...mariadb_upgrade_info. Assuming mysql_upgrade has to be
# MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change # MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change
# #
Looking for 'mariadb' as: mariadb Looking for 'mariadb' as: mariadb
This installation of MariaDB is already upgraded to MariaDB . This installation of MariaDB is already upgraded to X.Y.0-MariaDB.
There is no need to run mariadb-upgrade again for MariaDB . There is no need to run mariadb-upgrade again for X.Y.Z-MariaDB, because they're both X.Y.
This installation of MariaDB is already upgraded to MariaDB . This installation of MariaDB is already upgraded to X.Y.0-MariaDB.
There is no need to run mariadb-upgrade again for MariaDB . There is no need to run mariadb-upgrade again for X.Y.Z-MariaDB, because they're both X.Y.
You can use --force if you still want to run mariadb-upgrade You can use --force if you still want to run mariadb-upgrade
# #
# MDEV-27279: mariadb_upgrade check-if-upgrade with major version change # MDEV-27279: mariadb_upgrade check-if-upgrade with major version change
# #
Major version upgrade detected from MariaDB to MariaDB . Check required! Major version upgrade detected from X.0.99 to X.Y.Z-MariaDB. Check required!
Looking for 'mysql' as: mysql Looking for 'mysql' as: mysql
Major version upgrade detected from MariaDB to MariaDB . Check required! Major version upgrade detected from X.0.99 to X.Y.Z-MariaDB. Check required!
drop table mysql.global_priv; drop table mysql.global_priv;
rename table mysql.global_priv_bak to mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv;
# End of 10.2 tests # End of 10.2 tests

View File

@@ -1,8 +1,12 @@
--source include/long_test.inc
-- source include/mysql_upgrade_preparation.inc -- source include/mysql_upgrade_preparation.inc
-- source include/have_working_dns.inc -- source include/have_working_dns.inc
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_partition.inc -- source include/have_partition.inc
-- source include/no_valgrind_without_big.inc
let majorminor=`select substring_index(version(), '.', 2)`;
# for major upgrade test, see below
let major=`select substring_index(version(), '.', 1) - (version() like '%.0.%')`;
set sql_mode=""; set sql_mode="";
@@ -32,7 +36,7 @@ file_exists $MYSQLD_DATADIR/mysql_upgrade_info;
file_exists $MYSQLD_DATADIR/mariadb_upgrade_info; file_exists $MYSQLD_DATADIR/mariadb_upgrade_info;
--echo Run it again - should say already completed --echo Run it again - should say already completed
--replace_regex /upgraded to [^\n].*/upgraded to VERSION./ /again for [^\n]*/again for VERSION./ --replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB
--exec $MYSQL_UPGRADE 2>&1 --exec $MYSQL_UPGRADE 2>&1
# It should have created a file in the MySQL Servers datadir # It should have created a file in the MySQL Servers datadir
@@ -302,10 +306,11 @@ FLUSH PRIVILEGES;
--error 1 --error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / --replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB
--error 1 --error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ --replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB
--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/
--error 1 --error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
@@ -333,16 +338,18 @@ perl;
my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set";
$ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.$2.0$4/; $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.$2.0$4/;
open(FILE, ">$file/mariadb_upgrade_info") or die "Failed to open $file"; open(FILE, ">$file/mariadb_upgrade_info") or die "Failed to open $file";
binmode FILE;
print FILE "$ver\n"; print FILE "$ver\n";
close(FILE); close(FILE);
EOF EOF
--error 1 --error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ --replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $majorminor X.Y
--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/
--error 1 --error 1
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / --replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $majorminor X.Y
--exec $MYSQL_UPGRADE --exec $MYSQL_UPGRADE
--remove_file $MYSQLD_DATADIR/mariadb_upgrade_info --remove_file $MYSQLD_DATADIR/mariadb_upgrade_info
@@ -358,23 +365,17 @@ perl;
my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set"; my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set";
my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set";
open(FILE, ">$file/mariadb_upgrade_info") or die "Failed to open $file"; open(FILE, ">$file/mariadb_upgrade_info") or die "Failed to open $file";
if ($ver =~ m/(\d*)\.0\.(\d*)(.*)/) binmode FILE;
{ $ver =~ s/^(\d+)\.(\d+)\.\d+.*/($1-!$2).'.0.99'/e;
my $prev= $1-1;
$ver= $prev . '.0.' . $2 . $3;
}
else
{
$ver =~ s/^(\d*)\.(\d*)\.(\d*)(.*)/$1.0.$3$4/;
}
print FILE "$ver\n"; print FILE "$ver\n";
close(FILE); close(FILE);
EOF EOF
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / --replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $major X
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed
--replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mysql' as: mysql/ --replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $major X
--replace_regex /'mariadb.* as:[^\n]*/'mysql' as: mysql/
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose
--remove_file $MYSQLD_DATADIR/mariadb_upgrade_info --remove_file $MYSQLD_DATADIR/mariadb_upgrade_info
drop table mysql.global_priv; drop table mysql.global_priv;

View File

@@ -655,21 +655,21 @@ INSTALL PLUGIN test_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB';
/*M!100401 UNINSTALL PLUGIN IF EXIST cleartext_plugin_server */; /*M!100401 UNINSTALL PLUGIN IF EXIST cleartext_plugin_server */;
INSTALL PLUGIN cleartext_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB'; INSTALL PLUGIN cleartext_plugin_server SONAME 'AUTH_TEST_PLUGIN_LIB';
DELIMITER | DELIMITER |
/*M!100101 IF current_user()="'mariadb.sys'@'localhost'" THEN /*M!100101 IF current_user()='''mariadb.sys''@''localhost''' THEN
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'mariadb.sys'@'localhost''"; SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'mariadb.sys'@'localhost''";
END IF */| END IF */|
DELIMITER ; DELIMITER ;
/*!50701 DROP USER IF EXISTS 'mariadb.sys'@'localhost' */; /*!50701 DROP USER IF EXISTS 'mariadb.sys'@'localhost' */;
CREATE /*M!100103 OR REPLACE */ USER `mariadb.sys`@`localhost` PASSWORD EXPIRE; CREATE /*M!100103 OR REPLACE */ USER `mariadb.sys`@`localhost` PASSWORD EXPIRE;
DELIMITER | DELIMITER |
/*M!100101 IF current_user()="'root'@'localhost'" THEN /*M!100101 IF current_user()='''root''@''localhost''' THEN
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''"; SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''";
END IF */| END IF */|
DELIMITER ; DELIMITER ;
/*!50701 DROP USER IF EXISTS 'root'@'localhost' */; /*!50701 DROP USER IF EXISTS 'root'@'localhost' */;
CREATE /*M!100103 OR REPLACE */ USER `root`@`localhost`; CREATE /*M!100103 OR REPLACE */ USER `root`@`localhost`;
DELIMITER | DELIMITER |
/*M!100101 IF current_user()="'foobar'@'%'" THEN /*M!100101 IF current_user()='''foobar''@''%''' THEN
SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'foobar'@'%''"; SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'foobar'@'%''";
END IF */| END IF */|
DELIMITER ; DELIMITER ;

View File

@@ -6930,6 +6930,41 @@ set autocommit=0;
commit; commit;
ERROR at line 11: Not allowed in the sandbox mode ERROR at line 11: Not allowed in the sandbox mode
drop table t1; drop table t1;
#
# MDEV-36268 mariadb-dump used wrong quoting character
#
create table t1 (a int);
create view `v'1"2` as select * from t1 with check option;
/*M!999999\- enable the sandbox mode */
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8mb4 */;
CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
set autocommit=0;
commit;
SET @saved_cs_client = @@character_set_client;
SET character_set_client = utf8mb4;
/*!50001 CREATE VIEW `v'1"2` AS SELECT
1 AS `a` */;
SET character_set_client = @saved_cs_client;
/*!50001 DROP VIEW IF EXISTS `v'1"2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8mb3 */;
/*!50001 SET character_set_results = utf8mb3 */;
/*!50001 SET collation_connection = utf8mb3_uca1400_ai_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v'1"2` AS select `t1`.`a` AS `a` from `t1` */
/*!50002 WITH CASCADED CHECK OPTION */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
drop view `v'1"2`;
drop table t1;
# End of 10.5 tests # End of 10.5 tests
# #
# MDEV-16733 mysqldump --tab and --xml options are conflicting # MDEV-16733 mysqldump --tab and --xml options are conflicting

View File

@@ -1,4 +1,4 @@
--source include/no_valgrind_without_big.inc --source include/long_test.inc
--source include/have_utf8mb4.inc --source include/have_utf8mb4.inc
call mtr.add_suppression("@003f.frm' \\(errno: 22\\)"); call mtr.add_suppression("@003f.frm' \\(errno: 22\\)");
@@ -3032,6 +3032,15 @@ EOF
--remove_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql --remove_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql
drop table t1; drop table t1;
--echo #
--echo # MDEV-36268 mariadb-dump used wrong quoting character
--echo #
create table t1 (a int);
create view `v'1"2` as select * from t1 with check option; # "'
--exec $MYSQL_DUMP --compact test
drop view `v'1"2`; # "'
drop table t1;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -260,3 +260,6 @@ DROP TABLE t1;
# #
# Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK # Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK
# #
#
# Bug MDEV-34621: Fix division by zero in mariadb-slap when iterations=0
#

View File

@@ -88,3 +88,9 @@ DROP TABLE t1;
--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap
--exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-secondary-indexes=1 --create-schema=slap --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-secondary-indexes=1 --create-schema=slap
--echo #
--echo # Bug MDEV-34621: Fix division by zero in mariadb-slap when iterations=0
--echo #
--exec $MYSQL_SLAP -i0 --only-print

View File

@@ -989,4 +989,13 @@ select "foo\""bar";
foo\"bar foo\"bar
foo\"bar foo\"bar
set sql_mode=default; set sql_mode=default;
#
# MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error)
#
SELECT 1 /* doesn't throw error */;
1
1
SELECT 1 /* doesn't throw error */;
1
1
End of tests End of tests

View File

@@ -2954,6 +2954,12 @@ set sql_mode=no_backslash_escapes;
select "foo\""bar"; select "foo\""bar";
set sql_mode=default; set sql_mode=default;
--echo #
--echo # MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error)
--echo #
SELECT 1 /* doesn't throw error */;
SELECT 1 /* doesn't throw error */;
--echo End of tests --echo End of tests
# Wait till we reached the initial number of concurrent sessions # Wait till we reached the initial number of concurrent sessions

View File

@@ -860,7 +860,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxab
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaa xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxaa
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxz
Warnings: Warnings:
Warning 4203 2 values were longer than max_sort_length. Sorting used only the first 64 bytes Warning 4202 2 values were longer than max_sort_length. Sorting used only the first 64 bytes
drop table t1; drop table t1;
create table t1 ( create table t1 (
`sid` decimal(8,0) default null, `sid` decimal(8,0) default null,
@@ -4125,7 +4125,7 @@ a substr(b, @save_max_sort_length+1)
2 AB 2 AB
1 A 1 A
Warnings: Warnings:
Warning 4203 5 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 5 values were longer than max_sort_length. Sorting used only the first 1024 bytes
analyze format=json analyze format=json
select a, substr(b, @save_max_sort_length+1) from t1 order by b desc; select a, substr(b, @save_max_sort_length+1) from t1 order by b desc;
ANALYZE ANALYZE
@@ -4172,7 +4172,7 @@ ANALYZE
} }
} }
Warnings: Warnings:
Warning 4203 5 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 5 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1; drop table t1;
# #
# Packing sort keys with complex collations # Packing sort keys with complex collations

View File

@@ -782,10 +782,10 @@ SUBPARTITION BY HASH(TO_DAYS(purchased))
DATA DIRECTORY = '/tmp/not-existing' DATA DIRECTORY = '/tmp/not-existing'
INDEX DIRECTORY = '/tmp/not-existing'); INDEX DIRECTORY = '/tmp/not-existing');
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@@ -805,8 +805,8 @@ DATA DIRECTORY = '/tmp/not-existing'
INDEX DIRECTORY = '/tmp/not-existing', INDEX DIRECTORY = '/tmp/not-existing',
SUBPARTITION sp1)); SUBPARTITION sp1));
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@@ -825,8 +825,8 @@ PARTITION BY RANGE(YEAR(purchased))
DATA DIRECTORY = '/tmp/not-existing' DATA DIRECTORY = '/tmp/not-existing'
INDEX DIRECTORY = '/tmp/not-existing'); INDEX DIRECTORY = '/tmp/not-existing');
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (

View File

@@ -259,3 +259,24 @@ CHECK TABLE `t1` EXTENDED;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check status OK test.t1 check status OK
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-31122 Server crash in get_lock_data / mysql_lock_abort_for_thread
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT, c varchar(5))
PARTITION BY RANGE COLUMNS(c)
SUBPARTITION by key(b) SUBPARTITIONS 2 (
PARTITION p0 VALUES LESS THAN ('m'),
PARTITION p1 VALUES LESS THAN ('z')
);
connect con1,localhost,root,,;
HANDLER t1 OPEN;
SELECT b FROM t2 PARTITION (p0);
connection default;
SET lock_wait_timeout= 1;
ALTER TABLE t1 FORCE;
connection con1;
b
disconnect con1;
connection default;
DROP TABLE t2, t1;

View File

@@ -249,3 +249,31 @@ ALTER TABLE `t1` ADD PRIMARY KEY (`a`);
ALTER TABLE `t1` REMOVE PARTITIONING; ALTER TABLE `t1` REMOVE PARTITIONING;
CHECK TABLE `t1` EXTENDED; CHECK TABLE `t1` EXTENDED;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-31122 Server crash in get_lock_data / mysql_lock_abort_for_thread
--echo #
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INT, c varchar(5))
PARTITION BY RANGE COLUMNS(c)
SUBPARTITION by key(b) SUBPARTITIONS 2 (
PARTITION p0 VALUES LESS THAN ('m'),
PARTITION p1 VALUES LESS THAN ('z')
);
--connect (con1,localhost,root,,)
HANDLER t1 OPEN;
--send
SELECT b FROM t2 PARTITION (p0);
--connection default
SET lock_wait_timeout= 1;
--error 0,ER_STATEMENT_TIMEOUT,ER_LOCK_WAIT_TIMEOUT
ALTER TABLE t1 FORCE;
--connection con1
--reap
--disconnect con1
--connection default
DROP TABLE t2, t1;

View File

@@ -24,8 +24,8 @@ data directory='/not/existing'
index directory='/not/existing' index directory='/not/existing'
); );
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (

View File

@@ -156,8 +156,8 @@ data directory='/not/existing'
index directory='/not/existing' index directory='/not/existing'
); );
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (

View File

@@ -15,16 +15,16 @@ DATA DIRECTORY = 'E:/mysqltest/p2Data'
INDEX DIRECTORY = 'F:/mysqltest/p2Index' INDEX DIRECTORY = 'F:/mysqltest/p2Index'
); );
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
INSERT INTO t1 VALUES (NULL, "first", 1); INSERT INTO t1 VALUES (NULL, "first", 1);
INSERT INTO t1 VALUES (NULL, "second", 2); INSERT INTO t1 VALUES (NULL, "second", 2);
INSERT INTO t1 VALUES (NULL, "third", 3); INSERT INTO t1 VALUES (NULL, "third", 3);
ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index'); ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data' INDEX DIRECTORY = 'H:/mysqltest/p3Index');
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
INSERT INTO t1 VALUES (NULL, "last", 4); INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1; DROP TABLE t1;

View File

@@ -441,3 +441,28 @@ SET @@debug_dbug=@save_dbug;
DROP TABLE t1; DROP TABLE t1;
DROP PROCEDURE p1; DROP PROCEDURE p1;
# End of 11.2 tests # End of 11.2 tests
# MDEV-36079: Stored routine with a cursor crashes on
# the second execution if a DDL statement happened
CREATE OR REPLACE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
CREATE PROCEDURE p1()
BEGIN
DECLARE va INT DEFAULT 0;
DECLARE cur CURSOR FOR SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
CALL p1;
va
1
ALTER TABLE t1 MODIFY a INT UNSIGNED;
CALL p1;
va
1
# Clean up
DROP PROCEDURE p1;
DROP TABLE t1;
# End of 11.8 tests

View File

@@ -469,3 +469,35 @@ DROP TABLE t1;
DROP PROCEDURE p1; DROP PROCEDURE p1;
--echo # End of 11.2 tests --echo # End of 11.2 tests
--echo # MDEV-36079: Stored routine with a cursor crashes on
--echo # the second execution if a DDL statement happened
CREATE OR REPLACE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
--delimiter $
CREATE PROCEDURE p1()
BEGIN
DECLARE va INT DEFAULT 0;
DECLARE cur CURSOR FOR SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
--delimiter ;
CALL p1;
ALTER TABLE t1 MODIFY a INT UNSIGNED;
CALL p1;
--echo # Clean up
DROP PROCEDURE p1;
DROP TABLE t1;
--echo # End of 11.8 tests

View File

@@ -831,7 +831,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxw
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy
Warnings: Warnings:
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 64 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 64 bytes
set max_sort_length=200; set max_sort_length=200;
select c from t1 order by c, id; select c from t1 order by c, id;
c c

View File

@@ -287,7 +287,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL
GLOBAL_VALUE_PATH NULL GLOBAL_VALUE_PATH NULL
set alter_algorithm=COPY; set alter_algorithm=COPY;
Warnings: Warnings:
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
select @@alter_algorithm; select @@alter_algorithm;
@@alter_algorithm @@alter_algorithm
DEFAULT DEFAULT
@@ -295,8 +295,8 @@ set statement alter_algorithm=COPY FOR SELECT @@alter_algorithm;
@@alter_algorithm @@alter_algorithm
DEFAULT DEFAULT
Warnings: Warnings:
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 4201 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@alter_algorithm' is ignored. It only exists for compatibility with old installations and will be removed in a future release
# restart: --alter-algorithm=COPY # restart: --alter-algorithm=COPY
select @@alter_algorithm; select @@alter_algorithm;
@@alter_algorithm @@alter_algorithm

View File

@@ -29,8 +29,8 @@ explain select * from t1 where nm like '500%' AND fl2 = 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where 1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where
Warnings: Warnings:
Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
select json_detailed(json_extract(@trace, '$**.considered_access_paths')); select json_detailed(json_extract(@trace, '$**.considered_access_paths'));
json_detailed(json_extract(@trace, '$**.considered_access_paths')) json_detailed(json_extract(@trace, '$**.considered_access_paths'))
@@ -97,8 +97,8 @@ explain select * from t1 where nm like '500%' AND fl2 = 0;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where 1 SIMPLE t1 range idx1,idx2 idx1 35 NULL 1 Using index condition; Using where
Warnings: Warnings:
Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
set @trace=(select trace from information_schema.optimizer_trace); set @trace=(select trace from information_schema.optimizer_trace);
select json_detailed(json_extract(@trace, '$**.considered_access_paths')); select json_detailed(json_extract(@trace, '$**.considered_access_paths'));
json_detailed(json_extract(@trace, '$**.considered_access_paths')) json_detailed(json_extract(@trace, '$**.considered_access_paths'))
@@ -163,14 +163,14 @@ select @@optimizer_adjust_secondary_key_costs;
0 0
set @@optimizer_adjust_secondary_key_costs=7; set @@optimizer_adjust_secondary_key_costs=7;
Warnings: Warnings:
Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 1292 Truncated incorrect optimizer_adjust_secondary_ke... value: '7' Warning 1292 Truncated incorrect optimizer_adjust_secondary_ke... value: '7'
select @@optimizer_adjust_secondary_key_costs; select @@optimizer_adjust_secondary_key_costs;
@@optimizer_adjust_secondary_key_costs @@optimizer_adjust_secondary_key_costs
2 2
set @@optimizer_adjust_secondary_key_costs=default; set @@optimizer_adjust_secondary_key_costs=default;
Warnings: Warnings:
Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
# #
# MDEV-34664: fix_innodb_cardinality # MDEV-34664: fix_innodb_cardinality
# #
@@ -201,7 +201,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 5 test.t2.a 90 Using index 1 SIMPLE t1 ref b b 5 test.t2.a 90 Using index
set @@optimizer_adjust_secondary_key_costs=8; set @@optimizer_adjust_secondary_key_costs=8;
Warnings: Warnings:
Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release
Warning 1292 Truncated incorrect optimizer_adjust_secondary_ke... value: '8' Warning 1292 Truncated incorrect optimizer_adjust_secondary_ke... value: '8'
explain select * from t1,t2 where t1.b=t2.a; explain select * from t1,t2 where t1.b=t2.a;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
@@ -238,4 +238,4 @@ set global userstat=@save_userstat;
set global innodb_stats_persistent_sample_pages=@save_ispsp; set global innodb_stats_persistent_sample_pages=@save_ispsp;
set @@optimizer_adjust_secondary_key_costs=default; set @@optimizer_adjust_secondary_key_costs=default;
Warnings: Warnings:
Warning 4201 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release Warning 4200 The variable '@@optimizer_adjust_secondary_key_costs' is ignored. It only exists for compatibility with old installations and will be removed in a future release

View File

@@ -68,19 +68,15 @@ count(*)
select count(*) from information_schema.USER_PRIVILEGES; select count(*) from information_schema.USER_PRIVILEGES;
count(*) count(*)
0 0
#
# End of 5.0 tests # End of 5.0 tests
# #
#
# Bug#29817 Queries with UDF fail with non-descriptive error # Bug#29817 Queries with UDF fail with non-descriptive error
# if mysql.proc is missing # if mysql.proc is missing
# #
select no_such_function(1); select no_such_function(1);
ERROR 42000: FUNCTION test.no_such_function does not exist ERROR 42000: FUNCTION test.no_such_function does not exist
#
# End of 5.1 tests # End of 5.1 tests
# #
#
# MDEV-8280 crash in 'show global status' with --skip-grant-tables # MDEV-8280 crash in 'show global status' with --skip-grant-tables
# #
show global status like 'Acl%'; show global status like 'Acl%';
@@ -96,17 +92,13 @@ Acl_role_grants 0
Acl_roles 0 Acl_roles 0
Acl_table_grants 0 Acl_table_grants 0
Acl_users 0 Acl_users 0
#
# End of 10.1 tests # End of 10.1 tests
# #
#
# MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables # MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables
# #
set role x; set role x;
ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
#
# End of 10.2 tests # End of 10.2 tests
#
show create user root@localhost; show create user root@localhost;
ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement ERROR HY000: The MariaDB server is running with the --skip-grant-tables option so it cannot execute this statement
insert mysql.global_priv values ('foo', 'bar', '{}'); insert mysql.global_priv values ('foo', 'bar', '{}');
@@ -134,9 +126,15 @@ CREATE USER `baz`@`baz` IDENTIFIED BY PASSWORD '*E52096EF8EB0240275A7FE9E069101C
drop user bar@foo; drop user bar@foo;
drop user baz@baz; drop user baz@baz;
# restart # restart
#
# End of 10.3 tests # End of 10.3 tests
# #
# MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables
#
CREATE DEFINER=a PROCEDURE p() SELECT 1;
CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100;
DROP PROCEDURE p;
DROP FUNCTION f;
# End of 10.5 tests
# #
# MDEV-24815 Show "--skip-grant-tables" state in SYSTEM VARIABLES # MDEV-24815 Show "--skip-grant-tables" state in SYSTEM VARIABLES
# #
@@ -148,6 +146,10 @@ SELECT @@skip_grant_tables AS EXPECT_0;
EXPECT_0 EXPECT_0
0 0
# restart: --skip-grant-tables # restart: --skip-grant-tables
#
# End of 10.10 tests # End of 10.10 tests
# #
# MDEV-36351 MariaDB crashes when trying to access information_schema.users under --skip-grant-tables
#
select * from information_schema.users;
USER PASSWORD_ERRORS PASSWORD_EXPIRATION_TIME
# End of 11.8 tests

View File

@@ -104,9 +104,7 @@ select count(*) from information_schema.SCHEMA_PRIVILEGES;
select count(*) from information_schema.TABLE_PRIVILEGES; select count(*) from information_schema.TABLE_PRIVILEGES;
select count(*) from information_schema.USER_PRIVILEGES; select count(*) from information_schema.USER_PRIVILEGES;
--echo #
--echo # End of 5.0 tests --echo # End of 5.0 tests
--echo #
--echo # --echo #
--echo # Bug#29817 Queries with UDF fail with non-descriptive error --echo # Bug#29817 Queries with UDF fail with non-descriptive error
@@ -115,18 +113,14 @@ select count(*) from information_schema.USER_PRIVILEGES;
--error ER_SP_DOES_NOT_EXIST --error ER_SP_DOES_NOT_EXIST
select no_such_function(1); select no_such_function(1);
--echo #
--echo # End of 5.1 tests --echo # End of 5.1 tests
--echo #
--echo # --echo #
--echo # MDEV-8280 crash in 'show global status' with --skip-grant-tables --echo # MDEV-8280 crash in 'show global status' with --skip-grant-tables
--echo # --echo #
show global status like 'Acl%'; show global status like 'Acl%';
--echo #
--echo # End of 10.1 tests --echo # End of 10.1 tests
--echo #
--echo # --echo #
--echo # MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables --echo # MDEV-22966 Server crashes or hangs with SET ROLE when started with skip-grant-tables
@@ -135,9 +129,7 @@ show global status like 'Acl%';
--error ER_OPTION_PREVENTS_STATEMENT --error ER_OPTION_PREVENTS_STATEMENT
set role x; set role x;
--echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo #
# #
# MDEV-18297 # MDEV-18297
@@ -164,9 +156,18 @@ drop user baz@baz;
--enable_ps_protocol --enable_ps_protocol
--echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #
--echo # MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables
--echo #
CREATE DEFINER=a PROCEDURE p() SELECT 1;
CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100;
DROP PROCEDURE p;
DROP FUNCTION f;
--echo # End of 10.5 tests
--echo # --echo #
--echo # MDEV-24815 Show "--skip-grant-tables" state in SYSTEM VARIABLES --echo # MDEV-24815 Show "--skip-grant-tables" state in SYSTEM VARIABLES
@@ -183,6 +184,11 @@ SELECT @@skip_grant_tables AS EXPECT_0;
--let $restart_parameters = --skip-grant-tables --let $restart_parameters = --skip-grant-tables
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
--echo #
--echo # End of 10.10 tests --echo # End of 10.10 tests
--echo # --echo #
--echo # MDEV-36351 MariaDB crashes when trying to access information_schema.users under --skip-grant-tables
--echo #
select * from information_schema.users;
--echo # End of 11.8 tests

View File

@@ -388,5 +388,14 @@ ERROR 23000: Column 'c2' in FROM is ambiguous
DROP PROCEDURE p2; DROP PROCEDURE p2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #
# MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables
#
# This test is a duplicate of the one located in the file skip_grants.test
# and placed here to check the same test case against embedded-server
CREATE DEFINER=a PROCEDURE p() SELECT 1;
CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100;
DROP PROCEDURE p;
DROP FUNCTION f;
#
# End of 10.5 tests # End of 10.5 tests
# #

View File

@@ -414,6 +414,26 @@ CALL p2 (@a,@c);
DROP PROCEDURE p2; DROP PROCEDURE p2;
DROP TABLE t1, t2; DROP TABLE t1, t2;
--echo #
--echo # MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables
--echo #
--echo # This test is a duplicate of the one located in the file skip_grants.test
--echo # and placed here to check the same test case against embedded-server
# Disable warnings before running the following CREATE PROCEDURE/FUNCTION
# statement since the warning message
# "The user specified as a definer ('a'@'%') does not exist"
# is output in case the test be run against a regular server
# and isn't output if embedded server is used (@sa sp_process_definer()
# in sql_parse.cc).
--disable_warnings
CREATE DEFINER=a PROCEDURE p() SELECT 1;
CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100;
--enable_warnings
DROP PROCEDURE p;
DROP FUNCTION f;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -194,6 +194,13 @@ CONCAT(r.a, ' ', r.b)
1 b1 1 b1
DROP PACKAGE pkg; DROP PACKAGE pkg;
DROP TABLE t1; DROP TABLE t1;
#
# End of 11.7 tests # End of 11.7 tests
# #
# MDEV-36067 Assertion failure in TABLE_SHARE::init_from_sql_statement_string
#
rename table mysql.proc to test.proc_backup;
select * from information_schema.tables where
table_schema='sys' and table_name='x$schema_table_lock_waits';
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
rename table test.proc_backup to mysql.proc;
# End of 11.8 tests

View File

@@ -216,6 +216,14 @@ CALL pkg.p2;
DROP PACKAGE pkg; DROP PACKAGE pkg;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # End of 11.7 tests --echo # End of 11.7 tests
--echo # --echo #
--echo # MDEV-36067 Assertion failure in TABLE_SHARE::init_from_sql_statement_string
--echo #
rename table mysql.proc to test.proc_backup;
select * from information_schema.tables where
table_schema='sys' and table_name='x$schema_table_lock_waits';
rename table test.proc_backup to mysql.proc;
--echo # End of 11.8 tests

View File

@@ -2295,6 +2295,47 @@ SELECT 1 LIKE 2 ESCAPE a;
END; END;
$$ $$
ERROR 21000: Operand should contain 1 column(s) ERROR 21000: Operand should contain 1 column(s)
# Start of 10.6 tests
#
# MDEV-36179 Assertion `0' failed in virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const
#
CREATE PROCEDURE p0 (IN a ROW(a INT,b INT))
BEGIN
SET a=ROW(0,0);
END;
/
PREPARE s0 FROM 'CALL p0(?)';
EXECUTE s0 USING @a;
ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?'
DROP PROCEDURE p0;
CREATE PROCEDURE p0 (INOUT a ROW(a INT,b INT))
BEGIN
SET a=ROW(0,0);
END;
/
PREPARE s0 FROM 'CALL p0(?)';
EXECUTE s0 USING @a;
ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?'
DROP PROCEDURE p0;
CREATE PROCEDURE p0 (OUT a ROW(a INT,b INT))
BEGIN
SET a=ROW(0,0);
END;
/
PREPARE s0 FROM 'CALL p0(?)';
EXECUTE s0 USING @a;
ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?'
DROP PROCEDURE p0;
CREATE FUNCTION f0(a ROW(a INT,b INT)) RETURNS BOOLEAN
BEGIN
RETURN FALSE;
END;
/
PREPARE s0 FROM 'SELECT f0(?)';
EXECUTE s0 USING @a;
ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?'
DROP FUNCTION f0;
# End of 10.6 tests
# #
# Start of 11.7 tests # Start of 11.7 tests
# #

View File

@@ -1534,6 +1534,67 @@ $$
DELIMITER ;$$ DELIMITER ;$$
--echo # Start of 10.6 tests
--echo #
--echo # MDEV-36179 Assertion `0' failed in virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const
--echo #
DELIMITER /;
CREATE PROCEDURE p0 (IN a ROW(a INT,b INT))
BEGIN
SET a=ROW(0,0);
END;
/
DELIMITER ;/
PREPARE s0 FROM 'CALL p0(?)';
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
EXECUTE s0 USING @a;
DROP PROCEDURE p0;
DELIMITER /;
CREATE PROCEDURE p0 (INOUT a ROW(a INT,b INT))
BEGIN
SET a=ROW(0,0);
END;
/
DELIMITER ;/
PREPARE s0 FROM 'CALL p0(?)';
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
EXECUTE s0 USING @a;
DROP PROCEDURE p0;
DELIMITER /;
CREATE PROCEDURE p0 (OUT a ROW(a INT,b INT))
BEGIN
SET a=ROW(0,0);
END;
/
DELIMITER ;/
PREPARE s0 FROM 'CALL p0(?)';
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
EXECUTE s0 USING @a;
DROP PROCEDURE p0;
DELIMITER /;
CREATE FUNCTION f0(a ROW(a INT,b INT)) RETURNS BOOLEAN
BEGIN
RETURN FALSE;
END;
/
DELIMITER ;/
PREPARE s0 FROM 'SELECT f0(?)';
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
EXECUTE s0 USING @a;
DROP FUNCTION f0;
--echo # End of 10.6 tests
--echo # --echo #
--echo # Start of 11.7 tests --echo # Start of 11.7 tests
--echo # --echo #

View File

@@ -1993,4 +1993,96 @@ f1()
# Clean up # Clean up
DROP FUNCTION f1; DROP FUNCTION f1;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-36390: Minor refactoring of the method get_expr_query at the classes sp_instr_cpush/sp_instr_cursor_copy_struct
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
CREATE OR REPLACE PROCEDURE p1()
BEGIN
DECLARE va INT;
# Check that the TAB character after the clause FOR is skipped and
# the body of cursor is remembered correctly for subsequent re-parsing
DECLARE cur CURSOR FOR SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
CREATE OR REPLACE PROCEDURE p2()
BEGIN
DECLARE va INT;
# Check that the newline character after the clause FOR is skipped and
# the body of cursor is remembered correctly for subsequent re-parsing
DECLARE cur CURSOR FOR
SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
CREATE OR REPLACE PROCEDURE p3()
BEGIN
DECLARE va INT;
# Check that C-style comment and the newline character after
# the clause FOR is skipped and the body of cursor is remembered
# correctly for subsequent re-parsing
DECLARE cur CURSOR FOR /* Explicit comment */
SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
CREATE OR REPLACE PROCEDURE p4()
BEGIN
DECLARE va INT;
# Check that SQL-style comment and the newline character after
# the clause FOR is skipped and the body of cursor is remembered
# correctly for subsequent re-parsing
DECLARE cur CURSOR FOR -- Explicit comment
SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
CALL p1();
va
1
CALL p2();
va
1
CALL p3();
va
1
CALL p4();
va
1
ALTER TABLE t1 COMMENT 'The Comment 1';
# The following statements will run re-parsing of
# cursor declaration statements inside the stored
# procedures p1, p2, p3, p4.
CALL p1();
va
1
CALL p2();
va
1
CALL p3();
va
1
CALL p4();
va
1
# Clean up
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
DROP PROCEDURE p4;
DROP TABLE t1;
SET sql_mode = default; SET sql_mode = default;

View File

@@ -2795,5 +2795,96 @@ SELECT f1();
DROP FUNCTION f1; DROP FUNCTION f1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-36390: Minor refactoring of the method get_expr_query at the classes sp_instr_cpush/sp_instr_cursor_copy_struct
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1);
--delimiter $
CREATE OR REPLACE PROCEDURE p1()
BEGIN
DECLARE va INT;
# Check that the TAB character after the clause FOR is skipped and
# the body of cursor is remembered correctly for subsequent re-parsing
DECLARE cur CURSOR FOR SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
CREATE OR REPLACE PROCEDURE p2()
BEGIN
DECLARE va INT;
# Check that the newline character after the clause FOR is skipped and
# the body of cursor is remembered correctly for subsequent re-parsing
DECLARE cur CURSOR FOR
SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
CREATE OR REPLACE PROCEDURE p3()
BEGIN
DECLARE va INT;
# Check that C-style comment and the newline character after
# the clause FOR is skipped and the body of cursor is remembered
# correctly for subsequent re-parsing
DECLARE cur CURSOR FOR /* Explicit comment */
SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
CREATE OR REPLACE PROCEDURE p4()
BEGIN
DECLARE va INT;
# Check that SQL-style comment and the newline character after
# the clause FOR is skipped and the body of cursor is remembered
# correctly for subsequent re-parsing
DECLARE cur CURSOR FOR -- Explicit comment
SELECT a FROM t1;
OPEN cur;
FETCH cur INTO va;
SELECT va;
CLOSE cur;
END;
$
--delimiter ;
CALL p1();
CALL p2();
CALL p3();
CALL p4();
ALTER TABLE t1 COMMENT 'The Comment 1';
--echo # The following statements will run re-parsing of
--echo # cursor declaration statements inside the stored
--echo # procedures p1, p2, p3, p4.
CALL p1();
CALL p2();
CALL p3();
CALL p4();
--echo # Clean up
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
DROP PROCEDURE p4;
DROP TABLE t1;
SET sql_mode = default; SET sql_mode = default;
--enable_ps2_protocol --enable_ps2_protocol

View File

@@ -899,7 +899,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
set @@group_concat_max_len = 256; set @@group_concat_max_len = 256;
explain extended select left(a1,7), left(a2,7) explain extended select left(a1,7), left(a2,7)
from t1_1024 from t1_1024
@@ -917,7 +917,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1_1024, t2_1024, t3_1024; drop table t1_1024, t2_1024, t3_1024;
set @blob_len = 1025; set @blob_len = 1025;
set @suffix_len = @blob_len - @prefix_len; set @suffix_len = @blob_len - @prefix_len;
@@ -1002,7 +1002,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
set @@group_concat_max_len = 256; set @@group_concat_max_len = 256;
explain extended select left(a1,7), left(a2,7) explain extended select left(a1,7), left(a2,7)
from t1_1025 from t1_1025
@@ -1020,7 +1020,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1_1025, t2_1025, t3_1025; drop table t1_1025, t2_1025, t3_1025;
create table t1bit (a1 bit(3), a2 bit(3)); create table t1bit (a1 bit(3), a2 bit(3));
create table t2bit (b1 bit(3), b2 bit(3)); create table t2bit (b1 bit(3), b2 bit(3));

View File

@@ -919,7 +919,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
set @@group_concat_max_len = 256; set @@group_concat_max_len = 256;
explain extended select left(a1,7), left(a2,7) explain extended select left(a1,7), left(a2,7)
from t1_1024 from t1_1024
@@ -938,7 +938,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1_1024, t2_1024, t3_1024; drop table t1_1024, t2_1024, t3_1024;
set @blob_len = 1025; set @blob_len = 1025;
set @suffix_len = @blob_len - @prefix_len; set @suffix_len = @blob_len - @prefix_len;
@@ -1024,7 +1024,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
set @@group_concat_max_len = 256; set @@group_concat_max_len = 256;
explain extended select left(a1,7), left(a2,7) explain extended select left(a1,7), left(a2,7)
from t1_1025 from t1_1025
@@ -1043,7 +1043,7 @@ Warnings:
Warning 1260 Row 1 was cut by group_concat() Warning 1260 Row 1 was cut by group_concat()
Warning 1260 Row 2 was cut by group_concat() Warning 1260 Row 2 was cut by group_concat()
Warning 1260 Row 3 was cut by group_concat() Warning 1260 Row 3 was cut by group_concat()
Warning 4203 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes Warning 4202 3 values were longer than max_sort_length. Sorting used only the first 1024 bytes
drop table t1_1025, t2_1025, t3_1025; drop table t1_1025, t2_1025, t3_1025;
create table t1bit (a1 bit(3), a2 bit(3)); create table t1bit (a1 bit(3), a2 bit(3));
create table t2bit (b1 bit(3), b2 bit(3)); create table t2bit (b1 bit(3), b2 bit(3));

View File

@@ -86,7 +86,7 @@ drop database mysqltest;
create table t1 (a int not null) engine=myisam; create table t1 (a int not null) engine=myisam;
alter table t1 data directory="MYSQLTEST_VARDIR/tmp"; alter table t1 data directory="MYSQLTEST_VARDIR/tmp";
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@@ -95,7 +95,7 @@ t1 CREATE TABLE `t1` (
alter table t1 add b int; alter table t1 add b int;
alter table t1 data directory="MYSQLTEST_VARDIR/log"; alter table t1 data directory="MYSQLTEST_VARDIR/log";
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@@ -104,7 +104,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
alter table t1 index directory="MYSQLTEST_VARDIR/log"; alter table t1 index directory="MYSQLTEST_VARDIR/log";
Warnings: Warnings:
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
@@ -185,8 +185,8 @@ ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errco
SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE'; SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE='NO_DIR_IN_CREATE';
CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp'; CREATE TABLE t1(a INT) DATA DIRECTORY='MYSQLTEST_VARDIR/tmp' INDEX DIRECTORY='MYSQLTEST_VARDIR/tmp';
Warnings: Warnings:
Warning 1618 <DATA DIRECTORY> option ignored Warning 1618 DATA DIRECTORY option ignored
Warning 1618 <INDEX DIRECTORY> option ignored Warning 1618 INDEX DIRECTORY option ignored
DROP TABLE t1; DROP TABLE t1;
SET @@SQL_MODE=@OLD_SQL_MODE; SET @@SQL_MODE=@OLD_SQL_MODE;
# #

View File

@@ -25,3 +25,9 @@ OPENED_VIEWS 0
set @@use_stat_tables= @save_use_stat_tables; set @@use_stat_tables= @save_use_stat_tables;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1; drop table t1;
#
# MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir
#
create table t1 (c int);
drop table t1;
# restart

View File

@@ -24,4 +24,15 @@ select variable_name, session_status.variable_value - t1.variable_value
from information_schema.session_status join t1 using (variable_name); from information_schema.session_status join t1 using (variable_name);
set @@use_stat_tables= @save_use_stat_tables; set @@use_stat_tables= @save_use_stat_tables;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
drop table t1; drop table t1;
--echo #
--echo # MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir
--echo #
create table t1 (c int);
let $MYSQLD_TMPDIR=`SELECT @@tmpdir`;
let $MYSQLD_DATADIR=`SELECT @@datadir`;
--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_TMPDIR/#sqlt1.frm
drop table t1;
--source include/restart_mysqld.inc

View File

@@ -8,7 +8,7 @@ select FROM_UNIXTIME(24*3600);
enable_query_log; enable_query_log;
# The following is because of daylight saving time # The following is because of daylight saving time
--replace_result MEST CET MET CET --replace_result MEST CET MET CET CEST CET
show variables like "system_time_zone"; show variables like "system_time_zone";
--echo # --echo #

View File

@@ -48,7 +48,7 @@ set @@tmp_memory_table_size=32*1024;
--echo # The following queries should fail because of tmp_space_usage --echo # The following queries should fail because of tmp_space_usage
--error 41 --error 41
select * from t1 order by a,v; select * from t1 order by a,v;
--error 201 --error HA_ERR_LOCAL_TMP_SPACE_FULL
select v,count(*) from t1 group by v limit 2; select v,count(*) from t1 group by v limit 2;
--error 41 --error 41
update t1 set v=right(v,2); update t1 set v=right(v,2);
@@ -56,7 +56,7 @@ update t1 set v=right(v,2);
set @@binlog_format="statement"; set @@binlog_format="statement";
set @@max_tmp_session_space_usage=65536; set @@max_tmp_session_space_usage=65536;
set @@tmp_memory_table_size=0; set @@tmp_memory_table_size=0;
--error 201 --error HA_ERR_LOCAL_TMP_SPACE_FULL
update t1,t2 set t1.c=t2.a, t2.b=1 where t1.a=t2.a; update t1,t2 set t1.c=t2.a, t2.b=1 where t1.a=t2.a;
set @@binlog_format="row"; set @@binlog_format="row";
set @@max_tmp_session_space_usage=default; set @@max_tmp_session_space_usage=default;
@@ -205,7 +205,7 @@ DROP TABLE t1;
--echo # --echo #
set max_tmp_session_space_usage = 1024*1024; set max_tmp_session_space_usage = 1024*1024;
--error 202 --error HA_ERR_GLOBAL_TMP_SPACE_FULL
select count(distinct concat(seq,repeat('x',1000))) from seq_1_to_1000; select count(distinct concat(seq,repeat('x',1000))) from seq_1_to_1000;
--echo # --echo #
@@ -226,7 +226,7 @@ set @@max_heap_table_size=16777216;
CREATE TABLE t1 (a CHAR(255),b INT,INDEX (b)); CREATE TABLE t1 (a CHAR(255),b INT,INDEX (b));
INSERT INTO t1 SELECT SEQ,SEQ FROM seq_1_to_100000; INSERT INTO t1 SELECT SEQ,SEQ FROM seq_1_to_100000;
set @@max_tmp_session_space_usage=1179648; set @@max_tmp_session_space_usage=1179648;
--error 201 --error HA_ERR_LOCAL_TMP_SPACE_FULL
SELECT * FROM t1 UNION SELECT * FROM t1; SELECT * FROM t1 UNION SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
@@ -258,7 +258,7 @@ set @@global.max_tmp_total_space_usage=@save_max_tmp_total_space_usage;
--echo # "temporary space limit reached" error --echo # "temporary space limit reached" error
SET max_tmp_session_space_usage= 64*1024; SET max_tmp_session_space_usage= 64*1024;
--error 201 --error HA_ERR_LOCAL_TMP_SPACE_FULL
SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS; SELECT MIN(VARIABLE_VALUE) OVER (), NTILE(1) OVER (), MAX(VARIABLE_NAME) OVER () FROM information_schema.SESSION_STATUS;
--echo # --echo #
@@ -275,7 +275,7 @@ BEGIN;
INSERT INTO t1 SELECT NOW() FROM seq_1_to_6000; INSERT INTO t1 SELECT NOW() FROM seq_1_to_6000;
SET max_tmp_session_space_usage = 64*1024; SET max_tmp_session_space_usage = 64*1024;
--error 201 --error HA_ERR_LOCAL_TMP_SPACE_FULL
SELECT * FROM information_schema.ALL_PLUGINS LIMIT 2; SELECT * FROM information_schema.ALL_PLUGINS LIMIT 2;
ROLLBACK; ROLLBACK;
drop table t1; drop table t1;
@@ -290,7 +290,7 @@ disconnect c1;
SET MAX_TMP_SESSION_SPACE_USAGE = 128*1024, MAX_HEAP_TABLE_SIZE= 16*1024*1024; SET MAX_TMP_SESSION_SPACE_USAGE = 128*1024, MAX_HEAP_TABLE_SIZE= 16*1024*1024;
CREATE TABLE t1 (a varchar(1024)) DEFAULT CHARACTER SET utf8mb3; CREATE TABLE t1 (a varchar(1024)) DEFAULT CHARACTER SET utf8mb3;
INSERT INTO t1 SELECT 'x' FROM seq_1_to_50; INSERT INTO t1 SELECT 'x' FROM seq_1_to_50;
--error 201 --error HA_ERR_LOCAL_TMP_SPACE_FULL
SELECT * FROM t1 JOIN seq_1_to_200 INTERSECT ALL SELECT * FROM t1 JOIN seq_1_to_200; SELECT * FROM t1 JOIN seq_1_to_200 INTERSECT ALL SELECT * FROM t1 JOIN seq_1_to_200;
drop table t1; drop table t1;
@@ -300,7 +300,7 @@ drop table t1;
--echo # --echo #
SET MAX_TMP_SESSION_SPACE_USAGE = 400*1024; SET MAX_TMP_SESSION_SPACE_USAGE = 400*1024;
--error 201 --error HA_ERR_LOCAL_TMP_SPACE_FULL
SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_VARIABLES JOIN seq_1_to_100 SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_VARIABLES JOIN seq_1_to_100
INTERSECT ALL INTERSECT ALL
SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_VARIABLES JOIN seq_1_to_100; SELECT VARIABLE_VALUE FROM information_schema.GLOBAL_VARIABLES JOIN seq_1_to_100;

View File

@@ -916,6 +916,15 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range b b 5 NULL 3 Using where 1 PRIMARY t1 range b b 5 NULL 3 Using where
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 20000 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 20000
drop table t1, t2; drop table t1, t2;
#
# MDEV-35662 Assertion failure in diagnostics area upon EXPLAIN UPDATE
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INET6);
INSERT INTO t2 VALUES ('::'),('::');
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT b FROM t2) ORDER BY a LIMIT 1;
ERROR HY000: Illegal parameter data types int and inet6 for operation '='
DROP TABLE t1, t2;
# End of 11.7 tests # End of 11.7 tests
ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci; ALTER DATABASE test CHARACTER SET utf8mb4 COLLATE utf8mb4_uca1400_ai_ci;
# MDEV-35955 Wrong result for UPDATE ... ORDER BY LIMIT which uses tmp.table # MDEV-35955 Wrong result for UPDATE ... ORDER BY LIMIT which uses tmp.table

View File

@@ -824,6 +824,19 @@ explain update t1 set c = 5 where b <= 2 and a not in (select b from t2);
explain update t1 set c = 5 where b <= 3 and a not in (select b from t2); explain update t1 set c = 5 where b <= 3 and a not in (select b from t2);
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-35662 Assertion failure in diagnostics area upon EXPLAIN UPDATE
--echo #
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (b INET6);
INSERT INTO t2 VALUES ('::'),('::'); # Optional, fails either way
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT b FROM t2) ORDER BY a LIMIT 1;
# Cleanup
DROP TABLE t1, t2;
--echo # End of 11.7 tests --echo # End of 11.7 tests
--source include/test_db_charset_restore.inc --source include/test_db_charset_restore.inc

View File

@@ -436,3 +436,21 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t ALL NULL NULL NULL NULL 2 Using filesort 1 SIMPLE t ALL NULL NULL NULL NULL 2 Using filesort
drop table t; drop table t;
# End of 11.7 tests # End of 11.7 tests
#
# MDEV-35309 - ALTER performs vector truncation without WARN_DATA_TRUNCATED or similar warnings/errors
#
create table t (v vector(2));
insert into t values (0x3131313132323232);
select * from t;
v
11112222
alter table t modify v vector(1);
ERROR 01000: Data truncated for column 'v' at row 1
set statement sql_mode='' for alter table t modify v vector(1);
Warnings:
Warning 1265 Data truncated for column 'v' at row 1
select * from t;
v
1111
drop table t;
# End of 11.8 tests

View File

@@ -318,3 +318,17 @@ insert into t values (0x00000000),(0x00000000);
explain select vec_totext(a) from t order by vec_distance_euclidean(a,0x00000000) limit 1; explain select vec_totext(a) from t order by vec_distance_euclidean(a,0x00000000) limit 1;
drop table t; drop table t;
--echo # End of 11.7 tests --echo # End of 11.7 tests
--echo #
--echo # MDEV-35309 - ALTER performs vector truncation without WARN_DATA_TRUNCATED or similar warnings/errors
--echo #
create table t (v vector(2));
insert into t values (0x3131313132323232);
select * from t;
--error WARN_DATA_TRUNCATED
alter table t modify v vector(1);
set statement sql_mode='' for alter table t modify v vector(1);
select * from t;
drop table t;
--echo # End of 11.8 tests

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