Merge 10.3 into 10.4

This commit is contained in:
Marko Mäkelä 2020-06-13 19:01:28 +03:00
commit 805340936a
42 changed files with 479 additions and 183 deletions

View file

@ -1287,8 +1287,8 @@ sig_handler mysql_end(int sig)
{ {
#ifndef _WIN32 #ifndef _WIN32
/* /*
Ingnoring SIGQUIT and SIGINT signals when cleanup process starts. Ignoring SIGQUIT and SIGINT signals when cleanup process starts.
This will help in resolving the double free issues, which occures in case This will help in resolving the double free issues, which occurs in case
the signal handler function is started in between the clean up function. the signal handler function is started in between the clean up function.
*/ */
signal(SIGQUIT, SIG_IGN); signal(SIGQUIT, SIG_IGN);
@ -4714,7 +4714,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
/* /*
CLIENT_PROGRESS_OBSOLETE is set only if we requested it in CLIENT_PROGRESS_OBSOLETE is set only if we requested it in
mysql_real_connect() and the server also supports it mysql_real_connect() and the server also supports it
*/ */
if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE) if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE)
mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress); mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress);
#else #else
@ -4783,7 +4783,7 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql)); tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
/* /*
Don't remove "limit 1", Don't remove "limit 1",
it is protection againts SQL_SELECT_LIMIT=0 it is protection against SQL_SELECT_LIMIT=0
*/ */
if (!mysql_store_result_for_lazy(&result)) if (!mysql_store_result_for_lazy(&result))
{ {
@ -5132,7 +5132,7 @@ static const char *construct_prompt()
time_t lclock = time(NULL); // Get the date struct time_t lclock = time(NULL); // Get the date struct
struct tm *t = localtime(&lclock); struct tm *t = localtime(&lclock);
/* parse thru the settings for the prompt */ /* parse through the settings for the prompt */
for (char *c = current_prompt; *c ; c++) for (char *c = current_prompt; *c ; c++)
{ {
if (*c != PROMPT_CHAR) if (*c != PROMPT_CHAR)

View file

@ -1025,7 +1025,7 @@ static int find_plugin(char *tp_path)
/** /**
Build the boostrap file. Build the bootstrap file.
Create a new file and populate it with SQL commands to ENABLE or DISABLE Create a new file and populate it with SQL commands to ENABLE or DISABLE
the plugin via REPLACE and DELETE operations on the mysql.plugin table. the plugin via REPLACE and DELETE operations on the mysql.plugin table.
@ -1154,7 +1154,7 @@ exit:
Create a command line sequence to launch mysqld in bootstrap mode. This Create a command line sequence to launch mysqld in bootstrap mode. This
will allow mysqld to launch a minimal server instance to read and will allow mysqld to launch a minimal server instance to read and
execute SQL commands from a file piped in (the boostrap file). We use execute SQL commands from a file piped in (the bootstrap file). We use
the --no-defaults option to skip reading values from the config file. the --no-defaults option to skip reading values from the config file.
The bootstrap mode skips loading of plugins and many other subsystems. The bootstrap mode skips loading of plugins and many other subsystems.

View file

@ -746,7 +746,7 @@ static bool shall_skip_database(const char *log_dbname)
/** /**
Print "use <db>" statement when current db is to be changed. Print "use <db>" statement when current db is to be changed.
We have to control emiting USE statements according to rewrite-db options. We have to control emitting USE statements according to rewrite-db options.
We have to do it here (see process_event() below) and to suppress We have to do it here (see process_event() below) and to suppress
producing USE statements by corresponding log event print-functions. producing USE statements by corresponding log event print-functions.
*/ */
@ -778,7 +778,7 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev)
// In case of rewrite rule print USE statement for db_to // In case of rewrite rule print USE statement for db_to
my_fprintf(result_file, "use %`s%s\n", db_to, pinfo->delimiter); my_fprintf(result_file, "use %`s%s\n", db_to, pinfo->delimiter);
// Copy the *original* db to pinfo to suppress emiting // Copy the *original* db to pinfo to suppress emitting
// of USE stmts by log_event print-functions. // of USE stmts by log_event print-functions.
memcpy(pinfo->db, db, db_len + 1); memcpy(pinfo->db, db, db_len + 1);
} }

View file

@ -145,7 +145,7 @@ static char * opt_mysql_unix_port=0;
static int first_error=0; static int first_error=0;
/* /*
multi_source is 0 if old server or 2 if server that support multi source multi_source is 0 if old server or 2 if server that support multi source
This is choosen this was as multi_source has 2 extra columns first in This is chosen this was as multi_source has 2 extra columns first in
SHOW ALL SLAVES STATUS. SHOW ALL SLAVES STATUS.
*/ */
static uint multi_source= 0; static uint multi_source= 0;
@ -2065,7 +2065,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg,
<stag_atr="sval" xsi:nil="true"/> <stag_atr="sval" xsi:nil="true"/>
NOTE NOTE
sval MUST be a NULL terminated string. sval MUST be a NULL terminated string.
sval string will be qouted before output. sval string will be quoted before output.
*/ */
static void print_xml_null_tag(FILE * xml_file, const char* sbeg, static void print_xml_null_tag(FILE * xml_file, const char* sbeg,
@ -2137,7 +2137,7 @@ static void print_xml_cdata(FILE *xml_file, const char *str, ulong len)
Print tag with many attribute to the xml_file. Format is: Print tag with many attribute to the xml_file. Format is:
\t\t<row_name Atr1="Val1" Atr2="Val2"... /> \t\t<row_name Atr1="Val1" Atr2="Val2"... />
NOTE NOTE
All atributes and values will be quoted before output. All attributes and values will be quoted before output.
*/ */
static void print_xml_row(FILE *xml_file, const char *row_name, static void print_xml_row(FILE *xml_file, const char *row_name,
@ -2617,7 +2617,7 @@ static uint dump_routines_for_db(char *db)
print_comment(sql_file, 1, print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n", "-- does %s have permissions on mysql.proc?\n\n",
fix_for_comment(current_user)); fix_for_comment(current_user));
maybe_die(EX_MYSQLERR,"%s has insufficent privileges to %s!", maybe_die(EX_MYSQLERR,"%s has insufficient privileges to %s!",
current_user, query_buff); current_user, query_buff);
} }
else if (strlen(row[2])) else if (strlen(row[2]))
@ -4144,7 +4144,7 @@ static void dump_table(char *table, char *db, const uchar *hash_key, size_t len)
} }
} }
/* XML - close table tag and supress regular output */ /* XML - close table tag and suppress regular output */
if (opt_xml) if (opt_xml)
fputs("\t</table_data>\n", md_result_file); fputs("\t</table_data>\n", md_result_file);
else if (extended_insert && row_break) else if (extended_insert && row_break)

View file

@ -581,7 +581,7 @@ static char *field_escape(char *to,const char *from,uint length)
else else
{ {
if (*from == '\'' && !end_backslashes) if (*from == '\'' && !end_backslashes)
*to++= *from; /* We want a dublicate of "'" for MySQL */ *to++= *from; /* We want a duplicate of "'" for MySQL */
end_backslashes=0; end_backslashes=0;
} }
} }

View file

@ -2283,7 +2283,7 @@ slap_connect(MYSQL *mysql)
opt_mysql_unix_port, opt_mysql_unix_port,
connect_flags)) connect_flags))
{ {
/* Connect suceeded */ /* Connect succeeded */
connect_error= 0; connect_error= 0;
break; break;
} }

View file

