Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä 2020-06-14 10:13:53 +03:00
commit 3dbc49f075
45 changed files with 523 additions and 132 deletions

View file

@ -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)

View file

@ -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.

View file

@ -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);
}

View file

@ -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)

View file

@ -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;
}
}

View file

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

View file

@ -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 */

View file

@ -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
#

View file

@ -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 #

View file

@ -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
#
#

View file

@ -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 #

View file

@ -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

View file

@ -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 #

View file

@ -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

View file

@ -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

View file

@ -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;

View file

@ -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;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -924,6 +924,24 @@ DROP TABLE t1;
# End of 10.1 tests
#
#
# 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
#
#

View file

@ -634,6 +634,24 @@ DROP TABLE t1;
--echo # End of 10.1 tests
--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 #

View file

@ -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
#
#

View file

@ -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

View file

@ -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
#
#

View file

@ -819,6 +819,15 @@ SELECT CAST(f1() AS TIME);
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 #

View file

@ -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
#

View file

@ -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

View file

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

View file

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

View file

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

View file

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

View file

@ -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)

View file

@ -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();

View file

@ -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

View file

@ -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; }

View file

@ -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.

View file

@ -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);

View file

@ -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,

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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,

View file

@ -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));
}

View file

@ -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 =

View file

@ -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;

View file

@ -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);
}