1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-14 13:41:20 +03:00

Merge branch '10.6' into 10.11

This commit is contained in:
Sergei Golubchik
2024-02-01 18:36:14 +01:00
190 changed files with 6076 additions and 1654 deletions

View File

@ -1712,3 +1712,32 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*************************************************************************** ***************************************************************************
%%The following software may be included in this product:
socketpair.c
Copyright 2007, 2010 by Nathan C. Myers <ncm@cantrip.org>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
The name of the author must not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

View File

@ -261,6 +261,9 @@ static int connect_flag=CLIENT_INTERACTIVE;
static my_bool opt_binary_mode= FALSE; static my_bool opt_binary_mode= FALSE;
static my_bool opt_connect_expired_password= FALSE; static my_bool opt_connect_expired_password= FALSE;
static int interrupted_query= 0; static int interrupted_query= 0;
#ifdef USE_LIBEDIT_INTERFACE
static int sigint_received= 0;
#endif
static char *current_host,*current_db,*current_user=0,*opt_password=0, static char *current_host,*current_db,*current_user=0,*opt_password=0,
*current_prompt=0, *delimiter_str= 0, *current_prompt=0, *delimiter_str= 0,
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME, *default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME,
@ -1162,6 +1165,8 @@ extern "C" sig_handler handle_sigint(int sig);
static sig_handler window_resize(int sig); static sig_handler window_resize(int sig);
#endif #endif
static void end_in_sig_handler(int sig);
static bool kill_query(const char *reason);
const char DELIMITER_NAME[]= "delimiter"; const char DELIMITER_NAME[]= "delimiter";
const uint DELIMITER_NAME_LEN= sizeof(DELIMITER_NAME) - 1; const uint DELIMITER_NAME_LEN= sizeof(DELIMITER_NAME) - 1;
@ -1301,8 +1306,8 @@ int main(int argc,char *argv[])
if (opt_sigint_ignore) if (opt_sigint_ignore)
signal(SIGINT, SIG_IGN); signal(SIGINT, SIG_IGN);
else else
signal(SIGINT, handle_sigint); // Catch SIGINT to clean up signal(SIGINT, handle_sigint); // Catch SIGINT to clean up
signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up signal(SIGQUIT, mysql_end); // Catch SIGQUIT to clean up
#if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL) #if defined(HAVE_TERMIOS_H) && defined(GWINSZ_IN_SYS_IOCTL)
/* Readline will call this if it installs a handler */ /* Readline will call this if it installs a handler */
@ -1512,30 +1517,35 @@ static bool do_connect(MYSQL *mysql, const char *host, const char *user,
} }
/* void end_in_sig_handler(int sig)
This function handles sigint calls {
If query is in process, kill query #ifdef _WIN32
If 'source' is executed, abort source command /*
no query in process, terminate like previous behavior When SIGINT is raised on Windows, the OS creates a new thread to handle the
*/ interrupt. Once that thread completes, the main thread continues running
only to find that it's resources have already been free'd when the sigint
handler called mysql_end().
*/
mysql_thread_end();
#else
mysql_end(sig);
#endif
}
sig_handler handle_sigint(int sig)
/*
Kill a running query. Returns true if we were unable to connect to the server.
*/
bool kill_query(const char *reason)
{ {
char kill_buffer[40]; char kill_buffer[40];
MYSQL *kill_mysql= NULL; MYSQL *kill_mysql= NULL;
/* terminate if no query being executed, or we already tried interrupting */
if (!executing_query || (interrupted_query == 2))
{
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
goto err;
}
kill_mysql= mysql_init(kill_mysql); kill_mysql= mysql_init(kill_mysql);
if (!do_connect(kill_mysql,current_host, current_user, opt_password, "", 0)) if (!do_connect(kill_mysql,current_host, current_user, opt_password, "", 0))
{ {
tee_fprintf(stdout, "Ctrl-C -- sorry, cannot connect to server to kill query, giving up ...\n"); tee_fprintf(stdout, "%s -- sorry, cannot connect to server to kill query, giving up ...\n", reason);
goto err; return true;
} }
/* First time try to kill the query, second time the connection */ /* First time try to kill the query, second time the connection */
@ -1550,27 +1560,62 @@ sig_handler handle_sigint(int sig)
(interrupted_query == 1) ? "QUERY " : "", (interrupted_query == 1) ? "QUERY " : "",
mysql_thread_id(&mysql)); mysql_thread_id(&mysql));
if (verbose) if (verbose)
tee_fprintf(stdout, "Ctrl-C -- sending \"%s\" to server ...\n", tee_fprintf(stdout, "%s -- sending \"%s\" to server ...\n", reason,
kill_buffer); kill_buffer);
mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer)); mysql_real_query(kill_mysql, kill_buffer, (uint) strlen(kill_buffer));
mysql_close(kill_mysql); mysql_close(kill_mysql);
tee_fprintf(stdout, "Ctrl-C -- query killed. Continuing normally.\n"); if (interrupted_query == 1)
tee_fprintf(stdout, "%s -- query killed.\n", reason);
else
tee_fprintf(stdout, "%s -- connection killed.\n", reason);
if (in_com_source) if (in_com_source)
aborted= 1; // Abort source command aborted= 1; // Abort source command
return; return false;
}
err: /*
#ifdef _WIN32 This function handles sigint calls
If query is in process, kill query
If 'source' is executed, abort source command
no query in process, regenerate prompt.
*/
sig_handler handle_sigint(int sig)
{
/* /*
When SIGINT is raised on Windows, the OS creates a new thread to handle the On Unix only, if no query is being executed just clear the prompt,
interrupt. Once that thread completes, the main thread continues running don't exit. On Windows we exit.
only to find that it's resources have already been free'd when the sigint
handler called mysql_end().
*/ */
mysql_thread_end(); if (!executing_query)
{
#ifndef _WIN32
tee_fprintf(stdout, "^C\n");
#ifdef USE_LIBEDIT_INTERFACE
/* Libedit will regenerate it outside of the signal handler. */
sigint_received= 1;
#else #else
mysql_end(sig); rl_on_new_line(); // Regenerate the prompt on a newline
#endif rl_replace_line("", 0); // Clear the previous text
rl_redisplay();
#endif
#else // WIN32
tee_fprintf(stdout, "Ctrl-C -- exit!\n");
end_in_sig_handler(sig);
#endif
return;
}
/*
When executing a query, this newline makes the prompt look like so:
^C
Ctrl-C -- query killed.
*/
tee_fprintf(stdout, "\n");
if (kill_query("Ctrl-C"))
{
aborted= 1;
end_in_sig_handler(sig);
}
} }
@ -2137,6 +2182,15 @@ static int get_options(int argc, char **argv)
return(0); return(0);
} }
#if !defined(_WIN32) && defined(USE_LIBEDIT_INTERFACE)
static inline void reset_prompt(char *in_string, bool *ml_comment) {
glob_buffer.length(0);
*ml_comment = false;
*in_string = 0;
}
#endif
static int read_and_execute(bool interactive) static int read_and_execute(bool interactive)
{ {
char *line= NULL; char *line= NULL;
@ -2228,7 +2282,30 @@ static int read_and_execute(bool interactive)
if (line) if (line)
free(line); free(line);
line= readline(prompt); line= readline(prompt);
#endif /* defined(_WIN32) */ #ifdef USE_LIBEDIT_INTERFACE
/*
libedit handles interrupts different than libreadline.
libreadline has its own signal handlers, thus a sigint during readline
doesn't force readline to return null string.
However libedit returns null if the interrupt signal is raised.
We can also get an empty string when ctrl+d is pressed (EoF).
We need this sigint_received flag, to differentiate between the two
cases. This flag is only set during our handle_sigint function when
LIBEDIT_INTERFACE is used.
*/
if (!line && sigint_received)
{
// User asked to clear the input.
sigint_received= 0;
reset_prompt(&in_string, &ml_comment);
continue;
}
// For safety, we always mark this as cleared.
sigint_received= 0;
#endif
#endif /* defined(__WIN__) */
/* /*
When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS

View File

@ -4698,15 +4698,11 @@ void do_perl(struct st_command *command)
/* Check for error code that indicates perl could not be started */ /* Check for error code that indicates perl could not be started */
int exstat= WEXITSTATUS(error); int exstat= WEXITSTATUS(error);
#ifdef _WIN32 #ifndef _WIN32
if (exstat == 1)
/* Text must begin 'perl not found' as mtr looks for it */
abort_not_supported_test("perl not found in path or did not start");
#else
if (exstat == 127) if (exstat == 127)
abort_not_supported_test("perl not found in path"); abort_not_supported_test("perl not found in path");
#endif
else else
#endif
handle_command_error(command, exstat, my_errno); handle_command_error(command, exstat, my_errno);
} }
dynstr_free(&ds_delimiter); dynstr_free(&ds_delimiter);

View File

@ -102,11 +102,7 @@ IF(NOT VERSION)
SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}") SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}")
ENDIF() ENDIF()
ELSE() ELSE()
IF(64BIT) SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
SET(DEFAULT_MACHINE "x86_64")
ELSE()
SET(DEFAULT_MACHINE "i386")
ENDIF()
ENDIF() ENDIF()
IF(DEFAULT_MACHINE MATCHES "i386") IF(DEFAULT_MACHINE MATCHES "i386")

View File

@ -81,18 +81,15 @@ MACRO (CHECK_PCRE)
FIND_PACKAGE(PkgConfig QUIET) FIND_PACKAGE(PkgConfig QUIET)
PKG_CHECK_MODULES(PCRE libpcre2-8) PKG_CHECK_MODULES(PCRE libpcre2-8)
# in case pkg-config or libpcre2-8.pc is not installed: # in case pkg-config or libpcre2-8.pc is not installed:
IF(NOT PCRE_FOUND) CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "${PCRE_LIBRARY_DIRS}" HAVE_PCRE2_MATCH_8)
UNSET(PCRE_FOUND CACHE)
CHECK_LIBRARY_EXISTS(pcre2-8 pcre2_match_8 "" PCRE_FOUND)
ENDIF()
ENDIF() ENDIF()
IF(NOT PCRE_FOUND OR WITH_PCRE STREQUAL "bundled") IF(NOT HAVE_PCRE2_MATCH_8 OR WITH_PCRE STREQUAL "bundled")
IF (WITH_PCRE STREQUAL "system") IF (WITH_PCRE STREQUAL "system")
MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable") MESSAGE(FATAL_ERROR "system pcre2-8 library is not found or unusable")
ENDIF() ENDIF()
BUNDLE_PCRE2() BUNDLE_PCRE2()
ELSE() ELSE()
CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "" NEEDS_PCRE2_DEBIAN_HACK) CHECK_LIBRARY_EXISTS(pcre2-posix PCRE2regcomp "${PCRE_LIBRARY_DIRS}" NEEDS_PCRE2_DEBIAN_HACK)
IF(NEEDS_PCRE2_DEBIAN_HACK) IF(NEEDS_PCRE2_DEBIAN_HACK)
SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree") SET(PCRE2_DEBIAN_HACK "-Dregcomp=PCRE2regcomp -Dregexec=PCRE2regexec -Dregerror=PCRE2regerror -Dregfree=PCRE2regfree")
ENDIF() ENDIF()

View File

@ -114,6 +114,9 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE)
{ {
rl_completion_func_t *func1= (rl_completion_func_t*)0; rl_completion_func_t *func1= (rl_completion_func_t*)0;
rl_compentry_func_t *func2= (rl_compentry_func_t*)0; rl_compentry_func_t *func2= (rl_compentry_func_t*)0;
rl_on_new_line();
rl_replace_line(\"\", 0);
rl_redisplay();
}" }"
NEW_READLINE_INTERFACE) NEW_READLINE_INTERFACE)

View File

@ -73,6 +73,7 @@
#cmakedefine HAVE_SYS_IOCTL_H 1 #cmakedefine HAVE_SYS_IOCTL_H 1
#cmakedefine HAVE_SYS_MALLOC_H 1 #cmakedefine HAVE_SYS_MALLOC_H 1
#cmakedefine HAVE_SYS_MMAN_H 1 #cmakedefine HAVE_SYS_MMAN_H 1
#cmakedefine HAVE_SYS_MNTENT_H 1
#cmakedefine HAVE_SYS_NDIR_H 1 #cmakedefine HAVE_SYS_NDIR_H 1
#cmakedefine HAVE_SYS_PTE_H 1 #cmakedefine HAVE_SYS_PTE_H 1
#cmakedefine HAVE_SYS_PTEM_H 1 #cmakedefine HAVE_SYS_PTEM_H 1

View File

@ -2291,7 +2291,7 @@ ds_ctxt_t::make_hardlink(const char *from_path, const char *to_path)
} }
else else
{ {
strncpy(to_path_full, to_path, sizeof(to_path_full)); strncpy(to_path_full, to_path, sizeof(to_path_full)-1);
} }
#ifdef _WIN32 #ifdef _WIN32
return CreateHardLink(to_path_full, from_path, NULL); return CreateHardLink(to_path_full, from_path, NULL);

View File

