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

Merge remote-tracking branch 'origin/11.5' into 11.6

This commit is contained in:
Alexander Barkov
2024-07-08 14:15:04 +04:00
254 changed files with 4072 additions and 1357 deletions

View File

@@ -1,9 +1,8 @@
Code status: # Code status:
------------
* [![Appveyor CI status](https://ci.appveyor.com/api/projects/status/4u6pexmtpuf8jq66?svg=true)](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com * [![Appveyor CI status](https://ci.appveyor.com/api/projects/status/4u6pexmtpuf8jq66?svg=true)](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com
## MariaDB: The innovative open source database ## MariaDB: The innovative open source database
MariaDB was designed as a drop-in replacement of MySQL(R) with more MariaDB was designed as a drop-in replacement of MySQL(R) with more
features, new storage engines, fewer bugs, and better performance. features, new storage engines, fewer bugs, and better performance.
@@ -33,20 +32,19 @@ https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/
https://mariadb.com/kb/en/new-and-old-releases/ https://mariadb.com/kb/en/new-and-old-releases/
Getting the code, building it and testing it # Getting the code, building it and testing it
---------------------------------------------------------------
Refer to the following guide: https://mariadb.org/get-involved/getting-started-for-developers/get-code-build-test/ which outlines how to correctly build the source code and run the MariaDB testing framework. Refer to the following guide: https://mariadb.org/get-involved/getting-started-for-developers/get-code-build-test/
which outlines how to build the source code correctly and run the MariaDB testing framework,
as well as which branch to target for your contributions.
Help # Help
-----
More help is available from the Maria Discuss mailing list More help is available from the Maria Discuss mailing list
https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/ and MariaDB's Zulip https://lists.mariadb.org/postorius/lists/discuss.lists.mariadb.org/ and MariaDB's Zulip
instance, https://mariadb.zulipchat.com/ instance, https://mariadb.zulipchat.com/
Licensing # Licensing
---------
*************************************************************************** ***************************************************************************
@@ -60,8 +58,7 @@ license information can be found in the THIRDPARTY file.
*************************************************************************** ***************************************************************************
Bug Reports # Bug Reports
------------
Bug and/or error reports regarding MariaDB should be submitted at: Bug and/or error reports regarding MariaDB should be submitted at:
https://jira.mariadb.org https://jira.mariadb.org

View File

@@ -31,4 +31,14 @@ test_script:
- set /A parallel=4*%NUMBER_OF_PROCESSORS% - set /A parallel=4*%NUMBER_OF_PROCESSORS%
- perl mysql-test-run.pl --force --max-test-fail=10 --retry=2 --parallel=%parallel% --testcase-timeout=4 --suite=main --skip-test-list=%APPVEYOR_BUILD_FOLDER%\win\appveyor_skip_tests.txt --mysqld=--loose-innodb-flush-log-at-trx-commit=2 - perl mysql-test-run.pl --force --max-test-fail=10 --retry=2 --parallel=%parallel% --testcase-timeout=4 --suite=main --skip-test-list=%APPVEYOR_BUILD_FOLDER%\win\appveyor_skip_tests.txt --mysqld=--loose-innodb-flush-log-at-trx-commit=2
skip_commits:
files:
- debian/
- '**/*.sh'
branches:
only:
- /bb-/
- /\d+\.\d+$/
image: Visual Studio 2022 image: Visual Studio 2022

View File

@@ -248,7 +248,8 @@ static my_bool ignore_errors=0,wait_flag=0,quick=0,
default_pager_set= 0, opt_sigint_ignore= 0, default_pager_set= 0, opt_sigint_ignore= 0,
auto_vertical_output= 0, show_query_cost= 0, auto_vertical_output= 0, show_query_cost= 0,
show_warnings= 0, executing_query= 0, show_warnings= 0, executing_query= 0,
ignore_spaces= 0, opt_binhex= 0, opt_progress_reports; ignore_spaces= 0, opt_binhex= 0, opt_progress_reports,
opt_print_query_on_error;
static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error; static my_bool debug_info_flag, debug_check_flag, batch_abort_on_error;
static my_bool column_types_flag; static my_bool column_types_flag;
static my_bool preserve_comments= 0; static my_bool preserve_comments= 0;
@@ -326,6 +327,7 @@ static int com_quit(String *str,char*),
com_prompt(String *str, char*), com_delimiter(String *str, char*), com_prompt(String *str, char*), com_delimiter(String *str, char*),
com_warnings(String *str, char*), com_nowarnings(String *str, char*), com_warnings(String *str, char*), com_nowarnings(String *str, char*),
com_sandbox(String *str, char*); com_sandbox(String *str, char*);
static void print_query_to_stderr(String *buffer);
static int com_query_cost(String *str, char*); static int com_query_cost(String *str, char*);
#ifdef USE_POPEN #ifdef USE_POPEN
@@ -1210,6 +1212,8 @@ inline int get_command_index(char cmd_char)
static int delimiter_index= -1; static int delimiter_index= -1;
static int charset_index= -1; static int charset_index= -1;
static int sandbox_index= -1;
static bool real_binary_mode= FALSE; static bool real_binary_mode= FALSE;
@@ -1220,7 +1224,8 @@ int main(int argc,char *argv[])
MY_INIT(argv[0]); MY_INIT(argv[0]);
DBUG_ENTER("main"); DBUG_ENTER("main");
DBUG_PROCESS(argv[0]); DBUG_PROCESS(argv[0]);
sandbox_index= get_command_index('-');
charset_index= get_command_index('C'); charset_index= get_command_index('C');
delimiter_index= get_command_index('d'); delimiter_index= get_command_index('d');
delimiter_str= delimiter; delimiter_str= delimiter;
@@ -1798,6 +1803,10 @@ static struct my_option my_long_options[] =
#endif #endif
"built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", &opt_mysql_port, "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").", &opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, &opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"print-query-on-error", 0,
"Print the query if there was an error. Is only enabled in --batch mode if verbose is not set (as then the query would be printed anyway)",
&opt_print_query_on_error, &opt_print_query_on_error, 0, GET_BOOL, NO_ARG,
1, 0, 0, 0, 0, 0},
{"progress-reports", 0, {"progress-reports", 0,
"Get progress reports for long running commands (like ALTER TABLE)", "Get progress reports for long running commands (like ALTER TABLE)",
&opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0, &opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0,
@@ -2375,8 +2384,9 @@ static int read_and_execute(bool interactive)
/** /**
It checks if the input is a short form command. It returns the command's It checks if the input is a short form command. It returns the command's
pointer if a command is found, else return NULL. Note that if binary-mode pointer if a command is found, else return NULL.
is set, then only \C is searched for.
Note that if binary-mode is set, then only \C and \- are searched for.
@param cmd_char A character of one byte. @param cmd_char A character of one byte.
@@ -2391,13 +2401,23 @@ static COMMANDS *find_command(char cmd_char)
int index= -1; int index= -1;
/* /*
In binary-mode, we disallow all mysql commands except '\C' In binary-mode, we disallow all client commands except '\C',
and DELIMITER. DELIMITER (see long comand finding find_command(char *))
and '\-' (sandbox, see following comment).
*/ */
if (real_binary_mode) if (real_binary_mode)
{ {
if (cmd_char == 'C') if (cmd_char == 'C')
index= charset_index; index= charset_index;
/*
binary-mode enforces stricter controls compared to sandbox mode.
Whether sandbox mode is enabled or not is irrelevant when
binary-mode is active.
The only purpose of processing sandbox mode here is to avoid error
messages on files made by mysqldump.
*/
else if (cmd_char == '-')
index= sandbox_index;
} }
else else
index= get_command_index(cmd_char); index= get_command_index(cmd_char);
@@ -2453,6 +2473,12 @@ static COMMANDS *find_command(char *name)
len= (uint) strlen(name); len= (uint) strlen(name);
int index= -1; int index= -1;
/*
In binary-mode, we disallow all client commands except DELIMITER
and short commands '\C' and '\-' (see short command finding
find_command(char)).
*/
if (real_binary_mode) if (real_binary_mode)
{ {
if (is_delimiter_command(name, len)) if (is_delimiter_command(name, len))
@@ -3208,6 +3234,11 @@ int mysql_real_query_for_lazy(const char *buf, size_t length)
int error; int error;
if (!mysql_real_query(&mysql,buf,(ulong)length)) if (!mysql_real_query(&mysql,buf,(ulong)length))
return 0; return 0;
if (opt_print_query_on_error)
{
String query(buf, length, charset_info);
(void) print_query_to_stderr(&query);
}
error= put_error(&mysql); error= put_error(&mysql);
if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 || if (mysql_errno(&mysql) != CR_SERVER_GONE_ERROR || retry > 1 ||
!opt_reconnect) !opt_reconnect)
@@ -3430,7 +3461,6 @@ static int com_charset(String *, char *line)
1 if fatal error 1 if fatal error
*/ */
static int com_go(String *buffer, char *) static int com_go(String *buffer, char *)
{ {
char buff[200]; /* about 110 chars used so far */ char buff[200]; /* about 110 chars used so far */
@@ -3503,6 +3533,8 @@ static int com_go(String *buffer, char *)
{ {
if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql)) if (!(result=mysql_use_result(&mysql)) && mysql_field_count(&mysql))
{ {
if (opt_print_query_on_error)
print_query_to_stderr(buffer);
error= put_error(&mysql); error= put_error(&mysql);
goto end; goto end;
} }
@@ -3556,7 +3588,11 @@ static int com_go(String *buffer, char *)
(long) mysql_num_rows(result) == 1 ? "row" : "rows"); (long) mysql_num_rows(result) == 1 ? "row" : "rows");
end_pager(); end_pager();
if (mysql_errno(&mysql)) if (mysql_errno(&mysql))
{
if (opt_print_query_on_error)
print_query_to_stderr(buffer);
error= put_error(&mysql); error= put_error(&mysql);
}
} }
} }
else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0) else if (mysql_affected_rows(&mysql) == ~(ulonglong) 0)
@@ -3583,13 +3619,21 @@ static int com_go(String *buffer, char *)
put_info("",INFO_RESULT); // Empty row put_info("",INFO_RESULT); // Empty row
if (result && !mysql_eof(result)) /* Something wrong when using quick */ if (result && !mysql_eof(result)) /* Something wrong when using quick */
{
if (opt_print_query_on_error)
print_query_to_stderr(buffer);
error= put_error(&mysql); error= put_error(&mysql);
}
else if (unbuffered) else if (unbuffered)
fflush(stdout); fflush(stdout);
mysql_free_result(result); mysql_free_result(result);
} while (!(err= mysql_next_result(&mysql))); } while (!(err= mysql_next_result(&mysql)));
if (err >= 1) if (err >= 1)
{
if (opt_print_query_on_error)
print_query_to_stderr(buffer);
error= put_error(&mysql); error= put_error(&mysql);
}
end: end:
@@ -4547,14 +4591,35 @@ static int com_shell(String *, char *line)
#endif #endif
static void print_query(String *buffer, FILE *file)
{
tee_puts("--------------", file);
(void) tee_fputs(buffer->c_ptr(), file);
if (!buffer->length() || (*buffer)[buffer->length()-1] != '\n')
tee_putc('\n', file);
tee_puts("--------------\n", file);
}
/*
Print query to stderr in batch mode if verbose is not set
*/
static void print_query_to_stderr(String *buffer)
{
if ((status.batch || in_com_source) && !verbose)
{
fflush(stdout);
print_query(buffer, stderr);
fflush(stderr);
}
}
static int com_print(String *buffer,char *) static int com_print(String *buffer,char *)
{ {
tee_puts("--------------", stdout); print_query(buffer, stdout);
(void) tee_fputs(buffer->c_ptr(), stdout); return 0;
if (!buffer->length() || (*buffer)[buffer->length()-1] != '\n')
tee_putc('\n', stdout);
tee_puts("--------------\n", stdout);
return 0; /* If empty buffer */
} }
@@ -5309,8 +5374,9 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate)
static int put_error(MYSQL *con) static int put_error(MYSQL *con)
{ {
return put_info(mysql_error(con), INFO_ERROR, mysql_errno(con), DBUG_ENTER("put_error");
mysql_sqlstate(con)); DBUG_RETURN(put_info(mysql_error(con), INFO_ERROR,
mysql_errno(con), mysql_sqlstate(con)));
} }

View File

