1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Merge branch '11.2' into 11.3

This commit is contained in:
Sergei Golubchik
2023-12-21 01:17:10 +01:00
760 changed files with 29692 additions and 5649 deletions

View File

@ -32,7 +32,8 @@ Without automated tests, future regressions in the expected behavior can't be au
If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.
<!--
Tick one of the following boxes [x] to help us understand if the base branch for the PR is correct. (Currently the earliest maintained branch is 10.4)
Tick one of the following boxes [x] to help us understand if the base branch for the PR is correct.
see [CODING_STANDARDS.md](https://github.com/MariaDB/server/blob/-/CODING_STANDARDS.md) for the latest versions.
-->
## Basing the PR against the correct MariaDB version
- [ ] *This is a new feature and the PR is based against the latest MariaDB development branch.*
@ -43,5 +44,5 @@ Tick one of the following boxes [x] to help us understand if the base branch for
Maintainers are happy to point out inconsistencies but in order to speed up the review and merge process we ask you to check the CODING standards.
-->
## PR quality check
- [ ] I checked the [CODING_STANDARDS.md](https://github.com/MariaDB/server/blob/11.0/CODING_STANDARDS.md) file and my PR conforms to this where appropriate.
- [ ] I checked the [CODING_STANDARDS.md](https://github.com/MariaDB/server/blob/-/CODING_STANDARDS.md) file and my PR conforms to this where appropriate.
- [ ] For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

View File

@ -37,14 +37,21 @@ The commit messages are typically rendered in [Markdown format](https://docs.git
When updating your code, please make sure you perform a rebase, not a merge with the latest branch.
Pull requests should be a simple fast-forward of the branch they are intended to land on.
The correct way to rebase (if working on top of 10.3 branch):
The correct way to rebase (if working on top of 10.11 branch):
```sh
git fetch upstream/10.3 # This assumes upstream is github.com/MariaDB/server
git rebase upstream/10.3
git fetch upstream/10.11 # This assumes upstream is github.com/MariaDB/server
git rebase upstream/10.11
git push --force my_branch
```
### Target branch
Pull requests should be based against the correct MariaDB version.
New features should be based against the latest MariaDB development branch, which is the current GitHub default branch: https://github.com/MariaDB/server/blob/-/VERSION
Bug fixes should be based against the earliest maintained branch in which the bug can be reproduced.
The earliest maintained branch is found at https://mariadb.org/about/#maintenance-policy.
## Coding Style (C / C++ files)
Everyone has a preferred coding style, there is no real correct style for all projects around the world.

View File

@ -1484,7 +1484,12 @@ int main(int argc, char **argv)
open_mysql_upgrade_file();
if (opt_check_upgrade)
exit(upgrade_already_done(0) == 0);
{
int upgrade_needed = upgrade_already_done(0);
free_used_memory();
my_end(my_end_arg);
exit(upgrade_needed == 0);
}
/* Find mysqlcheck */
find_tool(mysqlcheck_path, IF_WIN("mariadb-check.exe", "mariadb-check"), self_name);

View File

@ -17,7 +17,7 @@
/* maintenance of mysql databases */
#define VER "9.1"
#define VER "10.0"
#include "client_priv.h"
#include <signal.h>
#include <my_pthread.h> /* because of signal() */
@ -36,12 +36,12 @@ char *host= NULL, *user= 0, *opt_password= 0,
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
ulonglong last_values[MAX_MYSQL_VAR+100];
static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress= 0, opt_local= 0, opt_relative= 0, opt_verbose= 0,
tty_password= 0, opt_nobeep, opt_shutdown_wait_for_slaves= 0;
static my_bool option_force=0,interrupted=0,new_line=0, opt_compress= 0,
opt_local= 0, opt_relative= 0, tty_password= 0, opt_nobeep,
opt_shutdown_wait_for_slaves= 0, opt_not_used;
static my_bool debug_info_flag= 0, debug_check_flag= 0;
static uint tcp_port = 0, option_wait = 0, option_silent=0, nr_iterations;
static uint opt_count_iterations= 0, my_end_arg;
static uint opt_count_iterations= 0, my_end_arg, opt_verbose= 0;
static ulong opt_connect_timeout, opt_shutdown_timeout;
static char * unix_port=0;
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
@ -187,8 +187,10 @@ static struct my_option my_long_options[] =
{"user", 'u', "User for login if not current user.", &user,
&user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"verbose", 'v', "Write more information.", &opt_verbose,
&opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"verbose", 'v', "Write more information."
"Using it will print more information for 'processlist."
"Using it 2 times will print even more information for 'processlist'.",
&opt_not_used, &opt_not_used, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
{"wait", 'w', "Wait and retry if connection is down.", 0, 0, 0, GET_UINT,
@ -277,6 +279,11 @@ get_one_option(const struct my_option *opt, const char *argument,
case 'I': /* Info */
usage();
exit(0);
case 'v': /* --verbose */
opt_verbose++;
if (argument == disabled_my_option)
opt_verbose= 0;
break;
case OPT_CHARSETS_DIR:
#if MYSQL_VERSION_ID > 32300
charsets_dir = argument;
@ -807,9 +814,16 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
MYSQL_RES *result;
MYSQL_ROW row;
const char *query;
if (mysql_query(mysql, (opt_verbose ? "show full processlist" :
"show processlist")) ||
if (!opt_verbose)
query= "show processlist";
else if (opt_verbose == 1)
query= "show full processlist";
else
query= "select * from information_schema.processlist where id != connection_id()";
if (mysql_query(mysql, query) ||
!(result = mysql_store_result(mysql)))
{
my_printf_error(0, "process list failed; error: '%s'", error_flags,

View File

@ -80,6 +80,9 @@ static my_bool non_blocking_api_enabled= 0;
#define DIE_BUFF_SIZE 256*1024
#define RESULT_STRING_INIT_MEM 2048
#define RESULT_STRING_INCREMENT_MEM 2048
/* Flags controlling send and reap */
#define QUERY_SEND_FLAG 1
#define QUERY_REAP_FLAG 2
@ -88,6 +91,8 @@ static my_bool non_blocking_api_enabled= 0;
#define CLOSED_CONNECTION "-closed_connection-"
#define dynstr_append DO_NO_USE
#ifndef HAVE_SETENV
static int setenv(const char *name, const char *value, int overwrite);
#endif
@ -1730,7 +1735,7 @@ void log_msg(const char *fmt, ...)
va_end(args);
dynstr_append_mem(&ds_res, buff, len);
dynstr_append(&ds_res, "\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n"));
DBUG_VOID_RETURN;
}
@ -1866,7 +1871,7 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
die("Out of memory");
dynstr_append_os_quoted(&ds_cmdline, tool_path, NullS);
dynstr_append(&ds_cmdline, " ");
dynstr_append_mem(&ds_cmdline, STRING_WITH_LEN(" "));
va_start(args, ds_res);
@ -1876,14 +1881,14 @@ static int run_tool(const char *tool_path, DYNAMIC_STRING *ds_res, ...)
if (strncmp(arg, "--", 2) == 0)
dynstr_append_os_quoted(&ds_cmdline, arg, NullS);
else
dynstr_append(&ds_cmdline, arg);
dynstr_append(&ds_cmdline, " ");
dynstr_append_mem(&ds_cmdline, arg, strlen(arg));
dynstr_append_mem(&ds_cmdline, STRING_WITH_LEN(" "));
}
va_end(args);
#ifdef _WIN32
dynstr_append(&ds_cmdline, "\"");
dynstr_append_mem(&ds_cmdline, STRING_WITH_LEN("\""));
#endif
DBUG_PRINT("info", ("Running: %s", ds_cmdline.str));
@ -2018,8 +2023,8 @@ void show_diff(DYNAMIC_STRING* ds,
Fallback to dump both files to result file and inform
about installing "diff"
*/
dynstr_append(&ds_tmp, "\n");
dynstr_append(&ds_tmp,
char message[]=
"\n"
"\n"
"The two files differ but it was not possible to execute 'diff' in\n"
"order to show only the difference. Instead the whole content of the\n"
@ -2029,17 +2034,18 @@ void show_diff(DYNAMIC_STRING* ds,
#ifdef _WIN32
"or http://gnuwin32.sourceforge.net/packages/diffutils.htm\n"
#endif
"\n");
"\n";
dynstr_append_mem(&ds_tmp, message, sizeof(message));
dynstr_append(&ds_tmp, " --- ");
dynstr_append(&ds_tmp, filename1);
dynstr_append(&ds_tmp, " >>>\n");
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" --- "));
dynstr_append_mem(&ds_tmp, filename1, strlen(filename1));
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" >>>\n"));
cat_file(&ds_tmp, filename1);
dynstr_append(&ds_tmp, "<<<\n --- ");
dynstr_append(&ds_tmp, filename1);
dynstr_append(&ds_tmp, " >>>\n");
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN("<<<\n --- "));
dynstr_append_mem(&ds_tmp, filename1, strlen(filename1));
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN(" >>>\n"));
cat_file(&ds_tmp, filename2);
dynstr_append(&ds_tmp, "<<<<\n");
dynstr_append_mem(&ds_tmp, STRING_WITH_LEN("<<<<\n"));
}
if (ds)
@ -2819,9 +2825,9 @@ do_result_format_version(struct st_command *command)
set_result_format_version(version);
dynstr_append(&ds_res, "result_format: ");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("result_format: "));
dynstr_append_mem(&ds_res, ds_version.str, ds_version.length);
dynstr_append(&ds_res, "\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n"));
dynstr_free(&ds_version);
}
@ -3292,13 +3298,15 @@ static int replace(DYNAMIC_STRING *ds_str,
{
DYNAMIC_STRING ds_tmp;
const char *start= strstr(ds_str->str, search_str);
size_t prefixlen= start - ds_str->str;
if (!start)
return 1;
init_dynamic_string(&ds_tmp, "",
ds_str->length + replace_len, 256);
dynstr_append_mem(&ds_tmp, ds_str->str, start - ds_str->str);
dynstr_append_mem(&ds_tmp, ds_str->str, prefixlen);
dynstr_append_mem(&ds_tmp, replace_str, replace_len);
dynstr_append(&ds_tmp, start + search_len);
dynstr_append_mem(&ds_tmp, start + search_len,
ds_str->length - prefixlen - search_len);
dynstr_set(ds_str, ds_tmp.str);
dynstr_free(&ds_tmp);
return 0;
@ -3413,7 +3421,7 @@ void do_exec(struct st_command *command)
if (disable_result_log)
{
/* Collect stderr output as well, for the case app. crashes or returns error.*/
dynstr_append(&ds_cmd, " 2>&1");
dynstr_append_mem(&ds_cmd, STRING_WITH_LEN(" 2>&1"));
}
DBUG_PRINT("info", ("Executing '%s' as '%s'",
@ -3625,9 +3633,9 @@ void do_system(struct st_command *command)
else
{
/* If ! abort_on_error, log message and continue */
dynstr_append(&ds_res, "system command '");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("system command '"));
replace_dynstr_append(&ds_res, command->first_argument);
dynstr_append(&ds_res, "' failed\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("' failed\n"));
}
}
@ -3803,7 +3811,7 @@ void do_remove_files_wildcard(struct st_command *command)
wild_compare(file->name, ds_wild.str, 0))
continue;
ds_file_to_remove.length= directory_length;
dynstr_append(&ds_file_to_remove, file->name);
dynstr_append_mem(&ds_file_to_remove, file->name, strlen(file->name));
DBUG_PRINT("info", ("removing file: %s", ds_file_to_remove.str));
if ((error= (my_delete(ds_file_to_remove.str, MYF(MY_WME)) != 0)))
sys_errno= my_errno;
@ -4093,7 +4101,7 @@ static int get_list_files(DYNAMIC_STRING *ds, const DYNAMIC_STRING *ds_dirname,
wild_compare(file->name, ds_wild->str, 0))
continue;
replace_dynstr_append(ds, file->name);
dynstr_append(ds, "\n");
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
}
set_wild_chars(0);
my_dirend(dir_info);
@ -7703,7 +7711,7 @@ void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field,
}
else
{
dynstr_append(ds, field->name);
dynstr_append_mem(ds, field->name, strlen(field->name));
dynstr_append_mem(ds, "\t", 1);
replace_dynstr_append_mem(ds, val, len);
dynstr_append_mem(ds, "\n", 1);
@ -7814,9 +7822,10 @@ void append_metadata(DYNAMIC_STRING *ds,
uint num_fields)
{
MYSQL_FIELD *field_end;
dynstr_append(ds,"Catalog\tDatabase\tTable\tTable_alias\tColumn\t"
dynstr_append_mem(ds, STRING_WITH_LEN(
"Catalog\tDatabase\tTable\tTable_alias\tColumn\t"
"Column_alias\tType\tLength\tMax length\tIs_null\t"
"Flags\tDecimals\tCharsetnr\n");
"Flags\tDecimals\tCharsetnr\n"));
for (field_end= field+num_fields ;
field < field_end ;
@ -7875,13 +7884,13 @@ void append_info(DYNAMIC_STRING *ds, ulonglong affected_rows,
const char *info)
{
char buf[40], buff2[21];
sprintf(buf,"affected rows: %s\n", llstr(affected_rows, buff2));
dynstr_append(ds, buf);
size_t len= sprintf(buf,"affected rows: %s\n", llstr(affected_rows, buff2));
dynstr_append_mem(ds, buf, len);
if (info)
{
dynstr_append(ds, "info: ");
dynstr_append(ds, info);
dynstr_append_mem(ds, "\n", 1);
dynstr_append_mem(ds, STRING_WITH_LEN("info: "));
dynstr_append_mem(ds, info, strlen(info));
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
}
}
@ -7927,18 +7936,19 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
(enum_session_state_type) type,
&data, &data_length))
{
dynstr_append(ds, "-- ");
dynstr_append_mem(ds, STRING_WITH_LEN("-- "));
if (type <= SESSION_TRACK_END)
{
dynstr_append(ds, trking_info_desc[type]);
dynstr_append_mem(ds, trking_info_desc[type],
strlen(trking_info_desc[type]));
}
else
{
DBUG_ASSERT(0);
dynstr_append(ds, "Tracker???\n");
dynstr_append_mem(ds, STRING_WITH_LEN("Tracker???\n"));
}
dynstr_append(ds, "-- ");
dynstr_append_mem(ds, STRING_WITH_LEN("-- "));
dynstr_append_mem(ds, data, data_length);
}
else
@ -7947,16 +7957,16 @@ static void append_session_track_info(DYNAMIC_STRING *ds, MYSQL *mysql)
(enum_session_state_type) type,
&data, &data_length))
{
dynstr_append(ds, "\n-- ");
dynstr_append_mem(ds, STRING_WITH_LEN("\n-- "));
if (data == NULL)
{
DBUG_ASSERT(data_length == 0);
dynstr_append_mem(ds, "<NULL>", sizeof("<NULL>") - 1);
dynstr_append_mem(ds, STRING_WITH_LEN("<NULL>"));
}
else
dynstr_append_mem(ds, data, data_length);
}
dynstr_append(ds, "\n\n");
dynstr_append_mem(ds, STRING_WITH_LEN("\n\n"));
}
#endif /* EMBEDDED_LIBRARY */
}
@ -8356,7 +8366,8 @@ void handle_error(struct st_command *command,
else if (command->expected_errors.err[0].type == ERR_SQLSTATE ||
(command->expected_errors.err[0].type == ERR_ERRNO &&
command->expected_errors.err[0].code.errnum != 0))
dynstr_append(ds,"Got one of the listed errors\n");
dynstr_append_mem(ds, STRING_WITH_LEN("Got one of the listed "
"errors\n"));
}
/* OK */
revert_properties();
@ -8435,6 +8446,85 @@ void handle_no_error(struct st_command *command)
}
/*
Read result set after prepare statement execution
SYNOPSIS
read_stmt_results
stmt - prepare statemet
mysql - mysql handle
command - current command pointer
ds - output buffer where to store result form query
RETURN VALUE
1 - if there is an error in result set
*/
int read_stmt_results(MYSQL_STMT* stmt,
DYNAMIC_STRING* ds,
struct st_command *command)
{
MYSQL_RES *res= NULL;
/*
We instruct that we want to update the "max_length" field in
mysql_stmt_store_result(), this is our only way to know how much
buffer to allocate for result data
*/
{
my_bool one= 1;
if (mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &one))
die("mysql_stmt_attr_set(STMT_ATTR_UPDATE_MAX_LENGTH) failed': %d %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
}
/*
If we got here the statement succeeded and was expected to do so,
get data. Note that this can still give errors found during execution!
Store the result of the query if if will return any fields
*/
if (mysql_stmt_field_count(stmt) && mysql_stmt_store_result(stmt))
{
handle_error(command, mysql_stmt_errno(stmt),
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
return 1;
}
if (!disable_result_log)
{
/*
Not all statements creates a result set. If there is one we can
now create another normal result set that contains the meta
data. This set can be handled almost like any other non prepared
statement result set.
*/
if ((res= mysql_stmt_result_metadata(stmt)) != NULL)
{
/* Take the column count from meta info */
MYSQL_FIELD *fields= mysql_fetch_fields(res);
uint num_fields= mysql_num_fields(res);
if (display_metadata)
append_metadata(ds, fields, num_fields);
if (!display_result_vertically)
append_table_headings(ds, fields, num_fields);
append_stmt_result(ds, stmt, fields, num_fields);
mysql_free_result(res); /* Free normal result set with meta data */
}
else
{
/*
This is a query without resultset
*/
}
}
return 0;
}
/*
Run query using prepared statement C API
@ -8455,11 +8545,17 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
DYNAMIC_STRING *ds_warnings)
{
my_bool ignore_second_execution= 0;
MYSQL_RES *res= NULL; /* Note that here 'res' is meta data result set */
MYSQL *mysql= cn->mysql;
MYSQL_STMT *stmt;
DYNAMIC_STRING ds_prepare_warnings;
DYNAMIC_STRING ds_execute_warnings;
DYNAMIC_STRING ds_res_1st_execution;
DYNAMIC_STRING ds_res_2_execution_unsorted;
DYNAMIC_STRING *ds_res_2_output;
my_bool ds_res_1st_execution_init = FALSE;
my_bool compare_2nd_execution = TRUE;
int query_match_ps2_re;
DBUG_ENTER("run_query_stmt");
DBUG_PRINT("query", ("'%-.60s'", query));
DBUG_PRINT("info",
@ -8489,6 +8585,12 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
init_dynamic_string(&ds_execute_warnings, NULL, 0, 256);
}
/* Check and remove potential trash */
if (strlen(ds->str) != 0)
{
dynstr_trunc(ds, 0);
}
/*
Prepare the query
*/
@ -8524,10 +8626,12 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
}
#endif
query_match_ps2_re = match_re(&ps2_re, query);
/*
Execute the query first time if second execution enable
*/
if(ps2_protocol_enabled && match_re(&ps2_re, query))
if (ps2_protocol_enabled && query_match_ps2_re)
{
if (do_stmt_execute(cn))
{
@ -8535,12 +8639,32 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
goto end;
}
/*
We cannot run query twice if we get prepare warnings as these will otherwise be
disabled
*/
ignore_second_execution= (prepare_warnings_enabled &&
mysql_warning_count(mysql) != 0);
if (ignore_second_execution)
compare_2nd_execution = 0;
else
{
init_dynamic_string(&ds_res_1st_execution, "",
RESULT_STRING_INIT_MEM, RESULT_STRING_INCREMENT_MEM);
ds_res_1st_execution_init = TRUE;
if (read_stmt_results(stmt, &ds_res_1st_execution, command))
{
/*
There was an error during execution
and there is no result set to compare
*/
compare_2nd_execution = 0;
}
else
handle_no_error(command);
}
}
/*
@ -8553,6 +8677,8 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
goto end;
}
DBUG_ASSERT(ds->length == 0);
int err;
do
{
@ -8563,75 +8689,82 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
if (cursor_protocol_enabled && !disable_warnings)
append_warnings(&ds_execute_warnings, mysql);
/*
We instruct that we want to update the "max_length" field in
mysql_stmt_store_result(), this is our only way to know how much
buffer to allocate for result data
*/
if (!disable_result_log &&
compare_2nd_execution &&
ps2_protocol_enabled &&
query_match_ps2_re &&
display_result_sorted)
{
my_bool one= 1;
if (mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void*) &one))
die("mysql_stmt_attr_set(STMT_ATTR_UPDATE_MAX_LENGTH) failed': %d %s",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
init_dynamic_string(&ds_res_2_execution_unsorted, "",
RESULT_STRING_INIT_MEM,
RESULT_STRING_INCREMENT_MEM);
ds_res_2_output= &ds_res_2_execution_unsorted;
}
else
ds_res_2_output= ds;
/*
If we got here the statement succeeded and was expected to do so,
get data. Note that this can still give errors found during execution!
Store the result of the query if if will return any fields
*/
if (mysql_stmt_field_count(stmt) && mysql_stmt_store_result(stmt))
if (read_stmt_results(stmt, ds_res_2_output, command))
{
handle_error(command, mysql_stmt_errno(stmt),
mysql_stmt_error(stmt), mysql_stmt_sqlstate(stmt), ds);
if (ds_res_2_output != ds)
{
dynstr_append_mem(ds, ds_res_2_output->str, ds_res_2_output->length);
dynstr_free(ds_res_2_output);
}
goto end;
}
if (!disable_result_log)
{
/*
Not all statements creates a result set. If there is one we can
now create another normal result set that contains the meta
data. This set can be handled almost like any other non prepared
statement result set.
The results of the first and second execution are compared
only if result logging is enabled
*/
if ((res= mysql_stmt_result_metadata(stmt)) != NULL)
if (compare_2nd_execution && ps2_protocol_enabled && query_match_ps2_re)
{
/* Take the column count from meta info */
MYSQL_FIELD *fields= mysql_fetch_fields(res);
uint num_fields= mysql_num_fields(res);
if (display_metadata)
append_metadata(ds, fields, num_fields);
if (!display_result_vertically)
append_table_headings(ds, fields, num_fields);
append_stmt_result(ds, stmt, fields, num_fields);
mysql_free_result(res); /* Free normal result set with meta data */
DYNAMIC_STRING *ds_res_1_execution_compare;
DYNAMIC_STRING ds_res_1_execution_sorted;
if (display_result_sorted)
{
init_dynamic_string(&ds_res_1_execution_sorted, "",
RESULT_STRING_INIT_MEM,
RESULT_STRING_INCREMENT_MEM);
dynstr_append_sorted(&ds_res_1_execution_sorted,
&ds_res_1st_execution, 1);
dynstr_append_sorted(ds, &ds_res_2_execution_unsorted, 1);
ds_res_1_execution_compare= &ds_res_1_execution_sorted;
}
else
{
ds_res_1_execution_compare= &ds_res_1st_execution;
}
if (ds->length != ds_res_1_execution_compare->length ||
!(memcmp(ds_res_1_execution_compare->str, ds->str, ds->length) == 0))
{
die("The result of the 1st execution does not match with \n"
"the result of the 2nd execution of ps-protocol:\n 1st:\n"
"%s\n 2nd:\n %s",
ds_res_1_execution_compare->str,
ds->str);
}
if (display_result_sorted)
{
dynstr_free(&ds_res_1_execution_sorted);
dynstr_free(&ds_res_2_execution_unsorted);
}
}
/*
Normally, if there is a result set, we do not show warnings from the
prepare phase. This is because some warnings are generated both during
prepare and execute; this would generate different warning output
between normal and ps-protocol test runs.
The --enable_prepare_warnings command can be used to change this so
that warnings from both the prepare and execute phase are shown.
*/
if (!disable_warnings && !prepare_warnings_enabled)
{
DBUG_PRINT("info", ("warnings disabled"));
if ((mysql_stmt_result_metadata(stmt) != NULL) &&
!disable_warnings &&
!prepare_warnings_enabled)
dynstr_set(&ds_prepare_warnings, NULL);
}
}
else
{
/*
This is a query without resultset
*/
}
/*
Fetch info before fetching warnings, since it will be reset
@ -8643,7 +8776,6 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
if (display_session_track_info)
append_session_track_info(ds, mysql);
if (!disable_warnings && !mysql_more_results(stmt->mysql))
{
/* Get the warnings from execute */
@ -8675,7 +8807,15 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command,
mysql_sqlstate(mysql), ds);
else
handle_no_error(command);
end:
if (ds_res_1st_execution_init)
{
dynstr_free(&ds_res_1st_execution);
ds_res_1st_execution_init= FALSE;
}
if (!disable_warnings)
{
dynstr_free(&ds_prepare_warnings);
@ -9187,11 +9327,14 @@ int util_query(MYSQL* org_mysql, const char* query){
void run_query(struct st_connection *cn, struct st_command *command, int flags)
{
MYSQL *mysql= cn->mysql;
DYNAMIC_STRING *ds;
DYNAMIC_STRING *save_ds= NULL;
DYNAMIC_STRING ds_result;
DYNAMIC_STRING ds_sorted;
DYNAMIC_STRING ds_warnings;
DYNAMIC_STRING *rs_output; /* where to put results */
DYNAMIC_STRING rs_cmp_result; /* here we put results to compare with
pre-recrded file */
DYNAMIC_STRING rs_unsorted; /* if we need sorted results, here we store
results before sorting them */
DYNAMIC_STRING *rs_sorted_save= NULL; /* here we store where to put sorted
result if needed */
DYNAMIC_STRING rs_warnings;
char *query;
size_t query_len;
my_bool view_created= 0, sp_created= 0;
@ -9205,8 +9348,8 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
if (!(flags & QUERY_SEND_FLAG) && !cn->pending)
die("Cannot reap on a connection without pending send");
init_dynamic_string(&ds_warnings, NULL, 0, 256);
ds_warn= &ds_warnings;
init_dynamic_string(&rs_warnings, NULL, 0, 256);
ds_warn= &rs_warnings;
/*
Evaluate query if this is an eval command
@ -9237,11 +9380,11 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
*/
if (command->require_file)
{
init_dynamic_string(&ds_result, "", 1024, 1024);
ds= &ds_result;
init_dynamic_string(&rs_cmp_result, "", 1024, 1024);
rs_output= &rs_cmp_result;
}
else
ds= &ds_res;
rs_output= &ds_res; // will be shown to colsole
/*
Log the query into the output buffer
@ -9255,9 +9398,9 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
print_query= command->query;
print_len= (int)(command->end - command->query);
}
replace_dynstr_append_mem(ds, print_query, print_len);
dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, "\n", 1);
replace_dynstr_append_mem(rs_output, print_query, print_len);
dynstr_append_mem(rs_output, delimiter, delimiter_length);
dynstr_append_mem(rs_output, "\n", 1);
}
/* We're done with this flag */
@ -9312,7 +9455,7 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
Collect warnings from create of the view that should otherwise
have been produced when the SELECT was executed
*/
append_warnings(&ds_warnings,
append_warnings(&rs_warnings,
service_connection_enabled ?
cur_con->util_mysql :
mysql);
@ -9368,9 +9511,9 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
that can be sorted before it's added to the
global result string
*/
init_dynamic_string(&ds_sorted, "", 1024, 1024);
save_ds= ds; /* Remember original ds */
ds= &ds_sorted;
init_dynamic_string(&rs_unsorted, "", 1024, 1024);
rs_sorted_save= rs_output; /* Remember original ds */
rs_output= &rs_unsorted;
}
/*
@ -9391,20 +9534,20 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
All other statements can be run using prepared statement C API.
*/
!match_re(&ps_re, query))
run_query_stmt(cn, command, query, query_len, ds, &ds_warnings);
run_query_stmt(cn, command, query, query_len, rs_output, &rs_warnings);
else
run_query_normal(cn, command, flags, query, query_len,
ds, &ds_warnings);
rs_output, &rs_warnings);
dynstr_free(&ds_warnings);
dynstr_free(&rs_warnings);
ds_warn= 0;
if (display_result_sorted)
{
/* Sort the result set and append it to result */
dynstr_append_sorted(save_ds, &ds_sorted, 1);
ds= save_ds;
dynstr_free(&ds_sorted);
dynstr_append_sorted(rs_sorted_save, &rs_unsorted, 1);
rs_output= rs_sorted_save;
dynstr_free(&rs_unsorted);
}
if (sp_created)
@ -9427,11 +9570,11 @@ void run_query(struct st_connection *cn, struct st_command *command, int flags)
and the output should be checked against an already
existing file which has been specified using --require or --result
*/
check_require(ds, command->require_file);
check_require(rs_output, command->require_file);
}
if (ds == &ds_result)
dynstr_free(&ds_result);
if (rs_output == &rs_cmp_result)
dynstr_free(&rs_cmp_result);
DBUG_VOID_RETURN;
}
@ -9690,7 +9833,7 @@ void mark_progress(struct st_command* command __attribute__((unused)),
dynstr_append_mem(&ds_progress, "\t", 1);
/* Filename */
dynstr_append(&ds_progress, cur_file->file_name);
dynstr_append_mem(&ds_progress, cur_file->file_name, strlen(cur_file->file_name));
dynstr_append_mem(&ds_progress, ":", 1);
/* Line in file */
@ -9888,7 +10031,7 @@ int main(int argc, char **argv)
read_command_buf= (char*)my_malloc(PSI_NOT_INSTRUMENTED, read_command_buflen= 65536, MYF(MY_FAE));
init_dynamic_string(&ds_res, "", 2048, 2048);
init_dynamic_string(&ds_res, "", RESULT_STRING_INIT_MEM, RESULT_STRING_INCREMENT_MEM);
init_alloc_root(PSI_NOT_INSTRUMENTED, &require_file_root, 1024, 1024, MYF(0));
parse_args(argc, argv);
@ -10316,7 +10459,7 @@ int main(int argc, char **argv)
if (p && *p == '#' && *(p+1) == '#')
{
dynstr_append_mem(&ds_res, command->query, command->query_len);
dynstr_append(&ds_res, "\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n"));
}
break;
}
@ -10329,7 +10472,7 @@ int main(int argc, char **argv)
if (disable_query_log)
break;
dynstr_append(&ds_res, "\n");
dynstr_append_mem(&ds_res, STRING_WITH_LEN("\n"));
break;
case Q_PING:
handle_command_error(command, mysql_ping(cur_con->mysql), -1);
@ -11991,8 +12134,8 @@ void dynstr_append_sorted(DYNAMIC_STRING* ds, DYNAMIC_STRING *ds_input,
for (i= 0; i < lines.elements ; i++)
{
const char **line= dynamic_element(&lines, i, const char**);
dynstr_append(ds, *line);
dynstr_append(ds, "\n");
dynstr_append_mem(ds, *line, strlen(*line));
dynstr_append_mem(ds, STRING_WITH_LEN("\n"));
}
delete_dynamic(&lines);

View File

@ -90,7 +90,7 @@ IF(NOT CPACK_PACKAGE_FILE_NAME)
ENDIF()
SET_IF_UNSET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}")
SET_IF_UNSET(CPACK_PACKAGE_CONTACT "MariaDB Developers <maria-developers@lists.launchpad.net>")
SET_IF_UNSET(CPACK_PACKAGE_CONTACT "MariaDB Developers <developers@lists.mariadb.org>")
SET_IF_UNSET(CPACK_PACKAGE_VENDOR "MariaDB Foundation")
SET_IF_UNSET(CPACK_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}

