summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-06-14 10:13:53 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-06-14 10:13:53 +0300
commit3dbc49f075ba4f6b86b67c1ef3776d651474b729 (patch)
tree552b8e488527637eb90f91cc2f03c0cc69169a08
parent9ed08f357693875c9d2376651305aa66199d2c35 (diff)
parentb58586aae938e6aa7714c9bb3813da908e49010a (diff)
downloadmariadb-git-3dbc49f075ba4f6b86b67c1ef3776d651474b729.tar.gz
Merge 10.4 into 10.5
-rw-r--r--client/mysql.cc10
-rw-r--r--client/mysql_plugin.c4
-rw-r--r--client/mysqlbinlog.cc4
-rw-r--r--client/mysqldump.c10
-rw-r--r--client/mysqlimport.c2
-rw-r--r--client/mysqlslap.c2
-rw-r--r--client/mysqltest.cc24
-rw-r--r--mysql-test/main/ctype_utf32_uca.result18
-rw-r--r--mysql-test/main/ctype_utf32_uca.test18
-rw-r--r--mysql-test/main/func_math.result30
-rw-r--r--mysql-test/main/func_math.test23
-rw-r--r--mysql-test/main/grant.result15
-rw-r--r--mysql-test/main/grant.test14
-rw-r--r--mysql-test/main/grant5.result17
-rw-r--r--mysql-test/main/grant5.test17
-rw-r--r--mysql-test/main/index_merge_innodb.result26
-rw-r--r--mysql-test/main/index_merge_innodb.test23
-rw-r--r--mysql-test/main/query_cache.result12
-rw-r--r--mysql-test/main/query_cache.test17
-rw-r--r--mysql-test/main/type_date.result18
-rw-r--r--mysql-test/main/type_date.test18
-rw-r--r--mysql-test/main/type_datetime.result12
-rw-r--r--mysql-test/main/type_datetime.test9
-rw-r--r--mysql-test/main/type_time.result12
-rw-r--r--mysql-test/main/type_time.test9
-rw-r--r--mysql-test/main/type_timestamp.result27
-rw-r--r--mysql-test/main/type_timestamp.test20
-rw-r--r--mysql-test/suite/innodb/r/innodb_bug34053.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result18
-rw-r--r--mysql-test/suite/innodb/t/innodb_bug34053.test57
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test34
-rw-r--r--sql/field.cc4
-rw-r--r--sql/item.cc6
-rw-r--r--sql/item.h8
-rw-r--r--sql/item_func.h4
-rw-r--r--sql/item_sum.cc2
-rw-r--r--sql/log.cc4
-rw-r--r--sql/sql_acl.cc51
-rw-r--r--sql/sql_cache.cc16
-rw-r--r--sql/sql_type.cc12
-rw-r--r--sql/uniques.cc10
-rw-r--r--sql/uniques.h3
-rw-r--r--storage/innobase/dict/dict0load.cc4
-rw-r--r--storage/innobase/row/row0undo.cc2
-rw-r--r--strings/ctype-utf8.c8
45 files changed, 523 insertions, 132 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index bb2b98b7d64..dcd9dfecef9 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1287,8 +1287,8 @@ sig_handler mysql_end(int sig)
{
#ifndef _WIN32
/*
- Ingnoring SIGQUIT and SIGINT signals when cleanup process starts.
- This will help in resolving the double free issues, which occures in case
+ Ignoring SIGQUIT and SIGINT signals when cleanup process starts.
+ 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.
*/
signal(SIGQUIT, SIG_IGN);
@@ -4720,7 +4720,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
/*
CLIENT_PROGRESS_OBSOLETE is set only if we requested it in
mysql_real_connect() and the server also supports it
- */
+*/
if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE)
mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress);
#else
@@ -4789,7 +4789,7 @@ com_status(String *buffer __attribute__((unused)),
tee_fprintf(stdout, "\nConnection id:\t\t%lu\n",mysql_thread_id(&mysql));
/*
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))
{
@@ -5138,7 +5138,7 @@ static const char *construct_prompt()
time_t lclock = time(NULL); // Get the date struct
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++)
{
if (*c != PROMPT_CHAR)
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index 15bbc71183d..eddae6114e6 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -1024,7 +1024,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
the plugin via REPLACE and DELETE operations on the mysql.plugin table.
@@ -1153,7 +1153,7 @@ exit:
Create a command line sequence to launch mysqld in bootstrap mode. This
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 bootstrap mode skips loading of plugins and many other subsystems.
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index ed0d9ef8ea4..a93d925db58 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -753,7 +753,7 @@ static bool shall_skip_database(const char *log_dbname)
/**
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
producing USE statements by corresponding log event print-functions.
*/
@@ -785,7 +785,7 @@ print_use_stmt(PRINT_EVENT_INFO* pinfo, const Query_log_event *ev)
// In case of rewrite rule print USE statement for db_to
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.
memcpy(pinfo->db, db, db_len + 1);
}
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 161485ca125..4830a6c782b 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -147,7 +147,7 @@ static char * opt_mysql_unix_port=0;
static int first_error=0;
/*
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.
*/
static uint multi_source= 0;
@@ -2075,7 +2075,7 @@ static void print_xml_tag(FILE * xml_file, const char* sbeg,
<stag_atr="sval" xsi:nil="true"/>
NOTE
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,
@@ -2147,7 +2147,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:
\t\t<row_name Atr1="Val1" Atr2="Val2"... />
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,
@@ -2632,7 +2632,7 @@ static uint dump_routines_for_db(char *db)
print_comment(sql_file, 1,
"-- does %s have permissions on mysql.proc?\n\n",
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);
}
else if (strlen(row[2]))
@@ -4187,7 +4187,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)
fputs("\t</table_data>\n", md_result_file);
else if (extended_insert && row_break)
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 9e197e4e199..6cb32da2239 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -581,7 +581,7 @@ static char *field_escape(char *to,const char *from,uint length)
else
{
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;
}
}
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index ff08a8565c1..75cd7f14846 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -2283,7 +2283,7 @@ slap_connect(MYSQL *mysql)
opt_mysql_unix_port,
connect_flags))
{
- /* Connect suceeded */
+ /* Connect succeeded */
connect_error= 0;
break;
}
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index c278bb1aabd..79ca4ed60e7 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -146,7 +146,7 @@ struct property {
my_bool *var; /* Actual variable */
my_bool set; /* Has been set for ONE command */
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 */
};
@@ -566,7 +566,7 @@ DYNAMIC_ARRAY regex_arr; /* stores a list of st_regex subsitutions */
Temporary storage areas for substitutions. To reduce unnessary copying
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
-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.
*/
char* buf;
@@ -3095,7 +3095,7 @@ void open_file(const char *name)
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
which would mean to include qwe/include/thing.inc.
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));
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)))
die("empty result in show master status");
strnmov(master_pos.file, row[0], sizeof(master_pos.file)-1);
@@ -5350,7 +5350,7 @@ void do_get_errcodes(struct st_command *command)
p++;
}
- /* Convert the sting to int */
+ /* Convert the string to int */
if (!str2int(start, 10, (long) INT_MIN, (long) INT_MAX, &val))
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, "\n", 1);
}
- /* Simlified logging if enabled */
+ /* Simplified logging if enabled */
if (!disable_connect_log && !disable_query_log)
{
replace_dynstr_append(ds, command->query);
@@ -8219,7 +8219,7 @@ void handle_no_error(struct st_command *command)
SYNPOSIS
run_query_stmt
mysql - mysql handle
- command - currrent command pointer
+ command - current command pointer
query - query string to execute
query_len - length query string to execute
ds - output buffer where to store result form query
@@ -8459,7 +8459,7 @@ end:
/*
Create a util connection if one does not already exists
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.
*/
@@ -8500,7 +8500,7 @@ int util_query(MYSQL* org_mysql, const char* query){
SYNPOSIS
run_query()
mysql mysql handle
- command currrent command pointer
+ command current command pointer
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
@@ -10257,7 +10257,7 @@ int multi_reg_replace(struct st_replace_regex* r,char* val)
if (!reg_replace(&out_buf, buf_len_p, re.pattern, re.replace,
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 == r->even_buf)
@@ -10524,7 +10524,7 @@ typedef struct st_rep_set {
uint found_len; /* Best match to date */
int found_offset;
uint table_offset;
- uint size_of_bits; /* For convinience */
+ uint size_of_bits; /* For convenience */
} REP_SET;
typedef struct st_rep_sets {
@@ -10627,7 +10627,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
DBUG_RETURN(0);
}
(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;
word_states=make_new_set(&sets); /* Start of new word */
start_states=make_new_set(&sets); /* This is first state */
diff --git a/mysql-test/main/ctype_utf32_uca.result b/mysql-test/main/ctype_utf32_uca.result
index e623d322d62..a344672579e 100644
--- a/mysql-test/main/ctype_utf32_uca.result
+++ b/mysql-test/main/ctype_utf32_uca.result
@@ -7921,3 +7921,21 @@ SET NAMES utf8;
#
# End of 10.2 tests
#
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-22499 Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed in TABLE_SHARE::init_from_binary_frm_image
+#
+SET @@SESSION.collation_connection=utf32_estonian_ci;
+CREATE TABLE t1(c1 SET('a') COLLATE 'Binary',c2 JSON);
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` set('\0\0\0a') CHARACTER SET binary DEFAULT NULL,
+ `c2` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`c2`))
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/ctype_utf32_uca.test b/mysql-test/main/ctype_utf32_uca.test
index 7849ddbca6f..f84093c4587 100644
--- a/mysql-test/main/ctype_utf32_uca.test
+++ b/mysql-test/main/ctype_utf32_uca.test
@@ -268,3 +268,21 @@ SET NAMES utf8;
--echo #
--echo # End of 10.2 tests
--echo #
+
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-22499 Assertion `(uint) (table_check_constraints - share->check_constraints) == (uint) (share->table_check_constraints - share->field_check_constraints)' failed in TABLE_SHARE::init_from_binary_frm_image
+--echo #
+
+SET @@SESSION.collation_connection=utf32_estonian_ci;
+CREATE TABLE t1(c1 SET('a') COLLATE 'Binary',c2 JSON);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result
index 6ed80275cbb..547339e56ac 100644
--- a/mysql-test/main/func_math.result
+++ b/mysql-test/main/func_math.result
@@ -2251,6 +2251,36 @@ SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1;
f
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
#
#
diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test
index 38c930fb927..7f8fe9e7e73 100644
--- a/mysql-test/main/func_math.test
+++ b/mysql-test/main/func_math.test
@@ -1111,6 +1111,29 @@ CREATE TABLE t1 (i INT(23));
SELECT ROUND( i, 18446744073709551594 ) AS f FROM 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 # End of 10.3 tests
--echo #
diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result
index e804a37d3d0..20f670cbef4 100644
--- a/mysql-test/main/grant.result
+++ b/mysql-test/main/grant.result
@@ -2735,7 +2735,20 @@ DROP USER untrusted@localhost;
DROP DATABASE secret;
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
diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test
index 7dedf820774..147fc42311c 100644
--- a/mysql-test/main/grant.test
+++ b/mysql-test/main/grant.test
@@ -2225,7 +2225,19 @@ set GLOBAL sql_mode=default;
--source include/wait_until_count_sessions.inc
--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 #
diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result
index 43b58b82231..df09b1fcc64 100644
--- a/mysql-test/main/grant5.result
+++ b/mysql-test/main/grant5.result
@@ -225,4 +225,21 @@ drop user twg@'%';
insert mysql.tables_priv (host,db,user,table_name,grantor,table_priv) values ('localhost','','otto','t1','root@localhost','select');
flush privileges;
delete from mysql.tables_priv where db='';
+create database db;
+create table db.t1 (a int);
+insert into db.t1 values (1);
+create user foo;
+grant delete on db.* to foo;
+connect con1,localhost,foo,,;
+show create table db.t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+delete from db.t1 returning *;
+ERROR 42000: SELECT command denied to user 'foo'@'localhost' for column 'a' in table 't1'
+disconnect con1;
+connection default;
+drop database db;
+drop user foo;
# End of 10.4 tests
diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test
index 307549ec9d8..39fcff92435 100644
--- a/mysql-test/main/grant5.test
+++ b/mysql-test/main/grant5.test
@@ -182,4 +182,21 @@ insert mysql.tables_priv (host,db,user,table_name,grantor,table_priv) values ('l
flush privileges;
delete from mysql.tables_priv where db='';
+#
+# MDEV-21560 Assertion `grant_table || grant_table_role' failed in check_grant_all_columns
+#
+create database db;
+create table db.t1 (a int);
+insert into db.t1 values (1);
+create user foo;
+grant delete on db.* to foo;
+--connect (con1,localhost,foo,,)
+show create table db.t1;
+--error ER_COLUMNACCESS_DENIED_ERROR
+delete from db.t1 returning *;
+--disconnect con1
+--connection default
+drop database db;
+drop user foo;
+
--echo # End of 10.4 tests
diff --git a/mysql-test/main/index_merge_innodb.result b/mysql-test/main/index_merge_innodb.result
index b7c006c09e8..775ef3d01e5 100644
--- a/mysql-test/main/index_merge_innodb.result
+++ b/mysql-test/main/index_merge_innodb.result
@@ -810,4 +810,30 @@ sum(col1)
33632261
drop table t1;
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;
diff --git a/mysql-test/main/index_merge_innodb.test b/mysql-test/main/index_merge_innodb.test
index 27125c319f5..c0918fec79f 100644
--- a/mysql-test/main/index_merge_innodb.test
+++ b/mysql-test/main/index_merge_innodb.test
@@ -200,4 +200,27 @@ SELECT sum(col1) FROM t1 FORCE INDEX (key1,key2) WHERE (key1 between 10 and 819
drop table t1;
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;
diff --git a/mysql-test/main/query_cache.result b/mysql-test/main/query_cache.result
index 4ba2568c3d9..4615c63feb2 100644
--- a/mysql-test/main/query_cache.result
+++ b/mysql-test/main/query_cache.result
@@ -2098,6 +2098,18 @@ drop procedure p1;
drop table t1;
set GLOBAL query_cache_size=1355776;
SET GLOBAL userstat=@save_userstat;
+#
+# MDEV-5924: MariaDB could crash after changing the query_cache size
+#
+SET GLOBAL query_cache_size= 50*1024;
+SET GLOBAL query_cache_type= 1;
+SET query_cache_type= 1;
+CREATE TABLE t1 (pk INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+SELECT * FROM v1 WHERE pk IN (5178922,5178924,6911605,6584899,1754348,7735031,9583206,8377182,6309967,3110885,7197937,5582397,9811721,8310302,7001831,3687942,8454635,8743988,9524703,3313583,1376007,5276565,7238861,5307189,2242691,2052764,8160476,7668014,5891525,9070968,1989181,3014068,5365005,2974655,6877822,7813446,6188705,1028564,6426696,6098205,7231857,2749710,4996963,9879425,2995803,8160614,1934799,1981216,3673522,2135299,4803054,8515609,1825485,5805694,8211425,3712249,8013259,3496368,4339706,2326187,3236816,8158416,5749801,6339492,2517486,1769729,2576400,8177368,5471847,4670669,5694046,5155990,1219314,1304321,7951736,2381942,1467330,3329376,6069503,3821151,8118179,4575775,5291671,4757186,6241302,9809112,5388351,3356292,5753921,8776535,7101943,8558868,6655212,5498901,1629516,8016143,1156005,1280700,9236450,8289703,4549957,5404968,3594833,3034667,3167602,7983322,3939941,8382949,9258422,6927947,9639236,3246566,3144943,5516067,5266540,3760726,6491516,9515090,7776229,1582824,4031951,3336517,5871612,4268432,2600433,6188018,6158355,6442214,7808502,7692871,9180969,3982238,9212692,9944381,3932525,5937118,6315460,2464477,1933151,3393646,4244674,7036026,1470764,3015029,2453765,9876129,2097534,3467391,4287658,8120651,4975540,4454101,7758102,6087905,2167022,7575454,5370086,8289703,7460235,8734512,7346801,6660293,5826843,4305511,8093597,8970031,9104476,1784973,9245925,6893890,4996414,3144393,1145568,2702056,4984878,5602859,7088073,2044113,5248275,6037094,2185287,1791564,3180374,8750991,9187011,6411453,9600372,4819671,3105667,2837051,1252548,3729003,7986618,8305633,5684432,4528808,8670104,4132202,2101516,5218475,6885513,4886413,1288803,9584167,6524475,3943649,6195846,4204986,5435592,8877334,9276275,8848358,3583435,6662216,7178298,1973526,5917205,9156387,8877334,4559432,2792144,9831634,8846710,6979858,5287277,2220718,9358123,4140029,1263122,8049789,9508361,3597030,8504348,4525924,9062866,1880691,9788375,4746612,7711822,9735366,9227523,9701721,2832519,4498870,3725021,4836151,2351181,7339935,9890686,7641098,1797607,1571838,3258377,6244186,5147476,6760543,9151580,2465576,2545776,6846237,4037582,8310440,2503616,1998245,1716445,2364913,4665039,8420440,1187728,1065917,1734710,5826705,8538681,8311950,4662017,7804519,7696853,7385116,8674362,2787612,2393341,1652313,2254364,3852737,4177108,7013641,8654037,9062728,7826629,2569396,1039138,2572692,9001892,3470550,4859359,5218887,6479568,1424621,3535644,7808639,7817291,8825149,6060302,2830047,7787765,5971313,9603256,1800491,3429214,9350021,8716796,1972564,6054946,6445510,9234802,5616729,6064559,2048233,9458511,1597244,3902862,2530120,5723846,3463821,9008346,3055130,2941696,8774337,3095367,2195037,6208480,9869262,3615295,9916641,1078002,1815597,7737228,1412261,6588607,9740173,6696411,7740386,1641326,9269546,3848754,7745193,6819458,5297164,1280975,1224395,5247589,7793533,5314743,8814025,2579010,7882659,6753128,9558349,8710067,7898727,4209106,2634902,7311233,1644897,8363449,6201339,1770828,3572174,5493408,8835449,5644332,5096115,7116088,1534484,3204544,1772064,2091903,6744476,9183166,5546005,1030075,7387725,1300888,5799789,7340209,7356552,7677627,9410995,5775894,9442581,5718353,6544937,9809524,7171569,4565475,1397293,6687759,1509353,3715682,8607208,3506118,3910827,1890167,1559341,4150329,9679336,9756927,1292373,3445419,2105361,6594238,4234237,8359466,7352432,1492462,9482818,1601226,8561614,4186584,5849365,1460189,9139495,3113357,8384460,7229660,8701553,7786254,4606399,2057708,1638992,1083221,8147293,9569198,4776550,2539871,8040039,7104141,8090713,7242568,2361480,6913940,7958053,1414596,3451461,9160644,7901473,8289703,5428588,3063232,2302291,5366378,8216918,8033447,8048965,8636322,7807952,7146026,6589569,2882644,1971328,7786392,5357864,4637985,2137222,9819961,9039932,8900680,1666732,8126968,1652999,7199035,8229003,7845581,8902328,8100051,9506164,8168579,8786560,4753890,6941268,5035552,2919860,9570983,4751968,4566574,7540023,1621963,7924270,7578750,6669494,5857192,6409805,2030792,4401779,5737991,8241088,4739746,2776901,7373718,8786697,9211593,6219741,1758331,3863586,6932754,5006164,8200302,5925033,1962127,2728149,8540191,9044326,6171264,4224899,9248672,5911026,6974502,1950317,4998611,2561569,2891845,3243957,8806335,8058303,8791778,1475708,3335281,7841186,9153228,5532135,5453994,5966369,4194824,3612686,8645385,9952621,1211349,2806289,4358520,7454330,5964035,2415313,8897384,6479431,1467330,6496185,8941055,8369903,5015502,5586105,4288482,3266204,1793212,6083923,6920394,1272048,7913696,1253234,3975372,9038970,7229522,7319061,4729995,9990386,5756942,4622741,8179565,1901840,2060729,6308593,2311767,6058517,9440521,4506286,2667724,2707412,9264328,7481658,7283767,4022613,7292282,7722808,1607543,3303695,9334091,4429382,7483169,2624877,7084777,1376693,3797668,1654510,6480667,4619720,9884094,5862548,9422256,4009429,6273574,8836135,8204696,7987167,1890991,6920944,2501831,7627502,3287765,9907714,8246444,2397872,6005920,6982330,5250473,8604049,6665649,4658172,8910156,2989349,2872344,5909790,5837142,1457168,6535461,2226623,1763137,9385314,1692550,9805267,2558547,7501022,7434143,5598876,5709976,6785263,6020614,1443572,3101684,3374557,4787536,3978530,9441757,1930130,9930648,8580841,9180145,1442749,9766128,9032516,7260009,3941177,6559494,9137985,4546386,3074356,5515518,9012878,2276748,4035247,9025100,6259704,9377487,4794540,5761474,2752593,3987731,8114746,2718948,3247390,3037689,3311660,8790679,5536666,2222091,5232482,8974563,4368682,3214843,8420028,8806335,8848220,7466827,6930969,8109664,5539825,4431991,9777114,1658630,1989456,4565338,4458084,9845504,1885635,9934494,5555755,2949661,1578155,8792465,5856231,1098190,3172134,3951339,2971771,6514724,7918090,8303161,8927734,5148162,3115005,8331726,8686172,9277099,5245941,8956710,9073989,9181930,1564422,7557327,9082504,3478927,5851699,1516220,6011001,3210998,7561996,3128875,3419052,8286682,3075180,4222702,9359085,4364151,5275878,8327606,8856597,5770950,4176971,9744155,7107299,3555694,8808120,1351837,1360076,6263137,8084533,7500198,4953704,5528839,7879226,7829376,8476745,9084976,9013153,9360595,1519927,9272705,2386062,6703552,2987976,2653991,7962310,6720443,7441421,9816116,8835861,1495346,2436462,3964523,5086776,2948287,9331619,3395294,2654541,4939971,5529388,2443054,8942016,4211166,4622741,4996826,3370712,8998596,8414672,6178268,8606521,4673553,8279541,6275634,5673858,3244918,1834274,1526931,7676940,2071578,4389968,8847671,8347793,5627304,3150848,6094223,3139175,7662246,4629882,6958709,6080078,6604812,6250503,8088928,8115158,5547515,6602340,9526214,7144378,6659744,2319869,8054733,1483261,5373657,5053268,2558273,4960433,3183807,8498855,9974731,2374801,8405883,1960617,4945877,2526550,7739700,5407440,6752304,8544998,3976608,6499618,1631164,8728744,3698516,8548431,5066864,5619064,5310623,6882492,6150802,6524063,6251052,3584671,8603775,2213165,7723495,4073150,9552993,9999450,8793975,6491241,4660095,9930786,4196609,8377456,4691268,3305343,4692779,5583221,8125320,4233688,4325836,7907516,4892318,4463714,3417266,1417343,9836441,1187866,2645751,7921936,2998275,2052352,5054229,9570159,9308273,7085052,4329132,6040390,5786056,7763320,5193618,8289703,5839752,2938400,9261032,2333740,8758682,8836135,3190261,2023376,1993301,8853439,8487869,8288879,1314758,9366775,4800720,2819610,1451126,3274719,2042053,9648025,2290206,7490997,1195281,1606033,1245407,3106765,2140518,9124389,8877197,7443206,5344268,1341262,5363906,7709762,3759902,4991333,2916427,3489913,1779754,4042251,5729888,4771057,3584533,4547760,5565505,7738327,7732559,5686904,2558273,2051116,4332153,9457275,9341644,4819946,2643692,7991149,1085830,4004486,4451492,8963714,3540176,4449020,5051483,2061691,2676651,5276153,9197860,7980850,3026428,2856414,8852752,4922805,8302612,1072509,9081542,9056823,8404922,6097930,3939804,4919097,7398712,5407302,6692565,2214401,5561660,7238311,9212554,4992568,6093811,5223144,1899368,7665542,4582092,7409286,9964294,1835372,4815963,3387054,7423294,9401657,1044494,8743713,6644226,8916748,6272750,6561965,4788223,4657897,3687393,6183486,3993774,6385223,8807159,2952682,2643692,7253280,2452804,5163818,3558853,6846511,3127502,1926834,8465347,4805801,2904479,2171691,8575622,3015853,8413299,9511245,3628479,4821868,1020324,9179046,5233032,4244400,3795471,2762893,2857376,7661010,6360778,4951644,1309265,8922927,7212219,2014862,9049407,5376403,5611511,2232940,5183456,2757949,4638946,6997848,7474517,6429168,1501800,5802124,8222274,9924880,8694000,3835708,8349304,5278213,1097091,5408126,6541915,8095245,3619415,6916961,2786102,4845352,7466827,3578079,8144683,4338470,1635971,9640609,3117614,1855010,5728103,6300903,7430709,1900192,3673660,6037643,5595443,7049072,6462951,3585632,8084533,1853363,8477294,2266586,1465270,1276580,2511856,2895828,4337097,3626968,7087249,8985000,9414840,7458724,1141174,7457214,1602325,4407272,7694519,5595306,3399688,8429092,5586380,2441543,4488845,6415573,9871047,2366287,5840713,7647552,8970306,3026016,8186569,5060821,9175888,2428634,4199768,7791061,9595565,2325363,2228820,2966415,5135116,7646453,5928054,6217681,2612930,8201812,4628372,4872955,3597305,5363082,6790893,7307388,2064025,6947860,9389984,2415451,4464401,8022598,7566390,6675811,3299850,6845413,9396438,2775527,1796508,1665359,7119934,1264907,2772644,8598693,4670669,2209182,5293182,1299514,7853683,7307525,3205093,1643661,5012481,3448440,2148208,6146820,6530380,5167251,4132614,4331054,9009719,4979522,3280487,7764144,6472427,9053253,4821456,3984985,4425674,7194503,2939361,6038879,6136795,9609985,1561401,3836807,7960662,8419204,4684951,6060989,9063690,5382308,6334548,5833572,9388198,8814849,5744033,4868148,1200775,6155197,5857192,1321624,9067535,4156234,2739959,4067108,3602661,8168441,4998748,5604919,4829833,5483520,9798538,3330474,2504852,4206909,1574035,1379440,9239746,3629440,8028366,1766845,8773513,1564834,9511657,7040695,7232955,4622467,6376022,7167312,3728591,2885940,4396835,8868270,7126800,9963195,6857360,8126831,5344406,3878555,7389236,9083740,5007949,4776962,9162017,8039764,2822631,7905044,1516357,9784667,6493438,7841873,9634292,3971252,2542480,3446517,4340805,4752929,6867660,3490188,3628890,9403579,5384231,3443496,9004089,6138854,1594360,7386215,9240707,3856857,5428863,2509521,9643905,7018722,9202941,5178375,4411254,7385116,1032135,5022506,3187652,5829727,7550186,7026824,2408035,9947540,9273666,7087936,3519851,2677337,8457244,2005661,4680969,7654968,2781570,4380081,5025390,3519851,9721084,1380264,2092041,1889892,2931121,7856018,3507766,5226303,4501617,8759506,6521591,6303924,5419250,4346023,2481506,6510330,3082870,7123367,4848236,7687789,8214035,6017868,4840545,8739181,4010116,7725280,6304473,6717834,6878509,8717071,7901062,6616348,4601318,7868927,3206878,3577255,2269744,3181472,1819305,4741119,5834259,1561264,7062255,9452194,2613754,3131347,7384979,6041351,2607711,7039733,7047561,2902420,1954162,9234252,9188522,8082885,4378570,3174057,3865371,2107696,6976425,7944458,9164901,7252593,5173294,8744537,1974624,9989013,4207321,5217926,2511032,1816970,1975036,7593170,5195953,3204681,2588897,5102981,1978607,2856002,7484954,7652359,6692153,1021011,7428237,5203643,2542892,8071487,3258789,8846160,9323516,7058685,6720581,9020843,3444595,1471038,4219131,5868041,4378570,3913986,5849914,1166580,6608795,5926269,9542007,7833496,7679412,9654891,2661956,2453765,9437225,8606246,1918182,2806838,9062179,7191619,1914337,6861343,9976791,2286773,4190429,2203964,6232238,7523681,6100128,7373992,6461715,7533432,4364425,3069549,5995483,3859741,9647476,2696838,9232879,3760177,9996704,3229263,1862838,5615081,5493682,2845703,2029144,3163070,6955413,6317382,9031143,8281463,4034286,6611404,5656692,6529281,2557037,7679138,3738891,7174179,1447692,4899871,1031311,2919723,9078796,6147369,9996154,1052597,5393844,9947265,8596496,4228469,3644683,5696243,9690322,3616119,1088714,2409408,9116287,6616210,8487594,6966949,9066986,8876098,1753799,3326492,2843505,4818298,3586044,6671554,9584304,9400833,3439788,9963745,9062454,5329025,4675338,4869110,9144851,4437484,6226333,2525177,6007293,2460083,9634979,2118820,6699844,6908035,2795578,3744247,9154464,7273742,2250106,4507247,1230575,4279830,6382064,2348434,8891067,3391723,4348358,9550247,3103195,8312500,1096817,1399078,1557693,9679061,5311035,8970581,3799728,4678497,3626144,2506088,5866256,6802154,2960510,8350540,3022857,9459060,2306274,6918197,1693374,6662902,2821807,9658737,3177215,7515991,7572296,6487258,7247650,3706619,2758773,1652862,7224166,6737197,6782653,9508499,6613464,6106307,7986755,3156753,1912689,1157928,3418365,2435089,6668395,2821121,4458084,6213150,7384841,4956588,5656692,9468399,7376190,1529541,7625167,8110488,4155548,4326660,9321182,7022293,2455001,2438247,6575973,6285659,7469299,7221694,2205200,8063247,1420089,6965988,1546844,1101211,1029525,1977233,7771560,1325469,1002197,7301620,8807983,6497558,9104614,4806625,6226608,6400192,4939971,1838119,5926544,5520736,1008239,7172256,2969299,1701065,2148345,9481033,6402252,3724060,5954696,3031097,1415832,4303314,2261367,1832077,2679534,9446289,6289642,5956481,6198181,4659408,2550033,5247451,2534515,3963287,5095428,2133926,2739273,8188217,3215667,3772262,5836044,9515914,7171432,1232360,3201110,3740264,8057205,2948013,2683380,3211685,3389938,5149536,5809814,2937438,1515121,2497161,1916946,9803070,3426055,2634490,2554565,6387695,1088165,3881027,9005325,4338607,8863464,7781997,8261825,4775314,5127700,7733795,7307662,2691619,7675155,7405029,3044555,5825195,7004577,1170974,5709426,6961456,8078491,6280166,4126296,6142974,3652511,6972854,8634674,3751251,3765670,8268692,6040664,6930145,7486328,5643508,7432495,6320541,5509338,5313095,5205291,1573486,7694519,9343841,2139007,5612060,4143325,1307479,9871459,7109771,6907073,8700454,8613937,1154495,8917709,7844482,8447906,4566436,7239135,8489517,6052200,3839691,8229141,2835678,4199905,4175323,8708282,8194808,4871032,1574859,5727005,5008087,8324310,1463348,2027908,8441726,9971160,4810195,5793334,3275268,9397537,4217071,9775192,7305740,5373931,9941085,2398422,1982727,9201156,4322540,4933517,4495849,5232894,6585449,7331008,2030380,7920013,2480133,3811264,4413452,9220382,1735946,9804443,7867004,1716995,4794265,9334091,9085937,6289505,6787734,2436599,6362701,1682113,9238510,2713180,9974731,8810867,5440124,1605346,7554306,2156448,8995162,1488616,5659713,9083602,1474746,8179290,3266479,6432189,3670639,3946395,9397125,2223464,2407348,7623107,5608078,1825759,9384216,8912216,1553573,3422897,2014999,9478012,3343109,1127990,4734252,2919174,6914352,5589126,6739257,9217086,7136825,6427658,1636795,4750732,8867584,3355194,6962417,7476028,3676681,3311248,7041381,5358688,6461715,2466674,1160812,5658477,7668701,3436492,1520339,1155868,7340484,5543807,9931472,4916351,4708572,9482269,6733489,3684921,1550277,1217529,7894882,8505722,1027053,1472686,7768676,7660186,6224548,1642013,7472045,9516738,9112304,7475891,9356063,7386627,1142272,2380706,6537246,8979507,5205017,6678558,9957977,7552108,7161132,8668594,6944839,1344284,2669509,6835388,1734024,1395782,1526519,2048233,4932006,8337219,7240371,8092910,5380798,6250778,3054855,9382293,7395965,8190826,7143417,6188568,4846725,3462585,3192459,4239730,2046173,3249038,7091369,8025619,6921768,7681472,3949142,9657363,7432083,9947952,7155502,5621810,9702407,4531005,9706253,6277420,4844802,7171432,7510910,7433593,5931900,8650329,8901092,5858154,4095260,4981582,3058837,1055618,3214157,8112823,8584686,2161529,9165863,8723663,3921676,9294815,7104553,2218933,4856338,6214111,9738388,4507385,9814605,5619476,3073944,6663589,6171264,3944747,7595642,2061828,1291549,3983886,9349472,8080001,1524597,7195190,5899627,8965774,1866134,8026992,2628311,2957077,8510116,9107772,6343338,8253860,4008056,8646896,4668334,3932388,3253845,5886444,5178100,2396499,2014038,2950347,5752685,4460418,2222091,3933761,6116195,6655349,5753921,7576416,4029617,9855392,7905731,3363021,5107925,9814193,8291625,3396118,7727340,8709106,7378662,2883880,9994369,1283721,6381515,9586502,9243728,1684173,5730987,8065444,5034179,1582687,1839355,8079864,3111434,6681854,4377883,6971893,4306335,6193237,1788269,6387695,2837463,4385025,5243469,3174743,4987213,4790969,8780242,4800720,2618560,4176147,4818984,7139160,2503341,3850814,9791671,2962158,9929962,5429962,5096252,3986495,4558197,7627365,9094863,9817352,4991607,7182281,5376953,5630050,8035095,2510208,6003860,2938125,7106887,3171859,1955535,7287338,1773712,7754669,7495941,8222000,4877899,7259323,4678359,1366531,4223800,3587005,3707168,2965866,2295425,1219451,7376739,3728454,9970886,6685424,5303894,2315887,9703781,2909561,2175811,2323165,7140121,5034454,7728713,5091583,6640106,2812194,1678405,8201538,2672393,4156784,8321426,5984634,2550033,2953506,6023086,1902389,1477493,4717636,4315399,2133514,6376846,5195816,4818298,9213790,2461318,1505645,7708389,3072433,4026733,2905441,4950271,9309646,2427673,3788604,5009185,8055969,6708496,2996353,3267303,8261962,7856567,5043243,5857742,4757736,8148254,6347595,3138214,7927566,9555328,1061660,9522094,7344879,3679702,9596115,2885391,5208862,1187316,2430694,6269180,7927566,8208404,1305557,1094345,3691787,5673171,5388214,4610794,3382659,1052047,6508132,9796203,1656845,1468566,2053451,3425094,7553344,4655014,8623550,3527130,1465820,9716827,3031921,7952148,3823211,9178497,9751296,2261642,4323776,9275726,9396713,8665298,9065475,3965347,4339019,9221206,8415771,3620239,6043273,4017669,5966918,7879364,1225357,1557693,1418029,5619750,3420288,4062301,4727935,8520965,4057769,9912384,1385345,3190261,1635009,5948928,9135787,8316482,4085784,7848876,2012527,4822143,2933731,4295349,4014236,6482864,3328826,7162643,2271255,2981796,9557113,9432693,9047897,6868209,5119186,8063522,3421249,8389816,6970932,1526794,9981323,6666061,8019989,2235137,9397674,2172653,4471405,9574966,1193222,2005249,3118026,1768218,3572723,3890502,7165664,9276138,4645675,1415008,1691864,3969055,9891784,3438964,9327087,8777359,2208221,2164550,3255218,9043640,4385986,8827209,9126037,7295166,6357345,1478454,2973831,9655166,1058364,2829772,8735198,6611129,8250564,6625549,2459808,6358993,6145446,6513763,8809906,3443222,1175506,7884445,5938491,3910003,2754791,6642028,6344024,7692321,7374542,4383651,1791976,6447158,1875610,7949401,4899871,5562210,9243316,1815460,1476806,2551406,6766448,3296005,1213958,2557037,9905792,9026611,9817352,3179687,7716079,5693908,2177871,2351318,7162918,6483001,7673095,6473388,7181182,7209884,9192642,2536437,6816848,3608978,9982421,6441802,3296966,8742614,5900588,7242019,3370437,5003005,1180038,9520996,3764846,3674896,3289688,2631469,9101318,2526824,8989807,5007400,7113479,5401260,7174453,3273345,5511123,2270706,1593536,6365859,5335891,1730178,7051544,7387725,6149566,5393157,4172851,1414047,7900924,7161407,4330230,4966888,5813796,5835769,2828125,9380371,6140365,6038192,7937316,2771408,5123031,4912918,4870758,1837982,4010116,2574890,6298431,3201385,2466812,6776748,3491561,2513092,7227188,6759307,5692810,9042953,7330047,3757431,8803588,5969116,6781829,1129501,8984313,9088272,2991958,5577041,1259963,3164169,1823287,5426803,6726211,7632995,2600433,4440368,5447265,5885894,7922348,5123031,7642471,7846130,9620559,1999069,5252807,7059509,5707778,4822280,9482543,3017227,8660079,8191787,6408432,2930847,9877914,8539230,9252243,2676239,4667510,2959274,3407928,5126190,6587783,7850250,7819076,3590988,2506912,4833679,3799865,6584762,2210281,4922119,8892715,4637023,7906829,3403945,1856384,9367874,3473297,7413269,3380325,2544815,4784790,7654968,9615203,6342239,9971298,4251541,2117309,4519607,7946517,3183120,1297866,6738845,1051910,3286804,8972640,3738891,2159606,7285964,5103530,6586410,7077911,4817749,6329193,7722259,1603561,5926681,9375427,3019973,4063812,9994644,6939620,2578460,4693328,6574325,7145065,7464492,9687576,1096542,1156280,6125946,6278930,8918533,8050064,3693298,2677200,1683486,6537109,2888824,4219543,1459091,8626159,3761962,7572845,9624130,3825820,3968780,9332580,1971603,1976409,3816619,2862869,9997940,2307785,6790069,4718322,6846374,8813613,1777969,3496368,4872543,9539810,7721435,7458587,2303665,3877731,4899459,2769210,5956069,4456573,4572067,7691223,1483673,7730087,9200744,7586166,8124221,3849990,6962142,1059600,8411376,1920242,4776962,5097625,6823440,6225646,9569747,6536422,7835830,9529373,6981643,4710769,5347152,2032440,9251419,6622802,7945831,8088516,5485855,2476974,2988937,5269012,3038101,7923171,9959075,7870986,2211242,2853256,9069732,7463119,3007064,6093948,3587417,7560760,3138900,7839126,1839767,7027923,5026901,8167617,6376571,7295303,8993240,9487762,3256179,5992187,1379440,4252777,2920959,7083404,4800170,3793411,8635635,1105880,1255706,5607391,8953414,8598556,2320556,7952972,5181121,5320098,5126464,5088424,8310302,2346237,9359497,9002166,7384567,9643218,4989135,3976333,5771224,3207702,6949234,5828079,1304595,2371093,1488204,6173599,6773727,8357406,6408294,9555328,4717910,9692520,1911865,6779769,5003417,3555969,6274536,2307785,9147460,4669708,8062423,2040130,4858810,8818420,2114013,7345428,1764511,8593612,3003219,2669921,6790618,1456893,4204849,9576339,4165985,6714675,8679168,5553833,9517425,4499008,9095275,5443008,2026672,2348159,7412719,4820083,2114974,7480285,6037643,2184051,8626983,2354614,6275634,6289505,8980880,7612533,9296875,2471069,1254608,5995071,1334533,9300170,7675155,9326675,8334060,1420776,9482681,6162338,3772125,9906066,7634506,9190582,6864776,4980621,4321441,2985504,1883026,7451583,1762176,2202453,6793502,6691879,2246124,2810958,2945541,5521011,6893066,9458099,9021118,3825271,6098617,2557449,1967208,7262207,4133438,1194869,4129455,7893096,7865768,4447372,3305892,5086364,4075759,3208389,6939208,4536224,8330490,7111282,5166290,9741546,2888275,8646896,8943939,6785263,8600479,9068771,9970336,1762588,9280670,1178115,1618530,3697692,9509460,6584213,6604125,3295181,7342956,8532638,7602783,2369445,9894943,3896545,5538314,9294677,8260726,6422164,2759735,1321487,3750839,8825698,9824768,3100723,1905136,5832061,8110076,3261810,3254257,4751968,2966964,2386199,6297744,8689193,9639648,4221878,6668258,6972305,7666915,9481719,7949813,2905578,2983993,4068893,1119064,5430648,8445571,1074844,9077972,5795669,9986267,2391555,9248260,9822845,8139328,2283752,1693374,2869735,4131240,6762603,8740417,8077941,2270980,2107284,3566955,7001831,5853759,8375259,3725296,9212966,6295822,7248474,3069274,3972213,5722198,6054946,5055191,8563949,9722595,9314178,1884674,9386138,3497467,6645874,9457138,1390701,1110000,9389160,2602355,2966140,1065917,1773025,4560668,8858108,9937103,9985168,4180130,1220413,3248764,1978744,8799468,8390914,3350250,1365570,5284805,7485504,8485122,2234451,2189544,2404602,6783477,5243881,6506759,1344696,7390609,4827224,8981018,9410720,7455017,4858947,2450195,3420425,7191207,9621932,8185333,4497222,9738250,4422927,8697296,8542800,1031723,7697265,4978424,7184341,8407806,1947021,6649032,3291748,8159240,5358276,1976959,1654510,5760513,1439041,4238906,4916351,4981994,6522415,5391647,4358245,9611770,1479003,5523620,4626174,8002960,7481796,3053894,8994476,3166503,5167526,6147781,4260742,2627899,4039230,4318557,6865875,3765258,6450592,5683197,2331268,5849777,2020767,6841018,1609466,3505157,6818222,9844543,1439590,1806671,4161727,7229934,9302505,7736267,8379104,4578521,1070449,2215637,9368972,1574035,7941986,9432556,1309539,1029113,2759872,6681716,6356933,2844879,7301071,7437988,8677932,7377288,9637863,6880569,6660156,3174057,5158874,5587478,8644012,8555709,2346786,7618026,9019470,7005401,9906204,1703262,4032501,7838989,8333786,1762863,3143569,9122741,3526306,2465850,5283157,4307983,3519302,7056213,3846557,7551559,6949920,1160125,7774307,5189910,6339355,2794616,7558563,6337158,4785751,8296295,8522476,1073608,4164199,9388610,6213287,8196319,8426071,9106262,8256332,2998275,9091156,4796463,4509582,6045196,5527465,9914581,7866455,6419692,9112030,1833175,4547760,9400970,2865753,2384552,8228454,8048828,3656906,7353118,2841583,6660018,9567001,7639175,4403564,3567642,6511566,7309448,8705261,7249710,5712310,2257522,1211624,2218246,7110458,4687561,3014617,1655746,4319107,5145690,5181259,4268157,7204940,2313140,8344085,1324645,8695922,1282760,1873413,4350143,6906112,2536437,9478836,5441497,9173278,8342300,8581115,2676376,3102645,5790725,3300399,2581344,1209014,7187911,4402877,6129516,9254028,8025482,7049758,7237350,6868759,6244735,7693283,1226455,6558395,6015396,6962966,5222869,9681259,5745407,3885696,6958709,6495498,1543685,9283279,5948654,9869125,5851013,2692443,9506988,8744674,4460968,4648147,3575607,1954162,4647460,8678619,3831451,7477539,7618713,7850387,9041580,9737701,4016433,4211715,7136001,1026779,5677841,1975311,8964263,7656478,5381347,7785430,8208404,4928024,3792312,2912307,4417709,7512557,4328857,9718750,5635406,5338775,7167449,1241424,3586044,4579208,2104400,1230850,8892166,5830688,9494354,6495361,4289169,8081100,6983703,6889770,2306961,5557952,7257400,4796051,2386474,3050186,7518600,3436630,6901718,7799987,3918792,9866241,8053634,5555618,7658538,3985122,6106307,4879959,3976608,9416625,6934402,4309494,6746124,1595596,5348388,2456649,5898254,4907012,1169189,4647735,5388626,6224136,9518524,2193664,2929748,9683593,4296173,3884460,1203933,4047058,8309890,5801712,9778625,5489837,8029602,6043823,1441375,1160125,5433120,4456710,7173080,1354446,1911590,3964248,7478637,7652221,1706008,7592483,2295013,5852111,9839462,9779861,7191894,7055389,4018493,3069549,7088897,2740234,8468368,7775405,2202453,1168365,6172912,1716995,6445648,1971328,6488357,9616577,6997436,4256210,4597885,4251403,6260665,4079055,5777130,4956176,1926696,4624389,3939117,7569137,8367843,3940353,6426834,5414031,2072952,1567993,3523422,5414718,2348022,6912017,1646820,1932601,7998428,9695816,9699523,1423660,1212448,3342422,7540847,6507171,9365539,3629714,2051803,7540298,3961776,9458236,1759292,7292007,5433807,1079238,6490966,9811035,2019119,3625869,5026763,8080276,6429992,5289886,5218612,9552169,2538909,9989013,8544448,8159515,6794601,4868148,7567077,4892868,5590774,5479263,8266906,3542373,2303253,3980590,2714279,2693130,7217575,1203659,2055099,9571945,6062225,1927520,1273422,6836624,1369415,1206130,3703598,5902236,9379959,3092895,3758117,9898788,7712097,9604354,1842376,1853500,4512878,3268402,3922088,6190216,8310577,5100921,7714981,6142974,6286895,6352264,8973876,8173522,9187973,8870880,2830322,8990081,9592819,8423873,4667098,3257827,1758468,2822631,2489883,3597442,8758407,3192733,9264739,3965072,4136734,4235610,1190887,2005386,6793365,8823089,9379272,2474227,2320968,8770904,6902542,9323104,5511398,8132461,2687774,9538986,7251495,8858795,2219345,1334396,3525619,9166824,3521362,6780456,2744628,6460342,3387741,4477172,2120056,1148727,2329895,1354995,9301132,2203689,1208877,8199890,9995468,3802337,5022644,2997863,2789672,5896057,8815811,6691329,1890853,3052383,8181900,4440643,3005828,5410736,9325714,7986343,2078857,7098373,9154190,1204071,8104995,1948257,1367492,1446594,4737823,6863677,6014160,5766830,8911804,3673385,7483993,9615615,1196792,2820159,5404418,2107421,2103164,4727249,9409347,8449142,6057556,8186843,2250930,2623092,2266860,3613098,8221176,3921401,1190063,1504409,3352722,9422119,7835418,6958709,2368209,4004486,4603790,8584686,4846313,5992187,1894561,9653381,9572631,3024642,3194107,7834320,4545974,6243225,5866668,5358825,6606872,5392471,1362960,9954544,4158294,7925231,6069641,9396301,2946640,7708389,5514968,6014709,1372299,3421661,5150497,4008468,5298126,2243103,7428649,8902191,7824295,2916702,9393417,3995971,7999801,1792938,2502792,8146469,2937164,6939071,5904022,8729019,9300720,4910720,6877136,9117935,3636032,9279434,1667831,2534515,8511627,9510559,1428466,3602523,6937561,3283370,7483444,3457229,2033676,2848999,9641845,6750656,3414657,9519485,2771545,7396926,5259674,8880355,3356979,7401870,7537002,7822784,7258224,7619949,1351837,3986770,5388900,2783355,5885345,7711685,7533843,8645797,5894409,7084091,2023925,9585128,3241348,5181808,8486633,7509124,4420455,2102203,7391571,6408020,4552703,5873672,2610733,5396316,5814620,7840362,9709548,5589263,4772842,6615524,1190475,4657211,4590332,7197799,6405685,2400756,4575637,7341857,1358840,9191680,5042007,5779602,2113876,8623138,6945663,8385284,6030639,1211624,8272674,3876358,5544769,8496246,3642486,2145874,6711380,2377685,7096176,7819900,7232131,8041687,5540786,4132888,1181274,3310287,6814514,8714462,1154083,6763565,8845474,6383575,1052734,4477722,8870193,9541183,5229187,8721603,5181121,6255996,2205200,6456222,2373291,1638992,8686996,9980773,8556671,2596588,8093048,3568054,8504623,7560211,8314971,7435653,9206100,4283401,6929321,7892547,6791992,1301025,7579025,2009506,7302032,6144348,1744049,4652954,4263351,2906402,5619476,5228500,9547088,4249618,3318664,9977890,4474014,5451385,3122970,4170928,6637084,5580062,3993637,6038879,2408584,4396011,7067474,1791290,3602249,5070022,4352478,5560974,5258575,3315643,7344192,6619781,4021240,2025161,2780471,2710296,7075027,5007125,6253387,7836242,2111541,1915847,1898132,8355621,7295303,5968704,1875610,7719787,9693756,3544433,4869796,7704544,1145706,3255493,6317245,3472610,1031860,7589187,1587219,2316024,4919235,4710357,8832290,8419067,9547775,1521026,7727890,1486557,8126968,6568695,9818313,4580718,7411621,1897857,3689453,8011749,5526229,1439590,8686996,6624313,9006011,1031448,7397201,7323867,1022659,7661285,8611053,3187515,2266174,7030807,1988632,5002456,1447555,3030685,2144638,9576477,4895065,6220428,6371353,4662017,9210083,5910064,9719985,6841293,2452667,9932708,9657226,7213043,4825027,6706710,9017822,1225082,2321380,5676330,3470275,4499008,9314453,1728942,7214279,5987243,5545181,1679092,4130966,3308502,1485870,3416030,4101303,8604049,4545288,2805877,1714660,7760848,5083892,8944076,8083297,4341766,6709320,7851348,6984664,5069198,3818130,8206207,6047531,6206283,2856552,1208740,7201782,8676147,8264846,4168457,4111053,4267471,6577621,1911727,1806671,5765869,4645263,9599685,4241104,9358261,2449234,8053222,9979949,7151107,1476669,2177322,6751754,1148864,1124420,7578201,5074142,1534347,3101135,8968246,2674316,5595993,3296829,1451263,9923645,3144943,9086761,5283157,1004257,4766937,7540847,3200012,2027496,3750564,3505432,5908416,9821609,3038925,8026718,5832611,6608383,9044326,6085433,6710281,7287475,6673751,9109970,6131713,8546234,6405960,5238250,1616333,1514984,6766036,2796127,5320922,7186264,8038940,6961318,2970397,8315383,1568405,8081375,4109130,7023391,7482070,1615234,2262878,9819137,4189880,1166305,1107666,7260147,2496063,1575958,6237045,1971740,8670928,6546585,3623809,8240676,3325531,5762435,4368408,4905502,4432128,6977523,5828079,7759201,8335571,8038803,2721008,9185089,3098388,5313919,6298019,5243469,1023483,4491729,7177612,1928619,5698440,4224899,1935623,4813766,4405349,8582626,1045181,9804031,9238922,2783630,3260299,8215820,3778030,2175399,7035339,5900039,7653457,9932296,8077117,6630218,7855743,2438110,8619705,4472229,5127288,2822357,5519500,7355453,5281784,1621139,9760635,1564010,5795806,1028564,1467605,5366516,5515106,4708984,8016555,4503128,6819732,4639083,2340744,7748764,2092453,2947463,7022430,6272064,3833236,3221023,2265899,3006378,2264389,9246887,5345092,3754959,8768981,1659179,9620010,1245819,6007843,2458297,6713989,5858016,8057067,8871841,4948623,1234832,6412139,5526779,6626510,4506011,5199249,7400085,1258590,1335357,2441131,9518112,9328323,7513244,3718154,2872482,8686172,9312942,6069915,4521530,3169250,7329635,2481369,9345626,2539459,6019790,7796005,9426788,2333190,2661682,3400787,6518432,2717163,6953353,8526733,1576919,1944000,9968826,4507247,3821975,3500900,5690200,9840835,7295028,8545684,1834411,5398788,4384613,5723571,6194335,7624618,2287048,1958282,6211776,7065826,3871688,7312057,9001205,7084503,8918945,8507644,6545211,6089553,6200378,6205596,5275878,5133193,3368927,6631866,2766326,1216979,2129257,6648345,5746505,3151260,1655197,6860656,8165008,3309600,9723968,1857208,5513595,5124679,9537612,9171768,9135513,3667617,5696105,5065490,1733062,1155456,7295852,8720642,4797424,8729431,8618469,2940185,1174819,8349166,5381072,4946838,9492019,6145721,8015182,2375488,8656646,7076538,8943801,5053405,9153228,6228530,9325851,8660079,5352508,6609756,8235595,3863174,6553588,5775894,5746368,7021057,6976562,6134460,3887207,3048950,2425750,9270370,2942520,1540664,3841339,4136734,4060379,6738983,2458023,8454223,6641342,3450637,7791198,2164138,2475189,2497436,5165878,1277404,9094314,4799072,8011611,2963394,9312530,8679718,6637908,5223281,1418579,9493942,6712203,2990997,8991867,8163360,4156784,2006210,2811096,4720794,8685211,6300903,6822616,2452804,7695617,2647125,7638488,7735992,9739898,5805557,2532318,6160552,5288925,7921936,3402160,8034545,2010192,3913024,7668701,8862503,8278717,8186294,5577865,2893081,5138687,9538436,7876892,3328140,5435317,4574264,1331100,9287811,6335372,2491119,5052169,8125869,5954284,6572814,9105850,7187225,7311096,9235763,4366760,3604034,9326538,5971450,2090805,3220886,7086151,2029556,9172729,6246246,1085006,8185333,1558105,7721298,1673873,8433761,5778503,2401443,1425445,3955734,7078598,6142837,9639099,8200164,1102584,2389770,4702804,7423568,6611816,5854034,6531890,4533752,5199249,7982772,7802185,7578750,3470687,5305953,2196548,8727920,3662261,1259277,1384796,4084274);
+pk
+DROP VIEW v1;
+DROP TABLE t1;
End of 5.5 tests
#
# Bug#12977203: SERVER CRASH ON A DERIVED TABLE WITH QUERY CACHE ENABLED
diff --git a/mysql-test/main/query_cache.test b/mysql-test/main/query_cache.test
index 3bf905d624c..118ebbf1703 100644
--- a/mysql-test/main/query_cache.test
+++ b/mysql-test/main/query_cache.test
@@ -1719,6 +1719,23 @@ drop table t1;
set GLOBAL query_cache_size=1355776;
SET GLOBAL userstat=@save_userstat;
+--echo #
+--echo # MDEV-5924: MariaDB could crash after changing the query_cache size
+--echo #
+
+SET GLOBAL query_cache_size= 50*1024;
+SET GLOBAL query_cache_type= 1;
+SET query_cache_type= 1;
+
+CREATE TABLE t1 (pk INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+
+SELECT * FROM v1 WHERE pk IN (5178922,5178924,6911605,6584899,1754348,7735031,9583206,8377182,6309967,3110885,7197937,5582397,9811721,8310302,7001831,3687942,8454635,8743988,9524703,3313583,1376007,5276565,7238861,5307189,2242691,2052764,8160476,7668014,5891525,9070968,1989181,3014068,5365005,2974655,6877822,7813446,6188705,1028564,6426696,6098205,7231857,2749710,4996963,9879425,2995803,8160614,1934799,1981216,3673522,2135299,4803054,8515609,1825485,5805694,8211425,3712249,8013259,3496368,4339706,2326187,3236816,8158416,5749801,6339492,2517486,1769729,2576400,8177368,5471847,4670669,5694046,5155990,1219314,1304321,7951736,2381942,1467330,3329376,6069503,3821151,8118179,4575775,5291671,4757186,6241302,9809112,5388351,3356292,5753921,8776535,7101943,8558868,6655212,5498901,1629516,8016143,1156005,1280700,9236450,8289703,4549957,5404968,3594833,3034667,3167602,7983322,3939941,8382949,9258422,6927947,9639236,3246566,3144943,5516067,5266540,3760726,6491516,9515090,7776229,1582824,4031951,3336517,5871612,4268432,2600433,6188018,6158355,6442214,7808502,7692871,9180969,3982238,9212692,9944381,3932525,5937118,6315460,2464477,1933151,3393646,4244674,7036026,1470764,3015029,2453765,9876129,2097534,3467391,4287658,8120651,4975540,4454101,7758102,6087905,2167022,7575454,5370086,8289703,7460235,8734512,7346801,6660293,5826843,4305511,8093597,8970031,9104476,1784973,9245925,6893890,4996414,3144393,1145568,2702056,4984878,5602859,7088073,2044113,5248275,6037094,2185287,1791564,3180374,8750991,9187011,6411453,9600372,4819671,3105667,2837051,1252548,3729003,7986618,8305633,5684432,4528808,8670104,4132202,2101516,5218475,6885513,4886413,1288803,9584167,6524475,3943649,6195846,4204986,5435592,8877334,9276275,8848358,3583435,6662216,7178298,1973526,5917205,9156387,8877334,4559432,2792144,9831634,8846710,6979858,5287277,2220718,9358123,4140029,1263122,8049789,9508361,3597030,8504348,4525924,9062866,1880691,9788375,4746612,7711822,9735366,9227523,9701721,2832519,4498870,3725021,4836151,2351181,7339935,9890686,7641098,1797607,1571838,3258377,6244186,5147476,6760543,9151580,2465576,2545776,6846237,4037582,8310440,2503616,1998245,1716445,2364913,4665039,8420440,1187728,1065917,1734710,5826705,8538681,8311950,4662017,7804519,7696853,7385116,8674362,2787612,2393341,1652313,2254364,3852737,4177108,7013641,8654037,9062728,7826629,2569396,1039138,2572692,9001892,3470550,4859359,5218887,6479568,1424621,3535644,7808639,7817291,8825149,6060302,2830047,7787765,5971313,9603256,1800491,3429214,9350021,8716796,1972564,6054946,6445510,9234802,5616729,6064559,2048233,9458511,1597244,3902862,2530120,5723846,3463821,9008346,3055130,2941696,8774337,3095367,2195037,6208480,9869262,3615295,9916641,1078002,1815597,7737228,1412261,6588607,9740173,6696411,7740386,1641326,9269546,3848754,7745193,6819458,5297164,1280975,1224395,5247589,7793533,5314743,8814025,2579010,7882659,6753128,9558349,8710067,7898727,4209106,2634902,7311233,1644897,8363449,6201339,1770828,3572174,5493408,8835449,5644332,5096115,7116088,1534484,3204544,1772064,2091903,6744476,9183166,5546005,1030075,7387725,1300888,5799789,7340209,7356552,7677627,9410995,5775894,9442581,5718353,6544937,9809524,7171569,4565475,1397293,6687759,1509353,3715682,8607208,3506118,3910827,1890167,1559341,4150329,9679336,9756927,1292373,3445419,2105361,6594238,4234237,8359466,7352432,1492462,9482818,1601226,8561614,4186584,5849365,1460189,9139495,3113357,8384460,7229660,8701553,7786254,4606399,2057708,1638992,1083221,8147293,9569198,4776550,2539871,8040039,7104141,8090713,7242568,2361480,6913940,7958053,1414596,3451461,9160644,7901473,8289703,5428588,3063232,2302291,5366378,8216918,8033447,8048965,8636322,7807952,7146026,6589569,2882644,1971328,7786392,5357864,4637985,2137222,9819961,9039932,8900680,1666732,8126968,1652999,7199035,8229003,7845581,8902328,8100051,9506164,8168579,8786560,4753890,6941268,5035552,2919860,9570983,4751968,4566574,7540023,1621963,7924270,7578750,6669494,5857192,6409805,2030792,4401779,5737991,8241088,4739746,2776901,7373718,8786697,9211593,6219741,1758331,3863586,6932754,5006164,8200302,5925033,1962127,2728149,8540191,9044326,6171264,4224899,9248672,5911026,6974502,1950317,4998611,2561569,2891845,3243957,8806335,8058303,8791778,1475708,3335281,7841186,9153228,5532135,5453994,5966369,4194824,3612686,8645385,9952621,1211349,2806289,4358520,7454330,5964035,2415313,8897384,6479431,1467330,6496185,8941055,8369903,5015502,5586105,4288482,3266204,1793212,6083923,6920394,1272048,7913696,1253234,3975372,9038970,7229522,7319061,4729995,9990386,5756942,4622741,8179565,1901840,2060729,6308593,2311767,6058517,9440521,4506286,2667724,2707412,9264328,7481658,7283767,4022613,7292282,7722808,1607543,3303695,9334091,4429382,7483169,2624877,7084777,1376693,3797668,1654510,6480667,4619720,9884094,5862548,9422256,4009429,6273574,8836135,8204696,7987167,1890991,6920944,2501831,7627502,3287765,9907714,8246444,2397872,6005920,6982330,5250473,8604049,6665649,4658172,8910156,2989349,2872344,5909790,5837142,1457168,6535461,2226623,1763137,9385314,1692550,9805267,2558547,7501022,7434143,5598876,5709976,6785263,6020614,1443572,3101684,3374557,4787536,3978530,9441757,1930130,9930648,8580841,9180145,1442749,9766128,9032516,7260009,3941177,6559494,9137985,4546386,3074356,5515518,9012878,2276748,4035247,9025100,6259704,9377487,4794540,5761474,2752593,3987731,8114746,2718948,3247390,3037689,3311660,8790679,5536666,2222091,5232482,8974563,4368682,3214843,8420028,8806335,8848220,7466827,6930969,8109664,5539825,4431991,9777114,1658630,1989456,4565338,4458084,9845504,1885635,9934494,5555755,2949661,1578155,8792465,5856231,1098190,3172134,3951339,2971771,6514724,7918090,8303161,8927734,5148162,3115005,8331726,8686172,9277099,5245941,8956710,9073989,9181930,1564422,7557327,9082504,3478927,5851699,1516220,6011001,3210998,7561996,3128875,3419052,8286682,3075180,4222702,9359085,4364151,5275878,8327606,8856597,5770950,4176971,9744155,7107299,3555694,8808120,1351837,1360076,6263137,8084533,7500198,4953704,5528839,7879226,7829376,8476745,9084976,9013153,9360595,1519927,9272705,2386062,6703552,2987976,2653991,7962310,6720443,7441421,9816116,8835861,1495346,2436462,3964523,5086776,2948287,9331619,3395294,2654541,4939971,5529388,2443054,8942016,4211166,4622741,4996826,3370712,8998596,8414672,6178268,8606521,4673553,8279541,6275634,5673858,3244918,1834274,1526931,7676940,2071578,4389968,8847671,8347793,5627304,3150848,6094223,3139175,7662246,4629882,6958709,6080078,6604812,6250503,8088928,8115158,5547515,6602340,9526214,7144378,6659744,2319869,8054733,1483261,5373657,5053268,2558273,4960433,3183807,8498855,9974731,2374801,8405883,1960617,4945877,2526550,7739700,5407440,6752304,8544998,3976608,6499618,1631164,8728744,3698516,8548431,5066864,5619064,5310623,6882492,6150802,6524063,6251052,3584671,8603775,2213165,7723495,4073150,9552993,9999450,8793975,6491241,4660095,9930786,4196609,8377456,4691268,3305343,4692779,5583221,8125320,4233688,4325836,7907516,4892318,4463714,3417266,1417343,9836441,1187866,2645751,7921936,2998275,2052352,5054229,9570159,9308273,7085052,4329132,6040390,5786056,7763320,5193618,8289703,5839752,2938400,9261032,2333740,8758682,8836135,3190261,2023376,1993301,8853439,8487869,8288879,1314758,9366775,4800720,2819610,1451126,3274719,2042053,9648025,2290206,7490997,1195281,1606033,1245407,3106765,2140518,9124389,8877197,7443206,5344268,1341262,5363906,7709762,3759902,4991333,2916427,3489913,1779754,4042251,5729888,4771057,3584533,4547760,5565505,7738327,7732559,5686904,2558273,2051116,4332153,9457275,9341644,4819946,2643692,7991149,1085830,4004486,4451492,8963714,3540176,4449020,5051483,2061691,2676651,5276153,9197860,7980850,3026428,2856414,8852752,4922805,8302612,1072509,9081542,9056823,8404922,6097930,3939804,4919097,7398712,5407302,6692565,2214401,5561660,7238311,9212554,4992568,6093811,5223144,1899368,7665542,4582092,7409286,9964294,1835372,4815963,3387054,7423294,9401657,1044494,8743713,6644226,8916748,6272750,6561965,4788223,4657897,3687393,6183486,3993774,6385223,8807159,2952682,2643692,7253280,2452804,5163818,3558853,6846511,3127502,1926834,8465347,4805801,2904479,2171691,8575622,3015853,8413299,9511245,3628479,4821868,1020324,9179046,5233032,4244400,3795471,2762893,2857376,7661010,6360778,4951644,1309265,8922927,7212219,2014862,9049407,5376403,5611511,2232940,5183456,2757949,4638946,6997848,7474517,6429168,1501800,5802124,8222274,9924880,8694000,3835708,8349304,5278213,1097091,5408126,6541915,8095245,3619415,6916961,2786102,4845352,7466827,3578079,8144683,4338470,1635971,9640609,3117614,1855010,5728103,6300903,7430709,1900192,3673660,6037643,5595443,7049072,6462951,3585632,8084533,1853363,8477294,2266586,1465270,1276580,2511856,2895828,4337097,3626968,7087249,8985000,9414840,7458724,1141174,7457214,1602325,4407272,7694519,5595306,3399688,8429092,5586380,2441543,4488845,6415573,9871047,2366287,5840713,7647552,8970306,3026016,8186569,5060821,9175888,2428634,4199768,7791061,9595565,2325363,2228820,2966415,5135116,7646453,5928054,6217681,2612930,8201812,4628372,4872955,3597305,5363082,6790893,7307388,2064025,6947860,9389984,2415451,4464401,8022598,7566390,6675811,3299850,6845413,9396438,2775527,1796508,1665359,7119934,1264907,2772644,8598693,4670669,2209182,5293182,1299514,7853683,7307525,3205093,1643661,5012481,3448440,2148208,6146820,6530380,5167251,4132614,4331054,9009719,4979522,3280487,7764144,6472427,9053253,4821456,3984985,4425674,7194503,2939361,6038879,6136795,9609985,1561401,3836807,7960662,8419204,4684951,6060989,9063690,5382308,6334548,5833572,9388198,8814849,5744033,4868148,1200775,6155197,5857192,1321624,9067535,4156234,2739959,4067108,3602661,8168441,4998748,5604919,4829833,5483520,9798538,3330474,2504852,4206909,1574035,1379440,9239746,3629440,8028366,1766845,8773513,1564834,9511657,7040695,7232955,4622467,6376022,7167312,3728591,2885940,4396835,8868270,7126800,9963195,6857360,8126831,5344406,3878555,7389236,9083740,5007949,4776962,9162017,8039764,2822631,7905044,1516357,9784667,6493438,7841873,9634292,3971252,2542480,3446517,4340805,4752929,6867660,3490188,3628890,9403579,5384231,3443496,9004089,6138854,1594360,7386215,9240707,3856857,5428863,2509521,9643905,7018722,9202941,5178375,4411254,7385116,1032135,5022506,3187652,5829727,7550186,7026824,2408035,9947540,9273666,7087936,3519851,2677337,8457244,2005661,4680969,7654968,2781570,4380081,5025390,3519851,9721084,1380264,2092041,1889892,2931121,7856018,3507766,5226303,4501617,8759506,6521591,6303924,5419250,4346023,2481506,6510330,3082870,7123367,4848236,7687789,8214035,6017868,4840545,8739181,4010116,7725280,6304473,6717834,6878509,8717071,7901062,6616348,4601318,7868927,3206878,3577255,2269744,3181472,1819305,4741119,5834259,1561264,7062255,9452194,2613754,3131347,7384979,6041351,2607711,7039733,7047561,2902420,1954162,9234252,9188522,8082885,4378570,3174057,3865371,2107696,6976425,7944458,9164901,7252593,5173294,8744537,1974624,9989013,4207321,5217926,2511032,1816970,1975036,7593170,5195953,3204681,2588897,5102981,1978607,2856002,7484954,7652359,6692153,1021011,7428237,5203643,2542892,8071487,3258789,8846160,9323516,7058685,6720581,9020843,3444595,1471038,4219131,5868041,4378570,3913986,5849914,1166580,6608795,5926269,9542007,7833496,7679412,9654891,2661956,2453765,9437225,8606246,1918182,2806838,9062179,7191619,1914337,6861343,9976791,2286773,4190429,2203964,6232238,7523681,6100128,7373992,6461715,7533432,4364425,3069549,5995483,3859741,9647476,2696838,9232879,3760177,9996704,3229263,1862838,5615081,5493682,2845703,2029144,3163070,6955413,6317382,9031143,8281463,4034286,6611404,5656692,6529281,2557037,7679138,3738891,7174179,1447692,4899871,1031311,2919723,9078796,6147369,9996154,1052597,5393844,9947265,8596496,4228469,3644683,5696243,9690322,3616119,1088714,2409408,9116287,6616210,8487594,6966949,9066986,8876098,1753799,3326492,2843505,4818298,3586044,6671554,9584304,9400833,3439788,9963745,9062454,5329025,4675338,4869110,9144851,4437484,6226333,2525177,6007293,2460083,9634979,2118820,6699844,6908035,2795578,3744247,9154464,7273742,2250106,4507247,1230575,4279830,6382064,2348434,8891067,3391723,4348358,9550247,3103195,8312500,1096817,1399078,1557693,9679061,5311035,8970581,3799728,4678497,3626144,2506088,5866256,6802154,2960510,8350540,3022857,9459060,2306274,6918197,1693374,6662902,2821807,9658737,3177215,7515991,7572296,6487258,7247650,3706619,2758773,1652862,7224166,6737197,6782653,9508499,6613464,6106307,7986755,3156753,1912689,1157928,3418365,2435089,6668395,2821121,4458084,6213150,7384841,4956588,5656692,9468399,7376190,1529541,7625167,8110488,4155548,4326660,9321182,7022293,2455001,2438247,6575973,6285659,7469299,7221694,2205200,8063247,1420089,6965988,1546844,1101211,1029525,1977233,7771560,1325469,1002197,7301620,8807983,6497558,9104614,4806625,6226608,6400192,4939971,1838119,5926544,5520736,1008239,7172256,2969299,1701065,2148345,9481033,6402252,3724060,5954696,3031097,1415832,4303314,2261367,1832077,2679534,9446289,6289642,5956481,6198181,4659408,2550033,5247451,2534515,3963287,5095428,2133926,2739273,8188217,3215667,3772262,5836044,9515914,7171432,1232360,3201110,3740264,8057205,2948013,2683380,3211685,3389938,5149536,5809814,2937438,1515121,2497161,1916946,9803070,3426055,2634490,2554565,6387695,1088165,3881027,9005325,4338607,8863464,7781997,8261825,4775314,5127700,7733795,7307662,2691619,7675155,7405029,3044555,5825195,7004577,1170974,5709426,6961456,8078491,6280166,4126296,6142974,3652511,6972854,8634674,3751251,3765670,8268692,6040664,6930145,7486328,5643508,7432495,6320541,5509338,5313095,5205291,1573486,7694519,9343841,2139007,5612060,4143325,1307479,9871459,7109771,6907073,8700454,8613937,1154495,8917709,7844482,8447906,4566436,7239135,8489517,6052200,3839691,8229141,2835678,4199905,4175323,8708282,8194808,4871032,1574859,5727005,5008087,8324310,1463348,2027908,8441726,9971160,4810195,5793334,3275268,9397537,4217071,9775192,7305740,5373931,9941085,2398422,1982727,9201156,4322540,4933517,4495849,5232894,6585449,7331008,2030380,7920013,2480133,3811264,4413452,9220382,1735946,9804443,7867004,1716995,4794265,9334091,9085937,6289505,6787734,2436599,6362701,1682113,9238510,2713180,9974731,8810867,5440124,1605346,7554306,2156448,8995162,1488616,5659713,9083602,1474746,8179290,3266479,6432189,3670639,3946395,9397125,2223464,2407348,7623107,5608078,1825759,9384216,8912216,1553573,3422897,2014999,9478012,3343109,1127990,4734252,2919174,6914352,5589126,6739257,9217086,7136825,6427658,1636795,4750732,8867584,3355194,6962417,7476028,3676681,3311248,7041381,5358688,6461715,2466674,1160812,5658477,7668701,3436492,1520339,1155868,7340484,5543807,9931472,4916351,4708572,9482269,6733489,3684921,1550277,1217529,7894882,8505722,1027053,1472686,7768676,7660186,6224548,1642013,7472045,9516738,9112304,7475891,9356063,7386627,1142272,2380706,6537246,8979507,5205017,6678558,9957977,7552108,7161132,8668594,6944839,1344284,2669509,6835388,1734024,1395782,1526519,2048233,4932006,8337219,7240371,8092910,5380798,6250778,3054855,9382293,7395965,8190826,7143417,6188568,4846725,3462585,3192459,4239730,2046173,3249038,7091369,8025619,6921768,7681472,3949142,9657363,7432083,9947952,7155502,5621810,9702407,4531005,9706253,6277420,4844802,7171432,7510910,7433593,5931900,8650329,8901092,5858154,4095260,4981582,3058837,1055618,3214157,8112823,8584686,2161529,9165863,8723663,3921676,9294815,7104553,2218933,4856338,6214111,9738388,4507385,9814605,5619476,3073944,6663589,6171264,3944747,7595642,2061828,1291549,3983886,9349472,8080001,1524597,7195190,5899627,8965774,1866134,8026992,2628311,2957077,8510116,9107772,6343338,8253860,4008056,8646896,4668334,3932388,3253845,5886444,5178100,2396499,2014038,2950347,5752685,4460418,2222091,3933761,6116195,6655349,5753921,7576416,4029617,9855392,7905731,3363021,5107925,9814193,8291625,3396118,7727340,8709106,7378662,2883880,9994369,1283721,6381515,9586502,9243728,1684173,5730987,8065444,5034179,1582687,1839355,8079864,3111434,6681854,4377883,6971893,4306335,6193237,1788269,6387695,2837463,4385025,5243469,3174743,4987213,4790969,8780242,4800720,2618560,4176147,4818984,7139160,2503341,3850814,9791671,2962158,9929962,5429962,5096252,3986495,4558197,7627365,9094863,9817352,4991607,7182281,5376953,5630050,8035095,2510208,6003860,2938125,7106887,3171859,1955535,7287338,1773712,7754669,7495941,8222000,4877899,7259323,4678359,1366531,4223800,3587005,3707168,2965866,2295425,1219451,7376739,3728454,9970886,6685424,5303894,2315887,9703781,2909561,2175811,2323165,7140121,5034454,7728713,5091583,6640106,2812194,1678405,8201538,2672393,4156784,8321426,5984634,2550033,2953506,6023086,1902389,1477493,4717636,4315399,2133514,6376846,5195816,4818298,9213790,2461318,1505645,7708389,3072433,4026733,2905441,4950271,9309646,2427673,3788604,5009185,8055969,6708496,2996353,3267303,8261962,7856567,5043243,5857742,4757736,8148254,6347595,3138214,7927566,9555328,1061660,9522094,7344879,3679702,9596115,2885391,5208862,1187316,2430694,6269180,7927566,8208404,1305557,1094345,3691787,5673171,5388214,4610794,3382659,1052047,6508132,9796203,1656845,1468566,2053451,3425094,7553344,4655014,8623550,3527130,1465820,9716827,3031921,7952148,3823211,9178497,9751296,2261642,4323776,9275726,9396713,8665298,9065475,3965347,4339019,9221206,8415771,3620239,6043273,4017669,5966918,7879364,1225357,1557693,1418029,5619750,3420288,4062301,4727935,8520965,4057769,9912384,1385345,3190261,1635009,5948928,9135787,8316482,4085784,7848876,2012527,4822143,2933731,4295349,4014236,6482864,3328826,7162643,2271255,2981796,9557113,9432693,9047897,6868209,5119186,8063522,3421249,8389816,6970932,1526794,9981323,6666061,8019989,2235137,9397674,2172653,4471405,9574966,1193222,2005249,3118026,1768218,3572723,3890502,7165664,9276138,4645675,1415008,1691864,3969055,9891784,3438964,9327087,8777359,2208221,2164550,3255218,9043640,4385986,8827209,9126037,7295166,6357345,1478454,2973831,9655166,1058364,2829772,8735198,6611129,8250564,6625549,2459808,6358993,6145446,6513763,8809906,3443222,1175506,7884445,5938491,3910003,2754791,6642028,6344024,7692321,7374542,4383651,1791976,6447158,1875610,7949401,4899871,5562210,9243316,1815460,1476806,2551406,6766448,3296005,1213958,2557037,9905792,9026611,9817352,3179687,7716079,5693908,2177871,2351318,7162918,6483001,7673095,6473388,7181182,7209884,9192642,2536437,6816848,3608978,9982421,6441802,3296966,8742614,5900588,7242019,3370437,5003005,1180038,9520996,3764846,3674896,3289688,2631469,9101318,2526824,8989807,5007400,7113479,5401260,7174453,3273345,5511123,2270706,1593536,6365859,5335891,1730178,7051544,7387725,6149566,5393157,4172851,1414047,7900924,7161407,4330230,4966888,5813796,5835769,2828125,9380371,6140365,6038192,7937316,2771408,5123031,4912918,4870758,1837982,4010116,2574890,6298431,3201385,2466812,6776748,3491561,2513092,7227188,6759307,5692810,9042953,7330047,3757431,8803588,5969116,6781829,1129501,8984313,9088272,2991958,5577041,1259963,3164169,1823287,5426803,6726211,7632995,2600433,4440368,5447265,5885894,7922348,5123031,7642471,7846130,9620559,1999069,5252807,7059509,5707778,4822280,9482543,3017227,8660079,8191787,6408432,2930847,9877914,8539230,9252243,2676239,4667510,2959274,3407928,5126190,6587783,7850250,7819076,3590988,2506912,4833679,3799865,6584762,2210281,4922119,8892715,4637023,7906829,3403945,1856384,9367874,3473297,7413269,3380325,2544815,4784790,7654968,9615203,6342239,9971298,4251541,2117309,4519607,7946517,3183120,1297866,6738845,1051910,3286804,8972640,3738891,2159606,7285964,5103530,6586410,7077911,4817749,6329193,7722259,1603561,5926681,9375427,3019973,4063812,9994644,6939620,2578460,4693328,6574325,7145065,7464492,9687576,1096542,1156280,6125946,6278930,8918533,8050064,3693298,2677200,1683486,6537109,2888824,4219543,1459091,8626159,3761962,7572845,9624130,3825820,3968780,9332580,1971603,1976409,3816619,2862869,9997940,2307785,6790069,4718322,6846374,8813613,1777969,3496368,4872543,9539810,7721435,7458587,2303665,3877731,4899459,2769210,5956069,4456573,4572067,7691223,1483673,7730087,9200744,7586166,8124221,3849990,6962142,1059600,8411376,1920242,4776962,5097625,6823440,6225646,9569747,6536422,7835830,9529373,6981643,4710769,5347152,2032440,9251419,6622802,7945831,8088516,5485855,2476974,2988937,5269012,3038101,7923171,9959075,7870986,2211242,2853256,9069732,7463119,3007064,6093948,3587417,7560760,3138900,7839126,1839767,7027923,5026901,8167617,6376571,7295303,8993240,9487762,3256179,5992187,1379440,4252777,2920959,7083404,4800170,3793411,8635635,1105880,1255706,5607391,8953414,8598556,2320556,7952972,5181121,5320098,5126464,5088424,8310302,2346237,9359497,9002166,7384567,9643218,4989135,3976333,5771224,3207702,6949234,5828079,1304595,2371093,1488204,6173599,6773727,8357406,6408294,9555328,4717910,9692520,1911865,6779769,5003417,3555969,6274536,2307785,9147460,4669708,8062423,2040130,4858810,8818420,2114013,7345428,1764511,8593612,3003219,2669921,6790618,1456893,4204849,9576339,4165985,6714675,8679168,5553833,9517425,4499008,9095275,5443008,2026672,2348159,7412719,4820083,2114974,7480285,6037643,2184051,8626983,2354614,6275634,6289505,8980880,7612533,9296875,2471069,1254608,5995071,1334533,9300170,7675155,9326675,8334060,1420776,9482681,6162338,3772125,9906066,7634506,9190582,6864776,4980621,4321441,2985504,1883026,7451583,1762176,2202453,6793502,6691879,2246124,2810958,2945541,5521011,6893066,9458099,9021118,3825271,6098617,2557449,1967208,7262207,4133438,1194869,4129455,7893096,7865768,4447372,3305892,5086364,4075759,3208389,6939208,4536224,8330490,7111282,5166290,9741546,2888275,8646896,8943939,6785263,8600479,9068771,9970336,1762588,9280670,1178115,1618530,3697692,9509460,6584213,6604125,3295181,7342956,8532638,7602783,2369445,9894943,3896545,5538314,9294677,8260726,6422164,2759735,1321487,3750839,8825698,9824768,3100723,1905136,5832061,8110076,3261810,3254257,4751968,2966964,2386199,6297744,8689193,9639648,4221878,6668258,6972305,7666915,9481719,7949813,2905578,2983993,4068893,1119064,5430648,8445571,1074844,9077972,5795669,9986267,2391555,9248260,9822845,8139328,2283752,1693374,2869735,4131240,6762603,8740417,8077941,2270980,2107284,3566955,7001831,5853759,8375259,3725296,9212966,6295822,7248474,3069274,3972213,5722198,6054946,5055191,8563949,9722595,9314178,1884674,9386138,3497467,6645874,9457138,1390701,1110000,9389160,2602355,2966140,1065917,1773025,4560668,8858108,9937103,9985168,4180130,1220413,3248764,1978744,8799468,8390914,3350250,1365570,5284805,7485504,8485122,2234451,2189544,2404602,6783477,5243881,6506759,1344696,7390609,4827224,8981018,9410720,7455017,4858947,2450195,3420425,7191207,9621932,8185333,4497222,9738250,4422927,8697296,8542800,1031723,7697265,4978424,7184341,8407806,1947021,6649032,3291748,8159240,5358276,1976959,1654510,5760513,1439041,4238906,4916351,4981994,6522415,5391647,4358245,9611770,1479003,5523620,4626174,8002960,7481796,3053894,8994476,3166503,5167526,6147781,4260742,2627899,4039230,4318557,6865875,3765258,6450592,5683197,2331268,5849777,2020767,6841018,1609466,3505157,6818222,9844543,1439590,1806671,4161727,7229934,9302505,7736267,8379104,4578521,1070449,2215637,9368972,1574035,7941986,9432556,1309539,1029113,2759872,6681716,6356933,2844879,7301071,7437988,8677932,7377288,9637863,6880569,6660156,3174057,5158874,5587478,8644012,8555709,2346786,7618026,9019470,7005401,9906204,1703262,4032501,7838989,8333786,1762863,3143569,9122741,3526306,2465850,5283157,4307983,3519302,7056213,3846557,7551559,6949920,1160125,7774307,5189910,6339355,2794616,7558563,6337158,4785751,8296295,8522476,1073608,4164199,9388610,6213287,8196319,8426071,9106262,8256332,2998275,9091156,4796463,4509582,6045196,5527465,9914581,7866455,6419692,9112030,1833175,4547760,9400970,2865753,2384552,8228454,8048828,3656906,7353118,2841583,6660018,9567001,7639175,4403564,3567642,6511566,7309448,8705261,7249710,5712310,2257522,1211624,2218246,7110458,4687561,3014617,1655746,4319107,5145690,5181259,4268157,7204940,2313140,8344085,1324645,8695922,1282760,1873413,4350143,6906112,2536437,9478836,5441497,9173278,8342300,8581115,2676376,3102645,5790725,3300399,2581344,1209014,7187911,4402877,6129516,9254028,8025482,7049758,7237350,6868759,6244735,7693283,1226455,6558395,6015396,6962966,5222869,9681259,5745407,3885696,6958709,6495498,1543685,9283279,5948654,9869125,5851013,2692443,9506988,8744674,4460968,4648147,3575607,1954162,4647460,8678619,3831451,7477539,7618713,7850387,9041580,9737701,4016433,4211715,7136001,1026779,5677841,1975311,8964263,7656478,5381347,7785430,8208404,4928024,3792312,2912307,4417709,7512557,4328857,9718750,5635406,5338775,7167449,1241424,3586044,4579208,2104400,1230850,8892166,5830688,9494354,6495361,4289169,8081100,6983703,6889770,2306961,5557952,7257400,4796051,2386474,3050186,7518600,3436630,6901718,7799987,3918792,9866241,8053634,5555618,7658538,3985122,6106307,4879959,3976608,9416625,6934402,4309494,6746124,1595596,5348388,2456649,5898254,4907012,1169189,4647735,5388626,6224136,9518524,2193664,2929748,9683593,4296173,3884460,1203933,4047058,8309890,5801712,9778625,5489837,8029602,6043823,1441375,1160125,5433120,4456710,7173080,1354446,1911590,3964248,7478637,7652221,1706008,7592483,2295013,5852111,9839462,9779861,7191894,7055389,4018493,3069549,7088897,2740234,8468368,7775405,2202453,1168365,6172912,1716995,6445648,1971328,6488357,9616577,6997436,4256210,4597885,4251403,6260665,4079055,5777130,4956176,1926696,4624389,3939117,7569137,8367843,3940353,6426834,5414031,2072952,1567993,3523422,5414718,2348022,6912017,1646820,1932601,7998428,9695816,9699523,1423660,1212448,3342422,7540847,6507171,9365539,3629714,2051803,7540298,3961776,9458236,1759292,7292007,5433807,1079238,6490966,9811035,2019119,3625869,5026763,8080276,6429992,5289886,5218612,9552169,2538909,9989013,8544448,8159515,6794601,4868148,7567077,4892868,5590774,5479263,8266906,3542373,2303253,3980590,2714279,2693130,7217575,1203659,2055099,9571945,6062225,1927520,1273422,6836624,1369415,1206130,3703598,5902236,9379959,3092895,3758117,9898788,7712097,9604354,1842376,1853500,4512878,3268402,3922088,6190216,8310577,5100921,7714981,6142974,6286895,6352264,8973876,8173522,9187973,8870880,2830322,8990081,9592819,8423873,4667098,3257827,1758468,2822631,2489883,3597442,8758407,3192733,9264739,3965072,4136734,4235610,1190887,2005386,6793365,8823089,9379272,2474227,2320968,8770904,6902542,9323104,5511398,8132461,2687774,9538986,7251495,8858795,2219345,1334396,3525619,9166824,3521362,6780456,2744628,6460342,3387741,4477172,2120056,1148727,2329895,1354995,9301132,2203689,1208877,8199890,9995468,3802337,5022644,2997863,2789672,5896057,8815811,6691329,1890853,3052383,8181900,4440643,3005828,5410736,9325714,7986343,2078857,7098373,9154190,1204071,8104995,1948257,1367492,1446594,4737823,6863677,6014160,5766830,8911804,3673385,7483993,9615615,1196792,2820159,5404418,2107421,2103164,4727249,9409347,8449142,6057556,8186843,2250930,2623092,2266860,3613098,8221176,3921401,1190063,1504409,3352722,9422119,7835418,6958709,2368209,4004486,4603790,8584686,4846313,5992187,1894561,9653381,9572631,3024642,3194107,7834320,4545974,6243225,5866668,5358825,6606872,5392471,1362960,9954544,4158294,7925231,6069641,9396301,2946640,7708389,5514968,6014709,1372299,3421661,5150497,4008468,5298126,2243103,7428649,8902191,7824295,2916702,9393417,3995971,7999801,1792938,2502792,8146469,2937164,6939071,5904022,8729019,9300720,4910720,6877136,9117935,3636032,9279434,1667831,2534515,8511627,9510559,1428466,3602523,6937561,3283370,7483444,3457229,2033676,2848999,9641845,6750656,3414657,9519485,2771545,7396926,5259674,8880355,3356979,7401870,7537002,7822784,7258224,7619949,1351837,3986770,5388900,2783355,5885345,7711685,7533843,8645797,5894409,7084091,2023925,9585128,3241348,5181808,8486633,7509124,4420455,2102203,7391571,6408020,4552703,5873672,2610733,5396316,5814620,7840362,9709548,5589263,4772842,6615524,1190475,4657211,4590332,7197799,6405685,2400756,4575637,7341857,1358840,9191680,5042007,5779602,2113876,8623138,6945663,8385284,6030639,1211624,8272674,3876358,5544769,8496246,3642486,2145874,6711380,2377685,7096176,7819900,7232131,8041687,5540786,4132888,1181274,3310287,6814514,8714462,1154083,6763565,8845474,6383575,1052734,4477722,8870193,9541183,5229187,8721603,5181121,6255996,2205200,6456222,2373291,1638992,8686996,9980773,8556671,2596588,8093048,3568054,8504623,7560211,8314971,7435653,9206100,4283401,6929321,7892547,6791992,1301025,7579025,2009506,7302032,6144348,1744049,4652954,4263351,2906402,5619476,5228500,9547088,4249618,3318664,9977890,4474014,5451385,3122970,4170928,6637084,5580062,3993637,6038879,2408584,4396011,7067474,1791290,3602249,5070022,4352478,5560974,5258575,3315643,7344192,6619781,4021240,2025161,2780471,2710296,7075027,5007125,6253387,7836242,2111541,1915847,1898132,8355621,7295303,5968704,1875610,7719787,9693756,3544433,4869796,7704544,1145706,3255493,6317245,3472610,1031860,7589187,1587219,2316024,4919235,4710357,8832290,8419067,9547775,1521026,7727890,1486557,8126968,6568695,9818313,4580718,7411621,1897857,3689453,8011749,5526229,1439590,8686996,6624313,9006011,1031448,7397201,7323867,1022659,7661285,8611053,3187515,2266174,7030807,1988632,5002456,1447555,3030685,2144638,9576477,4895065,6220428,6371353,4662017,9210083,5910064,9719985,6841293,2452667,9932708,9657226,7213043,4825027,6706710,9017822,1225082,2321380,5676330,3470275,4499008,9314453,1728942,7214279,5987243,5545181,1679092,4130966,3308502,1485870,3416030,4101303,8604049,4545288,2805877,1714660,7760848,5083892,8944076,8083297,4341766,6709320,7851348,6984664,5069198,3818130,8206207,6047531,6206283,2856552,1208740,7201782,8676147,8264846,4168457,4111053,4267471,6577621,1911727,1806671,5765869,4645263,9599685,4241104,9358261,2449234,8053222,9979949,7151107,1476669,2177322,6751754,1148864,1124420,7578201,5074142,1534347,3101135,8968246,2674316,5595993,3296829,1451263,9923645,3144943,9086761,5283157,1004257,4766937,7540847,3200012,2027496,3750564,3505432,5908416,9821609,3038925,8026718,5832611,6608383,9044326,6085433,6710281,7287475,6673751,9109970,6131713,8546234,6405960,5238250,1616333,1514984,6766036,2796127,5320922,7186264,8038940,6961318,2970397,8315383,1568405,8081375,4109130,7023391,7482070,1615234,2262878,9819137,4189880,1166305,1107666,7260147,2496063,1575958,6237045,1971740,8670928,6546585,3623809,8240676,3325531,5762435,4368408,4905502,4432128,6977523,5828079,7759201,8335571,8038803,2721008,9185089,3098388,5313919,6298019,5243469,1023483,4491729,7177612,1928619,5698440,4224899,1935623,4813766,4405349,8582626,1045181,9804031,9238922,2783630,3260299,8215820,3778030,2175399,7035339,5900039,7653457,9932296,8077117,6630218,7855743,2438110,8619705,4472229,5127288,2822357,5519500,7355453,5281784,1621139,9760635,1564010,5795806,1028564,1467605,5366516,5515106,4708984,8016555,4503128,6819732,4639083,2340744,7748764,2092453,2947463,7022430,6272064,3833236,3221023,2265899,3006378,2264389,9246887,5345092,3754959,8768981,1659179,9620010,1245819,6007843,2458297,6713989,5858016,8057067,8871841,4948623,1234832,6412139,5526779,6626510,4506011,5199249,7400085,1258590,1335357,2441131,9518112,9328323,7513244,3718154,2872482,8686172,9312942,6069915,4521530,3169250,7329635,2481369,9345626,2539459,6019790,7796005,9426788,2333190,2661682,3400787,6518432,2717163,6953353,8526733,1576919,1944000,9968826,4507247,3821975,3500900,5690200,9840835,7295028,8545684,1834411,5398788,4384613,5723571,6194335,7624618,2287048,1958282,6211776,7065826,3871688,7312057,9001205,7084503,8918945,8507644,6545211,6089553,6200378,6205596,5275878,5133193,3368927,6631866,2766326,1216979,2129257,6648345,5746505,3151260,1655197,6860656,8165008,3309600,9723968,1857208,5513595,5124679,9537612,9171768,9135513,3667617,5696105,5065490,1733062,1155456,7295852,8720642,4797424,8729431,8618469,2940185,1174819,8349166,5381072,4946838,9492019,6145721,8015182,2375488,8656646,7076538,8943801,5053405,9153228,6228530,9325851,8660079,5352508,6609756,8235595,3863174,6553588,5775894,5746368,7021057,6976562,6134460,3887207,3048950,2425750,9270370,2942520,1540664,3841339,4136734,4060379,6738983,2458023,8454223,6641342,3450637,7791198,2164138,2475189,2497436,5165878,1277404,9094314,4799072,8011611,2963394,9312530,8679718,6637908,5223281,1418579,9493942,6712203,2990997,8991867,8163360,4156784,2006210,2811096,4720794,8685211,6300903,6822616,2452804,7695617,2647125,7638488,7735992,9739898,5805557,2532318,6160552,5288925,7921936,3402160,8034545,2010192,3913024,7668701,8862503,8278717,8186294,5577865,2893081,5138687,9538436,7876892,3328140,5435317,4574264,1331100,9287811,6335372,2491119,5052169,8125869,5954284,6572814,9105850,7187225,7311096,9235763,4366760,3604034,9326538,5971450,2090805,3220886,7086151,2029556,9172729,6246246,1085006,8185333,1558105,7721298,1673873,8433761,5778503,2401443,1425445,3955734,7078598,6142837,9639099,8200164,1102584,2389770,4702804,7423568,6611816,5854034,6531890,4533752,5199249,7982772,7802185,7578750,3470687,5305953,2196548,8727920,3662261,1259277,1384796,4084274);
+
+# Cleanup
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.5 tests
--echo #
diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result
index fbf348c1a2f..aa5d6ccadc1 100644
--- a/mysql-test/main/type_date.result
+++ b/mysql-test/main/type_date.result
@@ -924,6 +924,24 @@ DROP TABLE t1;
# 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 range f f 4 NULL 1 100.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
#
#
diff --git a/mysql-test/main/type_date.test b/mysql-test/main/type_date.test
index bd874ec51fb..c041295f845 100644
--- a/mysql-test/main/type_date.test
+++ b/mysql-test/main/type_date.test
@@ -635,6 +635,24 @@ DROP TABLE t1;
--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 # Start of 10.3 tests
--echo #
diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result
index b23fa762c73..5b27d02d28f 100644
--- a/mysql-test/main/type_datetime.result
+++ b/mysql-test/main/type_datetime.result
@@ -1330,6 +1330,18 @@ a
2000-10-00 00:00:00
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 range f f 6 NULL 1 100.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
#
#
diff --git a/mysql-test/main/type_datetime.test b/mysql-test/main/type_datetime.test
index e4b18a245f0..c8ad240d817 100644
--- a/mysql-test/main/type_datetime.test
+++ b/mysql-test/main/type_datetime.test
@@ -837,6 +837,15 @@ ALTER TABLE t1 MODIFY a DATETIME;
SELECT * FROM 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 # End of 10.2 tests
diff --git a/mysql-test/main/type_time.result b/mysql-test/main/type_time.result
index 360746bb856..8ef8e981f57 100644
--- a/mysql-test/main/type_time.result
+++ b/mysql-test/main/type_time.result
@@ -1368,6 +1368,18 @@ CAST(f1() AS TIME)
00:00:00
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 range f f 4 NULL 1 100.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
#
#
diff --git a/mysql-test/main/type_time.test b/mysql-test/main/type_time.test
index 13101f0e29d..521953a5078 100644
--- a/mysql-test/main/type_time.test
+++ b/mysql-test/main/type_time.test
@@ -820,6 +820,15 @@ 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 # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result
index d8c74f15c57..e6fa9756b1d 100644
--- a/mysql-test/main/type_timestamp.result
+++ b/mysql-test/main/type_timestamp.result
@@ -884,8 +884,9 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage ';
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
-Warning 1292 Truncated incorrect datetime value: ' garbage '
-Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00' and <cache>(octet_length(TIMESTAMP'0000-00-00 00:00:00')) = 30 + rand()
+Warning 1292 Incorrect datetime value: ' garbage '
+Warning 1292 Incorrect datetime value: ' garbage '
+Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where octet_length(`test`.`t1`.`a`) = 30 + rand() and `test`.`t1`.`a` = ' garbage '
DROP TABLE t1;
CREATE TABLE t1 (a TIMESTAMP);;
INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01');
@@ -1297,5 +1298,27 @@ SELECT (SELECT MIN(b) FROM t1) - a FROM t1;
-20030101000000.0000
DROP TABLE t1;
#
+# MDEV-22734 Assertion `mon > 0 && mon < 13' failed in sec_since_epoch
+#
+SET time_zone="-02:00";
+CREATE TABLE t1(c TIMESTAMP KEY);
+SELECT * FROM t1 WHERE c='2010-00-01 00:00:00';
+c
+Warnings:
+Warning 1292 Incorrect datetime value: '2010-00-01 00:00:00'
+DROP TABLE t1;
+#
+# MDEV-22854 Garbage returned with SELECT CASE..DEFAULT(timestamp_field_with_now_as_default)
+#
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.456789');
+CREATE TABLE t1 (a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP);
+INSERT INTO t1 VALUES ('2019-02-23 11:31:04'),('2023-02-09 00:00:00');
+SELECT CASE WHEN a THEN DEFAULT(a) END FROM t1;
+CASE WHEN a THEN DEFAULT(a) END
+2001-01-01 10:20:30.456
+2001-01-01 10:20:30.456
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test
index 7b2311eaac3..9c5b57b8885 100644
--- a/mysql-test/main/type_timestamp.test
+++ b/mysql-test/main/type_timestamp.test
@@ -854,6 +854,26 @@ SELECT * FROM t1 WHERE (SELECT MIN(b) FROM t1) - a;
SELECT (SELECT MIN(b) FROM t1) - a FROM t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-22734 Assertion `mon > 0 && mon < 13' failed in sec_since_epoch
+--echo #
+SET time_zone="-02:00";
+CREATE TABLE t1(c TIMESTAMP KEY);
+SELECT * FROM t1 WHERE c='2010-00-01 00:00:00';
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-22854 Garbage returned with SELECT CASE..DEFAULT(timestamp_field_with_now_as_default)
+--echo #
+
+SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.456789');
+CREATE TABLE t1 (a TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP);
+INSERT INTO t1 VALUES ('2019-02-23 11:31:04'),('2023-02-09 00:00:00');
+SELECT CASE WHEN a THEN DEFAULT(a) END FROM t1;
+DROP TABLE t1;
+SET timestamp=DEFAULT;
+
--echo #
--echo # End of 10.4 tests
diff --git a/mysql-test/suite/innodb/r/innodb_bug34053.result b/mysql-test/suite/innodb/r/innodb_bug34053.result
deleted file mode 100644
index 23c5b0cc2f7..00000000000
--- a/mysql-test/suite/innodb/r/innodb_bug34053.result
+++ /dev/null
@@ -1 +0,0 @@
-SET default_storage_engine=InnoDB;
diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result b/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result
new file mode 100644
index 00000000000..81fa2448e3d
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_force_recovery_rollback.result
@@ -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;
diff --git a/mysql-test/suite/innodb/t/innodb_bug34053.test b/mysql-test/suite/innodb/t/innodb_bug34053.test
deleted file mode 100644
index d93d5100d81..00000000000
--- a/mysql-test/suite/innodb/t/innodb_bug34053.test
+++ /dev/null
@@ -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
diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test b/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test
new file mode 100644
index 00000000000..ad234eba72e
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_force_recovery_rollback.test
@@ -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;
diff --git a/sql/field.cc b/sql/field.cc
index d9b654945f6..8e8ed7df0cb 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -5835,7 +5835,9 @@ Item *Field_temporal::get_equal_const_item_datetime(THD *thd,
case ANY_SUBST:
if (!is_temporal_type_with_date(const_item->field_type()))
{
- Datetime dt(thd, const_item, Datetime::Options_cmp(thd));
+ Datetime dt= type_handler()->field_type() == MYSQL_TYPE_TIMESTAMP ?
+ Datetime(thd, const_item, Timestamp::DatetimeOptions(thd)) :
+ Datetime(thd, const_item, Datetime::Options_cmp(thd));
if (!dt.is_valid_datetime())
return NULL;
return new (thd->mem_root)
diff --git a/sql/item.cc b/sql/item.cc
index 9b3690f4c3b..6ec4fdc6546 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -9402,6 +9402,12 @@ void Item_default_value::calculate()
DEBUG_SYNC(field->table->in_use, "after_Item_default_value_calculate");
}
+bool Item_default_value::val_native(THD *thd, Native *to)
+{
+ calculate();
+ return Item_field::val_native(thd, to);
+}
+
String *Item_default_value::val_str(String *str)
{
calculate();
diff --git a/sql/item.h b/sql/item.h
index 8de38978a47..7a16ed02c6b 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -6305,6 +6305,7 @@ public:
longlong val_int();
my_decimal *val_decimal(my_decimal *decimal_value);
bool get_date(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate);
+ bool val_native(THD *thd, Native *to);
bool send(Protocol *protocol, st_value *buffer);
int save_in_field(Field *field_arg, bool no_conversions);
bool save_in_param(THD *thd, Item_param *param)
@@ -6800,6 +6801,13 @@ public:
bool cache_value();
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
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);
/*
Having a clone_item method tells optimizer that this object
diff --git a/sql/item_func.h b/sql/item_func.h
index ca72563581b..cd49496eb23 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1100,11 +1100,11 @@ public:
decimals= 0;
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);
fix_length_and_dec_decimal();
- if (decimals == 0)
+ if (decimals == 0 && downcast_decimal_to_int)
set_handler(type_handler_long_or_longlong());
}
bool need_parentheses_in_default() { return true; }
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 8422de7c3a3..12310ddce20 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -3774,7 +3774,6 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)),
else
result->append(*item->separator);
-
for (; arg < arg_end; arg++)
{
String *res;
@@ -4173,6 +4172,7 @@ bool Item_func_group_concat::add(bool exclude_nulls)
return 1;
tree_len+= row_str_len;
}
+
/*
In case of GROUP_CONCAT with DISTINCT or ORDER BY (or both) don't dump the
row to the output buffer here. That will be done in val_str.
diff --git a/sql/log.cc b/sql/log.cc
index b74adf59158..0182d41431e 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2631,7 +2631,7 @@ static int find_uniq_filename(char *name, ulong min_log_number_to_use,
char buff[FN_REFLEN], ext_buf[FN_REFLEN];
struct st_my_dir *dir_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;
char *start, *end;
int error= 0;
@@ -2667,7 +2667,7 @@ static int find_uniq_filename(char *name, ulong min_log_number_to_use,
if (strncmp(file_info->name, start, length) == 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);
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index c52463fbc91..d94016b7815 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -8458,7 +8458,8 @@ bool check_grant_all_columns(THD *thd, privilege_t want_access_arg,
grant_table= grant->grant_table_user;
grant_table_role= grant->grant_table_role;
- DBUG_ASSERT (grant_table || grant_table_role);
+ if (!grant_table && !grant_table_role)
+ goto err;
}
}
@@ -12212,7 +12213,7 @@ int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr)
#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* column, uint col_length,
const char *priv, uint priv_length,
@@ -12236,13 +12237,27 @@ static bool update_schema_privilege(THD *thd, TABLE *table, char *buff,
#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)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
int error= 0;
uint counter;
ACL_USER *acl_user;
- char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1);
@@ -12267,10 +12282,10 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(want_access & GRANT_ACL))
is_grantable= "NO";
- strxmov(buff,"'",user,"'@'",host,"'",NullS);
+ Grantee_str grantee(user, host);
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))
{
error= 1;
@@ -12286,7 +12301,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{
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_lengths[priv_id], is_grantable))
{
@@ -12313,7 +12328,6 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
int error= 0;
uint counter;
ACL_DB *acl_db;
- char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1);
@@ -12342,10 +12356,10 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{
is_grantable= "NO";
}
- strxmov(buff,"'",user,"'@'",host,"'",NullS);
+ Grantee_str grantee(user, host);
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))
{
error= 1;
@@ -12360,7 +12374,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)
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],
is_grantable))
{
@@ -12386,7 +12401,6 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
int error= 0;
uint index;
- char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1);
@@ -12419,10 +12433,11 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
if (!(table_access & GRANT_ACL))
is_grantable= "NO";
- strxmov(buff, "'", user, "'@'", host, "'", NullS);
+ Grantee_str grantee(user, host);
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,
STRING_WITH_LEN("USAGE"), is_grantable))
{
@@ -12438,7 +12453,8 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
{
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,
command_array[cnt],
command_lengths[cnt], is_grantable))
@@ -12466,7 +12482,6 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
#ifndef NO_EMBEDDED_ACCESS_CHECKS
int error= 0;
uint index;
- char buff[100];
TABLE *table= tables->table;
bool no_global_access= check_access(thd, SELECT_ACL, "mysql",
NULL, NULL, 1, 1);
@@ -12493,7 +12508,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
is_grantable= "NO";
privilege_t test_access(table_access & ~GRANT_ACL);
- strxmov(buff, "'", user, "'@'", host, "'", NullS);
+ Grantee_str grantee(user, host);
if (!test_access)
continue;
else
@@ -12512,7 +12527,9 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond)
my_hash_element(&grant_table->hash_columns,col_index);
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_column->column,
grant_column->key_length,
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index 00681ba8e2a..c44a98c75b9 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -3410,7 +3410,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
if (!insert_table(thd, key_length, key, (*block_table),
tables_used->view_db.length, 0,
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
present in the global list.
@@ -3434,7 +3434,7 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
tables_used->callback_func,
tables_used->engine_data,
TRUE))
- DBUG_RETURN(0);
+ goto err_cleanup;
if (tables_used->table->file->
register_query_cache_dependant_tables(thd, this, block_table, &n))
@@ -3442,6 +3442,11 @@ Query_cache::register_tables_from_list(THD *thd, TABLE_LIST *tables_used,
}
}
DBUG_RETURN(n - counter);
+err_cleanup:
+ // Mark failed
+ (*block_table)->next= (*block_table)->prev= NULL;
+ (*block_table)->parent= NULL;
+ DBUG_RETURN(0);
}
/*
@@ -3475,7 +3480,12 @@ my_bool Query_cache::register_all_tables(THD *thd,
for (Query_cache_block_table *tmp = block->table(0) ;
tmp != block_table;
tmp++)
- unlink_table(tmp);
+ {
+ if (tmp->prev) // not marked as failed and unuseable
+ unlink_table(tmp);
+ else
+ break;
+ }
if (block_table->parent)
unlink_table(block_table);
}
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index cb4d9fb1de5..aee9b4c165c 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2015,2020 MariaDB
+ Copyright (c) 2015, 2020, MariaDB
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
@@ -6540,7 +6540,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
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;
}
@@ -6589,7 +6589,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
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;
}
@@ -6638,7 +6638,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
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;
}
@@ -6687,7 +6687,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
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;
}
@@ -6736,7 +6736,7 @@ bool Type_handler_decimal_result::
bool Type_handler_temporal_result::
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;
}
diff --git a/sql/uniques.cc b/sql/uniques.cc
index a10b28c709e..a0cebe3e4dd 100644
--- a/sql/uniques.cc
+++ b/sql/uniques.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2001, 2010, Oracle and/or its affiliates.
- Copyright (c) 2010, 2015, MariaDB
+ Copyright (c) 2010, 2020, MariaDB
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
@@ -317,6 +317,9 @@ double Unique::get_use_cost(uint *buffer, size_t nkeys, uint key_size,
max_elements_in_tree= ((size_t) max_in_memory_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;
last_tree_elems= nkeys % max_elements_in_tree;
@@ -809,6 +812,11 @@ bool Unique::get(TABLE *table)
/* Not enough memory; Save the result to file && free memory used by tree */
if (flush())
DBUG_RETURN(1);
+ /*
+ 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(key_memory_Unique_sort_buffer, buff_sz,
diff --git a/sql/uniques.h b/sql/uniques.h
index a78e626907f..7e12a391fbd 100644
--- a/sql/uniques.h
+++ b/sql/uniques.h
@@ -86,6 +86,9 @@ public:
{
size_t max_elems_in_tree=
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));
}
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 0ed190cfeb3..b8fdff89545 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -1531,7 +1531,7 @@ dict_load_column_low(
ulint pos;
ulint num_base;
- ut_ad(table || column);
+ ut_ad(!table == !!column);
if (rec_get_deleted_flag(rec, 0)) {
return(dict_load_column_del);
@@ -1638,7 +1638,7 @@ err_len:
}
num_base = mach_read_from_4(field);
- if (column == NULL) {
+ if (table) {
if (prtype & DATA_VIRTUAL) {
#ifdef UNIV_DEBUG
dict_v_col_t* vcol =
diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc
index 398e31a5ae5..20bf53e3f91 100644
--- a/storage/innobase/row/row0undo.cc
+++ b/storage/innobase/row/row0undo.cc
@@ -478,7 +478,7 @@ row_undo_step(
if (UNIV_UNLIKELY(trx_get_dict_operation(trx) == TRX_DICT_OP_NONE
&& !srv_undo_sources
- && !srv_is_being_started)
+ && srv_shutdown_state != SRV_SHUTDOWN_NONE)
&& (srv_fast_shutdown == 3 || trx == trx_roll_crash_recv_trx)) {
/* Shutdown has been initiated. */
trx->error_state = DB_INTERRUPTED;
diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c
index b8e71b1f7a9..7434f968383 100644
--- a/strings/ctype-utf8.c
+++ b/strings/ctype-utf8.c
@@ -4992,13 +4992,11 @@ static void my_hash_sort_utf8mb3_nopad(CHARSET_INFO *cs, const uchar *s, size_t
static void my_hash_sort_utf8mb3(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2)
{
- const uchar *e= s+slen;
/*
Remove end space. We have to do this to be able to compare
'A ' and 'A' as identical
*/
- while (e > s && e[-1] == ' ')
- e--;
+ const uchar *e= skip_trailing_space(s, slen);
my_hash_sort_utf8mb3_nopad(cs, s, e - s, nr1, nr2);
}
@@ -7436,13 +7434,11 @@ static void
my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen,
ulong *nr1, ulong *nr2)
{
- const uchar *e= s + slen;
/*
Remove end space. We do this to be able to compare
'A ' and 'A' as identical
*/
- while (e > s && e[-1] == ' ')
- e--;
+ const uchar *e= skip_trailing_space(s, slen);
my_hash_sort_utf8mb4_nopad(cs, s, e - s, nr1, nr2);
}