@@ -683,7 +683,7 @@ static int load_plugin_data(char *plugin_name, char *config_file)
if (i == -1) /* if first pass, read this line as so_name */ if (i == -1) /* if first pass, read this line as so_name */
{ {
/* Add proper file extension for soname */ /* Add proper file extension for soname */
if (safe_strcpy(line + line_len - 1, sizeof(line), FN_SOEXT)) if (safe_strcpy_truncated(line + line_len - 1, sizeof line, FN_SOEXT))
{ {
reason= "Plugin name too long."; reason= "Plugin name too long.";
fclose(file_ptr); fclose(file_ptr);
@@ -746,7 +746,7 @@ static int check_options(int argc, char **argv, char *operation)
const char *plugin_dir_prefix = "--plugin_dir="; const char *plugin_dir_prefix = "--plugin_dir=";
size_t plugin_dir_len= strlen(plugin_dir_prefix); size_t plugin_dir_len= strlen(plugin_dir_prefix);
strcpy(plugin_name, ""); *plugin_name= '\0';
for (i = 0; i < argc && num_found < 5; i++) for (i = 0; i < argc && num_found < 5; i++)
{ {
@@ -784,8 +784,8 @@ static int check_options(int argc, char **argv, char *operation)
/* read the plugin config file and check for match against argument */ /* read the plugin config file and check for match against argument */
else else
{ {
if (safe_strcpy(plugin_name, sizeof(plugin_name), argv[i]) || if (safe_strcpy_truncated(plugin_name, sizeof plugin_name, argv[i]) ||
safe_strcpy(config_file, sizeof(config_file), argv[i]) || safe_strcpy_truncated(config_file, sizeof config_file, argv[i]) ||
safe_strcat(config_file, sizeof(config_file), ".ini")) safe_strcat(config_file, sizeof(config_file), ".ini"))
{ {
fprintf(stderr, "ERROR: argument is too long.\n"); fprintf(stderr, "ERROR: argument is too long.\n");

View File

@@ -626,7 +626,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
{ {
my_close(fd, MYF(MY_WME)); my_close(fd, MYF(MY_WME));
my_delete(query_file_path, MYF(0)); my_delete(query_file_path, MYF(0));
die("Failed to write to '%s'", query_file_path); die("Failed to write query to '%s'", query_file_path);
} }
} }
@@ -635,7 +635,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
{ {
my_close(fd, MYF(MY_WME)); my_close(fd, MYF(MY_WME));
my_delete(query_file_path, MYF(0)); my_delete(query_file_path, MYF(0));
die("Failed to write to '%s'", query_file_path); die("Failed to write query to '%s'", query_file_path);
} }
ret= run_tool(mysql_path, ret= run_tool(mysql_path,
@@ -645,6 +645,7 @@ static int run_query(const char *query, DYNAMIC_STRING *ds_res,
"--batch", /* Turns off pager etc. */ "--batch", /* Turns off pager etc. */
force ? "--force": "--skip-force", force ? "--force": "--skip-force",
opt_verbose >= 5 ? "--verbose" : "", opt_verbose >= 5 ? "--verbose" : "",
"--print-query-on-error",
ds_res || opt_silent ? "--silent": "", ds_res || opt_silent ? "--silent": "",
"<", "<",
query_file_path, query_file_path,
@@ -1092,18 +1093,6 @@ static char* get_line(char* line)
return line; return line;
} }
/* Print the current line to stderr */
static void print_line(char* line)
{
while (*line && *line != '\n')
{
fputc(*line, stderr);
line++;
}
fputc('\n', stderr);
}
static my_bool from_before_10_1() static my_bool from_before_10_1()
{ {
my_bool ret= TRUE; my_bool ret= TRUE;
@@ -1322,16 +1311,21 @@ static int check_slave_repositories(void)
static int run_sql_fix_privilege_tables(void) static int run_sql_fix_privilege_tables(void)
{ {
int found_real_errors= 0; int found_real_errors= 0, query_started= 0;
const char **query_ptr; const char **query_ptr;
const char *end;
DYNAMIC_STRING ds_script; DYNAMIC_STRING ds_script;
DYNAMIC_STRING ds_result; DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_query;
DBUG_ENTER("run_sql_fix_privilege_tables"); DBUG_ENTER("run_sql_fix_privilege_tables");
if (init_dynamic_string(&ds_script, "", 65536, 1024)) if (init_dynamic_string(&ds_script, "", 96*1024, 8196))
die("Out of memory"); die("Out of memory");
if (init_dynamic_string(&ds_result, "", 512, 512)) if (init_dynamic_string(&ds_result, "", 1024, 1024))
die("Out of memory");
if (init_dynamic_string(&ds_query, "", 1024, 1024))
die("Out of memory"); die("Out of memory");
verbose("Phase %d/%d: Running 'mysql_fix_privilege_tables'", verbose("Phase %d/%d: Running 'mysql_fix_privilege_tables'",
@@ -1360,22 +1354,46 @@ static int run_sql_fix_privilege_tables(void)
"Unknown column" and "Duplicate key name" since they just "Unknown column" and "Duplicate key name" since they just
indicate the system tables are already up to date indicate the system tables are already up to date
*/ */
char *line= ds_result.str; const char *line= ds_result.str;
do do
{ {
size_t length;
end= strchr(line, '\n');
if (!end)
end= strend(line);
else
end++; /* Include end \n */
length= (size_t) (end - line);
if (!is_expected_error(line)) if (!is_expected_error(line))
{ {
/* Something unexpected failed, dump error line to screen */ /* Something unexpected failed, dump error line to screen */
found_real_errors++; found_real_errors++;
print_line(line); if (ds_query.length)
fwrite(ds_query.str, sizeof(char), ds_query.length, stderr);
fwrite(line, sizeof(char), length, stderr);
query_started= 0;
} }
else if (strncmp(line, "WARNING", 7) == 0) else if (strncmp(line, "WARNING", 7) == 0)
{ {
print_line(line); fwrite(line, sizeof(char), length, stderr);
query_started= 0;
} }
} while ((line= get_line(line)) && *line); else if (!strncmp(line, "--------------\n", 16))
{
/* mariadb separates query from the error with a line of '-' */
if (!query_started++)
ds_query.length= 0; /* Truncate */
else
query_started= 0; /* End of query */
}
else if (query_started)
{
dynstr_append_mem(&ds_query, line, length);
}
} while (*(line= end));
} }
dynstr_free(&ds_query);
dynstr_free(&ds_result); dynstr_free(&ds_result);
dynstr_free(&ds_script); dynstr_free(&ds_script);
DBUG_RETURN(found_real_errors); DBUG_RETURN(found_real_errors);

View File

@@ -421,7 +421,7 @@ int main(int argc,char *argv[])
is given a t!=0, we get an endless loop, or n iterations if --count=n is given a t!=0, we get an endless loop, or n iterations if --count=n
was given an n!=0. If --sleep wasn't given, we get one iteration. was given an n!=0. If --sleep wasn't given, we get one iteration.
To wit, --wait loops the connection-attempts, while --sleep loops To wait, --wait loops the connection-attempts, while --sleep loops
the command execution (endlessly if no --count is given). the command execution (endlessly if no --count is given).
*/ */

View File

@@ -3107,7 +3107,7 @@ static void get_sequence_structure(const char *seq, const char *db)
row= mysql_fetch_row(result); row= mysql_fetch_row(result);
if (row[0]) if (row[0])
{ {
fprintf(sql_file, "SELECT SETVAL(%s, %s, 0);\n", result_seq, row[0]); fprintf(sql_file, "DO SETVAL(%s, %s, 0);\n", result_seq, row[0]);
} }
// Sequences will not use inserts, so no need for REPLACE and LOCKS // Sequences will not use inserts, so no need for REPLACE and LOCKS
mysql_free_result(result); mysql_free_result(result);
@@ -6163,7 +6163,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
free_root(&glob_root, MYF(0)); free_root(&glob_root, MYF(0));
} }
maybe_die(EX_ILLEGAL_TABLE, "Couldn't find table: \"%s\"", *table_names); maybe_die(EX_ILLEGAL_TABLE, "Couldn't find table: \"%s\"", *table_names);
/* We shall countinue here, if --force was given */ /* We shall continue here, if --force was given */
} }
} }
end= pos; end= pos;
@@ -6184,7 +6184,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
free_root(&glob_root, MYF(0)); free_root(&glob_root, MYF(0));
} }
DB_error(mysql, "when doing LOCK TABLES"); DB_error(mysql, "when doing LOCK TABLES");
/* We shall countinue here, if --force was given */ /* We shall continue here, if --force was given */
} }
} }
dynstr_free(&lock_tables_query); dynstr_free(&lock_tables_query);
@@ -6196,7 +6196,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
free_root(&glob_root, MYF(0)); free_root(&glob_root, MYF(0));
DB_error(mysql, "when doing refresh"); DB_error(mysql, "when doing refresh");
} }
/* We shall countinue here, if --force was given */ /* We shall continue here, if --force was given */
else else
verbose_msg("-- dump_selected_tables : logs flushed successfully!\n"); verbose_msg("-- dump_selected_tables : logs flushed successfully!\n");
} }

View File

@@ -430,7 +430,7 @@ static void lock_table(MYSQL *mysql, int tablecount, char **raw_tablename)
dynstr_append(&query, " WRITE,"); dynstr_append(&query, " WRITE,");
} }
if (mysql_real_query(mysql, query.str, (ulong)query.length-1)) if (mysql_real_query(mysql, query.str, (ulong)query.length-1))
db_error(mysql); /* We shall countinue here, if --force was given */ db_error(mysql); /* We shall continue here, if --force was given */
} }
@@ -621,7 +621,7 @@ pthread_handler_t worker_thread(void *arg)
if (mysql_query(mysql, "/*!40101 set @@character_set_database=binary */;")) if (mysql_query(mysql, "/*!40101 set @@character_set_database=binary */;"))
{ {
db_error(mysql); /* We shall countinue here, if --force was given */ db_error(mysql); /* We shall continue here, if --force was given */
goto error; goto error;
} }
@@ -749,12 +749,12 @@ int main(int argc, char **argv)
if (!(mysql= db_connect(current_host,current_db,current_user,opt_password))) if (!(mysql= db_connect(current_host,current_db,current_user,opt_password)))
{ {
free_defaults(argv_to_free); free_defaults(argv_to_free);
return(1); /* purecov: deadcode */ return(1); /* purecov: dead code */
} }
if (mysql_query(mysql, "/*!40101 set @@character_set_database=binary */;")) if (mysql_query(mysql, "/*!40101 set @@character_set_database=binary */;"))
{ {
db_error(mysql); /* We shall countinue here, if --force was given */ db_error(mysql); /* We shall continue here, if --force was given */
return(1); return(1);
} }

View File

@@ -6014,14 +6014,20 @@ int connect_n_handle_errors(struct st_command *command,
stay clear of trying to work out which exact user-limit was stay clear of trying to work out which exact user-limit was
exceeded. exceeded.
*/ */
auto my_err= mysql_errno(con);
if(my_err == 0)
{
/* Workaround client library bug, not indicating connection error. */
my_err= CR_SERVER_LOST;
}
if (((mysql_errno(con) == ER_TOO_MANY_USER_CONNECTIONS) || if (((my_err == ER_TOO_MANY_USER_CONNECTIONS) ||
(mysql_errno(con) == ER_USER_LIMIT_REACHED)) && (my_err == ER_USER_LIMIT_REACHED)) &&
(failed_attempts++ < opt_max_connect_retries)) (failed_attempts++ < opt_max_connect_retries))
{ {
int i; int i;
i= match_expected_error(command, mysql_errno(con), mysql_sqlstate(con)); i= match_expected_error(command, my_err, mysql_sqlstate(con));
if (i >= 0) if (i >= 0)
goto do_handle_error; /* expected error, handle */ goto do_handle_error; /* expected error, handle */
@@ -6031,9 +6037,9 @@ int connect_n_handle_errors(struct st_command *command,
} }
do_handle_error: do_handle_error:
var_set_errno(mysql_errno(con)); var_set_errno(my_err);
handle_error(command, mysql_errno(con), mysql_error(con), handle_error(command, my_err, mysql_error(con),
mysql_sqlstate(con), ds); mysql_sqlstate(con), ds);
return 0; /* Not connected */ return 0; /* Not connected */
} }
@@ -6373,7 +6379,7 @@ int do_done(struct st_command *command)
if (*cur_block->delim) if (*cur_block->delim)
{ {
/* Restore "old" delimiter after false if block */ /* Restore "old" delimiter after false if block */
if (safe_strcpy(delimiter, sizeof(delimiter), cur_block->delim)) if (safe_strcpy_truncated(delimiter, sizeof delimiter, cur_block->delim))
die("Delimiter too long, truncated"); die("Delimiter too long, truncated");
delimiter_length= strlen(delimiter); delimiter_length= strlen(delimiter);
@@ -6661,7 +6667,8 @@ void do_block(enum block_cmd cmd, struct st_command* command)
else else
{ {
/* Remember "old" delimiter if entering a false if block */ /* Remember "old" delimiter if entering a false if block */
if (safe_strcpy(cur_block->delim, sizeof(cur_block->delim), delimiter)) if (safe_strcpy_truncated(cur_block->delim, sizeof cur_block->delim,
delimiter))
die("Delimiter too long, truncated"); die("Delimiter too long, truncated");
} }

View File

@@ -44,7 +44,7 @@ FOREACH(F ${MY_WARNING_FLAGS})
MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO) MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO)
ENDFOREACH() ENDFOREACH()
SET(MY_ERROR_FLAGS -Werror) SET(MY_ERROR_FLAGS -Werror -fno-operator-names)
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized) SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized)

View File

@@ -87,7 +87,6 @@ expire_logs_days = 10
# MariaDB default is Latin1, but in Debian we rather default to the full # MariaDB default is Latin1, but in Debian we rather default to the full
# utf8 4-byte character set. See also client.cnf # utf8 4-byte character set. See also client.cnf
character-set-server = utf8mb4 character-set-server = utf8mb4
character-set-collations = utf8mb4=uca1400_ai_ci
# #
# * InnoDB # * InnoDB

View File

@@ -58,6 +58,7 @@ disable_libfmt()
} }
architecture=$(dpkg-architecture -q DEB_BUILD_ARCH) architecture=$(dpkg-architecture -q DEB_BUILD_ARCH)
uname_machine=$(uname -m)
# Parse release name and number from Linux standard base release # Parse release name and number from Linux standard base release
# Example: # Example:
@@ -188,6 +189,14 @@ then
BUILDPACKAGE_DPKGCMD+=("eatmydata") BUILDPACKAGE_DPKGCMD+=("eatmydata")
fi fi
# If running autobake-debs.sh inside docker/podman host machine which
# has 64 bits cpu but container image is 32 bit make sure that we set
# correct arch with linux32 for 32 bit enviroment
if [ "$architecture" = "i386" ] && [ "$uname_machine" = "x86_64" ]
then
BUILDPACKAGE_DPKGCMD+=("linux32")
fi
BUILDPACKAGE_DPKGCMD+=("dpkg-buildpackage") BUILDPACKAGE_DPKGCMD+=("dpkg-buildpackage")
# Using dpkg-buildpackage args # Using dpkg-buildpackage args

View File

@@ -12,8 +12,6 @@ fi
${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 }
#DEBHELPER#
# #
# - Purge logs and data only if they are ours (#307473) # - Purge logs and data only if they are ours (#307473)
# - Remove the mysql user only after all his owned files are purged. # - Remove the mysql user only after all his owned files are purged.

View File

