1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.2 into 10.3

This commit is contained in:
Marko Mäkelä
2019-11-06 13:14:31 +02:00
24 changed files with 400 additions and 110 deletions

View File

@@ -478,7 +478,7 @@ struct datafile_cur_t {
{ {
memset(rel_path, 0, sizeof rel_path); memset(rel_path, 0, sizeof rel_path);
if (filename) { if (filename) {
strncpy(abs_path, filename, sizeof abs_path); strncpy(abs_path, filename, sizeof abs_path - 1);
abs_path[(sizeof abs_path) - 1] = 0; abs_path[(sizeof abs_path) - 1] = 0;
} else { } else {
abs_path[0] = '\0'; abs_path[0] = '\0';

View File

@@ -390,7 +390,7 @@ log_online_setup_bitmap_file_range(
bitmap_files->files[array_pos].seq_num = file_seq_num; bitmap_files->files[array_pos].seq_num = file_seq_num;
strncpy(bitmap_files->files[array_pos].name, strncpy(bitmap_files->files[array_pos].name,
bitmap_dir_file_info.name, FN_REFLEN); bitmap_dir_file_info.name, FN_REFLEN - 1);
bitmap_files->files[array_pos].name[FN_REFLEN - 1] bitmap_files->files[array_pos].name[FN_REFLEN - 1]
= '\0'; = '\0';
bitmap_files->files[array_pos].start_lsn bitmap_files->files[array_pos].start_lsn

View File

@@ -246,7 +246,7 @@ int hp_panic(enum ha_panic_function flag);
int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key, int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
key_part_map keypart_map, enum ha_rkey_function find_flag); key_part_map keypart_map, enum ha_rkey_function find_flag);
extern uchar * heap_find(HP_INFO *info,int inx,const uchar *key); extern uchar * heap_find(HP_INFO *info,int inx,const uchar *key);
extern int heap_check_heap(HP_INFO *info, my_bool print_status); extern int heap_check_heap(const HP_INFO *info, my_bool print_status);
extern uchar *heap_position(HP_INFO *info); extern uchar *heap_position(HP_INFO *info);
/* The following is for programs that uses the old HEAP interface where /* The following is for programs that uses the old HEAP interface where

View File

@@ -1758,5 +1758,62 @@ a
1991 1991
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-20424: New default value for optimizer_use_condition-selectivity
# leads to bad plan
#
create table t1(a int, b int, c int, d int, key(a,b));
insert into t1 select 50,seq-1,seq-1,seq from seq_1_to_10;
insert into t1 select seq-1,seq-1,seq-1,seq from seq_1_to_100 limit 90;
create table t2(a int, b int, c int, primary key(a));
insert into t2 select seq-1,seq-1,seq-1 from seq_1_to_100;
create table t3(a int, b int, c int, primary key(a));
insert into t3 select seq-1,seq-1,seq-1 from seq_1_to_100 limit 30;
set optimizer_use_condition_selectivity=1;
explain extended select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 10 NULL 9 100.00 Using index condition; Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.d 1 100.00
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`c` and `test`.`t3`.`a` = `test`.`t1`.`d` and `test`.`t1`.`a` = 50 and `test`.`t1`.`b` <= 100
select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
b a a b
0 0 1 1
1 1 2 2
2 2 3 3
3 3 4 4
4 4 5 5
5 5 6 6
6 6 7 7
7 7 8 8
8 8 9 9
9 9 10 10
set optimizer_use_condition_selectivity=2;
explain extended select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 10 NULL 9 9.00 Using index condition; Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.d 1 100.00
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`c` and `test`.`t3`.`a` = `test`.`t1`.`d` and `test`.`t1`.`a` = 50 and `test`.`t1`.`b` <= 100
select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
b a a b
0 0 1 1
1 1 2 2
2 2 3 3
3 3 4 4
4 4 5 5
5 5 6 6
6 6 7 7
7 7 8 8
8 8 9 9
9 9 10 10
set optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
drop table t1,t2,t3;
# End of 10.1 tests # End of 10.1 tests
set @@global.histogram_size=@save_histogram_size; set @@global.histogram_size=@save_histogram_size;

View File

@@ -1211,6 +1211,35 @@ set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivit
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-20424: New default value for optimizer_use_condition-selectivity
--echo # leads to bad plan
--echo #
create table t1(a int, b int, c int, d int, key(a,b));
insert into t1 select 50,seq-1,seq-1,seq from seq_1_to_10;
insert into t1 select seq-1,seq-1,seq-1,seq from seq_1_to_100 limit 90;
create table t2(a int, b int, c int, primary key(a));
insert into t2 select seq-1,seq-1,seq-1 from seq_1_to_100;
create table t3(a int, b int, c int, primary key(a));
insert into t3 select seq-1,seq-1,seq-1 from seq_1_to_100 limit 30;
let $query= select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
set optimizer_use_condition_selectivity=1;
eval explain extended $query;
eval $query;
set optimizer_use_condition_selectivity=2;
eval explain extended $query;
eval $query;
set optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
drop table t1,t2,t3;
--echo # End of 10.1 tests --echo # End of 10.1 tests
# #

View File

@@ -1768,6 +1768,63 @@ a
1991 1991
set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-20424: New default value for optimizer_use_condition-selectivity
# leads to bad plan
#
create table t1(a int, b int, c int, d int, key(a,b));
insert into t1 select 50,seq-1,seq-1,seq from seq_1_to_10;
insert into t1 select seq-1,seq-1,seq-1,seq from seq_1_to_100 limit 90;
create table t2(a int, b int, c int, primary key(a));
insert into t2 select seq-1,seq-1,seq-1 from seq_1_to_100;
create table t3(a int, b int, c int, primary key(a));
insert into t3 select seq-1,seq-1,seq-1 from seq_1_to_100 limit 30;
set optimizer_use_condition_selectivity=1;
explain extended select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 10 NULL 11 100.00 Using index condition; Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.d 1 100.00
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`c` and `test`.`t3`.`a` = `test`.`t1`.`d` and `test`.`t1`.`a` = 50 and `test`.`t1`.`b` <= 100
select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
b a a b
0 0 1 1
1 1 2 2
2 2 3 3
3 3 4 4
4 4 5 5
5 5 6 6
6 6 7 7
7 7 8 8
8 8 9 9
9 9 10 10
set optimizer_use_condition_selectivity=2;
explain extended select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range a a 10 NULL 11 11.00 Using index condition; Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t1.d 1 100.00
1 SIMPLE t2 eq_ref PRIMARY PRIMARY 4 test.t1.c 1 100.00 Using index
Warnings:
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a` = `test`.`t1`.`c` and `test`.`t3`.`a` = `test`.`t1`.`d` and `test`.`t1`.`a` = 50 and `test`.`t1`.`b` <= 100
select t1.b,t2.a,t3.a,t3.b from t1,t2,t3
where t1.c = t2.a AND t1.d = t3.a and t1.a = 50 and t1.b <= 100;
b a a b
0 0 1 1
1 1 2 2
2 2 3 3
3 3 4 4
4 4 5 5
5 5 6 6
6 6 7 7
7 7 8 8
8 8 9 9
9 9 10 10
set optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
drop table t1,t2,t3;
# End of 10.1 tests # End of 10.1 tests
set @@global.histogram_size=@save_histogram_size; set @@global.histogram_size=@save_histogram_size;
set optimizer_switch=@save_optimizer_switch_for_selectivity_test; set optimizer_switch=@save_optimizer_switch_for_selectivity_test;

View File

@@ -22,4 +22,5 @@ check table t1;
Table Op Msg_type Msg_text Table Op Msg_type Msg_text
test.t1 check Warning InnoDB: Index 'b' contains #### entries, should be 4096. test.t1 check Warning InnoDB: Index 'b' contains #### entries, should be 4096.
test.t1 check error Corrupt test.t1 check error Corrupt
SET GLOBAL innodb_fast_shutdown=0;
DROP TABLE t1; DROP TABLE t1;

View File

@@ -42,15 +42,43 @@ INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1;
INSERT INTO t1 SELECT 0,b,c FROM t1; INSERT INTO t1 SELECT 0,b,c FROM t1;
let MYSQLD_DATADIR=`select @@datadir`;
let PAGE_SIZE=`select @@innodb_page_size`;
--source include/shutdown_mysqld.inc
# Corrupt the change buffer bitmap, to claim that pages are clean
perl;
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl";
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
my $ps= $ENV{PAGE_SIZE};
my $page;
sysseek(FILE, $ps, 0) || die "Unable to seek $file\n";
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
# Clean the change buffer bitmap.
substr($page,38,$ps - 38 - 8) = chr(0) x ($ps - 38 - 8);
my $polynomial = 0x82f63b78; # CRC-32C
my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
substr($page,0,4)=$ck;
substr($page,$ps-8,4)=$ck;
sysseek(FILE, $ps, 0) || die "Unable to rewind $file\n";
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close(FILE) || die "Unable to close $file";
EOF
--let $restart_parameters= --innodb-force-recovery=6 --innodb-change-buffer-dump --let $restart_parameters= --innodb-force-recovery=6 --innodb-change-buffer-dump
--source include/restart_mysqld.inc --source include/start_mysqld.inc
--replace_regex /contains \d+ entries/contains #### entries/ --replace_regex /contains \d+ entries/contains #### entries/
check table t1; check table t1;
--let $restart_parameters= --let $restart_parameters=
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
SET GLOBAL innodb_fast_shutdown=0;
--source include/restart_mysqld.inc
# Cleanup # Cleanup
DROP TABLE t1; DROP TABLE t1;

View File

@@ -1,4 +1,3 @@
drop table if exists t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
a VARCHAR(200), a VARCHAR(200),
@@ -409,7 +408,6 @@ AGAINST ('"following database"@10' IN BOOLEAN MODE);
id id
105 105
DROP TABLE t1; DROP TABLE t1;
drop table if exists t50;
set names utf8; set names utf8;
"----------Test1---------" "----------Test1---------"
create table t50 (s1 varchar(60) character set utf8 collate utf8_bin) engine = innodb; create table t50 (s1 varchar(60) character set utf8 collate utf8_bin) engine = innodb;
@@ -648,9 +646,6 @@ s1
ŁŁŁŁ ŁŁŁŁ
LLLL LLLL
ŁŁŁŁ ŁŁŁŁ ŁŁŁŁ ŁŁŁŁ
DROP TABLE if EXISTS t2;
Warnings:
Note 1051 Unknown table 'test.t2'
CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB; CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB;
CREATE FULLTEXT INDEX i ON t2 ( s1); CREATE FULLTEXT INDEX i ON t2 ( s1);
INSERT INTO t2 VALUES INSERT INTO t2 VALUES
@@ -705,7 +700,12 @@ ALTER TABLE t2 DROP a;
SET @@autocommit=0; SET @@autocommit=0;
CREATE FULLTEXT INDEX i ON t1 (char_column); CREATE FULLTEXT INDEX i ON t1 (char_column);
INSERT INTO t1 values (1,'aaa'); INSERT INTO t1 values (1,'aaa');
"restart server..." CREATE TABLE mdev20987_1(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
CREATE TABLE mdev20987_2(f1 INT NOT NULL, f2 CHAR(100),
FULLTEXT(f2),
FOREIGN KEY(f1) REFERENCES mdev20987_1(f1))ENGINE=InnoDB;
INSERT INTO mdev20987_1 VALUES(1);
INSERT INTO mdev20987_2 VALUES(1, 'mariadb');
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
@@ -713,12 +713,8 @@ t2 CREATE TABLE `t2` (
PRIMARY KEY (`FTS_DOC_ID`) PRIMARY KEY (`FTS_DOC_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb'); DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb');
SET @@autocommit=1; DROP TABLE t1, t2, mdev20987_2, mdev20987_1;
DROP TABLE t1, t2;
"----------Test28---------" "----------Test28---------"
drop table if exists `fts_test`;
Warnings:
Note 1051 Unknown table 'test.fts_test'
create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb; create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb;
set session autocommit=0; set session autocommit=0;
insert into `fts_test` values (''); insert into `fts_test` values ('');
@@ -908,9 +904,6 @@ id title body
2 How To Use MySQL Well After you went through a ... 2 How To Use MySQL Well After you went through a ...
3 Optimizing MySQL In this tutorial we will show ... 3 Optimizing MySQL In this tutorial we will show ...
DROP TABLE articles; DROP TABLE articles;
drop table if exists t1;
Warnings:
Note 1051 Unknown table 'test.t1'
create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key, create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key,
title varchar(200),body text,fulltext(title,body)) engine=innodb; title varchar(200),body text,fulltext(title,body)) engine=innodb;
insert into t1 set body='test'; insert into t1 set body='test';

View File

@@ -7,10 +7,6 @@
let collation=UTF8_UNICODE_CI; let collation=UTF8_UNICODE_CI;
--source include/have_collation.inc --source include/have_collation.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
# Create FTS table # Create FTS table
CREATE TABLE t1 ( CREATE TABLE t1 (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
@@ -403,10 +399,6 @@ DROP TABLE t1;
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# More FTS test from peter's testing # More FTS test from peter's testing
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
--disable_warnings
drop table if exists t50;
--enable_warnings
set names utf8; set names utf8;
@@ -608,7 +600,6 @@ CREATE FULLTEXT INDEX i ON t1 (s1);
INSERT INTO t1 VALUES INSERT INTO t1 VALUES
('a'),('b'),('c'),('d'),('ŁŁŁŁ'),('LLLL'),(NULL),('ŁŁŁŁ ŁŁŁŁ'),('LLLLLLLL'); ('a'),('b'),('c'),('d'),('ŁŁŁŁ'),('LLLL'),(NULL),('ŁŁŁŁ ŁŁŁŁ'),('LLLLLLLL');
SELECT * FROM t1 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI); SELECT * FROM t1 WHERE MATCH(s1) AGAINST ('LLLL' COLLATE UTF8_UNICODE_520_CI);
DROP TABLE if EXISTS t2;
CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB; CREATE TABLE t2 (s1 VARCHAR(60) CHARACTER SET UTF8 COLLATE UTF8_POLISH_CI) ENGINE = InnoDB;
CREATE FULLTEXT INDEX i ON t2 ( s1); CREATE FULLTEXT INDEX i ON t2 ( s1);
INSERT INTO t2 VALUES INSERT INTO t2 VALUES
@@ -675,16 +666,19 @@ ALTER TABLE t2 DROP a;
SET @@autocommit=0; SET @@autocommit=0;
CREATE FULLTEXT INDEX i ON t1 (char_column); CREATE FULLTEXT INDEX i ON t1 (char_column);
INSERT INTO t1 values (1,'aaa'); INSERT INTO t1 values (1,'aaa');
echo "restart server...";
# Restart the server CREATE TABLE mdev20987_1(f1 INT NOT NULL, PRIMARY KEY(f1))ENGINE=InnoDB;
CREATE TABLE mdev20987_2(f1 INT NOT NULL, f2 CHAR(100),
FULLTEXT(f2),
FOREIGN KEY(f1) REFERENCES mdev20987_1(f1))ENGINE=InnoDB;
INSERT INTO mdev20987_1 VALUES(1);
INSERT INTO mdev20987_2 VALUES(1, 'mariadb');
--source include/restart_mysqld.inc --source include/restart_mysqld.inc
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb'); DELETE FROM t1 WHERE MATCH(char_column) AGAINST ('bbb');
SET @@autocommit=1; DROP TABLE t1, t2, mdev20987_2, mdev20987_1;
DROP TABLE t1, t2;
--echo "----------Test28---------" --echo "----------Test28---------"
drop table if exists `fts_test`;
create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb; create table `fts_test`(`a` text,fulltext key(`a`))engine=innodb;
set session autocommit=0; set session autocommit=0;
insert into `fts_test` values (''); insert into `fts_test` values ('');
@@ -873,8 +867,6 @@ DROP TABLE articles;
# Test for Bug 13940669 - 64901: INNODB: ASSERTION FAILURE IN # Test for Bug 13940669 - 64901: INNODB: ASSERTION FAILURE IN
# THREAD 34387022112 IN FILE REM0CMP.CC LINE 5 # THREAD 34387022112 IN FILE REM0CMP.CC LINE 5
drop table if exists t1;
create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key, create table t1 (FTS_DOC_ID bigint unsigned auto_increment not null primary key,
title varchar(200),body text,fulltext(title,body)) engine=innodb; title varchar(200),body text,fulltext(title,body)) engine=innodb;

View File

@@ -134,3 +134,19 @@ truncate performance_schema.events_statements_history 0
select * from t1 3 select * from t1 3
insert into t1 select RAND()*10000 from t1 6 insert into t1 select RAND()*10000 from t1 6
drop table t1; drop table t1;
#
# MDEV-17896 Assertion `pfs->get_refcount() > 0' failed
# in release_table_share
#
SELECT COUNT(*)<@@performance_schema_max_table_instances FROM
performance_schema.objects_summary_global_by_type WHERE OBJECT_TYPE='TABLE';
COUNT(*)<@@performance_schema_max_table_instances
1
CREATE TABLE t0(a INT);
SELECT * FROM t0;
a
DROP TEMPORARY TABLE IF EXISTS t0;
Warnings:
Note 1051 Unknown table 'test.t0'
FLUSH TABLE t0;
DROP TABLE t0;

View File

@@ -222,3 +222,51 @@ insert into t1 select RAND()*10000 from t1;
select sql_text, rows_examined from performance_schema.events_statements_history; select sql_text, rows_examined from performance_schema.events_statements_history;
drop table t1; drop table t1;
--echo #
--echo # MDEV-17896 Assertion `pfs->get_refcount() > 0' failed
--echo # in release_table_share
--echo #
# There must be at least one available slot in PFS table_share_array for
# this test to be meaningful. If there are no free slots we must
# restart mysqld, it is the only way to reset PFS table_share_array
let $query= SELECT COUNT(*)<@@performance_schema_max_table_instances FROM
performance_schema.objects_summary_global_by_type WHERE OBJECT_TYPE='TABLE';
let $free_slots_available= `$query`;
if (!$free_slots_available)
{
source include/restart_mysqld.inc;
}
eval $query;
CREATE TABLE t0(a INT);
# TABLE_SHARE must be cached in the table definition cache.
SELECT * FROM t0;
# Dropping t0 using DROP TEMPORARY frees up a slot in table_share_array,
# but the persistent table is not correctly dropped, i.e. TABLE_SHARE::m_psi
# still points to that slot in table_share_array.
DROP TEMPORARY TABLE IF EXISTS t0;
# Try re-using each and every slot in PFS table_share_array. If bug is
# there, we re-use t0 slot.
# The newly created table that re-uses the t0 slot ends up
# resetting the PFS_table_share refcount.
let $i= `SELECT @@performance_schema_max_table_instances`;
disable_query_log;
while ($i)
{
# Memory engine is here to reduce disk IO
eval CREATE TABLE t$i(a INT) ENGINE=MEMORY;
eval DROP TABLE t$i;
dec $i;
}
enable_query_log;
# FLUSH TABLE crashes the server when PFS_table_share is found with
# an unexpected refcount.
FLUSH TABLE t0;
DROP TABLE t0;

View File

@@ -9243,7 +9243,10 @@ prev_record_reads(const POSITION *positions, uint idx, table_map found_ref)
#max_nested_outer_joins=64-1) will not make it any more precise. #max_nested_outer_joins=64-1) will not make it any more precise.
*/ */
if (pos->records_read) if (pos->records_read)
{
found= COST_MULT(found, pos->records_read); found= COST_MULT(found, pos->records_read);
found*= pos->cond_selectivity;
}
} }
} }
return found; return found;