@ -2191,7 +2191,7 @@ static bool innodb_init_param()
/* Check that values don't overflow on 32-bit systems. */ /* Check that values don't overflow on 32-bit systems. */
if (sizeof(ulint) == 4) { if (sizeof(ulint) == 4) {
if (xtrabackup_use_memory > UINT_MAX32) { if (xtrabackup_use_memory > (longlong) UINT_MAX32) {
msg("mariabackup: use-memory can't be over 4GB" msg("mariabackup: use-memory can't be over 4GB"
" on 32-bit systems"); " on 32-bit systems");
} }

View File

@ -28,6 +28,11 @@
#define NO_OLD_TIMEVAL_NAME #define NO_OLD_TIMEVAL_NAME
#define HAVE_SECURE_RENEGOTIATION #define HAVE_SECURE_RENEGOTIATION
#define HAVE_EXTENDED_MASTER #define HAVE_EXTENDED_MASTER
/*
Following is workaround about a WolfSSL 5.6.6 bug.
The bug is about undefined sessionCtxSz during compilation.
*/
#define WOLFSSL_SESSION_ID_CTX
/* TLSv1.3 definitions (all needed to build) */ /* TLSv1.3 definitions (all needed to build) */
#define WOLFSSL_TLS13 #define WOLFSSL_TLS13

View File

@ -477,7 +477,7 @@ typedef struct st_net {
char net_skip_rest_factor; char net_skip_rest_factor;
my_bool thread_specific_malloc; my_bool thread_specific_malloc;
unsigned char compress; unsigned char compress;
my_bool unused3; /* Please remove with the next incompatible ABI change. */ my_bool pkt_nr_can_be_reset;
/* /*
Pointer to query object in query cache, do not equal NULL (0) for Pointer to query object in query cache, do not equal NULL (0) for
queries in cache that have not stored its results yet queries in cache that have not stored its results yet

View File

@ -3229,7 +3229,8 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t
{ {
longlong data= my_strtoll10(value, &endptr, &err); longlong data= my_strtoll10(value, &endptr, &err);
*param->error= (IS_TRUNCATED(data, param->is_unsigned, *param->error= (IS_TRUNCATED(data, param->is_unsigned,
INT_MIN32, INT_MAX32, UINT_MAX32) || err > 0); (longlong) INT_MIN32, (longlong) INT_MAX32,
(longlong) UINT_MAX32) || err > 0);
longstore(buffer, (int32) data); longstore(buffer, (int32) data);
break; break;
} }
@ -3346,7 +3347,8 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
break; break;
case MYSQL_TYPE_LONG: case MYSQL_TYPE_LONG:
*param->error= IS_TRUNCATED(value, param->is_unsigned, *param->error= IS_TRUNCATED(value, param->is_unsigned,
INT_MIN32, INT_MAX32, UINT_MAX32); (longlong) INT_MIN32, (longlong) INT_MAX32,
(longlong) UINT_MAX32);
longstore(buffer, (int32) value); longstore(buffer, (int32) value);
break; break;
case MYSQL_TYPE_LONGLONG: case MYSQL_TYPE_LONGLONG:

View File

@ -0,0 +1,30 @@
# Purpose:
# Print first LINES_TO_READ from a file.
# The environment variables SEARCH_FILE and LINES_TO_READ must be set
# before sourcing this routine.
# Use:
# When the test is slow ( example because of ASAN build) then it
# may not flush the lines when 'cat' command is called and the
# test could fail with missing lines. Hence this can be used to
# to print first N lines.
#
perl;
use strict;
my $search_file = $ENV{SEARCH_FILE} or die "SEARCH_FILE not set";
my $lines_to_read = $ENV{LINES_TO_READ} or die "LINES_TO_READ not set";
open(FILE, '<', $search_file) or die "Can't open file $search_file: $!";
my $line_count = 0;
while ($line_count < $lines_to_read and my $line = <FILE>)
{
print $line;
$line_count++;
}
close(FILE);
EOF

View File

@ -51,12 +51,15 @@
# Created: 2011-11-11 mleich # Created: 2011-11-11 mleich
# #
--error 0,1
perl; perl;
use strict; use strict;
die "SEARCH_FILE not set" unless $ENV{SEARCH_FILE}; die "SEARCH_FILE not set" unless $ENV{SEARCH_FILE};
my @search_files= glob($ENV{SEARCH_FILE}); my @search_files= glob($ENV{SEARCH_FILE});
my $search_pattern= $ENV{SEARCH_PATTERN} or die "SEARCH_PATTERN not set"; my $search_pattern= $ENV{SEARCH_PATTERN} or die "SEARCH_PATTERN not set";
my $search_range= $ENV{SEARCH_RANGE}; my $search_range= $ENV{SEARCH_RANGE};
my $silent= $ENV{SEARCH_SILENT};
my $search_result= 0;
my $content; my $content;
foreach my $search_file (@search_files) { foreach my $search_file (@search_files) {
open(FILE, '<', $search_file) || die("Can't open file $search_file: $!"); open(FILE, '<', $search_file) || die("Can't open file $search_file: $!");
@ -89,16 +92,39 @@ perl;
{ {
@matches=($content =~ /$search_pattern/gm); @matches=($content =~ /$search_pattern/gm);
} }
my $res=@matches ? "FOUND " . scalar(@matches) : "NOT FOUND"; my $res;
if (@matches)
{
$res="FOUND " . scalar(@matches);
$search_result= 1;
}
else
{
$res= "NOT FOUND";
}
$ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1}; $ENV{SEARCH_FILE} =~ s{^.*?([^/\\]+)$}{$1};
if ($ENV{SEARCH_OUTPUT} eq "matches") { if (!$silent || $search_result)
foreach (@matches) { {
print $_ . "\n"; if ($ENV{SEARCH_OUTPUT} eq "matches")
} {
} else { foreach (@matches)
print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n"; {
print $_ . "\n";
}
}
else
{
print "$res /$search_pattern/ in $ENV{SEARCH_FILE}\n";
}
} }
die "$ENV{SEARCH_ABORT}\n" die "$ENV{SEARCH_ABORT}\n"
if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/; if $ENV{SEARCH_ABORT} && $res =~ /^$ENV{SEARCH_ABORT}/;
exit($search_result != 1);
EOF EOF
let $SEARCH_RESULT= 1; # Found pattern
if ($errno)
{
let $SEARCH_RESULT= 0; # Did not find pattern
}

View File

@ -0,0 +1,56 @@
# ==== Purpose ====
#
# Waits until pattern comes into log file or until a timeout is reached.
# This is a timeout wrapper for search_pattern_in_file.inc
#
#
# ==== Usage ====
#
# [--let $timeout= NUMBER in seconds]
# For other parameters, check search_pattern_in_file.inc
--let $wait_save_keep_include_silent=$keep_include_silent
--let $include_filename= wait_for_pattern_in_file.inc
--source include/begin_include_file.inc
--let $keep_include_silent= 1
let $_timeout= $timeout;
if (!$_timeout)
{
let $_timeout= 10;
if ($VALGRIND_TEST)
{
let $_timeout= 30;
}
}
let $_timeout_counter=`SELECT $_timeout * 10`;
let SEARCH_SILENT=1;
let $_continue= 1;
while ($_continue)
{
source include/search_pattern_in_file.inc;
if ($SEARCH_RESULT)
{
# Found match
let $_continue= 0;
}
if (!$SEARCH_RESULT)
{
dec $_timeout_counter;
if ($_timeout_counter == 1)
{
let $SEARCH_SILENT= 0;
}
if (!$_timeout_counter)
{
let $_continue= 0;
}
}
}
let SEARCH_SILENT=0;
--source include/end_include_file.inc
--let $keep_include_silent=$wait_save_keep_include_silent

View File

@ -458,3 +458,43 @@ id select_type table type possible_keys key key_len ref rows Extra
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
Warnings: Warnings:
Note 1249 Select 4 was reduced during optimization Note 1249 Select 4 was reduced during optimization
#
# End of 10.4 tests
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
EXPLAIN SELECT * FROM t1, t2 WHERE t2.b IN (SELECT 5 UNION SELECT 6);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
EXPLAIN DELETE t2 FROM t1, t2 WHERE t2.b IN (SELECT 5 UNION SELECT 6);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
prepare stmt from "EXPLAIN DELETE t2 FROM t1, t2 WHERE t2.b IN (SELECT 5 UNION SELECT 6)";
execute stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
execute stmt;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY NULL NULL NULL NULL NULL NULL NULL No tables used
3 DEPENDENT UNION NULL NULL NULL NULL NULL NULL NULL No tables used
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
DROP TABLE t1, t2;
#
# End of 10.5 tests
#

View File

@ -372,3 +372,26 @@ drop table t1;
explain explain
VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3)); VALUES ( (VALUES (2))) UNION VALUES ( (SELECT 3));
--enable_ps_protocol --enable_ps_protocol
--echo #
--echo # End of 10.4 tests
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT);
INSERT INTO t2 VALUES (3),(4);
EXPLAIN SELECT * FROM t1, t2 WHERE t2.b IN (SELECT 5 UNION SELECT 6);
EXPLAIN DELETE t2 FROM t1, t2 WHERE t2.b IN (SELECT 5 UNION SELECT 6);
prepare stmt from "EXPLAIN DELETE t2 FROM t1, t2 WHERE t2.b IN (SELECT 5 UNION SELECT 6)";
execute stmt;
execute stmt;
# Cleanup
DROP TABLE t1, t2;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@ -1460,6 +1460,39 @@ f
foo foo
SET @@COLLATION_CONNECTION= @old_collation_connection; SET @@COLLATION_CONNECTION= @old_collation_connection;
# #
# MDEV-32587 JSON_VALID fail to validate integer zero in scientific notation
#
select JSON_VALID(' {"number": 1E-4}');
JSON_VALID(' {"number": 1E-4}')
1
select JSON_VALID(' {"number": 0E-4}');
JSON_VALID(' {"number": 0E-4}')
1
select JSON_VALID(' {"number": 0.0}');
JSON_VALID(' {"number": 0.0}')
1
select JSON_VALID(' {"number": 0.1E-4}');
JSON_VALID(' {"number": 0.1E-4}')
1
select JSON_VALID(' {"number": 0e-4}');
JSON_VALID(' {"number": 0e-4}')
1
select JSON_VALID(' {"number": -0E-4}');
JSON_VALID(' {"number": -0E-4}')
1
select JSON_VALUE(' {"number": 0E-4}', '$.number');
JSON_VALUE(' {"number": 0E-4}', '$.number')
0E-4
select JSON_VALID(' {"number": 00E-4}');
JSON_VALID(' {"number": 00E-4}')
0
select JSON_VALID(' {"number": 01E-4}');
JSON_VALID(' {"number": 01E-4}')
0
select JSON_VALID(' {"number": 0E-4.0}');
JSON_VALID(' {"number": 0E-4.0}')
0
#
# End of 10.4 tests # End of 10.4 tests
# #
# #

View File

@ -947,6 +947,22 @@ SELECT JSON_VALUE('["foo"]', '$**[0]') AS f;
SET @@COLLATION_CONNECTION= @old_collation_connection; SET @@COLLATION_CONNECTION= @old_collation_connection;
--echo #
--echo # MDEV-32587 JSON_VALID fail to validate integer zero in scientific notation
--echo #
# Passing
select JSON_VALID(' {"number": 1E-4}');
select JSON_VALID(' {"number": 0E-4}');
select JSON_VALID(' {"number": 0.0}');
select JSON_VALID(' {"number": 0.1E-4}');
select JSON_VALID(' {"number": 0e-4}');
select JSON_VALID(' {"number": -0E-4}');
select JSON_VALUE(' {"number": 0E-4}', '$.number');
# Failing
select JSON_VALID(' {"number": 00E-4}');
select JSON_VALID(' {"number": 01E-4}');
select JSON_VALID(' {"number": 0E-4.0}');
--echo # --echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #

View File

@ -5286,6 +5286,33 @@ ERROR 42000: Incorrect parameter count in the call to native function 'DECODE'
# End of 10.4 tests # End of 10.4 tests
# #
# #
# Start of 10.5 tests
#
#
# MDEV-28651 quote(NULL) returns incorrect result in view ('NU' instead of 'NULL')
#
CREATE VIEW v1 AS SELECT quote(NULL);
SELECT * FROM v1;
quote(NULL)
NULL
DESCRIBE v1;
Field Type Null Key Default Extra
quote(NULL) varbinary(4) YES NULL
CREATE TABLE t1 AS SELECT * FROM v1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`quote(NULL)` varbinary(4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT * FROM t1;
quote(NULL)
NULL
DROP TABLE t1;
DROP VIEW v1;
#
# End of 10.5 tests
#
#
# MDEV-25704 Function random_bytes # MDEV-25704 Function random_bytes
# #
create table t1 as select random_bytes(100); create table t1 as select random_bytes(100);

View File

@ -2333,6 +2333,28 @@ SELECT DECODE(NULL, NULL, NULL);
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-28651 quote(NULL) returns incorrect result in view ('NU' instead of 'NULL')
--echo #
CREATE VIEW v1 AS SELECT quote(NULL);
SELECT * FROM v1;
DESCRIBE v1;
CREATE TABLE t1 AS SELECT * FROM v1;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
DROP VIEW v1;
--echo #
--echo # End of 10.5 tests
--echo #
--echo # --echo #
--echo # MDEV-25704 Function random_bytes --echo # MDEV-25704 Function random_bytes
--echo # --echo #

View File

@ -1,5 +1,5 @@
-- source include/have_geometry.inc -- source include/have_geometry.inc
-- source include/not_embedded.inc
# #
# Spatial objects # Spatial objects

View File

@ -1,14 +1,9 @@
SET SQL_MODE=""; SET SQL_MODE="";
SET @old_general_log_state = @@global.general_log;
SET @old_log_output= @@global.log_output; SET @old_log_output= @@global.log_output;
SET @old_slow_query_log= @@global.slow_query_log; SET @old_slow_query_log= @@global.slow_query_log;
SET @old_general_log= @@global.general_log; SET @old_general_log= @@global.general_log;
SET @old_long_query_time= @@session.long_query_time; SET @old_long_query_time= @@session.long_query_time;
use mysql; use mysql;
SET @saved_long_query_time = @@long_query_time;
SET @saved_log_output = @@log_output;
SET @saved_general_log = @@GLOBAL.general_log;
SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
truncate table general_log; truncate table general_log;
select * from general_log; select * from general_log;
event_time user_host thread_id server_id command_type argument event_time user_host thread_id server_id command_type argument
@ -120,6 +115,9 @@ show open tables;
Database Table In_use Name_locked Database Table In_use Name_locked
SET GLOBAL GENERAL_LOG=ON; SET GLOBAL GENERAL_LOG=ON;
SET GLOBAL SLOW_QUERY_LOG=ON; SET GLOBAL SLOW_QUERY_LOG=ON;
#
# Bug#23924 general_log truncates queries with character set introducers.
#
truncate table mysql.general_log; truncate table mysql.general_log;
set names binary; set names binary;
select _koi8r'<27><><EFBFBD><EFBFBD>' as test; select _koi8r'<27><><EFBFBD><EFBFBD>' as test;
@ -131,6 +129,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query set names binary
TIMESTAMP USER_HOST THREAD_ID 1 Query select _koi8r'\xD4\xC5\xD3\xD4' as test TIMESTAMP USER_HOST THREAD_ID 1 Query select _koi8r'\xD4\xC5\xD3\xD4' as test
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
set names utf8; set names utf8;
#
# Bug #16905 Log tables: unicode statements are logged incorrectly
#
truncate table mysql.general_log; truncate table mysql.general_log;
set names utf8; set names utf8;
create table bug16905 (s char(15) character set utf8 default 'пусто'); create table bug16905 (s char(15) character set utf8 default 'пусто');
@ -142,6 +143,9 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query create table bug16905 (s char(15) characte
TIMESTAMP USER_HOST THREAD_ID 1 Query insert into bug16905 values ('новое') TIMESTAMP USER_HOST THREAD_ID 1 Query insert into bug16905 values ('новое')
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.general_log
drop table bug16905; drop table bug16905;
#
# Bug #17600: Invalid data logged into mysql.slow_log
#
truncate table mysql.slow_log; truncate table mysql.slow_log;
set session long_query_time=1; set session long_query_time=1;
select sleep(2); select sleep(2);
@ -150,7 +154,11 @@ sleep(2)
select * from mysql.slow_log; select * from mysql.slow_log;
start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected start_time user_host query_time lock_time rows_sent rows_examined db last_insert_id insert_id server_id sql_text thread_id rows_affected
TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID 0 TIMESTAMP USER_HOST QUERY_TIME 00:00:00.000000 1 0 mysql 0 0 1 select sleep(2) THREAD_ID 0
set @@session.long_query_time = @saved_long_query_time; set @@session.long_query_time = @old_long_query_time;
#
# Bug #18559 log tables cannot change engine, and gets deadlocked when
# dropping w/ log on
#
alter table mysql.general_log engine=myisam; alter table mysql.general_log engine=myisam;
ERROR HY000: You cannot 'ALTER' a log table if logging is enabled ERROR HY000: You cannot 'ALTER' a log table if logging is enabled
alter table mysql.slow_log engine=myisam; alter table mysql.slow_log engine=myisam;
@ -232,7 +240,7 @@ TIMESTAMP USER_HOST THREAD_ID 1 Query truncate table mysql.slow_log
TIMESTAMP USER_HOST THREAD_ID 1 Query set session long_query_time=1 TIMESTAMP USER_HOST THREAD_ID 1 Query set session long_query_time=1
TIMESTAMP USER_HOST THREAD_ID 1 Query select sleep(2) TIMESTAMP USER_HOST THREAD_ID 1 Query select sleep(2)
TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.slow_log TIMESTAMP USER_HOST THREAD_ID 1 Query select * from mysql.slow_log
TIMESTAMP USER_HOST THREAD_ID 1 Query set @@session.long_query_time = @saved_long_query_time TIMESTAMP USER_HOST THREAD_ID 1 Query set @@session.long_query_time = @old_long_query_time
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.general_log engine=myisam TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.general_log engine=myisam
TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.slow_log engine=myisam TIMESTAMP USER_HOST THREAD_ID 1 Query alter table mysql.slow_log engine=myisam
TIMESTAMP USER_HOST THREAD_ID 1 Query drop table mysql.general_log TIMESTAMP USER_HOST THREAD_ID 1 Query drop table mysql.general_log
@ -300,17 +308,20 @@ ON UPDATE CURRENT_TIMESTAMP,
set global general_log='ON'; set global general_log='ON';
set global slow_query_log='ON'; set global slow_query_log='ON';
use test; use test;
#
# Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
#
flush tables with read lock; flush tables with read lock;
unlock tables; unlock tables;
use mysql; use mysql;
lock tables general_log read local, help_category read local; lock tables general_log read local, help_category read local;
ERROR HY000: You can't use locks with log tables ERROR HY000: You can't use locks with log tables
unlock tables; unlock tables;
#
# Bug #17544 Cannot do atomic log rotate and
# Bug #21785 Server crashes after rename of the log table
#
SET SESSION long_query_time = 1000; SET SESSION long_query_time = 1000;
drop table if exists mysql.renamed_general_log;
drop table if exists mysql.renamed_slow_log;
drop table if exists mysql.general_log_new;
drop table if exists mysql.slow_log_new;
use mysql; use mysql;
RENAME TABLE general_log TO renamed_general_log; RENAME TABLE general_log TO renamed_general_log;
ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log' ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
@ -356,13 +367,16 @@ set global slow_query_log='ON';
ERROR 42S02: Table 'mysql.slow_log' doesn't exist ERROR 42S02: Table 'mysql.slow_log' doesn't exist
RENAME TABLE general_log2 TO general_log; RENAME TABLE general_log2 TO general_log;
RENAME TABLE slow_log2 TO slow_log; RENAME TABLE slow_log2 TO slow_log;
SET SESSION long_query_time = @saved_long_query_time; SET SESSION long_query_time = @old_long_query_time;
set global general_log='ON'; set global general_log='ON';
set global slow_query_log='ON'; set global slow_query_log='ON';
flush logs; flush logs;
flush logs; flush logs;
drop table renamed_general_log, renamed_slow_log; drop table renamed_general_log, renamed_slow_log;
use test; use test;
#
# Bug #21966 Strange warnings on repair of the log tables
#
use mysql; use mysql;
repair table general_log; repair table general_log;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
@ -380,6 +394,10 @@ slow_log
slow_log_new slow_log_new
drop table slow_log_new, general_log_new; drop table slow_log_new, general_log_new;
use test; use test;
#
# Bug#69953 / MDEV-4851
# Log tables should be modifable on LOG_OUTPUT != TABLE
#
SET GLOBAL LOG_OUTPUT = 'FILE'; SET GLOBAL LOG_OUTPUT = 'FILE';
SET GLOBAL slow_query_log = 1; SET GLOBAL slow_query_log = 1;
SET GLOBAL general_log = 1; SET GLOBAL general_log = 1;
@ -388,6 +406,10 @@ ALTER TABLE mysql.general_log ADD COLUMN comment_text TEXT NOT NULL;
SET GLOBAL LOG_OUTPUT = 'NONE'; SET GLOBAL LOG_OUTPUT = 'NONE';
ALTER TABLE mysql.slow_log DROP COLUMN comment_text; ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
ALTER TABLE mysql.general_log DROP COLUMN comment_text; ALTER TABLE mysql.general_log DROP COLUMN comment_text;
#
# Bug#27857 (Log tables supplies the wrong value for generating
# AUTO_INCREMENT numbers)
#
SET GLOBAL LOG_OUTPUT = 'TABLE'; SET GLOBAL LOG_OUTPUT = 'TABLE';
SET GLOBAL general_log = 0; SET GLOBAL general_log = 0;
FLUSH LOGS; FLUSH LOGS;
@ -451,16 +473,15 @@ START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own sl
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 3 START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 3
START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 4 START_TIME USER_HOST QUERY_TIME 00:00:00.000000 1 0 test 0 0 1 SELECT "My own slow query", sleep(2) THREAD_ID 0 4
SET GLOBAL slow_query_log = 0; SET GLOBAL slow_query_log = 0;
SET SESSION long_query_time =@saved_long_query_time; SET SESSION long_query_time =@old_long_query_time;
FLUSH LOGS; FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq; ALTER TABLE mysql.slow_log DROP COLUMN seq;
ALTER TABLE mysql.slow_log ENGINE = CSV; ALTER TABLE mysql.slow_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log; SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log; SET GLOBAL slow_query_log = @old_slow_query_log;
drop procedure if exists proc25422_truncate_slow; #
drop procedure if exists proc25422_truncate_general; # Bug#25422 (Hang with log tables)
drop procedure if exists proc25422_alter_slow; #
drop procedure if exists proc25422_alter_general;
use test// use test//
create procedure proc25422_truncate_slow (loops int) create procedure proc25422_truncate_slow (loops int)
begin begin
@ -485,26 +506,26 @@ end//
create procedure proc25422_alter_slow (loops int) create procedure proc25422_alter_slow (loops int)
begin begin
declare v1 int default 0; declare v1 int default 0;
declare old_log_state int default @@global.slow_query_log;
declare ER_BAD_LOG_STATEMENT condition for 1575; declare ER_BAD_LOG_STATEMENT condition for 1575;
declare continue handler for ER_BAD_LOG_STATEMENT begin end; declare continue handler for ER_BAD_LOG_STATEMENT begin end;
while v1 < loops do while v1 < loops do
set @old_log_state = @@global.slow_query_log;
set global slow_query_log = 'OFF'; set global slow_query_log = 'OFF';
alter table mysql.slow_log engine = CSV; alter table mysql.slow_log engine = CSV;
set global slow_query_log = @old_log_state; set global slow_query_log = old_log_state;
set v1 = v1 + 1; set v1 = v1 + 1;
end while; end while;
end// end//
create procedure proc25422_alter_general (loops int) create procedure proc25422_alter_general (loops int)
begin begin
declare v1 int default 0; declare v1 int default 0;
declare old_log_state int default @@global.general_log;
declare ER_BAD_LOG_STATEMENT condition for 1575; declare ER_BAD_LOG_STATEMENT condition for 1575;
declare continue handler for ER_BAD_LOG_STATEMENT begin end; declare continue handler for ER_BAD_LOG_STATEMENT begin end;
while v1 < loops do while v1 < loops do
set @old_log_state = @@global.general_log;
set global general_log = 'OFF'; set global general_log = 'OFF';
alter table mysql.general_log engine = CSV; alter table mysql.general_log engine = CSV;
set global general_log = @old_log_state; set global general_log = old_log_state;
set v1 = v1 + 1; set v1 = v1 + 1;
end while; end while;
end// end//
@ -563,17 +584,19 @@ drop procedure proc25422_truncate_slow;
drop procedure proc25422_truncate_general; drop procedure proc25422_truncate_general;
drop procedure proc25422_alter_slow; drop procedure proc25422_alter_slow;
drop procedure proc25422_alter_general; drop procedure proc25422_alter_general;
#
# Bug#23044 (Warnings on flush of a log table)
#
FLUSH TABLE mysql.general_log; FLUSH TABLE mysql.general_log;
show warnings; show warnings;
Level Code Message Level Code Message
FLUSH TABLE mysql.slow_log; FLUSH TABLE mysql.slow_log;
show warnings; show warnings;
Level Code Message Level Code Message
DROP TABLE IF EXISTS `db_17876.slow_log_data`; #
DROP TABLE IF EXISTS `db_17876.general_log_data`; # Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`; # thread)
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`; #
DROP DATABASE IF EXISTS `db_17876`;
CREATE DATABASE db_17876; CREATE DATABASE db_17876;
CREATE TABLE `db_17876.slow_log_data` ( CREATE TABLE `db_17876.slow_log_data` (
`start_time` timestamp(6) default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `start_time` timestamp(6) default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
@ -686,6 +709,9 @@ DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`; DROP DATABASE IF EXISTS `db_17876`;
SET GLOBAL general_log = @old_general_log; SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log; SET GLOBAL slow_query_log = @old_slow_query_log;
#
# Bug#21557 entries in the general query log truncated at 1000 characters.
#
select CONNECTION_ID() into @thread_id; select CONNECTION_ID() into @thread_id;
truncate table mysql.general_log; truncate table mysql.general_log;
set global general_log = on; set global general_log = on;
@ -902,9 +928,9 @@ select '000 001 002 003 004 005 006 007 008 009010 011 012 013 014 015 016 017 0
set global general_log = off set global general_log = off
deallocate prepare long_query; deallocate prepare long_query;
set global general_log = @old_general_log; set global general_log = @old_general_log;
DROP TABLE IF EXISTS log_count; #
DROP TABLE IF EXISTS slow_log_copy; # Bug#34306: Can't make copy of log tables when server binary log is enabled
DROP TABLE IF EXISTS general_log_copy; #
CREATE TABLE log_count (count BIGINT(21)); CREATE TABLE log_count (count BIGINT(21));
SET GLOBAL general_log = ON; SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON; SET GLOBAL slow_query_log = ON;
@ -926,9 +952,12 @@ CREATE TABLE general_log_copy SELECT * FROM mysql.general_log;
INSERT INTO general_log_copy SELECT * FROM mysql.general_log; INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log)); INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
DROP TABLE general_log_copy; DROP TABLE general_log_copy;
SET GLOBAL general_log = @saved_general_log; SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @saved_slow_query_log; SET GLOBAL slow_query_log = @old_slow_query_log;
DROP TABLE log_count; DROP TABLE log_count;
#
# Bug #31700: thd->examined_row_count not incremented for 'const' type queries
#
SET SESSION long_query_time = 0; SET SESSION long_query_time = 0;
SET GLOBAL slow_query_log = ON; SET GLOBAL slow_query_log = ON;
FLUSH LOGS; FLUSH LOGS;
@ -954,9 +983,10 @@ TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1
TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2 TIMESTAMP 1 1 SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2
DROP TABLE t1; DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
#
# Bug #47924 main.log_tables times out sporadically
#
use mysql; use mysql;
drop table if exists renamed_general_log;
drop table if exists renamed_slow_log;
RENAME TABLE general_log TO renamed_general_log; RENAME TABLE general_log TO renamed_general_log;
ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log' ERROR HY000: Cannot rename 'general_log'. When logging enabled, rename to/from log table must rename two tables: the log table to an archive table and another table back to 'general_log'
RENAME TABLE slow_log TO renamed_slow_log; RENAME TABLE slow_log TO renamed_slow_log;
@ -964,7 +994,34 @@ ERROR HY000: Cannot rename 'slow_log'. When logging enabled, rename to/from log
use test; use test;
flush tables with read lock; flush tables with read lock;
unlock tables; unlock tables;
SET @@session.long_query_time= @old_long_query_time; #
# MDEV-33267 User with minimal permissions can intentionally corrupt mysql.slow_log table
#
truncate mysql.slow_log;
set global log_output= 'TABLE';
create user u@localhost;
set slow_query_log=on, long_query_time=0.1;
select 'before evil-doing', sleep(0.2);
before evil-doing sleep(0.2)
before evil-doing 0
connect con1,localhost,u,,;
set @@timestamp= 2147483647;
set slow_query_log=on, long_query_time=0.1;
select 'evil-doing', sleep(1.1);
evil-doing sleep(1.1)
evil-doing 0
disconnect con1;
connection default;
select 'after evil-doing', sleep(0.2);
after evil-doing sleep(0.2)
after evil-doing 0
select distinct sql_text from mysql.slow_log where sql_text like '%evil%';
sql_text
select 'before evil-doing', sleep(0.2)
select 'evil-doing', sleep(1.1)
select 'after evil-doing', sleep(0.2)
set global log_output=default;
drop user u@localhost;
SET @@global.log_output= @old_log_output; SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log; SET @@global.slow_query_log= @old_slow_query_log;
SET @@global.general_log= @old_general_log; SET @@global.general_log= @old_general_log;

View File

@ -1,13 +1,9 @@
# this test needs multithreaded mysqltest # this test needs multithreaded mysqltest
-- source include/not_embedded.inc -- source include/not_embedded.inc
#
# Basic log tables test
#
# check that CSV engine was compiled in
--source include/have_csv.inc --source include/have_csv.inc
SET SQL_MODE=""; SET SQL_MODE="";
SET @old_general_log_state = @@global.general_log;
SET @old_log_output= @@global.log_output; SET @old_log_output= @@global.log_output;
SET @old_slow_query_log= @@global.slow_query_log; SET @old_slow_query_log= @@global.slow_query_log;
SET @old_general_log= @@global.general_log; SET @old_general_log= @@global.general_log;
@ -16,16 +12,9 @@ SET @old_long_query_time= @@session.long_query_time;
--disable_ps_protocol --disable_ps_protocol
use mysql; use mysql;
# Capture initial settings of system variables #
# so that we can revert to old state after manipulation for testing # Basic log tables test
# NOTE: PLEASE USE THESE VALUES TO 'RESET' SYSTEM VARIABLES #
# Capturing old values within the tests results in loss of values
# due to people not paying attention to previous tests' changes, captures
# or improper cleanup
SET @saved_long_query_time = @@long_query_time;
SET @saved_log_output = @@log_output;
SET @saved_general_log = @@GLOBAL.general_log;
SET @saved_slow_query_log = @@GLOBAL.slow_query_log;
# #
# Check that log tables work and we can do basic selects. This also # Check that log tables work and we can do basic selects. This also
@ -147,9 +136,9 @@ show open tables;
SET GLOBAL GENERAL_LOG=ON; SET GLOBAL GENERAL_LOG=ON;
SET GLOBAL SLOW_QUERY_LOG=ON; SET GLOBAL SLOW_QUERY_LOG=ON;
# --echo #
# Bug#23924 general_log truncates queries with character set introducers. --echo # Bug#23924 general_log truncates queries with character set introducers.
# --echo #
truncate table mysql.general_log; truncate table mysql.general_log;
set names binary; set names binary;
select _koi8r'<27><><EFBFBD><EFBFBD>' as test; select _koi8r'<27><><EFBFBD><EFBFBD>' as test;
@ -157,9 +146,9 @@ select _koi8r'
select * from mysql.general_log; select * from mysql.general_log;
set names utf8; set names utf8;
# --echo #
# Bug #16905 Log tables: unicode statements are logged incorrectly --echo # Bug #16905 Log tables: unicode statements are logged incorrectly
# --echo #
truncate table mysql.general_log; truncate table mysql.general_log;
set names utf8; set names utf8;
@ -169,21 +158,21 @@ insert into bug16905 values ('новое');
select * from mysql.general_log; select * from mysql.general_log;
drop table bug16905; drop table bug16905;
# --echo #
# Bug #17600: Invalid data logged into mysql.slow_log --echo # Bug #17600: Invalid data logged into mysql.slow_log
# --echo #
truncate table mysql.slow_log; truncate table mysql.slow_log;
set session long_query_time=1; set session long_query_time=1;
select sleep(2); select sleep(2);
--replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID --replace_column 1 TIMESTAMP 2 USER_HOST 3 QUERY_TIME 12 THREAD_ID
select * from mysql.slow_log; select * from mysql.slow_log;
set @@session.long_query_time = @saved_long_query_time; set @@session.long_query_time = @old_long_query_time;
# --echo #
# Bug #18559 log tables cannot change engine, and gets deadlocked when --echo # Bug #18559 log tables cannot change engine, and gets deadlocked when
# dropping w/ log on --echo # dropping w/ log on
# --echo #
# check that appropriate error messages are given when one attempts to alter # check that appropriate error messages are given when one attempts to alter
# or drop a log tables, while corresponding logs are enabled # or drop a log tables, while corresponding logs are enabled
@ -322,9 +311,9 @@ set global general_log='ON';
set global slow_query_log='ON'; set global slow_query_log='ON';
use test; use test;
# --echo #
# Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log" --echo # Bug #20139 Infinite loop after "FLUSH" and "LOCK tabX, general_log"
# --echo #
flush tables with read lock; flush tables with read lock;
unlock tables; unlock tables;
@ -333,18 +322,12 @@ use mysql;
lock tables general_log read local, help_category read local; lock tables general_log read local, help_category read local;
unlock tables; unlock tables;
# --echo #
# Bug #17544 Cannot do atomic log rotate and --echo # Bug #17544 Cannot do atomic log rotate and
# Bug #21785 Server crashes after rename of the log table --echo # Bug #21785 Server crashes after rename of the log table
# --echo #
SET SESSION long_query_time = 1000; SET SESSION long_query_time = 1000;
--disable_warnings
drop table if exists mysql.renamed_general_log;
drop table if exists mysql.renamed_slow_log;
drop table if exists mysql.general_log_new;
drop table if exists mysql.slow_log_new;
--enable_warnings
use mysql; use mysql;
# Should result in error # Should result in error
@ -399,7 +382,7 @@ set global slow_query_log='ON';
RENAME TABLE general_log2 TO general_log; RENAME TABLE general_log2 TO general_log;
RENAME TABLE slow_log2 TO slow_log; RENAME TABLE slow_log2 TO slow_log;
SET SESSION long_query_time = @saved_long_query_time; SET SESSION long_query_time = @old_long_query_time;
# this should work # this should work
set global general_log='ON'; set global general_log='ON';
@ -427,13 +410,6 @@ use test;
# TODO: improve filtering of expected errors in master.err in # TODO: improve filtering of expected errors in master.err in
# mysql-test-run.pl (based on the test name ?), and uncomment this test. # mysql-test-run.pl (based on the test name ?), and uncomment this test.
# --disable_warnings
# drop table if exists mysql.bad_general_log;
# drop table if exists mysql.bad_slow_log;
# drop table if exists mysql.general_log_hide;
# drop table if exists mysql.slow_log_hide;
# --enable_warnings
#
# create table mysql.bad_general_log (a int) engine= CSV; # create table mysql.bad_general_log (a int) engine= CSV;
# create table mysql.bad_slow_log (a int) engine= CSV; # create table mysql.bad_slow_log (a int) engine= CSV;
# #
@ -459,9 +435,9 @@ use test;
# drop table mysql.bad_general_log; # drop table mysql.bad_general_log;
# drop table mysql.bad_slow_log; # drop table mysql.bad_slow_log;
# --echo #
# Bug #21966 Strange warnings on repair of the log tables --echo # Bug #21966 Strange warnings on repair of the log tables
# --echo #
use mysql; use mysql;
# check that no warning occurs on repair of the log tables # check that no warning occurs on repair of the log tables
@ -474,11 +450,10 @@ show tables like "%log%";
drop table slow_log_new, general_log_new; drop table slow_log_new, general_log_new;
use test; use test;
# --echo #
# Bug#69953 / MDEV-4851 --echo # Bug#69953 / MDEV-4851
# Log tables should be modifable on LOG_OUTPUT != TABLE --echo # Log tables should be modifable on LOG_OUTPUT != TABLE
# --echo #
#
SET GLOBAL LOG_OUTPUT = 'FILE'; SET GLOBAL LOG_OUTPUT = 'FILE';
SET GLOBAL slow_query_log = 1; SET GLOBAL slow_query_log = 1;
@ -492,10 +467,10 @@ ALTER TABLE mysql.slow_log DROP COLUMN comment_text;
ALTER TABLE mysql.general_log DROP COLUMN comment_text; ALTER TABLE mysql.general_log DROP COLUMN comment_text;
# --echo #
# Bug#27857 (Log tables supplies the wrong value for generating --echo # Bug#27857 (Log tables supplies the wrong value for generating
# AUTO_INCREMENT numbers) --echo # AUTO_INCREMENT numbers)
# --echo #
SET GLOBAL LOG_OUTPUT = 'TABLE'; SET GLOBAL LOG_OUTPUT = 'TABLE';
@ -554,7 +529,7 @@ SELECT "My own slow query", sleep(2);
SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3; SELECT * FROM mysql.slow_log WHERE seq >= 2 LIMIT 3;
SET GLOBAL slow_query_log = 0; SET GLOBAL slow_query_log = 0;
SET SESSION long_query_time =@saved_long_query_time; SET SESSION long_query_time =@old_long_query_time;
FLUSH LOGS; FLUSH LOGS;
ALTER TABLE mysql.slow_log DROP COLUMN seq; ALTER TABLE mysql.slow_log DROP COLUMN seq;
@ -563,16 +538,9 @@ ALTER TABLE mysql.slow_log ENGINE = CSV;
SET GLOBAL general_log = @old_general_log; SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log; SET GLOBAL slow_query_log = @old_slow_query_log;
# --echo #
# Bug#25422 (Hang with log tables) --echo # Bug#25422 (Hang with log tables)
# --echo #
--disable_warnings
drop procedure if exists proc25422_truncate_slow;
drop procedure if exists proc25422_truncate_general;
drop procedure if exists proc25422_alter_slow;
drop procedure if exists proc25422_alter_general;
--enable_warnings
delimiter //; delimiter //;
@ -602,14 +570,14 @@ end//
create procedure proc25422_alter_slow (loops int) create procedure proc25422_alter_slow (loops int)
begin begin
declare v1 int default 0; declare v1 int default 0;
declare old_log_state int default @@global.slow_query_log;
declare ER_BAD_LOG_STATEMENT condition for 1575; declare ER_BAD_LOG_STATEMENT condition for 1575;
declare continue handler for ER_BAD_LOG_STATEMENT begin end; declare continue handler for ER_BAD_LOG_STATEMENT begin end;
while v1 < loops do while v1 < loops do
set @old_log_state = @@global.slow_query_log;
set global slow_query_log = 'OFF'; set global slow_query_log = 'OFF';
alter table mysql.slow_log engine = CSV; alter table mysql.slow_log engine = CSV;
set global slow_query_log = @old_log_state; set global slow_query_log = old_log_state;
set v1 = v1 + 1; set v1 = v1 + 1;
end while; end while;
end// end//
@ -617,14 +585,14 @@ end//
create procedure proc25422_alter_general (loops int) create procedure proc25422_alter_general (loops int)
begin begin
declare v1 int default 0; declare v1 int default 0;
declare old_log_state int default @@global.general_log;
declare ER_BAD_LOG_STATEMENT condition for 1575; declare ER_BAD_LOG_STATEMENT condition for 1575;
declare continue handler for ER_BAD_LOG_STATEMENT begin end; declare continue handler for ER_BAD_LOG_STATEMENT begin end;
while v1 < loops do while v1 < loops do
set @old_log_state = @@global.general_log;
set global general_log = 'OFF'; set global general_log = 'OFF';
alter table mysql.general_log engine = CSV; alter table mysql.general_log engine = CSV;
set global general_log = @old_log_state; set global general_log = old_log_state;
set v1 = v1 + 1; set v1 = v1 + 1;
end while; end while;
end// end//
@ -713,9 +681,9 @@ drop procedure proc25422_alter_general;
--enable_ps_protocol --enable_ps_protocol
# --echo #
# Bug#23044 (Warnings on flush of a log table) --echo # Bug#23044 (Warnings on flush of a log table)
# --echo #
FLUSH TABLE mysql.general_log; FLUSH TABLE mysql.general_log;
show warnings; show warnings;
@ -723,18 +691,10 @@ show warnings;
FLUSH TABLE mysql.slow_log; FLUSH TABLE mysql.slow_log;
show warnings; show warnings;
# --echo #
# Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the --echo # Bug#17876 (Truncating mysql.slow_log in a SP after using cursor locks the
# thread) --echo # thread)
# --echo #
--disable_warnings
DROP TABLE IF EXISTS `db_17876.slow_log_data`;
DROP TABLE IF EXISTS `db_17876.general_log_data`;
DROP PROCEDURE IF EXISTS `db_17876.archiveSlowLog`;
DROP PROCEDURE IF EXISTS `db_17876.archiveGeneralLog`;
DROP DATABASE IF EXISTS `db_17876`;
--enable_warnings
CREATE DATABASE db_17876; CREATE DATABASE db_17876;
@ -872,9 +832,9 @@ DROP DATABASE IF EXISTS `db_17876`;
SET GLOBAL general_log = @old_general_log; SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @old_slow_query_log; SET GLOBAL slow_query_log = @old_slow_query_log;
# --echo #
# Bug#21557 entries in the general query log truncated at 1000 characters. --echo # Bug#21557 entries in the general query log truncated at 1000 characters.
# --echo #
select CONNECTION_ID() into @thread_id; select CONNECTION_ID() into @thread_id;
--disable_ps_protocol --disable_ps_protocol
@ -993,15 +953,9 @@ AND (command_type = 'Query' OR command_type= 'Execute');
deallocate prepare long_query; deallocate prepare long_query;
set global general_log = @old_general_log; set global general_log = @old_general_log;
# --echo #
# Bug#34306: Can't make copy of log tables when server binary log is enabled --echo # Bug#34306: Can't make copy of log tables when server binary log is enabled
# --echo #
--disable_warnings
DROP TABLE IF EXISTS log_count;
DROP TABLE IF EXISTS slow_log_copy;
DROP TABLE IF EXISTS general_log_copy;
--enable_warnings
CREATE TABLE log_count (count BIGINT(21)); CREATE TABLE log_count (count BIGINT(21));
@ -1031,14 +985,14 @@ INSERT INTO general_log_copy SELECT * FROM mysql.general_log;
INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log)); INSERT INTO log_count (count) VALUES ((SELECT count(*) FROM mysql.general_log));
DROP TABLE general_log_copy; DROP TABLE general_log_copy;
SET GLOBAL general_log = @saved_general_log; SET GLOBAL general_log = @old_general_log;
SET GLOBAL slow_query_log = @saved_slow_query_log; SET GLOBAL slow_query_log = @old_slow_query_log;
DROP TABLE log_count; DROP TABLE log_count;
# --echo #
# Bug #31700: thd->examined_row_count not incremented for 'const' type queries --echo # Bug #31700: thd->examined_row_count not incremented for 'const' type queries
# --echo #
SET SESSION long_query_time = 0; SET SESSION long_query_time = 0;
SET GLOBAL slow_query_log = ON; SET GLOBAL slow_query_log = ON;
@ -1065,16 +1019,12 @@ DROP TABLE t1;
TRUNCATE TABLE mysql.slow_log; TRUNCATE TABLE mysql.slow_log;
# --echo #
# Bug #47924 main.log_tables times out sporadically --echo # Bug #47924 main.log_tables times out sporadically
# --echo #
use mysql; use mysql;
# Should result in error # Should result in error
--disable_warnings
drop table if exists renamed_general_log;
drop table if exists renamed_slow_log;
--enable_warnings
--error ER_CANT_RENAME_LOG_TABLE --error ER_CANT_RENAME_LOG_TABLE
RENAME TABLE general_log TO renamed_general_log; RENAME TABLE general_log TO renamed_general_log;
--error ER_CANT_RENAME_LOG_TABLE --error ER_CANT_RENAME_LOG_TABLE
@ -1084,7 +1034,24 @@ use test;
flush tables with read lock; flush tables with read lock;
unlock tables; unlock tables;
SET @@session.long_query_time= @old_long_query_time; --echo #
--echo # MDEV-33267 User with minimal permissions can intentionally corrupt mysql.slow_log table
--echo #
truncate mysql.slow_log;
set global log_output= 'TABLE';
create user u@localhost;
set slow_query_log=on, long_query_time=0.1;
select 'before evil-doing', sleep(0.2);
--connect (con1,localhost,u,,)
set @@timestamp= 2147483647;
set slow_query_log=on, long_query_time=0.1;
select 'evil-doing', sleep(1.1);
--disconnect con1
--connection default
select 'after evil-doing', sleep(0.2);
select distinct sql_text from mysql.slow_log where sql_text like '%evil%';
set global log_output=default;
drop user u@localhost;
SET @@global.log_output= @old_log_output; SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log; SET @@global.slow_query_log= @old_slow_query_log;

View File

@ -653,5 +653,29 @@ f1 f2 f3 f4 f5 f6 f7
4 00004 0001009089999 netstes psit e 4 00004 0001009089999 netstes psit e
drop table t1; drop table t1;
# #
# MDEV-29954 Unique hash key on column prefix is computed incorrectly
#
create table t1 (c char(10),unique key a using hash (c(1)));
insert into t1 values (0);
check table t1 extended;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
#
# MDEV-32837 long unique does not work like unique key when using replace
#
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
REPLACE INTO t1 VALUES (3,1,1);
SELECT * FROM t1 ORDER BY a;
a b c
2 2 2
3 1 1
REPLACE INTO t1 VALUES (3,2,2);
SELECT * FROM t1;
a b c
3 2 2
DROP TABLE t1;
#
# End of 10.5 tests # End of 10.5 tests
# #

View File

@ -634,6 +634,27 @@ replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netst
select * from t1; select * from t1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-29954 Unique hash key on column prefix is computed incorrectly
--echo #
create table t1 (c char(10),unique key a using hash (c(1)));
insert into t1 values (0);
check table t1 extended;
drop table t1;
--echo #
--echo # MDEV-32837 long unique does not work like unique key when using replace
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
REPLACE INTO t1 VALUES (3,1,1);
SELECT * FROM t1 ORDER BY a;
REPLACE INTO t1 VALUES (3,2,2);
SELECT * FROM t1;
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@ -0,0 +1,95 @@
#
# Start of 10.5 tests
#
#
# MDEV-32837 long unique does not work like unique key when using replace
#
#
# Normal unique key + long unique key
#
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,1,1);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
Variable_name Value
Handler_delete 1
Handler_read_key 2
Handler_read_rnd 1
Handler_write 1
SELECT * FROM t1 ORDER BY a;
a b c
2 2 2
3 1 1
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,2,2);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
Variable_name Value
Handler_delete 1
Handler_read_key 3
Handler_read_rnd 2
Handler_update 1
Handler_write 1
SELECT * FROM t1;
a b c
3 2 2
DROP TABLE t1;
#
# Two long unique keys
#
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE KEY a (a) USING HASH,UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,1,1);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
Variable_name Value
Handler_read_key 3
Handler_read_rnd 1
Handler_update 1
SELECT * FROM t1 ORDER BY a;
a b c
2 2 2
3 1 1
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,2,2);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
Variable_name Value
Handler_delete 1
Handler_read_key 4
Handler_read_rnd 2
Handler_update 1
SELECT * FROM t1;
a b c
3 2 2
DROP TABLE t1;
#
# One long unique key
#
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,1,1);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
Variable_name Value
Handler_read_key 1
Handler_read_rnd 1
Handler_update 1
SELECT * FROM t1 ORDER BY a;
a b c
2 2 2
3 1 1
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,2,2);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
Variable_name Value
Handler_read_key 1
Handler_read_rnd 1
Handler_update 1
SELECT * FROM t1;
a b c
3 1 1
3 2 2
DROP TABLE t1;
#
# End of 10.5 tests
#

View File

@ -0,0 +1,68 @@
if (`SELECT $SP_PROTOCOL > 0`)
{
--skip Test requires: sp-protocol disabled
}
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-32837 long unique does not work like unique key when using replace
--echo #
# This test produces different Handler commands in the SHOW STATUS output
# with --sp-protocol. So it's here, in this *.test file with --sp-protocol disabled.
--echo #
--echo # Normal unique key + long unique key
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,1,1);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
SELECT * FROM t1 ORDER BY a;
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,2,2);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Two long unique keys
--echo #
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE KEY a (a) USING HASH,UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,1,1);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
SELECT * FROM t1 ORDER BY a;
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,2,2);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # One long unique key
--echo #
CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE KEY `test` (b,c) USING HASH) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1,1),(2,2,2);
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,1,1);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
SELECT * FROM t1 ORDER BY a;
FLUSH STATUS;
REPLACE INTO t1 VALUES (3,2,2);
SHOW STATUS WHERE Variable_name LIKE 'handler%' AND Value>0;
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@ -0,0 +1,24 @@
#
# regression introduced by MDEV-14448
#
delimiter $
select 1;
$
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is X
Server version: Y
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> delimiter $
MariaDB [(none)]> select 1;
-> $
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set
MariaDB [(none)]>

View File

@ -0,0 +1,29 @@
--echo #
--echo # regression introduced by MDEV-14448
--echo #
source include/not_embedded.inc;
source include/not_windows.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;
delimiter $
select 1;
$
EOF
let TERM=dumb;
replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//;
error 0,127;
exec socat EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in;
if ($sys_errno == 127)
{
remove_file $MYSQL_TMP_DIR/mysql_in;
skip no socat;
}
remove_file $MYSQL_TMP_DIR/mysql_in;

View File

@ -736,6 +736,13 @@ The following specify which files/extra groups are read (specified before remain
max_connections*5 or max_connections + table_cache*2 max_connections*5 or max_connections + table_cache*2
(whichever is larger) number of file descriptors (whichever is larger) number of file descriptors
(Automatically configured unless set explicitly) (Automatically configured unless set explicitly)
--optimizer-adjust-secondary-key-costs=#
0 = No changes. 1 = Update secondary key costs for ranges
to be at least 5x of clustered primary key costs. 2 =
Remove 'max_seek optimization' for secondary keys and
slight adjustment of filter cost. This option will be
deleted in MariaDB 11.0 as it is not needed with the new
11.0 optimizer.
--optimizer-extra-pruning-depth=# --optimizer-extra-pruning-depth=#
If the optimizer needs to enumerate join prefix of this If the optimizer needs to enumerate join prefix of this
size or larger, then it will try aggressively prune away size or larger, then it will try aggressively prune away
@ -1167,7 +1174,7 @@ The following specify which files/extra groups are read (specified before remain
The tracing level for semi-sync replication. The tracing level for semi-sync replication.
--rpl-semi-sync-master-wait-no-slave --rpl-semi-sync-master-wait-no-slave
Wait until timeout when no semi-synchronous replication Wait until timeout when no semi-synchronous replication
slave available (enabled by default). slave is available.
(Defaults to on; use --skip-rpl-semi-sync-master-wait-no-slave to disable.) (Defaults to on; use --skip-rpl-semi-sync-master-wait-no-slave to disable.)
--rpl-semi-sync-master-wait-point=name --rpl-semi-sync-master-wait-point=name
Should transaction wait for semi-sync ack after having Should transaction wait for semi-sync ack after having
@ -1725,6 +1732,7 @@ old-alter-table DEFAULT
old-mode UTF8_IS_UTF8MB3 old-mode UTF8_IS_UTF8MB3
old-passwords FALSE old-passwords FALSE
old-style-user-limits FALSE old-style-user-limits FALSE
optimizer-adjust-secondary-key-costs 0
optimizer-extra-pruning-depth 8 optimizer-extra-pruning-depth 8
optimizer-max-sel-arg-weight 32000 optimizer-max-sel-arg-weight 32000
optimizer-max-sel-args 16000 optimizer-max-sel-args 16000

View File

@ -1507,7 +1507,7 @@ BEGIN NOT ATOMIC DECLARE history INT; SET history=10; SELECT history; END
SELECT history FROM t1 SELECT history FROM t1
SELECT history 'alias' FROM t1 SELECT history 'alias' FROM t1
SELECT history() SELECT history()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT history.history() SELECT history.history()
Error 1630 FUNCTION history.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION history.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT history DATE FROM t1 SELECT history DATE FROM t1
@ -1530,7 +1530,7 @@ BEGIN NOT ATOMIC DECLARE next INT; SET next=10; SELECT next; END
SELECT next FROM t1 SELECT next FROM t1
SELECT next 'alias' FROM t1 SELECT next 'alias' FROM t1
SELECT next() SELECT next()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT next.next() SELECT next.next()
Error 1630 FUNCTION next.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION next.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT next DATE FROM t1 SELECT next DATE FROM t1
@ -1577,7 +1577,7 @@ BEGIN NOT ATOMIC DECLARE previous INT; SET previous=10; SELECT previous; END
SELECT previous FROM t1 SELECT previous FROM t1
SELECT previous 'alias' FROM t1 SELECT previous 'alias' FROM t1
SELECT previous() SELECT previous()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT previous.previous() SELECT previous.previous()
Error 1630 FUNCTION previous.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION previous.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT previous DATE FROM t1 SELECT previous DATE FROM t1
@ -1601,7 +1601,7 @@ BEGIN NOT ATOMIC DECLARE system INT; SET system=10; SELECT system; END
SELECT system FROM t1 SELECT system FROM t1
SELECT system 'alias' FROM t1 SELECT system 'alias' FROM t1
SELECT system() SELECT system()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system.system() SELECT system.system()
Error 1630 FUNCTION system.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION system.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system DATE FROM t1 SELECT system DATE FROM t1
@ -1624,7 +1624,7 @@ BEGIN NOT ATOMIC DECLARE system_time INT; SET system_time=10; SELECT system_time
SELECT system_time FROM t1 SELECT system_time FROM t1
SELECT system_time 'alias' FROM t1 SELECT system_time 'alias' FROM t1
SELECT system_time() SELECT system_time()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system_time.system_time() SELECT system_time.system_time()
Error 1630 FUNCTION system_time.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION system_time.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system_time DATE FROM t1 SELECT system_time DATE FROM t1
@ -1695,7 +1695,7 @@ BEGIN NOT ATOMIC DECLARE transaction INT; SET transaction=10; SELECT transaction
SELECT transaction FROM t1 SELECT transaction FROM t1
SELECT transaction 'alias' FROM t1 SELECT transaction 'alias' FROM t1
SELECT transaction() SELECT transaction()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT transaction.transaction() SELECT transaction.transaction()
Error 1630 FUNCTION transaction.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION transaction.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT transaction DATE FROM t1 SELECT transaction DATE FROM t1
@ -1741,7 +1741,7 @@ BEGIN NOT ATOMIC DECLARE versioning INT; SET versioning=10; SELECT versioning; E
SELECT versioning FROM t1 SELECT versioning FROM t1
SELECT versioning 'alias' FROM t1 SELECT versioning 'alias' FROM t1
SELECT versioning() SELECT versioning()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT versioning.versioning() SELECT versioning.versioning()
Error 1630 FUNCTION versioning.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION versioning.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT versioning DATE FROM t1 SELECT versioning DATE FROM t1
@ -1764,7 +1764,7 @@ BEGIN NOT ATOMIC DECLARE without INT; SET without=10; SELECT without; END
SELECT without FROM t1 SELECT without FROM t1
SELECT without 'alias' FROM t1 SELECT without 'alias' FROM t1
SELECT without() SELECT without()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT without.without() SELECT without.without()
Error 1630 FUNCTION without.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION without.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT without DATE FROM t1 SELECT without DATE FROM t1

View File

@ -0,0 +1,82 @@
create table t1 (
pk int primary key auto_increment,
nm varchar(32),
fl1 tinyint default 0,
fl2 tinyint default 0,
index idx1(nm, fl1),
index idx2(fl2)
) engine=myisam;
create table name (
pk int primary key auto_increment,
nm bigint
) engine=myisam;
create table flag2 (
pk int primary key auto_increment,
fl2 tinyint
) engine=myisam;
insert into name(nm) select seq from seq_1_to_1000 order by rand(17);
insert into flag2(fl2) select seq mod 2 from seq_1_to_1000 order by rand(19);
insert into t1(nm,fl2)
select nm, fl2 from name, flag2 where name.pk = flag2.pk;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status Table is already up to date
set optimizer_trace="enabled=on";
set optimizer_switch='rowid_filter=on';
set statement optimizer_adjust_secondary_key_costs=0 for
explain select * from t1 where nm like '500%' AND fl2 = 0;
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
set @trace=(select trace from information_schema.optimizer_trace);
select json_detailed(json_extract(@trace, '$**.considered_access_paths'));
json_detailed(json_extract(@trace, '$**.considered_access_paths'))
[
[
{
"access_type": "ref",
"index": "idx2",
"used_range_estimates": true,
"rowid_filter_skipped": "worst/max seeks clipping",
"rows": 492,
"cost": 492.3171406,
"chosen": true
},
{
"access_type": "range",
"resulting_rows": 0.492,
"cost": 1.448699097,
"chosen": true
}
]
]
The following trace should have a different rowid_filter_key cost
set statement optimizer_adjust_secondary_key_costs=2 for
explain select * from t1 where nm like '500%' AND fl2 = 0;
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
set @trace=(select trace from information_schema.optimizer_trace);
select json_detailed(json_extract(@trace, '$**.considered_access_paths'));
json_detailed(json_extract(@trace, '$**.considered_access_paths'))
[
[
{
"access_type": "ref",
"index": "idx2",
"used_range_estimates": true,
"rowid_filter_key": "idx1",
"rows": 492,
"cost": 3.814364688,
"chosen": true
},
{
"access_type": "range",
"resulting_rows": 0.492,
"cost": 1.448699097,
"chosen": true
}
]
]
drop table t1, name, flag2;

View File

@ -0,0 +1,53 @@
--source include/have_sequence.inc
--source include/not_embedded.inc
#
# Show the costs for rowid filter
#
create table t1 (
pk int primary key auto_increment,
nm varchar(32),
fl1 tinyint default 0,
fl2 tinyint default 0,
index idx1(nm, fl1),
index idx2(fl2)
) engine=myisam;
create table name (
pk int primary key auto_increment,
nm bigint
) engine=myisam;
create table flag2 (
pk int primary key auto_increment,
fl2 tinyint
) engine=myisam;
insert into name(nm) select seq from seq_1_to_1000 order by rand(17);
insert into flag2(fl2) select seq mod 2 from seq_1_to_1000 order by rand(19);
insert into t1(nm,fl2)
select nm, fl2 from name, flag2 where name.pk = flag2.pk;
analyze table t1 persistent for all;
--disable_ps_protocol
set optimizer_trace="enabled=on";
set optimizer_switch='rowid_filter=on';
set statement optimizer_adjust_secondary_key_costs=0 for
explain select * from t1 where nm like '500%' AND fl2 = 0;
set @trace=(select trace from information_schema.optimizer_trace);
select json_detailed(json_extract(@trace, '$**.considered_access_paths'));
--echo
--echo The following trace should have a different rowid_filter_key cost
--echo
set statement optimizer_adjust_secondary_key_costs=2 for
explain select * from t1 where nm like '500%' AND fl2 = 0;
set @trace=(select trace from information_schema.optimizer_trace);
select json_detailed(json_extract(@trace, '$**.considered_access_paths'));
--enable_ps_protocol
drop table t1, name, flag2;

View File

@ -8955,6 +8955,21 @@ DROP FUNCTION f1;
DROP FUNCTION f2; DROP FUNCTION f2;
DROP FUNCTION f3; DROP FUNCTION f3;
DROP VIEW v1; DROP VIEW v1;
#
# MDEV-33270: Call of SP invoking another SP with a parameter
# requiring type conversion
#
SET NAMES latin1;
CREATE PROCEDURE p1 (a text) BEGIN SELECT a; END |
CREATE PROCEDURE p2 () CALL p1(concat('x',_utf8'x')) |
CALL p2();
a
xx
CALL p2();
a
xx
DROP PROCEDURE p1;
DROP PROCEDURE p2;
# End of 10.4 tests # End of 10.4 tests
# #
# #
@ -9008,6 +9023,79 @@ BEGIN NOT ATOMIC DECLARE r ROW TYPE OF t1 DEFAULT (SELECT * FROM t1); SELECT r.a
r.a r.a
1 1
SET SESSION log_slow_verbosity= @tmp; SET SESSION log_slow_verbosity= @tmp;
#
# MDEV-31616 Problems with a stored function EMPTY() on upgrade to 10.6.
#
CREATE OR REPLACE FUNCTION empty(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
Warnings:
Note 1585 This function 'empty' has the same name as a native function
SELECT empty('1');
empty('1')
0
Warnings:
Note 1585 This function 'empty' has the same name as a native function
DROP FUNCTION empty;
CREATE OR REPLACE FUNCTION json_table(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
Warnings:
Note 1585 This function 'json_table' has the same name as a native function
SELECT json_table('1');
json_table('1')
0
Warnings:
Note 1585 This function 'json_table' has the same name as a native function
DROP FUNCTION json_table;
CREATE OR REPLACE FUNCTION nested(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
Warnings:
Note 1585 This function 'nested' has the same name as a native function
SELECT nested('1');
nested('1')
0
Warnings:
Note 1585 This function 'nested' has the same name as a native function
DROP FUNCTION nested;
CREATE OR REPLACE FUNCTION ordinality(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
Warnings:
Note 1585 This function 'ordinality' has the same name as a native function
SELECT ordinality('1');
ordinality('1')
0
Warnings:
Note 1585 This function 'ordinality' has the same name as a native function
DROP FUNCTION ordinality;
CREATE OR REPLACE FUNCTION path(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
Warnings:
Note 1585 This function 'path' has the same name as a native function
SELECT path('1');
path('1')
0
Warnings:
Note 1585 This function 'path' has the same name as a native function
DROP FUNCTION path;
CREATE OR REPLACE FUNCTION fast(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
Warnings:
Note 1585 This function 'fast' has the same name as a native function
SELECT fast('1');
fast('1')
0
Warnings:
Note 1585 This function 'fast' has the same name as a native function
DROP FUNCTION fast;
CREATE OR REPLACE FUNCTION relay(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
Warnings:
Note 1585 This function 'relay' has the same name as a native function
SELECT relay('1');
relay('1')
0
Warnings:
Note 1585 This function 'relay' has the same name as a native function
DROP FUNCTION relay;
CREATE OR REPLACE FUNCTION database() RETURNS int RETURN 333;
Warnings:
Note 1585 This function 'database' has the same name as a native function
SELECT database();
database()
test
DROP FUNCTION database;
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*) # MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*)

View File

@ -10566,6 +10566,26 @@ DROP FUNCTION f2;
DROP FUNCTION f3; DROP FUNCTION f3;
DROP VIEW v1; DROP VIEW v1;
--echo #
--echo # MDEV-33270: Call of SP invoking another SP with a parameter
--echo # requiring type conversion
--echo #
SET NAMES latin1;
--delimiter |
CREATE PROCEDURE p1 (a text) BEGIN SELECT a; END |
CREATE PROCEDURE p2 () CALL p1(concat('x',_utf8'x')) |
--delimiter ;
CALL p2();
CALL p2();
DROP PROCEDURE p1;
DROP PROCEDURE p2;
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #
@ -10618,6 +10638,44 @@ BEGIN NOT ATOMIC DECLARE r ROW TYPE OF t1 DEFAULT (SELECT * FROM t1); SELECT r.a
--delimiter ; --delimiter ;
SET SESSION log_slow_verbosity= @tmp; SET SESSION log_slow_verbosity= @tmp;
--echo #
--echo # MDEV-31616 Problems with a stored function EMPTY() on upgrade to 10.6.
--echo #
CREATE OR REPLACE FUNCTION empty(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
SELECT empty('1');
DROP FUNCTION empty;
CREATE OR REPLACE FUNCTION json_table(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
SELECT json_table('1');
DROP FUNCTION json_table;
CREATE OR REPLACE FUNCTION nested(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
SELECT nested('1');
DROP FUNCTION nested;
CREATE OR REPLACE FUNCTION ordinality(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
SELECT ordinality('1');
DROP FUNCTION ordinality;
CREATE OR REPLACE FUNCTION path(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
SELECT path('1');
DROP FUNCTION path;
CREATE OR REPLACE FUNCTION fast(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
SELECT fast('1');
DROP FUNCTION fast;
CREATE OR REPLACE FUNCTION relay(a VARCHAR(128)) RETURNS int RETURN LENGTH(a)=0;
SELECT relay('1');
DROP FUNCTION relay;
CREATE OR REPLACE FUNCTION database() RETURNS int RETURN 333;
SELECT database();
DROP FUNCTION database;
# Cleanup # Cleanup
DROP TABLE t1; DROP TABLE t1;

View File

@ -897,7 +897,7 @@ ERROR 22003: Out of range value for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('-1.2E-3'); INSERT INTO t1 (col2) VALUES ('-1.2E-3');
ERROR 22003: Out of range value for column 'col2' at row 1 ERROR 22003: Out of range value for column 'col2' at row 1
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
ERROR 22003: DOUBLE value is out of range in '"test"."t1"."col1" * 5000' Got one of the listed errors
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
ERROR 22012: Division by 0 ERROR 22012: Division by 0
UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0;

View File

@ -824,7 +824,7 @@ INSERT INTO t1 (col2) VALUES (-1.1E-3);
INSERT INTO t1 (col1) VALUES ('+1.8E+309'); INSERT INTO t1 (col1) VALUES ('+1.8E+309');
--error 1264 --error 1264
INSERT INTO t1 (col2) VALUES ('-1.2E-3'); INSERT INTO t1 (col2) VALUES ('-1.2E-3');
--error ER_DATA_OUT_OF_RANGE --error ER_DATA_OUT_OF_RANGE, ER_WARN_DATA_OUT_OF_RANGE
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0; UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
--error 1365 --error 1365
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0; UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;

View File

@ -600,6 +600,22 @@ DROP TEMPORARY TABLE t1;
# #
# End of 10.2 tests # End of 10.2 tests
# #
#
# MDEV-31523: Using two temporary tables in OPTIMIZE TABLE lead to crash
#
CREATE TEMPORARY TABLE t1 (c INT) ENGINE=MyISAM;
CREATE TEMPORARY TABLE t2 (c INT) ENGINE=MyISAM;
optimize TABLE t1,t2;
Table Op Msg_type Msg_text
test.t1 optimize status Table is already up to date
test.t2 optimize status Table is already up to date
SHOW TABLES;
Tables_in_test
# in 11.2 and above here should be listed above used temporary tables
DROP TEMPORARY TABLE t1, t2;
#
# End of 10.4 tests
#
create function f1() returns int create function f1() returns int
begin begin
drop temporary table t1, t2; drop temporary table t1, t2;

View File

@ -657,6 +657,22 @@ DROP TEMPORARY TABLE t1;
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
--echo #
--echo # MDEV-31523: Using two temporary tables in OPTIMIZE TABLE lead to crash
--echo #
CREATE TEMPORARY TABLE t1 (c INT) ENGINE=MyISAM;
CREATE TEMPORARY TABLE t2 (c INT) ENGINE=MyISAM;
optimize TABLE t1,t2;
SHOW TABLES;
--echo # in 11.2 and above here should be listed above used temporary tables
DROP TEMPORARY TABLE t1, t2;
--echo #
--echo # End of 10.4 tests
--echo #
# #
# DROP TEMPORARY TABLE fails in the middle # DROP TEMPORARY TABLE fails in the middle
# #

View File

@ -3101,6 +3101,7 @@ sub mysql_install_db {
mtr_add_arg($args, "--core-file"); mtr_add_arg($args, "--core-file");
mtr_add_arg($args, "--console"); mtr_add_arg($args, "--console");
mtr_add_arg($args, "--character-set-server=latin1"); mtr_add_arg($args, "--character-set-server=latin1");
mtr_add_arg($args, "--disable-performance-schema");
if ( $opt_debug ) if ( $opt_debug )
{ {
@ -4454,6 +4455,7 @@ sub extract_warning_lines ($$) {
qr/InnoDB: Warning: a long semaphore wait:/, qr/InnoDB: Warning: a long semaphore wait:/,
qr/InnoDB: Dumping buffer pool.*/, qr/InnoDB: Dumping buffer pool.*/,
qr/InnoDB: Buffer pool.*/, qr/InnoDB: Buffer pool.*/,
qr/InnoDB: Could not free any blocks in the buffer pool!/,
qr/InnoDB: Warning: Writer thread is waiting this semaphore:/, qr/InnoDB: Warning: Writer thread is waiting this semaphore:/,
qr/InnoDB: innodb_open_files .* should not be greater than/, qr/InnoDB: innodb_open_files .* should not be greater than/,
qr/Slave: Unknown table 't1' .* 1051/, qr/Slave: Unknown table 't1' .* 1051/,

View File

@ -7,7 +7,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets"); call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave; connection slave;
set sql_log_bin=0; set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1; set sql_log_bin=1;
@ -28,7 +27,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here # Main test of semi-sync replication start here
# #
connection master; connection master;
set global rpl_semi_sync_master_timeout= 60000; set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ] [ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled'; show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value Variable_name Value
@ -163,11 +162,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction # Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply. # timeout waiting for slave reply.
# #
connection master;
show status like "Rpl_semi_sync_master_status";
Variable_name Value
Rpl_semi_sync_master_status ON
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
connection master; connection master;
include/kill_binlog_dump_threads.inc include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000; set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ] [ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value Variable_name Value
@ -317,6 +320,8 @@ include/kill_binlog_dump_threads.inc
connection slave; connection slave;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
connection slave;
connection master;
create table t1 (a int) engine = ENGINE_TYPE; create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2), (3); insert into t1 values (2), (3);
@ -359,6 +364,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value Variable_name Value
Rpl_semi_sync_slave_status ON Rpl_semi_sync_slave_status ON
connection master; connection master;
connection slave;
connection master;
[ master semi-sync should be ON ] [ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_clients';
Variable_name Value Variable_name Value

View File

@ -1772,6 +1772,85 @@ Level Code Message
Note 1003 select trim(both ' ' from 'a') AS "oracle_schema.TRIM(BOTH ' ' FROM 'a')" Note 1003 select trim(both ' ' from 'a') AS "oracle_schema.TRIM(BOTH ' ' FROM 'a')"
Warnings: Warnings:
Note 1003 select trim(both ' ' from 'a') AS "oracle_schema.TRIM(BOTH ' ' FROM 'a')" Note 1003 select trim(both ' ' from 'a') AS "oracle_schema.TRIM(BOTH ' ' FROM 'a')"
CALL p3('REGEXP_REPLACE(''test'',''t'','''')');
----------
sql_mode='' qualifier=''
query
EXPLAIN EXTENDED SELECT REGEXP_REPLACE('test','t','')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select regexp_replace('test','t','') AS `REGEXP_REPLACE('test','t','')`
----------
sql_mode='' qualifier='unknown_schema.'
query
EXPLAIN EXTENDED SELECT unknown_schema.REGEXP_REPLACE('test','t','')
errmsg
ERROR: FUNCTION unknown_schema.REGEXP_REPLACE does not exist
----------
sql_mode='' qualifier='mariadb_schema.'
query
EXPLAIN EXTENDED SELECT mariadb_schema.REGEXP_REPLACE('test','t','')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select regexp_replace('test','t','') AS `mariadb_schema.REGEXP_REPLACE('test','t','')`
----------
sql_mode='' qualifier='maxdb_schema.'
query
EXPLAIN EXTENDED SELECT maxdb_schema.REGEXP_REPLACE('test','t','')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select regexp_replace('test','t','') AS `maxdb_schema.REGEXP_REPLACE('test','t','')`
----------
sql_mode='' qualifier='oracle_schema.'
query
EXPLAIN EXTENDED SELECT oracle_schema.REGEXP_REPLACE('test','t','')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select oracle_schema.regexp_replace('test','t','') AS `oracle_schema.REGEXP_REPLACE('test','t','')`
----------
sql_mode='ORACLE' qualifier=''
query
EXPLAIN EXTENDED SELECT REGEXP_REPLACE('test','t','')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select regexp_replace('test','t','') AS "REGEXP_REPLACE('test','t','')"
----------
sql_mode='ORACLE' qualifier='unknown_schema.'
query
EXPLAIN EXTENDED SELECT unknown_schema.REGEXP_REPLACE('test','t','')
errmsg
ERROR: FUNCTION unknown_schema.REGEXP_REPLACE does not exist
----------
sql_mode='ORACLE' qualifier='mariadb_schema.'
query
EXPLAIN EXTENDED SELECT mariadb_schema.REGEXP_REPLACE('test','t','')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select mariadb_schema.regexp_replace('test','t','') AS "mariadb_schema.REGEXP_REPLACE('test','t','')"
----------
sql_mode='ORACLE' qualifier='maxdb_schema.'
query
EXPLAIN EXTENDED SELECT maxdb_schema.REGEXP_REPLACE('test','t','')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select mariadb_schema.regexp_replace('test','t','') AS "maxdb_schema.REGEXP_REPLACE('test','t','')"
----------
sql_mode='ORACLE' qualifier='oracle_schema.'
query
EXPLAIN EXTENDED SELECT oracle_schema.REGEXP_REPLACE('test','t','')
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Level Code Message
Note 1003 select regexp_replace('test','t','') AS "oracle_schema.REGEXP_REPLACE('test','t','')"
Warnings:
Note 1003 select regexp_replace('test','t','') AS "oracle_schema.REGEXP_REPLACE('test','t','')"
CALL p3('CONCAT_OPERATOR_ORACLE(''a'')'); CALL p3('CONCAT_OPERATOR_ORACLE(''a'')');
---------- ----------
sql_mode='' qualifier='' sql_mode='' qualifier=''

View File

@ -0,0 +1,34 @@
SET sql_mode=ORACLE;
#
# MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode
#
CREATE TABLE t1 (replacement VARCHAR(10));
INSERT INTO t1 VALUES (NULL), ('');
SELECT replacement, REGEXP_REPLACE('abba','a',replacement) FROM t1 ORDER BY replacement;
replacement REGEXP_REPLACE('abba','a',replacement)
NULL bb
bb
DROP TABLE t1;
SELECT REGEXP_REPLACE('abba','a',null);
REGEXP_REPLACE('abba','a',null)
bb
EXPLAIN EXTENDED SELECT REPLACE('abba','a',null) ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
Warnings:
Note 1003 select replace('abba','a',NULL) AS "REPLACE('abba','a',null)"
CREATE VIEW v1 AS SELECT REPLACE('abba','a',null) ;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select replace('abba','a',NULL) AS "REPLACE('abba','a',null)" latin1 latin1_swedish_ci
SELECT * FROM v1;
REPLACE('abba','a',null)
bb
SET sql_mode=DEFAULT;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select oracle_schema.replace('abba','a',NULL) AS `REPLACE('abba','a',null)` latin1 latin1_swedish_ci
SELECT * FROM v1;
REPLACE('abba','a',null)
bb
DROP VIEW v1;

View File

@ -84,7 +84,7 @@ DECLARE history INT; BEGIN history:=10; SELECT history; END
SELECT history FROM t1 SELECT history FROM t1
SELECT history 'alias' FROM t1 SELECT history 'alias' FROM t1
SELECT history() SELECT history()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT history.history() SELECT history.history()
Error 1630 FUNCTION history.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION history.history does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT history DATE FROM t1 SELECT history DATE FROM t1
@ -106,7 +106,7 @@ DECLARE next INT; BEGIN next:=10; SELECT next; END
SELECT next FROM t1 SELECT next FROM t1
SELECT next 'alias' FROM t1 SELECT next 'alias' FROM t1
SELECT next() SELECT next()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT next.next() SELECT next.next()
Error 1630 FUNCTION next.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION next.next does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT next DATE FROM t1 SELECT next DATE FROM t1
@ -151,7 +151,7 @@ DECLARE previous INT; BEGIN previous:=10; SELECT previous; END
SELECT previous FROM t1 SELECT previous FROM t1
SELECT previous 'alias' FROM t1 SELECT previous 'alias' FROM t1
SELECT previous() SELECT previous()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT previous.previous() SELECT previous.previous()
Error 1630 FUNCTION previous.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION previous.previous does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT previous DATE FROM t1 SELECT previous DATE FROM t1
@ -174,7 +174,7 @@ DECLARE system INT; BEGIN system:=10; SELECT system; END
SELECT system FROM t1 SELECT system FROM t1
SELECT system 'alias' FROM t1 SELECT system 'alias' FROM t1
SELECT system() SELECT system()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system.system() SELECT system.system()
Error 1630 FUNCTION system.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION system.system does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system DATE FROM t1 SELECT system DATE FROM t1
@ -196,7 +196,7 @@ DECLARE system_time INT; BEGIN system_time:=10; SELECT system_time; END
SELECT system_time FROM t1 SELECT system_time FROM t1
SELECT system_time 'alias' FROM t1 SELECT system_time 'alias' FROM t1
SELECT system_time() SELECT system_time()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system_time.system_time() SELECT system_time.system_time()
Error 1630 FUNCTION system_time.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION system_time.system_time does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT system_time DATE FROM t1 SELECT system_time DATE FROM t1
@ -264,7 +264,7 @@ DECLARE transaction INT; BEGIN transaction:=10; SELECT transaction; END
SELECT transaction FROM t1 SELECT transaction FROM t1
SELECT transaction 'alias' FROM t1 SELECT transaction 'alias' FROM t1
SELECT transaction() SELECT transaction()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT transaction.transaction() SELECT transaction.transaction()
Error 1630 FUNCTION transaction.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION transaction.transaction does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT transaction DATE FROM t1 SELECT transaction DATE FROM t1
@ -308,7 +308,7 @@ DECLARE versioning INT; BEGIN versioning:=10; SELECT versioning; END
SELECT versioning FROM t1 SELECT versioning FROM t1
SELECT versioning 'alias' FROM t1 SELECT versioning 'alias' FROM t1
SELECT versioning() SELECT versioning()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT versioning.versioning() SELECT versioning.versioning()
Error 1630 FUNCTION versioning.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION versioning.versioning does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT versioning DATE FROM t1 SELECT versioning DATE FROM t1
@ -330,7 +330,7 @@ DECLARE without INT; BEGIN without:=10; SELECT without; END
SELECT without FROM t1 SELECT without FROM t1
SELECT without 'alias' FROM t1 SELECT without 'alias' FROM t1
SELECT without() SELECT without()
Error 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '()' at line 1 Error 1630 FUNCTION test.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT without.without() SELECT without.without()
Error 1630 FUNCTION without.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual Error 1630 FUNCTION without.without does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
SELECT without DATE FROM t1 SELECT without DATE FROM t1

View File

@ -165,6 +165,7 @@ CALL p3('TRIM(1,2)');
CALL p3('TRIM(''a'')'); CALL p3('TRIM(''a'')');
CALL p3('TRIM(BOTH '' '' FROM ''a'')'); CALL p3('TRIM(BOTH '' '' FROM ''a'')');
CALL p3('REGEXP_REPLACE(''test'',''t'','''')');
# Deprecated compatibility XXX_ORACLE functions. # Deprecated compatibility XXX_ORACLE functions.
# These functions are implemented as simple native functions # These functions are implemented as simple native functions

View File

@ -0,0 +1,26 @@
SET sql_mode=ORACLE;
--echo #
--echo # MDEV-29095 REGEXP_REPLACE treats empty strings different than REPLACE in ORACLE mode
--echo #
#SELECT REGEXP_REPLACE(null,'a','b') ;
#SELECT REGEXP_REPLACE('ab',null,'b') ;
#SELECT REGEXP_REPLACE('ab','a',null) ;
#SELECT REGEXP_REPLACE('ab',null,null) ;
CREATE TABLE t1 (replacement VARCHAR(10));
INSERT INTO t1 VALUES (NULL), ('');
SELECT replacement, REGEXP_REPLACE('abba','a',replacement) FROM t1 ORDER BY replacement;
DROP TABLE t1;
SELECT REGEXP_REPLACE('abba','a',null);
EXPLAIN EXTENDED SELECT REPLACE('abba','a',null) ;
CREATE VIEW v1 AS SELECT REPLACE('abba','a',null) ;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
SET sql_mode=DEFAULT;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
DROP VIEW v1;

View File

@ -10,7 +10,7 @@ performance_schema
sys sys
test test
USE DATABASE nond6; USE DATABASE nond6;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATABASE nond6' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'nond6' at line 1
DROP DATABASE d6; DROP DATABASE d6;
SHOW DATABASES; SHOW DATABASES;
Database Database

View File

@ -1,5 +1,16 @@
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
select @@rpl_semi_sync_master_enabled;
@@rpl_semi_sync_master_enabled
0
connection slave;
select @@rpl_semi_sync_slave_enabled;
@@rpl_semi_sync_slave_enabled
0
show status like "rpl_semi_sync_slave_status";
Variable_name Value
Rpl_semi_sync_slave_status OFF
connection master;
drop table if exists t1; drop table if exists t1;
Warnings: Warnings:
Note 1051 Unknown table 'test.t1' Note 1051 Unknown table 'test.t1'

View File

@ -2088,9 +2088,11 @@ SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'cursor() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'cursor()
SELECT * from t1 where f2=f1' at line 1 SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE database() CREATE PROCEDURE database()
SELECT * from t1 where f2=f1; SELECT 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database() CALL database();
SELECT * from t1 where f2=f1' at line 1 1
1
DROP PROCEDURE database;
CREATE PROCEDURE databases() CREATE PROCEDURE databases()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'databases() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'databases()
@ -2350,6 +2352,12 @@ CREATE PROCEDURE join()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'join() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'join()
SELECT * from t1 where f2=f1' at line 1 SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE json_table()
SELECT 1;
CALL json_table();
1
1
DROP PROCEDURE json_table;
CREATE PROCEDURE key() CREATE PROCEDURE key()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key()
@ -2470,6 +2478,12 @@ CREATE PROCEDURE natural()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'natural() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'natural()
SELECT * from t1 where f2=f1' at line 1 SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE nested()
SELECT 1;
CALL nested();
1
1
DROP PROCEDURE nested;
CREATE PROCEDURE not() CREATE PROCEDURE not()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not()
@ -2509,6 +2523,12 @@ CREATE PROCEDURE order()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'order()
SELECT * from t1 where f2=f1' at line 1 SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE ordinality()
SELECT 1;
CALL ordinality;
1
1
DROP PROCEDURE ordinality;
CREATE PROCEDURE out() CREATE PROCEDURE out()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out()
@ -2521,6 +2541,12 @@ CREATE PROCEDURE outfile()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'outfile() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'outfile()
SELECT * from t1 where f2=f1' at line 1 SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE path()
SELECT 1;
CALL path();
1
1
DROP PROCEDURE path;
CREATE PROCEDURE precision() CREATE PROCEDURE precision()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision()
@ -2602,9 +2628,11 @@ SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'rlike() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'rlike()
SELECT * from t1 where f2=f1' at line 1 SELECT * from t1 where f2=f1' at line 1
CREATE PROCEDURE schema() CREATE PROCEDURE schema()
SELECT * from t1 where f2=f1; SELECT 1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema() CALL schema();
SELECT * from t1 where f2=f1' at line 1 1
1
DROP PROCEDURE schema;
CREATE PROCEDURE schemas() CREATE PROCEDURE schemas()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schemas() ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schemas()
@ -4204,9 +4232,6 @@ CREATE PROCEDURE sp1()
database:BEGIN database:BEGIN
SELECT @x; SELECT @x;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database:BEGIN
SELECT @x;
END' at line 2
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
databases:BEGIN databases:BEGIN
@ -4737,6 +4762,11 @@ SELECT @x;
END' at line 2 END' at line 2
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
json_table:BEGIN
SELECT @x;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1()
key:BEGIN key:BEGIN
SELECT @x; SELECT @x;
END// END//
@ -4977,6 +5007,11 @@ SELECT @x;
END' at line 2 END' at line 2
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
nested:BEGIN
SELECT @x;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1()
not:BEGIN not:BEGIN
SELECT @x; SELECT @x;
END// END//
@ -5057,6 +5092,11 @@ SELECT @x;
END' at line 2 END' at line 2
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
ordinality:BEGIN
SELECT @x;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1()
out:BEGIN out:BEGIN
SELECT @x; SELECT @x;
END// END//
@ -5081,6 +5121,11 @@ SELECT @x;
END' at line 2 END' at line 2
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
path:BEGIN
SELECT @x;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1()
precision:BEGIN precision:BEGIN
SELECT @x; SELECT @x;
END// END//
@ -5253,9 +5298,6 @@ CREATE PROCEDURE sp1()
schema:BEGIN schema:BEGIN
SELECT @x; SELECT @x;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema:BEGIN
SELECT @x;
END' at line 2
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
schemas:BEGIN schemas:BEGIN
@ -7811,8 +7853,6 @@ CREATE PROCEDURE sp1()
BEGIN BEGIN
declare database char; declare database char;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database char;
END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN
@ -8278,6 +8318,11 @@ END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN
declare json_table char;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1()
BEGIN
declare key char; declare key char;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key char; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key char;
@ -8488,6 +8533,11 @@ END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN
declare nested char;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1()
BEGIN
declare not char; declare not char;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not char; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not char;
@ -8556,6 +8606,11 @@ END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN
declare ordinality char;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1()
BEGIN
declare out char; declare out char;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out char; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out char;
@ -8577,6 +8632,11 @@ END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN
declare path char;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1()
BEGIN
declare precision char; declare precision char;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision char; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision char;
@ -8745,11 +8805,7 @@ CREATE PROCEDURE sp1()
BEGIN BEGIN
declare schema char; declare schema char;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema char;
END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN
declare schemas char; declare schemas char;
@ -9704,11 +9760,7 @@ BEGIN
declare database condition for sqlstate '02000'; declare database condition for sqlstate '02000';
declare exit handler for database set @var2 = 1; declare exit handler for database set @var2 = 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database condition for sqlstate '02000';
declare exit handler for database se...' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare databases condition for sqlstate '02000'; declare databases condition for sqlstate '02000';
@ -10372,6 +10424,12 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare json_table condition for sqlstate '02000';
declare exit handler for json_table set @var2 = 1;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1( )
BEGIN
declare key condition for sqlstate '02000'; declare key condition for sqlstate '02000';
declare exit handler for key set @var2 = 1; declare exit handler for key set @var2 = 1;
END// END//
@ -10672,6 +10730,12 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare nested condition for sqlstate '02000';
declare exit handler for nested set @var2 = 1;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1( )
BEGIN
declare not condition for sqlstate '02000'; declare not condition for sqlstate '02000';
declare exit handler for not set @var2 = 1; declare exit handler for not set @var2 = 1;
END// END//
@ -10768,6 +10832,12 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare ordinality condition for sqlstate '02000';
declare exit handler for ordinality set @var2 = 1;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1( )
BEGIN
declare out condition for sqlstate '02000'; declare out condition for sqlstate '02000';
declare exit handler for out set @var2 = 1; declare exit handler for out set @var2 = 1;
END// END//
@ -10798,6 +10868,12 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare path condition for sqlstate '02000';
declare exit handler for path set @var2 = 1;
END//
DROP PROCEDURE sp1;
CREATE PROCEDURE sp1( )
BEGIN
declare precision condition for sqlstate '02000'; declare precision condition for sqlstate '02000';
declare exit handler for precision set @var2 = 1; declare exit handler for precision set @var2 = 1;
END// END//
@ -11021,11 +11097,7 @@ BEGIN
declare schema condition for sqlstate '02000'; declare schema condition for sqlstate '02000';
declare exit handler for schema set @var2 = 1; declare exit handler for schema set @var2 = 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema condition for sqlstate '02000';
declare exit handler for schema set @v...' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare schemas condition for sqlstate '02000'; declare schemas condition for sqlstate '02000';
@ -11974,8 +12046,7 @@ CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare database handler for sqlstate '02000' set @var2 = 1; declare database handler for sqlstate '02000' set @var2 = 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'database handler for sqlstate '02000' set @var2 = 1; ERROR HY000: Unknown data type: 'handler'
END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
Warnings: Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
@ -12571,6 +12642,11 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare json_table handler for sqlstate '02000' set @var2 = 1;
END//
ERROR HY000: Unknown data type: 'handler'
CREATE PROCEDURE sp1( )
BEGIN
declare key handler for sqlstate '02000' set @var2 = 1; declare key handler for sqlstate '02000' set @var2 = 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key handler for sqlstate '02000' set @var2 = 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key handler for sqlstate '02000' set @var2 = 1;
@ -12841,6 +12917,11 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare nested handler for sqlstate '02000' set @var2 = 1;
END//
ERROR HY000: Unknown data type: 'handler'
CREATE PROCEDURE sp1( )
BEGIN
declare not handler for sqlstate '02000' set @var2 = 1; declare not handler for sqlstate '02000' set @var2 = 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not handler for sqlstate '02000' set @var2 = 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'not handler for sqlstate '02000' set @var2 = 1;
@ -12930,6 +13011,11 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare ordinality handler for sqlstate '02000' set @var2 = 1;
END//
ERROR HY000: Unknown data type: 'handler'
CREATE PROCEDURE sp1( )
BEGIN
declare out handler for sqlstate '02000' set @var2 = 1; declare out handler for sqlstate '02000' set @var2 = 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out handler for sqlstate '02000' set @var2 = 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'out handler for sqlstate '02000' set @var2 = 1;
@ -12957,6 +13043,11 @@ Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare path handler for sqlstate '02000' set @var2 = 1;
END//
ERROR HY000: Unknown data type: 'handler'
CREATE PROCEDURE sp1( )
BEGIN
declare precision handler for sqlstate '02000' set @var2 = 1; declare precision handler for sqlstate '02000' set @var2 = 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision handler for sqlstate '02000' set @var2 = 1; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'precision handler for sqlstate '02000' set @var2 = 1;
@ -13164,8 +13255,7 @@ CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare schema handler for sqlstate '02000' set @var2 = 1; declare schema handler for sqlstate '02000' set @var2 = 1;
END// END//
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'schema handler for sqlstate '02000' set @var2 = 1; ERROR HY000: Unknown data type: 'handler'
END' at line 3
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
Warnings: Warnings:
Note 1305 PROCEDURE db_storedproc.sp1 does not exist Note 1305 PROCEDURE db_storedproc.sp1 does not exist

View File

@ -1102,9 +1102,11 @@ CREATE PROCEDURE current_user()
CREATE PROCEDURE cursor() CREATE PROCEDURE cursor()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
--error ER_PARSE_ERROR
CREATE PROCEDURE database() CREATE PROCEDURE database()
SELECT * from t1 where f2=f1; SELECT 1;
CALL database();
DROP PROCEDURE database;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE databases() CREATE PROCEDURE databases()
@ -1367,6 +1369,12 @@ CREATE PROCEDURE iterate()
CREATE PROCEDURE join() CREATE PROCEDURE join()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
CREATE PROCEDURE json_table()
SELECT 1;
CALL json_table();
DROP PROCEDURE json_table;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE key() CREATE PROCEDURE key()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
@ -1487,6 +1495,13 @@ CREATE PROCEDURE modifies()
CREATE PROCEDURE natural() CREATE PROCEDURE natural()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
CREATE PROCEDURE nested()
SELECT 1;
CALL nested();
DROP PROCEDURE nested;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE not() CREATE PROCEDURE not()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
@ -1527,6 +1542,13 @@ CREATE PROCEDURE or()
CREATE PROCEDURE order() CREATE PROCEDURE order()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
CREATE PROCEDURE ordinality()
SELECT 1;
CALL ordinality;
DROP PROCEDURE ordinality;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE out() CREATE PROCEDURE out()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
@ -1539,6 +1561,13 @@ CREATE PROCEDURE outer()
CREATE PROCEDURE outfile() CREATE PROCEDURE outfile()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
CREATE PROCEDURE path()
SELECT 1;
CALL path();
DROP PROCEDURE path;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE precision() CREATE PROCEDURE precision()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
@ -1619,9 +1648,11 @@ CREATE PROCEDURE right()
CREATE PROCEDURE rlike() CREATE PROCEDURE rlike()
SELECT * from t1 where f2=f1; SELECT * from t1 where f2=f1;
--error ER_PARSE_ERROR
CREATE PROCEDURE schema() CREATE PROCEDURE schema()
SELECT * from t1 where f2=f1; SELECT 1;
CALL schema();
DROP PROCEDURE schema;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE schemas() CREATE PROCEDURE schemas()
@ -3481,7 +3512,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //; delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
database:BEGIN database:BEGIN
SELECT @x; SELECT @x;
@ -4284,6 +4315,15 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //;
CREATE PROCEDURE sp1()
json_table:BEGIN
SELECT @x;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
@ -4644,6 +4684,16 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //;
CREATE PROCEDURE sp1()
nested:BEGIN
SELECT @x;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
@ -4765,6 +4815,16 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //;
CREATE PROCEDURE sp1()
ordinality:BEGIN
SELECT @x;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
@ -4801,6 +4861,16 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //;
CREATE PROCEDURE sp1()
path:BEGIN
SELECT @x;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
@ -5066,7 +5136,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //; delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
schema:BEGIN schema:BEGIN
SELECT @x; SELECT @x;
@ -8938,7 +9008,7 @@ DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //; delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN
declare database char; declare database char;
@ -9736,11 +9806,20 @@ BEGIN
declare join char; declare join char;
END// END//
delimiter ;// delimiter ;//
--disable_warnings --disable_warnings
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //;
CREATE PROCEDURE sp1()
BEGIN
declare json_table char;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
@ -10101,6 +10180,16 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //;
CREATE PROCEDURE sp1()
BEGIN
declare nested char;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
@ -10220,6 +10309,16 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //;
CREATE PROCEDURE sp1()
BEGIN
declare ordinality char;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
@ -10256,6 +10355,16 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
--enable_warnings --enable_warnings
delimiter //;
CREATE PROCEDURE sp1()
BEGIN
declare path char;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
@ -10506,7 +10615,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1() CREATE PROCEDURE sp1()
BEGIN BEGIN
declare schema char; declare schema char;
@ -11624,7 +11733,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare database condition for sqlstate '02000'; declare database condition for sqlstate '02000';
@ -12360,6 +12469,17 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //;
CREATE PROCEDURE sp1( )
BEGIN
declare json_table condition for sqlstate '02000';
declare exit handler for json_table set @var2 = 1;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
@ -12690,6 +12810,17 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //;
CREATE PROCEDURE sp1( )
BEGIN
declare nested condition for sqlstate '02000';
declare exit handler for nested set @var2 = 1;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
@ -12799,6 +12930,17 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //;
CREATE PROCEDURE sp1( )
BEGIN
declare ordinality condition for sqlstate '02000';
declare exit handler for ordinality set @var2 = 1;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
@ -12832,6 +12974,17 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //;
CREATE PROCEDURE sp1( )
BEGIN
declare path condition for sqlstate '02000';
declare exit handler for path set @var2 = 1;
END//
delimiter ;//
DROP PROCEDURE sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
@ -13075,7 +13228,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare schema condition for sqlstate '02000'; declare schema condition for sqlstate '02000';
@ -14181,7 +14334,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare database handler for sqlstate '02000' set @var2 = 1; declare database handler for sqlstate '02000' set @var2 = 1;
@ -14850,6 +15003,14 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //;
--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare json_table handler for sqlstate '02000' set @var2 = 1;
END//
delimiter ;//
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
@ -15150,6 +15311,14 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //;
--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare nested handler for sqlstate '02000' set @var2 = 1;
END//
delimiter ;//
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
@ -15250,6 +15419,14 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //;
--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare ordinality handler for sqlstate '02000' set @var2 = 1;
END//
delimiter ;//
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
@ -15280,6 +15457,14 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //;
--error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( )
BEGIN
declare path handler for sqlstate '02000' set @var2 = 1;
END//
delimiter ;//
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_PARSE_ERROR
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
@ -15511,7 +15696,7 @@ delimiter ;//
DROP PROCEDURE IF EXISTS sp1; DROP PROCEDURE IF EXISTS sp1;
delimiter //; delimiter //;
--error ER_PARSE_ERROR --error ER_UNKNOWN_DATA_TYPE
CREATE PROCEDURE sp1( ) CREATE PROCEDURE sp1( )
BEGIN BEGIN
declare schema handler for sqlstate '02000' set @var2 = 1; declare schema handler for sqlstate '02000' set @var2 = 1;

View File

@ -3085,8 +3085,10 @@ eval SHOW CREATE VIEW test1.v$level;
# the following line as written as '--eror ER_TOO_MANY_TABLES' and the command # the following line as written as '--eror ER_TOO_MANY_TABLES' and the command
# is successful so assuming no expected error was intended # is successful so assuming no expected error was intended
# --error ER_TOO_MANY_TABLES # --error ER_TOO_MANY_TABLES
--disable_ps2_protocol
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1, eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$level; CAST(f2 AS CHAR) AS f2 FROM test1.v$level;
--enable_ps2_protocol
let $message= The output of following EXPLAIN is deactivated, because the result let $message= The output of following EXPLAIN is deactivated, because the result
differs on some platforms differs on some platforms
FIXME Is this a bug ? ; FIXME Is this a bug ? ;
@ -3116,16 +3118,20 @@ SELECT f1 as f2, f2 as f1 FROM test2.t1;
CREATE OR REPLACE VIEW test2.v0 AS CREATE OR REPLACE VIEW test2.v0 AS
SELECT CAST('0001-01-01' AS DATE) as f1, f2 FROM test3.t1; SELECT CAST('0001-01-01' AS DATE) as f1, f2 FROM test3.t1;
eval SHOW CREATE VIEW test1.v$toplevel; eval SHOW CREATE VIEW test1.v$toplevel;
--disable_ps2_protocol
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1, eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel; CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
--enable_ps2_protocol
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel; CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
# 2.3.3 UCS2 string instead of common string # 2.3.3 UCS2 string instead of common string
CREATE OR REPLACE VIEW test3.v0 AS CREATE OR REPLACE VIEW test3.v0 AS
SELECT f1 , CONVERT('ßÄäÖöÜü§' USING UCS2) as f2 FROM test1.t1; SELECT f1 , CONVERT('ßÄäÖöÜü§' USING UCS2) as f2 FROM test1.t1;
eval SHOW CREATE VIEW test1.v$toplevel; eval SHOW CREATE VIEW test1.v$toplevel;
--disable_ps2_protocol
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1, eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel; CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
--enable_ps2_protocol
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel; CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
@ -3133,8 +3139,10 @@ eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CREATE OR REPLACE VIEW test3.v0 AS CREATE OR REPLACE VIEW test3.v0 AS
SELECT CONVERT('ßÄäÖöÜü§' USING UCS2) as f1, f2 FROM test1.t1; SELECT CONVERT('ßÄäÖöÜü§' USING UCS2) as f1, f2 FROM test1.t1;
eval SHOW CREATE VIEW test1.v$toplevel; eval SHOW CREATE VIEW test1.v$toplevel;
--disable_ps2_protocol
eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1, eval SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel; CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
--enable_ps2_protocol
eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1, eval EXPLAIN SELECT CAST(f1 AS SIGNED INTEGER) AS f1,
CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel; CAST(f2 AS CHAR) AS f2 FROM test1.v$toplevel;
--enable_result_log --enable_result_log

View File

@ -120,7 +120,6 @@ Filename::tab#.ibd
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Freshly allocated page | - #::# | Freshly allocated page | -
#::# | Freshly allocated page | -
# Variables used by page type dump for ibdata1 # Variables used by page type dump for ibdata1
Variables (--variable-name=value) Variables (--variable-name=value)
@ -154,7 +153,6 @@ Filename::tab#.ibd
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, - #::# | Index page | index id=#, page level=#, No. of records=#, garbage=#, -
#::# | Freshly allocated page | - #::# | Freshly allocated page | -
#::# | Freshly allocated page | -
[6]: check the valid lower bound values for option [6]: check the valid lower bound values for option
# allow-mismatches,page,start-page,end-page # allow-mismatches,page,start-page,end-page
[9]: check the both short and long options "page" and "start-page" when [9]: check the both short and long options "page" and "start-page" when

View File

@ -1,6 +1,7 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc --source include/have_debug.inc
--source include/not_windows.inc
--connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1) --connect (server_1,127.0.0.1,root,,,$SERVER_MYPORT_1)
--connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2) --connect (server_2,127.0.0.1,root,,,$SERVER_MYPORT_2)

View File

@ -191,17 +191,17 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT; ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
test 8b1406618d34996cd11d1796438c78b5 EXPLAIN SELECT * FROM `test` . `v1` 1 test b69a5ddd08657692e23aa72d37dc15e0 EXPLAIN SELECT * FROM `test` . `v1` 1
test 2c9e5d5b30d1690ba1a625afb4c42005 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1 test 8c76fc18fe1711607640be2906e38f58 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test 2265269dbe1b17d1f309a63b8e56933f EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1 test 9bedc57de65e2ac25d67fcb6ccadb427 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test 2df0babfc3c8ad27b4e3f99ad59bc938 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1 test 0539bbfdb016341a22d32fecb12c9882 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
test 8607297e7ffe77aa19a9d60812c5a8fd EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1 test 3368b44e9d8b8cfb13b58f97a255d77f EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
test 9c94fee7865aa050201f6e67887fd0c8 SELECT * FROM `test` . `v1` 1 test 2f619aeadc8bd993980ef9b4d12e4222 SELECT * FROM `test` . `v1` 1
test 7c856ddf7b57d65f8124f39e8b81882e SELECT * FROM `test` . `v1` WHERE `a` = ? 1 test b9a44c024c9d79de76f2ebcd2f208c4c SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test 994b14d068c24edd8fd61b2f03663be2 SELECT * FROM `test` . `v1` WHERE `b` > ? 1 test a3ccc4c3c79e853eaa17e3ceb7a24b30 SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test b3102e1f51878e35936d7d3fe2901839 SELECT `a` , `b` FROM `test` . `v1` 1 test 9556566adc0953fccd8e2e35019287ed SELECT `a` , `b` FROM `test` . `v1` 1
test cb300dd6358987c5afe1a2b0022fdea0 SELECT `b` , `a` FROM `test` . `v1` 1 test fc937c99007b0976d19fb685b3bf9acc SELECT `b` , `a` FROM `test` . `v1` 1
test 1b40b63f6a9dbffd146f0916fe4f5ed2 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 test a73dca7a09f45de04f1f4588f0a4e19f TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP TABLE test.v1; DROP TABLE test.v1;
CREATE VIEW test.v1 AS SELECT * FROM test.t1; CREATE VIEW test.v1 AS SELECT * FROM test.t1;
EXPLAIN SELECT * from test.v1; EXPLAIN SELECT * from test.v1;
@ -248,19 +248,19 @@ SELECT SCHEMA_NAME, DIGEST, DIGEST_TEXT, COUNT_STAR
FROM performance_schema.events_statements_summary_by_digest FROM performance_schema.events_statements_summary_by_digest
ORDER BY DIGEST_TEXT; ORDER BY DIGEST_TEXT;
SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR SCHEMA_NAME DIGEST DIGEST_TEXT COUNT_STAR
test a68fd555281a14d2809c3105e9cb2c90 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1 test 7f6c48fe072a231bc75d6d449978b9f5 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
test 4baff8f96e4b6ec6cdbfef5b9c7a8b12 DROP TABLE `test` . `v1` 1 test c24db45ea4beed6ba2537ca6ea2d0484 DROP TABLE `test` . `v1` 1
test 8b1406618d34996cd11d1796438c78b5 EXPLAIN SELECT * FROM `test` . `v1` 2 test b69a5ddd08657692e23aa72d37dc15e0 EXPLAIN SELECT * FROM `test` . `v1` 2
test 2c9e5d5b30d1690ba1a625afb4c42005 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2 test 8c76fc18fe1711607640be2906e38f58 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test 2265269dbe1b17d1f309a63b8e56933f EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2 test 9bedc57de65e2ac25d67fcb6ccadb427 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test 2df0babfc3c8ad27b4e3f99ad59bc938 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2 test 0539bbfdb016341a22d32fecb12c9882 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
test 8607297e7ffe77aa19a9d60812c5a8fd EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2 test 3368b44e9d8b8cfb13b58f97a255d77f EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
test 9c94fee7865aa050201f6e67887fd0c8 SELECT * FROM `test` . `v1` 2 test 2f619aeadc8bd993980ef9b4d12e4222 SELECT * FROM `test` . `v1` 2
test 7c856ddf7b57d65f8124f39e8b81882e SELECT * FROM `test` . `v1` WHERE `a` = ? 2 test b9a44c024c9d79de76f2ebcd2f208c4c SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test 994b14d068c24edd8fd61b2f03663be2 SELECT * FROM `test` . `v1` WHERE `b` > ? 2 test a3ccc4c3c79e853eaa17e3ceb7a24b30 SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test df38ce7f6e35972efe5a4ec57e48bf4d SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1 test 7b82ea9a7c1859f76abed712d2d4b14d SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
test b3102e1f51878e35936d7d3fe2901839 SELECT `a` , `b` FROM `test` . `v1` 2 test 9556566adc0953fccd8e2e35019287ed SELECT `a` , `b` FROM `test` . `v1` 2
test cb300dd6358987c5afe1a2b0022fdea0 SELECT `b` , `a` FROM `test` . `v1` 2 test fc937c99007b0976d19fb685b3bf9acc SELECT `b` , `a` FROM `test` . `v1` 2
test 1b40b63f6a9dbffd146f0916fe4f5ed2 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 test a73dca7a09f45de04f1f4588f0a4e19f TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1
DROP VIEW test.v1; DROP VIEW test.v1;
DROP TABLE test.t1; DROP TABLE test.t1;

View File

@ -8,5 +8,5 @@ SELECT 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1
#################################### ####################################
SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long; SELECT event_name, digest, digest_text, sql_text FROM events_statements_history_long;
event_name digest digest_text sql_text event_name digest digest_text sql_text
statement/sql/select ca9181d6d668396d467dd974f58a9402 SELECT ? + ? + SELECT ... statement/sql/select 142569e3e23dff2a0170a603ed79020a SELECT ? + ? + SELECT ...
statement/sql/truncate 4d2423d405bbcea8fa7bf9519c08dd8e TRUNCATE TABLE truncat... statement/sql/truncate 5947880b8ba439f0ed3ff0bfbb04eebf TRUNCATE TABLE truncat...

View File

@ -1,5 +1,7 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_perfschema.inc --source include/have_perfschema.inc
# This does not crash on 32 bit because of less memory used
--source include/have_64bit.inc
--echo # --echo #
--echo # MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status --echo # MDEV-33150 double-locking of LOCK_thd_kill in performance_schema.session_status
--echo # --echo #

View File

@ -9,6 +9,7 @@ sql_error_log_rotate OFF
sql_error_log_rotations 9 sql_error_log_rotations 9
sql_error_log_size_limit 1000000 sql_error_log_size_limit 1000000
sql_error_log_warnings ON sql_error_log_warnings ON
sql_error_log_with_db_and_thread_info OFF
set global sql_error_log_rate=1; set global sql_error_log_rate=1;
select * from t_doesnt_exist; select * from t_doesnt_exist;
ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist ERROR 42S02: Table 'test.t_doesnt_exist' doesn't exist

View File

@ -0,0 +1,41 @@
show variables like 'sql_error_log%';
Variable_name Value
sql_error_log_filename sql_errors.log
sql_error_log_rate 1
sql_error_log_rotate OFF
sql_error_log_rotations 9
sql_error_log_size_limit 1000000
sql_error_log_warnings ON
sql_error_log_with_db_and_thread_info ON
set global sql_error_log_rate=1;
# Trying to set the variable at runtime
SET sql_error_log_with_db_and_thread_info=OFF;
ERROR HY000: Variable 'sql_error_log_with_db_and_thread_info' is a read only variable
#
# Using test database from mtr
#
DROP DATABASE db;
ERROR HY000: Can't drop database 'db'; database doesn't exist
#
# Using no database at all
#
connect con1,localhost,root,,*NO-ONE*;
DROP DATABASE dbnodb;
ERROR HY000: Can't drop database 'dbnodb'; database doesn't exist
disconnect con1;
connection default;
#
# Using database with name `NULL`
#
CREATE DATABASE `NULL`;
USE `NULL`;
DROP DATABASE db;
ERROR HY000: Can't drop database 'db'; database doesn't exist
TIME THREAD_ID HOSTNAME `mtr` WARNING 1286: Unknown storage engine 'InnoDB' : SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql
TIME THREAD_ID HOSTNAME `mtr` WARNING 1286: Unknown storage engine 'InnoDB' : SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql
TIME THREAD_ID HOSTNAME `mtr` WARNING 1286: Unknown storage engine 'InnoDB' : SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql
TIME THREAD_ID HOSTNAME `test` ERROR 1238: Variable 'sql_error_log_with_db_and_thread_info' is a read only variable : SET sql_error_log_with_db_and_thread_info=OFF
TIME THREAD_ID HOSTNAME `test` ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db
TIME THREAD_ID HOSTNAME NULL ERROR 1008: Can't drop database 'dbnodb'; database doesn't exist : DROP DATABASE dbnodb
TIME THREAD_ID HOSTNAME `NULL` ERROR 1008: Can't drop database 'db'; database doesn't exist : DROP DATABASE db
DROP DATABASE `NULL`;

View File

@ -0,0 +1 @@
--plugin-load-add=$SQL_ERRLOG_SO --sql-error-log-with-db-and-thread-info=1 --lower_case_table_names=2

View File

@ -0,0 +1,49 @@
--source include/not_embedded.inc
if (!$SQL_ERRLOG_SO) {
skip No SQL_ERROR_LOG plugin;
}
show variables like 'sql_error_log%';
set global sql_error_log_rate=1;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--echo # Trying to set the variable at runtime
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
SET sql_error_log_with_db_and_thread_info=OFF;
--echo #
--echo # Using test database from mtr
--echo #
--error ER_DB_DROP_EXISTS
DROP DATABASE db;
--echo #
--echo # Using no database at all
--echo #
connect (con1,localhost,root,,*NO-ONE*);
--error ER_DB_DROP_EXISTS
DROP DATABASE dbnodb;
disconnect con1;
connection default;
--echo #
--echo # Using database with name `NULL`
--echo #
CREATE DATABASE `NULL`;
USE `NULL`;
--error ER_DB_DROP_EXISTS
DROP DATABASE db;
--let SEARCH_FILE= $MYSQLD_DATADIR/sql_errors.log
--let LINES_TO_READ=7
--replace_regex /[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* `mtr` /TIME THREAD_ID HOSTNAME `mtr` //[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* `test` /TIME THREAD_ID HOSTNAME `test` //[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* NULL /TIME THREAD_ID HOSTNAME NULL //[1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [0-9]* .* @ .* `NULL` /TIME THREAD_ID HOSTNAME `NULL` /
--source include/read_head.inc
DROP DATABASE `NULL`;

View File

@ -85,5 +85,16 @@ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHER
--eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1 --eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1
--source include/start_slave.inc --source include/start_slave.inc
# Ensure master is ready to start sending new transactions. That is, because
# the master does not have log_slave_updates, the slave's transactions of
# repl_t are not binlogged, and its state is behind. If the master binlogs
# any new transactions before the slaves connection is matured,
# ER_GTID_POSITION_NOT_FOUND_IN_BINLOG2 can be reported to the slave
# FIXME: We shouldn't need to do this, rather, the master should use
# log-slave-updates and gtid-strict-mode
--connection master
--let $wait_condition= SELECT COUNT(*) > 0 FROM information_schema.processlist WHERE State like '%Master has sent all binlog to slave%'
--source include/wait_condition.inc
--let $include_filename= rpl_change_master_demote.inc --let $include_filename= rpl_change_master_demote.inc
--source include/end_include_file.inc --source include/end_include_file.inc

View File

@ -8,6 +8,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
"Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')" "Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'\'\).*/ in mysqld.1.err FOUND 1 /using_gtid\(1\), gtid\(\'\'\).*/ in mysqld.1.err
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
@ -15,6 +16,7 @@ CHANGE MASTER TO MASTER_USE_GTID=no;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
"Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')" "Test Case 2: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(0), gtid('')"
include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(0\), gtid\(\'\'\).*/ in mysqld.1.err FOUND 1 /using_gtid\(0\), gtid\(\'\'\).*/ in mysqld.1.err
CREATE TABLE t (f INT) ENGINE=INNODB; CREATE TABLE t (f INT) ENGINE=INNODB;
INSERT INTO t VALUES(10); INSERT INTO t VALUES(10);
@ -25,6 +27,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
"Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')" "Test Case 3: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2')"
include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2\'\).*/ in mysqld.1.err FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2\'\).*/ in mysqld.1.err
SET @@SESSION.gtid_domain_id=10; SET @@SESSION.gtid_domain_id=10;
INSERT INTO t VALUES(20); INSERT INTO t VALUES(20);
@ -35,6 +38,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
"Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')" "Test Case 4: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('0-1-2,10-1-1')"
include/wait_for_pattern_in_file.inc
FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*/ in mysqld.1.err FOUND 1 /using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*/ in mysqld.1.err
"===== Clean up =====" "===== Clean up ====="
connection slave; connection slave;

View File

@ -58,6 +58,7 @@ GTID_SLAVE_POS 0-2-3
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# #
# Test Case 2: If gtid_slave_pos is empty, gtid_binlog_pos will # Test Case 2: If gtid_slave_pos is empty, gtid_binlog_pos will
# completely overwrite it with MASTER_DEMOTE_TO_SLAVE=1. # completely overwrite it with MASTER_DEMOTE_TO_SLAVE=1.
@ -124,6 +125,7 @@ GTID_SLAVE_POS 0-2-5
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# #
# Test Case 3: Using a single domain id, if neither gtid_slave_pos nor # Test Case 3: Using a single domain id, if neither gtid_slave_pos nor
# gtid_binlog_pos are empty, and gtid_binlog_pos is more recent, then # gtid_binlog_pos are empty, and gtid_binlog_pos is more recent, then
@ -183,6 +185,7 @@ GTID_SLAVE_POS 0-2-9
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# #
# Test Case 4: If gtid_slave_pos and gtid_binlog_pos are equivalent, # Test Case 4: If gtid_slave_pos and gtid_binlog_pos are equivalent,
# MASTER_DEMOTE_TO_SLAVE=1 will not change gtid_slave_pos. # MASTER_DEMOTE_TO_SLAVE=1 will not change gtid_slave_pos.
@ -244,6 +247,7 @@ GTID_SLAVE_POS 0-2-13
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# #
# Test Case 5: If a new domain id is added into gtid_binlog_pos while # Test Case 5: If a new domain id is added into gtid_binlog_pos while
# gtid_slave_pos already has a state, MASTER_DEMOTE_TO_SLAVE=1 will # gtid_slave_pos already has a state, MASTER_DEMOTE_TO_SLAVE=1 will
@ -308,6 +312,7 @@ GTID_SLAVE_POS 0-2-17,1-1-2
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# #
# Test Case 6: If gtid_slave_pos has multiple GTID positions and # Test Case 6: If gtid_slave_pos has multiple GTID positions and
# gtid_binlog_pos contains updates on existing domain ids, new # gtid_binlog_pos contains updates on existing domain ids, new
@ -390,6 +395,7 @@ GTID_SLAVE_POS 0-2-21,1-3-4,2-1-2,4-3-2
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# #
# Test Case 7: If MASTER_DEMOTE_TO_SLAVE=1 is combined with # Test Case 7: If MASTER_DEMOTE_TO_SLAVE=1 is combined with
# IGNORE_DOMAIN_IDS such that gtid_binlog_pos has more recent GTIDs # IGNORE_DOMAIN_IDS such that gtid_binlog_pos has more recent GTIDs
@ -455,6 +461,7 @@ GTID_SLAVE_POS 0-2-24,1-3-4,2-1-3,3-1-2,4-3-2
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# #
# Test Case 8: If gtid_binlog_pos is more recent than gtid_slave_pos, # Test Case 8: If gtid_binlog_pos is more recent than gtid_slave_pos,
# and MASTER_DEMOTE_TO_SLAVE=1 is combined with a later call to # and MASTER_DEMOTE_TO_SLAVE=1 is combined with a later call to
@ -556,6 +563,7 @@ GTID_SLAVE_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# Demote master to slave with the more recent gtid_slave_pos # Demote master to slave with the more recent gtid_slave_pos
connection master; connection master;
CHANGE MASTER TO master_host='127.0.0.1', master_port=SLAVE_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=SLAVE_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
@ -619,6 +627,7 @@ GTID_SLAVE_POS 0-2-32,1-3-4,2-1-3,3-1-2,4-3-2
connection master; connection master;
connection slave; connection slave;
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1; CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
connection master;
# Tag gtid_slave_pos now (before binlog updates) for later comparison # Tag gtid_slave_pos now (before binlog updates) for later comparison
connection master; connection master;
# In domain 1, make gtid_slave_pos < gtid_binlog_pos # In domain 1, make gtid_slave_pos < gtid_binlog_pos

View File

@ -1,5 +1,7 @@
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection server_2;
call mtr.add_suppression("Timeout waiting for reply of binlog");
# Master server_1 and Slave server_2 initialization ... # Master server_1 and Slave server_2 initialization ...
connection server_2; connection server_2;
include/stop_slave.inc include/stop_slave.inc
@ -40,6 +42,8 @@ set @@global.rpl_semi_sync_master_enabled = 1;
INSERT INTO t1(a) VALUES (2); INSERT INTO t1(a) VALUES (2);
include/save_master_gtid.inc include/save_master_gtid.inc
connection server_1; connection server_1;
include/stop_slave.inc
include/start_slave.inc
# #
# the successful sync is a required proof # the successful sync is a required proof
# #

View File

@ -70,6 +70,9 @@ include/stop_slave.inc
# CHANGE MASTER TO MASTER_DELAY = 2*T # CHANGE MASTER TO MASTER_DELAY = 2*T
include/start_slave.inc include/start_slave.inc
connection master; connection master;
INSERT INTO t1 VALUES ('Syncing slave', 5);
connection slave;
connection master;
INSERT INTO t1 VALUES (delay_on_slave(1), 6); INSERT INTO t1 VALUES (delay_on_slave(1), 6);
Warnings: Warnings:
Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave

View File

@ -38,8 +38,9 @@ connection master;
include/rpl_start_server.inc [server_number=1] include/rpl_start_server.inc [server_number=1]
# Master has restarted successfully # Master has restarted successfully
connection slave; connection slave;
include/wait_for_slave_io_to_start.inc include/stop_slave_sql.inc
include/wait_for_slave_sql_to_start.inc include/stop_slave_io.inc
include/start_slave.inc
select * from ti; select * from ti;
a a
1 1

View File

@ -21,23 +21,23 @@ master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment '' master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-# master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 1 master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 1
master-bin.000001 # Table_map 1 # table_id: 4294967295 (test.t)
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967295 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t) master-bin.000001 # Table_map 1 # table_id: 4294967296 (test.t)
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F master-bin.000001 # Write_rows_v1 1 # table_id: 4294967296 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # GTID #-#-# master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment '' master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-# master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3 master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 2
master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t) master-bin.000001 # Table_map 1 # table_id: 4294967297 (test.t)
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F master-bin.000001 # Write_rows_v1 1 # table_id: 4294967297 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT master-bin.000001 # Query 1 # COMMIT
master-bin.000001 # Gtid 1 # GTID #-#-#
master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment ''
master-bin.000001 # Gtid 1 # BEGIN GTID #-#-#
master-bin.000001 # Annotate_rows 1 # INSERT INTO t SET a= 3
master-bin.000001 # Table_map 1 # table_id: 4294967298 (test.t)
master-bin.000001 # Write_rows_v1 1 # table_id: 4294967298 flags: STMT_END_F
master-bin.000001 # Query 1 # COMMIT
connection slave; connection slave;
connection master; connection master;
SET debug_dbug=@old_debug_dbug; SET debug_dbug=@old_debug_dbug;

View File

@ -6,7 +6,8 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
include/start_slave.inc include/start_slave.inc
include/stop_slave.inc include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug; SET @save_dbug= @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master"; SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
include/start_slave.inc include/start_slave.inc
# Future events must be logged at least 2 seconds after # Future events must be logged at least 2 seconds after
# the slave starts # the slave starts
@ -18,11 +19,6 @@ insert into t1 values (1);
# event in its relay log # event in its relay log
flush logs; flush logs;
connection slave; connection slave;
# Ignore FDEs that happen before the CREATE/INSERT commands
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
# On the next FDE, the slave should have the master CREATE/INSERT events # On the next FDE, the slave should have the master CREATE/INSERT events
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
select count(*)=1 from t1; select count(*)=1 from t1;

View File

@ -7,7 +7,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets"); call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave; connection slave;
set sql_log_bin=0; set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1; set sql_log_bin=1;
@ -28,7 +27,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here # Main test of semi-sync replication start here
# #
connection master; connection master;
set global rpl_semi_sync_master_timeout= 60000; set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ] [ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled'; show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value Variable_name Value
@ -163,11 +162,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction # Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply. # timeout waiting for slave reply.
# #
connection master;
show status like "Rpl_semi_sync_master_status";
Variable_name Value
Rpl_semi_sync_master_status ON
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
connection master; connection master;
include/kill_binlog_dump_threads.inc include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000; set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ] [ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value Variable_name Value
@ -317,6 +320,8 @@ include/kill_binlog_dump_threads.inc
connection slave; connection slave;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
connection slave;
connection master;
create table t1 (a int) engine = ENGINE_TYPE; create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2), (3); insert into t1 values (2), (3);
@ -359,6 +364,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value Variable_name Value
Rpl_semi_sync_slave_status ON Rpl_semi_sync_slave_status ON
connection master; connection master;
connection slave;
connection master;
[ master semi-sync should be ON ] [ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_clients';
Variable_name Value Variable_name Value

View File

@ -8,7 +8,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets"); call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave; connection slave;
set sql_log_bin=0; set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1; set sql_log_bin=1;
@ -29,7 +28,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here # Main test of semi-sync replication start here
# #
connection master; connection master;
set global rpl_semi_sync_master_timeout= 60000; set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ] [ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled'; show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value Variable_name Value
@ -164,11 +163,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction # Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply. # timeout waiting for slave reply.
# #
connection master;
show status like "Rpl_semi_sync_master_status";
Variable_name Value
Rpl_semi_sync_master_status ON
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
connection master; connection master;
include/kill_binlog_dump_threads.inc include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000; set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ] [ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value Variable_name Value
@ -318,6 +321,8 @@ include/kill_binlog_dump_threads.inc
connection slave; connection slave;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
connection slave;
connection master;
create table t1 (a int) engine = ENGINE_TYPE; create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2), (3); insert into t1 values (2), (3);
@ -360,6 +365,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value Variable_name Value
Rpl_semi_sync_slave_status ON Rpl_semi_sync_slave_status ON
connection master; connection master;
connection slave;
connection master;
[ master semi-sync should be ON ] [ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_clients';
Variable_name Value Variable_name Value

View File

@ -8,7 +8,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets"); call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave; connection slave;
set sql_log_bin=0; set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1; set sql_log_bin=1;
@ -29,7 +28,7 @@ set global rpl_semi_sync_slave_enabled= 0;
# Main test of semi-sync replication start here # Main test of semi-sync replication start here
# #
connection master; connection master;
set global rpl_semi_sync_master_timeout= 60000; set global rpl_semi_sync_master_timeout= 2000;
[ default state of semi-sync on master should be OFF ] [ default state of semi-sync on master should be OFF ]
show variables like 'rpl_semi_sync_master_enabled'; show variables like 'rpl_semi_sync_master_enabled';
Variable_name Value Variable_name Value
@ -164,11 +163,15 @@ connection slave;
# Test semi-sync master will switch OFF after one transaction # Test semi-sync master will switch OFF after one transaction
# timeout waiting for slave reply. # timeout waiting for slave reply.
# #
connection master;
show status like "Rpl_semi_sync_master_status";
Variable_name Value
Rpl_semi_sync_master_status ON
connection slave; connection slave;
include/stop_slave.inc include/stop_slave.inc
connection master; connection master;
include/kill_binlog_dump_threads.inc include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000; set global rpl_semi_sync_master_timeout= 2000;
[ master status should be ON ] [ master status should be ON ]
show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_no_tx';
Variable_name Value Variable_name Value
@ -318,6 +321,8 @@ include/kill_binlog_dump_threads.inc
connection slave; connection slave;
include/start_slave.inc include/start_slave.inc
connection master; connection master;
connection slave;
connection master;
create table t1 (a int) engine = ENGINE_TYPE; create table t1 (a int) engine = ENGINE_TYPE;
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (2), (3); insert into t1 values (2), (3);
@ -360,6 +365,8 @@ show status like 'Rpl_semi_sync_slave_status';
Variable_name Value Variable_name Value
Rpl_semi_sync_slave_status ON Rpl_semi_sync_slave_status ON
connection master; connection master;
connection slave;
connection master;
[ master semi-sync should be ON ] [ master semi-sync should be ON ]
show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_clients';
Variable_name Value Variable_name Value

View File

@ -7,7 +7,6 @@ call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets"); call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave; connection slave;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
connection master; connection master;

View File

@ -8,7 +8,6 @@ call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT."); call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets"); call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave; connection slave;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
connection master; connection master;