@@ -1600,11 +1600,11 @@ struct my_option xb_client_options[]= {
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"rsync", OPT_RSYNC, {"rsync", OPT_RSYNC,
"Obsolete depricated option", "Obsolete, deprecated option",
&ignored_option, &ignored_option, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &ignored_option, &ignored_option, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"no-backup-locks", OPT_NO_BACKUP_LOCKS, {"no-backup-locks", OPT_NO_BACKUP_LOCKS,
"Obsolete depricated option", "Obsolete, deprecated option",
&ignored_option, &ignored_option, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, &ignored_option, &ignored_option, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"force-non-empty-directories", OPT_FORCE_NON_EMPTY_DIRS, {"force-non-empty-directories", OPT_FORCE_NON_EMPTY_DIRS,
@@ -6996,7 +6996,7 @@ static bool check_all_privileges()
if (opt_galera_info || opt_slave_info if (opt_galera_info || opt_slave_info
|| opt_safe_slave_backup) { || opt_safe_slave_backup) {
check_result |= check_privilege(granted_privileges, check_result |= check_privilege(granted_privileges,
"REPLICA MONITOR", "*", "*", "SLAVE MONITOR", "*", "*",
PRIVILEGE_WARNING); PRIVILEGE_WARNING);
} }

View File

@@ -249,15 +249,14 @@ static inline void lex_string_set3(LEX_CSTRING *lex_str, const char *c_str,
lex_str->length= len; lex_str->length= len;
} }
/* /**
Copies src into dst and ensures dst is a NULL terminated C string. Copies a string.
Returns 1 if the src string was truncated due to too small size of dst. @param dst destination buffer, will be NUL padded.
Returns 0 if src completely fit within dst. Pads the remaining dst with '\0' @param dst_size size of dst buffer, must be > 0
@param src NUL terminated source string
Note: dst_size must be > 0
*/ */
static inline int safe_strcpy(char *dst, size_t dst_size, const char *src) static inline void safe_strcpy(char *dst, size_t dst_size, const char *src)
{ {
DBUG_ASSERT(dst_size > 0); DBUG_ASSERT(dst_size > 0);
@@ -266,45 +265,49 @@ static inline int safe_strcpy(char *dst, size_t dst_size, const char *src)
* *
* 2) IF there is no 0 byte in the first dst_size bytes of src, strncpy will * 2) IF there is no 0 byte in the first dst_size bytes of src, strncpy will
* copy dst_size bytes, and the final byte won't be 0. * copy dst_size bytes, and the final byte won't be 0.
*
* In GCC 8+, the `-Wstringop-truncation` warning will object to strncpy()
* being used in this way, so we need to disable this warning for this
* single statement.
*/ */
#if defined(__GNUC__) && __GNUC__ >= 8
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
#endif
strncpy(dst, src, dst_size); strncpy(dst, src, dst_size);
#if defined(__GNUC__) && __GNUC__ >= 8 dst[dst_size - 1]= 0;
#pragma GCC diagnostic pop }
#endif
if (dst[dst_size-1]) /**
Copies a string, checking for truncation.
@param dst destination buffer, will be NUL padded.
@param dst_size size of dst buffer, must be > 0
@param src NUL terminated source string
@retval 1 if the src string was truncated due to too small size of dst.
@retval 0 if src completely fit within dst,
*/
static inline int safe_strcpy_truncated(char *dst, size_t dst_size,
const char *src)
{
DBUG_ASSERT(dst_size > 0);
strncpy(dst, src, dst_size);
if (dst[dst_size - 1])
{ {
/* Only possible in case (2), meaning src was truncated. */ dst[dst_size - 1]= 0;
dst[dst_size-1]= 0;
return 1; return 1;
} }
return 0; return 0;
} }
/* /**
Appends src to dst and ensures dst is a NULL terminated C string. Appends src to dst and ensures dst is a NUL terminated C string.
Returns 1 if the src string was truncated due to too small size of dst. @retval 1 if the src string was truncated due to too small size of dst.
Returns 0 if src completely fit within the remaining dst space. Pads the @retval 0 if src completely fit within the remaining dst space,
remaining dst with '\0'. including NUL termination.
Note: dst_size must be > 0
*/ */
static inline int safe_strcat(char *dst, size_t dst_size, const char *src) static inline int safe_strcat(char *dst, size_t dst_size, const char *src)
{ {
size_t init_len= strlen(dst); size_t init_len= strlen(dst);
if (init_len >= dst_size - 1) if (init_len > dst_size)
return 1; return 1;
return safe_strcpy(dst + init_len, dst_size - init_len, src); return safe_strcpy_truncated(dst + init_len, dst_size - init_len, src);
} }
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -242,6 +242,18 @@ static inline ulonglong my_timer_cycles(void)
#endif #endif
} }
#if MY_TIMER_ROUTINE_CYCLES == 0
static inline size_t my_pseudo_random(void)
{
/* In some platforms, pthread_self() might return a structure
that cannot be converted to a number like this. Possible alternatives
could include gettid() or sched_getcpu(). */
return ((size_t) pthread_self()) / 16;
}
#else
# define my_pseudo_random my_timer_cycles
#endif
/** /**
A nanosecond timer. A nanosecond timer.
@return the current timer value, in nanoseconds. @return the current timer value, in nanoseconds.

View File

@@ -409,7 +409,7 @@ shell> \fBmysqladmin password "my new password"\fR
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br

View File

@@ -167,7 +167,7 @@ option is given\&.
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br
@@ -424,7 +424,7 @@ USE\&. (In particular, no cross\-database updates should be used\&.)
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br
@@ -1337,7 +1337,7 @@ capability enabled\&.
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br
@@ -1985,7 +1985,7 @@ shell> \fBmysqlbinlog \-v \-\-base64\-output=DECODE\-ROWS \fR\fB\fIlog_file\fR\f
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br

View File

@@ -101,7 +101,7 @@ with partitioned tables is not supported\&.
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br

View File

@@ -2358,7 +2358,7 @@ file that contains its data\&. The option value is the directory in which to wri
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br

View File

@@ -36,7 +36,7 @@ performs a table check\&. If any problems are found, a table repair is attempted
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br
@@ -54,7 +54,7 @@ with administrator privileges\&. You can do this by running a Command Prompt as
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br

View File

@@ -51,14 +51,14 @@ Options unknown to
are passed to are passed to
\fBmysqld\fR \fBmysqld\fR
if they are specified on the command line, but ignored if they are specified in the if they are specified on the command line, but ignored if they are specified in the
[mysqld_safe] or [mariadb_safe] [mysqld_safe], [mariadbd-safe] or [mariadbd_safe]
groups of an option file\&. groups of an option file\&.
.PP .PP
\fBmysqld_safe\fR \fBmysqld_safe\fR
reads all options from the reads all options from the
[mysqld], [mysqld],
[server], [server],
[mysqld_safe], and [mariadb_safe] [mysqld_safe], [mariadbd-safe] and [mariadbd_safe]
sections in option files\&. For example, if you specify a sections in option files\&. For example, if you specify a
[mysqld] [mysqld]
section like this, section like this,
@@ -733,7 +733,7 @@ If none of these options is given, the default is
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br

View File

@@ -38,7 +38,7 @@ with partitioned tables is not supported\&.
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br
@@ -168,7 +168,7 @@ the section called \(lqMYISAMCHK MEMORY USAGE\(rq\&.
.sp .sp
.\} .\}
.RS 4 .RS 4
.it 1 an-trap .it 1
.nr an-no-space-flag 1 .nr an-no-space-flag 1
.nr an-break-flag 1 .nr an-break-flag 1
.br .br

View File

@@ -0,0 +1,4 @@
[binlogoff]
[binlogon]
log-bin

View File

@@ -0,0 +1,3 @@
# include file for test files that can be run with and without log-bin
# (see include/log_bin.combinations)

View File

@@ -23,7 +23,7 @@ use File::Path;
use Carp; use Carp;
use base qw(Exporter); use base qw(Exporter);
our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX IS_MAC our @EXPORT= qw(IS_CYGWIN IS_MSYS IS_WINDOWS IS_WIN32PERL IS_AIX IS_MAC IS_FREEBSD
native_path posix_path mixed_path native_path posix_path mixed_path
check_socket_path_length process_alive open_for_append); check_socket_path_length process_alive open_for_append);
@@ -79,6 +79,15 @@ BEGIN {
} }
} }
BEGIN {
if ($^O eq "freebsd") {
eval 'sub IS_FREEBSD { 1 }';
}
else {
eval 'sub IS_FREEBSD { 0 }';
}
}
# #
# native_path # native_path
# Convert from path format used by perl to the underlying # Convert from path format used by perl to the underlying

View File

@@ -398,7 +398,8 @@ sub collect_suite_name($$)
{ {
my @dirs = my_find_dir(dirname($::glob_mysql_test_dir), my @dirs = my_find_dir(dirname($::glob_mysql_test_dir),
["mariadb-test/suite", "mysql-test/suite", @plugin_suitedirs ], ["mariadb-test/suite", "mysql-test/suite", @plugin_suitedirs ],
$suitename); $suitename,
$::opt_skip_not_found ? NOT_REQUIRED : undef);
# #
# if $suitename contained wildcards, we'll have many suites and # if $suitename contained wildcards, we'll have many suites and
# their overlays here. Let's group them appropriately. # their overlays here. Let's group them appropriately.

View File

@@ -0,0 +1 @@
--innodb_buffer_pool_dump_at_shutdown=off --innodb_buffer_pool_load_at_startup=off --innodb-stats-persistent=1 --innodb-stats-auto-recalc=off

View File

@@ -0,0 +1,69 @@
#
# MDEV-34125: ANALYZE FORMAT=JSON: r_engine_stats.pages_read_time_ms has wrong scale
#
create table t1 (
a varchar(255),
b varchar(255),
c varchar(255),
d varchar(255),
primary key(a,b,c,d)
) engine=innodb;
SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR
insert into t1 select
repeat(uuid(), 7),
repeat(uuid(), 7),
repeat(uuid(), 7),
repeat(uuid(), 7)
from seq_1_to_16384;
SET GLOBAL innodb_fast_shutdown=0;
# restart
set log_slow_verbosity='engine';
set long_query_time=0.0;
set @js='$analyze_output';
select @js;
@js
{
"query_optimization": {
"r_total_time_ms": "REPLACED"
},
"query_block": {
"select_id": 1,
"cost": 0.011647987,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "index",
"key": "PRIMARY",
"key_length": "1028",
"used_key_parts": ["a", "b", "c", "d"],
"loops": 1,
"r_loops": 1,
"rows": 1,
"r_rows": 16384,
"cost": 0.0110178,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"r_engine_stats": {
"pages_accessed": "REPLACED",
"pages_read_count": "REPLACED",
"pages_read_time_ms": "REPLACED"
},
"filtered": 100,
"r_total_filtered": 100,
"r_filtered": 100
}
}
]
}
}
set @pages_read_time_ms=
(select json_value(@js,'$.query_block.nested_loop[0].table.r_engine_stats.pages_read_time_ms'));
OK: pages_read_time is same in slow log and ANALYZE
set long_query_time=default;
drop table t1;

View File

@@ -0,0 +1,75 @@
#
# r_engine_stats tests that require slow query log.
#
--source include/analyze-format.inc
--source include/have_sequence.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-34125: ANALYZE FORMAT=JSON: r_engine_stats.pages_read_time_ms has wrong scale
--echo #
# Each row is 1K.
create table t1 (
a varchar(255),
b varchar(255),
c varchar(255),
d varchar(255),
primary key(a,b,c,d)
) engine=innodb;
# The data size is 160K * 1K = 160M
# 16M / (page_size=16K) = 1K pages.
SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR
insert into t1 select
repeat(uuid(), 7),
repeat(uuid(), 7),
repeat(uuid(), 7),
repeat(uuid(), 7)
from seq_1_to_16384;
SET GLOBAL innodb_fast_shutdown=0;
source include/restart_mysqld.inc;
set log_slow_verbosity='engine';
set long_query_time=0.0;
let $analyze_output= `analyze format=json
select * from t1 force index (PRIMARY) order by a desc, b desc, c desc, d desc`;
evalp set @js='$analyze_output';
# Print it out for user-friendlines
--replace_regex /("(r_[a-z_]*_time_ms|pages[^"]*)": )[^, \n]*/\1"REPLACED"/
select @js;
set @pages_read_time_ms=
(select json_value(@js,'$.query_block.nested_loop[0].table.r_engine_stats.pages_read_time_ms'));
let ANALYZE_PAGES=`select @pages_read_time_ms`;
let SLOW_LOG_FILE= `select @@slow_query_log_file`;
perl;
my $slow_log_file= $ENV{'SLOW_LOG_FILE'} or die "SLOW_LOG_FILE not set";
my $analyze_pages=$ENV{'ANALYZE_PAGES'};
open(FILE, $slow_log_file) or die "Failed to open $slow_log_file";
# We didn't run any queries touching a storage engine after the query of
# interest, so we will be fine here if we just get the last occurrence of
# Pages_read_time: NNNN in the file
while(<FILE>) {
$slow_log_pages=$1 if (/Pages_read_time: ([0-9.]+)/);
}
close(FILE);
if ( $slow_log_pages > $analyze_pages * 0.95 &&
$slow_log_pages < $analyze_pages * 1.05) {
print "\n\n OK: pages_read_time is same in slow log and ANALYZE\n\n";
} else {
print "\n\n FAIL: $slow_log_pages not equal to $analyze_pages\n";
}
EOF
set long_query_time=default;
drop table t1;

View File

@@ -0,0 +1,9 @@
#
# MDEV-34226 On startup: UBSAN: applying zero offset to null pointer in my_copy_fix_mb from strings/ctype-mb.c and other locations
#
connect con1,localhost,root,,"*NO-ONE*";
SELECT database();
database()
NULL
disconnect con1;
connection default;

View File

@@ -0,0 +1,10 @@
--echo #
--echo # MDEV-34226 On startup: UBSAN: applying zero offset to null pointer in my_copy_fix_mb from strings/ctype-mb.c and other locations
--echo #
# Connect without a database
connect (con1,localhost,root,,"*NO-ONE*");
SELECT database();
disconnect con1;
connection default;

View File

@@ -2062,4 +2062,11 @@ DROP TABLE t1;
# #
CREATE TABLE t1 (id1 INT, id2 INT, primary key (id1), unique index (id2) visible); CREATE TABLE t1 (id1 INT, id2 INT, primary key (id1), unique index (id2) visible);
drop table t1; drop table t1;
#
# MDEV-32376 SHOW CREATE DATABASE statement crashes the server when db name contains some unicode characters, ASAN stack-buffer-overflow
#
SET NAMES utf8mb3;
SHOW CREATE DATABASE `#testone#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■`;
ERROR 42000: Incorrect database name '#testone#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■...'
SET NAMES DEFAULT;
# End of 10.5 Test # End of 10.5 Test

View File

@@ -1935,4 +1935,13 @@ DROP TABLE t1;
CREATE TABLE t1 (id1 INT, id2 INT, primary key (id1), unique index (id2) visible); CREATE TABLE t1 (id1 INT, id2 INT, primary key (id1), unique index (id2) visible);
drop table t1; drop table t1;
--echo #
--echo # MDEV-32376 SHOW CREATE DATABASE statement crashes the server when db name contains some unicode characters, ASAN stack-buffer-overflow
--echo #
SET NAMES utf8mb3;
--error ER_WRONG_DB_NAME
SHOW CREATE DATABASE `#testone#■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■`;
SET NAMES DEFAULT;
--echo # End of 10.5 Test --echo # End of 10.5 Test

View File

@@ -9,3 +9,48 @@ DROP TABLE t1;
# #
# End of 10.3 tests # End of 10.3 tests
# #
#
# Start of 10.11 tests
#
#
# MDEV-34288 SET NAMES DEFAULT crashes `mariadbd --collation-server=utf8mb4_unicode_ci`
#
SET NAMES DEFAULT COLLATE latin1_bin;
ERROR 42000: COLLATION 'latin1_bin' is not valid for CHARACTER SET 'utf8mb4'
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
@@character_set_connection @@collation_connection @@character_set_results
latin1 latin1_swedish_ci latin1
SET NAMES DEFAULT COLLATE utf8mb4_bin;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
@@character_set_connection @@collation_connection @@character_set_results
utf8mb4 utf8mb4_bin utf8mb4
SET NAMES DEFAULT COLLATE uca1400_ai_ci;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
@@character_set_connection @@collation_connection @@character_set_results
utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4
SET @@global.character_set_client=latin1;
SET NAMES DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
@@character_set_connection @@collation_connection @@character_set_results
latin1 latin1_swedish_ci latin1
SET @@global.character_set_client=utf8mb3;
SET NAMES DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
@@character_set_connection @@collation_connection @@character_set_results
utf8mb3 utf8mb3_uca1400_ai_ci utf8mb3
SET @@global.character_set_client=DEFAULT;
SET NAMES DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
@@character_set_connection @@collation_connection @@character_set_results
utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4
SET NAMES DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
@@character_set_connection @@collation_connection @@character_set_results
utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4
SET NAMES DEFAULT COLLATE DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
@@character_set_connection @@collation_connection @@character_set_results
utf8mb4 utf8mb4_uca1400_ai_ci utf8mb4
#
# End of 10.11 tests
#

View File

@@ -13,3 +13,45 @@ DROP TABLE t1;
--echo # --echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #
--echo #
--echo # Start of 10.11 tests
--echo #
--echo #
--echo # MDEV-34288 SET NAMES DEFAULT crashes `mariadbd --collation-server=utf8mb4_unicode_ci`
--echo #
--error ER_COLLATION_CHARSET_MISMATCH
SET NAMES DEFAULT COLLATE latin1_bin;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
SET NAMES DEFAULT COLLATE utf8mb4_bin;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
SET NAMES DEFAULT COLLATE uca1400_ai_ci;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
SET @@global.character_set_client=latin1;
SET NAMES DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
SET @@global.character_set_client=utf8mb3;
SET NAMES DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
SET @@global.character_set_client=DEFAULT;
SET NAMES DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
SET NAMES DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
SET NAMES DEFAULT COLLATE DEFAULT;
SELECT @@character_set_connection, @@collation_connection, @@character_set_results;
--echo #
--echo # End of 10.11 tests
--echo #

View File

@@ -258,3 +258,8 @@ drop database mysqltest;
Warnings: Warnings:
Note 1008 Can't drop database 'mysqltest'; database doesn't exist Note 1008 Can't drop database 'mysqltest'; database doesn't exist
set @@session.sql_if_exists=0; set @@session.sql_if_exists=0;
#
# MDEV-34205 ASAN stack-buffer-overflow in strxnmov | frm_file_exists
#
DROP TABLE `##################################################_long`.`#################################################_long`;
ERROR 42S02: Unknown table '##################################################_long.#########################################...'

View File

@@ -361,3 +361,9 @@ drop table mysqltest.does_not_exists;
drop database mysqltest; drop database mysqltest;
drop database mysqltest; drop database mysqltest;
set @@session.sql_if_exists=0; set @@session.sql_if_exists=0;
--echo #
--echo # MDEV-34205 ASAN stack-buffer-overflow in strxnmov | frm_file_exists
--echo #
--error ER_BAD_TABLE_ERROR
DROP TABLE `##################################################_long`.`#################################################_long`;

View File

