1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-05 13:16:09 +03:00

Merge mariadb-11.0.2 into 11.0

This commit is contained in:
Marko Mäkelä
2023-06-08 11:35:36 +03:00
429 changed files with 4171 additions and 1742 deletions

View File

@@ -153,51 +153,3 @@ enum options_client
#else #else
#define SOCKET_PROTOCOL_TO_FORCE MYSQL_PROTOCOL_PIPE #define SOCKET_PROTOCOL_TO_FORCE MYSQL_PROTOCOL_PIPE
#endif #endif
/**
Utility function to implicitly change the connection protocol to a
consistent value given the command line arguments. Additionally,
warns the user that the protocol has been changed.
Arguments:
@param [in] host Name of the host to connect to
@param [in, out] opt_protocol Location of the protocol option
variable to update
@param [in] new_protocol New protocol to force
*/
static inline void warn_protocol_override(char *host,
uint *opt_protocol,
uint new_protocol)
{
DBUG_ASSERT(new_protocol == MYSQL_PROTOCOL_TCP
|| new_protocol == SOCKET_PROTOCOL_TO_FORCE);
if ((host == NULL
|| strncmp(host, LOCAL_HOST, sizeof(LOCAL_HOST)-1) == 0))
{
const char *protocol_name;
if (*opt_protocol == MYSQL_PROTOCOL_DEFAULT
#ifndef _WIN32
&& new_protocol == MYSQL_PROTOCOL_SOCKET
#else
&& new_protocol == MYSQL_PROTOCOL_TCP
#endif
)
{
/* This is already the default behavior, do nothing */
return;
}
protocol_name= sql_protocol_typelib.type_names[new_protocol-1];
fprintf(stderr, "%s %s %s\n",
"WARNING: Forcing protocol to ",
protocol_name,
" due to option specification. "
"Please explicitly state intended protocol.");
*opt_protocol = new_protocol;
}
}

View File

@@ -299,8 +299,6 @@ unsigned short terminal_width= 80;
static uint opt_protocol=0; static uint opt_protocol=0;
static const char *opt_protocol_type= ""; static const char *opt_protocol_type= "";
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
#include "sslopt-vars.h" #include "sslopt-vars.h"
const char *default_dbug_option="d:t:o,/tmp/mariadb.trace"; const char *default_dbug_option="d:t:o,/tmp/mariadb.trace";
@@ -1273,14 +1271,6 @@ int main(int argc,char *argv[])
exit(status.exit_status); exit(status.exit_status);
} }
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
}
if (status.batch && !status.line_buff && if (status.batch && !status.line_buff &&
!(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin))) !(status.line_buff= batch_readline_init(MAX_BATCH_BUFFER_SIZE, stdin)))
{ {
@@ -1890,11 +1880,9 @@ static void usage(int version)
my_bool my_bool
get_one_option(const struct my_option *opt, const char *argument, const char *filename) get_one_option(const struct my_option *opt, const char *argument,
const char *filename)
{ {
/* Track when protocol is set via CLI to not force port TCP protocol override */
static my_bool ignore_protocol_override = FALSE;
switch(opt->id) { switch(opt->id) {
case OPT_CHARSETS_DIR: case OPT_CHARSETS_DIR:
strmake_buf(mysql_charsets_dir, argument); strmake_buf(mysql_charsets_dir, argument);
@@ -1955,18 +1943,11 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (!argument[0]) if (!argument[0])
opt_protocol= 0; opt_protocol= 0;
else if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, else if ((opt_protocol=
find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0) opt->name)) <= 0)
exit(1); exit(1);
#endif #endif
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case OPT_SERVER_ARG: case OPT_SERVER_ARG:
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
@@ -2066,13 +2047,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
#ifdef _WIN32 #ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
opt_protocol_type= "pipe"; opt_protocol_type= "pipe";
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
#include <sslopt-case.h> #include <sslopt-case.h>
@@ -2085,35 +2059,17 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
mysql_end(-1); mysql_end(-1);
break; break;
case 'P': case 'P':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{ {
ignore_protocol_override = TRUE; /* Port given on command line, switch protocol to use TCP */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_TCP;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
} }
break; break;
case 'S': case 'S':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{ {
ignore_protocol_override = TRUE; /* Socket given on command line, switch protocol to use SOCKETSt */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
} }
break; break;
case 'I': case 'I':

View File

@@ -54,8 +54,6 @@ static bool sql_log_bin_off= false;
static uint opt_protocol=0; static uint opt_protocol=0;
static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */ static myf error_flags; /* flags to pass to my_printf_error, like ME_BELL */
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
/* /*
When using extended-status relatively, ex_val_max_len is the estimated When using extended-status relatively, ex_val_max_len is the estimated
maximum length for any relative value printed by extended-status. The maximum length for any relative value printed by extended-status. The
@@ -243,12 +241,9 @@ static const char *load_default_groups[]=
0 }; 0 };
my_bool my_bool
get_one_option(const struct my_option *opt, const char *argument, const char *filename) get_one_option(const struct my_option *opt, const char *argument,
const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch(opt->id) { switch(opt->id) {
case 'c': case 'c':
opt_count_iterations= 1; opt_count_iterations= 1;
@@ -280,13 +275,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
case 'W': case 'W':
#ifdef _WIN32 #ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case '#': case '#':
@@ -322,45 +310,19 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case 'P': case 'P':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{ {
ignore_protocol_override = TRUE; /* Port given on command line, switch protocol to use TCP */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_TCP;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
} }
break; break;
case 'S': case 'S':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{ {
ignore_protocol_override = TRUE; /* Socket given on command line, switch protocol to use SOCKETSt */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
} }
break; break;
} }
@@ -388,13 +350,6 @@ int main(int argc,char *argv[])
temp_argv= mask_password(argc, &argv); temp_argv= mask_password(argc, &argv);
temp_argc= argc; temp_argc= argc;
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(host, &opt_protocol, protocol_to_force);
}
if (debug_info_flag) if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO; my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag) if (debug_check_flag)

View File