2
debian/control vendored
View File

@ -1,7 +1,7 @@
Source: mariadb
Section: database
Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
Maintainer: MariaDB Developers <developers@lists.mariadb.org>
Build-Depends: bison,
cmake,
cracklib-runtime <!nocheck>,

5
debian/copyright vendored
View File

@ -2,12 +2,11 @@
== MariaDB ==
The Debian package of MySQL was first debianzed on 1997-04-12 by Christian
Schwarz <schwarz@debian.org> and ist maintained since 1999-04-20 by
Schwarz <schwarz@debian.org> and is maintained since 1999-04-20 by
Christian Hammers <ch@debian.org>.
The MariaDB packages were initially made by http://ourdelta.org/, and
are now managed by the MariaDB development team,
maria-developers@lists.launchpad.net
are now managed by the MariaDB development team, developers@lists.mariadb.org
MariaDB can be downloaded from https://downloads.mariadb.org/

View File

@ -1,6 +1,7 @@
libmariadb.so.3 libmariadb3 #MINVER#
* Build-Depends-Package: libmariadb-dev
libmariadb_3@libmariadb_3 3.0.0
libmariadb_3_3_5@libmariadb_3_3_5 3.3.5
libmariadbclient_18@libmariadbclient_18 3.0.0
libmysqlclient_18@libmysqlclient_18 3.0.0
ma_pvio_register_callback@libmariadb_3 3.0.0
@ -8,6 +9,7 @@ libmariadb.so.3 libmariadb3 #MINVER#
mariadb_connection@libmariadb_3 3.0.0
mariadb_convert_string@libmariadb_3 3.0.0
mariadb_deinitialize_ssl@libmariadb_3 3.0.0
mariadb_field_attr@libmariadb_3 3.3.1
mariadb_free_rpl_event@libmariadb_3 3.1.0
mariadb_get_charset_by_name@libmariadb_3 3.0.0
mariadb_get_charset_by_nr@libmariadb_3 3.0.0
@ -15,8 +17,12 @@ libmariadb.so.3 libmariadb3 #MINVER#
mariadb_get_infov@libmariadb_3 3.0.0
mariadb_reconnect@libmariadb_3 3.0.0
mariadb_rpl_close@libmariadb_3 3.1.0
mariadb_rpl_errno@libmariadb_3_3_5 3.3.2
mariadb_rpl_error@libmariadb_3_3_5 3.3.2
mariadb_rpl_extract_rows@libmariadb_3_3_5 3.3.2
mariadb_rpl_fetch@libmariadb_3 3.1.0
mariadb_rpl_get_optionsv@libmariadb_3 3.1.0
mariadb_rpl_init_ex@libmariadb_3 3.3.0
mariadb_rpl_open@libmariadb_3 3.1.0
mariadb_rpl_optionsv@libmariadb_3 3.1.0
mariadb_stmt_execute_direct@libmariadb_3 3.0.0