@@ -1950,12 +1950,6 @@ ex
# End of 10.4 tests # End of 10.4 tests
# #
# #
# Start of 10.5 tests
#
#
# Start of 10.5 tests
#
#
# MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol # MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol
# #
SELECT hex(column_create(1,'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)) AS ex; SELECT hex(column_create(1,'a' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_bin)) AS ex;
@@ -1967,5 +1961,16 @@ SELECT hex(column_add(column_create(
ex ex
00020001000302001353612162 00020001000302001353612162
# #
# Start of 10.5 tests # MDEV-31566 Fix buffer overrun of column_json function
# #
create table t1 (
c1 varchar(32) primary key,
d1 blob
);
insert into t1 values ('var', 0x0402000A0000000300030023076A736E7375626A6563742E0005006C0027000200290002002B0002002D0002002F0002000C31000C3B000C4B000C51000F62006631663266336634663509E5A79AE8BF9CE6B48B0FE8819AE9809AE98791E6A1A5E5BA970537343530301031313634332F393634352F31313630300C080000000000EFBFBDEFBFBD192E), ('zzz', 0x0402000900000003000300740C6A736E766F6C756D652E000900EFBFBD004300020045000200470003004A0004004E00050053000500580005005D000500620005000C67000C6A000C6D000C7000052C00051B00052C000CEFBFBD0007EFBFBD006638663966313070696332626F785F63626F785F67626F785F6B626F785F7666355F696402343402343402333241687474703A2F2F6F73732E68646238382E636F6D2F302F70686F746F2F30373865653765376336343634616236386130343833373333323636613532612E67696608302E303532323732244F1E00030180C106);
select c1,column_json(d1) as not_crashing from t1 order by c1;
c1 not_crashing
var {"jsn":"\u0000\u0005\u0000l\u0000'\u0000\u0002\u0000)\u0000\u0002\u0000+\u0000\u0002\u0000-\u0000\u0002\u0000/\u0000\u0002\u0000\u000C1\u0000\u000C;\u0000\u000CK\u0000\u000CQ\u0000\u000Fb\u0000f1f2f3f4f5\u0009姚远洋\u000F聚通金桥店\u000574500\u001011643/9645/11600\u000C\u0008\u0000\u0000\u0000\u0000\u0000<30><30>\u0019","subject":""}
zzz {"jsn":"\u0000\u0009\u0000<30>\u0000C\u0000\u0002\u0000E\u0000\u0002\u0000G\u0000\u0003\u0000J\u0000\u0004\u0000N\u0000\u0005\u0000S\u0000\u0005\u0000X\u0000\u0005\u0000]\u0000\u0005\u0000b\u0000\u0005\u0000\u000Cg\u0000\u000Cj\u0000\u000Cm\u0000\u000Cp\u0000\u0005,\u0000\u0005\u001B\u0000\u0005,\u0000\u000C<30>\u0000\u0007<30>\u0000f8f9f10pic2box_cbox_gbox_kbox_vf5_id\u000244\u000244\u000232Ahttp://oss.hdb88.com/0/photo/078ee7e7c6464ab68a0483733266a52a.gif\u00080.052272$O\u001E\u0000","volume":193.6}
drop table t1;
# End of 10.5 tests

View File

@@ -1001,14 +1001,6 @@ SELECT HEX(COLUMN_ADD(COLUMN_CREATE(1,10),2,NULL,1,NULL)) as ex;
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # Start of 10.5 tests
--echo #
--echo # --echo #
--echo # MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol --echo # MDEV-33788 HEX(COLUMN_CREATE(.. AS CHAR ...)) fails with --view-protocol
--echo # --echo #
@@ -1019,5 +1011,18 @@ SELECT hex(column_add(column_create(
2, 'b' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci)) AS ex; 2, 'b' AS CHAR CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci)) AS ex;
--echo # --echo #
--echo # Start of 10.5 tests --echo # MDEV-31566 Fix buffer overrun of column_json function
--echo # --echo #
create table t1 (
c1 varchar(32) primary key,
d1 blob
);
insert into t1 values ('var', 0x0402000A0000000300030023076A736E7375626A6563742E0005006C0027000200290002002B0002002D0002002F0002000C31000C3B000C4B000C51000F62006631663266336634663509E5A79AE8BF9CE6B48B0FE8819AE9809AE98791E6A1A5E5BA970537343530301031313634332F393634352F31313630300C080000000000EFBFBDEFBFBD192E), ('zzz', 0x0402000900000003000300740C6A736E766F6C756D652E000900EFBFBD004300020045000200470003004A0004004E00050053000500580005005D000500620005000C67000C6A000C6D000C7000052C00051B00052C000CEFBFBD0007EFBFBD006638663966313070696332626F785F63626F785F67626F785F6B626F785F7666355F696402343402343402333241687474703A2F2F6F73732E68646238382E636F6D2F302F70686F746F2F30373865653765376336343634616236386130343833373333323636613532612E67696608302E303532323732244F1E00030180C106);
select c1,column_json(d1) as not_crashing from t1 order by c1;
drop table t1;
--echo # End of 10.5 tests

View File

@@ -200,3 +200,34 @@ select 30 + (20010101 + interval 2 day), x from v1;
20010133 20010133 20010133 20010133
drop view v1; drop view v1;
End of 10.2 tests End of 10.2 tests
#
# Start of 10.5 tests
#
#
# MDEV-30931 UBSAN: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in get_interval_value on SELECT
#
SELECT DATE_ADD('01-01-23',INTERVAL '9223372036854775808-02' WEEK);
DATE_ADD('01-01-23',INTERVAL '9223372036854775808-02' WEEK)
NULL
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '9223372036854775808-02'
Warning 1441 Datetime function: datetime field overflow
SELECT DATE_ADD('01-01-23',INTERVAL -9223372036854775807 WEEK);
DATE_ADD('01-01-23',INTERVAL -9223372036854775807 WEEK)
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT DATE_ADD('01-01-23',INTERVAL -9223372036854775808 WEEK);
DATE_ADD('01-01-23',INTERVAL -9223372036854775808 WEEK)
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT DATE_ADD('01-01-23',INTERVAL -9223372036854775809 WEEK);
DATE_ADD('01-01-23',INTERVAL -9223372036854775809 WEEK)
NULL
Warnings:
Warning 1916 Got overflow when converting '-9223372036854775809' to INT. Value truncated
Warning 1441 Datetime function: datetime field overflow
#
# End of 10.5 tests
#

View File

@@ -169,3 +169,20 @@ select 30 + (20010101 + interval 2 day), x from v1;
drop view v1; drop view v1;
--echo End of 10.2 tests --echo End of 10.2 tests
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-30931 UBSAN: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in get_interval_value on SELECT
--echo #
SELECT DATE_ADD('01-01-23',INTERVAL '9223372036854775808-02' WEEK);
SELECT DATE_ADD('01-01-23',INTERVAL -9223372036854775807 WEEK);
SELECT DATE_ADD('01-01-23',INTERVAL -9223372036854775808 WEEK);
SELECT DATE_ADD('01-01-23',INTERVAL -9223372036854775809 WEEK);
--echo #
--echo # End of 10.5 tests
--echo #

View File

@@ -1735,6 +1735,17 @@ SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D');
JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D') JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D')
{"A": {"B": 1}} {"A": {"B": 1}}
# #
# MDEV-34143: Server crashes when executing JSON_EXTRACT after setting non-default collation_connection
#
SET @save_collation_connection= @@collation_connection;
SET collation_connection='utf16_bin';
SELECT JSON_EXTRACT('{"a": 1,"b": 2}','$.a');
JSON_EXTRACT('{"a": 1,"b": 2}','$.a')
NULL
Warnings:
Warning 4036 Character disallowed in JSON in argument 1 to function 'json_extract' at position 2
SET @@collation_connection= @save_collation_connection;
#
# End of 10.5 tests # End of 10.5 tests
# #
# #

View File

@@ -1162,6 +1162,20 @@ SELECT JSON_TYPE(json_value(JSON_OBJECT("id", 1, "name", 'Monty', "date", Cast('
SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D'); SELECT JSON_REMOVE('{"A": { "B": 1 }}', '$.A.B.C.D');
--echo #
--echo # MDEV-34143: Server crashes when executing JSON_EXTRACT after setting non-default collation_connection
--echo #
SET @save_collation_connection= @@collation_connection;
SET collation_connection='utf16_bin';
--disable_service_connection
SELECT JSON_EXTRACT('{"a": 1,"b": 2}','$.a');
--enable_service_connection
SET @@collation_connection= @save_collation_connection;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -5310,6 +5310,14 @@ NULL
DROP TABLE t1; DROP TABLE t1;
DROP VIEW v1; DROP VIEW v1;
# #
# MDEV-28387 UBSAN: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strtoll10 on SELECT
#
SET @a='-9223372036854775808';
CREATE TABLE t (c1 INT,c2 CHAR);
SELECT SUBSTR(0,@a) FROM t;
SUBSTR(0,@a)
DROP TABLE t;
#
# End of 10.5 tests # End of 10.5 tests
# #
# #

View File

@@ -1548,6 +1548,7 @@ CREATE TABLE t1 ( a TEXT );
SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' );
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1; --eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/bug58165.txt
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
@@ -2351,6 +2352,15 @@ DROP TABLE t1;
DROP VIEW v1; DROP VIEW v1;
--echo #
--echo # MDEV-28387 UBSAN: runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strtoll10 on SELECT
--echo #
SET @a='-9223372036854775808'; # Quite specific value; considerably varying it will not work
CREATE TABLE t (c1 INT,c2 CHAR);
SELECT SUBSTR(0,@a) FROM t;
DROP TABLE t;
--echo # --echo #
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

81
mysql-test/main/lowercase_table2.result Normal file → Executable file
View File

@@ -357,30 +357,6 @@ drop user 'mysqltest_1'@'localhost';
drop tables a, B; drop tables a, B;
drop database db1; drop database db1;
# #
# MDEV-32026 lowercase_table2.test failures in 11.3
#
CREATE DATABASE Db1;
SHOW CREATE DATABASE Db1;
Database Create Database
Db1 CREATE DATABASE `Db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
USE Db1;
SELECT DATABASE();
DATABASE()
Db1
DROP DATABASE Db1;
CREATE DATABASE Db1;
CREATE FUNCTION Db1.f1() RETURNS INT RETURN 10;
CREATE FUNCTION db1.f2() RETURNS INT RETURN 10;
SELECT db, name FROM mysql.proc WHERE name LIKE '^f[12]';
db name
SELECT Db1.f1();
Db1.f1()
10
SELECT db1.f2();
db1.f2()
10
DROP DATABASE Db1;
#
# MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2 # MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2
# #
CREATE DATABASE `#mysql50#D+b1`; CREATE DATABASE `#mysql50#D+b1`;
@@ -402,8 +378,28 @@ Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci */ db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8mb3 COLLATE utf8mb3_uca1400_ai_ci */
DROP DATABASE Db1; DROP DATABASE Db1;
USE test; USE test;
#
# End of 10.4 tests # End of 10.4 tests
# #
#
# Start of 10.5 tests
#
#
# MDEV-33110 HANDLER commands are case insensitive with lower-case-table-names=0
#
SET sql_mode=ORACLE;
CREATE OR REPLACE PACKAGE test.pkg AS
END TEST.PKG;
$$
DROP PACKAGE test.pkg;
SET sql_mode=DEFAULT;
#
# End of 10.5 tests
#
#
# Start of 11.2 tests
#
#
# MDEV-32973 SHOW TABLES LIKE shows temporary tables with non-matching names # MDEV-32973 SHOW TABLES LIKE shows temporary tables with non-matching names
# #
create temporary table t2 (a int); create temporary table t2 (a int);
@@ -433,12 +429,37 @@ show tables like 't%';
Tables_in_test (t%) Tables_in_test (t%)
t1 t1
t2 t2
drop temporary table t2, T1;
#
# End of 11.2 tests # End of 11.2 tests
# #
# MDEV-33110 HANDLER commands are case insensitive with lower-case-table-names=0
# #
SET sql_mode=ORACLE; # Start of 11.3 tests
CREATE OR REPLACE PACKAGE test.pkg AS #
END TEST.PKG; #
$$ # MDEV-32026 lowercase_table2.test failures in 11.3
DROP PACKAGE test.pkg; #
CREATE DATABASE Db1;
SHOW CREATE DATABASE Db1;
Database Create Database
Db1 CREATE DATABASE `Db1` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */
USE Db1;
SELECT DATABASE();
DATABASE()
Db1
DROP DATABASE Db1;
CREATE DATABASE Db1;
CREATE FUNCTION Db1.f1() RETURNS INT RETURN 10;
CREATE FUNCTION db1.f2() RETURNS INT RETURN 10;
SELECT db, name FROM mysql.proc WHERE name LIKE '^f[12]';
db name
SELECT Db1.f1();
Db1.f1()
10
SELECT db1.f2();
db1.f2()
10
DROP DATABASE Db1;
#
# Start of 11.3 tests
#

View File

@@ -313,6 +313,78 @@ drop user 'mysqltest_1'@'localhost';
drop tables a, B; drop tables a, B;
drop database db1; drop database db1;
--echo #
--echo # MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2
--echo #
CREATE DATABASE `#mysql50#D+b1`;
ALTER DATABASE `#mysql50#D+b1` UPGRADE DATA DIRECTORY NAME;
SHOW CREATE DATABASE `D+b1`;
SHOW CREATE DATABASE `d+b1`;
DROP DATABASE `D+b1`;
CREATE DATABASE Db1;
ALTER DATABASE Db1 DEFAULT CHARACTER SET utf8;
SHOW CREATE DATABASE Db1;
SHOW CREATE DATABASE db1;
DROP DATABASE Db1;
USE test;
--echo #
--echo # End of 10.4 tests
--echo #
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-33110 HANDLER commands are case insensitive with lower-case-table-names=0
--echo #
SET sql_mode=ORACLE;
DELIMITER $$;
CREATE OR REPLACE PACKAGE test.pkg AS
END TEST.PKG;
$$
DELIMITER ;$$
DROP PACKAGE test.pkg;
SET sql_mode=DEFAULT;
--echo #
--echo # End of 10.5 tests
--echo #
--echo #
--echo # Start of 11.2 tests
--echo #
--echo #
--echo # MDEV-32973 SHOW TABLES LIKE shows temporary tables with non-matching names
--echo #
# temp tables don't preserve the letter case despite lower-case-table-names=2
create temporary table t2 (a int);
create temporary table T1 (a int);
show tables;
show tables like 't1';
show tables like 'T1';
select table_name from information_schema.tables where table_schema='test'
and table_name='t1';
select table_name from information_schema.tables where table_schema='test'
and table_name='T1';
show tables like '_1';
show tables like 't%';
drop temporary table t2, T1;
--echo #
--echo # End of 11.2 tests
--echo #
--echo #
--echo # Start of 11.3 tests
--echo #
--echo # --echo #
--echo # MDEV-32026 lowercase_table2.test failures in 11.3 --echo # MDEV-32026 lowercase_table2.test failures in 11.3
@@ -332,53 +404,6 @@ SELECT Db1.f1();
SELECT db1.f2(); SELECT db1.f2();
DROP DATABASE Db1; DROP DATABASE Db1;
--echo # --echo #
--echo # MDEV-32025 Crashes in MDL_key::mdl_key_init with lower-case-table-names=2 --echo # Start of 11.3 tests
--echo # --echo #
CREATE DATABASE `#mysql50#D+b1`;
ALTER DATABASE `#mysql50#D+b1` UPGRADE DATA DIRECTORY NAME;
SHOW CREATE DATABASE `D+b1`;
SHOW CREATE DATABASE `d+b1`;
DROP DATABASE `D+b1`;
CREATE DATABASE Db1;
ALTER DATABASE Db1 DEFAULT CHARACTER SET utf8;
SHOW CREATE DATABASE Db1;
SHOW CREATE DATABASE db1;
DROP DATABASE Db1;
USE test;
--echo # End of 10.4 tests
--echo #
--echo # MDEV-32973 SHOW TABLES LIKE shows temporary tables with non-matching names
--echo #
# temp tables don't preserve the letter case despite lower-case-table-names=2
create temporary table t2 (a int);
create temporary table T1 (a int);
show tables;
show tables like 't1';
show tables like 'T1';
select table_name from information_schema.tables where table_schema='test'
and table_name='t1';
select table_name from information_schema.tables where table_schema='test'
and table_name='T1';
show tables like '_1';
show tables like 't%';
--echo # End of 11.2 tests
--echo #
--echo # MDEV-33110 HANDLER commands are case insensitive with lower-case-table-names=0
--echo #
SET sql_mode=ORACLE;
DELIMITER $$;
CREATE OR REPLACE PACKAGE test.pkg AS
END TEST.PKG;
$$
DELIMITER ;$$
DROP PACKAGE test.pkg;

View File

@@ -48,6 +48,9 @@ DROP PROCEDURE SP;
# End of 10.4 tests # End of 10.4 tests
# #
# #
# Start of 10.5 tests
#
#
# MDEV-33084 LASTVAL(t1) and LASTVAL(T1) do not work well with lower-case-table-names=0 # MDEV-33084 LASTVAL(t1) and LASTVAL(T1) do not work well with lower-case-table-names=0
# #
CREATE SEQUENCE t1; CREATE SEQUENCE t1;
@@ -183,4 +186,6 @@ CREATE TABLE MYSQL.transaction_registry (a INT);
INSERT INTO MYSQL.transaction_registry VALUES (1),(2); INSERT INTO MYSQL.transaction_registry VALUES (1),(2);
DROP TABLE MYSQL.transaction_registry; DROP TABLE MYSQL.transaction_registry;
DROP DATABASE MYSQL; DROP DATABASE MYSQL;
# End of 11.5 tests #
# End of 10.5 tests
#

View File

@@ -50,6 +50,9 @@ DROP PROCEDURE SP;
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #
--echo #
--echo # Start of 10.5 tests
--echo #
--echo # --echo #
--echo # MDEV-33084 LASTVAL(t1) and LASTVAL(T1) do not work well with lower-case-table-names=0 --echo # MDEV-33084 LASTVAL(t1) and LASTVAL(T1) do not work well with lower-case-table-names=0
@@ -181,4 +184,6 @@ INSERT INTO MYSQL.transaction_registry VALUES (1),(2);
DROP TABLE MYSQL.transaction_registry; DROP TABLE MYSQL.transaction_registry;
DROP DATABASE MYSQL; DROP DATABASE MYSQL;
--echo # End of 11.5 tests --echo #
--echo # End of 10.5 tests
--echo #

View File

@@ -137,6 +137,10 @@ c int(11) YES NULL
drop table t1; drop table t1;
1 1
1 1
--------------
use
--------------
ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
ERROR at line 1: USE must be followed by a database name ERROR at line 1: USE must be followed by a database name
1 +1 1 +1
@@ -166,6 +170,10 @@ count(*)
drop table t17583; drop table t17583;
Test connect without db- or host-name => reconnect Test connect without db- or host-name => reconnect
Test connect with dbname only => new dbname, old hostname Test connect with dbname only => new dbname, old hostname
--------------
connecttest
--------------
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'connecttest' at line 1 ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'connecttest' at line 1
Test connect with _invalid_ dbname only => new invalid dbname, old hostname Test connect with _invalid_ dbname only => new invalid dbname, old hostname
ERROR 1049 (42000) at line 1: Unknown database 'invalid' ERROR 1049 (42000) at line 1: Unknown database 'invalid'
@@ -662,6 +670,17 @@ tee
source source
^^^ ^^^
3 3
#
# MDEV-34203: Sandbox mode \- is not compatible with --binary-mode
#
create table t1 (a int);
drop table t1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
# End of 10.5 tests # End of 10.5 tests
# #
# MDEV-30327 Client crashes in print_last_query_cost # MDEV-30327 Client crashes in print_last_query_cost

View File

@@ -756,6 +756,22 @@ source $MYSQL_TMP_DIR/mysql_in;" $MYSQL_TMP_DIR/mysql_in2;
--remove_file $MYSQL_TMP_DIR/mysql_in --remove_file $MYSQL_TMP_DIR/mysql_in
--remove_file $MYSQL_TMP_DIR/mysql_in2 --remove_file $MYSQL_TMP_DIR/mysql_in2
--echo #
--echo # MDEV-34203: Sandbox mode \- is not compatible with --binary-mode
--echo #
create table t1 (a int);
--exec $MYSQL_DUMP test t1 > $MYSQLTEST_VARDIR/tmp/MDEV-34203.sql
drop table t1;
--exec $MYSQL --binary-mode test 2>&1 < $MYSQLTEST_VARDIR/tmp/MDEV-34203.sql
show create table t1;
drop table t1;
--remove_file $MYSQLTEST_VARDIR/tmp/MDEV-34203.sql
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo # --echo #

View File

@@ -6491,14 +6491,6 @@ Table Create Table
s4 CREATE SEQUENCE `s4` start with 400 minvalue 400 maxvalue 1400 increment by 40 cache 1000 cycle ENGINE=MyISAM s4 CREATE SEQUENCE `s4` start with 400 minvalue 400 maxvalue 1400 increment by 40 cache 1000 cycle ENGINE=MyISAM
# Dump sequence without `--no-data` # Dump sequence without `--no-data`
# Restore from mysqldump # Restore from mysqldump
SETVAL(`s1`, 1101, 0)
1101
SETVAL(`s2`, 1201, 0)
1201
SETVAL(`s3`, 1301, 0)
1301
SETVAL(`s4`, 1401, 0)
1401
# Show create after restore # Show create after restore
show create sequence d.s1; show create sequence d.s1;
Table Create Table Table Create Table
@@ -6517,14 +6509,6 @@ NEXTVAL(d.s1) NEXTVAL(d.s2) NEXTVAL(d.s3) NEXTVAL(d.s4)
100 200 300 400 100 200 300 400
# Dump sequence with `--no-data` # Dump sequence with `--no-data`
# Restore from mysqldump # Restore from mysqldump
SETVAL(`s1`, 1101, 0)
1101
SETVAL(`s2`, 1201, 0)
1201
SETVAL(`s3`, 1301, 0)
1301
SETVAL(`s4`, 1401, 0)
1401
# Show create after restore `--no-data` # Show create after restore `--no-data`
show create sequence d.s1; show create sequence d.s1;
Table Create Table Table Create Table
@@ -6543,14 +6527,6 @@ NEXTVAL(d.s1) NEXTVAL(d.s2) NEXTVAL(d.s3) NEXTVAL(d.s4)
100 200 300 400 100 200 300 400
# Restore to different database than original # Restore to different database than original
create database d2; create database d2;
SETVAL(`s1`, 1101, 0)
1101
SETVAL(`s2`, 1201, 0)
1201
SETVAL(`s3`, 1301, 0)
1301
SETVAL(`s4`, 1401, 0)
1401
show create sequence d2.s1; show create sequence d2.s1;
Table Create Table Table Create Table
s1 CREATE SEQUENCE `s1` start with 100 minvalue 100 maxvalue 1100 increment by 10 cache 1000 cycle ENGINE=MyISAM s1 CREATE SEQUENCE `s1` start with 100 minvalue 100 maxvalue 1100 increment by 10 cache 1000 cycle ENGINE=MyISAM
@@ -6578,9 +6554,15 @@ j integer
INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4); INSERT INTO t VALUES (1,1),(2,2),(3,3),(4,4);
# Dump database 1 # Dump database 1
# Restore from database 1 to database 2 # Restore from database 1 to database 2
--------------
INSERT INTO `t` VALUES
(1,1),
(2,2),
(3,3),
(4,4)
--------------
ERROR 1100 (HY000) at line 46: Table 'seq_t_i' was not locked with LOCK TABLES ERROR 1100 (HY000) at line 46: Table 'seq_t_i' was not locked with LOCK TABLES
SETVAL(`seq_t_i`, 1, 0)
1
DROP DATABASE IF EXISTS test1; DROP DATABASE IF EXISTS test1;
DROP DATABASE IF EXISTS test2; DROP DATABASE IF EXISTS test2;
# #

View File

@@ -89,3 +89,32 @@ f
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t1; DROP TABLE t1;
# End of 10.4 tests # End of 10.4 tests
#
# MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT
#
CREATE OR REPLACE TABLE t1(a INT);
PREPARE stmt FROM 'SELECT 1 FROM t1 WHERE ROWNUM() < 2';
EXECUTE stmt;
1
EXECUTE stmt;
1
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
PREPARE stmt FROM 'SELECT * FROM t1 WHERE ROWNUM() < ?';
# Expected output is two rows (1), (2)
EXECUTE stmt USING 3;
a
1
2
# Expected output is one row (1)
EXECUTE stmt USING 2;
a
1
# Expected output is three rows (1), (2), (3)
EXECUTE stmt USING 4;
a
1
2
# Clean up
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 10.6 tests

View File

@@ -110,3 +110,27 @@ DEALLOCATE PREPARE stmt;
DROP TABLE t1; DROP TABLE t1;
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo #
--echo # MDEV-33769: Memory leak found in the test main.rownum run with --ps-protocol against a server built with the option -DWITH_PROTECT_STATEMENT_MEMROOT
--echo #
CREATE OR REPLACE TABLE t1(a INT);
PREPARE stmt FROM 'SELECT 1 FROM t1 WHERE ROWNUM() < 2';
EXECUTE stmt;
EXECUTE stmt;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
PREPARE stmt FROM 'SELECT * FROM t1 WHERE ROWNUM() < ?';
--echo # Expected output is two rows (1), (2)
EXECUTE stmt USING 3;
--echo # Expected output is one row (1)
EXECUTE stmt USING 2;
--echo # Expected output is three rows (1), (2), (3)
EXECUTE stmt USING 4;
--echo # Clean up
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
--echo # End of 10.6 tests

View File

@@ -3,7 +3,7 @@ set @save_query_cache_type=@@global.query_cache_type;
SET GLOBAL query_cache_type=ON; SET GLOBAL query_cache_type=ON;
SET LOCAL query_cache_type=ON; SET LOCAL query_cache_type=ON;
SET @@global.query_cache_size=1355776; SET @@global.query_cache_size=1355776;
flush status; flush global status;
select count(*) from t00; select count(*) from t00;
count(*) count(*)
514 514

View File

@@ -18,7 +18,7 @@ SET @@global.query_cache_size=1355776;
# more then 255 (257) merged tables test # more then 255 (257) merged tables test
# #
flush status; flush global status;
disable_query_log; disable_query_log;
--disable_warnings --disable_warnings
let $1 = 257; let $1 = 257;

View File

@@ -1171,7 +1171,7 @@ SET j= 1 + i;
END| END|
CALL ctest(); CALL ctest();
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: 'string ' Warning 1292 Truncated incorrect DOUBLE value: 'string'
DROP PROCEDURE ctest; DROP PROCEDURE ctest;
CREATE PROCEDURE vctest() CREATE PROCEDURE vctest()
BEGIN BEGIN

View File

@@ -83,121 +83,3 @@ variable_value < 1024*1024*1024
# #
# End of 10.2 tests # End of 10.2 tests
# #
#
# MDEV-32441 SENT_ROWS shows random wrong values when stored function
# is selected
#
create table t1 (a int) engine=aria;
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
flush status;
create function if not exists f() returns int return
(
select sum(a) > 0 from t1
);
select f() from seq_1_to_10 where seq%5 = 0;
f()
1
1
show status like "rows_sent";
Variable_name Value
Rows_sent 2
# Test simple query
set debug_sync='RESET';
connect con1,localhost,root,,;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
select f() from seq_1_to_10 where seq%5 = 0;
connection default;
set debug_sync='now WAIT_FOR parked';
# Result should be 2, 10+7*2=24
select sent_rows, examined_rows from information_schema.processlist where id=#;
sent_rows examined_rows
2 24
set debug_sync='now signal go';
connection con1;
f()
1
1
# Test union
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
select a from t1 where a not in (1,2,3,4) union select a from t1 where a not in (4,5,6,7);
connection default;
set debug_sync='now WAIT_FOR parked';
# Result should be 6, 7+7+6=20 (2 scans of 7 rows + 6 rows in union)
select sent_rows, examined_rows from information_schema.processlist where id=#;
sent_rows examined_rows
6 20
set debug_sync='now signal go';
connection con1;
a
5
6
7
1
2
3
# Test handler calls
handler t1 open;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
handler t1 read NEXT LIMIT 2,4;
connection default;
set debug_sync='now WAIT_FOR parked';
# Result should be 2, 10+7*2=24
select sent_rows, examined_rows from information_schema.processlist where id=#;
sent_rows examined_rows
4 6
set debug_sync='now signal go';
connection con1;
a
3
4
5
6
handler t1 close;
connection default;
drop function f;
drop table t1;
# Test Stored procedures
create or replace table t (a int primary key);
insert into t select seq from seq_1_to_100;
create procedure pr()
begin
select * from t where a between 1 and 2 ;
select * from t where a between 4 and 6 ;
end $
connection con1;
flush status;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go EXECUTE 2';
call pr();
connection default;
set debug_sync='now WAIT_FOR parked';
select examined_rows, sent_rows, info from information_schema.processlist where id=#;
examined_rows sent_rows info
2 2 select * from t where a between 1 and 2
set debug_sync='now signal go';
select examined_rows, sent_rows, info from information_schema.processlist where id=#;
examined_rows sent_rows info
3 3 select * from t where a between 4 and 6
set debug_sync='now signal go';
connection con1;
a
1
2
a
4
5
6
show status like '%rows%';
Variable_name Value
Not_flushed_delayed_rows 0
Rows_read 8
Rows_sent 5
Rows_tmp_read 0
Sort_rows 0
connection default;
drop table t;
drop procedure pr;
disconnect con1;
set debug_sync= RESET;
#
# End of 11.3 tests
#

View File

@@ -1,7 +1,4 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_sequence.inc
--source include/have_debug_sync.inc
--source include/have_sequence.inc
--echo # --echo #
--echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines --echo # Bug#24289 Status Variable "Questions" gets wrong values with Stored Routines
@@ -79,113 +76,3 @@ select variable_value < 1024*1024*1024 from information_schema.global_status whe
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
--echo #
--echo # MDEV-32441 SENT_ROWS shows random wrong values when stored function
--echo # is selected
--echo #
create table t1 (a int) engine=aria;
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
flush status;
create function if not exists f() returns int return
(
select sum(a) > 0 from t1
);
--disable_ps_protocol
select f() from seq_1_to_10 where seq%5 = 0;
show status like "rows_sent";
--enable_ps_protocol
--echo # Test simple query
set debug_sync='RESET';
--connect(con1,localhost,root,,)
--let $conid= `select connection_id()`
--let $replace_conid=id=$conid
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
--send select f() from seq_1_to_10 where seq%5 = 0
--connection default
set debug_sync='now WAIT_FOR parked';
--echo # Result should be 2, 10+7*2=24
--replace_result $replace_conid id=#
eval select sent_rows, examined_rows from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--connection con1
--reap
--echo # Test union
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
--send select a from t1 where a not in (1,2,3,4) union select a from t1 where a not in (4,5,6,7)
--connection default
set debug_sync='now WAIT_FOR parked';
--echo # Result should be 6, 7+7+6=20 (2 scans of 7 rows + 6 rows in union)
--replace_result $replace_conid id=#
eval select sent_rows, examined_rows from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--connection con1
--reap
--echo # Test handler calls
handler t1 open;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
--send handler t1 read NEXT LIMIT 2,4
--connection default
set debug_sync='now WAIT_FOR parked';
--echo # Result should be 2, 10+7*2=24
--replace_result $replace_conid id=#
eval select sent_rows, examined_rows from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--connection con1
--reap
handler t1 close;
--connection default
drop function f;
drop table t1;
--echo # Test Stored procedures
create or replace table t (a int primary key);
insert into t select seq from seq_1_to_100;
--delimiter $
create procedure pr()
begin
select * from t where a between 1 and 2 ;
select * from t where a between 4 and 6 ;
end $
--delimiter ;
--connection con1
flush status;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go EXECUTE 2';
--send call pr()
--connection default
set debug_sync='now WAIT_FOR parked';
--replace_result $replace_conid id=#
eval select examined_rows, sent_rows, info from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--replace_result $replace_conid id=#
eval select examined_rows, sent_rows, info from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--connection con1
--reap
show status like '%rows%';
connection default;
# Cleanup
drop table t;
drop procedure pr;
--disconnect con1
set debug_sync= RESET;
--echo #
--echo # End of 11.3 tests
--echo #

View File

@@ -0,0 +1,119 @@
#
# MDEV-32441 SENT_ROWS shows random wrong values when stored function
# is selected
#
create table t1 (a int) engine=aria;
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
flush status;
create function if not exists f() returns int return
(
select sum(a) > 0 from t1
);
select f() from seq_1_to_10 where seq%5 = 0;
f()
1
1
show status like "rows_sent";
Variable_name Value
Rows_sent 2
# Test simple query
set debug_sync='RESET';
connect con1,localhost,root,,;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
select f() from seq_1_to_10 where seq%5 = 0;
connection default;
set debug_sync='now WAIT_FOR parked';
# Result should be 2, 10+7*2=24
select sent_rows, examined_rows from information_schema.processlist where id=#;
sent_rows examined_rows
2 24
set debug_sync='now signal go';
connection con1;
f()
1
1
# Test union
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
select a from t1 where a not in (1,2,3,4) union select a from t1 where a not in (4,5,6,7);
connection default;
set debug_sync='now WAIT_FOR parked';
# Result should be 6, 7+7+6=20 (2 scans of 7 rows + 6 rows in union)
select sent_rows, examined_rows from information_schema.processlist where id=#;
sent_rows examined_rows
6 20
set debug_sync='now signal go';
connection con1;
a
5
6
7
1
2
3
# Test handler calls
handler t1 open;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
handler t1 read NEXT LIMIT 2,4;
connection default;
set debug_sync='now WAIT_FOR parked';
# Result should be 2, 10+7*2=24
select sent_rows, examined_rows from information_schema.processlist where id=#;
sent_rows examined_rows
4 6
set debug_sync='now signal go';
connection con1;
a
3
4
5
6
handler t1 close;
connection default;
drop function f;
drop table t1;
# Test Stored procedures
create or replace table t (a int primary key);
insert into t select seq from seq_1_to_100;
create procedure pr()
begin
select * from t where a between 1 and 2 ;
select * from t where a between 4 and 6 ;
end $
connection con1;
flush status;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go EXECUTE 2';
call pr();
connection default;
set debug_sync='now WAIT_FOR parked';
select examined_rows, sent_rows, info from information_schema.processlist where id=#;
examined_rows sent_rows info
2 2 select * from t where a between 1 and 2
set debug_sync='now signal go';
set debug_sync='now WAIT_FOR parked';
select examined_rows, sent_rows, info from information_schema.processlist where id=#;
examined_rows sent_rows info
3 3 select * from t where a between 4 and 6
set debug_sync='now signal go';
connection con1;
a
1
2
a
4
5
6
show status like '%rows%';
Variable_name Value
Not_flushed_delayed_rows 0
Rows_read 8
Rows_sent 5
Rows_tmp_read 0
Sort_rows 0
connection default;
drop table t;
drop procedure pr;
disconnect con1;
set debug_sync= RESET;
#
# End of 11.3 tests
#

View File

@@ -0,0 +1,115 @@
--source include/not_embedded.inc
--source include/have_debug_sync.inc
--source include/have_sequence.inc
--echo #
--echo # MDEV-32441 SENT_ROWS shows random wrong values when stored function
--echo # is selected
--echo #
create table t1 (a int) engine=aria;
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
flush status;
create function if not exists f() returns int return
(
select sum(a) > 0 from t1
);
--disable_ps_protocol
select f() from seq_1_to_10 where seq%5 = 0;
show status like "rows_sent";
--enable_ps_protocol
--echo # Test simple query
set debug_sync='RESET';
--connect(con1,localhost,root,,)
--let $conid= `select connection_id()`
--let $replace_conid=id=$conid
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
--send select f() from seq_1_to_10 where seq%5 = 0
--connection default
set debug_sync='now WAIT_FOR parked';
--echo # Result should be 2, 10+7*2=24
--replace_result $replace_conid id=#
eval select sent_rows, examined_rows from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--connection con1
--reap
--echo # Test union
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
--send select a from t1 where a not in (1,2,3,4) union select a from t1 where a not in (4,5,6,7)
--connection default
set debug_sync='now WAIT_FOR parked';
--echo # Result should be 6, 7+7+6=20 (2 scans of 7 rows + 6 rows in union)
--replace_result $replace_conid id=#
eval select sent_rows, examined_rows from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--connection con1
--reap
--echo # Test handler calls
handler t1 open;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go';
--send handler t1 read NEXT LIMIT 2,4
--connection default
set debug_sync='now WAIT_FOR parked';
--echo # Result should be 2, 10+7*2=24
--replace_result $replace_conid id=#
eval select sent_rows, examined_rows from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--connection con1
--reap
handler t1 close;
--connection default
drop function f;
drop table t1;
--echo # Test Stored procedures
create or replace table t (a int primary key);
insert into t select seq from seq_1_to_100;
--delimiter $
create procedure pr()
begin
select * from t where a between 1 and 2 ;
select * from t where a between 4 and 6 ;
end $
--delimiter ;
--connection con1
flush status;
set debug_sync='end_of_statement SIGNAL parked WAIT_FOR go EXECUTE 2';
--send call pr()
--connection default
set debug_sync='now WAIT_FOR parked';
--replace_result $replace_conid id=#
eval select examined_rows, sent_rows, info from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
set debug_sync='now WAIT_FOR parked';
--replace_result $replace_conid id=#
eval select examined_rows, sent_rows, info from information_schema.processlist where id=$conid;
set debug_sync='now signal go';
--connection con1
--reap
show status like '%rows%';
connection default;
# Cleanup
drop table t;
drop procedure pr;
--disconnect con1
set debug_sync= RESET;
--echo #
--echo # End of 11.3 tests
--echo #

View File

@@ -0,0 +1,40 @@
#
# Start of 10.5 tests
#
#
# MDEV-34295 CAST(char_col AS DOUBLE) prints redundant spaces in a warning
#
CREATE TABLE t1 (a CHAR(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci);
INSERT INTO t1 VALUES ('1x'), ('x');
SELECT a, CAST(a AS DOUBLE) FROM t1 ORDER BY a;
a CAST(a AS DOUBLE)
1x 1
x 0
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1x'
Warning 1292 Truncated incorrect DOUBLE value: 'x'
SELECT a, CAST(a AS DECIMAL(20,2)) FROM t1 ORDER BY a;
a CAST(a AS DECIMAL(20,2))
1x 1.00
x 0.00
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '1x'
Warning 1292 Truncated incorrect DECIMAL value: 'x'
SELECT a, CAST(a AS SIGNED) FROM t1 ORDER BY a;
a CAST(a AS SIGNED)
1x 1
x 0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '1x'
Warning 1292 Truncated incorrect INTEGER value: 'x'
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY a;
a CAST(a AS UNSIGNED)
1x 1
x 0
Warnings:
Warning 1292 Truncated incorrect INTEGER value: '1x'
Warning 1292 Truncated incorrect INTEGER value: 'x'
DROP TABLE t1;
#
# End of 10.5 tests
#

View File

@@ -0,0 +1,19 @@
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-34295 CAST(char_col AS DOUBLE) prints redundant spaces in a warning
--echo #
CREATE TABLE t1 (a CHAR(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci);
INSERT INTO t1 VALUES ('1x'), ('x');
SELECT a, CAST(a AS DOUBLE) FROM t1 ORDER BY a;
SELECT a, CAST(a AS DECIMAL(20,2)) FROM t1 ORDER BY a;
SELECT a, CAST(a AS SIGNED) FROM t1 ORDER BY a;
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY a;
DROP TABLE t1;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@@ -465,7 +465,7 @@ a (a + 0)
t 0 t 0
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: '1a' Warning 1292 Truncated incorrect DOUBLE value: '1a'
Warning 1292 Truncated incorrect DOUBLE value: 't ' Warning 1292 Truncated incorrect DOUBLE value: 't'
SELECT a,(a DIV 2) FROM t1 ORDER BY a; SELECT a,(a DIV 2) FROM t1 ORDER BY a;
a (a DIV 2) a (a DIV 2)
10 5 10 5
@@ -476,7 +476,7 @@ a (a DIV 2)
t 0 t 0
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: '1a' Warning 1292 Truncated incorrect DECIMAL value: '1a'
Warning 1292 Truncated incorrect DECIMAL value: 't ' Warning 1292 Truncated incorrect DECIMAL value: 't'
SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a; SELECT a,CAST(a AS SIGNED) FROM t1 ORDER BY a;
a CAST(a AS SIGNED) a CAST(a AS SIGNED)
10 10 10 10
@@ -508,8 +508,8 @@ SELECT 5 = a FROM t1;
0 0
0 0
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: 's ' Warning 1292 Truncated incorrect DECIMAL value: 's'
Warning 1292 Truncated incorrect DECIMAL value: ' ' Warning 1292 Truncated incorrect DECIMAL value: ''
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535 # MDEV-13530 VARBINARY doesn't convert to to BLOB for sizes 65533, 65534 and 65535

View File

@@ -1948,22 +1948,6 @@ connection default;
drop user user_11766767; drop user user_11766767;
drop database mysqltest1; drop database mysqltest1;
drop database mysqltest2; drop database mysqltest2;
# Check that a user without access to the schema 'foo' cannot query
# a JSON_TABLE view in that schema.
CREATE SCHEMA foo;
CREATE VIEW foo.v AS SELECT * FROM JSON_TABLE('[1,2,3]', '$[*]' COLUMNS (num INT PATH '$[0]')) AS jt;
CREATE USER foo@localhost;
GRANT SELECT on test.* to foo@localhost;
connect con1,localhost,foo,,;
SELECT * FROM foo.v;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `foo`.`v`
#
# Clean-up.
#
connection default;
disconnect con1;
drop user foo@localhost;
drop schema foo;
# #
# MDEV-33119 User is case insensitive in INFORMATION_SCHEMA.VIEWS # MDEV-33119 User is case insensitive in INFORMATION_SCHEMA.VIEWS
# #
@@ -1995,3 +1979,21 @@ connection default;
DROP VIEW v1; DROP VIEW v1;
DROP USER foo; DROP USER foo;
DROP USER FOO; DROP USER FOO;
# End of 10.5 tests
# Check that a user without access to the schema 'foo' cannot query
# a JSON_TABLE view in that schema.
CREATE SCHEMA foo;
CREATE VIEW foo.v AS SELECT * FROM JSON_TABLE('[1,2,3]', '$[*]' COLUMNS (num INT PATH '$[0]')) AS jt;
CREATE USER foo@localhost;
GRANT SELECT on test.* to foo@localhost;
connect con1,localhost,foo,,;
SELECT * FROM foo.v;
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table `foo`.`v`
#
# Clean-up.
#
connection default;
disconnect con1;
drop user foo@localhost;
drop schema foo;
# End of 10.6 tests

View File

@@ -2207,28 +2207,6 @@ drop user user_11766767;
drop database mysqltest1; drop database mysqltest1;
drop database mysqltest2; drop database mysqltest2;
--echo # Check that a user without access to the schema 'foo' cannot query
--echo # a JSON_TABLE view in that schema.
CREATE SCHEMA foo;
CREATE VIEW foo.v AS SELECT * FROM JSON_TABLE('[1,2,3]', '$[*]' COLUMNS (num INT PATH '$[0]')) AS jt;
CREATE USER foo@localhost;
GRANT SELECT on test.* to foo@localhost;
connect (con1,localhost,foo,,);
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM foo.v;
--echo #
--echo # Clean-up.
--echo #
connection default;
disconnect con1;
drop user foo@localhost;
drop schema foo;
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
--echo # --echo #
--echo # MDEV-33119 User is case insensitive in INFORMATION_SCHEMA.VIEWS --echo # MDEV-33119 User is case insensitive in INFORMATION_SCHEMA.VIEWS
--echo # --echo #
@@ -2255,3 +2233,28 @@ SELECT CURRENT_USER;
DROP VIEW v1; DROP VIEW v1;
DROP USER foo; DROP USER foo;
DROP USER FOO; DROP USER FOO;
--echo # End of 10.5 tests
--echo # Check that a user without access to the schema 'foo' cannot query
--echo # a JSON_TABLE view in that schema.
CREATE SCHEMA foo;
CREATE VIEW foo.v AS SELECT * FROM JSON_TABLE('[1,2,3]', '$[*]' COLUMNS (num INT PATH '$[0]')) AS jt;
CREATE USER foo@localhost;
GRANT SELECT on test.* to foo@localhost;
connect (con1,localhost,foo,,);
--error ER_TABLEACCESS_DENIED_ERROR
SELECT * FROM foo.v;
--echo #
--echo # Clean-up.
--echo #
connection default;
disconnect con1;
drop user foo@localhost;
drop schema foo;
--echo # End of 10.6 tests
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc

View File

@@ -4515,6 +4515,180 @@ row_number() OVER (order by a)
3 3
drop table t1; drop table t1;
# #
# MDEV-29307: join of 2 derived tables over the same grouping view such
# that the first of the joined tables contains a window
# function and the view's specification contains a subquery
# with a set function aggregated on the top level
#
CREATE TABLE t1 (
tst int NOT NULL,
flat tinyint unsigned NOT NULL,
type tinyint unsigned NOT NULL,
val int NOT NULL,
PRIMARY KEY (tst,flat,type)
) ENGINE=ARIA;
INSERT INTO t1 VALUES
(5, 20, 2, 100),
(7, 20, 2, 150),
(9, 20, 1, 200);
CREATE VIEW v1 AS (
SELECT
flat,
type,
( SELECT val FROM t1 sw
WHERE sw.tst = MAX(w.tst) AND sw.flat = w.flat AND sw.type = w.type)
AS total
FROM t1 w
GROUP BY flat, type
);
EXPLAIN EXTENDED SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived6> ref key0 key0 1 v1.flat 1 100.00 Using where
6 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using where; Using index; Using temporary; Using filesort
7 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
4 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using where; Using index; Using temporary; Using filesort
5 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
Warnings:
Note 1276 Field or reference 'test.w.tst' of SELECT #5 was resolved in SELECT #4
Note 1981 Aggregate function 'max()' of SELECT #5 belongs to SELECT #4
Note 1276 Field or reference 'test.w.flat' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.type' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.tst' of SELECT #7 was resolved in SELECT #6
Note 1981 Aggregate function 'max()' of SELECT #7 belongs to SELECT #6
Note 1276 Field or reference 'test.w.flat' of SELECT #7 was resolved in SELECT #6
Note 1276 Field or reference 'test.w.type' of SELECT #7 was resolved in SELECT #6
Note 1003 /* select#1 */ select `v1`.`total` AS `w2_total`,`v1`.`total` AS `w1_total` from `test`.`v1` join `test`.`v1` where `v1`.`flat` = `v1`.`flat` and `v1`.`type` = 2 and `v1`.`type` = 1
SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
w2_total w1_total
150 200
EXPLAIN EXTENDED SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY type ORDER BY type) AS u
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived6> ref key0 key0 1 w1.flat 1 100.00 Using where
6 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using where; Using index; Using temporary; Using filesort
7 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
2 DERIVED <derived4> ALL NULL NULL NULL NULL 3 100.00 Using where; Using temporary
4 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using where; Using index; Using temporary; Using filesort
5 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
Warnings:
Note 1276 Field or reference 'test.w.tst' of SELECT #5 was resolved in SELECT #4
Note 1981 Aggregate function 'max()' of SELECT #5 belongs to SELECT #4
Note 1276 Field or reference 'test.w.flat' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.type' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.tst' of SELECT #7 was resolved in SELECT #6
Note 1981 Aggregate function 'max()' of SELECT #7 belongs to SELECT #6
Note 1276 Field or reference 'test.w.flat' of SELECT #7 was resolved in SELECT #6
Note 1276 Field or reference 'test.w.type' of SELECT #7 was resolved in SELECT #6
Note 1003 /* select#1 */ select `v1`.`total` AS `w2_total`,`w1`.`total` AS `w1_total` from (/* select#2 */ select `v1`.`flat` AS `flat`,`v1`.`type` AS `type`,`v1`.`total` AS `total`,count(`v1`.`total`) over ( partition by `v1`.`type` order by `v1`.`type`) AS `u` from `test`.`v1` where `v1`.`type` = 1) `w1` join `test`.`v1` where `v1`.`flat` = `w1`.`flat` and `v1`.`type` = 2
SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY type ORDER BY type) AS u
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
w2_total w1_total
150 200
EXPLAIN EXTENDED SELECT w2.total AS w2_total, w1.total AS w1_total, u
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY flat ORDER BY flat) AS u
FROM v1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
) AS w2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
6 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using index; Using temporary; Using filesort
7 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
2 DERIVED <derived4> ALL NULL NULL NULL NULL 3 100.00 Using temporary
4 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using index; Using temporary; Using filesort
5 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
Warnings:
Note 1276 Field or reference 'test.w.tst' of SELECT #5 was resolved in SELECT #4
Note 1981 Aggregate function 'max()' of SELECT #5 belongs to SELECT #4
Note 1276 Field or reference 'test.w.flat' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.type' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.tst' of SELECT #7 was resolved in SELECT #6
Note 1981 Aggregate function 'max()' of SELECT #7 belongs to SELECT #6
Note 1276 Field or reference 'test.w.flat' of SELECT #7 was resolved in SELECT #6
Note 1276 Field or reference 'test.w.type' of SELECT #7 was resolved in SELECT #6
Note 1003 /* select#1 */ select `v1`.`total` AS `w2_total`,`w1`.`total` AS `w1_total`,`w1`.`u` AS `u` from (/* select#2 */ select `v1`.`flat` AS `flat`,`v1`.`type` AS `type`,`v1`.`total` AS `total`,count(`v1`.`total`) over ( partition by `v1`.`flat` order by `v1`.`flat`) AS `u` from `test`.`v1`) `w1` join `test`.`v1`
SELECT w2.total AS w2_total, w1.total AS w1_total, u
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY flat ORDER BY flat) AS u
FROM v1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
) AS w2;
w2_total w1_total u
150 150 2
150 200 2
200 150 2
200 200 2
DROP VIEW v1;
DROP TABLE t1;
# End of 10.5 tests
#
# MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER # MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER
# #
CREATE TABLE t(c1 INT); CREATE TABLE t(c1 INT);

View File

@@ -2886,6 +2886,99 @@ insert into t1 values (1),(2),(3);
SELECT row_number() OVER (order by a) FROM t1 order by NAME_CONST('myname',NULL); SELECT row_number() OVER (order by a) FROM t1 order by NAME_CONST('myname',NULL);
drop table t1; drop table t1;
--echo #
--echo # MDEV-29307: join of 2 derived tables over the same grouping view such
--echo # that the first of the joined tables contains a window
--echo # function and the view's specification contains a subquery
--echo # with a set function aggregated on the top level
--echo #
CREATE TABLE t1 (
tst int NOT NULL,
flat tinyint unsigned NOT NULL,
type tinyint unsigned NOT NULL,
val int NOT NULL,
PRIMARY KEY (tst,flat,type)
) ENGINE=ARIA;
INSERT INTO t1 VALUES
(5, 20, 2, 100),
(7, 20, 2, 150),
(9, 20, 1, 200);
CREATE VIEW v1 AS (
SELECT
flat,
type,
( SELECT val FROM t1 sw
WHERE sw.tst = MAX(w.tst) AND sw.flat = w.flat AND sw.type = w.type)
AS total
FROM t1 w
GROUP BY flat, type
);
let $q1=
SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
eval EXPLAIN EXTENDED $q1;
eval $q1;
let $q2=
SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY type ORDER BY type) AS u
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
eval EXPLAIN EXTENDED $q2;
eval $q2;
let $q3=
SELECT w2.total AS w2_total, w1.total AS w1_total, u
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY flat ORDER BY flat) AS u
FROM v1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
) AS w2;
eval EXPLAIN EXTENDED $q3;
--sorted_result
eval $q3;
DROP VIEW v1;
DROP TABLE t1;
--echo # End of 10.5 tests
--echo # --echo #
--echo # MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER --echo # MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER
--echo # --echo #

