Merge 10.1 into 10.2

This commit is contained in:
Marko Mäkelä 2019-01-17 11:24:38 +02:00
commit 8e80fd6bfd
33 changed files with 254 additions and 108 deletions

View File

@ -330,7 +330,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings: Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
Note 1003 select (select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in ( <materialize> (select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), <primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` Note 1003 select (select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
1 1
@ -344,7 +344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings: Warnings:
Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2
Note 1003 select (select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in ( <materialize> (select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), <primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` Note 1003 select (select 1 from dual where !(1 is not null and <in_optimizer>(1,1 in (<primary_index_lookup>(1 in <temporary table> on distinct_key where 1 = `<subquery3>`.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1`
SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1;
( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )
1 1

View File

@ -2128,6 +2128,44 @@ select @advertAcctId as a from dual union all select 1.0 from dual;
a a
1000003.0 1000003.0
1.0 1.0
#
# MDEV-13784: query causes seg fault
#
CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL);
INSERT INTO t1 VALUES (45199,1184);
CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`));
INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582);
CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64));
CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255));
INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo');
CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64));
explain select
(
select login_name from t4 where userId = (
select userid from t2 where product_id = t1.product_id
union
select userid from t2 where product_id = (
select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
) as x from t1 where (t1.bug_id=45199);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
2 SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 func 1 Using where
3 SUBQUERY t2 ref PRIMARY PRIMARY 4 const 3 Using index
4 UNION t2 ref PRIMARY PRIMARY 4 func 1 Using where; Using index
5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
6 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
select
(
select login_name from t4 where userId = (
select userid from t2 where product_id = t1.product_id
union
select userid from t2 where product_id = (
select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
) as x from t1 where (t1.bug_id=45199);
x
foo
drop table t1, t2, t3, t4, t5;
End of 5.5 tests End of 5.5 tests
# #
# WL#1763 Avoid creating temporary table in UNION ALL # WL#1763 Avoid creating temporary table in UNION ALL

View File

@ -4669,7 +4669,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings: Warnings:
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or <cache>(NULL is null)) having trigcond(NULL is null)))) Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or 1) having trigcond(NULL is null))))
SELECT * FROM t1, t2 SELECT * FROM t1, t2
WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a)
WHERE t4.a >= t1.a); WHERE t4.a >= t1.a);
@ -4685,7 +4685,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings: Warnings:
Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1 Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1
Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or <cache>(NULL is null)) having trigcond(NULL is null)))) Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<expr_cache><10,`test`.`t1`.`a`>(<in_optimizer>(10,<exists>(select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond(<cache>(10) = NULL or 1) having trigcond(NULL is null))))
SELECT * FROM v1, t2 SELECT * FROM v1, t2
WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a)
WHERE t4.a >= v1.a); WHERE t4.a >= v1.a);

View File