View File

@ -127,7 +127,8 @@ int sd_notifyf() { return 0; }
int sys_var_init();
/* === xtrabackup specific options === */
char xtrabackup_real_target_dir[FN_REFLEN] = "./mariadb_backup_files/";
#define DEFAULT_TARGET_DIR "./mariadb_backup_files/"
char xtrabackup_real_target_dir[FN_REFLEN] = DEFAULT_TARGET_DIR;
char *xtrabackup_target_dir= xtrabackup_real_target_dir;
static my_bool xtrabackup_version;
static my_bool verbose;
@ -410,6 +411,9 @@ uint opt_safe_slave_backup_timeout = 0;
const char *opt_history = NULL;
/* Whether xtrabackup_binlog_info should be created on recovery */
static bool recover_binlog_info;
char mariabackup_exe[FN_REFLEN];
char orig_argv1[FN_REFLEN];
@ -1269,22 +1273,25 @@ struct my_option xb_client_options[]= {
{"compress", OPT_XTRA_COMPRESS,
"Compress individual backup files using the "
"specified compression algorithm. Currently the only supported algorithm "
"is 'quicklz'. It is also the default algorithm, i.e. the one used when "
"--compress is used without an argument.",
"specified compression algorithm. It uses no longer maintained QuickLZ "
"library hence this option was deprecated with MariaDB 10.1.31 and 10.2.13.",
(G_PTR *) &xtrabackup_compress_alg, (G_PTR *) &xtrabackup_compress_alg, 0,
GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"compress-threads", OPT_XTRA_COMPRESS_THREADS,
"Number of threads for parallel data compression. The default value is "
"1.",
"1. "
"This option was deprecated as it relies on the no longer "
"maintained QuickLZ library.",
(G_PTR *) &xtrabackup_compress_threads,
(G_PTR *) &xtrabackup_compress_threads, 0, GET_UINT, REQUIRED_ARG, 1, 1,
UINT_MAX, 0, 0, 0},
{"compress-chunk-size", OPT_XTRA_COMPRESS_CHUNK_SIZE,
"Size of working buffer(s) for compression threads in bytes. The default "
"value is 64K.",
"value is 64K. "
"This option was deprecated as it relies on the no longer "
"maintained QuickLZ library.",
(G_PTR *) &xtrabackup_compress_chunk_size,
(G_PTR *) &xtrabackup_compress_chunk_size, 0, GET_ULL, REQUIRED_ARG,
(1 << 16), 1024, ULONGLONG_MAX, 0, 0, 0},
@ -1405,7 +1412,9 @@ struct my_option xb_client_options[]= {
{"decompress", OPT_DECOMPRESS,
"Decompresses all files with the .qp "
"extension in a backup previously made with the --compress option.",
"extension in a backup previously made with the --compress option. "
"This option was deprecated as it relies on the no longer "
"maintained QuickLZ library.",
(uchar *) &opt_decompress, (uchar *) &opt_decompress, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
@ -1699,8 +1708,11 @@ struct my_option xb_server_options[] =
"Path to InnoDB log files.", &srv_log_group_home_dir,
&srv_log_group_home_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"innodb_max_dirty_pages_pct", OPT_INNODB_MAX_DIRTY_PAGES_PCT,
"Percentage of dirty pages allowed in bufferpool.", (G_PTR*) &srv_max_buf_pool_modified_pct,
(G_PTR*) &srv_max_buf_pool_modified_pct, 0, GET_ULONG, REQUIRED_ARG, 90, 0, 100, 0, 0, 0},
"Percentage of dirty pages allowed in bufferpool.",
(G_PTR*) &srv_max_buf_pool_modified_pct,
(G_PTR*) &srv_max_buf_pool_modified_pct, 0, GET_DOUBLE, REQUIRED_ARG,
(longlong)getopt_double2ulonglong(90), (longlong)getopt_double2ulonglong(0),
getopt_double2ulonglong(100), 0, 0, 0},
{"innodb_use_native_aio", OPT_INNODB_USE_NATIVE_AIO,
"Use native AIO if supported on this platform.",
(G_PTR*) &srv_use_native_aio,
@ -2448,6 +2460,7 @@ xtrabackup_read_metadata(char *filename)
{
FILE *fp;
my_bool r = TRUE;
int t;
fp = fopen(filename,"r");
if(!fp) {
@ -2478,6 +2491,9 @@ xtrabackup_read_metadata(char *filename)
}
/* Optional fields */
if (fscanf(fp, "recover_binlog_info = %d\n", &t) == 1) {
recover_binlog_info = (t == 1);
}
end:
fclose(fp);
@ -2527,11 +2543,13 @@ xtrabackup_print_metadata(char *buf, size_t buf_len)
"backup_type = %s\n"
"from_lsn = " UINT64PF "\n"
"to_lsn = " UINT64PF "\n"
"last_lsn = " UINT64PF "\n",
"last_lsn = " UINT64PF "\n"
"recover_binlog_info = %d\n",
metadata_type,
metadata_from_lsn,
metadata_to_lsn,
metadata_last_lsn);
metadata_last_lsn,
MY_TEST(opt_binlog_info == BINLOG_INFO_LOCKLESS));
}
/***********************************************************************
@ -5966,6 +5984,26 @@ static ibool prepare_handle_del_files(const char *datadir, const char *db, const
return TRUE;
}
/**************************************************************************
Store the current binary log coordinates in a specified file.
@return 'false' on error. */
static bool
store_binlog_info(const char *filename, const char* name, ulonglong pos)
{
FILE *fp = fopen(filename, "w");
if (!fp) {
msg("mariabackup: failed to open '%s'\n", filename);
return(false);
}
fprintf(fp, "%s\t%llu\n", name, pos);
fclose(fp);
return(true);
}
/** Implement --prepare
@return whether the operation succeeded */
static bool xtrabackup_prepare_func(char** argv)
@ -6151,6 +6189,20 @@ error:
msg("Last binlog file %s, position %lld",
trx_sys.recovered_binlog_filename,
longlong(trx_sys.recovered_binlog_offset));
/* output to xtrabackup_binlog_pos_innodb and (if
backup_safe_binlog_info was available on the server) to
xtrabackup_binlog_info. In the latter case
xtrabackup_binlog_pos_innodb becomes redundant and is created
only for compatibility. */
ok = store_binlog_info(
"xtrabackup_binlog_pos_innodb",
trx_sys.recovered_binlog_filename,
trx_sys.recovered_binlog_offset)
&& (!recover_binlog_info || store_binlog_info(
XTRABACKUP_BINLOG_INFO,
trx_sys.recovered_binlog_filename,
trx_sys.recovered_binlog_offset));
}
/* Check whether the log is applied enough or not. */
@ -6352,7 +6404,7 @@ static bool check_all_privileges()
}
/* KILL ... */
if (!opt_no_lock && (opt_kill_long_queries_timeout || opt_kill_long_query_type)) {
if (!opt_no_lock && opt_kill_long_queries_timeout) {
check_result |= check_privilege(
granted_privileges,
"CONNECTION ADMIN", "*", "*",
@ -6373,7 +6425,7 @@ static bool check_all_privileges()
if (opt_galera_info || opt_slave_info
|| opt_safe_slave_backup) {
check_result |= check_privilege(granted_privileges,
"SLAVE MONITOR", "*", "*",
"REPLICA MONITOR", "*", "*",
PRIVILEGE_WARNING);
}
@ -6586,9 +6638,10 @@ void handle_options(int argc, char **argv, char ***argv_server,
server_default_groups.push_back(NULL);
snprintf(conf_file, sizeof(conf_file), "my");
if (prepare && target_dir) {
if (prepare) {
snprintf(conf_file, sizeof(conf_file),
"%s/backup-my.cnf", target_dir);
"%s/backup-my.cnf", target_dir ? target_dir:
DEFAULT_TARGET_DIR);
if (!strncmp(argv[1], "--defaults-file=", 16)) {
/* Remove defaults-file*/
for (int i = 2; ; i++) {

View File

@ -171,7 +171,7 @@ extern uint opt_safe_slave_backup_timeout;
extern const char *opt_history;
enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_ON,
enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_LOCKLESS, BINLOG_INFO_ON,
BINLOG_INFO_AUTO};
extern ulong opt_binlog_info;

View File

@ -170,6 +170,7 @@ int main(int argc, char **argv)
if ((error= load_defaults(config_file, (const char **) load_default_groups,
&count, &arguments)))
{
my_free(load_default_groups);
my_end(0);
if (error == 4)
return 0;

View File

@ -83,7 +83,7 @@ static inline ulonglong uint6korr(const void *p)
#define HAVE_mi_uint5korr
#define HAVE_mi_uint6korr
#define HAVE_mi_uint7korr
#define HAVE_mi_uint78orr
#define HAVE_mi_uint8korr
/* Read numbers stored in high-bytes-first order */

View File

@ -448,7 +448,8 @@ enum my_lex_states
MY_LEX_IDENT_OR_KEYWORD,
MY_LEX_IDENT_OR_HEX, MY_LEX_IDENT_OR_BIN, MY_LEX_IDENT_OR_NCHAR,
MY_LEX_STRING_OR_DELIMITER, MY_LEX_MINUS_OR_COMMENT, MY_LEX_PLACEHOLDER,
MY_LEX_COMMA
MY_LEX_COMMA,
MY_LEX_IDENT_OR_QUALIFIED_SPECIAL_FUNC
};
struct charset_info_st;

View File

@ -25,6 +25,8 @@
#define ALLOC_MAX_BLOCK_TO_DROP 4096
#define ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP 10
#define ROOT_FLAG_READ_ONLY 4
#ifdef __cplusplus
extern "C" {
#endif
@ -53,10 +55,6 @@ typedef struct st_mem_root
unsigned short first_block_usage;
unsigned short flags;
#ifdef PROTECT_STATEMENT_MEMROOT
int read_only;
#endif
void (*error_handler)(void);
PSI_memory_key psi_key;

View File

@ -668,11 +668,15 @@ extern void my_mutex_end(void);
with the current number of keys and key parts.
*/
# if defined(__SANITIZE_ADDRESS__) || defined(WITH_UBSAN)
#ifndef DBUG_OFF
#define DEFAULT_THREAD_STACK (1024*1024L)
#else
#define DEFAULT_THREAD_STACK (383*1024L) /* 392192 */
#endif
/*
Optimized WITH_ASAN=ON executables produced
by GCC 12.3.0, GCC 13.2.0, or clang 16.0.6
would fail ./mtr main.1st when the stack size is 5 MiB.
The minimum is more than 6 MiB for CMAKE_BUILD_TYPE=RelWithDebInfo and
more than 8 MiB for CMAKE_BUILD_TYPE=Debug.
Let us add some safety margin.
*/
# define DEFAULT_THREAD_STACK (10L<<20)
# else
# define DEFAULT_THREAD_STACK (292*1024L) /* 299008 */
# endif

View File

@ -896,6 +896,7 @@ extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root,
extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
extern void free_root(MEM_ROOT *root, myf MyFLAGS);
extern void move_root(MEM_ROOT *to, MEM_ROOT *from);
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
size_t prealloc_size);

View File

@ -112,6 +112,7 @@ typedef struct st_handler_check_param
uint progress_counter; /* How often to call _report_progress() */
ulonglong progress, max_progress;
void (*init_fix_record)(void *);
int (*fix_record)(struct st_myisam_info *info, uchar *record, int keynum);
mysql_mutex_t print_msg_mutex;

View File

@ -268,7 +268,6 @@ typedef struct st_mysql
char *host,*user,*passwd,*unix_socket,*server_version,*host_info;
char *info, *db;
const struct charset_info_st *charset;
MYSQL_FIELD *fields;
MEM_ROOT field_alloc;
my_ulonglong affected_rows;
my_ulonglong insert_id; /* id if insert on table with NEXTNR */
@ -290,7 +289,8 @@ typedef struct st_mysql
/* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1];
my_bool auto_local_infile;
void *unused2, *unused3, *unused4, *unused5;
void *unused2, *unused3, *unused4;
MYSQL_FIELD *fields;
LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods;

View File

@ -121,5 +121,3 @@ MYSQL *mysql_real_connect_local(MYSQL *mysql);
#endif
#endif /*MYSQL_SERVICE_SQL */

View File

@ -459,6 +459,7 @@ static int emb_read_change_user_result(MYSQL *mysql)
return mysql_errno(mysql) ? (int)packet_error : 1 /* length of the OK packet */;
}
static void emb_on_close_free(MYSQL *mysql)
{
my_free(mysql->info_buffer);
@ -470,6 +471,7 @@ static void emb_on_close_free(MYSQL *mysql)
}
}
MYSQL_METHODS embedded_methods=
{
emb_read_query_result,
@ -705,8 +707,7 @@ void *create_embedded_thd(ulong client_flag)
if (thd->variables.max_join_size == HA_POS_ERROR)
thd->variables.option_bits |= OPTION_BIG_SELECTS;
thd->proc_info=0; // Remove 'login'
thd->set_command(COM_SLEEP);
thd->mark_connection_idle();
thd->set_time();
thd->init_for_queries();
thd->client_capabilities= client_flag | MARIADB_CLIENT_EXTENDED_METADATA;
@ -1446,4 +1447,3 @@ int vprint_msg_to_log(enum loglevel level __attribute__((unused)),
}
return 0;
}

View File

@ -84,8 +84,8 @@ edit the test result to the correct results so that we can verify that
the bug is corrected in future releases.
If you want to submit your test case you can send it
to maria-developers@lists.launchpad.net or attach it to a bug report on
https://mariadb.org/jira/.
to developers@lists.mariadb.org or attach it to a bug report on
http://mariadb.org/jira/.
If the test case is really big or if it contains 'not public' data,
then put your .test file and .result file(s) into a tar.gz archive,

View File

@ -310,6 +310,19 @@ INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
--source include/explain_utils.inc
DROP TABLE t1;
--echo #30a
--echo #
--echo # MDEV-32957 Unusable key notes report wrong predicates for > and >=
--echo #
CREATE TABLE t1(a INT, i CHAR(2), INDEX(i(1)));
INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
(20),(21),(22),(23),(24),(25),(26),(27),(28),(29),
(30),(31),(32),(33),(34),(35);
--let $query = DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
--let $select = SELECT * FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
--source include/explain_utils.inc
DROP TABLE t1;
--echo #31
CREATE TABLE t1 (i INT);
INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),

View File

@ -0,0 +1,12 @@
#
# Include this file in your .test file if your testcase uses InnoDB tables
# requiring stable query plans, which likely requires that InnoDB produces
# stable estimates for #records in tables.
#
# How it works:
# Unstable InnoDB estimates are caused by InnoDB's background statistics
# collection. When you include this file, MTR will use server options from
# include/innodb_stable_estimates.opt, which disables background statistics
# collection.
# (and no, InnoDB team objects to using this configuration for all MTR tests)
#

View File

@ -0,0 +1 @@
--innodb_stats_auto_recalc=0

View File

@ -59,7 +59,7 @@ let $_wfsie_errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
if ($slave_io_errno == '') {
--echo !!!ERROR IN TEST: you must set \$slave_io_errno before you source
--echo !!!wait_for_slave_sql_error.inc. The error we got this time was '$_wfsie_errno',
--echo !!!wait_for_slave_io_error.inc. The error we got this time was '$_wfsie_errno',
--echo !!!so you probably want to add the following line to your test case:
--echo !!! --let \$slave_io_errno= $_wfsie_errno
--die !!!ERROR IN TEST: you must set \$slave_io_errno before sourcing wait_for_slave_io_error.inc

View File

@ -21,6 +21,17 @@
# $slave_timeout
# See include/wait_for_slave_param.inc.
#
# $rpl_allow_error
# By default, this file fails if there is an error in the IO
# thread. However, if an error in the IO thread is possible and allowed,
# setting $rpl_allow_error=1 will prevent this file from failing if
# there is an error in the IO thread.
# (If an error is _always_ expected, a better alternative might be to
# use wait_for_slave_io_error.inc instead of this file).
# Note: This is currently always enabled, since a simple STOP SLAVE
# IO_THREAD can cause an error if it interrupts the slave's initial
# communication with the master (MDEV-32892).
#
# $rpl_debug
# See include/rpl_init.inc
@ -31,9 +42,15 @@
--let $slave_param= Slave_IO_Running
--let $slave_param_value= No
--let $slave_error_param= Last_IO_Errno
--let $_io_stop_save_allow_error= $slave_error_param
# Disabled, as IO errors are left behind when a normal STOP SLAVE interrupts
# the initial communication between the IO thread and the master (MDEV-32892).
#if (!$rpl_allow_error)
#{
# --let $slave_error_param= Last_IO_Errno
#}
--source include/wait_for_slave_param.inc
--let $slave_error_param=
--let $slave_error_param= $_io_stop_save_allow_error
--let $include_filename= wait_for_slave_io_to_stop.inc

View File

@ -35,7 +35,7 @@
# $slave_error_param
# If set, this script will check if the column of the output from
# SHOW SLAVE STATUS named $slave_error_param is nonzero. If it is,
# this script will faile immediately. Typically, this should be set
# this script will fail immediately. Typically, this should be set
# to Last_IO_Errno or Last_SQL_Errno.
#
# $rpl_debug
@ -56,11 +56,6 @@ if (!$_slave_timeout)
}
}
if ($slave_error_param == '')
{
--let $slave_error_param= 1
}
let $_slave_param_comparison= $slave_param_comparison;
if (!$_slave_param_comparison)
{
@ -90,7 +85,7 @@ while ($_slave_continue)
--let $_show_slave_status_value= query_get_value("SHOW SLAVE STATUS", $slave_param, 1)
# Check if an error condition is reached.
if (!$slave_error_param)
if ($slave_error_param)
{
--let $_show_slave_status_error_value= query_get_value("SHOW SLAVE STATUS", $slave_error_param, 1)
if ($_show_slave_status_error_value)

View File

@ -21,6 +21,14 @@
# $slave_timeout
# See include/wait_for_slave_param.inc
#
# $rpl_allow_error
# By default, this file fails if there is an error in the SQL
# thread. However, if an error in the SQL thread is possible and allowed,
# setting $rpl_allow_error=1 will prevent this file from failing if
# there is an error in the SQL thread.
# (If an error is _always_ expected, a better alternative might be to
# use wait_for_slave_sql_error.inc instead of this file).
#
# $rpl_debug
# See include/rpl_init.inc
@ -31,7 +39,10 @@
--let $slave_param= Slave_SQL_Running
--let $slave_param_value= No
if (!$rpl_allow_error)
{
--let $slave_error_param= Last_SQL_Errno
}
--source include/wait_for_slave_param.inc
--let $slave_error_param=

View File

@ -1973,8 +1973,7 @@ ALTER TABLE ti1 DROP FOREIGN KEY fi1;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE tm1 DROP FOREIGN KEY fm1;
affected rows: 2
info: Records: 2 Duplicates: 0 Warnings: 0
ERROR 42000: Can't DROP FOREIGN KEY `fm1`; check that it exists
ALTER TABLE ti1 RENAME TO ti3;
affected rows: 0
ALTER TABLE tm1 RENAME TO tm3;

View File

@ -1688,6 +1688,7 @@ ALTER TABLE ti1 DROP PRIMARY KEY;
ALTER TABLE tm1 DROP PRIMARY KEY;
ALTER TABLE ti1 DROP FOREIGN KEY fi1;
--error ER_CANT_DROP_FIELD_OR_KEY
ALTER TABLE tm1 DROP FOREIGN KEY fm1;
ALTER TABLE ti1 RENAME TO ti3;

View File

@ -95,7 +95,7 @@ drop table t1;
#
# BACKUP STAGE performs implicit commits
#
create table t1(a int) engine=InnoDB;
create table t1(a int) stats_persistent=0, engine=InnoDB;
begin;
insert into t1 values(1);
select lock_mode from information_schema.metadata_lock_info where thread_id>0;
@ -197,8 +197,9 @@ drop table t1;
# CHECK: RO transaction under BACKUP STAGE is a potential deadlock
# OTOH we most probably allow them under FTWRL as well
#
CREATE TABLE t1 (col1 INT) ENGINE = InnoDB;
CREATE TABLE t1 (col1 INT)stats_persistent=0, ENGINE = InnoDB;
insert into t1 values (1);
InnoDB 0 transactions not purged
backup stage start;
backup stage block_commit;
begin;

View File

@ -120,7 +120,7 @@ drop table t1;
--echo # BACKUP STAGE performs implicit commits
--echo #
--disable_view_protocol
create table t1(a int) engine=InnoDB;
create table t1(a int) stats_persistent=0, engine=InnoDB;
begin;
insert into t1 values(1);
select lock_mode from information_schema.metadata_lock_info where thread_id>0;
@ -221,8 +221,9 @@ drop table t1;
--echo # OTOH we most probably allow them under FTWRL as well
--echo #
--disable_view_protocol
CREATE TABLE t1 (col1 INT) ENGINE = InnoDB;
CREATE TABLE t1 (col1 INT)stats_persistent=0, ENGINE = InnoDB;
insert into t1 values (1);
--source ../suite/innodb/include/wait_all_purged.inc
backup stage start;
backup stage block_commit;
begin;

View File

@ -1,6 +1,7 @@
#
# Testing which locks we get from all stages
#
InnoDB 0 transactions not purged
BACKUP STAGE START;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
@ -34,7 +35,8 @@ connection default;
#
# testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE
#
create table t1 (a int) engine=innodb;
create table t1 (a int) stats_persistent= 0, engine=innodb;
InnoDB 0 transactions not purged
connection con2;
backup stage start;
connection default;
@ -104,7 +106,8 @@ drop table t1;
#
# testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE
#
create table t1 (a int) engine=innodb;
create table t1 (a int)stats_persistent=0, engine=innodb;
InnoDB 0 transactions not purged
start transaction;
insert into t1 values (1);
connection con1;
@ -132,6 +135,7 @@ connection default;
# Check if backup stage block_dll + concurrent drop table blocks select
#
create table t1 (a int) engine=innodb;
InnoDB 0 transactions not purged
backup stage start;
backup stage block_ddl;
connection con1;

View File

@ -15,6 +15,8 @@
let $mdl= LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info
WHERE TABLE_NAME NOT LIKE 'innodb_%_stats';
--source ../suite/innodb/include/wait_all_purged.inc
BACKUP STAGE START;
eval SELECT $mdl;
BACKUP STAGE FLUSH;
@ -39,7 +41,8 @@ connection default;
--echo # testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE
--echo #
create table t1 (a int) engine=innodb;
create table t1 (a int) stats_persistent= 0, engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
connection con2;
backup stage start;
@ -129,7 +132,8 @@ drop table t1;
--echo # testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE
--echo #
create table t1 (a int) engine=innodb;
create table t1 (a int)stats_persistent=0, engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
start transaction;
# Acquires MDL lock
insert into t1 values (1);
@ -165,6 +169,7 @@ connection default;
--echo #
create table t1 (a int) engine=innodb;
--source ../suite/innodb/include/wait_all_purged.inc
backup stage start;
backup stage block_ddl;
connection con1;

View File

@ -23,7 +23,7 @@ BACKUP UNLOCK;
#
connect con1,localhost,root,,;
connection default;
create table t1 (a int) engine=innodb;
create table t1 (a int) stats_persistent=0,engine=innodb;
insert into t1 values (1);
backup lock t1;
select * from t1;
@ -184,5 +184,82 @@ ERROR HY000: Can't execute the query because you have a conflicting read lock
BACKUP UNLOCK;
DROP TABLE t3;
#
# MDEV-28367: BACKUP LOCKS on table to be accessible to those
# with database LOCK TABLES privileges
#
create database db1;
create table db1.t1(t int);
create user user1@localhost;
select user,host from mysql.user where user='user1';
User Host
user1 localhost
connect(localhost,user1,,db1,MASTER_PORT,MASTER_SOCKET);
connect con1, localhost, user1, ,db1;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1'
grant reload on *.* to user1@localhost;
grant select on db1.* to user1@localhost;
show grants for user1@localhost;
Grants for user1@localhost
GRANT RELOAD ON *.* TO `user1`@`localhost`
GRANT SELECT ON `db1`.* TO `user1`@`localhost`
connect con1, localhost, user1, ,db1;
BACKUP UNLOCK;
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_SHARED_HIGH_PRIO Table metadata lock db1 t1
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
connection default;
disconnect con1;
grant lock tables on db1.* to user1@localhost;
show grants for user1@localhost;
Grants for user1@localhost
GRANT RELOAD ON *.* TO `user1`@`localhost`
GRANT SELECT, LOCK TABLES ON `db1`.* TO `user1`@`localhost`
connect con1, localhost, user1, ,db1;
BACKUP UNLOCK;
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_SHARED_HIGH_PRIO Table metadata lock db1 t1
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
connection default;
disconnect con1;
revoke reload on *.* from user1@localhost;
show grants for user1@localhost;
Grants for user1@localhost
GRANT USAGE ON *.* TO `user1`@`localhost`
GRANT SELECT, LOCK TABLES ON `db1`.* TO `user1`@`localhost`
connect con1, localhost, user1, ,db1;
BACKUP UNLOCK;
ERROR 42000: Access denied; you need (at least one of) the RELOAD, LOCK TABLES privilege(s) for this operation
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_SHARED_HIGH_PRIO Table metadata lock db1 t1
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
connection default;
disconnect con1;
revoke lock tables on db1.* from user1@localhost;
show grants for user1@localhost;
Grants for user1@localhost
GRANT USAGE ON *.* TO `user1`@`localhost`
GRANT SELECT ON `db1`.* TO `user1`@`localhost`
connect con1, localhost, user1, ,db1;
BACKUP LOCK db1.t1;
ERROR 42000: Access denied; you need (at least one of) the RELOAD, LOCK TABLES privilege(s) for this operation
BACKUP UNLOCK;
ERROR 42000: Access denied; you need (at least one of) the RELOAD, LOCK TABLES privilege(s) for this operation
connection default;
disconnect con1;
drop database db1;
drop user user1@localhost;
#
# End of MariaDB 10.4 tests
#

View File

@ -29,7 +29,7 @@ BACKUP UNLOCK;
connect (con1,localhost,root,,);
connection default;
create table t1 (a int) engine=innodb;
create table t1 (a int) stats_persistent=0,engine=innodb;
insert into t1 values (1);
backup lock t1;
select * from t1;
@ -214,7 +214,78 @@ LOCK TABLES t3 AS a2 WRITE, t3 AS a1 READ LOCAL;
DROP TABLE t3;
BACKUP UNLOCK;
DROP TABLE t3;
--echo #
--echo # MDEV-28367: BACKUP LOCKS on table to be accessible to those
--echo # with database LOCK TABLES privileges
--echo #
--source include/have_metadata_lock_info.inc
create database db1;
create table db1.t1(t int);
create user user1@localhost;
select user,host from mysql.user where user='user1';
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_DBACCESS_DENIED_ERROR
--connect (con1, localhost, user1, ,db1)
grant reload on *.* to user1@localhost;
# To access DB one need select privileges
grant select on db1.* to user1@localhost;
show grants for user1@localhost;
--connect (con1, localhost, user1, ,db1)
# This should work we have RELOAD privilege
BACKUP UNLOCK;
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
# Add LOCK TABLES DB privileges (all privileges for BACKUP LOCK are there)
connection default;
disconnect con1;
grant lock tables on db1.* to user1@localhost;
show grants for user1@localhost;
--connect (con1, localhost, user1, ,db1)
# This should work we have RELOAD & LOCK privilege
BACKUP UNLOCK;
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
# Remove reload privilege, leave only LOCK TABLES privilege
connection default;
disconnect con1;
revoke reload on *.* from user1@localhost;
show grants for user1@localhost;
--connect (con1, localhost, user1, ,db1)
# There is no reload priv needed for unlock and there is no mdl_backup_lock taken
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP UNLOCK;
# BACKUP LOCK should work, since we have LOCK privilege
BACKUP LOCK db1.t1;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
# This works since there was taken mdl_backup_lock before
BACKUP UNLOCK;
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info where table_name not like "innodb_%";
# Remove LOCK TABLES privilege
connection default;
disconnect con1;
revoke lock tables on db1.* from user1@localhost;
show grants for user1@localhost;
--connect (con1, localhost, user1, ,db1)
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP LOCK db1.t1;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP UNLOCK;
connection default;
disconnect con1;
drop database db1;
drop user user1@localhost;
--echo #
--echo # End of MariaDB 10.4 tests
--echo #

View File

@ -17,6 +17,7 @@ FROM information_schema.processlist WHERE id = @con1_id;
ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY
<con1_id> root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START
BACKUP STAGE END;
InnoDB 0 transactions not purged
connection con1;
# The connection default has removed the backup lock.
# And so the current connection con1 can reap for its BACKUP STAGE START

View File

@ -50,6 +50,7 @@ FROM information_schema.processlist WHERE id = @con1_id;
# con1 uses @@global.lock_wait_timeout
BACKUP STAGE END;
--source ../suite/innodb/include/wait_all_purged.inc
--connection con1
--echo # The connection default has removed the backup lock.

View File

@ -814,7 +814,7 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` char(5) GENERATED ALWAYS AS (cast('a' as char(10) charset latin1) + `a`) VIRTUAL
`b` char(5) GENERATED ALWAYS AS (cast('a' as char(10) charset latin1 binary) + `a`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
drop table t1;
select collation(cast("a" as char(10) binary));

View File

@ -158,10 +158,9 @@ select cast(1 as double(64,63));
#
set names binary;
select cast(_latin1'test' as char character set latin2);
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
--enable_view_protocol
--enable_service_connection
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251) as t;
show create table t1;
drop table t1;
@ -169,8 +168,7 @@ drop table t1;
#
# CAST to CHAR with/without length
#
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
select
cast(_latin1'ab' AS char) as c1,
cast(_latin1'a ' AS char) as c2,
@ -178,7 +176,7 @@ select
cast(_latin1'a ' AS char(2)) as c4,
hex(cast(_latin1'a' AS char(2))) as c5;
select cast(1000 as CHAR(3));
--enable_view_protocol
--enable_service_connection
SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR
create table t1 select
@ -239,15 +237,14 @@ select cast("1:2:3" as TIME) = "1:02:03";
#
CREATE TABLE t1 (a enum ('aac','aab','aaa') not null);
INSERT INTO t1 VALUES ('aaa'),('aab'),('aac');
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
# these two should be in enum order
SELECT a, CAST(a AS CHAR) FROM t1 ORDER BY CAST(a AS UNSIGNED) ;
SELECT a, CAST(a AS CHAR(3)) FROM t1 ORDER BY CAST(a AS CHAR(2)), a;
# these two should be in alphabetic order
SELECT a, CAST(a AS UNSIGNED) FROM t1 ORDER BY CAST(a AS CHAR) ;
SELECT a, CAST(a AS CHAR(2)) FROM t1 ORDER BY CAST(a AS CHAR(3)), a;
--enable_view_protocol
--enable_service_connection
DROP TABLE t1;
#
@ -349,12 +346,11 @@ select cast(NULL as decimal(6)) as t1;
# Bug #17903: cast to char results in binary
#
set names latin1;
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
select hex(cast('a' as char(2) binary));
select hex(cast('a' as binary(2)));
select hex(cast('a' as char(2) binary));
--enable_view_protocol
--enable_service_connection
#
# Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
@ -484,14 +480,13 @@ drop table t1;
#
# CAST (... BINARY)
#
#enable after MDEV-32461 fix
--disable_view_protocol
--disable_service_connection
select collation(cast("a" as char(10) binary));
select collation(cast("a" as char(10) charset utf8 binary));
select collation(cast("a" as char(10) ascii binary));
select collation(cast("a" as char(10) binary charset utf8));
select collation(cast("a" as char(10) binary ascii));
--enable_view_protocol
--enable_service_connection
--echo #
--echo # MDEV-11030 Assertion `precision > 0' failed in decimal_bin_size
@ -773,14 +768,14 @@ INSERT INTO t1 VALUES (-1.0);
SELECT * FROM t1;
DROP TABLE t1;
#enable after MDEV-32461 fix
#enable after MDEV-32645 is fixed
--disable_view_protocol
SELECT CAST(-1e0 AS UNSIGNED);
--enable_view_protocol
CREATE TABLE t1 (a BIGINT UNSIGNED);
INSERT INTO t1 VALUES (-1e0);
SELECT * FROM t1;
DROP TABLE t1;
--enable_view_protocol
SELECT CAST(-1e308 AS UNSIGNED);
CREATE TABLE t1 (a BIGINT UNSIGNED);

View File

@ -1,4 +1,6 @@
set global secure_auth=0;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
create user test_nopw;
grant select on test.* to test_nopw;
create user test_oldpw identified by password "09301740536db389";
@ -90,6 +92,8 @@ NULL
FLUSH STATUS;
Value of com_select did not change
set global secure_auth=default;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
set timestamp=unix_timestamp('2010-10-10 10:10:10');
select now();
now()

View File

@ -1,4 +1,6 @@
SET global secure_auth=0;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
connect con1,localhost,root,,mysql;
show tables;
Tables_in_mysql
@ -412,6 +414,8 @@ test
test
drop procedure p1;
SET global secure_auth=default;
Warnings:
Warning 1287 '@@secure_auth' is deprecated and will be removed in a future release
#
# MDEV-19282: Log more specific warning with log_warnings=2 if
# connection is aborted prior to authentication

View File

@ -260,6 +260,7 @@ Note 1051 Unknown table 'test.t1,mysqltest2.t2'
create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
InnoDB 0 transactions not purged
select * from information_schema.metadata_lock_info;
THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME
# MDL_BACKUP_DDL NULL Backup lock

View File

@ -216,6 +216,7 @@ drop table if exists test.t1,mysqltest2.t2;
create table test.t1 (i int) engine=myisam;
create table mysqltest2.t2 like test.t1;
lock table test.t1 write, mysqltest2.t2 write;
--source ../suite/innodb/include/wait_all_purged.inc
--replace_column 1 #
--sorted_result
select * from information_schema.metadata_lock_info;

View File

@ -2611,4 +2611,29 @@ src path dest distance population
E FD D 251 80000
drop procedure sp;
drop table distances, city_population;
#
# MDEV-28615: Multi-table UPDATE over derived table containing
# row that uses subquery with hanging CTE
#
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (3), (7), (1);
UPDATE
(SELECT (5, (WITH cte AS (SELECT 1) SELECT a FROM t1))) dt
JOIN t1 t
ON t.a=dt.a
SET t.a = 1;
ERROR 21000: Operand should contain 1 column(s)
UPDATE
(SELECT a FROM t1
WHERE (5, (WITH cte AS (SELECT 1) SELECT a FROM t1 WHERE a > 4)) <=
(5,a)) dt
JOIN t1 t
ON t.a=dt.a
SET t.a = 1;
SELECT * FROM t1;
a
3
1
1
DROP TABLE t1;
# End of 10.4 tests

View File

@ -1796,8 +1796,6 @@ with data as (select 1 as id)
select id into @myid from data;
set sql_mode= @save_sql_mode;
--echo #
--echo # MDEV-31995 Bogus error executing PS for query using CTE with renaming of columns
--echo #
@ -1954,4 +1952,31 @@ drop procedure sp;
drop table distances, city_population;
--echo #
--echo # MDEV-28615: Multi-table UPDATE over derived table containing
--echo # row that uses subquery with hanging CTE
--echo #
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (3), (7), (1);
--error ER_OPERAND_COLUMNS
UPDATE
(SELECT (5, (WITH cte AS (SELECT 1) SELECT a FROM t1))) dt
JOIN t1 t
ON t.a=dt.a
SET t.a = 1;
UPDATE
(SELECT a FROM t1
WHERE (5, (WITH cte AS (SELECT 1) SELECT a FROM t1 WHERE a > 4)) <=
(5,a)) dt
JOIN t1 t
ON t.a=dt.a
SET t.a = 1;
SELECT * FROM t1;
DROP TABLE t1;
--echo # End of 10.4 tests

View File

@ -614,18 +614,24 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` >= "'a'" of collation `latin1_german1_ci`
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` = "'a'" of collation `latin1_german1_ci`
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 1 Using index condition
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` like "'a' collate latin1_german1_ci" of collation `latin1_german1_ci`
DROP TABLE t1;
create table t1(f1 varchar(10) character set latin2 collate latin2_hungarian_ci, key(f1));
insert into t1 set f1=0x3F3F9DC73F;

View File

@ -888,7 +888,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET STATEMENT ',@seq, '.a=1 SELECT 1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET STATEMENT a.',@seq, '=1 SELECT 1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
#
# SET SESSION (bad|good.bad|bad.good)=1
#
@ -897,7 +897,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET SESSION ',@seq, '.a=1 SELECT 1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET SESSION a.',@seq, '=1 SELECT 1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
#
# SET (bad|good.bad|bad.good)=1
#
@ -906,7 +906,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET ', @seq, '.a=1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('SET a.', @seq, '=1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
#
# Oracle SP call: BEGIN (bad|good.bad|bad.good)(params); END
#
@ -916,7 +916,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('BEGIN ',@seq, '.a(1); END;');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('BEGIN a.',@seq, '(1); END;');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
#
# Oracle assignment: (bad|good.bad|bad.good):= value
#
@ -925,7 +925,7 @@ ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT(@seq, '.a:=1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
EXECUTE IMMEDIATE CONCAT('a.', @seq, ':=1');
ERROR HY000: Invalid cp932 character string: '\x81\xAD'
ERROR HY000: Invalid cp932 character string: '\x81'
SET sql_mode=DEFAULT;
#
# End of 10.5 tests

View File

@ -19619,7 +19619,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT('SET STATEMENT ',@seq, '.a=1 SELECT 1');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('SET STATEMENT a.',@seq, '=1 SELECT 1');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
#
# SET SESSION (bad|good.bad|bad.good)=1
#
@ -19628,7 +19628,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT('SET SESSION ',@seq, '.a=1 SELECT 1');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('SET SESSION a.',@seq, '=1 SELECT 1');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
#
# SET (bad|good.bad|bad.good)=1
#
@ -19637,7 +19637,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT('SET ', @seq, '.a=1');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('SET a.', @seq, '=1');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
#
# Oracle SP call: BEGIN (bad|good.bad|bad.good)(params); END
#
@ -19647,7 +19647,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT('BEGIN ',@seq, '.a(1); END;');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('BEGIN a.',@seq, '(1); END;');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
#
# Oracle assignment: (bad|good.bad|bad.good):= value
#
@ -19656,7 +19656,7 @@ ERROR HY000: Invalid sjis character string: '
EXECUTE IMMEDIATE CONCAT(@seq, '.a:=1');
ERROR HY000: Invalid sjis character string: '<27>_x81<38>_xAD'
EXECUTE IMMEDIATE CONCAT('a.', @seq, ':=1');
ERROR HY000: Invalid sjis character string: '<27>_x81<EFBFBD>_xAD'
ERROR HY000: Invalid sjis character string: '<27>_x81'
SET sql_mode=DEFAULT;
#
# End of 10.5 tests

View File

@ -610,4 +610,49 @@ c1 c2 c3
2 1 4
2 2 5
drop table t1;
#
# MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
#
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
select * from t1;
c1
1
3
4
5
6
truncate t1;
truncate t2;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
check sj optimization with order-by
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using filesort
1 PRIMARY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 16.67 Using where; FirstMatch(t1)
select * from t1;
c1
1
3
4
5
6
truncate t2;
INSERT INTO t2 values (3);
disallows sj optimization
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 5 1.00 100.00 100.00 Using where; Using filesort
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 1 1.00 100.00 20.00 Using where
select * from t1;
c1
1
4
5
6
DROP TABLE t1, t2;
End of 11.1 tests

View File

@ -667,4 +667,31 @@ select *from t1;
drop table t1;
--echo #
--echo # MDEV-32212 DELETE with ORDER BY and semijoin optimization causing crash
--echo #
--source include/have_innodb.inc
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TABLE t2 (c2 INT) ENGINE=InnoDB;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
DELETE FROM t1 WHERE c1 IN (select c2 from t2);
select * from t1;
truncate t1;
truncate t2;
INSERT INTO t1 values (1),(2),(3),(4),(5),(6);
INSERT INTO t2 values (2);
--echo check sj optimization with order-by
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1;
select * from t1;
truncate t2;
INSERT INTO t2 values (3);
--echo disallows sj optimization
analyze DELETE FROM t1 WHERE c1 IN (select c2 from t2) ORDER BY c1 limit 1;
select * from t1;
DROP TABLE t1, t2;
--echo End of 11.1 tests

View File

@ -891,5 +891,20 @@ SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
a b
DROP VIEW v;
DROP TABLE t1, t2, t3;
#
# MDEV-31279 Crash when lateral derived is guaranteed to return no rows
#
CREATE TABLE t1 (a CHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1'),('2');
CREATE TABLE t2 (b INT, KEY(b)) ENGINE=MyISAM;
ALTER TABLE t2 DISABLE KEYS;
INSERT INTO t2 VALUES (1),(2),(3);
ALTER TABLE t2 ENABLE KEYS;
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 (c) SELECT seq FROM seq_1_to_101;
SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM
(SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq);
a
DROP TABLE t1, t2, t3;
# End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@ -499,6 +499,24 @@ SELECT * FROM t1 JOIN t2 WHERE (t1.a, t2.b) IN (SELECT * FROM v);
DROP VIEW v;
DROP TABLE t1, t2, t3;
--echo #
--echo # MDEV-31279 Crash when lateral derived is guaranteed to return no rows
--echo #
CREATE TABLE t1 (a CHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('1'),('2');
CREATE TABLE t2 (b INT, KEY(b)) ENGINE=MyISAM;
ALTER TABLE t2 DISABLE KEYS;
INSERT INTO t2 VALUES (1),(2),(3);
ALTER TABLE t2 ENABLE KEYS;
CREATE TABLE t3 (c INT) ENGINE=MyISAM;
INSERT INTO t3 (c) SELECT seq FROM seq_1_to_101;
SELECT * FROM t1 WHERE t1.a IN (SELECT b FROM
(SELECT t2.b FROM t2 WHERE NOT EXISTS (SELECT 1 FROM t3) GROUP BY b) sq);
DROP TABLE t1, t2, t3;
--echo # End of 10.4 tests
SET GLOBAL innodb_stats_persistent=@save_innodb_stats_persistent;

View File

@ -4309,6 +4309,51 @@ a
deallocate prepare stmt;
drop view v;
drop table t1,t2,t3;
#
# MDEV-32829 Crash when executing PS for query with eliminated subquery
# using view
#
create view v1 as select 1 as a;
prepare stmt from
'SELECT EXISTS (SELECT 1 FROM v1 GROUP BY a IN (SELECT a FROM v1))';
execute stmt;
EXISTS (SELECT 1 FROM v1 GROUP BY a IN (SELECT a FROM v1))
1
drop view v1;
create table t1 (a int, b int);
insert into t1 values (1,2),(3,4),(5,6);
create view v1 as select * from t1;
create table t2 select * from t1;
prepare stmt from "select t2.a from t2 where exists
(
select * from t1 where t2.b = t1.b and t1.b != 6
group by a in (select a from v1 where v1.a = t2.a)
)";
execute stmt;
a
1
3
execute stmt;
a
1
3
deallocate prepare stmt;
create procedure aproc() select t2.a from t2 where exists
(
select * from t1 where t2.b = t1.b and t1.b != 6
group by a in (select a from v1 where v1.a = t2.a)
);
call aproc();
a
1
3
call aproc();
a
1
3
drop table t1, t2;
drop view v1;
drop procedure aproc;
# End of 10.4 tests
#
# MDEV-31143: view with ORDER BY used in query with rownum() in WHERE

View File

@ -2767,6 +2767,42 @@ deallocate prepare stmt;
drop view v;
drop table t1,t2,t3;
--echo #
--echo # MDEV-32829 Crash when executing PS for query with eliminated subquery
--echo # using view
--echo #
create view v1 as select 1 as a;
prepare stmt from
'SELECT EXISTS (SELECT 1 FROM v1 GROUP BY a IN (SELECT a FROM v1))';
execute stmt;
drop view v1;
create table t1 (a int, b int);
insert into t1 values (1,2),(3,4),(5,6);
create view v1 as select * from t1;
create table t2 select * from t1;
let $q=
select t2.a from t2 where exists
(
select * from t1 where t2.b = t1.b and t1.b != 6
group by a in (select a from v1 where v1.a = t2.a)
);
eval prepare stmt from "$q";
execute stmt;
execute stmt;
deallocate prepare stmt;
eval create procedure aproc() $q;
call aproc();
call aproc();
drop table t1, t2;
drop view v1;
drop procedure aproc;
--echo # End of 10.4 tests
--echo #

View File

@ -16,4 +16,3 @@ mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 chang
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
partition_open_files_limit : open_files_limit check broken by MDEV-18360
partition_innodb : Waiting for fix MDEV-20169

View File

@ -670,18 +670,16 @@ SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
--echo #
--echo # creation test (names)
set names utf8;
#enable after MDEV-32465 fix
--disable_view_protocol
--disable_service_connection
select hex(column_create("адын", 1212));
--enable_view_protocol
--enable_service_connection
select hex(column_create("1212", 1212));
select hex(column_create(1212, 2, "www", 3));
select hex(column_create("1212", 2, "www", 3));
select hex(column_create("1212", 2, 3, 3));
#enable after MDEV-32465 fix
--disable_view_protocol
--disable_service_connection
select hex(column_create("1212", 2, "адын", 1, 3, 3));
--enable_view_protocol
--enable_service_connection
set names latin1;
--echo # fetching column test (names)
@ -708,15 +706,14 @@ select column_exists(column_create("1212", 2, "адын", 1, 3, 3), "4") as ex;
set names latin1;
--echo # column changing test (names)
#enable after MDEV-32465 fix
--disable_view_protocol
--disable_service_connection
select hex(column_add(column_create(1, "AAA"), "b", "BBB")) as ex;
select hex(column_add(column_create("1", "AAA"), "b", "BBB")) as ex;
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), 1 as char) as ex;
select column_get(column_add(column_create(1, "AAA"), "b", "BBB"), "b" as char) as ex;
select hex(column_add(column_create("a", "AAA"), 1, "BBB")) as ex;
select hex(column_add(column_create("a", "AAA"), "1", "BBB")) as ex;
--enable_view_protocol
--enable_service_connection
select hex(column_add(column_create("a", 1212 as integer), "b", "1212" as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", "1212" as integer)) as ex;
select hex(column_add(column_create("a", 1212 as integer), "a", NULL as integer)) as ex;

View File

@ -158,5 +158,12 @@ t3 CREATE TABLE `t3` (
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t3;
#
# MDEV-21618 CREATE UNIQUE INDEX fails with "ERROR 1286 (42000): Unknown storage engine 'partition'"
#
SET SESSION enforce_storage_engine=MyISAM;
CREATE TABLE t4 (a INT) ENGINE=MyISAM PARTITION BY HASH(a);
CREATE INDEX x on t4 (a);
DROP TABLE t4;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;

View File

@ -1,4 +1,5 @@
--source include/not_embedded.inc
--source include/have_partition.inc
set local sql_mode="";
set global sql_mode="";
@ -107,5 +108,15 @@ ALTER TABLE t3 ADD COLUMN c3 INT;
SHOW CREATE TABLE t3;
DROP TABLE t3;
--echo #
--echo # MDEV-21618 CREATE UNIQUE INDEX fails with "ERROR 1286 (42000): Unknown storage engine 'partition'"
--echo #
SET SESSION enforce_storage_engine=MyISAM;
CREATE TABLE t4 (a INT) ENGINE=MyISAM PARTITION BY HASH(a);
CREATE INDEX x on t4 (a);
DROP TABLE t4;
SET SESSION enforce_storage_engine=NULL;
SET GLOBAL enforce_storage_engine=NULL;

View File

@ -1,5 +1,6 @@
# In embedded server we don't really have a control over stack usage
-- source include/not_embedded.inc
-- source include/not_asan.inc
#
# Bug#21476: Lost Database Connection During Query

View File

@ -531,6 +531,8 @@ Warning 1292 Truncated incorrect DECIMAL value: 'b'
explain select f1 from t1 where f1 in (2,1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index t1f1_idx t1f1_idx 2 NULL 3 Using where; Using index
Warnings:
Note 1105 Cannot use key `t1f1_idx` part[0] for lookup: `test`.`t1`.`f1` of type `char` = "2" of type `int`
create table t2(f2 int, index t2f2(f2));
insert into t2 values(0),(1),(2);
select f2 from t2 where f2 in ('a',2);

View File

@ -4737,6 +4737,13 @@ NULL
#
PREPARE s FROM 'SELECT JSON_SCHEMA_VALID (?,''{}'') FROM DUAL';
ERROR HY000: Variable schema is not supported.
#
# MDEV-33015: Server crashes upon JSON_SCHEMA_VALID reading NULL from a user variable
#
SET @a= NULL;
SELECT JSON_SCHEMA_VALID(@a,'{}');
JSON_SCHEMA_VALID(@a,'{}')
NULL
# End of 11.1 test
# Beginning of 11.2
#

View File

@ -3710,6 +3710,14 @@ SELECT JSON_SCHEMA_VALID(NULL, NULL);
--error ER_JSON_NO_VARIABLE_SCHEMA
PREPARE s FROM 'SELECT JSON_SCHEMA_VALID (?,''{}'') FROM DUAL';
--echo #
--echo # MDEV-33015: Server crashes upon JSON_SCHEMA_VALID reading NULL from a user variable
--echo #
SET @a= NULL;
SELECT JSON_SCHEMA_VALID(@a,'{}');
--echo # End of 11.1 test
--echo # Beginning of 11.2

View File

@ -0,0 +1,124 @@
#
# Start of 10.5 tests
#
#
# MDEV-17226 Column Data in Truncated on UNION to the length of the first value if using REPLACE
#
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
CREATE TABLE t2 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ("a", "ba");
INSERT INTO t2 (col1, col2) VALUES ("a", "ba");
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
a
a
ba
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
a
a
ba
SELECT REPLACE('z', col1, col2) FROM t1 UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
REPLACE('z', col1, col2)
z
ba
SELECT REPLACE('z', col1, col2) FROM t2 UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
REPLACE('z', col1, col2)
z
ba
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'ba');
SELECT REPLACE('a', col1, col2) FROM t1;
REPLACE('a', col1, col2)
ba
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT * FROM t2;
a
a
ba
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(2) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (10),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', '0123456789');
SELECT REPLACE('aa', col1, col2) FROM t1;
REPLACE('aa', col1, col2)
01234567890123456789
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
a
a
01234567890123456789
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(20) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (20),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbb');
SELECT REPLACE('aa', col1, col2) FROM t1;
REPLACE('aa', col1, col2)
aaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbb
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
a
a
aaaaaaaaaabbbbbbbbbbaaaaaaaaaabbbbbbbbbb
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(40) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (30),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbbcccccccccc');
SELECT REPLACE('aaa', col1, col2) FROM t1;
REPLACE('aaa', col1, col2)
aaaaaaaaaabbbbbbbbbbccccccccccaaaaaaaaaabbbbbbbbbbccccccccccaaaaaaaaaabbbbbbbbbbcccccccccc
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aaa', col1, col2) FROM t1;
SELECT * FROM t2;
a
a
aaaaaaaaaabbbbbbbbbbccccccccccaaaaaaaaaabbbbbbbbbbccccccccccaaaaaaaaaabbbbbbbbbbcccccccccc
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(90) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
DROP TABLE t1, t2;
#
# End of 10.5 tests
#

View File

@ -0,0 +1,86 @@
--echo #
--echo # Start of 10.5 tests
--echo #
--echo #
--echo # MDEV-17226 Column Data in Truncated on UNION to the length of the first value if using REPLACE
--echo #
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
CREATE TABLE t2 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ("a", "ba");
INSERT INTO t2 (col1, col2) VALUES ("a", "ba");
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
SELECT REPLACE('z', col1, col2) FROM t1 UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT REPLACE('z', col1, col2) FROM t2 UNION ALL SELECT REPLACE('a', col1, col2) FROM t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (2),
col2 VARCHAR (2),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'ba');
SELECT REPLACE('a', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('a', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (10),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', '0123456789');
SELECT REPLACE('aa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (20),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbb');
SELECT REPLACE('aa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
CREATE TABLE t1 (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
col1 VARCHAR (1),
col2 VARCHAR (30),
PRIMARY KEY (id)
);
INSERT INTO t1 (col1, col2) VALUES ('a', 'aaaaaaaaaabbbbbbbbbbcccccccccc');
SELECT REPLACE('aaa', col1, col2) FROM t1;
CREATE TABLE t2 AS SELECT 'a' UNION ALL SELECT REPLACE('aaa', col1, col2) FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1, t2;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@ -1990,6 +1990,11 @@ GRANT EXECUTE ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT FILE ON *.* TO mysqltest_u1@localhost;
GRANT CREATE USER ON *.* TO mysqltest_u1@localhost;
GRANT PROCESS ON *.* TO mysqltest_u1@localhost;
GRANT RELOAD ON mysqltest_db1.* TO mysqltest_u1@localhost;
ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
connect(localhost,mysqltest_u1,,db1,MASTER_PORT,MASTER_SOCKET);
connect con1, localhost, mysqltest_u1, ,db1;
ERROR 42000: Access denied for user 'mysqltest_u1'@'localhost' to database 'db1'
GRANT RELOAD ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION CLIENT ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION SLAVE ON *.* TO mysqltest_u1@localhost;

View File

@ -1824,6 +1824,13 @@ GRANT EXECUTE ON mysqltest_db1.* TO mysqltest_u1@localhost;
GRANT FILE ON *.* TO mysqltest_u1@localhost;
GRANT CREATE USER ON *.* TO mysqltest_u1@localhost;
GRANT PROCESS ON *.* TO mysqltest_u1@localhost;
# Global privileges should be granted to all schemas, not individual DB
--error ER_WRONG_USAGE
GRANT RELOAD ON mysqltest_db1.* TO mysqltest_u1@localhost;
# Select privilege is needed beside RELOAD privilege
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_DBACCESS_DENIED_ERROR
--connect (con1, localhost, mysqltest_u1, ,db1)
GRANT RELOAD ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION CLIENT ON *.* TO mysqltest_u1@localhost;
GRANT REPLICATION SLAVE ON *.* TO mysqltest_u1@localhost;

View File

@ -3312,6 +3312,8 @@ explain
SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref b b 4 const 1 Using where; Using index
Warnings:
Note 1105 Cannot use key `b` part[1] for lookup: `test`.`t1`.`a` of type `varchar` > "'0' = 'z'" of type `boolean`
SELECT b, min(a) FROM t1 WHERE a > ('0' = b) AND b = 'z' GROUP BY b;
b min(a)
explain
@ -4018,12 +4020,18 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND DATE'2001-01-05' GROUP BY id;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index
Warnings:
Note 1105 Cannot use key `id` part[1] for lookup: `test`.`t1`.`a` of type `varchar` >= "DATE'2001-01-04'" of type `date`
EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN DATE'2001-01-04' AND '2001-01-05' GROUP BY id;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index
Warnings:
Note 1105 Cannot use key `id` part[1] for lookup: `test`.`t1`.`a` of type `varchar` >= "DATE'2001-01-04'" of type `date`
EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN '2001-01-04' AND DATE'2001-01-05' GROUP BY id;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL id 27 NULL 64 Using where; Using index
Warnings:
Note 1105 Cannot use key `id` part[1] for lookup: `test`.`t1`.`a` of type `varchar` >= "<cache>('2001-01-04')" of type `date`
DROP TABLE t1;
#
# MIN() optimization didn't work correctly with BETWEEN when using too

View File

@ -331,6 +331,113 @@ JOIN t1 ON dt.a=t1.b;
a
Australia
DROP TABLES t1, t2;
#
# MDEV-15656: Assertion `is_last_prefix <= 0' failed in
# QUICK_GROUP_MIN_MAX_SELECT::get_next
#
SET @lru_depth.save= @@innodb_lru_scan_depth;
SET GLOBAL innodb_lru_scan_depth= 1024;
CREATE TABLE t1 (
pk_part1 INT AUTO_INCREMENT,
a VARCHAR(4),
row_start timestamp(6) default current_timestamp,
PRIMARY KEY (pk_part1, row_start)
) ENGINE=InnoDB;
INSERT INTO t1 (a) VALUES
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo');
connect con1,localhost,root,,test;
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
SELECT DISTINCT pk_part1 FROM t1;
connection default;
INSERT INTO t1 (pk_part1) VALUES (NULL);
connection con1;
disconnect con1;
connection default;
DROP TABLE t1;
SET GLOBAL innodb_lru_scan_depth= @lru_depth.save;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;

View File

@ -276,6 +276,53 @@ eval $query;
DROP TABLES t1, t2;
--echo #
--echo # MDEV-15656: Assertion `is_last_prefix <= 0' failed in
--echo # QUICK_GROUP_MIN_MAX_SELECT::get_next
--echo #
SET @lru_depth.save= @@innodb_lru_scan_depth;
SET GLOBAL innodb_lru_scan_depth= 1024;
CREATE TABLE t1 (
pk_part1 INT AUTO_INCREMENT,
a VARCHAR(4),
row_start timestamp(6) default current_timestamp,
PRIMARY KEY (pk_part1, row_start)
) ENGINE=InnoDB;
INSERT INTO t1 (a) VALUES
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo'),
('foo'),('bar'),('foo'),('bar'),('foo');
--connect (con1,localhost,root,,test)
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
--let $run= 20
--disable_result_log
while ($run)
{
--send
SELECT DISTINCT pk_part1 FROM t1;
--connection default
INSERT INTO t1 (pk_part1) VALUES (NULL);
--connection con1
--reap
--dec $run
}
--enable_result_log
--disconnect con1
--connection default
DROP TABLE t1;
SET GLOBAL innodb_lru_scan_depth= @lru_depth.save;
set global innodb_stats_persistent= @innodb_stats_persistent_save;
set global innodb_stats_persistent_sample_pages=
@innodb_stats_persistent_sample_pages_save;

View File

@ -0,0 +1,20 @@
--- ./main/innodb_ext_key.result
+++ ./main/innodb_ext_key.reject
@@ -244,7 +244,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 21
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
@@ -266,7 +266,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 6
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0

View File

@ -0,0 +1,20 @@
--- ./main/innodb_ext_key.result
+++ ./main/innodb_ext_key.reject
@@ -244,7 +244,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 21
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
@@ -266,7 +266,7 @@
Variable_name Value
Handler_read_first 0
Handler_read_key 6
-Handler_read_last 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0

View File

@ -500,21 +500,21 @@ SELECT @@global.rpad(); -- Unknown system variable 'rpad'
--------
SELECT @@global.adddate(); -- Unknown system variable 'adddate'
--------
SELECT @@global.substr(); -- Unknown system variable 'substr'
SELECT @@global.substr(); -- ..syntax.. near 'substr()' at line 1
--------
SELECT @@global.substring(); -- Unknown system variable 'substring'
SELECT @@global.substring(); -- ..syntax.. near 'substring()' at line 1
--------
SELECT @@global.trim_oracle(); -- Unknown system variable 'trim_oracle'
--------
SELECT @@global.ascii(); -- Unknown system variable 'ascii'
--------
SELECT @@global.replace(); -- Unknown system variable 'replace'
SELECT @@global.replace(); -- ..syntax.. near 'replace()' at line 1
--------
SELECT @@global.weight_string(); -- Unknown system variable 'weight_string'
--------
SELECT @@global.char(); -- Unknown system variable 'char'
--------
SELECT @@global.trim(); -- Unknown system variable 'trim'
SELECT @@global.trim(); -- ..syntax.. near 'trim()' at line 1
--------
SELECT @@global.year(); -- Unknown system variable 'year'
--------
@ -732,21 +732,21 @@ CREATE FUNCTION test.rpad() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.adddate() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.substr() RETURNS OOPS; -- Unknown data type: 'OOPS'
CREATE FUNCTION test.substr() RETURNS OOPS; -- ..syntax.. near 'substr() RETURNS OOPS'
--------
CREATE FUNCTION test.substring() RETURNS OOPS; -- Unknown data type: 'OOPS'
CREATE FUNCTION test.substring() RETURNS OOPS; -- ..syntax.. near 'substring() RETURNS OOP
--------
CREATE FUNCTION test.trim_oracle() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.ascii() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.replace() RETURNS OOPS; -- Unknown data type: 'OOPS'
CREATE FUNCTION test.replace() RETURNS OOPS; -- ..syntax.. near 'replace() RETURNS OOPS'
--------
CREATE FUNCTION test.weight_string() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.char() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------
CREATE FUNCTION test.trim() RETURNS OOPS; -- Unknown data type: 'OOPS'
CREATE FUNCTION test.trim() RETURNS OOPS; -- ..syntax.. near 'trim() RETURNS OOPS' at
--------
CREATE FUNCTION test.year() RETURNS OOPS; -- Unknown data type: 'OOPS'
--------

View File

@ -301,15 +301,18 @@ SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL log_output= "TABLE";
SET GLOBAL slow_query_log= ON;
SET SESSION long_query_time= 0;
SET GLOBAL debug_dbug="+d,debug_huge_number_of_examined_rows";
SET debug_dbug="+d,debug_huge_number_of_examined_rows";
SELECT * FROM tab_MDEV_30820 ORDER BY 1;
ID A
1 0
2 0
SET GLOBAL debug_dbug=@old_dbug;
SET debug_dbug=@old_dbug;
SET @@long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
SELECT rows_examined, sql_text from mysql.slow_log where sql_text like "SELECT%FROM tab_MDEV_30820%";
rows_examined sql_text
18446744073708551615 SELECT * FROM tab_MDEV_30820 ORDER BY 1
drop table tab_MDEV_30820;
#
# End of 10.4 test

View File

@ -170,16 +170,21 @@ SET GLOBAL log_output= "TABLE";
SET GLOBAL slow_query_log= ON;
SET SESSION long_query_time= 0;
SET GLOBAL debug_dbug="+d,debug_huge_number_of_examined_rows";
SET debug_dbug="+d,debug_huge_number_of_examined_rows";
--disable_ps_protocol
--disable_view_protocol
SELECT * FROM tab_MDEV_30820 ORDER BY 1;
SET GLOBAL debug_dbug=@old_dbug;
--enable_view_protocol
--enable_ps_protocol
SET debug_dbug=@old_dbug;
## Reset to initial values
SET @@long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
SELECT rows_examined, sql_text from mysql.slow_log where sql_text like "SELECT%FROM tab_MDEV_30820%";
drop table tab_MDEV_30820;
--echo #

View File

@ -19,9 +19,9 @@ create table mariadbtestdb2.t2 (a int);
create table mariadbtestdb.t3 (a int);
SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_long_host,getaddrinfo_fake_good_ipv4";
flush hosts;
# check connect
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select current_user();
current_user()
user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345
@ -34,7 +34,6 @@ connection default;
grant SELECT ON *.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
a b
select * from mariadbtestdb2.t2;
@ -44,7 +43,6 @@ connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1`
select * from mariadbtestdb2.t2;
@ -54,7 +52,6 @@ connection default;
grant SELECT ON mariadbtestdb.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
a b
select * from mariadbtestdb2.t2;
@ -67,7 +64,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_3456789
grant SELECT ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
a b
select * from mariadbtestdb2.t2;
@ -80,7 +76,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_3456789
grant SELECT (a) ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1`
select * from mariadbtestdb2.t2;
@ -100,7 +95,6 @@ GRANT CREATE ROUTINE on test.* to user5678901_345678902_345678903_345678904_3456
grant role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678 to user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,;
connection con1;
select * from mariadbtestdb.t1;
ERROR 42000: SELECT command denied to user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345' for table `mariadbtestdb`.`t1`
select * from mariadbtestdb2.t2;

View File

@ -33,11 +33,11 @@ create table mariadbtestdb.t3 (a int);
SET @saved_dbug = @@GLOBAL.debug_dbug;
set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_long_host,getaddrinfo_fake_good_ipv4";
flush hosts;
--echo # check connect
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
select current_user();
--echo # check global privileges
@ -51,7 +51,6 @@ connection default;
grant SELECT ON *.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,);
connection con1;
select * from mariadbtestdb.t1;
select * from mariadbtestdb2.t2;
@ -62,7 +61,6 @@ connection default;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb.t1;
--error ER_TABLEACCESS_DENIED_ERROR
@ -75,7 +73,6 @@ connection default;
grant SELECT ON mariadbtestdb.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
select * from mariadbtestdb.t1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb2.t2;
@ -88,7 +85,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_3456789
grant SELECT ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
select * from mariadbtestdb.t1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb2.t2;
@ -102,7 +98,6 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_3456789
grant SELECT (a) ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345;
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,);
connection con1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb.t1;
--error ER_TABLEACCESS_DENIED_ERROR
@ -132,7 +127,6 @@ grant role5678901_345678902_345678903_345678904_345678905_345678906_345678907_34
disconnect con1;
connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,);
connection con1;
--error ER_TABLEACCESS_DENIED_ERROR
select * from mariadbtestdb.t1;

View File

@ -574,5 +574,84 @@ insert into t1 values (1,10),(2,20);
update t1 set b = 30 limit 1;
drop table t1;
#
# MDEV-32839 LONG UNIQUE gives error when used with REPLACE
#
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=myisam;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
f1 f2 f3 f4 f5 f6 f7
2 00004 0001009089999 netstes psit d
4 00004 0001009089999 netstes psit e
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=innodb;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
f1 f2 f3 f4 f5 f6 f7
2 00004 0001009089999 netstes psit d
4 00004 0001009089999 netstes psit e
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=myisam partition by key(f1) partitions 2;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
f1 f2 f3 f4 f5 f6 f7
2 00004 0001009089999 netstes psit d
4 00004 0001009089999 netstes psit e
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=innodb partition by key(f1) partitions 2;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
f1 f2 f3 f4 f5 f6 f7
2 00004 0001009089999 netstes psit d
4 00004 0001009089999 netstes psit e
drop table t1;
#
# End of 10.5 tests
#

View File

@ -563,6 +563,77 @@ insert into t1 values (1,10),(2,20);
update t1 set b = 30 limit 1;
drop table t1;
--echo #
--echo # MDEV-32839 LONG UNIQUE gives error when used with REPLACE
--echo #
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=myisam;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=innodb;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=myisam partition by key(f1) partitions 2;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
drop table t1;
create table t1 (
f1 bigint(20) not null auto_increment primary key,
f2 varchar(30) default null,
f3 varchar(30) default null,
f4 varchar(255) default null,
f5 varchar(30) default null,
f6 varchar(255) default null,
f7 varchar(255) default null,
unique problem_key (f3,f5,f6,f2,f4,f7) using hash
) engine=innodb partition by key(f1) partitions 2;
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'd');
insert t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
replace t1 (f2, f3, f4, f5, f6, f7) values ('00004', '0001009089999', '', 'netstes', 'psit', 'e');
select * from t1;
drop table t1;
--echo #
--echo # End of 10.5 tests
--echo #