View File

@@ -991,20 +991,20 @@ CALL spxml('<a><b>b1</b><b>b2</b></a>', '1 and string');
ExtractValue(xml,'/a/b[$i]') ExtractValue(xml,'/a/b[$i]')
b1 b1
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: '1 and string ' Warning 1292 Truncated incorrect INTEGER value: '1 and string'
Warning 1292 Truncated incorrect INTEGER value: '1 and string ' Warning 1292 Truncated incorrect INTEGER value: '1 and string'
CALL spxml('<a><b>b1</b><b>b2</b></a>', 'string and 1'); CALL spxml('<a><b>b1</b><b>b2</b></a>', 'string and 1');
ExtractValue(xml,'/a/b[$i]') ExtractValue(xml,'/a/b[$i]')
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'string and 1 ' Warning 1292 Truncated incorrect INTEGER value: 'string and 1'
Warning 1292 Truncated incorrect INTEGER value: 'string and 1 ' Warning 1292 Truncated incorrect INTEGER value: 'string and 1'
CALL spxml('<a><b>b1</b><b>b2</b></a>', 'string'); CALL spxml('<a><b>b1</b><b>b2</b></a>', 'string');
ExtractValue(xml,'/a/b[$i]') ExtractValue(xml,'/a/b[$i]')
Warnings: Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'string ' Warning 1292 Truncated incorrect INTEGER value: 'string'
Warning 1292 Truncated incorrect INTEGER value: 'string ' Warning 1292 Truncated incorrect INTEGER value: 'string'
DROP PROCEDURE spxml; DROP PROCEDURE spxml;
select UpdateXML('<a>a</a>',repeat('a b ',1000),''); select UpdateXML('<a>a</a>',repeat('a b ',1000),'');
ERROR HY000: XPATH syntax error: 'b a b a b a b a b a b a b a b...' ERROR HY000: XPATH syntax error: 'b a b a b a b a b a b a b a b...'

