Merge branch '10.11' into 11.4

This commit is contained in:
Sergei Golubchik 2025-03-31 20:18:05 +02:00
commit 28425cc276
24 changed files with 247 additions and 107 deletions

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

@ -2165,7 +2165,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]= '\'';
@ -3720,7 +3720,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]);
@ -4764,17 +4764,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 */
@ -6892,6 +6894,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");
@ -6952,7 +6955,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

@ -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)

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

@ -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

@ -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

@ -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 class, BINARY ch; SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY 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:]]');
SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY class, BINARY ch; SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY class, BINARY ch;
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

@ -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

@ -4,6 +4,10 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_partition.inc -- source include/have_partition.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="";
call mtr.add_suppression("Incorrect definition of table mysql.column_stats:.*"); call mtr.add_suppression("Incorrect definition of table mysql.column_stats:.*");
@ -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

@ -6757,6 +6757,39 @@ CREATE TABLE `t1` (
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
ERROR at line 9: Not allowed in the sandbox mode ERROR at line 9: 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 @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_general_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

@ -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

@ -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

@ -0,0 +1,11 @@
#
# MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM
#
create table t1 (
id bigint(20) not null auto_increment,
primary key (id)
) engine=myisam
partition by hash (id)
partitions 600;
FOUND 1 /Error 24 on file ./test/t1#P#p\d+\.MY[DI] open during `test`.`t1` table copy: Too many open files/ in backup.log
drop table t1;

View File

@ -0,0 +1,25 @@
source include/not_windows.inc;
source include/have_partition.inc;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $log=$MYSQL_TMP_DIR/backup.log;
--echo #
--echo # MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM
--echo #
create table t1 (
id bigint(20) not null auto_increment,
primary key (id)
) engine=myisam
partition by hash (id)
partitions 600;
error 1;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $log 2>&1;
let SEARCH_FILE=$log;
let SEARCH_PATTERN=Error 24 on file ./test/t1#P#p\d+\.MY[DI] open during `test`.`t1` table copy: Too many open files;
source include/search_pattern_in_file.inc;
rmdir $targetdir;
#remove_file $log;
drop table t1;

View File

@ -211,7 +211,7 @@ if ($opt{socket} and -S $opt{socket})
else else
{ {
$dsn .= "host=" . $opt{host}; $dsn .= "host=" . $opt{host};
if ($opt{host} ne "localhost") if ($opt{host} ne "localhost" and $opt{port})
{ {
$dsn .= ";port=". $opt{port}; $dsn .= ";port=". $opt{port};
} }

View File

@ -61,7 +61,6 @@ C_MODE_END
#endif #endif
/* fmtlib include (https://fmt.dev/). */ /* fmtlib include (https://fmt.dev/). */
#define FMT_STATIC_THOUSANDS_SEPARATOR ','
#define FMT_HEADER_ONLY 1 #define FMT_HEADER_ONLY 1
#include "fmt/args.h" #include "fmt/args.h"
@ -1566,6 +1565,13 @@ namespace fmt {
}; };
}; };
struct fmt_locale_comma : std::numpunct<char>
{
char do_thousands_sep() const override { return ','; }
std::string do_grouping() const override { return "\3"; }
};
static std::locale fmt_locale(std::locale(), new fmt_locale_comma);
/* /*
SFORMAT(format_string, ...) SFORMAT(format_string, ...)
This function receives a formatting specification string and N parameters This function receives a formatting specification string and N parameters
@ -1618,7 +1624,7 @@ String *Item_func_sformat::val_str(String *res)
/* Create the string output */ /* Create the string output */
try try
{ {
auto text = fmt::vformat(fmt_arg->c_ptr_safe(), arg_store); auto text = fmt::vformat(fmt_locale, fmt_arg->c_ptr_safe(), arg_store);
res->length(0); res->length(0);
res->set_charset(collation.collation); res->set_charset(collation.collation);
res->append(text.c_str(), text.size(), fmt_arg->charset()); res->append(text.c_str(), text.size(), fmt_arg->charset());

View File

@ -318,18 +318,16 @@ Diagnostics_area::reset_diagnostics_area()
#endif #endif
get_warning_info()->clear_error_condition(); get_warning_info()->clear_error_condition();
set_is_sent(false); set_is_sent(false);
/** Tiny reset in debug mode to see garbage right away */ /*
if (!is_bulk_op()) For BULK DML operations (e.g. UPDATE) the data member m_status
/* has the value DA_OK_BULK. Keep this value in order to handle
For BULK DML operations (e.g. UPDATE) the data member m_status m_affected_rows, m_statement_warn_count in correct way. Else,
has the value DA_OK_BULK. Keep this value in order to handle the number of rows and the number of warnings affected by
m_affected_rows, m_statement_warn_count in correct way. Else, the last statement executed as part of a trigger fired by the dml
the number of rows and the number of warnings affected by (e.g. UPDATE statement fires a trigger on AFTER UPDATE) would counts
the last statement executed as part of a trigger fired by the dml rows modified by trigger's statement.
(e.g. UPDATE statement fires a trigger on AFTER UPDATE) would counts */
rows modified by trigger's statement. m_status= is_bulk_op() ? DA_OK_BULK : DA_EMPTY;
*/
m_status= DA_EMPTY;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }

View File

@ -4529,10 +4529,9 @@ innobase_commit(
ut_ad("invalid state" == 0); ut_ad("invalid state" == 0);
/* fall through */ /* fall through */
case TRX_STATE_PREPARED: case TRX_STATE_PREPARED:
ut_ad(commit_trx || trx->is_wsrep()); ut_ad(commit_trx ||
ut_ad(thd_test_options(thd, OPTION_NOT_AUTOCOMMIT !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT
| OPTION_BEGIN) | OPTION_BEGIN));
|| trx->is_wsrep());
/* fall through */ /* fall through */
case TRX_STATE_ACTIVE: case TRX_STATE_ACTIVE:
/* Transaction is deregistered only in a commit or a /* Transaction is deregistered only in a commit or a

View File

@ -22886,8 +22886,58 @@ void test_mdev_10075()
DIE_UNLESS(rc == 1); DIE_UNLESS(rc == 1);
mysql_free_result(result); mysql_free_result(result);
mysql_query(mysql, "drop table t1");
} }
static void test_mdev35953()
{
#ifndef EMBEDDED_LIBRARY
int rc;
MYSQL_STMT *stmt;
MYSQL_BIND bind[1];
int vals[]= {1, 2}, count= array_elements(vals);
MYSQL *con= mysql_client_init(NULL);
DIE_UNLESS(con);
if (!mysql_real_connect(con, opt_host, opt_user, opt_password, current_db,
opt_port, opt_unix_socket, 0))
{
fprintf(stderr, "Failed to connect to database: Error: %s\n",
mysql_error(con));
exit(1);
}
rc= mysql_query(mysql, "create table t1 (a int)");
myquery(rc);
stmt= mysql_stmt_init(con);
rc= mysql_stmt_prepare(stmt, "insert into t1 (a) values (?)", -1);
check_execute(stmt, rc);
memset(bind, 0, sizeof(bind));
bind[0].buffer_type = MYSQL_TYPE_LONG;
bind[0].buffer = vals;
mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, &count);
rc= mysql_stmt_bind_param(stmt, bind);
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
rc= mysql_query(mysql, "alter table t1 add xx int");
myquery(rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
mysql_stmt_close(stmt);
mysql_close(con);
mysql_query(mysql, "drop table t1");
#endif
}
static struct my_tests_st my_tests[]= { static struct my_tests_st my_tests[]= {
{ "test_mdev_20516", test_mdev_20516 }, { "test_mdev_20516", test_mdev_20516 },
{ "test_mdev24827", test_mdev24827 }, { "test_mdev24827", test_mdev24827 },
@ -23206,6 +23256,7 @@ static struct my_tests_st my_tests[]= {
{ "test_mdev_34958", test_mdev_34958 }, { "test_mdev_34958", test_mdev_34958 },
#endif #endif
{ "test_mdev_10075", test_mdev_10075}, { "test_mdev_10075", test_mdev_10075},
{ "test_mdev35953", test_mdev35953 },
{ 0, 0 } { 0, 0 }
}; };