View File

@ -5,6 +5,7 @@ include/stop_slave.inc
connection server_1; connection server_1;
RESET MASTER; RESET MASTER;
SET @@global.max_binlog_size= 4096; SET @@global.max_binlog_size= 4096;
set @@global.rpl_semi_sync_master_enabled = 1;
connection server_2; connection server_2;
RESET MASTER; RESET MASTER;
SET @@global.max_binlog_size= 4096; SET @@global.max_binlog_size= 4096;
@ -14,7 +15,6 @@ CHANGE MASTER TO master_use_gtid= slave_pos;
include/start_slave.inc include/start_slave.inc
connection server_1; connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set @@global.rpl_semi_sync_master_enabled = 1;
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC; set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;
INSERT INTO t1 VALUES (1, 'dummy1'); INSERT INTO t1 VALUES (1, 'dummy1');

View File

@ -0,0 +1,48 @@
include/rpl_init.inc [topology=1->2,1->3]
connection server_1;
set @old_enabled= @@global.rpl_semi_sync_master_enabled;
set @old_timeout= @@global.rpl_semi_sync_master_timeout;
set global rpl_semi_sync_master_enabled= 1;
set global rpl_semi_sync_master_timeout= 500;
connection server_2;
include/stop_slave.inc
set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
set @old_dbug= @@global.debug_dbug;
set global rpl_semi_sync_slave_enabled= 1;
set global debug_dbug="+d,simulate_delay_semisync_slave_reply";
include/start_slave.inc
connection server_3;
include/stop_slave.inc
set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
set global rpl_semi_sync_slave_enabled= 1;
include/start_slave.inc
# Ensure primary recognizes both replicas are semi-sync
connection server_1;
connection server_1;
create table t1 (a int);
connection server_2;
# Verifying server_2 did not send ACK
connection server_3;
# Verifying server_3 did send ACK
connection server_1;
# Verifying master's semi-sync status is still ON (This failed pre-MDEV-32960 fixes)
# Verifying rpl_semi_sync_master_yes_tx incremented
#
# Cleanup
connection server_2;
set global rpl_semi_sync_slave_enabled= @old_enabled;
set global debug_dbug= @old_dbug;
include/stop_slave.inc
connection server_3;
set global rpl_semi_sync_slave_enabled= @old_enabled;
include/stop_slave.inc
connection server_1;
set global rpl_semi_sync_master_enabled= @old_enabled;
set global rpl_semi_sync_master_timeout= @old_timeout;
drop table t1;
connection server_2;
include/start_slave.inc
connection server_3;
include/start_slave.inc
include/rpl_end.inc
# End of rpl_semi_sync_no_missed_ack_after_add_slave.test