View File

@@ -339,7 +339,11 @@ my $opt_max_test_fail= env_or_val(MTR_MAX_TEST_FAIL => 10);
my $opt_core_on_failure= 0; my $opt_core_on_failure= 0;
my $opt_parallel= $ENV{MTR_PARALLEL} || 1; my $opt_parallel= $ENV{MTR_PARALLEL} || 1;
my $opt_port_group_size = $ENV{MTR_PORT_GROUP_SIZE} || 20; # Some galera tests starts 6 galera nodes. Each galera node requires
# three ports: 6*3 = 18. Plus 6 ports are needed for 6 mariadbd servers.
# Since the number of ports is rounded up to 10 everywhere, we will
# take 30 as the default value:
my $opt_port_group_size = $ENV{MTR_PORT_GROUP_SIZE} || 30;
# lock file to stop tests # lock file to stop tests
my $opt_stop_file= $ENV{MTR_STOP_FILE}; my $opt_stop_file= $ENV{MTR_STOP_FILE};
@@ -436,7 +440,7 @@ sub main {
{ {
$opt_parallel= $ENV{NUMBER_OF_PROCESSORS} || 1; $opt_parallel= $ENV{NUMBER_OF_PROCESSORS} || 1;
} }
elsif (IS_MAC) elsif (IS_MAC || IS_FREEBSD)
{ {
$opt_parallel= `sysctl -n hw.ncpu`; $opt_parallel= `sysctl -n hw.ncpu`;
} }
@@ -5587,6 +5591,8 @@ sub start_check_testcase ($$$) {
mtr_add_arg($args, "--record"); mtr_add_arg($args, "--record");
} }
my $errfile= "$opt_vardir/tmp/$name.err"; my $errfile= "$opt_vardir/tmp/$name.err";
My::Debugger::setup_client_args(\$args, \$exe_mysqltest);
my $proc= My::SafeProcess->new my $proc= My::SafeProcess->new
( (
name => $name, name => $name,

View File

@@ -4521,6 +4521,180 @@ row_number() OVER (order by a)
3 3
drop table t1; drop table t1;
# #
# MDEV-29307: join of 2 derived tables over the same grouping view such
# that the first of the joined tables contains a window
# function and the view's specification contains a subquery
# with a set function aggregated on the top level
#
CREATE TABLE t1 (
tst int NOT NULL,
flat tinyint unsigned NOT NULL,
type tinyint unsigned NOT NULL,
val int NOT NULL,
PRIMARY KEY (tst,flat,type)
) ENGINE=ARIA;
INSERT INTO t1 VALUES
(5, 20, 2, 100),
(7, 20, 2, 150),
(9, 20, 1, 200);
CREATE VIEW v1 AS (
SELECT
flat,
type,
( SELECT val FROM t1 sw
WHERE sw.tst = MAX(w.tst) AND sw.flat = w.flat AND sw.type = w.type)
AS total
FROM t1 w
GROUP BY flat, type
);
EXPLAIN EXTENDED SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived4> ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived6> ref key0 key0 1 v1.flat 1 100.00 Using where
6 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using where; Using index; Using temporary; Using filesort
7 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
4 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using where; Using index; Using temporary; Using filesort
5 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
Warnings:
Note 1276 Field or reference 'test.w.tst' of SELECT #5 was resolved in SELECT #4
Note 1981 Aggregate function 'max()' of SELECT #5 belongs to SELECT #4
Note 1276 Field or reference 'test.w.flat' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.type' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.tst' of SELECT #7 was resolved in SELECT #6
Note 1981 Aggregate function 'max()' of SELECT #7 belongs to SELECT #6
Note 1276 Field or reference 'test.w.flat' of SELECT #7 was resolved in SELECT #6
Note 1276 Field or reference 'test.w.type' of SELECT #7 was resolved in SELECT #6
Note 1003 /* select#1 */ select `v1`.`total` AS `w2_total`,`v1`.`total` AS `w1_total` from `test`.`v1` join `test`.`v1` where `v1`.`flat` = `v1`.`flat` and `v1`.`type` = 2 and `v1`.`type` = 1
SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
w2_total w1_total
150 200
EXPLAIN EXTENDED SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY type ORDER BY type) AS u
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived6> ref key0 key0 1 w1.flat 1 100.00 Using where
6 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using where; Using index; Using temporary; Using filesort
7 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
2 DERIVED <derived4> ALL NULL NULL NULL NULL 3 100.00 Using where; Using temporary
4 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using where; Using index; Using temporary; Using filesort
5 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
Warnings:
Note 1276 Field or reference 'test.w.tst' of SELECT #5 was resolved in SELECT #4
Note 1981 Aggregate function 'max()' of SELECT #5 belongs to SELECT #4
Note 1276 Field or reference 'test.w.flat' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.type' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.tst' of SELECT #7 was resolved in SELECT #6
Note 1981 Aggregate function 'max()' of SELECT #7 belongs to SELECT #6
Note 1276 Field or reference 'test.w.flat' of SELECT #7 was resolved in SELECT #6
Note 1276 Field or reference 'test.w.type' of SELECT #7 was resolved in SELECT #6
Note 1003 /* select#1 */ select `v1`.`total` AS `w2_total`,`w1`.`total` AS `w1_total` from (/* select#2 */ select `v1`.`flat` AS `flat`,`v1`.`type` AS `type`,`v1`.`total` AS `total`,count(`v1`.`total`) over ( partition by `v1`.`type` order by `v1`.`type`) AS `u` from `test`.`v1` where `v1`.`type` = 1) `w1` join `test`.`v1` where `v1`.`flat` = `w1`.`flat` and `v1`.`type` = 2
SELECT w2.total AS w2_total, w1.total AS w1_total
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY type ORDER BY type) AS u
FROM v1
WHERE type = 1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
WHERE type = 2
) AS w2
ON w1.flat = w2.flat;
w2_total w1_total
150 200
EXPLAIN EXTENDED SELECT w2.total AS w2_total, w1.total AS w1_total, u
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY flat ORDER BY flat) AS u
FROM v1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
) AS w2;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY <derived6> ALL NULL NULL NULL NULL 3 100.00 Using join buffer (flat, BNL join)
6 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using index; Using temporary; Using filesort
7 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
2 DERIVED <derived4> ALL NULL NULL NULL NULL 3 100.00 Using temporary
4 DERIVED w index NULL PRIMARY 6 NULL 3 100.00 Using index; Using temporary; Using filesort
5 DEPENDENT SUBQUERY sw eq_ref PRIMARY PRIMARY 6 func,func,func 1 100.00 Using index condition
Warnings:
Note 1276 Field or reference 'test.w.tst' of SELECT #5 was resolved in SELECT #4
Note 1981 Aggregate function 'max()' of SELECT #5 belongs to SELECT #4
Note 1276 Field or reference 'test.w.flat' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.type' of SELECT #5 was resolved in SELECT #4
Note 1276 Field or reference 'test.w.tst' of SELECT #7 was resolved in SELECT #6
Note 1981 Aggregate function 'max()' of SELECT #7 belongs to SELECT #6
Note 1276 Field or reference 'test.w.flat' of SELECT #7 was resolved in SELECT #6
Note 1276 Field or reference 'test.w.type' of SELECT #7 was resolved in SELECT #6
Note 1003 /* select#1 */ select `v1`.`total` AS `w2_total`,`w1`.`total` AS `w1_total`,`w1`.`u` AS `u` from (/* select#2 */ select `v1`.`flat` AS `flat`,`v1`.`type` AS `type`,`v1`.`total` AS `total`,count(`v1`.`total`) over ( partition by `v1`.`flat` order by `v1`.`flat`) AS `u` from `test`.`v1`) `w1` join `test`.`v1`
SELECT w2.total AS w2_total, w1.total AS w1_total, u
FROM
(
SELECT flat, type, total,
COUNT(total) OVER (PARTITION BY flat ORDER BY flat) AS u
FROM v1
) AS w1
JOIN
(
SELECT flat, type, total
FROM v1
) AS w2;
w2_total w1_total u
150 150 2
150 200 2
200 150 2
200 200 2
DROP VIEW v1;
DROP TABLE t1;
# End of 10.5 tests
#
# MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER # MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER
# #
CREATE TABLE t(c1 INT); CREATE TABLE t(c1 INT);