@@ -100,8 +100,6 @@ static const char *output_prefix= "";
static char **defaults_argv= 0; static char **defaults_argv= 0;
static MEM_ROOT glob_root; static MEM_ROOT glob_root;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
#ifndef DBUG_OFF #ifndef DBUG_OFF
static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace"; static const char *default_dbug_option = "d:t:o,/tmp/mariadb-binlog.trace";
const char *current_dbug_option= default_dbug_option; const char *current_dbug_option= default_dbug_option;
@@ -2061,13 +2059,11 @@ int parse_gtid_filter_option(
} }
extern "C" my_bool extern "C" my_bool
get_one_option(const struct my_option *opt, const char *argument, const char *filename) get_one_option(const struct my_option *opt, const char *argument,
const char *filename)
{ {
bool tty_password=0; bool tty_password=0;
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch (opt->id) { switch (opt->id) {
#ifndef DBUG_OFF #ifndef DBUG_OFF
case '#': case '#':
@@ -2117,14 +2113,6 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
die(1); die(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
#ifdef WHEN_FLASHBACK_REVIEW_READY #ifdef WHEN_FLASHBACK_REVIEW_READY
case opt_flashback_review: case opt_flashback_review:
@@ -2165,35 +2153,17 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
print_row_event_positions_used= 1; print_row_event_positions_used= 1;
break; break;
case 'P': case 'P':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{ {
ignore_protocol_override = TRUE; /* Port given on command line, switch protocol to use TCP */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_TCP;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
} }
break; break;
case 'S': case 'S':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{ {
ignore_protocol_override = TRUE; /* Socket given on command line, switch protocol to use SOCKETSt */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
} }
break; break;
case 'v': case 'v':
@@ -3261,13 +3231,6 @@ int main(int argc, char** argv)
parse_args(&argc, (char***)&argv); parse_args(&argc, (char***)&argv);
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(host, &opt_protocol, protocol_to_force);
}
if (!argc || opt_version) if (!argc || opt_version)
{ {
if (!opt_version) if (!opt_version)

View File

@@ -57,8 +57,6 @@ DYNAMIC_ARRAY tables4repair, tables4rebuild, alter_table_cmds;
DYNAMIC_ARRAY views4repair; DYNAMIC_ARRAY views4repair;
static uint opt_protocol=0; static uint opt_protocol=0;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES }; enum operations { DO_CHECK=1, DO_REPAIR, DO_ANALYZE, DO_OPTIMIZE, DO_FIX_NAMES };
const char *operation_name[]= const char *operation_name[]=
{ {
@@ -283,10 +281,6 @@ get_one_option(const struct my_option *opt,
const char *filename) const char *filename)
{ {
int orig_what_to_do= what_to_do; int orig_what_to_do= what_to_do;
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");
switch(opt->id) { switch(opt->id) {
@@ -349,13 +343,6 @@ get_one_option(const struct my_option *opt,
case 'W': case 'W':
#ifdef _WIN32 #ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case '#': case '#':
@@ -379,45 +366,19 @@ get_one_option(const struct my_option *opt,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case 'P': case 'P':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{ {
ignore_protocol_override = TRUE; /* Port given on command line, switch protocol to use TCP */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_TCP;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
} }
break; break;
case 'S': case 'S':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{ {
ignore_protocol_override = TRUE; /* Socket given on command line, switch protocol to use SOCKETSt */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
} }
break; break;
} }
@@ -1241,14 +1202,6 @@ int main(int argc, char **argv)
if (get_options(&argc, &argv)) if (get_options(&argc, &argv))
goto end1; goto end1;
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
}
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
ret= EX_MYSQLERR; ret= EX_MYSQLERR;

View File

@@ -195,12 +195,10 @@ FILE *stderror_file=0;
static uint opt_protocol= 0; static uint opt_protocol= 0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
/* /*
Dynamic_string wrapper functions. In this file use these Dynamic_string wrapper functions. In this file use these
wrappers, they will terminate the process if there is wrappers, they will terminate the process if there is
an allocation failure. an allocation failure.
*/ */
static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str, static void init_dynamic_string_checked(DYNAMIC_STRING *str, const char *init_str,
size_t init_alloc, size_t alloc_increment); size_t init_alloc, size_t alloc_increment);
@@ -880,9 +878,6 @@ get_one_option(const struct my_option *opt,
const char *filename) const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch (opt->id) { switch (opt->id) {
case 'p': case 'p':
if (argument == disabled_my_option) if (argument == disabled_my_option)
@@ -913,13 +908,6 @@ get_one_option(const struct my_option *opt,
case 'W': case 'W':
#ifdef _WIN32 #ifdef _WIN32
opt_protocol= MYSQL_PROTOCOL_PIPE; opt_protocol= MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case 'N': case 'N':
@@ -1070,49 +1058,23 @@ get_one_option(const struct my_option *opt,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case (int) OPT_DEFAULT_CHARSET: case (int) OPT_DEFAULT_CHARSET:
if (default_charset == disabled_my_option) if (default_charset == disabled_my_option)
default_charset= (char *)mysql_universal_client_charset; default_charset= (char *)mysql_universal_client_charset;
break; break;
case 'P': case 'P':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{ {
ignore_protocol_override = TRUE; /* Port given on command line, switch protocol to use TCP */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_TCP;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
} }
break; break;
case 'S': case 'S':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{ {
ignore_protocol_override = TRUE; /* Socket given on command line, switch protocol to use SOCKETSt */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
} }
break; break;
} }
@@ -1161,19 +1123,9 @@ static int get_options(int *argc, char ***argv)
return(ho_error); return(ho_error);
/* /*
Command line options override configured protocol Dumping under --system=stats with --replace or --insert-ignore is
*/ safe and will not result into race condition. Otherwise dump only
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT structure and ignore data by default while dumping.
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
}
/*
Dumping under --system=stats with --replace or --insert-ignore is safe and will not
result into race condition. Otherwise dump only structure and ignore data by default
while dumping.
*/ */
if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into)) if (!(opt_system & OPT_SYSTEM_STATS) && !(opt_ignore || opt_replace_into))
{ {

View File

@@ -64,8 +64,6 @@ static char * opt_mysql_unix_port=0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static longlong opt_ignore_lines= -1; static longlong opt_ignore_lines= -1;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
#include <sslopt-vars.h> #include <sslopt-vars.h>
static char **argv_to_free; static char **argv_to_free;
@@ -220,9 +218,6 @@ static my_bool
get_one_option(const struct my_option *opt, const char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename) const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch(opt->id) { switch(opt->id) {
case 'p': case 'p':
if (argument == disabled_my_option) if (argument == disabled_my_option)
@@ -249,14 +244,6 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'W': case 'W':
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
opt_local_file=1; opt_local_file=1;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
#endif #endif
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
@@ -266,45 +253,19 @@ get_one_option(const struct my_option *opt, const char *argument,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case 'P': case 'P':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{ {
ignore_protocol_override = TRUE; /* Port given on command line, switch protocol to use TCP */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_TCP;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
} }
break; break;
case 'S': case 'S':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{ {
ignore_protocol_override = TRUE; /* Socket given on command line, switch protocol to use SOCKETSt */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
} }
break; break;
case '#': case '#':
@@ -706,13 +667,6 @@ int main(int argc, char **argv)
return(1); return(1);
} }
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(current_host, &opt_protocol, protocol_to_force);
}
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
if (opt_use_threads && !lock_tables) if (opt_use_threads && !lock_tables)

View File

@@ -41,8 +41,6 @@ static char *opt_plugin_dir= 0, *opt_default_auth= 0;
static uint opt_protocol=0; static uint opt_protocol=0;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
static void get_options(int *argc,char ***argv); static void get_options(int *argc,char ***argv);
static uint opt_mysql_port=0; static uint opt_mysql_port=0;
static int list_dbs(MYSQL *mysql,const char *wild); static int list_dbs(MYSQL *mysql,const char *wild);
@@ -81,14 +79,6 @@ int main(int argc, char **argv)
get_options(&argc,&argv); get_options(&argc,&argv);
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(host, &opt_protocol, protocol_to_force);
}
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
wild=0; wild=0;
if (argc) if (argc)
@@ -301,9 +291,6 @@ get_one_option(const struct my_option *opt, const char *argument,
const char *filename) const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
switch(opt->id) { switch(opt->id) {
case 'v': case 'v':
opt_verbose++; opt_verbose++;
@@ -332,13 +319,6 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'W': case 'W':
#ifdef _WIN32 #ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE; opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
@@ -348,47 +328,22 @@ get_one_option(const struct my_option *opt, const char *argument,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case 'P': case 'P':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{ {
ignore_protocol_override = TRUE; /* Port given on command line, switch protocol to use TCP */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_TCP;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
} }
break; break;
case 'S': case 'S':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{ {
ignore_protocol_override = TRUE; /* Socket given on command line, switch protocol to use SOCKETSt */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
} }
break; break;
break;
case '#': case '#':
DBUG_PUSH(argument ? argument : "d:t:o"); DBUG_PUSH(argument ? argument : "d:t:o");
debug_check_flag= 1; debug_check_flag= 1;

View File

@@ -172,8 +172,6 @@ File csv_file;
static uint opt_protocol= 0; static uint opt_protocol= 0;
static uint protocol_to_force= MYSQL_PROTOCOL_DEFAULT;
static int get_options(int *argc,char ***argv); static int get_options(int *argc,char ***argv);
static uint opt_mysql_port= 0; static uint opt_mysql_port= 0;
@@ -335,13 +333,6 @@ int main(int argc, char **argv)
exit(1); exit(1);
} }
/* Command line options override configured protocol */
if (protocol_to_force > MYSQL_PROTOCOL_DEFAULT
&& protocol_to_force != opt_protocol)
{
warn_protocol_override(host, &opt_protocol, protocol_to_force);
}
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
/* Seed the random number generator if we will be using it. */ /* Seed the random number generator if we will be using it. */
@@ -737,9 +728,6 @@ static my_bool
get_one_option(const struct my_option *opt, const char *argument, get_one_option(const struct my_option *opt, const char *argument,
const char *filename) const char *filename)
{ {
/* Track when protocol is set via CLI to not force overrides */
static my_bool ignore_protocol_override = FALSE;
DBUG_ENTER("get_one_option"); DBUG_ENTER("get_one_option");
switch(opt->id) { switch(opt->id) {
case 'v': case 'v':
@@ -769,13 +757,6 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'W': case 'W':
#ifdef _WIN32 #ifdef _WIN32
opt_protocol= MYSQL_PROTOCOL_PIPE; opt_protocol= MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
#endif #endif
break; break;
case OPT_MYSQL_PROTOCOL: case OPT_MYSQL_PROTOCOL:
@@ -785,45 +766,19 @@ get_one_option(const struct my_option *opt, const char *argument,
sf_leaking_memory= 1; /* no memory leak reports here */ sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
} }
/* Specification of protocol via CLI trumps implicit overrides */
if (filename[0] == '\0')
{
ignore_protocol_override = TRUE;
protocol_to_force = MYSQL_PROTOCOL_DEFAULT;
}
break; break;
case 'P': case 'P':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == SOCKET_PROTOCOL_TO_FORCE)
{ {
ignore_protocol_override = TRUE; /* Port given on command line, switch protocol to use TCP */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_TCP;
}
/* If port is set via CLI, try to force protocol to TCP */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = MYSQL_PROTOCOL_TCP;
} }
break; break;
case 'S': case 'S':
/* If port and socket are set, fall back to default behavior */ if (filename[0] == '\0')
if (protocol_to_force == MYSQL_PROTOCOL_TCP)
{ {
ignore_protocol_override = TRUE; /* Socket given on command line, switch protocol to use SOCKETSt */
protocol_to_force = MYSQL_PROTOCOL_DEFAULT; opt_protocol= MYSQL_PROTOCOL_SOCKET;
}
/* Prioritize socket if set via command line */
if (filename[0] == '\0' &&
!ignore_protocol_override &&
protocol_to_force == MYSQL_PROTOCOL_DEFAULT)
{
protocol_to_force = SOCKET_PROTOCOL_TO_FORCE;
} }
break; break;
case '#': case '#':

View File

@@ -68,8 +68,8 @@ add_lsb_base_depends()
replace_uring_with_aio() replace_uring_with_aio()
{ {
sed 's/liburing-dev/libaio-dev/g' -i debian/control sed 's/liburing-dev/libaio-dev/g' -i debian/control
sed -e '/-DIGNORE_AIO_CHECK=YES/d' \ sed -e '/-DIGNORE_AIO_CHECK=ON/d' \
-e '/-DWITH_URING=YES/d' -i debian/rules -e '/-DWITH_URING=ON/d' -i debian/rules
} }
disable_pmem() disable_pmem()

View File

@@ -86,7 +86,7 @@ sanity_checks() {
datadir=`mariadbd_get_param datadir` datadir=`mariadbd_get_param datadir`
# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024 # As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024
# 4096 blocks is then lower than 4 MB # 4096 blocks is then lower than 4 MB
df_available_blocks=`LC_ALL=C BLOCKSIZE= df --output=avail "$datadir" | tail -n 1` df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$datadir" | tail -n 1)"
if [ "$df_available_blocks" -lt "4096" ]; then if [ "$df_available_blocks" -lt "4096" ]; then
log_failure_msg "$0: ERROR: The partition with $datadir is too full!" log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER

View File

@@ -210,7 +210,7 @@ fi
# As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024 # As preset blocksize of GNU df is 1024 then available bytes is $df_available_blocks * 1024
# 4096 blocks is then lower than 4 MB # 4096 blocks is then lower than 4 MB
df_available_blocks=`LC_ALL=C BLOCKSIZE= df --output=avail "$datadir" | tail -n 1` df_available_blocks="$(LC_ALL=C BLOCKSIZE='' df --output=avail "$mysql_datadir" | tail -n 1)"
if [ "$df_available_blocks" -lt "4096" ]; then if [ "$df_available_blocks" -lt "4096" ]; then
echo "ERROR: There's not enough space in $mysql_datadir/" 1>&2 echo "ERROR: There's not enough space in $mysql_datadir/" 1>&2
db_stop db_stop

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates. /* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2022, Oracle and/or its affiliates /* Copyright (c) 2011, 2023, Oracle and/or its affiliates
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2012, 2022, Oracle and/or its affiliates. /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2012, 2022, Oracle and/or its affiliates. /* Copyright (c) 2012, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2014, 2022, Oracle and/or its affiliates. /* Copyright (c) 2014, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2022, Oracle and/or its affiliates. /* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
Copyright (c) 2017, MariaDB Corporation. Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2013, 2022, Oracle and/or its affiliates. /* Copyright (c) 2013, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2022, Oracle and/or its affiliates. /* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2022, Oracle and/or its affiliates. /* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2017, 2019, MariaDB Corporation. Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates. /* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
Copyright (c) 2020, 2021, MariaDB Corporation. Copyright (c) 2020, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2013, 2022, Oracle and/or its affiliates. /* Copyright (c) 2013, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates. /* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2011, 2022, Oracle and/or its affiliates. /* Copyright (c) 2011, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates. /* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates. /* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022, Oracle and/or its affiliates. /* Copyright (c) 2008, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2013, 2022, Oracle and/or its affiliates. /* Copyright (c) 2013, 2023, Oracle and/or its affiliates.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0, it under the terms of the GNU General Public License, version 2.0,

View File

@@ -4,21 +4,19 @@
# #
# The following group of tests should produce no warnings # The following group of tests should produce no warnings
# #
# exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:" # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
Connection: Localhost via UNIX socket Connection: Localhost via UNIX socket
# exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:" # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
Connection: localhost via TCP/IP Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:" # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
Connection: Localhost via UNIX socket Connection: Localhost via UNIX socket
# exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
Connection: 127.0.0.1 via TCP/IP Connection: 127.0.0.1 via TCP/IP
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
Connection: Localhost via UNIX socket Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:" # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
Connection: Localhost via UNIX socket Connection: Localhost via UNIX socket
# # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
# The remaining tests should produce warnings Connection: Localhost via UNIX socket
# # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
WARNING: Forcing protocol to TCP due to option specification. Please explicitly state intended protocol.
Connection: localhost via TCP/IP Connection: localhost via TCP/IP

View File

@@ -10,28 +10,26 @@
--echo # The following group of tests should produce no warnings --echo # The following group of tests should produce no warnings
--echo # --echo #
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:" --echo # exec MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
--exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:\|WARNING:" --exec $MYSQL --host=localhost -e "status" 2>&1 | grep "Connection:"
--echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:" --echo # exec MYSQL --port=MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
--exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:\|WARNING:" --exec $MYSQL --port=$MASTER_MYPORT --protocol=tcp -e "status" 2>&1 | grep "Connection:"
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:" --echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:\|WARNING:" --exec $MYSQL --host=localhost --port=$MASTER_MYPORT --protocol=socket -e "status" 2>&1 | grep "Connection:"
--echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" --echo # exec MYSQL --host=127.0.0.1 --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
--exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" --exec $MYSQL --host=127.0.0.1 --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" --echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:" --exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:" --echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:\|WARNING:" --exec $MYSQL --host=localhost --port=MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | grep "Connection:"
--echo # --echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
--echo # The remaining tests should produce warnings --exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:"
--echo #
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | grep "Connection:\|WARNING:"

View File

@@ -1,24 +1,17 @@
# #
# MDEV-14974: --port ignored for --host=localhost # MDEV-14974: --port ignored for --host=localhost
# #
# # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
# The following group of tests should produce no warnings
#
# exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
Connection: localhost via TCP/IP Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via named pipe Connection: localhost via named pipe
# exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via named pipe
# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
Connection: localhost via named pipe
#
# The remaining tests should produce warnings
#
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
WARNING: Forcing protocol to PIPE due to option specification. Please explicitly state intended protocol.
Connection: localhost via named pipe Connection: localhost via named pipe
# exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP
# exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
Connection: localhost via TCP/IP

View File

@@ -5,33 +5,23 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/windows.inc --source include/windows.inc
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
--exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:"
--echo # --echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
--echo # The following group of tests should produce no warnings --exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:"
--echo #
--echo # exec MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--exec $MYSQL --host=localhost -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:"
--echo # exec MYSQL --host=localhost --port=MASTER_MYPORT --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
--exec $MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:"
--echo # exec MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--exec $MYSQL --host=localhost --protocol=pipe -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--echo # exec MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--exec $MYSQL --host=localhost -W -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:" --exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:"
--echo # exec MYSQL --host=localhost -W --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost -W --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--echo #
--echo # The remaining tests should produce warnings
--echo #
--echo # exec MYSQL --host=localhost --socket=MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"
--exec $MYSQL --host=localhost --socket=$MASTER_MYSOCK -e "status" 2>&1 | findstr /c:"Connection:" /c:"WARNING:"

View File

@@ -22701,6 +22701,100 @@ a
deallocate prepare stmt; deallocate prepare stmt;
drop view v1; drop view v1;
drop table t1; drop table t1;
#
# MDEV-31240: condition pushed into splittable derived has reference to
# outer column and does not refer to any column of embedding
# select
#
create table t1 (a int);
insert into t1 select seq from seq_1_to_1000;
create table t2 (a int, b int, key (a));
insert into t2 select mod(seq,100), rand(13) * mod(seq,500) from seq_1_to_1000;
create table t3 (a int);
insert into t3 values (3), (1);
analyze table t1, t2, t3 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
explain select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 1
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
3 LATERAL DERIVED t2 ref a a 5 test.t1.a 10
select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
a ( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
1 1=804
2 1=1056
3 1=846
4 1=947
5 1=973
truncate table t2;
insert into t2 select mod(seq,10), rand(15) * mod(seq,500) from seq_1_to_1000;
analyze table t2 persistent for all;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
explain select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 1000
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY <derived3> ref key0 key0 5 test.t1.a 100
3 DERIVED t2 ALL a NULL NULL NULL 1000 Using temporary; Using filesort
select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
a ( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
1 1=11858
2 1=11380
3 1=11588
4 1=11373
5 1=11612
drop table t1,t2,t3;
# End of 10.4 tests # End of 10.4 tests
# #
# MDEV-28958: condition pushable into view after simplification # MDEV-28958: condition pushable into view after simplification

View File

@@ -4173,6 +4173,47 @@ deallocate prepare stmt;
drop view v1; drop view v1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-31240: condition pushed into splittable derived has reference to
--echo # outer column and does not refer to any column of embedding
--echo # select
--echo #
create table t1 (a int);
insert into t1 select seq from seq_1_to_1000;
create table t2 (a int, b int, key (a));
insert into t2 select mod(seq,100), rand(13) * mod(seq,500) from seq_1_to_1000;
create table t3 (a int);
insert into t3 values (3), (1);
analyze table t1, t2, t3 persistent for all;
let $q=
select
a,
( select concat(t3.a,'=',dt.s)
from
(select a, sum(b) as s from t2 group by a) as dt,
t3
where dt.a=t1.a and t3.a < 3
)
from t1 limit 5;
eval explain $q;
eval $q;
truncate table t2;
insert into t2 select mod(seq,10), rand(15) * mod(seq,500) from seq_1_to_1000;
analyze table t2 persistent for all;
eval explain $q;
eval $q;
drop table t1,t2,t3;
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #

View File

@@ -287,4 +287,604 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED t4 ALL NULL NULL NULL NULL 40 Using filesort 2 DERIVED t4 ALL NULL NULL NULL NULL 40 Using filesort
drop table t3, t4; drop table t3, t4;
# End of 10.3 tests # End of 10.3 tests
#
# MDEV-26301: Split optimization refills temporary table too many times
#
create table t1(a int, b int);
insert into t1 select seq,seq from seq_1_to_5;
create table t2(a int, b int, key(a));
insert into t2
select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
create table t3(a int, b int, key(a));
insert into t3
select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
analyze table t1,t2,t3 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
explain
select * from
(t1 left join t2 on t2.a=t1.b) left join t3 on t3.a=t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1 SIMPLE t2 ref a a 5 test.t1.b 2 Using where
1 SIMPLE t3 ref a a 5 test.t1.b 3 Using where
create table t10 (
grp_id int,
col1 int,
key(grp_id)
);
insert into t10
select
A.seq,
B.seq
from
seq_1_to_100 A,
seq_1_to_100 B;
create table t11 (
col1 int,
col2 int
);
insert into t11
select A.seq, A.seq from seq_1_to_10 A;
analyze table t10,t11 persistent for all;
Table Op Msg_type Msg_text
test.t10 analyze status Engine-independent statistics collected
test.t10 analyze status Table is already up to date
test.t11 analyze status Engine-independent statistics collected
test.t11 analyze status OK
explain select * from
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
# The important part in the below output is:
# "lateral": 1,
# "query_block": {
# "select_id": 2,
# "r_loops": 5, <-- must be 5, not 30.
analyze format=json select * from
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b;
ANALYZE
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"cost": "REPLACED",
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"const_condition": "1",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"r_loops": 1,
"rows": 5,
"r_rows": 5,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
},
{
"table": {
"table_name": "t2",
"access_type": "ref",
"possible_keys": ["a"],
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t1.b"],
"loops": 5,
"r_loops": 5,
"rows": 2,
"r_rows": 2,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "trigcond(trigcond(t1.b is not null))"
}
},
{
"table": {
"table_name": "t3",
"access_type": "ref",
"possible_keys": ["a"],
"key": "a",
"key_length": "5",
"used_key_parts": ["a"],
"ref": ["test.t1.b"],
"loops": 10,
"r_loops": 10,
"rows": 3,
"r_rows": 3,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "trigcond(trigcond(t1.b is not null))"
}
},
{
"table": {
"table_name": "<derived2>",
"access_type": "ref",
"possible_keys": ["key0"],
"key": "key0",
"key_length": "5",
"used_key_parts": ["grp_id"],
"ref": ["test.t1.b"],
"loops": 30,
"r_loops": 30,
"rows": 10,
"r_rows": 1,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "trigcond(trigcond(t1.b is not null))",
"materialized": {
"lateral": 1,
"query_block": {
"select_id": 2,
"cost": "REPLACED",
"r_loops": 5,
"r_total_time_ms": "REPLACED",
"outer_ref_condition": "t1.b is not null",
"nested_loop": [
{
"table": {
"table_name": "t10",
"access_type": "ref",
"possible_keys": ["grp_id"],
"key": "grp_id",
"key_length": "5",
"used_key_parts": ["grp_id"],
"ref": ["test.t1.b"],
"loops": 1,
"r_loops": 5,
"rows": 100,
"r_rows": 100,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
},
{
"block-nl-join": {
"table": {
"table_name": "t11",
"access_type": "ALL",
"loops": 100,
"r_loops": 5,
"rows": 10,
"r_rows": 10,
"cost": "REPLACED",
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"buffer_type": "flat",
"buffer_size": "1Kb",
"join_type": "BNL",
"attached_condition": "trigcond(t11.col1 = t10.col1)",
"r_loops": 500,
"r_filtered": 10,
"r_unpack_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_effective_rows": 10
}
}
]
}
}
}
}
]
}
}
create table t21 (pk int primary key);
insert into t21 values (1),(2),(3);
create table t22 (pk int primary key);
insert into t22 values (1),(2),(3);
explain
select * from
t21, t22,
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b
where
t21.pk=1 and t22.pk=2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index
1 PRIMARY t22 const PRIMARY PRIMARY 4 const 1 Using index
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
explain
select * from
t21,
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from
t22 join t10 left join t11 on t11.col1=t10.col1
where
t22.pk=1
group by grp_id) T on T.grp_id=t1.b
where
t21.pk=1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 LATERAL DERIVED t22 const PRIMARY PRIMARY 4 const 1 Using index
2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
create table t5 (
pk int primary key
);
insert into t5 select seq from seq_1_to_1000;
explain
select * from
t21,
(
(((t1 join t5 on t5.pk=t1.b)) left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from
t22 join t10 left join t11 on t11.col1=t10.col1
where
t22.pk=1
group by grp_id) T on T.grp_id=t1.b
where
t21.pk=1;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t21 const PRIMARY PRIMARY 4 const 1 Using index
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where
1 PRIMARY t5 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 Using index
1 PRIMARY t2 ref a a 5 test.t1.b 2
1 PRIMARY t3 ref a a 5 test.t1.b 3
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 LATERAL DERIVED t22 const PRIMARY PRIMARY 4 const 1 Using index
2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t5.pk 100 Using index condition
2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
drop table t1,t2,t3,t5, t10, t11, t21, t22;
create table t1(a int, b int);
insert into t1 select seq,seq from seq_1_to_5;
create table t2(a int, b int, key(a));
insert into t2
select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
create table t3(a int, b int, key(a));
insert into t3
select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
analyze table t1,t2,t3 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
create table t10 (
grp_id int,
col1 int,
key(grp_id)
);
insert into t10
select
A.seq,
B.seq
from
seq_1_to_100 A,
seq_1_to_100 B;
create table t11 (
col1 int,
col2 int
);
insert into t11
select A.seq, A.seq from seq_1_to_10 A;
analyze table t10,t11 persistent for all;
Table Op Msg_type Msg_text
test.t10 analyze status Engine-independent statistics collected
test.t10 analyze status Table is already up to date
test.t11 analyze status Engine-independent statistics collected
test.t11 analyze status OK
explain select *
from
(
(t1 left join t2 on t2.a=t1.b)
left join
t3
on t3.a=t1.b
)
left join
(
select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id
)dt
on dt.grp_id=t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
select *
from
(
(t1 left join t2 on t2.a=t1.b)
left join
t3
on t3.a=t1.b
)
left join
(
select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id
)dt
on dt.grp_id=t1.b;
a b a b a b grp_id count(*)
1 1 1 1 1 1 1 100
1 1 1 1 1 2 1 100
1 1 1 1 1 3 1 100
1 1 1 2 1 1 1 100
1 1 1 2 1 2 1 100
1 1 1 2 1 3 1 100
2 2 2 1 2 1 2 100
2 2 2 1 2 2 2 100
2 2 2 1 2 3 2 100
2 2 2 2 2 1 2 100
2 2 2 2 2 2 2 100
2 2 2 2 2 3 2 100
3 3 3 1 3 1 3 100
3 3 3 1 3 2 3 100
3 3 3 1 3 3 3 100
3 3 3 2 3 1 3 100
3 3 3 2 3 2 3 100
3 3 3 2 3 3 3 100
4 4 4 1 4 1 4 100
4 4 4 1 4 2 4 100
4 4 4 1 4 3 4 100
4 4 4 2 4 1 4 100
4 4 4 2 4 2 4 100
4 4 4 2 4 3 4 100
5 5 5 1 5 1 5 100
5 5 5 1 5 2 5 100
5 5 5 1 5 3 5 100
5 5 5 2 5 1 5 100
5 5 5 2 5 2 5 100
5 5 5 2 5 3 5 100
set join_cache_level=4;
set optimizer_trace=1;
set @tmp=@@optimizer_switch, optimizer_switch='hash_join_cardinality=off';
insert into t11
select A.seq, A.seq from seq_11_to_100 A;
analyze table t11 persistent for all;
Table Op Msg_type Msg_text
test.t11 analyze status Engine-independent statistics collected
test.t11 analyze status OK
explain select *
from
(
(t1 left join t2 on t2.a=t1.b)
left join
t3
on t3.a=t1.b
)
left join
(
select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id
)dt
on dt.grp_id=t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
2 LATERAL DERIVED t11 hash_ALL NULL #hash#$hj 5 test.t10.col1 100 Using where; Using join buffer (flat, BNLH join)
select *
from
(
(t1 left join t2 on t2.a=t1.b)
left join
t3
on t3.a=t1.b
)
left join
(
select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id
)dt
on dt.grp_id=t1.b;
a b a b a b grp_id count(*)
1 1 1 1 1 1 1 100
1 1 1 1 1 2 1 100
1 1 1 1 1 3 1 100
1 1 1 2 1 1 1 100
1 1 1 2 1 2 1 100
1 1 1 2 1 3 1 100
2 2 2 1 2 1 2 100
2 2 2 1 2 2 2 100
2 2 2 1 2 3 2 100
2 2 2 2 2 1 2 100
2 2 2 2 2 2 2 100
2 2 2 2 2 3 2 100
3 3 3 1 3 1 3 100
3 3 3 1 3 2 3 100
3 3 3 1 3 3 3 100
3 3 3 2 3 1 3 100
3 3 3 2 3 2 3 100
3 3 3 2 3 3 3 100
4 4 4 1 4 1 4 100
4 4 4 1 4 2 4 100
4 4 4 1 4 3 4 100
4 4 4 2 4 1 4 100
4 4 4 2 4 2 4 100
4 4 4 2 4 3 4 100
5 5 5 1 5 1 5 100
5 5 5 1 5 2 5 100
5 5 5 1 5 3 5 100
5 5 5 2 5 1 5 100
5 5 5 2 5 2 5 100
5 5 5 2 5 3 5 100
set optimizer_switch=@tmp;
set join_cache_level=default;
delete from t11;
insert into t11 select A.seq, A.seq from seq_1_to_10 A;
analyze table t11 persistent for all;
Table Op Msg_type Msg_text
test.t11 analyze status Engine-independent statistics collected
test.t11 analyze status OK
drop index a on t2;
drop index a on t3;
explain select *
from
(
(t1 left join t2 on t2.a=t1.b)
left join
t3
on t3.a=t1.b
)
left join
(
select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id
)dt
on dt.grp_id=t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ALL NULL NULL NULL NULL 50 Using where; Using join buffer (flat, BNL join)
1 PRIMARY t3 ALL NULL NULL NULL NULL 15 Using where; Using join buffer (incremental, BNL join)
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 1000 Using where
2 DERIVED t10 ALL grp_id NULL NULL NULL 10000 Using temporary; Using filesort
2 DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
select *
from
(
(t1 left join t2 on t2.a=t1.b)
left join
t3
on t3.a=t1.b
)
left join
(
select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id
)dt
on dt.grp_id=t1.b;
a b a b a b grp_id count(*)
1 1 1 1 1 1 1 100
1 1 1 2 1 1 1 100
1 1 1 1 1 2 1 100
1 1 1 2 1 2 1 100
1 1 1 1 1 3 1 100
1 1 1 2 1 3 1 100
2 2 2 1 2 1 2 100
2 2 2 2 2 1 2 100
2 2 2 1 2 2 2 100
2 2 2 2 2 2 2 100
2 2 2 1 2 3 2 100
2 2 2 2 2 3 2 100
3 3 3 1 3 1 3 100
3 3 3 2 3 1 3 100
3 3 3 1 3 2 3 100
3 3 3 2 3 2 3 100
3 3 3 1 3 3 3 100
3 3 3 2 3 3 3 100
4 4 4 1 4 1 4 100
4 4 4 2 4 1 4 100
4 4 4 1 4 2 4 100
4 4 4 2 4 2 4 100
4 4 4 1 4 3 4 100
4 4 4 2 4 3 4 100
5 5 5 1 5 1 5 100
5 5 5 2 5 1 5 100
5 5 5 1 5 2 5 100
5 5 5 2 5 2 5 100
5 5 5 1 5 3 5 100
5 5 5 2 5 3 5 100
drop table t1,t2,t3;
drop table t10, t11;
#
# MDEV-31194: Server crash or assertion failure with join_cache_level=4
# (a followup to the above bug, MDEV-26301)
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (3),(4);
CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=Aria;
INSERT INTO t2 VALUES (1),(2);
set @tmp1= @@optimizer_switch, @tmp2= @@join_cache_level;
set
optimizer_switch= 'derived_with_keys=off',
join_cache_level= 4;
SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id= t1.a;
a
set optimizer_switch= @tmp1, join_cache_level= @tmp2;
DROP TABLE t1, t2;
#
# MDEV-31403: Server crashes in st_join_table::choose_best_splitting (still)
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (100),(200);
CREATE TABLE t3 (c INT, d INT, KEY(c)) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1,1),(2,2);
CREATE VIEW v AS SELECT c, d FROM t3 GROUP BY c, d;
SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
a b
DROP VIEW v;
DROP TABLE t1, t2, t3;
# End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@@ -233,4 +233,272 @@ drop table t3, t4;
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo #
--echo # MDEV-26301: Split optimization refills temporary table too many times
--echo #
# 5 values
create table t1(a int, b int);
insert into t1 select seq,seq from seq_1_to_5;
# 5 value groups of size 2 each
create table t2(a int, b int, key(a));
insert into t2
select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
# 5 value groups of size 3 each
create table t3(a int, b int, key(a));
insert into t3
select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
analyze table t1,t2,t3 persistent for all;
explain
select * from
(t1 left join t2 on t2.a=t1.b) left join t3 on t3.a=t1.b;
# Now, create tables for Groups.
create table t10 (
grp_id int,
col1 int,
key(grp_id)
);
# 100 groups of 100 values each
insert into t10
select
A.seq,
B.seq
from
seq_1_to_100 A,
seq_1_to_100 B;
# and X10 multiplier
create table t11 (
col1 int,
col2 int
);
insert into t11
select A.seq, A.seq from seq_1_to_10 A;
analyze table t10,t11 persistent for all;
let $q1=
select * from
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b;
eval
explain $q1;
--echo # The important part in the below output is:
--echo # "lateral": 1,
--echo # "query_block": {
--echo # "select_id": 2,
--echo # "r_loops": 5, <-- must be 5, not 30.
--source include/analyze-format.inc
eval
analyze format=json $q1;
create table t21 (pk int primary key);
insert into t21 values (1),(2),(3);
create table t22 (pk int primary key);
insert into t22 values (1),(2),(3);
# Same as above but throw in a couple of const tables.
explain
select * from
t21, t22,
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b
where
t21.pk=1 and t22.pk=2;
explain
select * from
t21,
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from
t22 join t10 left join t11 on t11.col1=t10.col1
where
t22.pk=1
group by grp_id) T on T.grp_id=t1.b
where
t21.pk=1;
# And also add a non-const table
create table t5 (
pk int primary key
);
insert into t5 select seq from seq_1_to_1000;
explain
select * from
t21,
(
(((t1 join t5 on t5.pk=t1.b)) left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from
t22 join t10 left join t11 on t11.col1=t10.col1
where
t22.pk=1
group by grp_id) T on T.grp_id=t1.b
where
t21.pk=1;
drop table t1,t2,t3,t5, t10, t11, t21, t22;
# 5 values
create table t1(a int, b int);
insert into t1 select seq,seq from seq_1_to_5;
# 5 value groups of size 2 each
create table t2(a int, b int, key(a));
insert into t2
select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
# 5 value groups of size 3 each
create table t3(a int, b int, key(a));
insert into t3
select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
analyze table t1,t2,t3 persistent for all;
create table t10 (
grp_id int,
col1 int,
key(grp_id)
);
# 100 groups of 100 values each
insert into t10
select
A.seq,
B.seq
from
seq_1_to_100 A,
seq_1_to_100 B;
# and X10 multiplier
create table t11 (
col1 int,
col2 int
);
insert into t11
select A.seq, A.seq from seq_1_to_10 A;
analyze table t10,t11 persistent for all;
let $q=
select *
from
(
(t1 left join t2 on t2.a=t1.b)
left join
t3
on t3.a=t1.b
)
left join
(
select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id
)dt
on dt.grp_id=t1.b;
eval explain $q;
eval $q;
set join_cache_level=4;
set optimizer_trace=1;
set @tmp=@@optimizer_switch, optimizer_switch='hash_join_cardinality=off';
# Need table t11 to be larger in 11.0:
insert into t11
select A.seq, A.seq from seq_11_to_100 A;
analyze table t11 persistent for all;
eval explain $q;
eval $q;
set optimizer_switch=@tmp;
set join_cache_level=default;
delete from t11;
insert into t11 select A.seq, A.seq from seq_1_to_10 A;
analyze table t11 persistent for all;
drop index a on t2;
drop index a on t3;
eval explain $q;
eval $q;
drop table t1,t2,t3;
drop table t10, t11;
--echo #
--echo # MDEV-31194: Server crash or assertion failure with join_cache_level=4
--echo # (a followup to the above bug, MDEV-26301)
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (3),(4);
CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=Aria;
INSERT INTO t2 VALUES (1),(2);
set @tmp1= @@optimizer_switch, @tmp2= @@join_cache_level;
set
optimizer_switch= 'derived_with_keys=off',
join_cache_level= 4;
SELECT t1.* FROM t1 JOIN (SELECT id, COUNT(*) FROM t2 GROUP BY id) sq ON sq.id= t1.a;
set optimizer_switch= @tmp1, join_cache_level= @tmp2;
# Cleanup
DROP TABLE t1, t2;
--echo #
--echo # MDEV-31403: Server crashes in st_join_table::choose_best_splitting (still)
--echo #
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES
(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15);
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
INSERT INTO t2 VALUES (100),(200);
CREATE TABLE t3 (c INT, d INT, KEY(c)) ENGINE=InnoDB;
INSERT INTO t3 VALUES (1,1),(2,2);
CREATE VIEW v AS SELECT c, d FROM t3 GROUP BY c, d;
SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
# Cleanup
DROP VIEW v;
DROP TABLE t1, t2, t3;
--echo # End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent; SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@@ -4310,3 +4310,71 @@ deallocate prepare stmt;
drop view v; drop view v;
drop table t1,t2,t3; drop table t1,t2,t3;
# End of 10.4 tests # End of 10.4 tests
#
# MDEV-31143: view with ORDER BY used in query with rownum() in WHERE
#
create table t1 (id int primary key);
insert into t1 values (3), (7), (1);
create table t2 (a int);
insert into t2 values (2), (4);
create view v as select a from t2 order by a;
set big_tables= 1;
Warnings:
Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
select t1.id from v, t1 where rownum() = 1 group by t1.id;
id
1
set big_tables=default;
Warnings:
Warning 1287 '@@big_tables' is deprecated and will be removed in a future release
drop view v;
drop table t1, t2;
#
# MDEV-31162: multi-table mergeable view with ORDER BY used
# in query with rownum() in WHERE
#
create table t1 (a INT) engine=MyISAM;
insert into t1 values (1),(2);
create table t2 (b INT) engine=MyISAM;
insert into t2 values (3),(4);
create view v1 AS select * from t1 join t2 order by b;
explain select * from v1 where rownum() <= 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
select * from v1 where rownum() <= 2;
a b
1 3
2 3
prepare stmt from "select * from v1 where rownum() <= 2";
execute stmt;
a b
1 3
2 3
execute stmt;
a b
1 3
2 3
deallocate prepare stmt;
create view v2 AS select * from t1 join t2 order by b/a;
explain select * from v2 where rownum() <= 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
select * from v2 where rownum() <= 2;
a b
2 3
1 3
prepare stmt from "select * from v2 where rownum() <= 2";
execute stmt;
a b
2 3
1 3
execute stmt;
a b
2 3
1 3
deallocate prepare stmt;
drop view v1,v2;
drop table t1,t2;
# End of 10.6 tests

View File

@@ -2760,3 +2760,65 @@ drop view v;
drop table t1,t2,t3; drop table t1,t2,t3;
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo #
--echo # MDEV-31143: view with ORDER BY used in query with rownum() in WHERE
--echo #
create table t1 (id int primary key);
insert into t1 values (3), (7), (1);
create table t2 (a int);
insert into t2 values (2), (4);
create view v as select a from t2 order by a;
set big_tables= 1;
select t1.id from v, t1 where rownum() = 1 group by t1.id;
set big_tables=default;
drop view v;
drop table t1, t2;
--echo #
--echo # MDEV-31162: multi-table mergeable view with ORDER BY used
--echo # in query with rownum() in WHERE
--echo #
create table t1 (a INT) engine=MyISAM;
insert into t1 values (1),(2);
create table t2 (b INT) engine=MyISAM;
insert into t2 values (3),(4);
create view v1 AS select * from t1 join t2 order by b;
let $q1=
select * from v1 where rownum() <= 2;
eval explain $q1;
--sorted_result
eval $q1;
eval prepare stmt from "$q1";
--sorted_result
execute stmt;
--sorted_result
execute stmt;
deallocate prepare stmt;
create view v2 AS select * from t1 join t2 order by b/a;
let $q2=
select * from v2 where rownum() <= 2;
eval explain $q2;
eval $q2;
eval prepare stmt from "$q2";
execute stmt;
execute stmt;
deallocate prepare stmt;
drop view v1,v2;
drop table t1,t2;
--echo # End of 10.6 tests

View File

@@ -1097,6 +1097,7 @@ sum(distinct 1) sum(t1.d) > 5 c
1 1 0 1 1 0
1 0 5 1 0 5
1 1 6 1 1 6
SET @sort_buffer_size_save= @@sort_buffer_size;
set @@sort_buffer_size=1024; set @@sort_buffer_size=1024;
insert into t1 select -seq,-seq from seq_1_to_100; insert into t1 select -seq,-seq from seq_1_to_100;
select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ; select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ;
@@ -1110,6 +1111,19 @@ sum(distinct 1) sum(t1.d) > 2 length(group_concat(t1.d)) > 1000 c
1 1 0 5 1 1 0 5
1 1 0 6 1 1 0 6
drop table t1; drop table t1;
set @@sort_buffer_size=@sort_buffer_size_save;
#
# MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key
# with DISTINCT and group function
#
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
SELECT DISTINCT CONVERT(STDDEV(f), CHAR(16)) AS f1, UUID() AS f2 FROM t GROUP BY f2 WITH ROLLUP;
f1 f2
0.0000 #
0.0000 #
0.5000 #
DROP TABLE t;
# End of 10.4 tests # End of 10.4 tests
# #
# MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN # MDEV-27382: OFFSET is ignored when it is combined with the DISTINCT, IN() and JOIN

View File

@@ -835,11 +835,24 @@ select distinct sum(distinct 1), sum(t1.d) > 5 from (t1 e join t1) group by t1.c
select distinct sum(distinct 1), sum(t1.d) > 5, t1.c from (t1 e join t1) group by t1.c; select distinct sum(distinct 1), sum(t1.d) > 5, t1.c from (t1 e join t1) group by t1.c;
# Force usage of remove_dup_with_compare() algorithm # Force usage of remove_dup_with_compare() algorithm
SET @sort_buffer_size_save= @@sort_buffer_size;
set @@sort_buffer_size=1024; set @@sort_buffer_size=1024;
insert into t1 select -seq,-seq from seq_1_to_100; insert into t1 select -seq,-seq from seq_1_to_100;
select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ; select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000 from (t1 e join t1) group by t1.c having t1.c > -2 ;
select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000,t1.c from (t1 e join t1) group by t1.c having t1.c > -2; select distinct sum(distinct 1), sum(t1.d) > 2, length(group_concat(t1.d)) > 1000,t1.c from (t1 e join t1) group by t1.c having t1.c > -2;
drop table t1; drop table t1;
set @@sort_buffer_size=@sort_buffer_size_save;
--echo #
--echo # MDEV-31113 Server crashes in store_length / Type_handler_string_result::make_sort_key
--echo # with DISTINCT and group function
--echo #
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
--replace_column 2 #
SELECT DISTINCT CONVERT(STDDEV(f), CHAR(16)) AS f1, UUID() AS f2 FROM t GROUP BY f2 WITH ROLLUP;
DROP TABLE t;
--echo # End of 10.4 tests --echo # End of 10.4 tests

View File

@@ -18,3 +18,21 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DERIVED t1 range NULL id 53 NULL 1 Using index for group-by 2 DERIVED t1 range NULL id 53 NULL 1 Using index for group-by
SET GLOBAL slow_query_log = @sql_tmp; SET GLOBAL slow_query_log = @sql_tmp;
drop table t1; drop table t1;
#
# MDEV-31181: Server crash in subselect_uniquesubquery_engine::print
# upon EXPLAIN EXTENDED DELETE
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (pk INT PRIMARY KEY);
INSERT INTO t2 VALUES (1),(2);
EXPLAIN EXTENDED DELETE FROM t1 WHERE a IN (SELECT pk FROM t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2 DEPENDENT SUBQUERY t2 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index
Warnings:
Note 1003 /* select#1 */ delete from `test`.`t1` where <in_optimizer>(`test`.`t1`.`a`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`a`))))
drop table t1, t2;
#
# End of 10.4 tests
#

View File

@@ -18,3 +18,22 @@ SELECT * FROM (SELECT id FROM t1 GROUP BY id) dt WHERE 1=0;
SET GLOBAL slow_query_log = @sql_tmp; SET GLOBAL slow_query_log = @sql_tmp;
drop table t1; drop table t1;
--echo #
--echo # MDEV-31181: Server crash in subselect_uniquesubquery_engine::print
--echo # upon EXPLAIN EXTENDED DELETE
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (pk INT PRIMARY KEY);
INSERT INTO t2 VALUES (1),(2);
EXPLAIN EXTENDED DELETE FROM t1 WHERE a IN (SELECT pk FROM t2);
drop table t1, t2;
--echo #
--echo # End of 10.4 tests
--echo #

View File

@@ -277,3 +277,22 @@ EXECUTE stmt;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 2 1 SIMPLE t2 ALL NULL NULL NULL NULL 2
drop table t1,t2; drop table t1,t2;
#
# MDEV-31224: EXPLAIN EXTENDED for multi-table update of system table
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (3);
EXPLAIN EXTENDED UPDATE t1, t2 SET b = 4 WHERE a IN (6,2);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 update `test`.`t1` set `test`.`t2`.`b` = 4 where `test`.`t1`.`a` in (6,2)
UPDATE t1, t2 SET b = 4 WHERE a IN (6,2);
SELECT * from t2;
b
4
DROP TABLE t1, t2;
# End of 10.4 tests

View File

@@ -250,3 +250,23 @@ PREPARE stmt FROM 'EXPLAIN INSERT INTO t1 SELECT * FROM t2';
EXECUTE stmt; EXECUTE stmt;
drop table t1,t2; drop table t1,t2;
--echo #
--echo # MDEV-31224: EXPLAIN EXTENDED for multi-table update of system table
--echo #
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (3);
let $q=
UPDATE t1, t2 SET b = 4 WHERE a IN (6,2);
eval EXPLAIN EXTENDED $q;
eval $q;
SELECT * from t2;
DROP TABLE t1, t2;
--echo # End of 10.4 tests

View File

@@ -1674,7 +1674,18 @@ DROP TABLE t;
# End of 10.6 tests # End of 10.6 tests
# #
# #
# Beginning of 10.9 tests # MDEV-31147 json_normalize does not work correctly with MSAN build
#
CREATE TABLE t1 (val JSON);
ALTER TABLE t1 ADD COLUMN normalized_json JSON AS (JSON_NORMALIZE(val));
INSERT INTO t1 (val) VALUES ('15');
SELECT * FROM t1;
val normalized_json
15 1.5E1
DROP TABLE t1;
#
# End of 10.8 tests
#
# #
# MDEV-27677: Implement JSON_OVERLAPS() # MDEV-27677: Implement JSON_OVERLAPS()
# #

View File

@@ -1114,7 +1114,18 @@ DROP TABLE t;
--echo # --echo #
--echo # --echo #
--echo # Beginning of 10.9 tests --echo # MDEV-31147 json_normalize does not work correctly with MSAN build
--echo #
CREATE TABLE t1 (val JSON);
ALTER TABLE t1 ADD COLUMN normalized_json JSON AS (JSON_NORMALIZE(val));
INSERT INTO t1 (val) VALUES ('15');
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.8 tests
--echo #
--echo # --echo #
--echo # MDEV-27677: Implement JSON_OVERLAPS() --echo # MDEV-27677: Implement JSON_OVERLAPS()
--echo # --echo #

View File

@@ -51,7 +51,7 @@ CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNI
ERROR HY000: Field 'v1' doesn't have a default value ERROR HY000: Field 'v1' doesn't have a default value
CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb
REPLACE SELECT NULL AS a; REPLACE SELECT NULL AS a;
ERROR HY000: Field 'DB_ROW_HASH_1' doesn't have a default value ERROR 23000: CONSTRAINT `t1.i` failed for `test`.`t1`
# #
# End of 10.5 tests # End of 10.5 tests
# #

View File

@@ -71,7 +71,7 @@ DROP TABLE t2, t1;
--error ER_NO_DEFAULT_FOR_FIELD --error ER_NO_DEFAULT_FOR_FIELD
CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ; CREATE TEMPORARY TABLE v0 ( v1 TEXT ( 15 ) CHAR SET BINARY NOT NULL NOT NULL UNIQUE CHECK ( v1 ) ) REPLACE SELECT NULL AS v3 , 74 AS v2 ;
--error ER_NO_DEFAULT_FOR_FIELD --error ER_CONSTRAINT_FAILED
CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb CREATE TEMPORARY TABLE t1 (i TEXT(15) NOT NULL DEFAULT '' UNIQUE CHECK (i)) engine=innodb
REPLACE SELECT NULL AS a; REPLACE SELECT NULL AS a;

View File

@@ -412,3 +412,45 @@ select if( @stamp1 = @stamp2, "correct", "wrong");
if( @stamp1 = @stamp2, "correct", "wrong") if( @stamp1 = @stamp2, "correct", "wrong")
correct correct
drop table t1; drop table t1;
#
# MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases
#
set timestamp=unix_timestamp('2000-10-20 0:0:0');
create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp
default current_timestamp on update current_timestamp);
insert t1 (pk, val) values(1, 'val1');
select * from t1;
pk val ts
1 val1 2000-10-20 00:00:00
set timestamp=unix_timestamp('2000-10-20 1:0:0');
insert t1 (pk, val) select 2, 'val3' union select 3, 'val4'
on duplicate key update ts=now();
select * from t1;
pk val ts
1 val1 2000-10-20 00:00:00
2 val3 2000-10-20 01:00:00
3 val4 2000-10-20 01:00:00
set timestamp=unix_timestamp('2000-10-20 2:0:0');
insert t1 (pk, val) select 1, 'val1' union select 4, 'val2'
on duplicate key update ts=now();
select * from t1;
pk val ts
1 val1 2000-10-20 02:00:00
2 val3 2000-10-20 01:00:00
3 val4 2000-10-20 01:00:00
4 val2 2000-10-20 02:00:00
set timestamp=unix_timestamp('2000-10-20 3:0:0');
insert t1 (pk, val) select 5, 'val1' union select 1, 'val2'
on duplicate key update ts=now();
select * from t1;
pk val ts
1 val1 2000-10-20 03:00:00
2 val3 2000-10-20 01:00:00
3 val4 2000-10-20 01:00:00
4 val2 2000-10-20 02:00:00
5 val1 2000-10-20 03:00:00
drop table t1;
set timestamp=default;
#
# End of 10.4 tests
#

View File

@@ -311,3 +311,30 @@ insert into t1(f1) values(1) on duplicate key update f1=1;
select @stamp2:=f2 from t1; select @stamp2:=f2 from t1;
select if( @stamp1 = @stamp2, "correct", "wrong"); select if( @stamp1 = @stamp2, "correct", "wrong");
drop table t1; drop table t1;
--echo #
--echo # MDEV-31164 default current_timestamp() not working when used INSERT ON DUPLICATE KEY in some cases
--echo #
set timestamp=unix_timestamp('2000-10-20 0:0:0');
create table t1 (pk integer primary key, val varchar(20) not null, ts timestamp
default current_timestamp on update current_timestamp);
insert t1 (pk, val) values(1, 'val1');
select * from t1;
set timestamp=unix_timestamp('2000-10-20 1:0:0');
insert t1 (pk, val) select 2, 'val3' union select 3, 'val4'
on duplicate key update ts=now();
select * from t1;
set timestamp=unix_timestamp('2000-10-20 2:0:0');
insert t1 (pk, val) select 1, 'val1' union select 4, 'val2'
on duplicate key update ts=now();
select * from t1;
set timestamp=unix_timestamp('2000-10-20 3:0:0');
insert t1 (pk, val) select 5, 'val1' union select 1, 'val2'
on duplicate key update ts=now();
select * from t1;
drop table t1;
set timestamp=default;
--echo #
--echo # End of 10.4 tests
--echo #

View File

@@ -1,7 +1,8 @@
# Disabled embedded as it does not support optimizer_trace
--source include/not_embedded.inc
--source include/have_sequence.inc --source include/have_sequence.inc
# Embedded doesn't have optimizer trace:
--source include/not_embedded.inc
create table t1 (a int, b int, c int); create table t1 (a int, b int, c int);
insert into t1 select seq,seq/2, seq/4 from seq_1_to_100; insert into t1 select seq,seq/2, seq/4 from seq_1_to_100;

View File

@@ -451,6 +451,12 @@ a b
1 xxx 1 xxx
drop table t1; drop table t1;
# #
# MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
#
create table t1 (f text not null, unique (f));
insert into t1 (f) select 'f';
drop table t1;
#
# End of 10.4 tests # End of 10.4 tests
# #
# #

View File

@@ -443,6 +443,13 @@ insert into t1 (a,b) select 1,'xxx' from seq_1_to_5;
select * from t1; select * from t1;
drop table t1; drop table t1;
--echo #
--echo # MDEV-22756 SQL Error (1364): Field 'DB_ROW_HASH_1' doesn't have a default value
--echo #
create table t1 (f text not null, unique (f));
insert into t1 (f) select 'f';
drop table t1;
--echo # --echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #

View File

@@ -2472,7 +2472,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00
Warnings: Warnings:
Note 1003 update `test`.`t1` set NULL = 10 Note 1003 update `test`.`t1` set `test`.`t2`.`c2` = 10
# Status of EXPLAIN EXTENDED query # Status of EXPLAIN EXTENDED query
Variable_name Value Variable_name Value
Handler_read_key 7 Handler_read_key 7
@@ -2513,7 +2513,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found 1 SIMPLE t2 system NULL NULL NULL NULL 0 0.00 Const row not found
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings: Warnings:
Note 1003 update `test`.`t1` set NULL = 10 where `test`.`t1`.`c3` = 10 Note 1003 update `test`.`t1` set `test`.`t2`.`c2` = 10 where `test`.`t1`.`c3` = 10
# Status of EXPLAIN EXTENDED query # Status of EXPLAIN EXTENDED query
Variable_name Value Variable_name Value
Handler_read_key 7 Handler_read_key 7

View File

@@ -514,6 +514,11 @@ select * from v2 {
} }
] ]
}, },
{
"check_split_materialized": {
"not_applicable": "no candidate field can be accessed through ref"
}
},
{ {
"best_join_order": ["t1"], "best_join_order": ["t1"],
"rows": 1, "rows": 1,
@@ -900,6 +905,11 @@ explain select * from v1 {
} }
] ]
}, },
{
"check_split_materialized": {
"not_applicable": "group list has no candidates"
}
},
{ {
"best_join_order": ["t1"], "best_join_order": ["t1"],
"rows": 10, "rows": 10,
@@ -12045,6 +12055,116 @@ SET optimizer_trace=DEFAULT;
DROP VIEW v; DROP VIEW v;
DROP TABLE t; DROP TABLE t;
# #
# MDEV-26301: Split optimization improvements: Optimizer Trace coverage
#
create table t1(a int, b int);
insert into t1 select seq,seq from seq_1_to_5;
create table t2(a int, b int, key(a));
insert into t2
select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
create table t3(a int, b int, key(a));
insert into t3
select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
analyze table t1,t2,t3 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status Table is already up to date
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status Table is already up to date
create table t10 (
grp_id int,
col1 int,
key(grp_id)
);
insert into t10
select
A.seq,
B.seq
from
seq_1_to_100 A,
seq_1_to_100 B;
create table t11 (
col1 int,
col2 int
);
insert into t11
select A.seq, A.seq from seq_1_to_10 A;
analyze table t10,t11 persistent for all;
Table Op Msg_type Msg_text
test.t10 analyze status Engine-independent statistics collected
test.t10 analyze status Table is already up to date
test.t11 analyze status Engine-independent statistics collected
test.t11 analyze status OK
set optimizer_trace=1;
explain
select * from
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5
1 PRIMARY t2 ref a a 5 test.t1.b 2 Using where
1 PRIMARY t3 ref a a 5 test.t1.b 3 Using where
1 PRIMARY <derived2> ref key0 key0 5 test.t1.b 10 Using where
2 LATERAL DERIVED t10 ref grp_id grp_id 5 test.t1.b 100
2 LATERAL DERIVED t11 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join)
select json_detailed(json_extract(trace, '$**.check_split_materialized')) as JS
from information_schema.optimizer_trace;
JS
[
{
"split_candidates":
["t10.grp_id"]
}
]
select
json_detailed(
json_remove(
json_extract(trace, '$**.choose_best_splitting')
, '$[0].split_plan_search[0]'
)
) as JS
from information_schema.optimizer_trace;
JS
[
{
"considered_keys":
[
{
"table_name": "t10",
"index": "grp_id",
"rec_per_key": 100,
"param_tables": 1
}
],
"refills": 5,
"spl_pd_boundary": 2,
"split_plan_search":
[],
"split_materialized":
{
"table": "t10",
"key": "grp_id",
"org_cost": 1.159965,
"postjoin_cost": 4.020888502,
"one_splitting_cost": 5.180853502,
"unsplit_postjoin_cost": 32.78652054,
"unsplit_cost": 148.7830205,
"rows": 100,
"refills": 5,
"total_splitting_cost": 25.90426751,
"chosen": true
}
}
]
drop table t1,t2,t3,t10,t11;
set optimizer_trace=DEFAULT;
#
# End of 10.4 tests # End of 10.4 tests
# #
set optimizer_trace='enabled=on'; set optimizer_trace='enabled=on';
@@ -12476,6 +12596,23 @@ from
information_schema.optimizer_trace; information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.choose_best_splitting')) json_detailed(json_extract(trace, '$**.choose_best_splitting'))
[ [
{
"considered_keys":
[]
},
{
"considered_keys":
[
{
"table_name": "t2",
"index": "idx_a",
"rec_per_key": 1.8367,
"param_tables": 1
}
],
"refills": 4,
"spl_pd_boundary": 2,
"split_plan_search":
[ [
{ {
"considered_execution_plans": "considered_execution_plans":
@@ -12529,8 +12666,8 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting'))
"cost_for_sorting": 0.001155201 "cost_for_sorting": 0.001155201
} }
] ]
}, }
{ ],
"split_materialized": "split_materialized":
{ {
"table": "t2", "table": "t2",
@@ -12541,19 +12678,12 @@ json_detailed(json_extract(trace, '$**.choose_best_splitting'))
"unsplit_postjoin_cost": 0.036032575, "unsplit_postjoin_cost": 0.036032575,
"unsplit_cost": 0.060625425, "unsplit_cost": 0.060625425,
"rows": 1.8367, "rows": 1.8367,
"outer_rows": 4, "refills": 4,
"total_splitting_cost": 0.012746412, "total_splitting_cost": 0.012746412,
"chosen": true "chosen": true
} }
} }
]
] ]
select
json_detailed(json_extract(trace, '$**.lateral_derived'))
from
information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.lateral_derived'))
NULL
drop table t1,t2; drop table t1,t2;
# #
# Test table functions. # Test table functions.