View File

@@ -2435,6 +2435,13 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
err, ER_THD(thd, err), err, ER_THD(thd, err),
tbl_name.c_ptr_safe()); tbl_name.c_ptr_safe());
/*
Our job is done here. This statement was added to avoid executing
unnecessary code farther below which in some strange corner cases
caused the server to crash (see MDEV-17896).
*/
goto log_query;
} }
else else
{ {
@@ -2550,6 +2557,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
mysql_audit_drop_table(thd, table); mysql_audit_drop_table(thd, table);
} }
log_query:
if (!dont_log_query && !drop_temporary) if (!dont_log_query && !drop_temporary)
{ {
non_tmp_table_deleted= (if_exists ? TRUE : non_tmp_table_deleted); non_tmp_table_deleted= (if_exists ? TRUE : non_tmp_table_deleted);

View File

@@ -18,10 +18,8 @@
#include "heapdef.h" #include "heapdef.h"
static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records, static int check_one_key(HP_KEYDEF *, uint, ulong, ulong, my_bool);
ulong blength, my_bool print_status); static int check_one_rb_key(const HP_INFO *, uint, ulong, my_bool);
static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
my_bool print_status);
/* /*
@@ -40,13 +38,13 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
1 error 1 error
*/ */
int heap_check_heap(HP_INFO *info, my_bool print_status) int heap_check_heap(const HP_INFO *info, my_bool print_status)
{ {
int error; int error;
uint key; uint key;
ulong records=0, deleted=0, pos, next_block; ulong records=0, deleted=0, pos, next_block;
HP_SHARE *share=info->s; HP_SHARE *share=info->s;
HP_INFO save_info= *info; /* Needed because scan_init */ uchar *current_ptr= info->current_ptr;
DBUG_ENTER("heap_check_heap"); DBUG_ENTER("heap_check_heap");
for (error=key= 0 ; key < share->keys ; key++) for (error=key= 0 ; key < share->keys ; key++)
@@ -65,7 +63,7 @@ int heap_check_heap(HP_INFO *info, my_bool print_status)
{ {
if (pos < next_block) if (pos < next_block)
{ {
info->current_ptr+= share->block.recbuffer; current_ptr+= share->block.recbuffer;
} }
else else
{ {
@@ -77,9 +75,9 @@ int heap_check_heap(HP_INFO *info, my_bool print_status)
break; /* End of file */ break; /* End of file */
} }
} }
hp_find_record(info,pos); current_ptr= hp_find_block(&share->block, pos);
if (!info->current_ptr[share->visible]) if (!current_ptr[share->visible])
deleted++; deleted++;
else else
records++; records++;
@@ -92,7 +90,6 @@ int heap_check_heap(HP_INFO *info, my_bool print_status)
deleted, (ulong) share->deleted)); deleted, (ulong) share->deleted));
error= 1; error= 1;
} }
*info= save_info;
DBUG_RETURN(error); DBUG_RETURN(error);
} }
@@ -165,7 +162,7 @@ static int check_one_key(HP_KEYDEF *keydef, uint keynr, ulong records,
return error; return error;
} }
static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records, static int check_one_rb_key(const HP_INFO *info, uint keynr, ulong records,
my_bool print_status) my_bool print_status)
{ {
HP_KEYDEF *keydef= info->s->keydef + keynr; HP_KEYDEF *keydef= info->s->keydef + keynr;
@@ -174,9 +171,11 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
uchar *key, *recpos; uchar *key, *recpos;
uint key_length; uint key_length;
uint not_used[2]; uint not_used[2];
TREE_ELEMENT **last_pos;
TREE_ELEMENT *parents[MAX_TREE_HEIGHT+1];
if ((key= tree_search_edge(&keydef->rb_tree, info->parents, if ((key= tree_search_edge(&keydef->rb_tree, parents,
&info->last_pos, offsetof(TREE_ELEMENT, left)))) &last_pos, offsetof(TREE_ELEMENT, left))))
{ {
do do
{ {
@@ -191,7 +190,7 @@ static int check_one_rb_key(HP_INFO *info, uint keynr, ulong records,
} }
else else
found++; found++;
key= tree_search_next(&keydef->rb_tree, &info->last_pos, key= tree_search_next(&keydef->rb_tree, &last_pos,
offsetof(TREE_ELEMENT, left), offsetof(TREE_ELEMENT, left),
offsetof(TREE_ELEMENT, right)); offsetof(TREE_ELEMENT, right));
} while (key); } while (key);

View File

@@ -127,8 +127,7 @@ dict_hdr_get_new_id(
} }
if (space_id) { if (space_id) {
*space_id = mtr_read_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID, *space_id = mach_read_from_4(dict_hdr + DICT_HDR_MAX_SPACE_ID);
MLOG_4BYTES, &mtr);
if (fil_assign_new_space_id(space_id)) { if (fil_assign_new_space_id(space_id)) {
mlog_write_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID, mlog_write_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
*space_id, MLOG_4BYTES, &mtr); *space_id, MLOG_4BYTES, &mtr);
@@ -361,9 +360,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "NAME", 0); dict_mem_index_add_field(index, "NAME", 0);
index->id = DICT_TABLES_ID; index->id = DICT_TABLES_ID;
index = dict_index_add_to_cache( dberr_t error = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_TABLES)); index, mach_read_from_4(dict_hdr + DICT_HDR_TABLES));
ut_a(index); ut_a(error == DB_SUCCESS);
ut_ad(!table->is_instant()); ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES( table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES(
unsigned(table->indexes.start->n_nullable)); unsigned(table->indexes.start->n_nullable));
@@ -373,9 +372,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_TABLE_IDS_ID; index->id = DICT_TABLE_IDS_ID;
index = dict_index_add_to_cache( error = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_TABLE_IDS)); index, mach_read_from_4(dict_hdr + DICT_HDR_TABLE_IDS));
ut_a(index); ut_a(error == DB_SUCCESS);
/*-------------------------*/ /*-------------------------*/
table = dict_mem_table_create("SYS_COLUMNS", fil_system.sys_space, table = dict_mem_table_create("SYS_COLUMNS", fil_system.sys_space,
@@ -403,9 +402,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_COLUMNS_ID; index->id = DICT_COLUMNS_ID;
index = dict_index_add_to_cache( error = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_COLUMNS)); index, mach_read_from_4(dict_hdr + DICT_HDR_COLUMNS));
ut_a(index); ut_a(error == DB_SUCCESS);
ut_ad(!table->is_instant()); ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES( table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES(
unsigned(table->indexes.start->n_nullable)); unsigned(table->indexes.start->n_nullable));
@@ -446,9 +445,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "ID", 0); dict_mem_index_add_field(index, "ID", 0);
index->id = DICT_INDEXES_ID; index->id = DICT_INDEXES_ID;
index = dict_index_add_to_cache( error = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_INDEXES)); index, mach_read_from_4(dict_hdr + DICT_HDR_INDEXES));
ut_a(index); ut_a(error == DB_SUCCESS);
ut_ad(!table->is_instant()); ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES( table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES(
unsigned(table->indexes.start->n_nullable)); unsigned(table->indexes.start->n_nullable));
@@ -475,9 +474,9 @@ dict_boot(void)
dict_mem_index_add_field(index, "POS", 0); dict_mem_index_add_field(index, "POS", 0);
index->id = DICT_FIELDS_ID; index->id = DICT_FIELDS_ID;
index = dict_index_add_to_cache( error = dict_index_add_to_cache(
index, mach_read_from_4(dict_hdr + DICT_HDR_FIELDS)); index, mach_read_from_4(dict_hdr + DICT_HDR_FIELDS));
ut_a(index); ut_a(error == DB_SUCCESS);
ut_ad(!table->is_instant()); ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES( table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES(
unsigned(table->indexes.start->n_nullable)); unsigned(table->indexes.start->n_nullable));