View File

@@ -2202,9 +2202,9 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' ' Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2218,9 +2218,9 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' ' Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--'
DROP VIEW v1; DROP VIEW v1;
@@ -3523,9 +3523,9 @@ NULL NULL 1
-1.00 -1 5 -1.00 -1 5
-3333.33 -3333.3333 26 -3333.33 -3333.3333 26
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ' ' Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$--'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3540,9 +3540,9 @@ NULL NULL 1
-1.00 -1 5 -1.00 -1 5
-3333.33 -3333.3333 26 -3333.33 -3333.3333 26
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ' ' Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$--'
DROP VIEW v1; DROP VIEW v1;

View File

@@ -2203,9 +2203,9 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' ' Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2219,9 +2219,9 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' ' Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--'
DROP VIEW v1; DROP VIEW v1;
@@ -3524,9 +3524,9 @@ NULL NULL 1
-1.00 -1 5 -1.00 -1 5
-3333.33 -3333.3333 26 -3333.33 -3333.3333 26
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ' ' Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$--'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3541,9 +3541,9 @@ NULL NULL 1
-1.00 -1 5 -1.00 -1 5
-3333.33 -3333.3333 26 -3333.33 -3333.3333 26
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ' ' Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$--'
DROP VIEW v1; DROP VIEW v1;

View File

@@ -2203,9 +2203,9 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' ' Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select if(`t1_values`.`my_char_30`,'IS TRUE','IS NOT TRUE') AS `IF(my_char_30, 'IS TRUE', 'IS NOT TRUE')`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -2219,9 +2219,9 @@ IS NOT TRUE <--------30 characters-------> 3
IS NOT TRUE ---äÖüß@µ*$-- 4 IS NOT TRUE ---äÖüß@µ*$-- 4
IS TRUE -1 5 IS TRUE -1 5
Warnings: Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ' ' Warning 1292 Truncated incorrect DOUBLE value: ''
Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->' Warning 1292 Truncated incorrect DOUBLE value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DOUBLE value: ' ---äÖüß@µ*$--'
DROP VIEW v1; DROP VIEW v1;
@@ -3524,9 +3524,9 @@ NULL NULL 1
-1.00 -1 5 -1.00 -1 5
-3333.33 -3333.3333 26 -3333.33 -3333.3333 26
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ' ' Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$--'
SHOW CREATE VIEW v1; SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as decimal(37,2)) AS `CAST(my_char_30 AS DECIMAL(37,2))`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci
@@ -3541,9 +3541,9 @@ NULL NULL 1
-1.00 -1 5 -1.00 -1 5
-3333.33 -3333.3333 26 -3333.33 -3333.3333 26
Warnings: Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ' ' Warning 1292 Truncated incorrect DECIMAL value: ''
Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->' Warning 1292 Truncated incorrect DECIMAL value: '<--------30 characters------->'
Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$-- ' Warning 1292 Truncated incorrect DECIMAL value: ' ---äÖüß@µ*$--'
DROP VIEW v1; DROP VIEW v1;

View File