@ -146,7 +146,7 @@ struct property {
my_bool *var; /* Actual variable */ my_bool *var; /* Actual variable */
my_bool set; /* Has been set for ONE command */ my_bool set; /* Has been set for ONE command */
my_bool old; /* If set, thus is the old value */ my_bool old; /* If set, thus is the old value */
my_bool reverse; /* Varible is true if disabled */ my_bool reverse; /* Variable is true if disabled */
const char *env_name; /* Env. variable name */ const char *env_name; /* Env. variable name */
}; };
@ -566,7 +566,7 @@ DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex subsitutions */
Temporary storage areas for substitutions. To reduce unnessary copying Temporary storage areas for substitutions. To reduce unnessary copying
and memory freeing/allocation, we pre-allocate two buffers, and alternate and memory freeing/allocation, we pre-allocate two buffers, and alternate
their use, one for input/one for output, the roles changing on the next their use, one for input/one for output, the roles changing on the next
st_regex substition. At the end of substitutions buf points to the st_regex substitution. At the end of substitutions buf points to the
one containing the final result. one containing the final result.
*/ */
char* buf; char* buf;
@ -3095,7 +3095,7 @@ void open_file(const char *name)
strxnmov(buff, sizeof(buff), opt_overlay_dir, suffix, name, NullS); strxnmov(buff, sizeof(buff), opt_overlay_dir, suffix, name, NullS);
/* /*
Overlayed rty/include/thing.inc can contain the line Overlaid rty/include/thing.inc can contain the line
--source thing.inc --source thing.inc
which would mean to include qwe/include/thing.inc. which would mean to include qwe/include/thing.inc.
But it looks like including "itself", so don't try to open the file, But it looks like including "itself", so don't try to open the file,
@ -4803,7 +4803,7 @@ int do_save_master_pos()
mysql_errno(mysql), mysql_error(mysql)); mysql_errno(mysql), mysql_error(mysql));
if (!(res = mysql_store_result(mysql))) if (!(res = mysql_store_result(mysql)))
die("mysql_store_result() retuned NULL for '%s'", query); die("mysql_store_result() returned NULL for '%s'", query);
if (!(row = mysql_fetch_row(res))) if (!(row = mysql_fetch_row(res)))
die("empty result in show master status"); die("empty result in show master status");
strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1); strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1);
@ -5350,7 +5350,7 @@ void do_get_errcodes(struct st_command *command)
p++; p++;
} }
/* Convert the sting to int */ /* Convert the string to int */
if (!str2int(start, 10, (long) INT_MIN, (long) INT_MAX, &val)) if (!str2int(start, 10, (long) INT_MIN, (long) INT_MAX, &val))
die("Invalid argument to error: '%s'", command->first_argument); die("Invalid argument to error: '%s'", command->first_argument);
@ -5742,7 +5742,7 @@ int connect_n_handle_errors(struct st_command *command,
dynstr_append_mem(ds, delimiter, delimiter_length); dynstr_append_mem(ds, delimiter, delimiter_length);
dynstr_append_mem(ds, "\n", 1); dynstr_append_mem(ds, "\n", 1);
} }
/* Simlified logging if enabled */ /* Simplified logging if enabled */
if (!disable_connect_log && !disable_query_log) if (!disable_connect_log && !disable_query_log)
{ {
replace_dynstr_append(ds, command->query); replace_dynstr_append(ds, command->query);
@ -8174,7 +8174,7 @@ void handle_no_error(struct st_command *command)
SYNPOSIS SYNPOSIS
run_query_stmt run_query_stmt
mysql - mysql handle mysql - mysql handle
command - currrent command pointer command - current command pointer
query - query string to execute query - query string to execute
query_len - length query string to execute query_len - length query string to execute
ds - output buffer where to store result form query ds - output buffer where to store result form query
@ -8414,7 +8414,7 @@ end:
/* /*
Create a util connection if one does not already exists Create a util connection if one does not already exists
and use that to run the query and use that to run the query
This is done to avoid implict commit when creating/dropping objects such This is done to avoid implicit commit when creating/dropping objects such
as view, sp etc. as view, sp etc.
*/ */
@ -8455,7 +8455,7 @@ int util_query(MYSQL* org_mysql, const char* query){
SYNPOSIS SYNPOSIS
run_query() run_query()
mysql mysql handle mysql mysql handle
command currrent command pointer command current command pointer
flags control the phased/stages of query execution to be performed flags control the phased/stages of query execution to be performed
if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG if QUERY_SEND_FLAG bit is on, the query will be sent. If QUERY_REAP_FLAG
@ -10211,7 +10211,7 @@ int multi_reg_replace(struct st_replace_regex* r,char* val)
if (!reg_replace(&out_buf, buf_len_p, re.pattern, re.replace, if (!reg_replace(&out_buf, buf_len_p, re.pattern, re.replace,
in_buf, re.icase)) in_buf, re.icase))
{ {
/* if the buffer has been reallocated, make adjustements */ /* if the buffer has been reallocated, make adjustments */
if (save_out_buf != out_buf) if (save_out_buf != out_buf)
{ {
if (save_out_buf == r->even_buf) if (save_out_buf == r->even_buf)
@ -10478,7 +10478,7 @@ typedef struct st_rep_set {
uint found_len; /* Best match to date */ uint found_len; /* Best match to date */
int found_offset; int found_offset;
uint table_offset; uint table_offset;
uint size_of_bits; /* For convinience */ uint size_of_bits; /* For convenience */
} REP_SET; } REP_SET;
typedef struct st_rep_sets { typedef struct st_rep_sets {
@ -10581,7 +10581,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
DBUG_RETURN(0); DBUG_RETURN(0);
} }
(void) make_new_set(&sets); /* Set starting set */ (void) make_new_set(&sets); /* Set starting set */
make_sets_invisible(&sets); /* Hide previus sets */ make_sets_invisible(&sets); /* Hide previous sets */
used_sets=-1; used_sets=-1;
word_states=make_new_set(&sets); /* Start of new word */ word_states=make_new_set(&sets); /* Start of new word */
start_states=make_new_set(&sets); /* This is first state */ start_states=make_new_set(&sets); /* This is first state */

View file

@ -363,8 +363,8 @@ bb,ccc,a,bb,ccc
BB,CCC,A,BB,CCC BB,CCC,A,BB,CCC
select group_concat(distinct b) from t1 group by a; select group_concat(distinct b) from t1 group by a;
group_concat(distinct b) group_concat(distinct b)
bb,ccc,a a,bb,ccc
BB,CCC,A A,BB,CCC
select group_concat(b order by b) from t1 group by a; select group_concat(b order by b) from t1 group by a;
group_concat(b order by b) group_concat(b order by b)
a,bb,bb,ccc,ccc a,bb,bb,ccc,ccc
@ -383,11 +383,11 @@ Warning 1260 Row 2 was cut by GROUP_CONCAT()
Warning 1260 Row 4 was cut by GROUP_CONCAT() Warning 1260 Row 4 was cut by GROUP_CONCAT()
select group_concat(distinct b) from t1 group by a; select group_concat(distinct b) from t1 group by a;
group_concat(distinct b) group_concat(distinct b)
bb,c a,bb
BB,C A,BB
Warnings: Warnings:
Warning 1260 Row 2 was cut by GROUP_CONCAT() Warning 1260 Row 3 was cut by GROUP_CONCAT()
Warning 1260 Row 4 was cut by GROUP_CONCAT() Warning 1260 Row 6 was cut by GROUP_CONCAT()
select group_concat(b order by b) from t1 group by a; select group_concat(b order by b) from t1 group by a;
group_concat(b order by b) group_concat(b order by b)
a,bb a,bb
@ -413,8 +413,8 @@ bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111
BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
select group_concat(distinct b) from t1 group by a; select group_concat(distinct b) from t1 group by a;
group_concat(distinct b) group_concat(distinct b)
bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,ccc
BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,A,BB,CCC
select group_concat(b order by b) from t1 group by a; select group_concat(b order by b) from t1 group by a;
group_concat(b order by b) group_concat(b order by b)
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,bb,ccc,ccc 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,a,bb,bb,ccc,ccc
@ -433,11 +433,11 @@ Warning 1260 Row 7 was cut by GROUP_CONCAT()
Warning 1260 Row 14 was cut by GROUP_CONCAT() Warning 1260 Row 14 was cut by GROUP_CONCAT()
select group_concat(distinct b) from t1 group by a; select group_concat(distinct b) from t1 group by a;
group_concat(distinct b) group_concat(distinct b)
bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
Warnings: Warnings:
Warning 1260 Row 5 was cut by GROUP_CONCAT() Warning 1260 Row 2 was cut by GROUP_CONCAT()
Warning 1260 Row 10 was cut by GROUP_CONCAT() Warning 1260 Row 4 was cut by GROUP_CONCAT()
select group_concat(b order by b) from t1 group by a; select group_concat(b order by b) from t1 group by a;
group_concat(b order by b) group_concat(b order by b)
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
@ -520,9 +520,9 @@ a group_concat(b)
NULL 3,4,2,1,2,7,3,3 NULL 3,4,2,1,2,7,3,3
select a, group_concat(distinct b) from t1 group by a with rollup; select a, group_concat(distinct b) from t1 group by a with rollup;
a group_concat(distinct b) a group_concat(distinct b)
1 3,4,2,1 1 1,2,3,4
2 7,3 2 3,7
NULL 3,4,2,1,7 NULL 1,2,3,4,7
select a, group_concat(b order by b) from t1 group by a with rollup; select a, group_concat(b order by b) from t1 group by a with rollup;
a group_concat(b order by b) a group_concat(b order by b)
1 1,2,2,3,4 1 1,2,2,3,4
@ -745,10 +745,10 @@ CREATE TABLE t1(a TEXT, b CHAR(20));
INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3"); INSERT INTO t1 VALUES ("one.1","one.1"),("two.2","two.2"),("one.3","one.3");
SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1; SELECT GROUP_CONCAT(DISTINCT UCASE(a)) FROM t1;
GROUP_CONCAT(DISTINCT UCASE(a)) GROUP_CONCAT(DISTINCT UCASE(a))
ONE.1,TWO.2,ONE.3 ONE.1,ONE.3,TWO.2
SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1; SELECT GROUP_CONCAT(DISTINCT UCASE(b)) FROM t1;
GROUP_CONCAT(DISTINCT UCASE(b)) GROUP_CONCAT(DISTINCT UCASE(b))
ONE.1,TWO.2,ONE.3 ONE.1,ONE.3,TWO.2
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1( a VARCHAR( 10 ), b INT ); CREATE TABLE t1( a VARCHAR( 10 ), b INT );
INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1), INSERT INTO t1 VALUES ( repeat( 'a', 10 ), 1),
@ -847,7 +847,7 @@ create table t1(a bit(2) not null);
insert into t1 values (1), (0), (0), (3), (1); insert into t1 values (1), (0), (0), (3), (1);
select group_concat(distinct a) from t1; select group_concat(distinct a) from t1;
group_concat(distinct a) group_concat(distinct a)
1,0,3 0,1,3
select group_concat(distinct a order by a) from t1; select group_concat(distinct a order by a) from t1;
group_concat(distinct a order by a) group_concat(distinct a order by a)
0,1,3 0,1,3
@ -860,13 +860,13 @@ insert into t1 values (1, 'a', 0), (0, 'b', 1), (0, 'c', 0), (3, 'd', 1),
(1, 'e', 1), (3, 'f', 1), (0, 'g', 1); (1, 'e', 1), (3, 'f', 1), (0, 'g', 1);
select group_concat(distinct a, c) from t1; select group_concat(distinct a, c) from t1;
group_concat(distinct a, c) group_concat(distinct a, c)
10,01,00,31,11 00,01,10,11,31
select group_concat(distinct a, c order by a) from t1; select group_concat(distinct a, c order by a) from t1;
group_concat(distinct a, c order by a) group_concat(distinct a, c order by a)
00,01,11,10,31 00,01,11,10,31
select group_concat(distinct a, c) from t1; select group_concat(distinct a, c) from t1;
group_concat(distinct a, c) group_concat(distinct a, c)
10,01,00,31,11 00,01,10,11,31
select group_concat(distinct a, c order by a, c) from t1; select group_concat(distinct a, c order by a, c) from t1;
group_concat(distinct a, c order by a, c) group_concat(distinct a, c order by a, c)
00,01,10,11,31 00,01,10,11,31
@ -1333,8 +1333,8 @@ select grp,group_concat(c limit 5.5...' at line 1
select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp; select grp,group_concat(distinct c limit 1,10 ) from t1 group by grp;
grp group_concat(distinct c limit 1,10 ) grp group_concat(distinct c limit 1,10 )
1 c 1 c
2 b 2 c
3 C,D 3 D,E
select grp,group_concat(c order by a) from t1 group by grp; select grp,group_concat(c order by a) from t1 group by grp;
grp group_concat(c order by a) grp group_concat(c order by a)
1 b,c 1 b,c
@ -1370,6 +1370,15 @@ grp group_concat(c order by c desc limit 2)
1 c,b 1 c,b
2 c,b 2 c,b
3 E,E 3 E,E
#
# Empty results for group concat as offset is greater than the rows
# for a group
#
select grp,group_concat(distinct c limit 10,1 ) from t1 group by grp;
grp group_concat(distinct c limit 10,1 )
1
2
3
drop table t1; drop table t1;
create table t2 (a int, b varchar(10)); create table t2 (a int, b varchar(10));
insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y'); insert into t2 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');

View file

@ -986,6 +986,13 @@ select grp,group_concat(c order by c limit 2) from t1 group by grp;
select grp,group_concat(c order by c desc) from t1 group by grp; select grp,group_concat(c order by c desc) from t1 group by grp;
select grp,group_concat(c order by c desc limit 2) from t1 group by grp; select grp,group_concat(c order by c desc limit 2) from t1 group by grp;
--echo #
--echo # Empty results for group concat as offset is greater than the rows
--echo # for a group
--echo #
select grp,group_concat(distinct c limit 10,1 ) from t1 group by grp;
drop table t1; drop table t1;
create table t2 (a int, b varchar(10)); create table t2 (a int, b varchar(10));

View file

@ -2251,6 +2251,36 @@ SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1;
f f
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-22268 virtual longlong Item_func_div::int_op(): Assertion `0' failed in Item_func_div::int_op
#
SET sql_mode='';
SET @@SESSION.div_precision_increment=0;
SELECT UTC_TIME / 0;
UTC_TIME / 0
NULL
SELECT TIMESTAMP'2001-01-01 00:00:00'/0;
TIMESTAMP'2001-01-01 00:00:00'/0
NULL
SELECT TIME'00:00:00'/0;
TIME'00:00:00'/0
NULL
CREATE TABLE t1 AS SELECT
UTC_TIME / 0 AS c1,
TIMESTAMP'2001-01-01 00:00:00'/0 AS c3,
TIME'00:00:00'/0 AS c4;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` decimal(7,0) DEFAULT NULL,
`c3` decimal(14,0) DEFAULT NULL,
`c4` decimal(7,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SELECT(-0 * MOD((UTC_TIME / -0)MOD (ATAN('<img src_x0=x onerror="javascript:alert(0)">') MOD COT(0)),-0)) MOD (0 DIV 0);
ERROR 22003: DOUBLE value is out of range in 'cot(0)'
SET @@SESSION.div_precision_increment=DEFAULT;
SET sql_mode=DEFAULT;
#
# End of 10.3 tests # End of 10.3 tests
# #
# #

View file

@ -1111,6 +1111,29 @@ CREATE TABLE t1 (i INT(23));
SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1; SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-22268 virtual longlong Item_func_div::int_op(): Assertion `0' failed in Item_func_div::int_op
--echo #
SET sql_mode='';
SET @@SESSION.div_precision_increment=0;
SELECT UTC_TIME / 0;
SELECT TIMESTAMP'2001-01-01 00:00:00'/0;
SELECT TIME'00:00:00'/0;
CREATE TABLE t1 AS SELECT
UTC_TIME / 0 AS c1,
TIMESTAMP'2001-01-01 00:00:00'/0 AS c3,
TIME'00:00:00'/0 AS c4;
SHOW CREATE TABLE t1;
DROP TABLE t1;
--error ER_DATA_OUT_OF_RANGE
SELECT(-0 * MOD((UTC_TIME / -0)MOD (ATAN('<img src_x0=x onerror="javascript:alert(0)">') MOD COT(0)),-0)) MOD (0 DIV 0);
SET @@SESSION.div_precision_increment=DEFAULT;
SET sql_mode=DEFAULT;
--echo # --echo #
--echo # End of 10.3 tests --echo # End of 10.3 tests
--echo # --echo #

View file

@ -2728,7 +2728,20 @@ DROP USER untrusted@localhost;
DROP DATABASE secret; DROP DATABASE secret;
set GLOBAL sql_mode=default; set GLOBAL sql_mode=default;
# #
# End of 10.1 tests # MDEV-22755 CREATE USER leads to indirect SIGABRT in __stack_chk_fail () from fill_schema_user_privileges + *** stack smashing detected *** (on optimized builds)
#
SET NAMES utf8;
SET SQL_MODE='';
CREATE USER 觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻@localhost;
SELECT * FROM INFORMATION_SCHEMA.user_privileges WHERE GRANTEE LIKE "'abcdefghijklmnopqrstuvwxyz'%";
GRANTEE TABLE_CATALOG PRIVILEGE_TYPE IS_GRANTABLE
SELECT GRANTEE FROM INFORMATION_SCHEMA.user_privileges WHERE GRANTEE LIKE '%觻%';
GRANTEE
'觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻'@'localhost'
DROP USER 觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻@localhost;
SET SQL_MODE=DEFAULT;
#
# Start of 10.2 tests
# #
# #
# MDEV-10134 Add full support for DEFAULT # MDEV-10134 Add full support for DEFAULT

View file

@ -2225,7 +2225,19 @@ set GLOBAL sql_mode=default;
--source include/wait_until_count_sessions.inc --source include/wait_until_count_sessions.inc
--echo # --echo #
--echo # End of 10.1 tests --echo # MDEV-22755 CREATE USER leads to indirect SIGABRT in __stack_chk_fail () from fill_schema_user_privileges + *** stack smashing detected *** (on optimized builds)
--echo #
SET NAMES utf8;
SET SQL_MODE='';
CREATE USER 觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻@localhost;
SELECT * FROM INFORMATION_SCHEMA.user_privileges WHERE GRANTEE LIKE "'abcdefghijklmnopqrstuvwxyz'%";
SELECT GRANTEE FROM INFORMATION_SCHEMA.user_privileges WHERE GRANTEE LIKE '%觻%';
DROP USER 觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻_觻觻觻觻觻觻觻觻觻觻@localhost;
SET SQL_MODE=DEFAULT;
--echo #
--echo # Start of 10.2 tests
--echo # --echo #
--echo # --echo #

View file

@ -810,4 +810,30 @@ sum(col1)
33632261 33632261
drop table t1; drop table t1;
set optimizer_switch=@tmp_optimizer_switch; set optimizer_switch=@tmp_optimizer_switch;
#
# MDEV-22728: SIGFPE in Unique::get_cost_calc_buff_size from prepare_search_best_index_intersect
# on optimized builds
#
SET @save_sort_buffer_size=@@sort_buffer_size;
SET @save_innodb_file_format= @@innodb_file_format;
SET @save_innodb_large_prefix= @@innodb_large_prefix;
SET sort_buffer_size=2048;
CREATE TABLE t1 (
a VARCHAR(1024) CHARACTER SET UTF8 PRIMARY KEY,
b INT,
c INT,
INDEX (b)
) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_100;
EXPLAIN SELECT * FROM t1 WHERE a='1' OR b < 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge PRIMARY,b b,PRIMARY 5,3074 NULL 5 Using sort_union(b,PRIMARY); Using where
SELECT * FROM t1 WHERE a='1' OR b < 5;
a b c
2 2 2
3 3 3
4 4 4
1 1 1
DROP TABLE t1;
SET sort_buffer_size= @save_sort_buffer_size;
disconnect disable_purge; disconnect disable_purge;

View file

@ -200,4 +200,27 @@ SELECT sum(col1) FROM t1 FORCE INDEX (key1,key2) WHERE (key1 between 10 and 819
drop table t1; drop table t1;
set optimizer_switch=@tmp_optimizer_switch; set optimizer_switch=@tmp_optimizer_switch;
--echo #
--echo # MDEV-22728: SIGFPE in Unique::get_cost_calc_buff_size from prepare_search_best_index_intersect
--echo # on optimized builds
--echo #
SET @save_sort_buffer_size=@@sort_buffer_size;
SET @save_innodb_file_format= @@innodb_file_format;
SET @save_innodb_large_prefix= @@innodb_large_prefix;
SET sort_buffer_size=2048;
CREATE TABLE t1 (
a VARCHAR(1024) CHARACTER SET UTF8 PRIMARY KEY,
b INT,
c INT,
INDEX (b)
) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC;
INSERT INTO t1 SELECT seq, seq, seq from seq_1_to_100;
EXPLAIN SELECT * FROM t1 WHERE a='1' OR b < 5;
SELECT * FROM t1 WHERE a='1' OR b < 5;
DROP TABLE t1;
SET sort_buffer_size= @save_sort_buffer_size;
disconnect disable_purge; disconnect disable_purge;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -924,6 +924,24 @@ DROP TABLE t1;
# End of 10.1 tests # End of 10.1 tests
# #
# #
# Start of 10.2 tests
#
#
# MDEV-21619 Server crash or assertion failures in my_datetime_to_str
#
CREATE TABLE t1 (f DATE, KEY(f));
INSERT INTO t1 VALUES ('2020-01-01'),('2020-01-02');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index f f 4 NULL 2 50.00 Using where; Using index
Warnings:
Warning 1292 Truncated incorrect datetime value: '1995.0000000'
Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '0000-00-00' between `test`.`t1`.`f` and <cache>('2012-12-12')
DROP TABLE t1;
#
# End of 10.2 tests
#
#
# Start of 10.3 tests # Start of 10.3 tests
# #
# #

View file

@ -634,6 +634,24 @@ DROP TABLE t1;
--echo # End of 10.1 tests --echo # End of 10.1 tests
--echo # --echo #
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-21619 Server crash or assertion failures in my_datetime_to_str
--echo #
CREATE TABLE t1 (f DATE, KEY(f));
INSERT INTO t1 VALUES ('2020-01-01'),('2020-01-02');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12';
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #
--echo # --echo #
--echo # Start of 10.3 tests --echo # Start of 10.3 tests
--echo # --echo #

View file

@ -1330,6 +1330,18 @@ a
2000-10-00 00:00:00 2000-10-00 00:00:00
DROP TABLE t1; DROP TABLE t1;
# #
# MDEV-21619 Server crash or assertion failures in my_datetime_to_str
#
CREATE TABLE t1 (f DATETIME, KEY(f));
INSERT INTO t1 VALUES ('2020-01-01 00:00:00'),('2020-01-02 00:00:00');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index f f 6 NULL 2 50.00 Using where; Using index
Warnings:
Warning 1292 Truncated incorrect datetime value: '1995.0000000'
Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '0000-00-00 00:00:00.000000' between `test`.`t1`.`f` and <cache>('2012-12-12')
DROP TABLE t1;
#
# End of 10.2 tests # End of 10.2 tests
# #
# #

View file

@ -837,6 +837,15 @@ ALTER TABLE t1 MODIFY a DATETIME;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-21619 Server crash or assertion failures in my_datetime_to_str
--echo #
CREATE TABLE t1 (f DATETIME, KEY(f));
INSERT INTO t1 VALUES ('2020-01-01 00:00:00'),('2020-01-02 00:00:00');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '2012-12-12';
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests

View file

@ -1368,6 +1368,18 @@ CAST(f1() AS TIME)
00:00:00 00:00:00
DROP FUNCTION f1; DROP FUNCTION f1;
# #
# MDEV-21619 Server crash or assertion failures in my_datetime_to_str
#
CREATE TABLE t1 (f TIME, KEY(f));
INSERT INTO t1 VALUES ('10:10:10'),('20:20:20');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '23:59:59';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 index f f 4 NULL 2 50.00 Using where; Using index
Warnings:
Warning 1292 Truncated incorrect time value: '1995.0000000'
Note 1003 select `test`.`t1`.`f` AS `f` from `test`.`t1` where '00:00:00.000000' between `test`.`t1`.`f` and <cache>('23:59:59')
DROP TABLE t1;
#
# End of 10.2 tests # End of 10.2 tests
# #
# #

View file

@ -819,6 +819,15 @@ SELECT CAST(f1() AS TIME);
DROP FUNCTION f1; DROP FUNCTION f1;
--echo #
--echo # MDEV-21619 Server crash or assertion failures in my_datetime_to_str
--echo #
CREATE TABLE t1 (f TIME, KEY(f));
INSERT INTO t1 VALUES ('10:10:10'),('20:20:20');
EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1995.0000000 BETWEEN f AND '23:59:59';
DROP TABLE t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #

View file

@ -1 +0,0 @@
SET default_storage_engine=InnoDB;

View file

@ -0,0 +1,18 @@
FLUSH TABLES;
#
# MDEV-21217 innodb_force_recovery=2 may wrongly abort the rollback
# of recovered transactions
#
connect con0,localhost,root;
CREATE TABLE t0 (a INT PRIMARY KEY) ENGINE=InnoDB;
BEGIN;
INSERT INTO t0 SELECT * FROM seq_1_to_1000;
connection default;
SET GLOBAL innodb_flush_log_at_trx_commit=1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
# restart: --innodb-force-recovery=2
disconnect con0;
connection default;
SELECT * FROM t0 LOCK IN SHARE MODE;
a
DROP TABLE t0,t1;

View file

@ -1,57 +0,0 @@
#
# Make sure http://bugs.mysql.com/34053 remains fixed.
#
-- source include/not_embedded.inc
-- source include/have_innodb.inc
SET default_storage_engine=InnoDB;
# we do not really care about what gets printed, we are only
# interested in getting success or failure according to our
# expectations
-- disable_query_log
-- disable_result_log
GRANT USAGE ON *.* TO 'shane'@'localhost' IDENTIFIED BY '12345';
FLUSH PRIVILEGES;
-- connect (con1,localhost,shane,12345,)
-- connection con1
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
SET GLOBAL innodb_status_output=ON;
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
SET GLOBAL innodb_status_output_locks=ON;
CREATE TABLE innodb_monitor (a INT) ENGINE=INNODB;
DROP TABLE innodb_monitor;
CREATE TABLE innodb_mem_validate (a INT) ENGINE=INNODB;
DROP TABLE innodb_mem_validate;
CREATE TABLE innodb_sql (a INT) ENGINE=INNODB;
DROP TABLE innodb_sql;
CREATE TABLE innodb_monitorx (a INT) ENGINE=INNODB;
DROP TABLE innodb_monitorx;
CREATE TABLE innodb_monito (a INT) ENGINE=INNODB;
DROP TABLE innodb_monito;
CREATE TABLE xinnodb_monitor (a INT) ENGINE=INNODB;
DROP TABLE xinnodb_monitor;
CREATE TABLE nnodb_monitor (a INT) ENGINE=INNODB;
DROP TABLE nnodb_monitor;
-- connection default
SET GLOBAL innodb_status_output=ON;
SET GLOBAL innodb_status_output_locks=ON;
-- connection con1
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
SET GLOBAL innodb_status_output=OFF;
-- error ER_SPECIFIC_ACCESS_DENIED_ERROR
SET GLOBAL innodb_status_output_locks=OFF;
-- connection default
SET GLOBAL innodb_status_output=OFF;
SET GLOBAL innodb_status_output_locks=OFF;
DROP USER 'shane'@'localhost';
-- disconnect con1

View file

@ -0,0 +1,34 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
# We will kill and restart the server.
--source include/not_embedded.inc
FLUSH TABLES;
--echo #
--echo # MDEV-21217 innodb_force_recovery=2 may wrongly abort the rollback
--echo # of recovered transactions
--echo #
connect (con0,localhost,root);
CREATE TABLE t0 (a INT PRIMARY KEY) ENGINE=InnoDB;
# Create enough undo log so that the rollback may take enough time.
BEGIN;
INSERT INTO t0 SELECT * FROM seq_1_to_1000;
connection default;
# Persist the above incomplete transaction.
SET GLOBAL innodb_flush_log_at_trx_commit=1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
--let $restart_parameters= --innodb-force-recovery=2
--let $shutdown_timeout=0
--source include/restart_mysqld.inc
--let $restart_parameters=
--let $shutdown_timeout=
disconnect con0;
connection default;
# If the rollback was aborted, we would end up in a lock wait here.
SELECT * FROM t0 LOCK IN SHARE MODE;
DROP TABLE t0,t1;

View file

@ -33,9 +33,9 @@ ST_FIELD_INFO disks_table_fields[]=
{ {
{ "Disk", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 }, { "Disk", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 },
{ "Path", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 }, { "Path", PATH_MAX, MYSQL_TYPE_STRING, 0, 0 ,0, 0 },
{ "Total", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Total amount available { "Total", 32, MYSQL_TYPE_LONGLONG, 0, 0 ,0 ,0 }, // Total amount available
{ "Used", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Amount of space used { "Used", 32, MYSQL_TYPE_LONGLONG, 0, 0 ,0 ,0 }, // Amount of space used
{ "Available", 32, MYSQL_TYPE_LONG, 0, 0 ,0 ,0 }, // Amount available to users other than root. { "Available", 32, MYSQL_TYPE_LONGLONG, 0, 0 ,0 ,0 }, // Amount available to users other than root.
{ 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 } { 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 }
}; };
@ -52,9 +52,10 @@ int disks_table_add_row(THD* pThd,
// f_bfree Total number of free blocks. // f_bfree Total number of free blocks.
// f_bavail Number of free blocks available to non-privileged process. // f_bavail Number of free blocks available to non-privileged process.
size_t total = (info.f_frsize * info.f_blocks) / 1024; ulonglong total = ((ulonglong)info.f_frsize * info.f_blocks) / 1024;
size_t used = (info.f_frsize * (info.f_blocks - info.f_bfree)) / 1024; ulonglong used = ((ulonglong)info.f_frsize *
size_t avail = (info.f_frsize * info.f_bavail) / 1024; (info.f_blocks - info.f_bfree)) / 1024;
ulonglong avail = ((ulonglong)info.f_frsize * info.f_bavail) / 1024;
pTable->field[0]->store(zDisk, strlen(zDisk), system_charset_info); pTable->field[0]->store(zDisk, strlen(zDisk), system_charset_info);
pTable->field[1]->store(zPath, strlen(zPath), system_charset_info); pTable->field[1]->store(zPath, strlen(zPath), system_charset_info);

View file

@ -3,9 +3,9 @@ Table Create Table
DISKS CREATE TEMPORARY TABLE `DISKS` ( DISKS CREATE TEMPORARY TABLE `DISKS` (
`Disk` varchar(4096) NOT NULL DEFAULT '', `Disk` varchar(4096) NOT NULL DEFAULT '',
`Path` varchar(4096) NOT NULL DEFAULT '', `Path` varchar(4096) NOT NULL DEFAULT '',
`Total` int(32) NOT NULL DEFAULT 0, `Total` bigint(32) NOT NULL DEFAULT 0,
`Used` int(32) NOT NULL DEFAULT 0, `Used` bigint(32) NOT NULL DEFAULT 0,
`Available` int(32) NOT NULL DEFAULT 0 `Available` bigint(32) NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8 ) ENGINE=MEMORY DEFAULT CHARSET=utf8
select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks; select sum(Total) > sum(Available), sum(Total)>sum(Used) from information_schema.disks;
sum(Total) > sum(Available) sum(Total)>sum(Used) sum(Total) > sum(Available) sum(Total)>sum(Used)

View file

@ -6818,6 +6818,13 @@ public:
bool cache_value(); bool cache_value();
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate); bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
int save_in_field(Field *field, bool no_conversions); int save_in_field(Field *field, bool no_conversions);
bool setup(THD *thd, Item *item)
{
if (Item_cache_int::setup(thd, item))
return true;
set_if_smaller(decimals, TIME_SECOND_PART_DIGITS);
return false;
}
void store_packed(longlong val_arg, Item *example); void store_packed(longlong val_arg, Item *example);
/* /*
Having a clone_item method tells optimizer that this object Having a clone_item method tells optimizer that this object

View file

@ -970,11 +970,11 @@ class Item_num_op :public Item_func_numhybrid
decimals= 0; decimals= 0;
set_handler(type_handler_long_or_longlong()); set_handler(type_handler_long_or_longlong());
} }
void fix_length_and_dec_temporal() void fix_length_and_dec_temporal(bool downcast_decimal_to_int)
{ {
set_handler(&type_handler_newdecimal); set_handler(&type_handler_newdecimal);
fix_length_and_dec_decimal(); fix_length_and_dec_decimal();
if (decimals == 0) if (decimals == 0 && downcast_decimal_to_int)
set_handler(type_handler_long_or_longlong()); set_handler(type_handler_long_or_longlong());
} }
bool need_parentheses_in_default() { return true; } bool need_parentheses_in_default() { return true; }

View file

@ -3628,23 +3628,25 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
ulonglong *offset_limit= &item->copy_offset_limit; ulonglong *offset_limit= &item->copy_offset_limit;
ulonglong *row_limit = &item->copy_row_limit; ulonglong *row_limit = &item->copy_row_limit;
if (item->limit_clause && !(*row_limit)) if (item->limit_clause && !(*row_limit))
{
item->result_finalized= true;
return 1; return 1;
}
if (item->no_appended)
item->no_appended= FALSE;
else
result->append(*item->separator);
tmp.length(0); tmp.length(0);
if (item->limit_clause && (*offset_limit)) if (item->limit_clause && (*offset_limit))
{ {
item->row_count++; item->row_count++;
item->no_appended= TRUE;
(*offset_limit)--; (*offset_limit)--;
return 0; return 0;
} }
if (!item->result_finalized)
item->result_finalized= true;
else
result->append(*item->separator);
for (; arg < arg_end; arg++) for (; arg < arg_end; arg++)
{ {
String *res; String *res;
@ -3899,7 +3901,7 @@ void Item_func_group_concat::clear()
result.copy(); result.copy();
null_value= TRUE; null_value= TRUE;
warning_for_row= FALSE; warning_for_row= FALSE;
no_appended= TRUE; result_finalized= FALSE;
if (offset_limit) if (offset_limit)
copy_offset_limit= offset_limit->val_int(); copy_offset_limit= offset_limit->val_int();
if (row_limit) if (row_limit)
@ -4032,13 +4034,12 @@ bool Item_func_group_concat::add()
return 1; return 1;
tree_len+= row_str_len; tree_len+= row_str_len;
} }
/* /*
If the row is not a duplicate (el->count == 1) In case of GROUP_CONCAT with DISTINCT or ORDER BY (or both) don't dump the
we can dump the row here in case of GROUP_CONCAT(DISTINCT...) row to the output buffer here. That will be done in val_str.
instead of doing tree traverse later.
*/ */
if (row_eligible && !warning_for_row && if (row_eligible && !warning_for_row && (!tree && !distinct))
(!tree || (el->count == 1 && distinct && !arg_count_order)))
dump_leaf_key(table->record[0] + table->s->null_bytes, 1, this); dump_leaf_key(table->record[0] + table->s->null_bytes, 1, this);
return 0; return 0;
@ -4274,9 +4275,18 @@ String* Item_func_group_concat::val_str(String* str)
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
if (null_value) if (null_value)
return 0; return 0;
if (no_appended && tree)
/* Tree is used for sorting as in ORDER BY */ if (!result_finalized) // Result yet to be written.
tree_walk(tree, &dump_leaf_key, this, left_root_right); {
if (tree != NULL) // order by
tree_walk(tree, &dump_leaf_key, this, left_root_right);
else if (distinct) // distinct (and no order by).
unique_filter->walk(table, &dump_leaf_key, this);
else if (row_limit && copy_row_limit == (ulonglong)row_limit->val_int())
return &result;
else
DBUG_ASSERT(false); // Can't happen
}
if (table && table->blob_storage && if (table && table->blob_storage &&
table->blob_storage->is_truncated_value()) table->blob_storage->is_truncated_value())

View file

@ -1871,7 +1871,8 @@ class Item_func_group_concat : public Item_sum
bool warning_for_row; bool warning_for_row;
bool always_null; bool always_null;
bool force_copy_fields; bool force_copy_fields;
bool no_appended; /** True if entire result of GROUP_CONCAT has been written to output buffer. */
bool result_finalized;
/** Limits the rows in the result */ /** Limits the rows in the result */
Item *row_limit; Item *row_limit;
/** Skips a particular number of rows in from the result*/ /** Skips a particular number of rows in from the result*/

View file

@ -2494,7 +2494,7 @@ static int find_uniq_filename(char *name, ulong min_log_number_to_use,
char buff[FN_REFLEN], ext_buf[FN_REFLEN]; char buff[FN_REFLEN], ext_buf[FN_REFLEN];
struct st_my_dir *dir_info; struct st_my_dir *dir_info;
struct fileinfo *file_info; struct fileinfo *file_info;
ulong max_found, next, UNINIT_VAR(number); ulong max_found= 0, next= 0, number= 0;
size_t buf_length, length; size_t buf_length, length;
char *start, *end; char *start, *end;
int error= 0; int error= 0;
@ -2530,7 +2530,7 @@ static int find_uniq_filename(char *name, ulong min_log_number_to_use,
if (strncmp(file_info->name, start, length) == 0 && if (strncmp(file_info->name, start, length) == 0 &&
test_if_number(file_info->name+length, &number,0)) test_if_number(file_info->name+length, &number,0))
{ {
set_if_bigger(max_found,(ulong) number); set_if_bigger(max_found, number);
} }
} }
my_dirend(dir_info); my_dirend(dir_info);

View file

@ -11852,7 +11852,7 @@ int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr)
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
static bool update_schema_privilege(THD *thd, TABLE *table, char *buff, static bool update_schema_privilege(THD *thd, TABLE *table, const char *buff,
const char* db, const char* t_name, const char* db, const char* t_name,
const char* column, uint col_length, const char* column, uint col_length,
const char *priv, uint priv_length, const char *priv, uint priv_length,
@ -11876,6 +11876,21 @@ static bool update_schema_privilege(THD *thd, TABLE *table, char *buff,
#endif #endif
#ifndef NO_EMBEDDED_ACCESS_CHECKS
class Grantee_str
{
char m_buff[USER_HOST_BUFF_SIZE + 6 /* 4 quotes, @, '\0' */];
public:
Grantee_str(const char *user, const char *host)
{
DBUG_ASSERT(strlen(user) + strlen(host) + 6 < sizeof(m_buff));
strxmov(m_buff, "'", user, "'@'", host, "'", NullS);
}
operator const char *() const { return m_buff; }
};
#endif
int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{ {
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -11883,7 +11898,6 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
uint counter; uint counter;
ACL_USER *acl_user; ACL_USER *acl_user;
ulong want_access; ulong want_access;
char buff[100];
TABLE *table= tables->table; TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql", bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1); NULL, NULL, 1, 1);
@ -11908,10 +11922,10 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(want_access & GRANT_ACL)) if (!(want_access & GRANT_ACL))
is_grantable= "NO"; is_grantable= "NO";
strxmov(buff,"'",user,"'@'",host,"'",NullS); Grantee_str grantee(user, host);
if (!(want_access & ~GRANT_ACL)) if (!(want_access & ~GRANT_ACL))
{ {
if (update_schema_privilege(thd, table, buff, 0, 0, 0, 0, if (update_schema_privilege(thd, table, grantee, 0, 0, 0, 0,
STRING_WITH_LEN("USAGE"), is_grantable)) STRING_WITH_LEN("USAGE"), is_grantable))
{ {
error= 1; error= 1;
@ -11926,7 +11940,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{ {
if (test_access & j) if (test_access & j)
{ {
if (update_schema_privilege(thd, table, buff, 0, 0, 0, 0, if (update_schema_privilege(thd, table, grantee, 0, 0, 0, 0,
command_array[priv_id], command_array[priv_id],
command_lengths[priv_id], is_grantable)) command_lengths[priv_id], is_grantable))
{ {
@ -11954,7 +11968,6 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
uint counter; uint counter;
ACL_DB *acl_db; ACL_DB *acl_db;
ulong want_access; ulong want_access;
char buff[100];
TABLE *table= tables->table; TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql", bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1); NULL, NULL, 1, 1);
@ -11983,10 +11996,10 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{ {
is_grantable= "NO"; is_grantable= "NO";
} }
strxmov(buff,"'",user,"'@'",host,"'",NullS); Grantee_str grantee(user, host);
if (!(want_access & ~GRANT_ACL)) if (!(want_access & ~GRANT_ACL))
{ {
if (update_schema_privilege(thd, table, buff, acl_db->db, 0, 0, if (update_schema_privilege(thd, table, grantee, acl_db->db, 0, 0,
0, STRING_WITH_LEN("USAGE"), is_grantable)) 0, STRING_WITH_LEN("USAGE"), is_grantable))
{ {
error= 1; error= 1;
@ -12000,7 +12013,8 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
for (cnt=0, j = SELECT_ACL; j <= DB_ACLS; cnt++,j <<= 1) for (cnt=0, j = SELECT_ACL; j <= DB_ACLS; cnt++,j <<= 1)
if (test_access & j) if (test_access & j)
{ {
if (update_schema_privilege(thd, table, buff, acl_db->db, 0, 0, 0, if (update_schema_privilege(thd, table,
grantee, acl_db->db, 0, 0, 0,
command_array[cnt], command_lengths[cnt], command_array[cnt], command_lengths[cnt],
is_grantable)) is_grantable))
{ {
@ -12026,7 +12040,6 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
int error= 0; int error= 0;
uint index; uint index;
char buff[100];
TABLE *table= tables->table; TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql", bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1); NULL, NULL, 1, 1);
@ -12059,10 +12072,11 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(table_access & GRANT_ACL)) if (!(table_access & GRANT_ACL))
is_grantable= "NO"; is_grantable= "NO";
strxmov(buff, "'", user, "'@'", host, "'", NullS); Grantee_str grantee(user, host);
if (!test_access) if (!test_access)
{ {
if (update_schema_privilege(thd, table, buff, grant_table->db, if (update_schema_privilege(thd, table,
grantee, grant_table->db,
grant_table->tname, 0, 0, grant_table->tname, 0, 0,
STRING_WITH_LEN("USAGE"), is_grantable)) STRING_WITH_LEN("USAGE"), is_grantable))
{ {
@ -12078,7 +12092,8 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{ {
if (test_access & j) if (test_access & j)
{ {
if (update_schema_privilege(thd, table, buff, grant_table->db, if (update_schema_privilege(thd, table,
grantee, grant_table->db,
grant_table->tname, 0, 0, grant_table->tname, 0, 0,
command_array[cnt], command_array[cnt],
command_lengths[cnt], is_grantable)) command_lengths[cnt], is_grantable))
@ -12106,7 +12121,6 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
int error= 0; int error= 0;
uint index; uint index;
char buff[100];
TABLE *table= tables->table; TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql", bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1); NULL, NULL, 1, 1);
@ -12133,7 +12147,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
is_grantable= "NO"; is_grantable= "NO";
ulong test_access= table_access & ~GRANT_ACL; ulong test_access= table_access & ~GRANT_ACL;
strxmov(buff, "'", user, "'@'", host, "'", NullS); Grantee_str grantee(user, host);
if (!test_access) if (!test_access)
continue; continue;
else else
@ -12152,7 +12166,9 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
my_hash_element(&grant_table->hash_columns,col_index); my_hash_element(&grant_table->hash_columns,col_index);
if ((grant_column->rights & j) && (table_access & j)) if ((grant_column->rights & j) && (table_access & j))
{ {
if (update_schema_privilege(thd, table, buff, grant_table->db, if (update_schema_privilege(thd, table,
grantee,
grant_table->db,
grant_table->tname, grant_table->tname,
grant_column->column, grant_column->column,
grant_column->key_length, grant_column->key_length,

View file

@ -3412,7 +3412,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
if (!insert_table(thd, key_length, key, (*block_table), if (!insert_table(thd, key_length, key, (*block_table),
tables_used->view_db.length, 0, tables_used->view_db.length, 0,
HA_CACHE_TBL_NONTRANSACT, 0, 0, TRUE)) HA_CACHE_TBL_NONTRANSACT, 0, 0, TRUE))
DBUG_RETURN(0); goto err_cleanup;
/* /*
We do not need to register view tables here because they are already We do not need to register view tables here because they are already
present in the global list. present in the global list.
@ -3436,7 +3436,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
tables_used->callback_func, tables_used->callback_func,
tables_used->engine_data, tables_used->engine_data,
TRUE)) TRUE))
DBUG_RETURN(0); goto err_cleanup;
if (tables_used->table->file-> if (tables_used->table->file->
register_query_cache_dependant_tables(thd, this, block_table, &n)) register_query_cache_dependant_tables(thd, this, block_table, &n))
@ -3444,6 +3444,11 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
} }
} }
DBUG_RETURN(n - counter); DBUG_RETURN(n - counter);
err_cleanup:
// Mark failed
(*block_table)->next= (*block_table)->prev= NULL;
(*block_table)->parent= NULL;
DBUG_RETURN(0);
} }
/* /*
@ -3477,7 +3482,12 @@ my_bool Query_cache::register_all_tables(THD *thd,
for (Query_cache_block_table *tmp = block->table(0) ; for (Query_cache_block_table *tmp = block->table(0) ;
tmp != block_table; tmp != block_table;
tmp++) tmp++)
unlink_table(tmp); {
if (tmp->prev) // not marked as failed and unuseable
unlink_table(tmp);
else
break;
}
if (block_table->parent) if (block_table->parent)
unlink_table(block_table); unlink_table(block_table);
} }

View file

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2015,2019 MariaDB Copyright (c) 2015, 2020, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -6147,7 +6147,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result:: bool Type_handler_temporal_result::
Item_func_plus_fix_length_and_dec(Item_func_plus *item) const Item_func_plus_fix_length_and_dec(Item_func_plus *item) const
{ {
item->fix_length_and_dec_temporal(); item->fix_length_and_dec_temporal(true);
return false; return false;
} }
@ -6196,7 +6196,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result:: bool Type_handler_temporal_result::
Item_func_minus_fix_length_and_dec(Item_func_minus *item) const Item_func_minus_fix_length_and_dec(Item_func_minus *item) const
{ {
item->fix_length_and_dec_temporal(); item->fix_length_and_dec_temporal(true);
return false; return false;
} }
@ -6245,7 +6245,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result:: bool Type_handler_temporal_result::
Item_func_mul_fix_length_and_dec(Item_func_mul *item) const Item_func_mul_fix_length_and_dec(Item_func_mul *item) const
{ {
item->fix_length_and_dec_temporal(); item->fix_length_and_dec_temporal(true);
return false; return false;
} }
@ -6294,7 +6294,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result:: bool Type_handler_temporal_result::
Item_func_div_fix_length_and_dec(Item_func_div *item) const Item_func_div_fix_length_and_dec(Item_func_div *item) const
{ {
item->fix_length_and_dec_temporal(); item->fix_length_and_dec_temporal(false);
return false; return false;
} }
@ -6343,7 +6343,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result:: bool Type_handler_temporal_result::
Item_func_mod_fix_length_and_dec(Item_func_mod *item) const Item_func_mod_fix_length_and_dec(Item_func_mod *item) const
{ {
item->fix_length_and_dec_temporal(); item->fix_length_and_dec_temporal(true);
return false; return false;
} }

View file

@ -318,6 +318,9 @@ double Unique::get_use_cost(uint *buffer, size_t nkeys, uint key_size,
max_elements_in_tree= ((size_t) max_in_memory_size / max_elements_in_tree= ((size_t) max_in_memory_size /
ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size)); ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
if (max_elements_in_tree == 0)
max_elements_in_tree= 1;
n_full_trees= nkeys / max_elements_in_tree; n_full_trees= nkeys / max_elements_in_tree;
last_tree_elems= nkeys % max_elements_in_tree; last_tree_elems= nkeys % max_elements_in_tree;
@ -786,7 +789,12 @@ bool Unique::get(TABLE *table)
/* Not enough memory; Save the result to file && free memory used by tree */ /* Not enough memory; Save the result to file && free memory used by tree */
if (flush()) if (flush())
DBUG_RETURN(1); DBUG_RETURN(1);
size_t buff_sz= (max_in_memory_size / full_size + 1) * full_size; /*
merge_buffer must fit at least MERGEBUFF2 + 1 keys, because
merge_index() can merge that many BUFFPEKs at once. The extra space for
one key for Sort_param::unique_buff
*/
size_t buff_sz= MY_MAX(MERGEBUFF2+1, max_in_memory_size/full_size+1) * full_size;
if (!(sort_buffer= (uchar*) my_malloc(buff_sz, if (!(sort_buffer= (uchar*) my_malloc(buff_sz,
MYF(MY_THREAD_SPECIFIC|MY_WME)))) MYF(MY_THREAD_SPECIFIC|MY_WME))))
DBUG_RETURN(1); DBUG_RETURN(1);

View file

@ -85,6 +85,9 @@ public:
{ {
size_t max_elems_in_tree= size_t max_elems_in_tree=
max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size); max_in_memory_size / ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size);
if (max_elems_in_tree == 0)
max_elems_in_tree= 1;
return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree)); return (int) (sizeof(uint)*(1 + nkeys/max_elems_in_tree));
} }

View file

@ -1536,7 +1536,7 @@ dict_load_column_low(
ulint pos; ulint pos;
ulint num_base; ulint num_base;
ut_ad(table || column); ut_ad(!table == !!column);
if (rec_get_deleted_flag(rec, 0)) { if (rec_get_deleted_flag(rec, 0)) {
return(dict_load_column_del); return(dict_load_column_del);
@ -1643,7 +1643,7 @@ err_len:
} }
num_base = mach_read_from_4(field); num_base = mach_read_from_4(field);
if (column == NULL) { if (table) {
if (prtype & DATA_VIRTUAL) { if (prtype & DATA_VIRTUAL) {
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
dict_v_col_t* vcol = dict_v_col_t* vcol =

View file

@ -485,7 +485,7 @@ row_undo_step(
if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE
&& !srv_undo_sources && !srv_undo_sources
&& !srv_is_being_started) && srv_shutdown_state != SRV_SHUTDOWN_NONE)
&& (srv_fast_shutdown == 3 || trx == trx_roll_crash_recv_trx)) { && (srv_fast_shutdown == 3 || trx == trx_roll_crash_recv_trx)) {
/* Shutdown has been initiated. */ /* Shutdown has been initiated. */
trx->error_state = DB_INTERRUPTED; trx->error_state = DB_INTERRUPTED;

View file

@ -4968,8 +4968,8 @@ static size_t my_caseup_utf8(CHARSET_INFO *cs, const char *src, size_t srclen,
} }
static void my_hash_sort_utf8_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, static void my_hash_sort_utf8mb3_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2) ulong *nr1, ulong *nr2)
{ {
my_wc_t wc; my_wc_t wc;
int res; int res;
@ -4988,17 +4988,15 @@ static void my_hash_sort_utf8_nopad(CHARSET_INFO *cs, const uchar *s, size_t sle
} }
static void my_hash_sort_utf8(CHARSET_INFO *cs, const uchar *s, size_t slen, static void my_hash_sort_utf8mb3(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2) ulong *nr1, ulong *nr2)
{ {
const uchar *e= s+slen;
/* /*
Remove end space. We have to do this to be able to compare Remove end space. We have to do this to be able to compare
'A ' and 'A' as identical 'A ' and 'A' as identical
*/ */
while (e > s && e[-1] == ' ') const uchar *e= skip_trailing_space(s, slen);
e--; my_hash_sort_utf8mb3_nopad(cs, s, e - s, nr1, nr2);
my_hash_sort_utf8_nopad(cs, s, e - s, nr1, nr2);
} }
@ -5365,7 +5363,7 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_ci_handler =
my_wildcmp_utf8, my_wildcmp_utf8,
my_strcasecmp_utf8, my_strcasecmp_utf8,
my_instr_mb, my_instr_mb,
my_hash_sort_utf8, my_hash_sort_utf8mb3,
my_propagate_complex my_propagate_complex
}; };
@ -5381,7 +5379,7 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_mysql500_ci_handler =
my_wildcmp_utf8, my_wildcmp_utf8,
my_strcasecmp_utf8, my_strcasecmp_utf8,
my_instr_mb, my_instr_mb,
my_hash_sort_utf8, my_hash_sort_utf8mb3,
my_propagate_complex my_propagate_complex
}; };
@ -5413,7 +5411,7 @@ static MY_COLLATION_HANDLER my_collation_utf8_general_nopad_ci_handler =
my_wildcmp_utf8, my_wildcmp_utf8,
my_strcasecmp_utf8, my_strcasecmp_utf8,
my_instr_mb, my_instr_mb,
my_hash_sort_utf8_nopad, my_hash_sort_utf8mb3_nopad,
my_propagate_complex my_propagate_complex
}; };
@ -7066,7 +7064,7 @@ static MY_COLLATION_HANDLER my_collation_filename_handler =
my_wildcmp_utf8, my_wildcmp_utf8,
my_strcasecmp_utf8, my_strcasecmp_utf8,
my_instr_mb, my_instr_mb,
my_hash_sort_utf8, my_hash_sort_utf8mb3,
my_propagate_complex my_propagate_complex
}; };
@ -7422,13 +7420,11 @@ static void
my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen, my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2) ulong *nr1, ulong *nr2)
{ {
const uchar *e= s + slen;
/* /*
Remove end space. We do this to be able to compare Remove end space. We do this to be able to compare
'A ' and 'A' as identical 'A ' and 'A' as identical
*/ */
while (e > s && e[-1] == ' ') const uchar *e= skip_trailing_space(s, slen);
e--;
my_hash_sort_utf8mb4_nopad(cs, s, e - s, nr1, nr2); my_hash_sort_utf8mb4_nopad(cs, s, e - s, nr1, nr2);
} }