View File

@ -0,0 +1,35 @@
include/master-slave.inc
[connection master]
call mtr.add_suppression("Replication event checksum verification failed");
call mtr.add_suppression("could not queue event from master");
#
# Set up a semisync connection
connection master;
set @@global.rpl_semi_sync_master_enabled= ON;
connection slave;
stop slave io_thread;
set @@global.rpl_semi_sync_slave_enabled= ON;
set @old_dbug= @@global.debug_dbug;
set @@global.debug_dbug= "+d,corrupt_queue_event";
set @@global.debug_dbug= "+d,pause_before_io_read_event";
set @@global.debug_dbug= "+d,placeholder";
start slave io_thread;
# Disable semi-sync on the slave while the IO thread is active
set debug_sync='now wait_for io_thread_at_read_event';
set @@global.rpl_semi_sync_slave_enabled= OFF;
set debug_sync='now signal io_thread_continue_read_event';
# Waiting for the slave to stop with the error from corrupt_queue_event
connection slave;
include/wait_for_slave_io_error.inc [errno=1595,1743]
# Sleep 1 to give time for Ack_receiver to receive COM_QUIT
include/assert_grep.inc [Check that there is no 'Read semi-sync reply magic number error' in error log.]
#
# Cleanup
connection slave;
include/stop_slave.inc
set @@global.debug_dbug= @old_dbug;
include/start_slave.inc
connection master;
set @@global.rpl_semi_sync_master_enabled= default;
include/rpl_end.inc
# End of rpl_semi_sync_slave_enabled_consistent.test