View File

@@ -672,6 +672,82 @@ SET optimizer_trace=DEFAULT;
DROP VIEW v; DROP VIEW v;
DROP TABLE t; DROP TABLE t;
--echo #
--echo # MDEV-26301: Split optimization improvements: Optimizer Trace coverage
--echo #
# 5 values
create table t1(a int, b int);
insert into t1 select seq,seq from seq_1_to_5;
# 5 value groups of size 2 each
create table t2(a int, b int, key(a));
insert into t2
select A.seq,B.seq from seq_1_to_25 A, seq_1_to_2 B;
# 5 value groups of size 3 each
create table t3(a int, b int, key(a));
insert into t3
select A.seq,B.seq from seq_1_to_5 A, seq_1_to_3 B;
analyze table t1,t2,t3 persistent for all;
create table t10 (
grp_id int,
col1 int,
key(grp_id)
);
# 100 groups of 100 values each
insert into t10
select
A.seq,
B.seq
from
seq_1_to_100 A,
seq_1_to_100 B;
# and X10 multiplier
create table t11 (
col1 int,
col2 int
);
insert into t11
select A.seq, A.seq from seq_1_to_10 A;
analyze table t10,t11 persistent for all;
set optimizer_trace=1;
explain
select * from
(
(t1 left join t2 on t2.a=t1.b)
left join t3 on t3.a=t1.b
) left join (select grp_id, count(*)
from t10 left join t11 on t11.col1=t10.col1
group by grp_id) T on T.grp_id=t1.b;
# Not sure how MDEV-27871 is related but this test uses this reason
# all over the place:
#enable after fix MDEV-27871
--disable_view_protocol
select json_detailed(json_extract(trace, '$**.check_split_materialized')) as JS
from information_schema.optimizer_trace;
select
json_detailed(
json_remove(
json_extract(trace, '$**.choose_best_splitting')
, '$[0].split_plan_search[0]'
)
) as JS
from information_schema.optimizer_trace;
--enable_view_protocol
drop table t1,t2,t3,t10,t11;
set optimizer_trace=DEFAULT;
--echo # --echo #
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #
@@ -880,13 +956,6 @@ from
information_schema.optimizer_trace; information_schema.optimizer_trace;
--enable_view_protocol --enable_view_protocol
# Same as above. just to show that splitting plan has some coverage in the
# trace.
select
json_detailed(json_extract(trace, '$**.lateral_derived'))
from
information_schema.optimizer_trace;
drop table t1,t2; drop table t1,t2;
--echo # --echo #