@ -77,7 +77,6 @@ t2 CREATE TABLE `t2` (
`a` int(11) NOT NULL, `a` int(11) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4; CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options") ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
SHOW WARNINGS; SHOW WARNINGS;
@ -85,3 +84,30 @@ Level Code Message
Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1 Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options") Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
FLUSH TABLES;
create table t1(f1 int not null, f2 int not null)engine=innodb encrypted=yes;
insert into t1 values(1, 2), (2, 3), (4, 5), (5, 6), (7, 8);
insert into t1 select * from t1;
BEGIN;
INSERT INTO t2 VALUES (1);
connect con1, localhost, root;
SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL done WAIT_FOR ever';
alter table t1 force;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR done';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
COMMIT;
disconnect con1;
select * from t1;
f1 f2
1 2
2 3
4 5
5 6
7 8
1 2
2 3
4 5
5 6
7 8
drop table t1,t2;

View File

@ -1,13 +1,12 @@
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_debug.inc
-- source include/have_debug_sync.inc
-- source include/have_file_key_management_plugin.inc -- source include/have_file_key_management_plugin.inc
# #
# MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID # MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID
# #
let $encrypt_tables = `SELECT @@innodb_encrypt_tables`;
let $threads = `SELECT @@innodb_encryption_threads`;
SET GLOBAL innodb_encrypt_tables = ON; SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4; SET GLOBAL innodb_encryption_threads = 4;
@ -99,14 +98,35 @@ ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
SHOW WARNINGS; SHOW WARNINGS;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
DROP TABLE t2;
--error ER_CANT_CREATE_TABLE --error ER_CANT_CREATE_TABLE
CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4; CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
SHOW WARNINGS; SHOW WARNINGS;
# reset system FLUSH TABLES;
--disable_query_log
EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables; create table t1(f1 int not null, f2 int not null)engine=innodb encrypted=yes;
EVAL SET GLOBAL innodb_encryption_threads = $threads; insert into t1 values(1, 2), (2, 3), (4, 5), (5, 6), (7, 8);
--enable_query_log insert into t1 select * from t1;
BEGIN;
INSERT INTO t2 VALUES (1);
connect con1, localhost, root;
SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL done WAIT_FOR ever';
send alter table t1 force;
connection default;
SET DEBUG_SYNC = 'now WAIT_FOR done';
SET GLOBAL innodb_flush_log_at_trx_commit=1;
COMMIT;
--let $shutdown_timeout= 0
--source include/restart_mysqld.inc
disconnect con1;
select * from t1;
drop table t1,t2;
# Work around missing crash recovery at the SQL layer.
let $datadir= `select @@datadir`;
--remove_files_wildcard $datadir/test #sql-*.frm

View File

@ -150,6 +150,7 @@ connection node_3;
connection node_2; connection node_2;
STOP SLAVE; STOP SLAVE;
RESET SLAVE ALL; RESET SLAVE ALL;
set global gtid_slave_pos="";
reset master; reset master;
#Connection 3 #Connection 3
connection node_3; connection node_3;

View File

@ -196,6 +196,9 @@ DROP TABLE t2,t1;
--connection node_2 --connection node_2
STOP SLAVE; STOP SLAVE;
RESET SLAVE ALL; RESET SLAVE ALL;
--disable_warnings
set global gtid_slave_pos="";
--enable_warnings
reset master; reset master;
--echo #Connection 3 --echo #Connection 3

View File

@ -330,3 +330,18 @@ term uw_id plan wdraw_rsn admit_term
1035 2 CSM ACAD 1009 1035 2 CSM ACAD 1009
drop table grad_degree; drop table grad_degree;
drop table gso_grad_supr; drop table gso_grad_supr;
CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1,'foo');
SELECT * FROM t1;
a b c
1 foo 1
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1,'foo');
ALTER TABLE t1 ADD FULLTEXT KEY(b);
Warnings:
Warning 124 InnoDB rebuilding table to add column FTS_DOC_ID
SELECT * FROM t1;
a b c
1 foo 1
DROP TABLE t1;

View File

@ -306,3 +306,14 @@ select * from gso_grad_supr;
drop table grad_degree; drop table grad_degree;
drop table gso_grad_supr; drop table gso_grad_supr;
CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL, FULLTEXT KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1,'foo');
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a INT, b CHAR(12), c INT AS (a) VIRTUAL) ENGINE=InnoDB;
INSERT INTO t1 (a,b) VALUES (1,'foo');
ALTER TABLE t1 ADD FULLTEXT KEY(b);
SELECT * FROM t1;
DROP TABLE t1;

View File

@ -3938,7 +3938,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of cached table definitions VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400 NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 524288 NUMERIC_MAX_VALUE 2097152
NUMERIC_BLOCK_SIZE 1 NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO

View File

@ -4722,7 +4722,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The number of cached table definitions VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400 NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 524288 NUMERIC_MAX_VALUE 2097152
NUMERIC_BLOCK_SIZE 1 NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL ENUM_VALUE_LIST NULL
READ_ONLY NO READ_ONLY NO

View File

@ -28,14 +28,14 @@ Warning 1292 Truncated incorrect table_definition_cache value: '2'
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
400 400
SET @@global.table_definition_cache = 524287; SET @@global.table_definition_cache = 2097151;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
524287 2097151
SET @@global.table_definition_cache = 524288; SET @@global.table_definition_cache = 2097152;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
524288 2097152
'#--------------------FN_DYNVARS_019_04-------------------------#' '#--------------------FN_DYNVARS_019_04-------------------------#'
SET @@global.table_definition_cache = 0; SET @@global.table_definition_cache = 0;
Warnings: Warnings:
@ -49,18 +49,18 @@ Warning 1292 Truncated incorrect table_definition_cache value: '-1024'
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
400 400
SET @@global.table_definition_cache = 524289; SET @@global.table_definition_cache = 2097153;
Warnings: Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '524289' Warning 1292 Truncated incorrect table_definition_cache value: '2097153'
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
524288 2097152
SET @@global.table_definition_cache = 42949672950; SET @@global.table_definition_cache = 42949672950;
Warnings: Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '42949672950' Warning 1292 Truncated incorrect table_definition_cache value: '42949672950'
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
524288 2097152
SET @@global.table_definition_cache = 21221204.10; SET @@global.table_definition_cache = 21221204.10;
ERROR 42000: Incorrect argument type to variable 'table_definition_cache' ERROR 42000: Incorrect argument type to variable 'table_definition_cache'
SET @@global.table_definition_cache = ON; SET @@global.table_definition_cache = ON;