View File

@@ -1350,9 +1350,9 @@ dict_create_index_step(
if (node->state == INDEX_ADD_TO_CACHE) { if (node->state == INDEX_ADD_TO_CACHE) {
ut_ad(node->index->table == node->table); ut_ad(node->index->table == node->table);
node->index = dict_index_add_to_cache( err = dict_index_add_to_cache(
node->index, FIL_NULL, trx_is_strict(trx), node->index, FIL_NULL, trx_is_strict(trx),
&err, node->add_v); node->add_v);
ut_ad((node->index == NULL) == (err != DB_SUCCESS)); ut_ad((node->index == NULL) == (err != DB_SUCCESS));

View File

@@ -1765,8 +1765,7 @@ dict_table_rename_in_cache(
/* The old table name in my_charset_filename is stored /* The old table name in my_charset_filename is stored
in old_name_cs_filename */ in old_name_cs_filename */
strncpy(old_name_cs_filename, old_name, strcpy(old_name_cs_filename, old_name);
MAX_FULL_NAME_LEN);
old_name_cs_filename[MAX_FULL_NAME_LEN] = '\0'; old_name_cs_filename[MAX_FULL_NAME_LEN] = '\0';
if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) { if (strstr(old_name, TEMP_TABLE_PATH_PREFIX) == NULL) {
@@ -1788,8 +1787,7 @@ dict_table_rename_in_cache(
} else { } else {
/* Old name already in /* Old name already in
my_charset_filename */ my_charset_filename */
strncpy(old_name_cs_filename, old_name, strcpy(old_name_cs_filename, old_name);
MAX_FULL_NAME_LEN);
old_name_cs_filename[MAX_FULL_NAME_LEN] old_name_cs_filename[MAX_FULL_NAME_LEN]
= '\0'; = '\0';
} }
@@ -2291,23 +2289,19 @@ void dict_index_remove_from_v_col_list(dict_index_t* index)
/** Adds an index to the dictionary cache, with possible indexing newly /** Adds an index to the dictionary cache, with possible indexing newly
added column. added column.
@param[in] index index; NOTE! The index memory @param[in,out] index index; NOTE! The index memory
object is freed in this function! object is freed in this function!
@param[in] page_no root page number of the index @param[in] page_no root page number of the index
@param[in] strict TRUE=refuse to create the index @param[in] strict true=refuse to create the index
if records could be too big to fit in if records could be too big to fit in
an B-tree page an B-tree page
@param[out] err DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION @param[in] add_v virtual columns being added along with ADD INDEX
@param[in] add_v new virtual column that being added along with @return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
an add index call dberr_t
@return the added index
@retval NULL on error */
dict_index_t*
dict_index_add_to_cache( dict_index_add_to_cache(
dict_index_t* index, dict_index_t*& index,
ulint page_no, ulint page_no,
bool strict, bool strict,
dberr_t* err,
const dict_add_v_col_t* add_v) const dict_add_v_col_t* add_v)
{ {
dict_index_t* new_index; dict_index_t* new_index;
@@ -2328,8 +2322,8 @@ dict_index_add_to_cache(
if (!dict_index_find_cols(index, add_v)) { if (!dict_index_find_cols(index, add_v)) {
dict_mem_index_free(index); dict_mem_index_free(index);
if (err) *err = DB_CORRUPTION; index = NULL;
return NULL; return DB_CORRUPTION;
} }
/* Build the cache internal representation of the index, /* Build the cache internal representation of the index,
@@ -2361,8 +2355,8 @@ dict_index_add_to_cache(
if (strict) { if (strict) {
dict_mem_index_free(new_index); dict_mem_index_free(new_index);
dict_mem_index_free(index); dict_mem_index_free(index);
if (err) *err = DB_TOO_BIG_RECORD; index = NULL;
return NULL; return DB_TOO_BIG_RECORD;
} else if (current_thd != NULL) { } else if (current_thd != NULL) {
/* Avoid the warning to be printed /* Avoid the warning to be printed
during recovery. */ during recovery. */
@@ -2440,8 +2434,8 @@ dict_index_add_to_cache(
new_index->n_core_fields = new_index->n_fields; new_index->n_core_fields = new_index->n_fields;
dict_mem_index_free(index); dict_mem_index_free(index);
if (err) *err = DB_SUCCESS; index = new_index;
return new_index; return DB_SUCCESS;
} }
/**********************************************************************//** /**********************************************************************//**

View File

@@ -2574,8 +2574,9 @@ corrupted:
and simply did not load this index definition, the and simply did not load this index definition, the
.frm file would disagree with the index definitions .frm file would disagree with the index definitions
inside InnoDB. */ inside InnoDB. */
if (!dict_index_add_to_cache( if ((error = dict_index_add_to_cache(index,
index, index->page, false, &error)) { index->page))
!= DB_SUCCESS) {
goto func_exit; goto func_exit;
} }
} }
@@ -3089,7 +3090,7 @@ func_exit:
fts_free(table); fts_free(table);
} else if (fts_optimize_wq) { } else if (fts_optimize_wq) {
fts_optimize_add_table(table); fts_optimize_add_table(table);
} else { } else if (table->can_be_evicted) {
/* fts_optimize_thread is not started yet. /* fts_optimize_thread is not started yet.
So make the table as non-evictable from cache. */ So make the table as non-evictable from cache. */
dict_table_move_from_lru_to_non_lru(table); dict_table_move_from_lru_to_non_lru(table);

View File

@@ -5299,9 +5299,8 @@ new_clustered_failed:
for (uint a = 0; a < ctx->num_to_add_index; a++) { for (uint a = 0; a < ctx->num_to_add_index; a++) {
ctx->add_index[a]->table = ctx->new_table; ctx->add_index[a]->table = ctx->new_table;
ctx->add_index[a] = dict_index_add_to_cache( error = dict_index_add_to_cache(
ctx->add_index[a], FIL_NULL, false, ctx->add_index[a], FIL_NULL, false, add_v);
&error, add_v);
ut_a(error == DB_SUCCESS); ut_a(error == DB_SUCCESS);
} }
DBUG_ASSERT(ha_alter_info->key_count DBUG_ASSERT(ha_alter_info->key_count

View File

@@ -4313,6 +4313,71 @@ func_exit:
return(TRUE); return(TRUE);
} }
/**
Delete any buffered entries for a page.
This prevents an infinite loop on slow shutdown
in the case where the change buffer bitmap claims that no buffered
changes exist, while entries exist in the change buffer tree.
@param page_id page number for which there should be no unbuffered changes */
ATTRIBUTE_COLD static void ibuf_delete_recs(const page_id_t page_id)
{
ulint dops[IBUF_OP_COUNT];
mtr_t mtr;
btr_pcur_t pcur;
mem_heap_t* heap = mem_heap_create(512);
const dtuple_t* tuple = ibuf_search_tuple_build(
page_id.space(), page_id.page_no(), heap);
memset(dops, 0, sizeof(dops));
loop:
ibuf_mtr_start(&mtr);
btr_pcur_open(ibuf->index, tuple, PAGE_CUR_GE, BTR_MODIFY_LEAF,
&pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur)) {
ut_ad(btr_pcur_is_after_last_in_tree(&pcur));
goto func_exit;
}
for (;;) {
ut_ad(btr_pcur_is_on_user_rec(&pcur));
const rec_t* ibuf_rec = btr_pcur_get_rec(&pcur);
if (ibuf_rec_get_space(&mtr, ibuf_rec)
!= page_id.space()
|| ibuf_rec_get_page_no(&mtr, ibuf_rec)
!= page_id.page_no()) {
break;
}
dops[ibuf_rec_get_op_type(&mtr, ibuf_rec)]++;
/* Delete the record from ibuf */
if (ibuf_delete_rec(page_id.space(), page_id.page_no(),
&pcur, tuple, &mtr)) {
/* Deletion was pessimistic and mtr was committed:
we start from the beginning again */
ut_ad(mtr.has_committed());
goto loop;
}
if (btr_pcur_is_after_last_on_page(&pcur)) {
ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
goto loop;
}
}
func_exit:
ibuf_mtr_commit(&mtr);
btr_pcur_close(&pcur);
ibuf_add_ops(ibuf->n_discarded_ops, dops);
mem_heap_free(heap);
}
/** When an index page is read from a disk to the buffer pool, this function /** When an index page is read from a disk to the buffer pool, this function
applies any buffered operations to the page and deletes the entries from the applies any buffered operations to the page and deletes the entries from the
insert buffer. If the page is not read, but created in the buffer pool, this insert buffer. If the page is not read, but created in the buffer pool, this
@@ -4332,9 +4397,7 @@ ibuf_merge_or_delete_for_page(
const page_size_t* page_size, const page_size_t* page_size,
ibool update_ibuf_bitmap) ibool update_ibuf_bitmap)
{ {
mem_heap_t* heap;
btr_pcur_t pcur; btr_pcur_t pcur;
dtuple_t* search_tuple;
#ifdef UNIV_IBUF_DEBUG #ifdef UNIV_IBUF_DEBUG
ulint volume = 0; ulint volume = 0;
#endif /* UNIV_IBUF_DEBUG */ #endif /* UNIV_IBUF_DEBUG */
@@ -4407,9 +4470,16 @@ ibuf_merge_or_delete_for_page(
ibuf_mtr_commit(&mtr); ibuf_mtr_commit(&mtr);
if (!bitmap_bits) { if (!bitmap_bits) {
/* No inserts buffered for this page */ /* No changes are buffered for this page. */
space->release(); space->release();
if (UNIV_UNLIKELY(srv_shutdown_state)
&& !srv_fast_shutdown) {
/* Prevent an infinite loop on slow
shutdown, in case the bitmap bits are
wrongly clear even though buffered
changes exist. */
ibuf_delete_recs(page_id);
}
return; return;
} }
} }
@@ -4422,9 +4492,9 @@ ibuf_merge_or_delete_for_page(
space = NULL; space = NULL;
} }
heap = mem_heap_create(512); mem_heap_t* heap = mem_heap_create(512);
search_tuple = ibuf_search_tuple_build( const dtuple_t* search_tuple = ibuf_search_tuple_build(
page_id.space(), page_id.page_no(), heap); page_id.space(), page_id.page_no(), heap);
if (block != NULL) { if (block != NULL) {

View File

@@ -1067,26 +1067,21 @@ void dict_index_remove_from_v_col_list(dict_index_t* index);
/** Adds an index to the dictionary cache, with possible indexing newly /** Adds an index to the dictionary cache, with possible indexing newly
added column. added column.
@param[in] index index; NOTE! The index memory @param[in,out] index index; NOTE! The index memory
object is freed in this function! object is freed in this function!
@param[in] page_no root page number of the index @param[in] page_no root page number of the index
@param[in] strict true=refuse to create the index @param[in] strict true=refuse to create the index
if records could be too big to fit in if records could be too big to fit in
an B-tree page an B-tree page
@param[out] err DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION @param[in] add_v virtual columns being added along with ADD INDEX
@param[in] add_v new virtual column that being added along with @return DB_SUCCESS, DB_TOO_BIG_RECORD, or DB_CORRUPTION */
an add index call dberr_t
@return the added index
@retval NULL on error */
dict_index_t*
dict_index_add_to_cache( dict_index_add_to_cache(
dict_index_t* index, dict_index_t*& index,
ulint page_no, ulint page_no,
bool strict = false, bool strict = false,
dberr_t* err = NULL,
const dict_add_v_col_t* add_v = NULL) const dict_add_v_col_t* add_v = NULL)
MY_ATTRIBUTE((nonnull(1))); MY_ATTRIBUTE((warn_unused_result));
/********************************************************************//** /********************************************************************//**
Gets the number of fields in the internal representation of an index, Gets the number of fields in the internal representation of an index,
including fields added by the dictionary system. including fields added by the dictionary system.

View File

@@ -2580,10 +2580,10 @@ row_create_index_for_mysql(
} else { } else {
dict_build_index_def(table, index, trx); dict_build_index_def(table, index, trx);
/* add index to dictionary cache and also free index object. */ err = dict_index_add_to_cache(
index = dict_index_add_to_cache( index, FIL_NULL, trx_is_strict(trx));
index, FIL_NULL, trx_is_strict(trx), &err); ut_ad((index == NULL) == (err != DB_SUCCESS));
if (index) { if (UNIV_LIKELY(err == DB_SUCCESS)) {
ut_ad(!index->is_instant()); ut_ad(!index->is_instant());
index->n_core_null_bytes = UT_BITS_IN_BYTES( index->n_core_null_bytes = UT_BITS_IN_BYTES(
unsigned(index->n_nullable)); unsigned(index->n_nullable));

View File

@@ -68,11 +68,12 @@ IF(UNIX)
IF(CHECKMODULE AND SEMODULE_PACKAGE) IF(CHECKMODULE AND SEMODULE_PACKAGE)
FOREACH(pol mariadb) FOREACH(pol mariadb)
SET(src ${CMAKE_CURRENT_SOURCE_DIR}/policy/selinux/${pol}.te) SET(src ${CMAKE_CURRENT_SOURCE_DIR}/policy/selinux/${pol}.te)
SET(tmp ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${pol}-pp.dir/${pol}.mod) SET(tmp ${CMAKE_CURRENT_BINARY_DIR}/${pol}.mod)
SET(out ${CMAKE_CURRENT_BINARY_DIR}/${pol}.pp) SET(out ${CMAKE_CURRENT_BINARY_DIR}/${pol}.pp)
ADD_CUSTOM_COMMAND(OUTPUT ${out} ADD_CUSTOM_COMMAND(OUTPUT ${out}
COMMAND ${CHECKMODULE} -M -m ${src} -o ${tmp} COMMAND ${CHECKMODULE} -M -m ${src} -o ${tmp}
COMMAND ${SEMODULE_PACKAGE} -m ${tmp} -o ${out} COMMAND ${SEMODULE_PACKAGE} -m ${tmp} -o ${out}
COMMAND ${CMAKE_COMMAND} -E remove ${tmp}
DEPENDS ${src}) DEPENDS ${src})
ADD_CUSTOM_TARGET(${pol}-pp ALL DEPENDS ${out}) ADD_CUSTOM_TARGET(${pol}-pp ALL DEPENDS ${out})
INSTALL(FILES ${out} DESTINATION ${inst_location}/policy/selinux COMPONENT SupportFiles) INSTALL(FILES ${out} DESTINATION ${inst_location}/policy/selinux COMPONENT SupportFiles)