View File

@ -0,0 +1,101 @@
create function bug10100f(prm int) returns int
begin
if prm > 1 then
return prm * bug10100f(prm - 1);
end if;
return 1;
end|
set statement sql_mode = '' for
create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
end if;
end|
set statement sql_mode = '' for
create procedure bug10100t(prm int)
begin
declare res int;
set res = 1;
call bug10100p(prm, res);
select res;
end|
create table t3 (a int)|
insert into t3 values (0)|
create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then
update t3 set a=level;
FLUSH TABLES;
call bug10100pt(level+1, lim);
else
select * from t3;
end if;
end|
create procedure bug10100pv(level int, lim int)
begin
if level < lim then
update v1 set a=level;
FLUSH TABLES;
call bug10100pv(level+1, lim);
else
select * from v1;
end if;
end|
prepare stmt2 from "select * from t3;";
create procedure bug10100pd(level int, lim int)
begin
if level < lim then
select level;
prepare stmt1 from "update t3 set a=a+2";
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
deallocate prepare stmt1;
execute stmt2;
select * from t3;
call bug10100pd(level+1, lim);
else
execute stmt2;
end if;
end|
create procedure bug10100pc(level int, lim int)
begin
declare lv int;
declare c cursor for select a from t3;
open c;
if level < lim then
select level;
fetch c into lv;
select lv;
update t3 set a=level+lv;
FLUSH TABLES;
call bug10100pc(level+1, lim);
else
select * from t3;
end if;
close c;
end|
set @@max_sp_recursion_depth=255|
set @var=1|
call bug10100p(255, @var)|
call bug10100pt(1,255)|
call bug10100pv(1,255)|
call bug10100pd(1,255)|
call bug10100pc(1,255)|
set @@max_sp_recursion_depth=0|
deallocate prepare stmt2|
drop function bug10100f|
drop procedure bug10100p|
drop procedure bug10100t|
drop procedure bug10100pt|
drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop table t3|