View File

@ -4,6 +4,7 @@ connection slave;
include/stop_slave.inc include/stop_slave.inc
connection master; connection master;
call mtr.add_suppression("Timeout waiting for reply of binlog*"); call mtr.add_suppression("Timeout waiting for reply of binlog*");
call mtr.add_suppression("Master server does not read semi-sync messages*");
set global rpl_semi_sync_master_enabled = ON; set global rpl_semi_sync_master_enabled = ON;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100; SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
create table t1 (i int); create table t1 (i int);
@ -15,8 +16,8 @@ SET GLOBAL debug_dbug="+d,semislave_failed_net_flush";
include/start_slave.inc include/start_slave.inc
connection master; connection master;
connection slave; connection slave;
"Assert that the net_fulsh() reply failed is present in slave error log. "Assert that Master server does not read semi-sync messages" is present in slave error log.
FOUND 1 /Semi-sync slave net_flush\(\) reply failed/ in mysqld.2.err FOUND 1 /Master server does not read semi-sync messages/ in mysqld.2.err
"Assert that Slave IO thread is up and running." "Assert that Slave IO thread is up and running."
SHOW STATUS LIKE 'Slave_running'; SHOW STATUS LIKE 'Slave_running';
Variable_name Value Variable_name Value

View File

@ -14,7 +14,6 @@ CALL mtr.add_suppression("Failed on request_dump()*");
CALL mtr.add_suppression("Semi-sync master failed on*"); CALL mtr.add_suppression("Semi-sync master failed on*");
CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*"); CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*");
CALL mtr.add_suppression("on master failed*"); CALL mtr.add_suppression("on master failed*");
CALL mtr.add_suppression("Master server does not support semi-sync*");
CALL mtr.add_suppression("Semi-sync slave net_flush*"); CALL mtr.add_suppression("Semi-sync slave net_flush*");
CALL mtr.add_suppression("Failed to flush master info*"); CALL mtr.add_suppression("Failed to flush master info*");
CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*"); CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*");
@ -196,7 +195,7 @@ Variable_name Value
Rpl_semi_sync_master_clients 0 Rpl_semi_sync_master_clients 0
show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_status';
Variable_name Value Variable_name Value
Rpl_semi_sync_master_status OFF Rpl_semi_sync_master_status ON
connection slave; connection slave;
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc include/wait_for_slave_io_to_start.inc