@@ -10,7 +10,6 @@
# #
############################################################################## ##############################################################################
MDEV-27862 : MDEV-34240
galera_as_slave_ctas : MDEV-28378 timeout galera_as_slave_ctas : MDEV-28378 timeout
galera_pc_recovery : MDEV-25199 cluster fails to start up galera_pc_recovery : MDEV-25199 cluster fails to start up
galera_bf_kill_debug : timeout after 900 seconds galera_bf_kill_debug : timeout after 900 seconds
@@ -24,4 +23,3 @@ galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep:
galera_sst_mysqldump_with_key : MDEV-32782 galera_sst_mysqldump_with_key test failed galera_sst_mysqldump_with_key : MDEV-32782 galera_sst_mysqldump_with_key test failed
galera_var_ignore_apply_errors : MENT-1997 galera_var_ignore_apply_errors test freezes galera_var_ignore_apply_errors : MENT-1997 galera_var_ignore_apply_errors test freezes
galera_desync_overlapped : MDEV-21538 galera_desync_overlapped MTR failed: Result content mismatch galera_desync_overlapped : MDEV-21538 galera_desync_overlapped MTR failed: Result content mismatch
galera_create_table_as_select : MDEV-33952 fails sporadically

View File

@@ -33,6 +33,9 @@ wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port'
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket

View File

@@ -47,6 +47,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
wsrep-on=OFF wsrep-on=OFF
server-id=3 server-id=3
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket

View File

@@ -46,6 +46,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
wsrep-on=OFF wsrep-on=OFF
server-id=3 server-id=3
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket

View File

@@ -11,7 +11,6 @@ default-storage-engine=innodb
wsrep_gtid_mode=1 wsrep_gtid_mode=1
gtid_ignore_duplicates gtid_ignore_duplicates
auto_increment_increment=3 auto_increment_increment=3
wsrep-provider=@ENV.WSREP_PROVIDER wsrep-provider=@ENV.WSREP_PROVIDER
# enforce read-committed characteristics across the cluster # enforce read-committed characteristics across the cluster
# wsrep-causal-reads=ON # wsrep-causal-reads=ON
@@ -61,6 +60,9 @@ wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port'
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket
@@ -73,5 +75,3 @@ NODE_MYSOCK_3= @mysqld.3.socket
NODE_MYPORT_4= @mysqld.4.port NODE_MYPORT_4= @mysqld.4.port
NODE_MYSOCK_4= @mysqld.4.socket NODE_MYSOCK_4= @mysqld.4.socket

View File

@@ -59,6 +59,9 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
wsrep-on=OFF wsrep-on=OFF
server-id=4 server-id=4
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket

View File

@@ -59,6 +59,9 @@ wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
auto-increment-offset=4 auto-increment-offset=4
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket

View File

@@ -0,0 +1,6 @@
connection node_2;
connection node_1;
SET SESSION wsrep_on=OFF;
BEGIN;
ROLLBACK;
SET SESSION wsrep_on=OFF;

View File

@@ -22,12 +22,6 @@ EXPECT_1
1 1
gtid_binlog_state_equal gtid_binlog_state_equal
0 0
connection node_2;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
gtid_binlog_state_equal
0
#cleanup #cleanup
connection node_3; connection node_3;
DROP TABLE t1; DROP TABLE t1;

View File

@@ -49,16 +49,23 @@ a b
disconnect node_2a; disconnect node_2a;
disconnect node_2b; disconnect node_2b;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a; connection node_2a;
SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=OFF;
begin; begin;
update t1 set a =5, b=2; update t1 set a =5, b=2;
connection node_2; connection node_2;
ALTER TABLE t1 ADD UNIQUE KEY b3(b); ALTER TABLE t1 ADD UNIQUE KEY b3(b);
connection node_2b;
SET SESSION wsrep_sync_wait=0;
connection node_2a;
select * from t1; select * from t1;
a b a b
2 1 5 2
commit;
connection node_2;
disconnect node_2a; disconnect node_2a;
disconnect node_2b;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a; connection node_2a;
SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=OFF;
@@ -67,7 +74,7 @@ update t1 set a =5, b=2;
connection node_2; connection node_2;
select * from t1; select * from t1;
a b a b
2 1 5 2
disconnect node_2a; disconnect node_2a;
connection node_1; connection node_1;
drop table t1; drop table t1;

View File

@@ -76,22 +76,21 @@ EXECUTE stmt;
DEALLOCATE PREPARE stmt; DEALLOCATE PREPARE stmt;
DROP TABLE t1, t2; DROP TABLE t1, t2;
connection node_1; connection node_1;
SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3),(4),(5); INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; SET DEBUG_SYNC = 'create_table_select_before_create WAIT_FOR sync.wsrep_apply_cb_reached';
LOCK TABLE t2 WRITE; SET DEBUG_SYNC = 'create_table_select_before_lock SIGNAL signal.wsrep_apply_cb WAIT_FOR bf_abort';
connection node_1;
CREATE TABLE t1 AS SELECT * FROM t2;; CREATE TABLE t1 AS SELECT * FROM t2;;
connection node_1a;
connection node_2; connection node_2;
SELECT COUNT(*) = 5 FROM t2; SELECT COUNT(*) = 5 FROM t2;
COUNT(*) = 5 COUNT(*) = 5
1 1
CREATE TABLE t1 AS SELECT * FROM t2; CREATE TABLE t1 AS SELECT * FROM t2;
connection node_1a;
UNLOCK TABLES;
connection node_1; connection node_1;
Got one of the listed errors ERROR 70100: Query execution was interrupted
SET GLOBAL DEBUG_DBUG = '';
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1, t2; DROP TABLE t1, t2;
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3),(4),(5); INSERT INTO t2 VALUES (1),(2),(3),(4),(5);

View File

@@ -0,0 +1,46 @@
connection node_2;
connection node_1;
connection node_1;
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`other_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`,`other_id`)
) ENGINE=InnoDB
PARTITION BY LIST (`id` MOD 2)
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB,
PARTITION `p1` VALUES IN (1) ENGINE = InnoDB);
INSERT INTO t1 VALUES (1, 0);
CREATE TABLE t2 LIKE t1;
START TRANSACTION;
INSERT INTO t2(SELECT * FROM t1 WHERE id = 1);
DELETE FROM t1 WHERE id = 1;
COMMIT;
connection node_2;
SELECT * from t1;
id other_id
SELECT * from t2;
id other_id
1 0
DROP TABLE t1, t2;
connection node_1;
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`other_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
PARTITION BY LIST (`id` MOD 2)
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB,
PARTITION `p1` VALUES IN (1) ENGINE = InnoDB);
INSERT INTO t1 VALUES (1, 0);
CREATE TABLE t2 LIKE t1;
START TRANSACTION;
INSERT INTO t2(SELECT * FROM t1 WHERE id = 1);
DELETE FROM t1 WHERE id = 1;
COMMIT;
connection node_2;
SELECT * from t1;
id other_id
SELECT * from t2;
id other_id
1 0
DROP TABLE t1, t2;

View File

@@ -0,0 +1,71 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
create user repl@'%' identified by 'repl';
grant all on *.* to repl@'%';
flush privileges;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
connection node_1;
connection node_2;
connection node_2;
START SLAVE;
connection node_3;
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.gtid_slave_pos;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
# Verify that graceful shutdown succeeds.
# Force SST
connection node_1;
# Waiting until node_2 is not part of cluster anymore
connection node_2;
# Start node_2 again
¤ Wait until node_2 is back on cluster
connection node_2;
call mtr.add_suppression("Slave: Operation CREATE USER failed for .*");
SELECT COUNT(*) AS EXPECT_0 FROM mysql.gtid_slave_pos;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1;
SELECT COUNT(*) AS EXPECT_0 FROM mysql.gtid_slave_pos;
EXPECT_0
0
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_3;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
connection node_3;
RESET MASTER;
drop table t1;
connection node_2;
DROP TABLE t1;
connection node_1;
connection node_1;
disconnect node_3;
disconnect node_2;
disconnect node_1;
# End of test

View File

@@ -0,0 +1,11 @@
#
# MDEV-33523: Spurious deadlock error when wsrep_on=OFF
#
--source include/galera_cluster.inc
SET SESSION wsrep_on=OFF;
BEGIN;
# If bug is present, the following rollback
# results in ER_LOCK_DEADLOCK error.
ROLLBACK;
SET SESSION wsrep_on=OFF;

View File

@@ -46,18 +46,8 @@ SELECT LENGTH(@@global.gtid_binlog_state) > 1;
SELECT COUNT(*) AS EXPECT_1 FROM t1; SELECT COUNT(*) AS EXPECT_1 FROM t1;
--disable_query_log # Note that MyISAM tables are not replicated by Galera so we do not here
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal; # check node_2
--enable_query_log
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1;
--disable_query_log --disable_query_log
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal; --eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;

View File

@@ -94,27 +94,43 @@ select * from t1;
--disconnect node_2b --disconnect node_2b
# #
# Test case 5: Start a transaction on node_2a with wsrep disabled # Test case 5: Start a transaction on node_2a with wsrep disabled.
# and start a DDL on other transaction that will then abort node_2a # A conflicting DDL on other transaction can't BF abort
# transactions # transaction from node_2a (wsrep disabled).
# #
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a --connection node_2a
SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=OFF;
begin; begin;
update t1 set a =5, b=2; update t1 set a =5, b=2;
--connection node_2 --connection node_2
ALTER TABLE t1 ADD UNIQUE KEY b3(b); --send ALTER TABLE t1 ADD UNIQUE KEY b3(b)
--connection node_2b
SET SESSION wsrep_sync_wait=0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table metadata lock';
--source include/wait_condition.inc
--connection node_2a
select * from t1; select * from t1;
# We expect that ALTER should not be able to BF abort
# this transaction, it must wait for it to finish.
# Expect commit to succeed.
commit;
--connection node_2
--reap
--disconnect node_2a --disconnect node_2a
--disconnect node_2b
# #
# Test case 6: Start a transaction on node_2a with wsrep disabled # Test case 6: Start a transaction on node_2a with wsrep disabled
# and kill it from other connection on same node # and kill it from other connection on same node.
# #
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2

View File

@@ -3,6 +3,8 @@
# #
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_debug_sync.inc
--source include/have_debug.inc
--connection node_1 --connection node_1
SET SESSION default_storage_engine=InnoDB; SET SESSION default_storage_engine=InnoDB;
@@ -103,31 +105,27 @@ DROP TABLE t1, t2;
# #
--connection node_1 --connection node_1
# Pause applying CTAS command from the other node
SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_apply_cb';
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t2 VALUES (1),(2),(3),(4),(5); INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 # Wait until local CTAS grabs MDL lock and let applied CTAS BF-abort it
LOCK TABLE t2 WRITE; SET DEBUG_SYNC = 'create_table_select_before_create WAIT_FOR sync.wsrep_apply_cb_reached';
SET DEBUG_SYNC = 'create_table_select_before_lock SIGNAL signal.wsrep_apply_cb WAIT_FOR bf_abort';
--connection node_1
--send CREATE TABLE t1 AS SELECT * FROM t2; --send CREATE TABLE t1 AS SELECT * FROM t2;
--connection node_1a
--let $wait_condition = SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE STATE LIKE 'Waiting for table metadata lock%'
--source include/wait_condition.inc
--connection node_2 --connection node_2
SELECT COUNT(*) = 5 FROM t2; SELECT COUNT(*) = 5 FROM t2;
CREATE TABLE t1 AS SELECT * FROM t2; CREATE TABLE t1 AS SELECT * FROM t2;
--connection node_1a
UNLOCK TABLES;
--connection node_1 --connection node_1
--error ER_TABLE_EXISTS_ERROR,ER_QUERY_INTERRUPTED --error ER_QUERY_INTERRUPTED
--reap --reap
SET GLOBAL DEBUG_DBUG = '';
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1, t2; DROP TABLE t1, t2;
# #

View File

@@ -1,5 +1,6 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/log_bin.inc
# #
# This tests simple autocommit replication of MyISAM tables. # This tests simple autocommit replication of MyISAM tables.

View File

@@ -2,6 +2,7 @@
--source include/have_partition.inc --source include/have_partition.inc
--source include/big_test.inc --source include/big_test.inc
--source include/force_restart.inc --source include/force_restart.inc
--source include/log_bin.inc
--connection node_1 --connection node_1

View File

@@ -0,0 +1,55 @@
--source include/galera_cluster.inc
--source include/have_partition.inc
--source include/log_bin.inc
--connection node_1
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`other_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`,`other_id`)
) ENGINE=InnoDB
PARTITION BY LIST (`id` MOD 2)
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB,
PARTITION `p1` VALUES IN (1) ENGINE = InnoDB);
INSERT INTO t1 VALUES (1, 0);
CREATE TABLE t2 LIKE t1;
START TRANSACTION;
INSERT INTO t2(SELECT * FROM t1 WHERE id = 1);
DELETE FROM t1 WHERE id = 1;
COMMIT;
--connection node_2
SELECT * from t1;
SELECT * from t2;
DROP TABLE t1, t2;
--connection node_1
CREATE TABLE `t1` (
`id` int(10) unsigned NOT NULL,
`other_id` int(10) unsigned NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB
PARTITION BY LIST (`id` MOD 2)
(PARTITION `p0` VALUES IN (0) ENGINE = InnoDB,
PARTITION `p1` VALUES IN (1) ENGINE = InnoDB);
INSERT INTO t1 VALUES (1, 0);
CREATE TABLE t2 LIKE t1;
START TRANSACTION;
INSERT INTO t2(SELECT * FROM t1 WHERE id = 1);
DELETE FROM t1 WHERE id = 1;
COMMIT;
--connection node_2
SELECT * from t1;
SELECT * from t2;
DROP TABLE t1, t2;

View File

@@ -0,0 +1,9 @@
!include ../galera_2nodes_as_slave.cnf
[mysqld]
wsrep-debug=1
server_id=15
wsrep_gtid_mode=OFF
wsrep_gtid_domain_id=16
gtid_domain_id=11
gtid_strict_mode=OFF

View File

@@ -0,0 +1,124 @@
#
# Test Galera as a replica to a MySQL async replication
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
#
--source include/force_restart.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
create user repl@'%' identified by 'repl';
grant all on *.* to repl@'%';
flush privileges;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $node_1 = node_1
--let $node_2 = node_2
--source include/auto_increment_offset_save.inc
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos;
--enable_query_log
START SLAVE;
--connection node_3
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
--disable_query_log
INSERT INTO t1 SELECT seq, 'test' from seq_1_to_10000;
--enable_query_log
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 10000 FROM t1;
--source include/wait_condition.inc
#
# Node_2 is slave so mysql.gtid_slave_pos table is also replicated
#
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 10000 FROM t1;
--source include/wait_condition.inc
#
# mysql-gtid_slave_pos table should not be replicated by Galera
#
SELECT COUNT(*) AS EXPECT_0 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_2
--echo # Verify that graceful shutdown succeeds.
--source include/shutdown_mysqld.inc
--echo # Force SST
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--connection node_1
--echo # Waiting until node_2 is not part of cluster anymore
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--connection node_2
--echo # Start node_2 again
--source include/start_mysqld.inc
--echo ¤ Wait until node_2 is back on cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--connection node_2
call mtr.add_suppression("Slave: Operation CREATE USER failed for .*");
SELECT COUNT(*) AS EXPECT_0 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_1
SELECT COUNT(*) AS EXPECT_0 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_3
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
#
# Cleanup
#
--connection node_2
STOP SLAVE;
RESET SLAVE ALL;
--connection node_3
RESET MASTER;
drop table t1;
--connection node_2
DROP TABLE t1;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_1
--disconnect node_3
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc
--echo # End of test

View File

@@ -1,6 +1,6 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_log_bin.inc --source include/log_bin.inc
--source include/have_sequence.inc --source include/have_sequence.inc
--source include/have_aria.inc --source include/have_aria.inc

View File

@@ -83,6 +83,9 @@ wsrep_node_address='127.0.0.1:@mysqld.6.#galera_port'
wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port' wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port'
[sst]
sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log
[ENV] [ENV]
NODE_MYPORT_1= @mysqld.1.port NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket NODE_MYSOCK_1= @mysqld.1.socket

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