View File

@ -64,9 +64,9 @@ SET @@global.table_definition_cache = 1;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 2; SET @@global.table_definition_cache = 2;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 524287; SET @@global.table_definition_cache = 2097151;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 524288; SET @@global.table_definition_cache = 2097152;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@ -79,7 +79,7 @@ SET @@global.table_definition_cache = 0;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = -1024; SET @@global.table_definition_cache = -1024;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 524289; SET @@global.table_definition_cache = 2097153;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 42949672950; SET @@global.table_definition_cache = 42949672950;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;

View File

@ -1469,6 +1469,41 @@ eval SET NAMES $old_charset;
SET @advertAcctId = 1000003; SET @advertAcctId = 1000003;
select @advertAcctId as a from dual union all select 1.0 from dual; select @advertAcctId as a from dual union all select 1.0 from dual;
--echo #
--echo # MDEV-13784: query causes seg fault
--echo #
CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL);
INSERT INTO t1 VALUES (45199,1184);
CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`));
INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582);
CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64));
CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255));
INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo');
CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64));
explain select
(
select login_name from t4 where userId = (
select userid from t2 where product_id = t1.product_id
union
select userid from t2 where product_id = (
select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
) as x from t1 where (t1.bug_id=45199);
select
(
select login_name from t4 where userId = (
select userid from t2 where product_id = t1.product_id
union
select userid from t2 where product_id = (
select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 )
) as x from t1 where (t1.bug_id=45199);
drop table t1, t2, t3, t4, t5;
--echo End of 5.5 tests --echo End of 5.5 tests
--echo # --echo #

View File

@ -285,8 +285,8 @@ static void warn(const char *format,...)
va_list args; va_list args;
DBUG_PRINT("error", ("%s", format)); DBUG_PRINT("error", ("%s", format));
va_start(args,format); va_start(args,format);
fflush(stderr);
vfprintf(stderr, format, args); vfprintf(stderr, format, args);
fflush(stderr);
va_end(args); va_end(args);
#ifdef HAVE_BACKTRACE #ifdef HAVE_BACKTRACE

View File

@ -1405,6 +1405,7 @@ void THD::cleanup(void)
auto_inc_intervals_in_cur_stmt_for_binlog.empty(); auto_inc_intervals_in_cur_stmt_for_binlog.empty();
mysql_ull_cleanup(this); mysql_ull_cleanup(this);
stmt_map.reset();
/* All metadata locks must have been released by now. */ /* All metadata locks must have been released by now. */
DBUG_ASSERT(!mdl_context.has_locks()); DBUG_ASSERT(!mdl_context.has_locks());
@ -3740,11 +3741,13 @@ void Statement_map::erase(Statement *statement)
void Statement_map::reset() void Statement_map::reset()
{ {
/* Must be first, hash_free will reset st_hash.records */ /* Must be first, hash_free will reset st_hash.records */
mysql_mutex_lock(&LOCK_prepared_stmt_count); if (st_hash.records)
DBUG_ASSERT(prepared_stmt_count >= st_hash.records); {
prepared_stmt_count-= st_hash.records; mysql_mutex_lock(&LOCK_prepared_stmt_count);
mysql_mutex_unlock(&LOCK_prepared_stmt_count); DBUG_ASSERT(prepared_stmt_count >= st_hash.records);
prepared_stmt_count-= st_hash.records;
mysql_mutex_unlock(&LOCK_prepared_stmt_count);
}
my_hash_reset(&names_hash); my_hash_reset(&names_hash);
my_hash_reset(&st_hash); my_hash_reset(&st_hash);
last_found_statement= 0; last_found_statement= 0;
@ -3753,12 +3756,8 @@ void Statement_map::reset()
Statement_map::~Statement_map() Statement_map::~Statement_map()
{ {
/* Must go first, hash_free will reset st_hash.records */ /* Statement_map::reset() should be called prior to destructor. */
mysql_mutex_lock(&LOCK_prepared_stmt_count); DBUG_ASSERT(!st_hash.records);
DBUG_ASSERT(prepared_stmt_count >= st_hash.records);
prepared_stmt_count-= st_hash.records;
mysql_mutex_unlock(&LOCK_prepared_stmt_count);
my_hash_free(&names_hash); my_hash_free(&names_hash);
my_hash_free(&st_hash); my_hash_free(&st_hash);
} }

View File

@ -3857,6 +3857,7 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
inner_join->select_options|= SELECT_DESCRIBE; inner_join->select_options|= SELECT_DESCRIBE;
} }
res= inner_join->optimize(); res= inner_join->optimize();
sl->update_used_tables();
sl->update_correlated_cache(); sl->update_correlated_cache();
is_correlated_unit|= sl->is_correlated; is_correlated_unit|= sl->is_correlated;
inner_join->select_options= save_options; inner_join->select_options= save_options;

View File

@ -3229,11 +3229,15 @@ static Sys_var_charptr Sys_system_time_zone(
CMD_LINE_HELP_ONLY, CMD_LINE_HELP_ONLY,
IN_SYSTEM_CHARSET, DEFAULT(system_time_zone)); IN_SYSTEM_CHARSET, DEFAULT(system_time_zone));
/*
If One use views with prepared statements this should be bigger than
table_open_cache (now we allow 2 times bigger value)
*/
static Sys_var_ulong Sys_table_def_size( static Sys_var_ulong Sys_table_def_size(
"table_definition_cache", "table_definition_cache",
"The number of cached table definitions", "The number of cached table definitions",
GLOBAL_VAR(tdc_size), CMD_LINE(REQUIRED_ARG), GLOBAL_VAR(tdc_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(TABLE_DEF_CACHE_MIN, 512*1024), VALID_RANGE(TABLE_DEF_CACHE_MIN, 2*1024*1024),
DEFAULT(TABLE_DEF_CACHE_DEFAULT), BLOCK_SIZE(1)); DEFAULT(TABLE_DEF_CACHE_DEFAULT), BLOCK_SIZE(1));
@ -3245,7 +3249,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type)
return false; return false;
} }
/* Check the table_definition_cache comment if makes changes */
static Sys_var_ulong Sys_table_cache_size( static Sys_var_ulong Sys_table_cache_size(
"table_open_cache", "The number of cached open tables", "table_open_cache", "The number of cached open tables",
GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG), GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG),

View File

@ -496,10 +496,12 @@ fil_parse_write_crypt_data(
uint len = mach_read_from_1(ptr); uint len = mach_read_from_1(ptr);
ptr += 1; ptr += 1;
ut_a(type == CRYPT_SCHEME_UNENCRYPTED || if ((type != CRYPT_SCHEME_1 && type != CRYPT_SCHEME_UNENCRYPTED)
type == CRYPT_SCHEME_1); // only supported || len != CRYPT_SCHEME_1_IV_LEN) {
*err = DB_CORRUPTION;
return NULL;
}
ut_a(len == CRYPT_SCHEME_1_IV_LEN); // only supported
uint min_key_version = mach_read_from_4(ptr); uint min_key_version = mach_read_from_4(ptr);
ptr += 4; ptr += 4;
@ -518,6 +520,7 @@ fil_parse_write_crypt_data(
crypt_data->page0_offset = offset; crypt_data->page0_offset = offset;
crypt_data->min_key_version = min_key_version; crypt_data->min_key_version = min_key_version;
crypt_data->encryption = encryption; crypt_data->encryption = encryption;
crypt_data->type = type;
memcpy(crypt_data->iv, ptr, len); memcpy(crypt_data->iv, ptr, len);
ptr += len; ptr += len;
@ -2370,7 +2373,7 @@ fil_space_crypt_close_tablespace(
{ {
fil_space_crypt_t* crypt_data = space->crypt_data; fil_space_crypt_t* crypt_data = space->crypt_data;
if (!crypt_data) { if (!crypt_data || srv_n_fil_crypt_threads == 0) {
return; return;
} }

View File

@ -1489,6 +1489,9 @@ public:
/** Page id. Protected by buf_pool mutex. */ /** Page id. Protected by buf_pool mutex. */
page_id_t id; page_id_t id;
buf_page_t* hash; /*!< node used in chaining to
buf_pool->page_hash or
buf_pool->zip_hash */
/** Page size. Protected by buf_pool mutex. */ /** Page size. Protected by buf_pool mutex. */
page_size_t size; page_size_t size;
@ -1536,9 +1539,6 @@ public:
buf_tmp_buffer_t* slot; /*!< Slot for temporary memory buf_tmp_buffer_t* slot; /*!< Slot for temporary memory
used for encryption/compression used for encryption/compression
or NULL */ or NULL */
buf_page_t* hash; /*!< node used in chaining to
buf_pool->page_hash or
buf_pool->zip_hash */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ibool in_page_hash; /*!< TRUE if in buf_pool->page_hash */ ibool in_page_hash; /*!< TRUE if in buf_pool->page_hash */
ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */ ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */

View File

@ -1411,6 +1411,12 @@ struct dict_table_t {
/** Id of the table. */ /** Id of the table. */
table_id_t id; table_id_t id;
/** Hash chain node. */
hash_node_t id_hash;
/** Table name. */
table_name_t name;
/** Hash chain node. */
hash_node_t name_hash;
/** Memory heap. If you allocate from this heap after the table has /** Memory heap. If you allocate from this heap after the table has
been created then be sure to account the allocation into been created then be sure to account the allocation into
@ -1423,9 +1429,6 @@ struct dict_table_t {
dict_sys->size += new_size - old_size. */ dict_sys->size += new_size - old_size. */
mem_heap_t* heap; mem_heap_t* heap;
/** Table name. */
table_name_t name;
/** NULL or the directory path specified by DATA DIRECTORY. */ /** NULL or the directory path specified by DATA DIRECTORY. */
char* data_dir_path; char* data_dir_path;
@ -1538,12 +1541,6 @@ struct dict_table_t {
/*!< !DICT_FRM_CONSISTENT==0 if data /*!< !DICT_FRM_CONSISTENT==0 if data
dictionary information and dictionary information and
MySQL FRM information mismatch. */ MySQL FRM information mismatch. */
/** Hash chain node. */
hash_node_t name_hash;
/** Hash chain node. */
hash_node_t id_hash;
/** The FTS_DOC_ID_INDEX, or NULL if no fulltext indexes exist */ /** The FTS_DOC_ID_INDEX, or NULL if no fulltext indexes exist */
dict_index_t* fts_doc_id_index; dict_index_t* fts_doc_id_index;

View File

@ -79,8 +79,10 @@ struct fil_node_t;
/** Tablespace or log data space */ /** Tablespace or log data space */
struct fil_space_t { struct fil_space_t {
char* name; /*!< Tablespace name */
ulint id; /*!< space id */ ulint id; /*!< space id */
hash_node_t hash; /*!< hash chain node */
char* name; /*!< Tablespace name */
hash_node_t name_hash;/*!< hash chain the name_hash table */
lsn_t max_lsn; lsn_t max_lsn;
/*!< LSN of the most recent /*!< LSN of the most recent
fil_names_write_if_was_clean(). fil_names_write_if_was_clean().
@ -149,8 +151,6 @@ struct fil_space_t {
Note that fil_node_t::n_pending tracks actual pending I/O requests. Note that fil_node_t::n_pending tracks actual pending I/O requests.
Protected by fil_system->mutex. */ Protected by fil_system->mutex. */
ulint n_pending_ios; ulint n_pending_ios;
hash_node_t hash; /*!< hash chain node */
hash_node_t name_hash;/*!< hash chain the name_hash table */
rw_lock_t latch; /*!< latch protecting the file space storage rw_lock_t latch; /*!< latch protecting the file space storage
allocation */ allocation */
UT_LIST_NODE_T(fil_space_t) unflushed_spaces; UT_LIST_NODE_T(fil_space_t) unflushed_spaces;

View File

@ -623,12 +623,14 @@ typedef void* os_thread_ret_t;
#include "ut0ut.h" #include "ut0ut.h"
#include "sync0types.h" #include "sync0types.h"
#include <my_valgrind.h>
/* define UNIV macros in terms of my_valgrind.h */
#define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size)
#define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size)
#define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size)
#ifdef UNIV_DEBUG_VALGRIND #ifdef UNIV_DEBUG_VALGRIND
# include <valgrind/memcheck.h> # include <valgrind/memcheck.h>
# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size) # define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size)
# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size)
# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
# define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr) # define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr)
# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b) # define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \ # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \
@ -663,9 +665,6 @@ typedef void* os_thread_ret_t;
} while (0) } while (0)
#else #else
# define UNIV_MEM_VALID(addr, size) do {} while(0) # define UNIV_MEM_VALID(addr, size) do {} while(0)
# define UNIV_MEM_INVALID(addr, size) do {} while(0)
# define UNIV_MEM_FREE(addr, size) do {} while(0)
# define UNIV_MEM_ALLOC(addr, size) do {} while(0)
# define UNIV_MEM_DESC(addr, size) do {} while(0) # define UNIV_MEM_DESC(addr, size) do {} while(0)
# define UNIV_MEM_UNDESC(b) do {} while(0) # define UNIV_MEM_UNDESC(b) do {} while(0)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0) # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0)

View File

@ -165,7 +165,6 @@ os_mem_free_large(
if (os_use_large_pages && os_large_page_size && !shmdt(ptr)) { if (os_use_large_pages && os_large_page_size && !shmdt(ptr)) {
my_atomic_addlint( my_atomic_addlint(
&os_total_large_mem_allocated, -size); &os_total_large_mem_allocated, -size);
UNIV_MEM_FREE(ptr, size);
return; return;
} }
#endif /* HAVE_LINUX_LARGE_PAGES && UNIV_LINUX */ #endif /* HAVE_LINUX_LARGE_PAGES && UNIV_LINUX */
@ -178,7 +177,6 @@ os_mem_free_large(
} else { } else {
my_atomic_addlint( my_atomic_addlint(
&os_total_large_mem_allocated, -lint(size)); &os_total_large_mem_allocated, -lint(size));
UNIV_MEM_FREE(ptr, size);
} }
#elif !defined OS_MAP_ANON #elif !defined OS_MAP_ANON
ut_free(ptr); ut_free(ptr);
@ -193,7 +191,6 @@ os_mem_free_large(
} else { } else {
my_atomic_addlint( my_atomic_addlint(
&os_total_large_mem_allocated, -size); &os_total_large_mem_allocated, -size);
UNIV_MEM_FREE(ptr, size);
} }
#endif #endif
} }

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation. Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@ -907,7 +907,7 @@ loop:
goto func_exit; goto func_exit;
} }
UNIV_MEM_INVALID(block[t_ctx.buf_used][0], srv_sort_buf_size); UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size);
buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]); buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]);
mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used]; mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used];
t_ctx.rows_added[t_ctx.buf_used] = 0; t_ctx.rows_added[t_ctx.buf_used] = 0;
@ -1001,12 +1001,11 @@ exit:
goto func_exit; goto func_exit;
} }
UNIV_MEM_INVALID(block[i][0], UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
srv_sort_buf_size);
if (crypt_block[i]) { if (crypt_block[i]) {
UNIV_MEM_INVALID(crypt_block[i][0], UNIV_MEM_INVALID(crypt_block[i],
srv_sort_buf_size); srv_sort_buf_size);
} }
} }

View File

@ -529,10 +529,12 @@ fil_parse_write_crypt_data(
size_t len = mach_read_from_1(ptr); size_t len = mach_read_from_1(ptr);
ptr += 1; ptr += 1;
ut_a(type == CRYPT_SCHEME_UNENCRYPTED || if ((type != CRYPT_SCHEME_1 && type != CRYPT_SCHEME_UNENCRYPTED)
type == CRYPT_SCHEME_1); // only supported || len != CRYPT_SCHEME_1_IV_LEN) {
*err = DB_CORRUPTION;
return NULL;
}
ut_a(len == CRYPT_SCHEME_1_IV_LEN); // only supported
uint min_key_version = mach_read_from_4(ptr); uint min_key_version = mach_read_from_4(ptr);
ptr += 4; ptr += 4;
@ -551,6 +553,7 @@ fil_parse_write_crypt_data(
crypt_data->page0_offset = offset; crypt_data->page0_offset = offset;
crypt_data->min_key_version = min_key_version; crypt_data->min_key_version = min_key_version;
crypt_data->encryption = encryption; crypt_data->encryption = encryption;
crypt_data->type = type;
memcpy(crypt_data->iv, ptr, len); memcpy(crypt_data->iv, ptr, len);
ptr += len; ptr += len;
@ -2413,7 +2416,8 @@ void
fil_space_crypt_close_tablespace( fil_space_crypt_close_tablespace(
const fil_space_t* space) const fil_space_t* space)
{ {
if (!srv_encrypt_tables || !space->crypt_data) { if (!srv_encrypt_tables || !space->crypt_data
|| srv_n_fil_crypt_threads == 0) {
return; return;
} }

View File

@ -6334,19 +6334,18 @@ ha_innobase::open(
ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err); ib_table = dict_table_open_on_name(norm_name, FALSE, TRUE, ignore_err);
if (ib_table if (ib_table
&& ((!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID) && (table->s->stored_fields != dict_table_get_n_user_cols(ib_table)
&& table->s->stored_fields != dict_table_get_n_user_cols(ib_table)) - !!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID))) {
|| (DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID)
&& (table->s->fields
!= dict_table_get_n_user_cols(ib_table) - 1)))) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
"table %s contains " ULINTPF " user defined columns " "table %s contains " ULINTPF " user defined columns "
"in InnoDB, but %u columns in MySQL. Please " "in InnoDB, but %u columns in MySQL. Please "
"check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and " "check INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and "
REFMAN "innodb-troubleshooting.html " REFMAN "innodb-troubleshooting.html "
"for how to resolve it", "for how to resolve it",
norm_name, dict_table_get_n_user_cols(ib_table), norm_name, dict_table_get_n_user_cols(ib_table)
table->s->fields); - !!DICT_TF2_FLAG_IS_SET(ib_table,
DICT_TF2_FTS_HAS_DOC_ID),
table->s->stored_fields);
/* Mark this table as corrupted, so the drop table /* Mark this table as corrupted, so the drop table
or force recovery can still use it, but not others. */ or force recovery can still use it, but not others. */

View File

@ -1576,6 +1576,9 @@ struct buf_page_t{
ib_uint32_t space; /*!< tablespace id. */ ib_uint32_t space; /*!< tablespace id. */
ib_uint32_t offset; /*!< page number. */ ib_uint32_t offset; /*!< page number. */
buf_page_t* hash; /*!< node used in chaining to
buf_pool->page_hash or
buf_pool->zip_hash */
/** count of how manyfold this block is currently bufferfixed */ /** count of how manyfold this block is currently bufferfixed */
#ifdef PAGE_ATOMIC_REF_COUNT #ifdef PAGE_ATOMIC_REF_COUNT
ib_uint32_t buf_fix_count; ib_uint32_t buf_fix_count;
@ -1646,9 +1649,6 @@ struct buf_page_t{
used for encryption/compression used for encryption/compression
or NULL */ or NULL */
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
buf_page_t* hash; /*!< node used in chaining to
buf_pool->page_hash or
buf_pool->zip_hash */
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
ibool in_page_hash; /*!< TRUE if in buf_pool->page_hash */ ibool in_page_hash; /*!< TRUE if in buf_pool->page_hash */
ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */ ibool in_zip_hash; /*!< TRUE if in buf_pool->zip_hash */

View File

@ -1050,8 +1050,10 @@ struct dict_table_t{
table_id_t id; /*!< id of the table */ table_id_t id; /*!< id of the table */
hash_node_t id_hash; /*!< hash chain node */
mem_heap_t* heap; /*!< memory heap */ mem_heap_t* heap; /*!< memory heap */
char* name; /*!< table name */ char* name; /*!< table name */
hash_node_t name_hash; /*!< hash chain node */
const char* dir_path_of_temp_table;/*!< NULL or the directory path const char* dir_path_of_temp_table;/*!< NULL or the directory path
where a TEMPORARY table that was explicitly where a TEMPORARY table that was explicitly
created by a user should be placed if created by a user should be placed if
@ -1109,8 +1111,6 @@ struct dict_table_t{
dictionary information and dictionary information and
MySQL FRM information mismatch. */ MySQL FRM information mismatch. */
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
hash_node_t name_hash; /*!< hash chain node */
hash_node_t id_hash; /*!< hash chain node */
UT_LIST_BASE_NODE_T(dict_index_t) UT_LIST_BASE_NODE_T(dict_index_t)
indexes; /*!< list of indexes of the table */ indexes; /*!< list of indexes of the table */

View File

@ -267,7 +267,9 @@ struct fil_node_t {
struct fil_space_t { struct fil_space_t {
char* name; /*!< space name = the path to the first file in char* name; /*!< space name = the path to the first file in
it */ it */
hash_node_t name_hash;/*!< hash chain the name_hash table */
ulint id; /*!< space id */ ulint id; /*!< space id */
hash_node_t hash; /*!< hash chain node */
ib_int64_t tablespace_version; ib_int64_t tablespace_version;
/*!< in DISCARD/IMPORT this timestamp /*!< in DISCARD/IMPORT this timestamp
is used to check if we should ignore is used to check if we should ignore
@ -323,8 +325,6 @@ struct fil_space_t {
Note that fil_node_t::n_pending tracks actual pending I/O requests. Note that fil_node_t::n_pending tracks actual pending I/O requests.
Protected by fil_system->mutex. */ Protected by fil_system->mutex. */
ulint n_pending_ios; ulint n_pending_ios;
hash_node_t hash; /*!< hash chain node */
hash_node_t name_hash;/*!< hash chain the name_hash table */
#ifndef UNIV_HOTBACKUP #ifndef UNIV_HOTBACKUP
prio_rw_lock_t latch; /*!< latch protecting the file space storage prio_rw_lock_t latch; /*!< latch protecting the file space storage
allocation */ allocation */

View File

@ -645,12 +645,14 @@ typedef void* os_thread_ret_t;
#include "ut0dbg.h" #include "ut0dbg.h"
#include "ut0ut.h" #include "ut0ut.h"
#include "db0err.h" #include "db0err.h"
#include <my_valgrind.h>
/* define UNIV macros in terms of my_valgrind.h */
#define UNIV_MEM_INVALID(addr, size) MEM_UNDEFINED(addr, size)
#define UNIV_MEM_FREE(addr, size) MEM_NOACCESS(addr, size)
#define UNIV_MEM_ALLOC(addr, size) UNIV_MEM_INVALID(addr, size)
#ifdef UNIV_DEBUG_VALGRIND #ifdef UNIV_DEBUG_VALGRIND
# include <valgrind/memcheck.h> # include <valgrind/memcheck.h>
# define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size) # define UNIV_MEM_VALID(addr, size) VALGRIND_MAKE_MEM_DEFINED(addr, size)
# define UNIV_MEM_INVALID(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
# define UNIV_MEM_FREE(addr, size) VALGRIND_MAKE_MEM_NOACCESS(addr, size)
# define UNIV_MEM_ALLOC(addr, size) VALGRIND_MAKE_MEM_UNDEFINED(addr, size)
# define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr) # define UNIV_MEM_DESC(addr, size) VALGRIND_CREATE_BLOCK(addr, size, #addr)
# define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b) # define UNIV_MEM_UNDESC(b) VALGRIND_DISCARD(b)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \ # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do { \
@ -685,9 +687,6 @@ typedef void* os_thread_ret_t;
} while (0) } while (0)
#else #else
# define UNIV_MEM_VALID(addr, size) do {} while(0) # define UNIV_MEM_VALID(addr, size) do {} while(0)
# define UNIV_MEM_INVALID(addr, size) do {} while(0)
# define UNIV_MEM_FREE(addr, size) do {} while(0)
# define UNIV_MEM_ALLOC(addr, size) do {} while(0)
# define UNIV_MEM_DESC(addr, size) do {} while(0) # define UNIV_MEM_DESC(addr, size) do {} while(0)
# define UNIV_MEM_UNDESC(b) do {} while(0) # define UNIV_MEM_UNDESC(b) do {} while(0)
# define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0) # define UNIV_MEM_ASSERT_RW_LOW(addr, size, should_abort) do {} while(0)

View File

@ -247,7 +247,6 @@ os_mem_free_large(
ut_a(ut_total_allocated_memory >= size); ut_a(ut_total_allocated_memory >= size);
ut_total_allocated_memory -= size; ut_total_allocated_memory -= size;
os_fast_mutex_unlock(&ut_list_mutex); os_fast_mutex_unlock(&ut_list_mutex);
UNIV_MEM_FREE(ptr, size);
return; return;
} }
#endif /* HAVE_LARGE_PAGES && UNIV_LINUX */ #endif /* HAVE_LARGE_PAGES && UNIV_LINUX */
@ -263,7 +262,6 @@ os_mem_free_large(
ut_a(ut_total_allocated_memory >= size); ut_a(ut_total_allocated_memory >= size);
ut_total_allocated_memory -= size; ut_total_allocated_memory -= size;
os_fast_mutex_unlock(&ut_list_mutex); os_fast_mutex_unlock(&ut_list_mutex);
UNIV_MEM_FREE(ptr, size);
} }
#elif !defined OS_MAP_ANON #elif !defined OS_MAP_ANON
ut_free(ptr); ut_free(ptr);
@ -281,7 +279,6 @@ os_mem_free_large(
ut_a(ut_total_allocated_memory >= size); ut_a(ut_total_allocated_memory >= size);
ut_total_allocated_memory -= size; ut_total_allocated_memory -= size;
os_fast_mutex_unlock(&ut_list_mutex); os_fast_mutex_unlock(&ut_list_mutex);
UNIV_MEM_FREE(ptr, size);
} }
#endif #endif
} }

View File

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2018, MariaDB Corporation. Copyright (c) 2015, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the Free Software the terms of the GNU General Public License as published by the Free Software
@ -782,7 +782,7 @@ loop:
goto func_exit; goto func_exit;
} }
UNIV_MEM_INVALID(block[t_ctx.buf_used][0], srv_sort_buf_size); UNIV_MEM_INVALID(block[t_ctx.buf_used], srv_sort_buf_size);
buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]); buf[t_ctx.buf_used] = row_merge_buf_empty(buf[t_ctx.buf_used]);
mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used]; mycount[t_ctx.buf_used] += t_ctx.rows_added[t_ctx.buf_used];
t_ctx.rows_added[t_ctx.buf_used] = 0; t_ctx.rows_added[t_ctx.buf_used] = 0;
@ -877,12 +877,11 @@ exit:
goto func_exit; goto func_exit;
} }
UNIV_MEM_INVALID(block[i][0], UNIV_MEM_INVALID(block[i], srv_sort_buf_size);
srv_sort_buf_size);
if (crypt_block[i]) { if (crypt_block[i]) {
UNIV_MEM_INVALID(crypt_block[i][0], UNIV_MEM_INVALID(crypt_block[i],
srv_sort_buf_size); srv_sort_buf_size);
} }
} }