View File

@ -1,5 +1,16 @@
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
select @@rpl_semi_sync_master_enabled;
@@rpl_semi_sync_master_enabled
0
connection slave;
select @@rpl_semi_sync_slave_enabled;
@@rpl_semi_sync_slave_enabled
0
show status like "rpl_semi_sync_slave_status";
Variable_name Value
Rpl_semi_sync_slave_status OFF
connection master;
drop table if exists t1; drop table if exists t1;
Warnings: Warnings:
Note 1051 Unknown table 'test.t1' Note 1051 Unknown table 'test.t1'

View File

@ -0,0 +1,69 @@
include/master-slave.inc
[connection master]
select @@rpl_semi_sync_master_enabled;
@@rpl_semi_sync_master_enabled
1
connection slave;
select @@rpl_semi_sync_slave_enabled;
@@rpl_semi_sync_slave_enabled
1
show status like "rpl_semi_sync_slave_status";
Variable_name Value
Rpl_semi_sync_slave_status ON
connection master;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
create table t1(a varchar(100),b int);
set @@session.sql_mode=pipes_as_concat;
insert into t1 values('My'||'SQL', 1);
set @@session.sql_mode=default;
insert into t1 values('1'||'2', 2);
select * from t1 where b<3 order by a;
a b
1 2
MySQL 1
connection slave;
select * from t1 where b<3 order by a;
a b
1 2
MySQL 1
connection master;
set @@session.sql_mode=ignore_space;
insert into t1 values(password ('MySQL'), 3);
set @@session.sql_mode=ansi_quotes;
create table "t2" ("a" int);
drop table t1, t2;
set @@session.sql_mode=default;
create table t1(a int auto_increment primary key);
create table t2(b int, a int);
set @@session.sql_auto_is_null=1;
insert into t1 values(null);
insert into t2 select 1,a from t1 where a is null;
set @@session.sql_auto_is_null=0;
insert into t1 values(null);
insert into t2 select 2,a from t1 where a is null;
select * from t2 order by b;
b a
1 1
connection slave;
select * from t2 order by b;
b a
1 1
connection master;
drop table t1,t2;
connection slave;
connection master;
CREATE TABLE t1 (
`id` int(11) NOT NULL auto_increment,
`data` varchar(100),
PRIMARY KEY (`id`)
) ENGINE=MyISAM;
INSERT INTO t1(data) VALUES(SESSION_USER());
connection slave;
SELECT length(data) < 100 FROM t1;
length(data) < 100
1
connection master;
drop table t1;
include/rpl_end.inc