View File

@@ -139,6 +139,13 @@ select * from t1,t2 where t1.a=t2.a and rownum()<=2 order by t1.a,t2.a;
a b a b a b a b
2 20 2 21 2 20 2 21
3 30 3 31 3 30 3 31
create view v1 as
select * from (select * from t1 order by a desc) as t where rownum() <= 2;
select * from v1;
a b
3 30
2 20
drop view v1;
# #
# Having # Having
# #
@@ -984,3 +991,29 @@ next row is 3
3 3
next row is 5 next row is 5
5 5
#
# MDEV-31073: Server crash, assertion `table != 0 &&
# view->field_translation != 0' failure with ROWNUM and view
#
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
CREATE VIEW v AS SELECT * FROM t;
UPDATE v SET f = 10 WHERE ROWNUM() > 42 LIMIT 1;
DROP VIEW v;
DROP TABLE t;
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
CREATE VIEW v AS SELECT f, 3 as e FROM t;
UPDATE v SET f = 10 WHERE e > 42 LIMIT 1;
DROP VIEW v;
DROP TABLE t;
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
CREATE VIEW v AS SELECT f, ROWNUM() as e FROM t;
UPDATE v SET f = 10 WHERE e > 42 LIMIT 1;
ERROR HY000: The target table v of the UPDATE is not updatable
DROP VIEW v;
DROP TABLE t;
#
# End of 10.6 tests
#

