1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge 10.0 into 10.1

This commit is contained in:
Marko Mäkelä
2019-01-17 06:40:24 +02:00
25 changed files with 169 additions and 77 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 (not(((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 (not(((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 (not(((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 (not(((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

@@ -2121,6 +2121,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

@@ -4665,7 +4665,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 (not(<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>(isnull(NULL))))) having trigcond(<is_not_null_test>(NULL))))))) Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<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(<is_not_null_test>(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);
@@ -4681,7 +4681,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 (not(<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>(isnull(NULL))))) having trigcond(<is_not_null_test>(NULL))))))) Note 1003 select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where (not(<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(<is_not_null_test>(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

@@ -320,3 +320,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

@@ -300,3 +300,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

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

@@ -1470,6 +1470,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

@@ -282,8 +282,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

@@ -3793,6 +3793,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

@@ -3178,11 +3178,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));
@@ -3194,7 +3198,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

@@ -5813,19 +5813,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

@@ -1555,6 +1555,9 @@ struct buf_page_t{
by buf_pool->mutex. */ by buf_pool->mutex. */
ib_uint32_t offset; /*!< page number; also protected ib_uint32_t offset; /*!< page number; also protected
by buf_pool->mutex. */ by buf_pool->mutex. */
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;
@@ -1618,9 +1621,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

@@ -1034,8 +1034,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
@@ -1092,8 +1094,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

@@ -273,7 +273,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
@@ -329,8 +331,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
rw_lock_t latch; /*!< latch protecting the file space storage rw_lock_t latch; /*!< latch protecting the file space storage
allocation */ allocation */

View File

@@ -631,12 +631,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 { \
@@ -671,9 +673,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

@@ -192,7 +192,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 */
@@ -208,7 +207,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);
@@ -226,7 +224,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
@@ -779,7 +779,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;
@@ -874,11 +874,10 @@ 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

@@ -6368,19 +6368,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,11 +877,10 @@ 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);
} }
} }