View File

@ -79,7 +79,9 @@ domain_id seq_no
0 5 0 5
include/start_slave.inc include/start_slave.inc
connection master; connection master;
include/save_master_gtid.inc
connection slave; connection slave;
include/sync_with_master_gtid.inc
# Everything from the master binlog must have been applied now: # Everything from the master binlog must have been applied now:
select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1; select domain_id, seq_no from mysql.gtid_slave_pos order by seq_no desc limit 1;
domain_id seq_no domain_id seq_no

View File

@ -117,7 +117,10 @@ include/start_slave.inc
# not master_use_gtid=no should warn the user that Using_Gtid is being # not master_use_gtid=no should warn the user that Using_Gtid is being
# changed to No. # changed to No.
# #
connection master;
include/save_master_pos.inc
connection slave; connection slave;
include/sync_io_with_master.inc
include/stop_slave.inc include/stop_slave.inc
CHANGE MASTER TO master_log_pos=io_log_pos, master_log_file='io_log_file'; CHANGE MASTER TO master_log_pos=io_log_pos, master_log_file='io_log_file';
Warnings: Warnings:

View File

@ -59,7 +59,7 @@ if(!$log_error_)
--let SEARCH_FILE=$log_error_ --let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000 --let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'\'\).* --let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'\'\).*
--source include/search_pattern_in_file.inc --source include/wait_for_pattern_in_file.inc
--connection slave --connection slave
--source include/stop_slave.inc --source include/stop_slave.inc
@ -71,7 +71,7 @@ CHANGE MASTER TO MASTER_USE_GTID=no;
--let SEARCH_FILE=$log_error_ --let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000 --let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(0\), gtid\(\'\'\).* --let SEARCH_PATTERN=using_gtid\(0\), gtid\(\'\'\).*
--source include/search_pattern_in_file.inc --source include/wait_for_pattern_in_file.inc
CREATE TABLE t (f INT) ENGINE=INNODB; CREATE TABLE t (f INT) ENGINE=INNODB;
INSERT INTO t VALUES(10); INSERT INTO t VALUES(10);
save_master_pos; save_master_pos;
@ -89,7 +89,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
--let SEARCH_FILE=$log_error_ --let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000 --let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2\'\).* --let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2\'\).*
--source include/search_pattern_in_file.inc --source include/wait_for_pattern_in_file.inc
SET @@SESSION.gtid_domain_id=10; SET @@SESSION.gtid_domain_id=10;
INSERT INTO t VALUES(20); INSERT INTO t VALUES(20);
save_master_pos; save_master_pos;
@ -107,7 +107,7 @@ CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
--let SEARCH_FILE=$log_error_ --let SEARCH_FILE=$log_error_
--let SEARCH_RANGE=-50000 --let SEARCH_RANGE=-50000
--let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).* --let SEARCH_PATTERN=using_gtid\(1\), gtid\(\'0-1-2,10-1-1\'\).*
--source include/search_pattern_in_file.inc --source include/wait_for_pattern_in_file.inc
--echo "===== Clean up =====" --echo "===== Clean up ====="
--connection slave --connection slave

View File

@ -7,6 +7,9 @@
--source include/have_binlog_format_mixed.inc --source include/have_binlog_format_mixed.inc
--source include/master-slave.inc --source include/master-slave.inc
connection server_2;
call mtr.add_suppression("Timeout waiting for reply of binlog");
# The following tests prove # The following tests prove
# A. # A.
# no out-of-order gtid error is done to the stict gtid mode semisync # no out-of-order gtid error is done to the stict gtid mode semisync
@ -66,10 +69,18 @@ evalp CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_2, ma
--connection server_2 --connection server_2
set @@global.gtid_strict_mode = true; set @@global.gtid_strict_mode = true;
set @@global.rpl_semi_sync_master_enabled = 1; set @@global.rpl_semi_sync_master_enabled = 1;
# The following command is likely to cause the slave master is not yet setup
# for semi-sync
INSERT INTO t1(a) VALUES (2); INSERT INTO t1(a) VALUES (2);
--source include/save_master_gtid.inc --source include/save_master_gtid.inc
--connection server_1 --connection server_1
# Update slave to notice that server_2 now has rpl_semi_sync_master_enabled
--source include/stop_slave.inc
--source include/start_slave.inc
--echo # --echo #
--echo # the successful sync is a required proof --echo # the successful sync is a required proof
--echo # --echo #

View File

@ -192,6 +192,12 @@ eval CHANGE MASTER TO MASTER_DELAY = $time2;
--enable_query_log --enable_query_log
--source include/start_slave.inc --source include/start_slave.inc
# Ensure that slave has started properly
--connection master
INSERT INTO t1 VALUES ('Syncing slave', 5);
--save_master_pos
--sync_slave_with_master
--connection master --connection master
INSERT INTO t1 VALUES (delay_on_slave(1), 6); INSERT INTO t1 VALUES (delay_on_slave(1), 6);
--save_master_pos --save_master_pos

View File

@ -67,10 +67,26 @@ connection master;
save_master_pos; save_master_pos;
--connection slave --connection slave
# Left to its own devices, the IO thread may or may not stop in error,
# depending on what it is doing when its connection to the primary is killed
# (e.g. a failed read results in an error, whereas if the IO thread is idly
# waiting for events when the connection dies, it will enter into a reconnect
# loop and reconnect). So we manually stop/start the IO thread to ensure it is
# in a consistent state
#
# FIXME: We shouldn't need to stop/start the SQL thread here, but due to
# MDEV-33268, we have to. So after fixing 33268, this should only stop/start
# the IO thread. Note the SQL thread must be stopped first due to an invalid
# DBUG_ASSERT in the IO thread's stop logic that depends on the state of the
# SQL thread (also reported and to be fixed in the same ticket).
#
--source include/stop_slave_sql.inc
--let rpl_allow_error=1 --let rpl_allow_error=1
--source include/wait_for_slave_io_to_start.inc --source include/stop_slave_io.inc
--let rpl_allow_error= --let rpl_allow_error=
--source include/wait_for_slave_sql_to_start.inc --source include/start_slave.inc
sync_with_master; sync_with_master;
select * from ti; select * from ti;
select * from tm; select * from tm;

View File

@ -11,7 +11,7 @@ set @old_master_binlog_checksum= @@global.binlog_checksum;
# empty Gtid_list event # empty Gtid_list event
# #
# Test this by binlog rotation before we log any GTIDs. # Test this by binlog rotation before we log any GTIDs.
connection slave; sync_slave_with_master;
# Need to stop/start the master without GTID before setting debug_dbug # Need to stop/start the master without GTID before setting debug_dbug
--source include/stop_slave.inc --source include/stop_slave.inc

View File

@ -33,7 +33,8 @@ CHANGE MASTER TO MASTER_USE_GTID=NO;
--source include/stop_slave.inc --source include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug; SET @save_dbug= @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde,negate_clock_diff_with_master"; SET @@global.debug_dbug="+d,pause_sql_thread_on_relay_fde_after_trans";
SET @@global.debug_dbug="+d,negate_clock_diff_with_master";
--source include/start_slave.inc --source include/start_slave.inc
--let $sleep_time=2 --let $sleep_time=2
@ -52,12 +53,6 @@ insert into t1 values (1);
flush logs; flush logs;
--connection slave --connection slave
--echo # Ignore FDEs that happen before the CREATE/INSERT commands
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
SET DEBUG_SYNC='now SIGNAL sql_thread_continue';
--echo # On the next FDE, the slave should have the master CREATE/INSERT events --echo # On the next FDE, the slave should have the master CREATE/INSERT events
SET DEBUG_SYNC='now WAIT_FOR paused_on_fde'; SET DEBUG_SYNC='now WAIT_FOR paused_on_fde';
select count(*)=1 from t1; select count(*)=1 from t1;
@ -138,6 +133,7 @@ while (!$caught_up)
} }
sleep 0.1; sleep 0.1;
} }
set debug_sync="RESET";
--enable_query_log --enable_query_log
--connection master --connection master