View File

@@ -58,6 +58,11 @@ select *,rownum() from t1,t2 order by t2.a desc, t1.a desc;
select * from (select * from t1 order by a desc) as t where rownum() <= 2; select * from (select * from t1 order by a desc) as t where rownum() <= 2;
select * from t1,t2 where t1.a=t2.a and rownum()<=2 order by t1.a,t2.a; select * from t1,t2 where t1.a=t2.a and rownum()<=2 order by t1.a,t2.a;
create view v1 as
select * from (select * from t1 order by a desc) as t where rownum() <= 2;
select * from v1;
drop view v1;
--echo # --echo #
--echo # Having --echo # Having
--echo # --echo #
@@ -568,3 +573,40 @@ drop table t1;
--echo # Table value constructors --echo # Table value constructors
--echo # --echo #
values ("first row"),("next row is 3"),(rownum()),("next row is 5"),(rownum()); values ("first row"),("next row is 3"),(rownum()),("next row is 5"),(rownum());
--echo #
--echo # MDEV-31073: Server crash, assertion `table != 0 &&
--echo # view->field_translation != 0' failure with ROWNUM and view
--echo #
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
CREATE VIEW v AS SELECT * FROM t;
UPDATE v SET f = 10 WHERE ROWNUM() > 42 LIMIT 1;
# Cleanup
DROP VIEW v;
DROP TABLE t;
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
CREATE VIEW v AS SELECT f, 3 as e FROM t;
UPDATE v SET f = 10 WHERE e > 42 LIMIT 1;
# Cleanup
DROP VIEW v;
DROP TABLE t;
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
CREATE VIEW v AS SELECT f, ROWNUM() as e FROM t;
--error ER_NON_UPDATABLE_TABLE
UPDATE v SET f = 10 WHERE e > 42 LIMIT 1;
# Cleanup
DROP VIEW v;
DROP TABLE t;
--echo #
--echo # End of 10.6 tests
--echo #

View File

@@ -834,7 +834,7 @@ flush table t1;
set optimizer_use_condition_selectivity=4; set optimizer_use_condition_selectivity=4;
explain extended select * from t1 where a=0; explain extended select * from t1 where a=0;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.78 Using where
Warnings: Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
drop table t1; drop table t1;
@@ -1977,11 +1977,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
Warnings: Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
DROP TABLE t1;
# End of 10.2 tests
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size; set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables; set use_stat_tables= @save_use_stat_tables;
DROP TABLE t1;
# End of 10.2 tests
set @@global.histogram_size=@save_histogram_size; set @@global.histogram_size=@save_histogram_size;
# #
# MDEV-20595 # MDEV-20595

View File

@@ -1331,17 +1331,18 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
FLUSH TABLES; FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.2 tests --echo # End of 10.2 tests
# #
# Clean up # Clean up
# #
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables;
--source include/restore_charset.inc --source include/restore_charset.inc
set @@global.histogram_size=@save_histogram_size; set @@global.histogram_size=@save_histogram_size;

View File

@@ -840,7 +840,7 @@ flush table t1;
set optimizer_use_condition_selectivity=4; set optimizer_use_condition_selectivity=4;
explain extended select * from t1 where a=0; explain extended select * from t1 where a=0;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.39 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 1025 0.78 Using where
Warnings: Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 0
drop table t1; drop table t1;
@@ -1984,11 +1984,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 25.00 Using where
Warnings: Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2
DROP TABLE t1;
# End of 10.2 tests
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size; set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables; set use_stat_tables= @save_use_stat_tables;
DROP TABLE t1;
# End of 10.2 tests
set @@global.histogram_size=@save_histogram_size; set @@global.histogram_size=@save_histogram_size;
# #
# MDEV-20595 # MDEV-20595

View File

@@ -0,0 +1,104 @@
SET SESSION STORAGE_ENGINE='InnoDB';
Warnings:
Warning 1287 '@@storage_engine' is deprecated and will be removed in a future release. Please use '@@default_storage_engine' instead
set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
drop table if exists t0,t1,t2,t3;
select @@global.use_stat_tables;
@@global.use_stat_tables
COMPLEMENTARY
select @@session.use_stat_tables;
@@session.use_stat_tables
COMPLEMENTARY
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set @save_histogram_size=@@histogram_size;
set @save_histogram_type=@@histogram_type;
set join_cache_level=2;
set @@global.histogram_size=0,@@local.histogram_size=0;
set histogram_type='single_prec_hb';
set optimizer_use_condition_selectivity=3;
#
# MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
#
create table t0(a int);
insert into t0 select 1 from seq_1_to_78;
create table t1(a int);
insert into t1 select 1 from seq_1_to_26;
create table t10 (a int);
insert into t10 select 0 from t0, seq_1_to_4;
insert into t10 select 8693 from t1;
insert into t10 select 8694 from t1;
insert into t10 select 8695 from t1;
insert into t10 select 34783 from t1;
insert into t10 select 34784 from t1;
insert into t10 select 34785 from t1;
insert into t10 select 34785 from t0, seq_1_to_8;
insert into t10 select 65214 from t1;
insert into t10 select 65215 from t1;
insert into t10 select 65216 from t1;
insert into t10 select 65216 from t0, seq_1_to_52;
insert into t10 select 65217 from t1;
insert into t10 select 65218 from t1;
insert into t10 select 65219 from t1;
insert into t10 select 65219 from t0;
insert into t10 select 73913 from t1;
insert into t10 select 73914 from t1;
insert into t10 select 73915 from t1;
insert into t10 select 73915 from t0, seq_1_to_40;
insert into t10 select 78257 from t1;
insert into t10 select 78258 from t1;
insert into t10 select 78259 from t1;
insert into t10 select 91300 from t1;
insert into t10 select 91301 from t1;
insert into t10 select 91302 from t1;
insert into t10 select 91302 from t0, seq_1_to_6;
insert into t10 select 91303 from t1;
insert into t10 select 91304 from t1;
insert into t10 select 91305 from t1;
insert into t10 select 91305 from t0, seq_1_to_8;
insert into t10 select 99998 from t1;
insert into t10 select 99999 from t1;
insert into t10 select 100000 from t1;
set use_stat_tables=preferably;
analyze table t10 persistent for all;
Table Op Msg_type Msg_text
test.t10 analyze status Engine-independent statistics collected
test.t10 analyze status OK
flush tables;
set @tmp=@@optimizer_trace;
set optimizer_trace=1;
explain select * from t10 where a in (91303);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t10 ALL NULL NULL NULL NULL 9984 Using where
# Must have selectivity_from_histogram <= 1.0:
select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel
from information_schema.optimizer_trace;
sel
[
[
{
"column_name": "a",
"ranges":
["91303 <= a <= 91303"],
"selectivity_from_histogram": 0.035714283
}
]
]
set optimizer_trace=@tmp;
drop table t0,t1,t10;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables;
#
# End of 10.4 tests
#
#
# Clean up
#
set @@global.histogram_size=@save_histogram_size;
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
SET SESSION STORAGE_ENGINE=DEFAULT;
Warnings:
Warning 1287 '@@storage_engine' is deprecated and will be removed in a future release. Please use '@@default_storage_engine' instead

View File

@@ -0,0 +1,16 @@
--source include/have_innodb.inc
# This test is slow on buildbot.
--source include/big_test.inc
--source include/default_optimizer_switch.inc
--source include/not_embedded.inc
SET SESSION STORAGE_ENGINE='InnoDB';
set @save_optimizer_switch_for_selectivity_test=@@optimizer_switch;
set optimizer_switch='extended_keys=on';
--source selectivity_notembedded.test
set optimizer_switch=@save_optimizer_switch_for_selectivity_test;
SET SESSION STORAGE_ENGINE=DEFAULT;

View File