View File

@ -0,0 +1,133 @@
#
# For tests that need a lot of stack - they likely won't work under ASAN
#
source include/not_asan.inc;
source include/not_embedded.inc;
#
# Bug#10100 function (and stored procedure?) recursivity problem
#
# routines with simple recursion
delimiter |;
create function bug10100f(prm int) returns int
begin
if prm > 1 then
return prm * bug10100f(prm - 1);
end if;
return 1;
end|
set statement sql_mode = '' for
create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
end if;
end|
set statement sql_mode = '' for
create procedure bug10100t(prm int)
begin
declare res int;
set res = 1;
call bug10100p(prm, res);
select res;
end|
# a procedure which use tables and recursion
create table t3 (a int)|
insert into t3 values (0)|
create view v1 as select a from t3|
create procedure bug10100pt(level int, lim int)
begin
if level < lim then
update t3 set a=level;
FLUSH TABLES;
call bug10100pt(level+1, lim);
else
select * from t3;
end if;
end|
# view & recursion
create procedure bug10100pv(level int, lim int)
begin
if level < lim then
update v1 set a=level;
FLUSH TABLES;
call bug10100pv(level+1, lim);
else
select * from v1;
end if;
end|
# dynamic sql & recursion
prepare stmt2 from "select * from t3;";
create procedure bug10100pd(level int, lim int)
begin
if level < lim then
select level;
prepare stmt1 from "update t3 set a=a+2";
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
execute stmt1;
FLUSH TABLES;
deallocate prepare stmt1;
execute stmt2;
select * from t3;
call bug10100pd(level+1, lim);
else
execute stmt2;
end if;
end|
# cursor & recursion
create procedure bug10100pc(level int, lim int)
begin
declare lv int;
declare c cursor for select a from t3;
open c;
if level < lim then
select level;
fetch c into lv;
select lv;
update t3 set a=level+lv;
FLUSH TABLES;
call bug10100pc(level+1, lim);
else
select * from t3;
end if;
close c;
end|
# end of the stack checking
set @@max_sp_recursion_depth=255|
set @var=1|
# disable log because error about stack overrun contains numbers which
# depend on a system
-- disable_ps_protocol
-- disable_result_log
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100p(255, @var)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pt(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pv(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pd(1,255)|
-- error ER_STACK_OVERRUN_NEED_MORE
call bug10100pc(1,255)|
-- enable_result_log
-- enable_ps_protocol
set @@max_sp_recursion_depth=0|
deallocate prepare stmt2|
drop function bug10100f|
drop procedure bug10100p|
drop procedure bug10100t|
drop procedure bug10100pt|
drop procedure bug10100pv|
drop procedure bug10100pd|
drop procedure bug10100pc|
drop view v1|
drop table t3|
delimiter ;|

View File

@ -61,7 +61,7 @@ DROP TABLE t1,t3;
#
# Check MDL locks taken for different kind of tables by open
#
CREATE TABLE t1(a INT) ENGINE=InnoDB;
CREATE TABLE t1(a INT) stats_persistent=0, ENGINE=InnoDB;
CREATE TABLE t3(a INT) ENGINE=myisam;
connect purge_control,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;

View File

@ -43,7 +43,7 @@ DROP TABLE t1,t3;
--echo # Check MDL locks taken for different kind of tables by open
--echo #
CREATE TABLE t1(a INT) ENGINE=InnoDB;
CREATE TABLE t1(a INT) stats_persistent=0, ENGINE=InnoDB;
CREATE TABLE t3(a INT) ENGINE=myisam;
connect(purge_control,localhost,root,,);
START TRANSACTION WITH CONSISTENT SNAPSHOT;

View File

@ -2403,6 +2403,7 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
# Check that FLUSH must wait to get the GRL
# and let DROP PROCEDURE continue
InnoDB 0 transactions not purged
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME
MDL_BACKUP_DDL Backup lock
@ -2427,7 +2428,7 @@ SET DEBUG_SYNC= 'RESET';
# UPDATE should wait for FTWRL with non transactional table second
#
create table t1 (a int) engine=myisam;
create table t2 (a int) engine=innodb;
create table t2 (a int) stats_persistent=0, engine=innodb;
insert into t1 values (1);
insert into t2 values (1);
SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2';

View File

@ -3085,6 +3085,7 @@ connection con2;
SET DEBUG_SYNC= 'now WAIT_FOR table_opened';
--echo # Check that FLUSH must wait to get the GRL
--echo # and let DROP PROCEDURE continue
--source ../suite/innodb/include/wait_all_purged.inc
SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info;
SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait';
--send FLUSH TABLES WITH READ LOCK
@ -3110,7 +3111,7 @@ SET DEBUG_SYNC= 'RESET';
--echo #
create table t1 (a int) engine=myisam;
create table t2 (a int) engine=innodb;
create table t2 (a int) stats_persistent=0, engine=innodb;
insert into t1 values (1);
insert into t2 values (1);

View File

@ -38,18 +38,24 @@ id select_type table type possible_keys key key_len ref rows Extra
EXPLAIN SELECT * FROM t1 WHERE s2 BETWEEN 'a' AND 'b' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` >= "'a'" of collation `latin1_german1_ci`
EXPLAIN SELECT * FROM t1 WHERE s1 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 2 Using index condition; Rowid-ordered scan
EXPLAIN SELECT * FROM t1 WHERE s2 IN ('a','b' COLLATE latin1_german1_ci);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` = "'a'" of collation `latin1_german1_ci`
EXPLAIN SELECT * FROM t1 WHERE s1 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range s1 s1 11 NULL 1 Using index condition; Rowid-ordered scan
EXPLAIN SELECT * FROM t1 WHERE s2 LIKE 'a' COLLATE latin1_german1_ci;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL s2 NULL NULL NULL 10 Using where
Warnings:
Note 1105 Cannot use key `s2` part[0] for lookup: `test`.`t1`.`s2` of collation `latin1_swedish_ci` like "'a' collate latin1_german1_ci" of collation `latin1_german1_ci`
DROP TABLE t1;
#
#

View File

@ -1385,7 +1385,7 @@ EXPLAIN DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` <= "18" of type `int`
FLUSH STATUS;
FLUSH TABLES;
@ -1393,7 +1393,7 @@ EXPLAIN EXTENDED DELETE FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` <= "18" of type `int`
Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED query
@ -1405,7 +1405,9 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` <= "18" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` <= "18" of type `int`
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
@ -1427,6 +1429,67 @@ Handler_read_rnd_next 27
Sort_rows 8
Sort_scan 1
DROP TABLE t1;
#30a
#
# MDEV-32957 Unusable key notes report wrong predicates for > and >=
#
CREATE TABLE t1(a INT, i CHAR(2), INDEX(i(1)));
INSERT INTO t1 (i) VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19),
(20),(21),(22),(23),(24),(25),(26),(27),(28),(29),
(30),(31),(32),(33),(34),(35);
#
# query: DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
# select: SELECT * FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5
#
EXPLAIN DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` < "18" of type `int`
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED DELETE FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` < "18" of type `int`
Note 1003 delete from `test`.`t1` using dual where `test`.`t1`.`i` >= 10 and `test`.`t1`.`i` < 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED query
Variable_name Value
Handler_read_key 4
FLUSH STATUS;
FLUSH TABLES;
EXPLAIN EXTENDED SELECT * FROM t1 WHERE i >= 10 AND i < 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` < "18" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t1`.`i` of type `char` < "18" of type `int`
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` >= 10 and `test`.`t1`.`i` < 18 order by `test`.`t1`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution
Variable_name Value
Handler_read_key 4
# Status of "equivalent" SELECT query execution:
Variable_name Value
Handler_read_key 4
Handler_read_rnd_next 27
Sort_priority_queue_sorts 1
Sort_rows 5
Sort_scan 1
# Status of testing query execution:
Variable_name Value
Handler_delete 5
Handler_read_key 4
Handler_read_rnd 5
Handler_read_rnd_next 27
Sort_rows 8
Sort_scan 1
DROP TABLE t1;
#31
CREATE TABLE t1 (i INT);
@ -1892,7 +1955,7 @@ EXPLAIN UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` <= "18" of type `int`
FLUSH STATUS;
FLUSH TABLES;
@ -1900,7 +1963,7 @@ EXPLAIN EXTENDED UPDATE t2 SET a = 10 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` <= "18" of type `int`
Note 1003 update `test`.`t2` set `test`.`t2`.`a` = 10 where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED query
@ -1912,7 +1975,9 @@ EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL i NULL NULL NULL 26 100.00 Using where; Using filesort
Warnings:
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` >= "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` <= "18" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` > "10" of type `int`
Note 1105 Cannot use key `i` part[0] for lookup: `test`.`t2`.`i` of type `char` <= "18" of type `int`
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5
# Status of EXPLAIN EXTENDED "equivalent" SELECT query execution

View File

@ -0,0 +1,58 @@
$assembly = [system.reflection.Assembly]::LoadWithPartialName("MySql.Data")
if ($assembly -eq $null)
{
"Can't load assembly MySql.Data"
exit 100
}
try
{
$connectionString =[string]::Format("server=127.0.0.1;uid=root;port={0};Connection Reset=true;",$Env:MASTER_MYPORT)
$connection = [MySql.Data.MySqlClient.MySqlConnection]@{ConnectionString=$connectionString}
$connection.Open()
# Test ExecuteReader()
$command = New-Object MySql.Data.MySqlClient.MySqlCommand
$command.Connection = $connection
$command.CommandText = "SELECT @@old_mode"
$reader = $command.ExecuteReader()
$reader.GetName(0)
while ($reader.Read())
{
$reader.GetValue(0)
}
# Test connection reset
$connection.Close()
$connection.Open()
# Test ExecuteNonQuery()
$command.CommandText="do 1";
$affected_rows = $command.ExecuteNonQuery()
if ($affected_rows -ne 0)
{
"Expected affected rows 0, actual $affected_rows"
exit 1
}
# Test Prepared Statement
$command.CommandText = "SELECT @var";
[void]$command.Parameters.AddWithValue("@var", 1);
$command.Prepare();
$out = $command.ExecuteScalar();
if ($out -ne 1)
{
"Expected output 1, actual $out"
exit 1
}
$connection.Close()
}
catch
{
# Dump exception
$_
$inner = $PSItem.Exception.InnerException
if ($inner -ne $null)
{
$PSItem.Exception.InnerException.Message
$PSItem.Exception.InnerException.StackTrace
}
}

View File

@ -0,0 +1,2 @@
@@old_mode
UTF8_IS_UTF8MB3,NO_NULL_COLLATION_IDS

View File

@ -0,0 +1,11 @@
--source include/windows.inc
let $sys_errno=0;
# Error 100 is returned by the powershell script
# if MySql.Data is not installed
--error 0,100
--exec powershell -NoLogo -NoProfile -File main\mysql_connector_net.ps1
if ($sys_errno != 0)
{
--skip Connector/NET is not installed
}

View File

@ -24,7 +24,9 @@ rmdir $ddir;
# MDEV-23052
# 1. mysql_install_db works on existing, empty directory
mkdir $ddir;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R > /dev/null;
disable_result_log;
exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R --verbose-bootstrap;
enable_result_log;
rmdir $ddir;
# 2. mysql_install_db rejects existing, non-empty directory, and does not

View File

@ -2505,6 +2505,14 @@ Phase 7/8: uninstalling plugins
Phase 8/8: Running 'FLUSH PRIVILEGES'
OK
set global sql_safe_updates=@orig_sql_safe_updates;
#
# MDEV-32043 Remove plugins previously external that are now built in (unix_socket)
#
INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so'
FROM dual WHERE convert(@@version_compile_os using latin1) not in ('Win32', 'Win64', 'Windows');
# mariadb-upgrade --force --silent 2>&1
SELECT * FROM mysql.plugin WHERE name='unix_socket';
name dl
# End of 10.4 tests
#
# Check that mysql_upgrade can be run on mysqldump

View File

@ -517,6 +517,17 @@ set global sql_safe_updates=ON;
--remove_file $MYSQLD_DATADIR/mariadb_upgrade_info
set global sql_safe_updates=@orig_sql_safe_updates;
--echo #
--echo # MDEV-32043 Remove plugins previously external that are now built in (unix_socket)
--echo #
INSERT INTO mysql.plugin SELECT 'unix_socket', 'auth_socket.so'
FROM dual WHERE convert(@@version_compile_os using latin1) not in ('Win32', 'Win64', 'Windows');
--echo # mariadb-upgrade --force --silent 2>&1
--exec $MYSQL_UPGRADE --force --silent 2>&1
SELECT * FROM mysql.plugin WHERE name='unix_socket';
--remove_file $MYSQLD_DATADIR/mariadb_upgrade_info
--echo # End of 10.4 tests
#

View File

@ -0,0 +1,4 @@
Running mysql_upgrade with --check-if-upgrade-is-needed
Checking for absence of temporary files by mysql_upgrade
No temporary files found
End of 10.4 tests

View File

@ -0,0 +1,24 @@
-- source include/mysql_upgrade_preparation.inc
#
# MDEV-31925 mysqld_upgrade --check-if-upgrade-is-needed leaks files
#
# Run mysql_upgrade with --check-if-upgrade-is-needed
--echo Running mysql_upgrade with --check-if-upgrade-is-needed
--exec $MYSQL_UPGRADE --check-if-upgrade-is-needed 2>&1
# Check if temporary files related to mysql_upgrade are cleared
--echo Checking for absence of temporary files by mysql_upgrade
--perl
# Use the temporary directory path from the MySQL configuration
my $tmpdir = "$ENV{MYSQL_TMP_DIR}";
die "Test failed: Found temporary file left by mysql_upgrade\n" if (glob("$tmpdir/mysql_upgrade-*"));
print "No temporary files found\n";
EOF
let $MYSQLD_DATADIR= `select @@datadir`;
--remove_file $MYSQLD_DATADIR/mariadb_upgrade_info
--echo End of 10.4 tests

View File

@ -1,4 +1,6 @@
@@ -180,6 +180,7 @@
--- main/mysqld--help.result 2023-11-30 02:21:51.951132200 +0100
+++ main/mysqld--help,win.reject 2023-11-30 02:35:44.404612300 +0100
@@ -191,6 +191,7 @@
--console Write error output on screen; don't remove the console
window on windows.
--core-file Write core on crashes
@ -6,7 +8,7 @@
-h, --datadir=name Path to the database root directory
--date-format=name The DATE format (ignored)
--datetime-format=name
@@ -650,6 +651,7 @@
@@ -696,6 +697,7 @@
Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME,
DATETIME, TIMESTAMP columns.
(Defaults to on; use --skip-mysql56-temporal-format to disable.)
@ -14,7 +16,7 @@
--net-buffer-length=#
Buffer length for TCP/IP and socket communication
--net-read-timeout=#
@@ -1327,6 +1328,10 @@
@@ -1351,6 +1353,10 @@
Alias for log_slow_query_file. Log slow queries to given
log file. Defaults logging to 'hostname'-slow.log. Must
be enabled to activate other slow log options
@ -25,7 +27,7 @@
--socket=name Socket file to use for connection
--sort-buffer-size=#
Each thread that needs to do a sort allocates a buffer of
@@ -1351,6 +1356,7 @@
@@ -1376,6 +1382,7 @@
deleting or updating every row in a table.
--stack-trace Print a symbolic stack trace on failure
(Defaults to on; use --skip-stack-trace to disable.)
@ -33,7 +35,7 @@
--standard-compliant-cte
Allow only CTEs compliant to SQL standard
(Defaults to on; use --skip-standard-compliant-cte to disable.)
@@ -1426,6 +1432,11 @@
@@ -1454,6 +1461,11 @@
--thread-pool-max-threads=#
Maximum allowed number of worker threads in the thread
pool
@ -45,7 +47,7 @@
--thread-pool-oversubscribe=#
How many additional active worker threads in a group are
allowed.
@@ -1464,8 +1475,8 @@
@@ -1493,8 +1505,8 @@
automatically convert it to an on-disk MyISAM or Aria
table.
-t, --tmpdir=name Path for temporary files. Several paths may be specified,
@ -56,7 +58,7 @@
--transaction-alloc-block-size=#
Allocation block size for transactions to be stored in
binary log
@@ -1685,6 +1696,7 @@
@@ -1716,6 +1728,7 @@
myisam-stats-method NULLS_UNEQUAL
myisam-use-mmap FALSE
mysql56-temporal-format TRUE
@ -64,7 +66,7 @@
net-buffer-length 16384
net-read-timeout 30
net-retry-count 10
@@ -1841,6 +1853,7 @@
@@ -1874,6 +1887,7 @@
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
@ -72,7 +74,7 @@
sort-buffer-size 2097152
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql-safe-updates FALSE
@@ -1867,6 +1880,8 @@
@@ -1901,6 +1915,8 @@
thread-pool-exact-stats FALSE
thread-pool-idle-timeout 60
thread-pool-max-threads 65536

View File

@ -569,9 +569,8 @@ The following specify which files/extra groups are read (specified before remain
when binary log is disabled).
--log-tc-size=# Size of transaction coordinator log.
-W, --log-warnings[=#]
Log some not critical warnings to the general log
file.Value can be between 0 and 11. Higher values mean
more verbosity
Log some non critical warnings to the error log.Value can
be between 0 and 11. Higher values mean more verbosity
--long-query-time=# Alias for log_slow_query_time. Log all queries that have
taken more than long_query_time seconds to execute to the
slow query log file. The argument will be treated as a
@ -721,7 +720,7 @@ The following specify which files/extra groups are read (specified before remain
NO_DUP_KEY_WARNINGS_WITH_IGNORE, NO_PROGRESS_INFO,
ZERO_DATE_TIME_CAST, UTF8_IS_UTF8MB3,
IGNORE_INDEX_ONLY_FOR_JOIN, COMPAT_5_1_CHECKSUM,
LOCK_ALTER_TABLE_COPY
NO_NULL_COLLATION_IDS, LOCK_ALTER_TABLE_COPY
Use 'ALL' to set all combinations.
--old-passwords Use old password encryption method (needed for 4.0 and
older clients)

View File

@ -264,3 +264,15 @@ Warning 1264 Out of range value for column 'a' at row 2
DROP TABLE t1;
SET @@time_zone=DEFAULT;
SET TIMESTAMP=DEFAULT;
#
# MDEV-31608 - Connector/NET fails to connect since 10.10
#
select count(*) > 0 from information_schema.collations where id IS NULL;
count(*) > 0
1
SET old_mode=no_null_collation_ids;
Warnings:
Warning 1287 'NO_NULL_COLLATION_IDS' is deprecated and will be removed in a future release
select count(*) > 0 from information_schema.collations where id IS NULL;
count(*) > 0
0

View File

@ -164,3 +164,11 @@ DROP TABLE t1;
SET @@time_zone=DEFAULT;
SET TIMESTAMP=DEFAULT;
--echo #
--echo # MDEV-31608 - Connector/NET fails to connect since 10.10
--echo #
select count(*) > 0 from information_schema.collations where id IS NULL;
SET old_mode=no_null_collation_ids;
select count(*) > 0 from information_schema.collations where id IS NULL;

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