View File

@ -23,7 +23,6 @@ connection slave;
# inconsistent GTID values because the seq_nos are non-deterministic with # inconsistent GTID values because the seq_nos are non-deterministic with
# the masters events coming in concurrently # the masters events coming in concurrently
set sql_log_bin=0; set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
set sql_log_bin=1; set sql_log_bin=1;
@ -58,7 +57,7 @@ set global rpl_semi_sync_slave_enabled= 0;
connection master; connection master;
set global rpl_semi_sync_master_timeout= 60000; # 60s set global rpl_semi_sync_master_timeout= 2000; # 2s
echo [ default state of semi-sync on master should be OFF ]; echo [ default state of semi-sync on master should be OFF ];
show variables like 'rpl_semi_sync_master_enabled'; show variables like 'rpl_semi_sync_master_enabled';
@ -202,12 +201,16 @@ sync_slave_with_master;
--echo # Test semi-sync master will switch OFF after one transaction --echo # Test semi-sync master will switch OFF after one transaction
--echo # timeout waiting for slave reply. --echo # timeout waiting for slave reply.
--echo # --echo #
connection master;
show status like "Rpl_semi_sync_master_status";
connection slave; connection slave;
source include/stop_slave.inc; source include/stop_slave.inc;
connection master; connection master;
--source include/kill_binlog_dump_threads.inc --source include/kill_binlog_dump_threads.inc
set global rpl_semi_sync_master_timeout= 5000; set global rpl_semi_sync_master_timeout= 2000;
# The first semi-sync check should be on because after slave stop, # The first semi-sync check should be on because after slave stop,
# there are no transactions on the master. # there are no transactions on the master.
@ -239,8 +242,8 @@ show status like 'Rpl_semi_sync_master_status';
show status like 'Rpl_semi_sync_master_no_tx'; show status like 'Rpl_semi_sync_master_no_tx';
show status like 'Rpl_semi_sync_master_yes_tx'; show status like 'Rpl_semi_sync_master_yes_tx';
# Semi-sync status on master is now OFF, so all these transactions # Semi-sync status on master is now ON, but there are no slaves attached,
# will be replicated asynchronously. # so all these transactions will be replicated asynchronously.
delete from t1 where a=10; delete from t1 where a=10;
delete from t1 where a=9; delete from t1 where a=9;
delete from t1 where a=8; delete from t1 where a=8;
@ -374,6 +377,9 @@ let $status_var= Rpl_semi_sync_master_clients;
let $status_var_value= 1; let $status_var_value= 1;
source include/wait_for_status_var.inc; source include/wait_for_status_var.inc;
sync_slave_with_master;
connection master;
replace_result $engine_type ENGINE_TYPE; replace_result $engine_type ENGINE_TYPE;
eval create table t1 (a int) engine = $engine_type; eval create table t1 (a int) engine = $engine_type;
insert into t1 values (1); insert into t1 values (1);
@ -420,6 +426,10 @@ connection master;
let $status_var= Rpl_semi_sync_master_clients; let $status_var= Rpl_semi_sync_master_clients;
let $status_var_value= 1; let $status_var_value= 1;
source include/wait_for_status_var.inc; source include/wait_for_status_var.inc;
sync_slave_with_master;
connection master;
echo [ master semi-sync should be ON ]; echo [ master semi-sync should be ON ];
show status like 'Rpl_semi_sync_master_clients'; show status like 'Rpl_semi_sync_master_clients';
show status like 'Rpl_semi_sync_master_status'; show status like 'Rpl_semi_sync_master_status';

View File

@ -14,7 +14,6 @@ call mtr.add_suppression("Unsafe statement written to the binary log using state
call mtr.add_suppression("mysqld: Got an error reading communication packets"); call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave; connection slave;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply"); call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group"); call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");

View File

@ -18,6 +18,7 @@
--connection server_1 --connection server_1
RESET MASTER; RESET MASTER;
SET @@global.max_binlog_size= 4096; SET @@global.max_binlog_size= 4096;
set @@global.rpl_semi_sync_master_enabled = 1;
--connection server_2 --connection server_2
RESET MASTER; RESET MASTER;
@ -29,7 +30,6 @@ CHANGE MASTER TO master_use_gtid= slave_pos;
--connection server_1 --connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
set @@global.rpl_semi_sync_master_enabled = 1;
set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC; set @@global.rpl_semi_sync_master_wait_point=AFTER_SYNC;
CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb; CREATE TABLE t1 (a INT PRIMARY KEY, b MEDIUMTEXT) ENGINE=Innodb;

View File

@ -0,0 +1,12 @@
!include include/default_mysqld.cnf
[mysqld.1]
[mysqld.2]
[mysqld.3]
[ENV]
SERVER_MYPORT_1= @mysqld.1.port
SERVER_MYPORT_2= @mysqld.2.port
SERVER_MYPORT_3= @mysqld.3.port

View File

@ -0,0 +1,122 @@
#
# This test ensures that a primary will listen for ACKs by newly added
# semi-sync connections connections, after a pre-existing connection is already
# established. MDEV-32960 reported that the newly added slave's ACK can be
# ignored if listen_on_sockets() does not timeout before
# rpl_semi_sync_master_timeout, and if the existing semi-sync connections fail
# to send ACKs, semi-sync is switched off.
#
# This test ensures this in a two-replica setup with a semi-sync timeout of
# 500ms, and delaying the ACK reply of the first-established replica by 800ms
# to force a timeout, and allowing the second replica to immediately ACK.
#
# References:
# MDEV-32960: Semi-sync ACKed Transaction can Timeout and Switch Off
# Semi-sync with Multiple Replicas
#
--source include/have_debug.inc
# binlog_format independent
--source include/have_binlog_format_statement.inc
--let $rpl_topology= 1->2,1->3
--source include/rpl_init.inc
--connection server_1
set @old_enabled= @@global.rpl_semi_sync_master_enabled;
set @old_timeout= @@global.rpl_semi_sync_master_timeout;
set global rpl_semi_sync_master_enabled= 1;
set global rpl_semi_sync_master_timeout= 500;
--connection server_2
--source include/stop_slave.inc
set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
set @old_dbug= @@global.debug_dbug;
set global rpl_semi_sync_slave_enabled= 1;
set global debug_dbug="+d,simulate_delay_semisync_slave_reply";
--source include/start_slave.inc
--connection server_3
--source include/stop_slave.inc
set @old_enabled= @@global.rpl_semi_sync_slave_enabled;
set global rpl_semi_sync_slave_enabled= 1;
--source include/start_slave.inc
--echo # Ensure primary recognizes both replicas are semi-sync
--connection server_1
--let $status_var_value= 2
--let $status_var= rpl_semi_sync_master_clients
--source include/wait_for_status_var.inc
--let $master_ss_status= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_status', Value, 1)
if (`SELECT strcmp("$master_ss_status", "ON") != 0`)
{
SHOW STATUS LIKE 'rpl_semi_sync_master_status';
--die rpl_semi_sync_master_status should be ON to start
}
--connection server_1
--let $init_master_yes_tx= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_yes_tx', Value, 1)
create table t1 (a int);
--connection server_2
--echo # Verifying server_2 did not send ACK
--let $slave1_sent_ack= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack', Value, 1)
if (`SELECT $slave1_sent_ack`)
{
SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack';
--die server_2 should not have sent semi-sync ACK to primary
}
--connection server_3
--echo # Verifying server_3 did send ACK
--let $slave2_sent_ack= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack', Value, 1)
if (`SELECT NOT $slave2_sent_ack`)
{
SHOW STATUS LIKE 'rpl_semi_sync_slave_send_ack';
--die server_3 should have sent semi-sync ACK to primary
}
--connection server_1
--echo # Verifying master's semi-sync status is still ON (This failed pre-MDEV-32960 fixes)
let $master_ss_status= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_status', Value, 1);
if (`SELECT strcmp("$master_ss_status", "ON") != 0`)
{
SHOW STATUS LIKE 'rpl_semi_sync_master_status';
--die rpl_semi_sync_master_status should not have switched off after server_3 ACKed transaction
}
--echo # Verifying rpl_semi_sync_master_yes_tx incremented
--let $cur_master_yes_tx= query_get_value(SHOW STATUS LIKE 'rpl_semi_sync_master_yes_tx', Value, 1)
if (`SELECT $cur_master_yes_tx != ($init_master_yes_tx + 1)`)
{
--echo # Initial yes_tx: $init_master_yes_tx
--echo # Current yes_tx: $cur_master_yes_tx
--die rpl_semi_sync_master_yes_tx should have been incremented by primary
}
--echo #
--echo # Cleanup
--connection server_2
set global rpl_semi_sync_slave_enabled= @old_enabled;
set global debug_dbug= @old_dbug;
--source include/stop_slave.inc
--connection server_3
set global rpl_semi_sync_slave_enabled= @old_enabled;
--source include/stop_slave.inc
--connection server_1
set global rpl_semi_sync_master_enabled= @old_enabled;
set global rpl_semi_sync_master_timeout= @old_timeout;
drop table t1;
--connection server_2
--source include/start_slave.inc
--connection server_3
--source include/start_slave.inc
--source include/rpl_end.inc
--echo # End of rpl_semi_sync_no_missed_ack_after_add_slave.test

View File

@ -0,0 +1,73 @@
#
# MDEV-32551: "Read semi-sync reply magic number error" warnings on master
#
# Test that changing rpl_semi_sync_master_enabled after startup does not
# cause problems with semi-sync cleanup.
#
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Test is binlog format independent, so save resources
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
call mtr.add_suppression("Replication event checksum verification failed");
call mtr.add_suppression("could not queue event from master");
--echo #
--echo # Set up a semisync connection
--connection master
set @@global.rpl_semi_sync_master_enabled= ON;
--connection slave
stop slave io_thread;
set @@global.rpl_semi_sync_slave_enabled= ON;
set @old_dbug= @@global.debug_dbug;
# Force an error to abort out of the main IO thread loop
set @@global.debug_dbug= "+d,corrupt_queue_event";
# Pause the IO thread as soon as the main loop starts. Note we can't use
# processlist where "Waiting for master to send event" because the
# "corrupt_queue_event" will trigger before we can turn semisync OFF
set @@global.debug_dbug= "+d,pause_before_io_read_event";
# Because the other debug_dbug points are automatically negated when they are
# run, and there is a bug that if "-d" takes us to an empty debug string state,
# _all_ debug_print statements are output
set @@global.debug_dbug= "+d,placeholder";
start slave io_thread;
--echo # Disable semi-sync on the slave while the IO thread is active
set debug_sync='now wait_for io_thread_at_read_event';
set @@global.rpl_semi_sync_slave_enabled= OFF;
set debug_sync='now signal io_thread_continue_read_event';
--echo # Waiting for the slave to stop with the error from corrupt_queue_event
--connection slave
--let $slave_io_errno= 1595,1743
--source include/wait_for_slave_io_error.inc
--echo # Sleep 1 to give time for Ack_receiver to receive COM_QUIT
--sleep 1
--let $assert_text= Check that there is no 'Read semi-sync reply magic number error' in error log.
--let $assert_select=magic number error
--let $assert_file= $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_count= 0
--let $assert_only_after=CURRENT_TEST
--source include/assert_grep.inc
--echo #
--echo # Cleanup
--connection slave
--source include/stop_slave.inc
set @@global.debug_dbug= @old_dbug;
--source include/start_slave.inc
--connection master
set @@global.rpl_semi_sync_master_enabled= default;
--source include/rpl_end.inc
--echo # End of rpl_semi_sync_slave_enabled_consistent.test

View File

@ -31,6 +31,7 @@
--connection master --connection master
call mtr.add_suppression("Timeout waiting for reply of binlog*"); call mtr.add_suppression("Timeout waiting for reply of binlog*");
call mtr.add_suppression("Master server does not read semi-sync messages*");
--let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout` --let $sav_timeout_master=`SELECT @@GLOBAL.rpl_semi_sync_master_timeout`
set global rpl_semi_sync_master_enabled = ON; set global rpl_semi_sync_master_enabled = ON;
SET @@GLOBAL.rpl_semi_sync_master_timeout=100; SET @@GLOBAL.rpl_semi_sync_master_timeout=100;
@ -54,9 +55,9 @@ if(!$log_error_)
# does not know the location of its .err log, use default location # does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err; let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
} }
--echo "Assert that the net_fulsh() reply failed is present in slave error log. --echo "Assert that Master server does not read semi-sync messages" is present in slave error log.
--let SEARCH_FILE=$log_error_ --let SEARCH_FILE=$log_error_
--let SEARCH_PATTERN=Semi-sync slave net_flush\(\) reply failed --let SEARCH_PATTERN=Master server does not read semi-sync messages
--source include/search_pattern_in_file.inc --source include/search_pattern_in_file.inc
--echo "Assert that Slave IO thread is up and running." --echo "Assert that Slave IO thread is up and running."

View File

@ -16,7 +16,6 @@ CALL mtr.add_suppression("Failed on request_dump()*");
CALL mtr.add_suppression("Semi-sync master failed on*"); CALL mtr.add_suppression("Semi-sync master failed on*");
CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*"); CALL mtr.add_suppression("Master command COM_BINLOG_DUMP failed*");
CALL mtr.add_suppression("on master failed*"); CALL mtr.add_suppression("on master failed*");
CALL mtr.add_suppression("Master server does not support semi-sync*");
CALL mtr.add_suppression("Semi-sync slave net_flush*"); CALL mtr.add_suppression("Semi-sync slave net_flush*");
CALL mtr.add_suppression("Failed to flush master info*"); CALL mtr.add_suppression("Failed to flush master info*");
CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*"); CALL mtr.add_suppression("Request to stop slave SQL Thread received while apply*");

View File

@ -7,6 +7,12 @@ disable_query_log;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
enable_query_log; enable_query_log;
select @@rpl_semi_sync_master_enabled;
connection slave;
select @@rpl_semi_sync_slave_enabled;
show status like "rpl_semi_sync_slave_status";
connection master;
drop table if exists t1; drop table if exists t1;
create table t1(a varchar(100),b int); create table t1(a varchar(100),b int);
set @@session.sql_mode=pipes_as_concat; set @@session.sql_mode=pipes_as_concat;

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