@@ -36,12 +36,12 @@ test.t2 analyze status OK
# The following two must have the same in 'Extra' column: # The following two must have the same in 'Extra' column:
explain extended select * from t2 where col1 IN (20, 180); explain extended select * from t2 where col1 IN (20, 180);
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.00 Using where
Warnings: Warnings:
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (20,180) Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (20,180)
explain extended select * from t2 where col1 IN (180, 20); explain extended select * from t2 where col1 IN (180, 20);
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.35 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 1100 1.00 Using where
Warnings: Warnings:
Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (180,20) Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` in (180,20)
drop table t1, t2; drop table t1, t2;
@@ -102,7 +102,7 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK test.t1 analyze status OK
explain extended select * from t1 where col1 in (1,2,3); explain extended select * from t1 where col1 in (1,2,3);
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 3.37 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 10000 2.97 Using where
Warnings: Warnings:
Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (1,2,3) Note 1003 select `test`.`t1`.`col1` AS `col1` from `test`.`t1` where `test`.`t1`.`col1` in (1,2,3)
# Must not cause fp division by zero, or produce nonsense numbers: # Must not cause fp division by zero, or produce nonsense numbers:
@@ -334,6 +334,29 @@ a b c d e
set join_cache_level=@tmp_jcl; set join_cache_level=@tmp_jcl;
drop table t1,t2; drop table t1,t2;
# #
# MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on
#
CREATE TABLE t1 (a VARCHAR(255));
INSERT INTO t1 VALUES ('u'),('uu');
CREATE TABLE t2 (b VARCHAR(255)) CHARACTER SET utf8mb4;
INSERT INTO t2 VALUES ('x'),('xx');
CREATE TABLE t3 (c VARCHAR(255));
INSERT INTO t3 VALUES ('z'),('zz');
ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
set @tmp1=@@optimizer_switch, @tmp2=@@join_cache_level;
set optimizer_switch='hash_join_cardinality=on', join_cache_level=3;
SELECT t1.* FROM t1 JOIN (SELECT DISTINCT b FROM t2 JOIN t3) sq ON sq.b = t1.a;
a
set optimizer_switch=@tmp1, join_cache_level=@tmp2;
DROP TABLE t1, t2, t3;
#
# End of the test file # End of the test file
# #
set use_stat_tables= @save_use_stat_tables; set use_stat_tables= @save_use_stat_tables;

View File

@@ -271,6 +271,27 @@ SELECT * FROM t1 JOIN t2 ON t1.a = t2.c WHERE t2.b IN ('o') OR t2.e >= 'f' OR t2
set join_cache_level=@tmp_jcl; set join_cache_level=@tmp_jcl;
drop table t1,t2; drop table t1,t2;
--echo #
--echo # MDEV-31199: Assertion `field->table->stats_is_read' fails with hash_join_cardinality=on
--echo #
CREATE TABLE t1 (a VARCHAR(255));
INSERT INTO t1 VALUES ('u'),('uu');
CREATE TABLE t2 (b VARCHAR(255)) CHARACTER SET utf8mb4;
INSERT INTO t2 VALUES ('x'),('xx');
CREATE TABLE t3 (c VARCHAR(255));
INSERT INTO t3 VALUES ('z'),('zz');
ANALYZE TABLE t1, t2, t3 PERSISTENT FOR ALL; # Optional, fails either way
set @tmp1=@@optimizer_switch, @tmp2=@@join_cache_level;
set optimizer_switch='hash_join_cardinality=on', join_cache_level=3;
SELECT t1.* FROM t1 JOIN (SELECT DISTINCT b FROM t2 JOIN t3) sq ON sq.b = t1.a;
set optimizer_switch=@tmp1, join_cache_level=@tmp2;
DROP TABLE t1, t2, t3;
--echo # --echo #
--echo # End of the test file --echo # End of the test file
--echo # --echo #
@@ -279,4 +300,3 @@ set use_stat_tables= @save_use_stat_tables;
set histogram_type=@save_histogram_type; set histogram_type=@save_histogram_type;
set histogram_size=@save_histogram_size; set histogram_size=@save_histogram_size;
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;

View File

@@ -0,0 +1,95 @@
drop table if exists t0,t1,t2,t3;
select @@global.use_stat_tables;
@@global.use_stat_tables
COMPLEMENTARY
select @@session.use_stat_tables;
@@session.use_stat_tables
COMPLEMENTARY
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set @save_histogram_size=@@histogram_size;
set @save_histogram_type=@@histogram_type;
set join_cache_level=2;
set @@global.histogram_size=0,@@local.histogram_size=0;
set histogram_type='single_prec_hb';
set optimizer_use_condition_selectivity=3;
#
# MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
#
create table t0(a int);
insert into t0 select 1 from seq_1_to_78;
create table t1(a int);
insert into t1 select 1 from seq_1_to_26;
create table t10 (a int);
insert into t10 select 0 from t0, seq_1_to_4;
insert into t10 select 8693 from t1;
insert into t10 select 8694 from t1;
insert into t10 select 8695 from t1;
insert into t10 select 34783 from t1;
insert into t10 select 34784 from t1;
insert into t10 select 34785 from t1;
insert into t10 select 34785 from t0, seq_1_to_8;
insert into t10 select 65214 from t1;
insert into t10 select 65215 from t1;
insert into t10 select 65216 from t1;
insert into t10 select 65216 from t0, seq_1_to_52;
insert into t10 select 65217 from t1;
insert into t10 select 65218 from t1;
insert into t10 select 65219 from t1;
insert into t10 select 65219 from t0;
insert into t10 select 73913 from t1;
insert into t10 select 73914 from t1;
insert into t10 select 73915 from t1;
insert into t10 select 73915 from t0, seq_1_to_40;
insert into t10 select 78257 from t1;
insert into t10 select 78258 from t1;
insert into t10 select 78259 from t1;
insert into t10 select 91300 from t1;
insert into t10 select 91301 from t1;
insert into t10 select 91302 from t1;
insert into t10 select 91302 from t0, seq_1_to_6;
insert into t10 select 91303 from t1;
insert into t10 select 91304 from t1;
insert into t10 select 91305 from t1;
insert into t10 select 91305 from t0, seq_1_to_8;
insert into t10 select 99998 from t1;
insert into t10 select 99999 from t1;
insert into t10 select 100000 from t1;
set use_stat_tables=preferably;
analyze table t10 persistent for all;
Table Op Msg_type Msg_text
test.t10 analyze status Engine-independent statistics collected
test.t10 analyze status OK
flush tables;
set @tmp=@@optimizer_trace;
set optimizer_trace=1;
explain select * from t10 where a in (91303);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t10 ALL NULL NULL NULL NULL 9984 Using where
# Must have selectivity_from_histogram <= 1.0:
select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel
from information_schema.optimizer_trace;
sel
[
[
{
"column_name": "a",
"ranges":
["91303 <= a <= 91303"],
"selectivity_from_histogram": 0.035714283
}
]
]
set optimizer_trace=@tmp;
drop table t0,t1,t10;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables;
#
# End of 10.4 tests
#
#
# Clean up
#
set @@global.histogram_size=@save_histogram_size;

View File

@@ -0,0 +1,121 @@
--source include/no_valgrind_without_big.inc
--source include/have_stat_tables.inc
--source include/have_sequence.inc
--source include/default_charset.inc
--source include/not_embedded.inc
--disable_warnings
drop table if exists t0,t1,t2,t3;
--enable_warnings
select @@global.use_stat_tables;
select @@session.use_stat_tables;
set @save_use_stat_tables=@@use_stat_tables;
set use_stat_tables='preferably';
--source include/default_optimizer_switch.inc
set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity;
set @save_histogram_size=@@histogram_size;
set @save_histogram_type=@@histogram_type;
set join_cache_level=2;
set @@global.histogram_size=0,@@local.histogram_size=0;
set histogram_type='single_prec_hb';
# check that statistics on nulls is used
set optimizer_use_condition_selectivity=3;
--echo #
--echo # MDEV-31067: selectivity_from_histogram >1.0 for a DOUBLE_PREC_HB histogram
--echo #
create table t0(a int); # This holds how many rows we hold in a bucket.
insert into t0 select 1 from seq_1_to_78;
create table t1(a int); # one-third of a bucket
insert into t1 select 1 from seq_1_to_26;
create table t10 (a int);
insert into t10 select 0 from t0, seq_1_to_4;
insert into t10 select 8693 from t1;
insert into t10 select 8694 from t1;
insert into t10 select 8695 from t1;
insert into t10 select 34783 from t1;
insert into t10 select 34784 from t1;
insert into t10 select 34785 from t1;
insert into t10 select 34785 from t0, seq_1_to_8;
insert into t10 select 65214 from t1;
insert into t10 select 65215 from t1;
insert into t10 select 65216 from t1;
insert into t10 select 65216 from t0, seq_1_to_52;
insert into t10 select 65217 from t1;
insert into t10 select 65218 from t1;
insert into t10 select 65219 from t1;
insert into t10 select 65219 from t0;
insert into t10 select 73913 from t1;
insert into t10 select 73914 from t1;
insert into t10 select 73915 from t1;
insert into t10 select 73915 from t0, seq_1_to_40;
insert into t10 select 78257 from t1;
insert into t10 select 78258 from t1;
insert into t10 select 78259 from t1;
insert into t10 select 91300 from t1;
insert into t10 select 91301 from t1;
insert into t10 select 91302 from t1;
insert into t10 select 91302 from t0, seq_1_to_6;
insert into t10 select 91303 from t1; # Only 1/3rd of bucket matches the search tuple
insert into t10 select 91304 from t1;
insert into t10 select 91305 from t1;
insert into t10 select 91305 from t0, seq_1_to_8;
insert into t10 select 99998 from t1;
insert into t10 select 99999 from t1;
insert into t10 select 100000 from t1;
set use_stat_tables=preferably;
analyze table t10 persistent for all;
flush tables;
set @tmp=@@optimizer_trace;
set optimizer_trace=1;
explain select * from t10 where a in (91303);
--echo # Must have selectivity_from_histogram <= 1.0:
select json_detailed(json_extract(trace, '$**.selectivity_for_columns')) as sel
from information_schema.optimizer_trace;
set optimizer_trace=@tmp;
drop table t0,t1,t10;
set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set histogram_size=@save_histogram_size;
set use_stat_tables= @save_use_stat_tables;
--echo #
--echo # End of 10.4 tests
--echo #
--echo #
--echo # Clean up
--echo #
--source include/restore_charset.inc
set @@global.histogram_size=@save_histogram_size;

View File

@@ -780,7 +780,13 @@ eval $query;
let $query= let $query=
SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0); SELECT pk FROM t1 WHERE (b, i) IN (SELECT b, i FROM t2 WHERE pk > 0);
#set optimizer_trace=1;
#select @@optimizer_switch;
#select @@join_cache_level;
#select @@optimizer_use_condition_selectivity;
eval EXPLAIN EXTENDED $query; eval EXPLAIN EXTENDED $query;
#select * from information_schema.optimizer_trace;
eval $query; eval $query;
let $query= let $query=

View File

@@ -6959,6 +6959,24 @@ create algorithm=merge view v as
select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3); select * from t1 left join t2 on t1.a=t2.b and t1.a in (select d from t3);
ERROR 42S22: Unknown column 'd' in 'field list' ERROR 42S22: Unknown column 'd' in 'field list'
drop table t1,t2,t3; drop table t1,t2,t3;
#
# MDEV-31189: Server crash or assertion failure in upon 2nd
# execution of PS with views and HAVING
#
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2);
CREATE VIEW v1 AS SELECT 1 AS a;
CREATE VIEW v2 AS SELECT a FROM v1;
PREPARE stmt FROM "SELECT * FROM v2 HAVING 1 IN (SELECT f FROM t)";
EXECUTE stmt;
a
1
EXECUTE stmt;
a
1
DROP VIEW v1;
DROP VIEW v2;
DROP TABLE t;
# End of 10.4 tests # End of 10.4 tests
# #
# MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct # MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct

View File

@@ -6704,6 +6704,25 @@ create algorithm=merge view v as
drop table t1,t2,t3; drop table t1,t2,t3;
--echo #
--echo # MDEV-31189: Server crash or assertion failure in upon 2nd
--echo # execution of PS with views and HAVING
--echo #
CREATE TABLE t (f INT);
INSERT INTO t VALUES (1),(2); # Optional, fails either way
CREATE VIEW v1 AS SELECT 1 AS a;
CREATE VIEW v2 AS SELECT a FROM v1;
PREPARE stmt FROM "SELECT * FROM v2 HAVING 1 IN (SELECT f FROM t)";
EXECUTE stmt;
EXECUTE stmt;
# Cleanup
DROP VIEW v1;
DROP VIEW v2;
DROP TABLE t;
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #

Binary file not shown.

View File

@@ -0,0 +1,23 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY (10), c3 DATETIME);
SELECT get_lock ('test2', 0);
get_lock ('test2', 0)
1
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
SET SESSION wsrep_trx_fragment_size=10;
SET SESSION autocommit=0;
SELECT * FROM t1 WHERE c1 <=0 ORDER BY c1 DESC;
c1
INSERT INTO t1 VALUES (4),(3),(1),(2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE;
ERROR 42S01: Table 't1' already exists
ALTER TABLE t1 DROP COLUMN c2;
ERROR 42000: Can't DROP COLUMN `c2`; check that it exists
SELECT get_lock ('test', 1.5);
get_lock ('test', 1.5)
1
DROP TABLE t1;

View File

@@ -0,0 +1,18 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection node_2a;
SELECT GET_LOCK("foo", 1000);
GET_LOCK("foo", 1000)
1
connection node_2;
SET AUTOCOMMIT=OFF;
INSERT INTO t1 VALUES (1);
SELECT GET_LOCK("foo", 1000);;
connection node_1;
INSERT INTO t1 VALUES (1);
connection node_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_aborts_increment
1
DROP TABLE t1;

View File

@@ -1,24 +0,0 @@
connection node_2;
connection node_1;
CREATE TABLE t (c DOUBLE,c2 INT,PRIMARY KEY(c)) ENGINE=InnoDB;
INSERT INTO t values (1,1);
SELECT GET_LOCK('a',1);
ERROR 42000: This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)'
SHOW WARNINGS;
Level Code Message
Error 1235 This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)'
SELECT * FROM t;
c c2
1 1
SELECT RELEASE_LOCK('a');
ERROR 42000: This version of MariaDB doesn't yet support 'RELEASE_LOCK in cluster (WSREP_ON=ON)'
SHOW WARNINGS;
Level Code Message
Error 1235 This version of MariaDB doesn't yet support 'RELEASE_LOCK in cluster (WSREP_ON=ON)'
SELECT RELEASE_ALL_LOCKS();
ERROR 42000: This version of MariaDB doesn't yet support 'RELEASE_ALL_LOCKS in cluster (WSREP_ON=ON)'
SHOW WARNINGS;
Level Code Message
Error 1235 This version of MariaDB doesn't yet support 'RELEASE_ALL_LOCKS in cluster (WSREP_ON=ON)'
COMMIT;
DROP TABLE t;

View File

@@ -8,6 +8,8 @@ connection node_4;
call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node."); call mtr.add_suppression("WSREP: Ignoring server id for non bootstrap node.");
connection node_3; connection node_3;
CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;; CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;;
Warnings:
Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
START SLAVE; START SLAVE;
include/wait_for_slave_to_start.inc include/wait_for_slave_to_start.inc
connection node_1; connection node_1;
@@ -110,6 +112,8 @@ connection node_3;
connection node_3; connection node_3;
STOP SLAVE; STOP SLAVE;
RESET SLAVE ALL; RESET SLAVE ALL;
Warnings:
Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
connection node_1; connection node_1;
SET SESSION WSREP_ON=OFF; SET SESSION WSREP_ON=OFF;
RESET MASTER; RESET MASTER;

View File

@@ -20,17 +20,25 @@ DROP TABLE t1;
connection node_1; connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1; SET SESSION wsrep_retry_autocommit = 1;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
INSERT INTO t1 (f1) VALUES (3); INSERT INTO t1 (f1) VALUES (3);
connection node_1a; connection node_1a;
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
connection node_2; connection node_2;
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
connection node_1; connection node_1a;
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)
0 0
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
SET DEBUG_SYNC = 'RESET'; SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1; DROP TABLE t1;
connection node_1; connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
@@ -64,6 +72,8 @@ SET SESSION wsrep_retry_autocommit = 64;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64'; SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64';
INSERT INTO t1 VALUES (5); INSERT INTO t1 VALUES (5);
connection node_2;
connection node_1;
connection node_1; connection node_1;
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
COUNT(*) COUNT(*)

View File

@@ -0,0 +1,20 @@
--source include/galera_cluster.inc
--source include/have_sequence.inc
CREATE TABLE t1 (c1 BIGINT NOT NULL PRIMARY KEY, c2 BINARY (10), c3 DATETIME);
SELECT get_lock ('test2', 0);
DROP TABLE t1;
CREATE TABLE t1 (c1 SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
SET SESSION wsrep_trx_fragment_size=10;
SET SESSION autocommit=0;
SELECT * FROM t1 WHERE c1 <=0 ORDER BY c1 DESC;
--error ER_LOCK_DEADLOCK
INSERT INTO t1 VALUES (4),(3),(1),(2);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE t1 DROP COLUMN c2;
SELECT get_lock ('test', 1.5);
DROP TABLE t1;

View File

@@ -0,0 +1,36 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
#
# Test a local transaction being aborted by a slave one while it is running a GET_LOCK()
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
--let $galera_connection_name = node_2a
--let $galera_server_number = 2
--source include/galera_connect.inc
--connection node_2a
SELECT GET_LOCK("foo", 1000);
--connection node_2
SET AUTOCOMMIT=OFF;
--let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
INSERT INTO t1 VALUES (1);
--send SELECT GET_LOCK("foo", 1000);
--connection node_1
INSERT INTO t1 VALUES (1);
--connection node_2
--error ER_LOCK_DEADLOCK
--reap
--let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'`
# Check that wsrep_local_bf_aborts has been incremented by exactly 1
--disable_query_log
--eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment;
--enable_query_log
DROP TABLE t1;

View File

@@ -1,18 +0,0 @@
--source include/galera_cluster.inc
CREATE TABLE t (c DOUBLE,c2 INT,PRIMARY KEY(c)) ENGINE=InnoDB;
INSERT INTO t values (1,1);
--error ER_NOT_SUPPORTED_YET
SELECT GET_LOCK('a',1);
SHOW WARNINGS;
SELECT * FROM t;
--error ER_NOT_SUPPORTED_YET
SELECT RELEASE_LOCK('a');
SHOW WARNINGS;
# New in 10.5
--error ER_NOT_SUPPORTED_YET
SELECT RELEASE_ALL_LOCKS();
SHOW WARNINGS;
COMMIT;
DROP TABLE t;

View File

@@ -25,6 +25,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2 --connection node_2
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
--source include/wait_condition.inc
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
--connection node_1 --connection node_1
@@ -44,6 +46,7 @@ DROP TABLE t1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 1; SET SESSION wsrep_retry_autocommit = 1;
SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit';
SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue'; SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue';
--send INSERT INTO t1 (f1) VALUES (3) --send INSERT INTO t1 (f1) VALUES (3)
@@ -51,14 +54,21 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2 --connection node_2
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
--source include/wait_condition.inc
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
--connection node_1a
SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached';
SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue';
--connection node_1 --connection node_1
--error 0,ER_LOCK_DEADLOCK
--reap --reap
SELECT COUNT(*) FROM t1; SELECT COUNT(*) FROM t1;
SET DEBUG_SYNC = 'RESET'; SET DEBUG_SYNC = 'RESET';
SET GLOBAL debug_dbug = NULL;
DROP TABLE t1; DROP TABLE t1;
@@ -79,6 +89,8 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; SET DEBUG_SYNC = 'now WAIT_FOR before_cert';
--connection node_2 --connection node_2
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
--source include/wait_condition.inc
TRUNCATE TABLE t1; TRUNCATE TABLE t1;
--connection node_1a --connection node_1a
@@ -114,6 +126,11 @@ SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continu
--send INSERT INTO t1 VALUES (5) --send INSERT INTO t1 VALUES (5)
--connection node_2
--let $wait_condition = SELECT count(*)=1 FROM information_schema.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='t1'
--source include/wait_condition.inc
--connection node_1
--disable_query_log --disable_query_log
--disable_result_log --disable_result_log
--let $count = 64 --let $count = 64

View File

@@ -0,0 +1,15 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES(1);
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
INSERT INTO t1 VALUES(2);
ERROR HY000: Error while appending streaming replication fragment
COMMIT;
SELECT * FROM t1;
f1
SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
DROP TABLE t1;
CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");

View File

@@ -0,0 +1,18 @@
#
# MDEV-30838 - Assertion `m_thd == _current_thd()' failed in
# virtual int Wsrep_client_service::bf_rollback()
#
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES(1);
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
--error ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES(2);
COMMIT;
SELECT * FROM t1;
SET debug_dbug='-d,ib_create_table_fail_too_many_trx';
DROP TABLE t1;
CALL mtr.add_suppression("Error writing into mysql.wsrep_streaming_log: 177");

View File

@@ -1,10 +1,9 @@
set global innodb_monitor_disable = All;
select name, if(enabled,'enabled','disabled') status select name, if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics; from information_schema.innodb_metrics;
name status name status
metadata_table_handles_opened disabled metadata_table_handles_opened disabled
lock_deadlocks disabled lock_deadlocks enabled
lock_timeouts disabled lock_timeouts enabled
lock_rec_lock_waits disabled lock_rec_lock_waits disabled
lock_table_lock_waits disabled lock_table_lock_waits disabled
lock_rec_lock_requests disabled lock_rec_lock_requests disabled
@@ -14,30 +13,30 @@ lock_rec_locks disabled
lock_table_lock_created disabled lock_table_lock_created disabled
lock_table_lock_removed disabled lock_table_lock_removed disabled
lock_table_locks disabled lock_table_locks disabled
lock_row_lock_current_waits disabled lock_row_lock_current_waits enabled
lock_row_lock_time disabled lock_row_lock_time enabled
lock_row_lock_time_max disabled lock_row_lock_time_max enabled
lock_row_lock_waits disabled lock_row_lock_waits enabled
lock_row_lock_time_avg disabled lock_row_lock_time_avg enabled
buffer_pool_size disabled buffer_pool_size enabled
buffer_pool_reads disabled buffer_pool_reads enabled
buffer_pool_read_requests disabled buffer_pool_read_requests enabled
buffer_pool_write_requests disabled buffer_pool_write_requests enabled
buffer_pool_wait_free disabled buffer_pool_wait_free enabled
buffer_pool_read_ahead disabled buffer_pool_read_ahead enabled
buffer_pool_read_ahead_evicted disabled buffer_pool_read_ahead_evicted enabled
buffer_pool_pages_total disabled buffer_pool_pages_total enabled
buffer_pool_pages_misc disabled buffer_pool_pages_misc enabled
buffer_pool_pages_data disabled buffer_pool_pages_data enabled
buffer_pool_bytes_data disabled buffer_pool_bytes_data enabled
buffer_pool_pages_dirty disabled buffer_pool_pages_dirty enabled
buffer_pool_bytes_dirty disabled buffer_pool_bytes_dirty enabled
buffer_pool_pages_free disabled buffer_pool_pages_free enabled
buffer_pages_created disabled buffer_pages_created enabled
buffer_pages_written disabled buffer_pages_written enabled
buffer_pages_read disabled buffer_pages_read enabled
buffer_data_reads disabled buffer_data_reads enabled
buffer_data_written disabled buffer_data_written enabled
buffer_flush_batch_scanned disabled buffer_flush_batch_scanned disabled
buffer_flush_batch_num_scan disabled buffer_flush_batch_num_scan disabled
buffer_flush_batch_scanned_per_call disabled buffer_flush_batch_scanned_per_call disabled
@@ -70,8 +69,8 @@ buffer_flush_background_pages disabled
buffer_LRU_batch_scanned disabled buffer_LRU_batch_scanned disabled
buffer_LRU_batch_num_scan disabled buffer_LRU_batch_num_scan disabled
buffer_LRU_batch_scanned_per_call disabled buffer_LRU_batch_scanned_per_call disabled
buffer_LRU_batch_flush_total_pages disabled buffer_LRU_batch_flush_total_pages enabled
buffer_LRU_batch_evict_total_pages disabled buffer_LRU_batch_evict_total_pages enabled
buffer_LRU_single_flush_failure_count disabled buffer_LRU_single_flush_failure_count disabled
buffer_LRU_get_free_search disabled buffer_LRU_get_free_search disabled
buffer_LRU_search_scanned disabled buffer_LRU_search_scanned disabled
@@ -104,21 +103,21 @@ buffer_page_written_blob disabled
buffer_page_written_zblob disabled buffer_page_written_zblob disabled
buffer_page_written_zblob2 disabled buffer_page_written_zblob2 disabled
buffer_page_written_other disabled buffer_page_written_other disabled
os_data_reads disabled os_data_reads enabled
os_data_writes disabled os_data_writes enabled
os_data_fsyncs disabled os_data_fsyncs enabled
os_pending_reads disabled os_pending_reads enabled
os_pending_writes disabled os_pending_writes enabled
os_log_bytes_written disabled os_log_bytes_written enabled
trx_rw_commits disabled trx_rw_commits disabled
trx_ro_commits disabled trx_ro_commits disabled
trx_nl_ro_commits disabled trx_nl_ro_commits disabled
trx_commits_insert_update disabled trx_commits_insert_update disabled
trx_rollbacks disabled trx_rollbacks disabled
trx_rollbacks_savepoint disabled trx_rollbacks_savepoint disabled
trx_rseg_history_len disabled trx_rseg_history_len enabled
trx_undo_slots_used disabled trx_undo_slots_used disabled
trx_undo_slots_cached disabled trx_undo_slots_cached enabled
trx_rseg_current_size disabled trx_rseg_current_size disabled
purge_del_mark_records disabled purge_del_mark_records disabled
purge_upd_exist_or_extern_records disabled purge_upd_exist_or_extern_records disabled
@@ -134,9 +133,9 @@ log_lsn_current disabled
log_lsn_checkpoint_age disabled log_lsn_checkpoint_age disabled
log_lsn_buf_pool_oldest disabled log_lsn_buf_pool_oldest disabled
log_max_modified_age_async disabled log_max_modified_age_async disabled
log_waits disabled log_waits enabled
log_write_requests disabled log_write_requests enabled
log_writes disabled log_writes enabled
compress_pages_compressed disabled compress_pages_compressed disabled
compress_pages_decompressed disabled compress_pages_decompressed disabled
compression_pad_increments disabled compression_pad_increments disabled
@@ -154,26 +153,26 @@ index_page_merge_successful disabled
index_page_reorg_attempts disabled index_page_reorg_attempts disabled
index_page_reorg_successful disabled index_page_reorg_successful disabled
index_page_discards disabled index_page_discards disabled
adaptive_hash_searches disabled adaptive_hash_searches enabled
adaptive_hash_searches_btree disabled adaptive_hash_searches_btree enabled
adaptive_hash_pages_added disabled adaptive_hash_pages_added disabled
adaptive_hash_pages_removed disabled adaptive_hash_pages_removed disabled
adaptive_hash_rows_added disabled adaptive_hash_rows_added disabled
adaptive_hash_rows_removed disabled adaptive_hash_rows_removed disabled
adaptive_hash_rows_deleted_no_hash_entry disabled adaptive_hash_rows_deleted_no_hash_entry disabled
adaptive_hash_rows_updated disabled adaptive_hash_rows_updated disabled
file_num_open_files disabled file_num_open_files enabled
innodb_master_thread_sleeps disabled innodb_master_thread_sleeps disabled
innodb_activity_count disabled innodb_activity_count enabled
innodb_master_active_loops disabled innodb_master_active_loops disabled
innodb_master_idle_loops disabled innodb_master_idle_loops disabled
innodb_log_flush_usec disabled innodb_log_flush_usec disabled
innodb_dict_lru_usec disabled innodb_dict_lru_usec disabled
innodb_dict_lru_count_active disabled innodb_dict_lru_count_active disabled
innodb_dict_lru_count_idle disabled innodb_dict_lru_count_idle disabled
innodb_dblwr_writes disabled innodb_dblwr_writes enabled
innodb_dblwr_pages_written disabled innodb_dblwr_pages_written enabled
innodb_page_size disabled innodb_page_size enabled
ddl_background_drop_indexes disabled ddl_background_drop_indexes disabled
ddl_online_create_index disabled ddl_online_create_index disabled
ddl_pending_alter_table disabled ddl_pending_alter_table disabled
@@ -183,6 +182,9 @@ icp_attempts disabled
icp_no_match disabled icp_no_match disabled
icp_out_of_range disabled icp_out_of_range disabled
icp_match disabled icp_match disabled
set global innodb_monitor_disable = All;
select name from information_schema.innodb_metrics where enabled;
name
set global innodb_monitor_enable = all; set global innodb_monitor_enable = all;
select name from information_schema.innodb_metrics where not enabled; select name from information_schema.innodb_metrics where not enabled;
name name

View File

@@ -5,12 +5,14 @@
# sys_vars.innodb_monitor_enable_basic # sys_vars.innodb_monitor_enable_basic
--source include/have_innodb.inc --source include/have_innodb.inc
set global innodb_monitor_disable = All;
# Test turn on/off the monitor counter with "all" option # Test turn on/off the monitor counter with "all" option
# By default, they will be off. # By default, they will be off.
select name, if(enabled,'enabled','disabled') status select name, if(enabled,'enabled','disabled') status
from information_schema.innodb_metrics; from information_schema.innodb_metrics;
set global innodb_monitor_disable = All;
select name from information_schema.innodb_metrics where enabled;
# Turn on all monitor counters # Turn on all monitor counters
set global innodb_monitor_enable = all; set global innodb_monitor_enable = all;

View File

@@ -615,4 +615,25 @@ SET GLOBAL innodb_compression_level=0;
INSERT INTO t1 VALUES (''); INSERT INTO t1 VALUES ('');
SET GLOBAL innodb_compression_level= @save_innodb_compression_level; SET GLOBAL innodb_compression_level= @save_innodb_compression_level;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-31158 Assertion ...MTR_MEMO_X_LOCKED in btr_attach_half_pages()
#
SET @save_compression_level=@@GLOBAL.innodb_compression_level;
SET GLOBAL innodb_compression_level=0;
CREATE TEMPORARY TABLE t(a SERIAL, prefix VARBINARY(4), pad INT);
INSERT INTO t(prefix, pad) VALUES
(_binary 0xff,160),('',19),(_binary 0x0001,253),(_binary 0x0b11,169),
(_binary 0x0b010001,23),(_binary 0x0b100001,251),(_binary 0x0d,163),
(_binary 0xb3,254),(_binary 0x96,254),(_binary 0xeb,61),
(_binary 0xf231,253),(_binary 0x1db0,253),(_binary 0x0005,101),
(_binary 0x6370,253),(_binary 0x0b12,112),(_binary 0x0b010002,23),
(_binary 0x0b100002,80),(_binary 0x181984,163),(_binary 0x181926,168),
(_binary 0xe1,176),(_binary 0xe2,187),(_binary 0xe6,254),(_binary 0xbb,51),
(_binary 0x1c,248),(_binary 0x8a,94),(_binary 0x14,254);
CREATE TABLE u(a SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
b VARBINARY(255), KEY(b)) ENGINE=InnoDB
KEY_BLOCK_SIZE=1 ROW_FORMAT=COMPRESSED;
INSERT INTO u SELECT a,CONCAT(prefix,REPEAT(chr(0),pad)) FROM t;
DROP TABLE u, t;
SET GLOBAL innodb_compression_level=@save_compression_level;
# End of 10.6 tests # End of 10.6 tests

View File

@@ -860,4 +860,28 @@ INSERT INTO t1 VALUES ('');
SET GLOBAL innodb_compression_level= @save_innodb_compression_level; SET GLOBAL innodb_compression_level= @save_innodb_compression_level;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-31158 Assertion ...MTR_MEMO_X_LOCKED in btr_attach_half_pages()
--echo #
--source include/have_innodb.inc
SET @save_compression_level=@@GLOBAL.innodb_compression_level;
SET GLOBAL innodb_compression_level=0;
CREATE TEMPORARY TABLE t(a SERIAL, prefix VARBINARY(4), pad INT);
INSERT INTO t(prefix, pad) VALUES
(_binary 0xff,160),('',19),(_binary 0x0001,253),(_binary 0x0b11,169),
(_binary 0x0b010001,23),(_binary 0x0b100001,251),(_binary 0x0d,163),
(_binary 0xb3,254),(_binary 0x96,254),(_binary 0xeb,61),
(_binary 0xf231,253),(_binary 0x1db0,253),(_binary 0x0005,101),
(_binary 0x6370,253),(_binary 0x0b12,112),(_binary 0x0b010002,23),
(_binary 0x0b100002,80),(_binary 0x181984,163),(_binary 0x181926,168),
(_binary 0xe1,176),(_binary 0xe2,187),(_binary 0xe6,254),(_binary 0xbb,51),
(_binary 0x1c,248),(_binary 0x8a,94),(_binary 0x14,254);
CREATE TABLE u(a SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT,
b VARBINARY(255), KEY(b)) ENGINE=InnoDB
KEY_BLOCK_SIZE=1 ROW_FORMAT=COMPRESSED;
INSERT INTO u SELECT a,CONCAT(prefix,REPEAT(chr(0),pad)) FROM t;
DROP TABLE u, t;
SET GLOBAL innodb_compression_level=@save_compression_level;
--echo # End of 10.6 tests --echo # End of 10.6 tests

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 333a53e537d74bf74dd28c78ad5b23dd EXPLAIN SELECT * FROM `test` . `v1` 1 test 78b80220002834f612d11b0663f64d59 EXPLAIN SELECT * FROM `test` . `v1` 1
test 1fb578da66e6583bae8e64061486f1b1 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1 test 9649c572f7c7b927e314d31620294e34 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test 923bca939a55826e231e1335016ba418 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1 test 304c0393779f7b183065e7b577f1be26 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test 6fa6d75432fd499d1c7d6f964c8310a2 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1 test 6e400ce1796d40cfefa45333d6e5895c EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 1
test 3421da1ec8ecb8cac97e12a0609f73cb EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1 test 36c8726233a5c621742d35107d72e5e0 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 1
test c2f68fd41bfbf3acd52eb5e7306b0c00 SELECT * FROM `test` . `v1` 1 test 0aeb23572eed79a9e05cafe0e9cd1909 SELECT * FROM `test` . `v1` 1
test dd68812cbe4c1ed5a38921222981f8c5 SELECT * FROM `test` . `v1` WHERE `a` = ? 1 test 28bd92caf5c189316fab14a67b622203 SELECT * FROM `test` . `v1` WHERE `a` = ? 1
test 7563bcc32c6d0d872c8d9f0bf7717e6a SELECT * FROM `test` . `v1` WHERE `b` > ? 1 test 637dba52704594bc4275ba3f37b8f851 SELECT * FROM `test` . `v1` WHERE `b` > ? 1
test 0817c53833dc6adbca581e8fe4c598c7 SELECT `a` , `b` FROM `test` . `v1` 1 test fd8e83e523b0eec97a94eef612154591 SELECT `a` , `b` FROM `test` . `v1` 1
test a5f13903c70812ae08fa8c084e9cd503 SELECT `b` , `a` FROM `test` . `v1` 1 test c58ed156113959965ebf619b6dd3a8b2 SELECT `b` , `a` FROM `test` . `v1` 1
test 66b14a14f2a42e1335dd28dfad8ea084 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 test 4d9d22440ce86533e3fac764ab259bbd 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 98531b331031b84ddfbb2de8b601a704 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1 test 4ccb56972e9c19941d4928d31502e796 CREATE VIEW `test` . `v1` AS SELECT * FROM `test` . `t1` 1
test 5352d7d117e97fecd312e354e9e290ce DROP TABLE `test` . `v1` 1 test a087be31e6440102676ef0171b8b2734 DROP TABLE `test` . `v1` 1
test 333a53e537d74bf74dd28c78ad5b23dd EXPLAIN SELECT * FROM `test` . `v1` 2 test 78b80220002834f612d11b0663f64d59 EXPLAIN SELECT * FROM `test` . `v1` 2
test 1fb578da66e6583bae8e64061486f1b1 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2 test 9649c572f7c7b927e314d31620294e34 EXPLAIN SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test 923bca939a55826e231e1335016ba418 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2 test 304c0393779f7b183065e7b577f1be26 EXPLAIN SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test 6fa6d75432fd499d1c7d6f964c8310a2 EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2 test 6e400ce1796d40cfefa45333d6e5895c EXPLAIN SELECT `a` , `b` FROM `test` . `v1` 2
test 3421da1ec8ecb8cac97e12a0609f73cb EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2 test 36c8726233a5c621742d35107d72e5e0 EXPLAIN SELECT `b` , `a` FROM `test` . `v1` 2
test c2f68fd41bfbf3acd52eb5e7306b0c00 SELECT * FROM `test` . `v1` 2 test 0aeb23572eed79a9e05cafe0e9cd1909 SELECT * FROM `test` . `v1` 2
test dd68812cbe4c1ed5a38921222981f8c5 SELECT * FROM `test` . `v1` WHERE `a` = ? 2 test 28bd92caf5c189316fab14a67b622203 SELECT * FROM `test` . `v1` WHERE `a` = ? 2
test 7563bcc32c6d0d872c8d9f0bf7717e6a SELECT * FROM `test` . `v1` WHERE `b` > ? 2 test 637dba52704594bc4275ba3f37b8f851 SELECT * FROM `test` . `v1` WHERE `b` > ? 2
test 21c19dd7ef5b894f3e32d0585cb3007f SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1 test 765bf27a2d45249dcc6377bcc02e1c4b SELECT SCHEMA_NAME , `DIGEST` , `DIGEST_TEXT` , `COUNT_STAR` FROM `performance_schema` . `events_statements_summary_by_digest` ORDER BY `DIGEST_TEXT` 1
test 0817c53833dc6adbca581e8fe4c598c7 SELECT `a` , `b` FROM `test` . `v1` 2 test fd8e83e523b0eec97a94eef612154591 SELECT `a` , `b` FROM `test` . `v1` 2
test a5f13903c70812ae08fa8c084e9cd503 SELECT `b` , `a` FROM `test` . `v1` 2 test c58ed156113959965ebf619b6dd3a8b2 SELECT `b` , `a` FROM `test` . `v1` 2
test 66b14a14f2a42e1335dd28dfad8ea084 TRUNCATE TABLE `performance_schema` . `events_statements_summary_by_digest` 1 test 4d9d22440ce86533e3fac764ab259bbd 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 96a6bb95edaf100857f09c968aca354b SELECT ? + ? + SELECT ... statement/sql/select be5dd6a08f2e34c86168c154f61cbf8c SELECT ? + ? + SELECT ...
statement/sql/truncate c1d647bb870f2c63c22a16707bb8aee3 TRUNCATE TABLE truncat... statement/sql/truncate e2b84d4b47baf073fa24b65f724e9431 TRUNCATE TABLE truncat...

View File

@@ -0,0 +1,85 @@
include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
# MDEV-29621 the sequence engine binlog_row_image-full events
# MDL-deadlock on the parallel slave.
connection master;
CREATE SEQUENCE s1;
SET @@session.binlog_row_image=FULL;
SET @@session.debug_dbug="+d,binlog_force_commit_id";
SET @commit_id=7;
SET @@gtid_seq_no=100;
SELECT NEXT VALUE FOR s1;
NEXT VALUE FOR s1
1
INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0);
SET @@session.debug_dbug="";
connection slave;
SET @@global.slave_parallel_threads=2;
SET @@global.slave_parallel_mode=optimistic;
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
include/start_slave.inc
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
connection master;
DROP SEQUENCE s1;
connection slave;
include/stop_slave.inc
# Simulate buggy 10.3.36 master to prove the parallel applier
# does not deadlock now at replaying the above master load.
connection master;
include/rpl_stop_server.inc [server_number=1]
include/rpl_start_server.inc [server_number=1]
connection slave;
RESET MASTER;
SET @@global.gtid_slave_pos="";
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos;
START SLAVE UNTIL MASTER_GTID_POS='0-1-102';
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
# Normal stop is expected
include/wait_for_slave_to_stop.inc
# MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order
# The test proves ALTER-SEQUENCE binlogs first before the following transaction does so.
connection slave;
include/stop_slave.inc
Warnings:
Note 1255 Slave already has been stopped
RESET MASTER;
SET @@global.gtid_slave_pos="";
SET @@global.gtid_strict_mode=1;
connection master;
RESET MASTER;
CREATE TABLE ti (a INT) ENGINE=innodb;
CREATE SEQUENCE s2 ENGINE=innodb;
SET @@gtid_seq_no=100;
ALTER SEQUENCE s2 restart with 1;
INSERT INTO ti SET a=1;
include/save_master_gtid.inc
SELECT @@global.gtid_binlog_state "Master gtid state";
Master gtid state
0-1-101
connection slave;
include/start_slave.inc
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both";
@@global.gtid_binlog_state no 100,101 yet in both
0-1-2 0-1-2
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
# Normal sync with master proves the fixes correct
include/sync_with_master_gtid.inc
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed";
@@global.gtid_binlog_state all through 101 have been committed
0-1-101 0-1-101
connection slave;
include/stop_slave.inc
SET debug_sync = RESET;
SET @@global.slave_parallel_threads= 0;
SET @@global.slave_parallel_mode= optimistic;
SET @@global.debug_dbug = "";
SET @@global.gtid_strict_mode=0;
include/start_slave.inc
connection master;
DROP SEQUENCE s2;
DROP TABLE ti;
connection slave;
include/rpl_end.inc

View File

@@ -17,10 +17,6 @@
# BUG#12133 master.index file keeps mysqld from starting if bin log has been moved # BUG#12133 master.index file keeps mysqld from starting if bin log has been moved
# BUG#42576 Relay logs in relay-log.info&localhost-relay-bin.index not processed after move # BUG#42576 Relay logs in relay-log.info&localhost-relay-bin.index not processed after move
source include/master-slave.inc;
# There is no need to run this test case on all binlog format
source include/have_binlog_format_row.inc;
# Since this test relies heavily on filesystem operations (like # Since this test relies heavily on filesystem operations (like
# moving files around, backslashes and so forth) we avoid messing # moving files around, backslashes and so forth) we avoid messing
# around with windows access violations for not cluttering the # around with windows access violations for not cluttering the
@@ -28,6 +24,10 @@ source include/have_binlog_format_row.inc;
# it is not 100% compliant. # it is not 100% compliant.
--source include/not_windows.inc --source include/not_windows.inc
source include/master-slave.inc;
# There is no need to run this test case on all binlog format
source include/have_binlog_format_row.inc;
connection master; connection master;
--let $master_datadir= `select @@datadir` --let $master_datadir= `select @@datadir`
connection slave; connection slave;

View File

@@ -2,10 +2,10 @@ if (`SELECT $PS_PROTOCOL != 0`)
{ {
--skip Test temporarily disabled for ps-protocol --skip Test temporarily disabled for ps-protocol
} }
--source include/no_valgrind_without_big.inc
--let $rpl_topology=1->2 --let $rpl_topology=1->2
--source include/rpl_init.inc --source include/rpl_init.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/no_valgrind_without_big.inc
--echo *** Test normal shutdown/restart of slave server configured as a GTID slave. *** --echo *** Test normal shutdown/restart of slave server configured as a GTID slave. ***

View File

@@ -15,8 +15,8 @@
# #
# (iii) master and slave tables do not differ # (iii) master and slave tables do not differ
# #
-- source include/master-slave.inc
-- source include/not_windows.inc -- source include/not_windows.inc
-- source include/master-slave.inc
SET SQL_LOG_BIN=0; SET SQL_LOG_BIN=0;
CREATE DATABASE B37656; CREATE DATABASE B37656;

View File

@@ -1,7 +1,7 @@
--source include/no_valgrind_without_big.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--let $rpl_topology=1->2 --let $rpl_topology=1->2
--source include/rpl_init.inc --source include/rpl_init.inc
--source include/no_valgrind_without_big.inc
--connection server_2 --connection server_2
call mtr.add_suppression("The automatically created table.*name may not be entirely in lowercase"); call mtr.add_suppression("The automatically created table.*name may not be entirely in lowercase");

View File

@@ -1,7 +1,7 @@
--source include/not_windows.inc #unix shell escaping used for mysqlbinlog
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_binlog_format_statement.inc --source include/have_binlog_format_statement.inc
--source include/master-slave.inc --source include/master-slave.inc
--source include/not_windows.inc #unix shell escaping used for mysqlbinlog
# MDEV-382: multiple SQL injections in replication code. # MDEV-382: multiple SQL injections in replication code.

View File

@@ -0,0 +1,131 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--connection slave
--source include/stop_slave.inc
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--echo # MDEV-29621 the sequence engine binlog_row_image-full events
--echo # MDL-deadlock on the parallel slave.
--connection master
CREATE SEQUENCE s1;
SET @@session.binlog_row_image=FULL;
SET @@session.debug_dbug="+d,binlog_force_commit_id";
SET @commit_id=7;
SET @@gtid_seq_no=100;
SELECT NEXT VALUE FOR s1;
INSERT INTO s1 VALUES(2, 1, 10, 1, 2, 1, 1, 0);
SET @@session.debug_dbug="";
--connection slave
--let $slave_parallel_threads=`select @@global.slave_parallel_threads`
--let $slave_parallel_mode=`select @@global.slave_parallel_mode`
SET @@global.slave_parallel_threads=2;
SET @@global.slave_parallel_mode=optimistic;
SET @@global.debug_dbug="+d,hold_worker_on_schedule";
--source include/start_slave.inc
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to start commit"
--source include/wait_condition.inc
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
--connection master
DROP SEQUENCE s1;
--sync_slave_with_master
--source include/stop_slave.inc
--echo # Simulate buggy 10.3.36 master to prove the parallel applier
--echo # does not deadlock now at replaying the above master load.
--connection master
--let $datadir= `SELECT @@datadir`
--let $rpl_server_number= 1
--source include/rpl_stop_server.inc
--remove_file $datadir/master-bin.000001
--copy_file $MYSQL_TEST_DIR/std_data/rpl/master-bin-seq_10.3.36.000001 $datadir/master-bin.000001
--let $rpl_server_number= 1
--source include/rpl_start_server.inc
--source include/wait_until_connected_again.inc
--save_master_pos
--connection slave
RESET MASTER;
SET @@global.gtid_slave_pos="";
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_use_gtid=slave_pos;
START SLAVE UNTIL MASTER_GTID_POS='0-1-102';
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit"
--source include/wait_condition.inc
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
--echo # Normal stop is expected
--source include/wait_for_slave_to_stop.inc
--echo # MDEV-31077 ALTER SEQUENCE may end up in optimistic parallel slave binlog out-of-order
--echo # The test proves ALTER-SEQUENCE binlogs first before the following transaction does so.
--connection slave
--source include/stop_slave.inc
RESET MASTER;
SET @@global.gtid_slave_pos="";
--let $slave_gtid_strict_mode=`select @@global.gtid_strict_mode`
SET @@global.gtid_strict_mode=1;
--connection master
RESET MASTER;
# Load from master
CREATE TABLE ti (a INT) ENGINE=innodb;
CREATE SEQUENCE s2 ENGINE=innodb;
SET @@gtid_seq_no=100;
ALTER SEQUENCE s2 restart with 1;
INSERT INTO ti SET a=1;
--source include/save_master_gtid.inc
SELECT @@global.gtid_binlog_state "Master gtid state";
--connection slave
--source include/start_slave.inc
--let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit"
--source include/wait_condition.inc
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "no 100,101 yet in both";
# DEBUG_DBUG extension point of hold_worker_on_schedule is reused
# (gets deployed) in Sql_cmd_alter_sequence::execute.
SET DEBUG_SYNC = 'now SIGNAL continue_worker';
--echo # Normal sync with master proves the fixes correct
--source include/sync_with_master_gtid.inc
SELECT @@global.gtid_binlog_state, @@global.gtid_slave_pos as "all through 101 have been committed";
#
# MDEV-29621/MDEV-31077 clean up.
#
--connection slave
--source include/stop_slave.inc
SET debug_sync = RESET;
--eval SET @@global.slave_parallel_threads= $slave_parallel_threads
--eval SET @@global.slave_parallel_mode= $slave_parallel_mode
SET @@global.debug_dbug = "";
--eval SET @@global.gtid_strict_mode=$slave_gtid_strict_mode
--source include/start_slave.inc
--connection master
DROP SEQUENCE s2;
DROP TABLE ti;
--sync_slave_with_master
--source include/rpl_end.inc

View File

@@ -3,10 +3,10 @@
# For details look into extra/rpl_tests/rpl_lower_case_table_names.test # For details look into extra/rpl_tests/rpl_lower_case_table_names.test
# #
-- source include/master-slave.inc
-- source include/have_innodb.inc
-- source include/not_windows.inc -- source include/not_windows.inc
-- source include/have_innodb.inc
-- source include/have_binlog_format_row.inc -- source include/have_binlog_format_row.inc
-- source include/master-slave.inc
-- let $engine=InnoDB -- let $engine=InnoDB
-- source include/rpl_lower_case_table_names.test -- source include/rpl_lower_case_table_names.test

View File

@@ -1,7 +1,7 @@
source include/no_valgrind_without_big.inc;
source include/not_embedded.inc; source include/not_embedded.inc;
source include/have_innodb.inc; source include/have_innodb.inc;
source include/master-slave.inc; source include/master-slave.inc;
source include/no_valgrind_without_big.inc;
let $engine_type= InnoDB; let $engine_type= InnoDB;

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