Merge 10.3 into 10.4
This commit is contained in:
commit
ec40980ddd
@ -205,7 +205,7 @@ IF(MSVC)
|
||||
# Noisy warning C4800: 'type': forcing value to bool 'true' or 'false' (performance warning),
|
||||
# removed in VS2017
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800")
|
||||
ELSE()
|
||||
ELSEIF (NOT (CMAKE_CXX_COMPILER_ID MATCHES Clang))
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /d2OptimizeHugeFunctions")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
@ -225,11 +225,8 @@ typedef struct _db_code_state_ {
|
||||
const char *file; /* Name of current user file */
|
||||
struct _db_stack_frame_ *framep; /* Pointer to current frame */
|
||||
struct settings *stack; /* debugging settings */
|
||||
const char *jmpfunc; /* Remember current function for setjmp */
|
||||
const char *jmpfile; /* Remember current file for setjmp */
|
||||
int lineno; /* Current debugger output line number */
|
||||
uint level; /* Current function nesting level */
|
||||
int jmplevel; /* Remember nesting level at setjmp() */
|
||||
|
||||
/*
|
||||
* The following variables are used to hold the state information
|
||||
|
2
debian/additions/my.cnf
vendored
2
debian/additions/my.cnf
vendored
@ -131,8 +131,6 @@ max_binlog_size = 100M
|
||||
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
|
||||
# Read the manual for more InnoDB related options. There are many!
|
||||
default_storage_engine = InnoDB
|
||||
# you can't just change log file size, requires special procedure
|
||||
#innodb_log_file_size = 50M
|
||||
innodb_buffer_pool_size = 256M
|
||||
innodb_log_buffer_size = 8M
|
||||
innodb_file_per_table = 1
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 261a5c435581c8d6c6341afac95bcc5c96d1435c
|
||||
Subproject commit 980f2dbea6586091333057bb2994b18747466942
|
@ -202,7 +202,6 @@ main.function_defaults_innodb
|
||||
main.gcc296
|
||||
main.get_diagnostics
|
||||
main.gis
|
||||
main.gis2
|
||||
main.gis-alter_table_online
|
||||
main.gis-precise
|
||||
main.gis-rt-precise
|
||||
|
@ -875,6 +875,49 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #29723340: MYSQL SERVER CRASH AFTER SQL QUERY WITH DATA ?AST
|
||||
#
|
||||
create table t1(a int);
|
||||
insert ignore t1 values("1e-214748364");
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
insert ignore t1 values("1e-2147483648");
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
insert ignore t1 values("1e-21474836480");
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'a' at row 1
|
||||
insert ignore t1 values("1e+214748364");
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
insert ignore t1 values("1e+2147483647");
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
insert ignore t1 values("1e+21474836470");
|
||||
Warnings:
|
||||
Warning 1264 Out of range value for column 'a' at row 1
|
||||
set global max_allowed_packet= cast(2*1024*1024*1024+1024 as unsigned);
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect max_allowed_packet value: '2147484672'
|
||||
connect foo,localhost,root;
|
||||
set @a=2147483647;
|
||||
insert ignore t1 values (concat('1', repeat('0', @a+18), 'e-', @a-1, '0'));
|
||||
Warnings:
|
||||
Warning 1301 Result of repeat() was larger than max_allowed_packet (1073741824) - truncated
|
||||
disconnect foo;
|
||||
connection default;
|
||||
set global max_allowed_packet=default;
|
||||
select * from t1;
|
||||
a
|
||||
0
|
||||
0
|
||||
0
|
||||
2147483647
|
||||
2147483647
|
||||
2147483647
|
||||
NULL
|
||||
drop table t1;
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
#
|
||||
|
@ -627,6 +627,31 @@ SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #29723340: MYSQL SERVER CRASH AFTER SQL QUERY WITH DATA ?AST
|
||||
--echo #
|
||||
|
||||
create table t1(a int);
|
||||
insert ignore t1 values("1e-214748364");
|
||||
insert ignore t1 values("1e-2147483648");
|
||||
insert ignore t1 values("1e-21474836480");
|
||||
insert ignore t1 values("1e+214748364");
|
||||
insert ignore t1 values("1e+2147483647");
|
||||
insert ignore t1 values("1e+21474836470");
|
||||
|
||||
# if max max_allowed_packet will ever be increased beyond 2GB, this could
|
||||
# break again:
|
||||
set global max_allowed_packet= cast(2*1024*1024*1024+1024 as unsigned);
|
||||
connect foo,localhost,root;
|
||||
set @a=2147483647;
|
||||
insert ignore t1 values (concat('1', repeat('0', @a+18), 'e-', @a-1, '0'));
|
||||
disconnect foo;
|
||||
connection default;
|
||||
set global max_allowed_packet=default;
|
||||
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
--echo #
|
||||
|
@ -246,3 +246,82 @@ connection user1;
|
||||
disconnect user1;
|
||||
connection default;
|
||||
set global sql_mode=default;
|
||||
create user foo@localhost;
|
||||
grant select on test.* to foo@localhost;
|
||||
create procedure rootonly() select 1;
|
||||
create sql security definer view v1d as select current_user(),user from information_schema.processlist;
|
||||
create sql security invoker view v1i as select current_user(),user from information_schema.processlist;
|
||||
create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
|
||||
create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
|
||||
create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
|
||||
create sql security invoker view v3i as select schema_name from information_schema.schemata where schema_name like '%mysql%';
|
||||
create sql security definer view v4d as select routine_name from information_schema.routines where routine_schema='test';
|
||||
create sql security invoker view v4i as select routine_name from information_schema.routines where routine_schema='test';
|
||||
create sql security definer view v5d as select view_definition > '' from information_schema.views where table_name='v1d';
|
||||
create sql security invoker view v5i as select view_definition > '' from information_schema.views where table_name='v1d';
|
||||
connect foo,localhost,foo;
|
||||
select * from v1d;
|
||||
current_user() user
|
||||
root@localhost root
|
||||
root@localhost root
|
||||
select * from v1i;
|
||||
current_user() user
|
||||
foo@localhost foo
|
||||
select * from v2d;
|
||||
table_name
|
||||
user
|
||||
select * from v2i;
|
||||
table_name
|
||||
select * from v3d;
|
||||
schema_name
|
||||
mysql
|
||||
select * from v3i;
|
||||
schema_name
|
||||
select * from v4d;
|
||||
routine_name
|
||||
rootonly
|
||||
select * from v4i;
|
||||
routine_name
|
||||
select * from v5d;
|
||||
view_definition > ''
|
||||
1
|
||||
select * from v5i;
|
||||
view_definition > ''
|
||||
0
|
||||
connection default;
|
||||
select * from v1d;
|
||||
current_user() user
|
||||
root@localhost foo
|
||||
root@localhost root
|
||||
select * from v1i;
|
||||
current_user() user
|
||||
root@localhost foo
|
||||
root@localhost root
|
||||
select * from v2d;
|
||||
table_name
|
||||
user
|
||||
select * from v2i;
|
||||
table_name
|
||||
user
|
||||
select * from v3d;
|
||||
schema_name
|
||||
mysql
|
||||
select * from v3i;
|
||||
schema_name
|
||||
mysql
|
||||
select * from v4d;
|
||||
routine_name
|
||||
rootonly
|
||||
select * from v4i;
|
||||
routine_name
|
||||
rootonly
|
||||
select * from v5d;
|
||||
view_definition > ''
|
||||
1
|
||||
select * from v5i;
|
||||
view_definition > ''
|
||||
1
|
||||
disconnect foo;
|
||||
drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
|
||||
drop user foo@localhost;
|
||||
drop procedure rootonly;
|
||||
|
@ -255,3 +255,47 @@ disconnect user1;
|
||||
connection default;
|
||||
|
||||
set global sql_mode=default;
|
||||
|
||||
#
|
||||
# MDEV-20549 SQL SECURITY DEFINER does not work for INFORMATION_SCHEMA tables
|
||||
#
|
||||
|
||||
create user foo@localhost;
|
||||
grant select on test.* to foo@localhost;
|
||||
create procedure rootonly() select 1;
|
||||
create sql security definer view v1d as select current_user(),user from information_schema.processlist;
|
||||
create sql security invoker view v1i as select current_user(),user from information_schema.processlist;
|
||||
create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
|
||||
create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
|
||||
create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
|
||||
create sql security invoker view v3i as select schema_name from information_schema.schemata where schema_name like '%mysql%';
|
||||
create sql security definer view v4d as select routine_name from information_schema.routines where routine_schema='test';
|
||||
create sql security invoker view v4i as select routine_name from information_schema.routines where routine_schema='test';
|
||||
create sql security definer view v5d as select view_definition > '' from information_schema.views where table_name='v1d';
|
||||
create sql security invoker view v5i as select view_definition > '' from information_schema.views where table_name='v1d';
|
||||
connect foo,localhost,foo;
|
||||
select * from v1d;
|
||||
select * from v1i;
|
||||
select * from v2d;
|
||||
select * from v2i;
|
||||
select * from v3d;
|
||||
select * from v3i;
|
||||
select * from v4d;
|
||||
select * from v4i;
|
||||
select * from v5d;
|
||||
select * from v5i;
|
||||
connection default;
|
||||
select * from v1d;
|
||||
select * from v1i;
|
||||
select * from v2d;
|
||||
select * from v2i;
|
||||
select * from v3d;
|
||||
select * from v3i;
|
||||
select * from v4d;
|
||||
select * from v4i;
|
||||
select * from v5d;
|
||||
select * from v5i;
|
||||
disconnect foo;
|
||||
drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
|
||||
drop user foo@localhost;
|
||||
drop procedure rootonly;
|
||||
|
@ -1069,5 +1069,29 @@ COUNT(*)
|
||||
2
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
|
||||
#
|
||||
CREATE TABLE t1 (a INT)
|
||||
ENGINE=InnoDB
|
||||
PARTITION BY RANGE (a) (
|
||||
PARTITION p0 VALUES LESS THAN (6),
|
||||
PARTITION pn VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
INSERT INTO t1 VALUES (4),(5),(6);
|
||||
ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
|
||||
UPDATE t1 PARTITION (p0) SET a = 3 WHERE a = 5;
|
||||
INSERT INTO t1 PARTITION(p0) VALUES ();
|
||||
ERROR HY000: Found a row not matching the given partition set
|
||||
INSERT INTO t1 PARTITION(p0) VALUES (-1);
|
||||
INSERT INTO t1 VALUES ();
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
-1
|
||||
1
|
||||
3
|
||||
4
|
||||
6
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -1139,6 +1139,26 @@ INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL)
|
||||
SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18244 Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT)
|
||||
ENGINE=InnoDB
|
||||
PARTITION BY RANGE (a) (
|
||||
PARTITION p0 VALUES LESS THAN (6),
|
||||
PARTITION pn VALUES LESS THAN MAXVALUE
|
||||
);
|
||||
INSERT INTO t1 VALUES (4),(5),(6);
|
||||
ALTER TABLE t1 MODIFY a INT AUTO_INCREMENT PRIMARY KEY;
|
||||
UPDATE t1 PARTITION (p0) SET a = 3 WHERE a = 5;
|
||||
--error ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET
|
||||
INSERT INTO t1 PARTITION(p0) VALUES ();
|
||||
INSERT INTO t1 PARTITION(p0) VALUES (-1);
|
||||
INSERT INTO t1 VALUES ();
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
13
mysql-test/main/partition_ucs2.result
Normal file
13
mysql-test/main/partition_ucs2.result
Normal file
@ -0,0 +1,13 @@
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-20855 Crash with PARTITION BY LIST and extended characters
|
||||
#
|
||||
SET NAMES utf8;
|
||||
CREATE OR REPLACE TABLE t1 (a TIME)
|
||||
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN (_ucs2 0x0411));
|
||||
ERROR HY000: This partition function is not allowed
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
19
mysql-test/main/partition_ucs2.test
Normal file
19
mysql-test/main/partition_ucs2.test
Normal file
@ -0,0 +1,19 @@
|
||||
--source include/have_partition.inc
|
||||
--source include/have_ucs2.inc
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20855 Crash with PARTITION BY LIST and extended characters
|
||||
--echo #
|
||||
|
||||
SET NAMES utf8;
|
||||
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE OR REPLACE TABLE t1 (a TIME)
|
||||
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN (_ucs2 0x0411));
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
@ -51,3 +51,19 @@ t1 CREATE TABLE `t1` (
|
||||
insert into t1 values ('');
|
||||
insert into t1 values (_ucs2 0x2020);
|
||||
drop table t1;
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-20855 Crash with PARTITION BY LIST and extended characters
|
||||
#
|
||||
SET NAMES utf8;
|
||||
CREATE OR REPLACE TABLE t1 (a CHAR(10)) CHARACTER SET latin1
|
||||
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
|
||||
ERROR HY000: This partition function is not allowed
|
||||
CREATE OR REPLACE TABLE t1 (a TIME)
|
||||
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
|
||||
ERROR HY000: This partition function is not allowed
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -40,3 +40,25 @@ show create table t1;
|
||||
insert into t1 values ('');
|
||||
insert into t1 values (_ucs2 0x2020);
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20855 Crash with PARTITION BY LIST and extended characters
|
||||
--echo #
|
||||
|
||||
SET NAMES utf8;
|
||||
|
||||
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE OR REPLACE TABLE t1 (a CHAR(10)) CHARACTER SET latin1
|
||||
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
|
||||
|
||||
--error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
|
||||
CREATE OR REPLACE TABLE t1 (a TIME)
|
||||
PARTITION BY LIST COLUMNS (a) (PARTITION p0 VALUES IN ('Б'));
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -23,8 +23,9 @@ select command, time < 5 from information_schema.processlist where id != connect
|
||||
command time < 5
|
||||
Sleep 1
|
||||
disconnect con1;
|
||||
set debug_sync='reset';
|
||||
connection default;
|
||||
set debug_sync='reset';
|
||||
End of 5.5 tests
|
||||
#
|
||||
# 10.1 tests
|
||||
#
|
||||
|
@ -49,10 +49,10 @@ SET DEBUG_SYNC = 'now WAIT_FOR query_done';
|
||||
select command, time < 5 from information_schema.processlist where id != connection_id();
|
||||
|
||||
disconnect con1;
|
||||
connection default;
|
||||
set debug_sync='reset';
|
||||
|
||||
connection default;
|
||||
|
||||
--echo End of 5.5 tests
|
||||
|
||||
--echo #
|
||||
--echo # 10.1 tests
|
||||
|
12
mysql-test/main/processlist_notembedded.result
Normal file
12
mysql-test/main/processlist_notembedded.result
Normal file
@ -0,0 +1,12 @@
|
||||
#
|
||||
# MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
|
||||
#
|
||||
connect con1,localhost,root,,;
|
||||
connection con1;
|
||||
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
|
||||
connection default;
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
|
||||
FOUND 1 /sleep \(30\)/ in MDEV-20466.text
|
||||
disconnect con1;
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
End of 5.5 tests
|
34
mysql-test/main/processlist_notembedded.test
Normal file
34
mysql-test/main/processlist_notembedded.test
Normal file
@ -0,0 +1,34 @@
|
||||
source include/have_debug.inc;
|
||||
source include/have_debug_sync.inc;
|
||||
source include/not_embedded.inc;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
|
||||
--echo #
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
|
||||
connection con1;
|
||||
|
||||
let $q= `select CONCAT("SELECT user FROM mysql.user WHERE user ='some", CHAR(0), "' or sleep (30)")`;
|
||||
|
||||
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
|
||||
--disable_query_log
|
||||
--send_eval $q;
|
||||
--enable_query_log
|
||||
connection default;
|
||||
|
||||
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
|
||||
|
||||
exec $MYSQL test -e "SHOW PROCESSLIST" > $MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
|
||||
|
||||
let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
|
||||
let SEARCH_PATTERN=sleep \(30\);
|
||||
source include/search_pattern_in_file.inc;
|
||||
remove_file $MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
|
||||
|
||||
disconnect con1;
|
||||
|
||||
SET DEBUG_SYNC = 'RESET';
|
||||
|
||||
--echo End of 5.5 tests
|
@ -3268,6 +3268,32 @@ create table t1 (a1 varchar(25));
|
||||
create table t2 (a2 varchar(25)) ;
|
||||
insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
|
||||
drop table t1,t2;
|
||||
#
|
||||
# MDEV-13172: Wrong result / SELECT ... WHERE EXISTS ... (with UNIQUE Key)
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`Id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Id`)
|
||||
);
|
||||
INSERT INTO `t1` (`Id`) VALUES (1);
|
||||
CREATE TABLE `t2` (
|
||||
`t1_Id` int(11) NOT NULL DEFAULT 0,
|
||||
`col1` int(11) DEFAULT NULL,
|
||||
UNIQUE KEY `col1` (`col1`)
|
||||
);
|
||||
INSERT INTO `t2` (`t1_Id`, `col1`) VALUES (1, NULL), (1, NULL);
|
||||
SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
|
||||
Id
|
||||
1
|
||||
explain extended
|
||||
SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
|
||||
2 MATERIALIZED t2 ref col1 col1 5 const 2 100.00 Using index condition; Using where
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `Id` from (`test`.`t2`) where `test`.`t2`.`t1_Id` = 1 and `test`.`t2`.`col1` is null
|
||||
DROP TABLE t1, t2;
|
||||
# End of 5.5 test
|
||||
#
|
||||
# MDEV-20109: Optimizer ignores distinct key created for materialized
|
||||
|
@ -2942,6 +2942,32 @@ insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
|
||||
|
||||
drop table t1,t2;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-13172: Wrong result / SELECT ... WHERE EXISTS ... (with UNIQUE Key)
|
||||
--echo #
|
||||
|
||||
CREATE TABLE `t1` (
|
||||
`Id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Id`)
|
||||
);
|
||||
|
||||
INSERT INTO `t1` (`Id`) VALUES (1);
|
||||
|
||||
CREATE TABLE `t2` (
|
||||
`t1_Id` int(11) NOT NULL DEFAULT 0,
|
||||
`col1` int(11) DEFAULT NULL,
|
||||
UNIQUE KEY `col1` (`col1`)
|
||||
);
|
||||
|
||||
INSERT INTO `t2` (`t1_Id`, `col1`) VALUES (1, NULL), (1, NULL);
|
||||
|
||||
SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
|
||||
explain extended
|
||||
SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo # End of 5.5 test
|
||||
|
||||
--echo #
|
||||
|
@ -3279,6 +3279,32 @@ create table t1 (a1 varchar(25));
|
||||
create table t2 (a2 varchar(25)) ;
|
||||
insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
|
||||
drop table t1,t2;
|
||||
#
|
||||
# MDEV-13172: Wrong result / SELECT ... WHERE EXISTS ... (with UNIQUE Key)
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`Id` int(11) NOT NULL,
|
||||
PRIMARY KEY (`Id`)
|
||||
);
|
||||
INSERT INTO `t1` (`Id`) VALUES (1);
|
||||
CREATE TABLE `t2` (
|
||||
`t1_Id` int(11) NOT NULL DEFAULT 0,
|
||||
`col1` int(11) DEFAULT NULL,
|
||||
UNIQUE KEY `col1` (`col1`)
|
||||
);
|
||||
INSERT INTO `t2` (`t1_Id`, `col1`) VALUES (1, NULL), (1, NULL);
|
||||
SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
|
||||
Id
|
||||
1
|
||||
explain extended
|
||||
SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 100.00
|
||||
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
|
||||
2 MATERIALIZED t2 ref col1 col1 5 const 2 100.00 Using index condition; Using where
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `Id` from (`test`.`t2`) where `test`.`t2`.`t1_Id` = 1 and `test`.`t2`.`col1` is null
|
||||
DROP TABLE t1, t2;
|
||||
# End of 5.5 test
|
||||
#
|
||||
# MDEV-20109: Optimizer ignores distinct key created for materialized
|
||||
|
129
mysql-test/suite/binlog/r/read_only.result
Normal file
129
mysql-test/suite/binlog/r/read_only.result
Normal file
@ -0,0 +1,129 @@
|
||||
#
|
||||
# MDEV-17863 DROP TEMPORARY TABLE creates a transaction in
|
||||
# binary log on read only server
|
||||
# MDEV-19074 Improved read_only mode for slaves with
|
||||
# gtid_strict_mode enabled
|
||||
#
|
||||
create user test@localhost;
|
||||
grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost;
|
||||
create table t1 (a int) engine=myisam;
|
||||
insert into t1 values (1),(2);
|
||||
reset master;
|
||||
set global read_only=1;
|
||||
# Ensure that optimize and analyze doesn't log to binary log
|
||||
connect con1,localhost,test,,test;
|
||||
insert into t1 values(3);
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
repair table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair Error The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
test.t1 repair error Corrupt
|
||||
optimize table t1;
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
# Ensure that using temporary tables is not logged
|
||||
create temporary table tmp1 (a int) engine=myisam;
|
||||
insert into tmp1 values (1),(2);
|
||||
update tmp1 set a=10 where a=2;
|
||||
delete from tmp1 where a=1;
|
||||
create temporary table tmp2 select * from t1;
|
||||
select * from tmp1;
|
||||
a
|
||||
10
|
||||
select * from tmp2;
|
||||
a
|
||||
1
|
||||
2
|
||||
create temporary table tmp3 like t1;
|
||||
create or replace temporary table tmp3 like t1;
|
||||
alter table tmp2 add column (b int);
|
||||
select * from tmp2;
|
||||
a b
|
||||
1 NULL
|
||||
2 NULL
|
||||
insert into t1 select a+100 from tmp2;
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
drop table tmp1,tmp2,tmp3;
|
||||
# Clean up test connection
|
||||
disconnect con1;
|
||||
connection default;
|
||||
# Execute some commands as root that should not be logged
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status Table is already up to date
|
||||
repair table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
# Changes to temporary tables created under readonly should not
|
||||
# be logged
|
||||
create temporary table tmp4 (a int) engine=myisam;
|
||||
insert into tmp4 values (1),(2);
|
||||
create temporary table tmp5 (a int) engine=myisam;
|
||||
insert into tmp5 select * from tmp4;
|
||||
alter table tmp5 add column (b int);
|
||||
set global read_only=0;
|
||||
insert into tmp4 values (3),(4);
|
||||
insert into tmp5 values (10,3),(11,4);
|
||||
select * from tmp4;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
select * from tmp5;
|
||||
a b
|
||||
1 NULL
|
||||
2 NULL
|
||||
10 3
|
||||
11 4
|
||||
update tmp4 set a=10 where a=2;
|
||||
delete from tmp4 where a=1;
|
||||
create table t2 select * from tmp4;
|
||||
alter table tmp5 add column (c int);
|
||||
insert into tmp5 values (20,5,1),(21,5,2);
|
||||
select * from tmp5;
|
||||
a b c
|
||||
1 NULL NULL
|
||||
2 NULL NULL
|
||||
10 3 NULL
|
||||
11 4 NULL
|
||||
20 5 1
|
||||
21 5 2
|
||||
insert into t1 select a+200 from tmp5;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
201
|
||||
202
|
||||
210
|
||||
211
|
||||
220
|
||||
221
|
||||
drop table tmp4,tmp5;
|
||||
# Check what is logged. Only last create select and the insert...select's should be
|
||||
# row-logged
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE `t2` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
)
|
||||
master-bin.000001 # Annotate_rows # # create table t2 select * from tmp4
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows # # insert into t1 select a+200 from tmp5
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
# Clean up
|
||||
drop user test@localhost;
|
||||
drop table t1,t2;
|
129
mysql-test/suite/binlog/r/read_only_statement.result
Normal file
129
mysql-test/suite/binlog/r/read_only_statement.result
Normal file
@ -0,0 +1,129 @@
|
||||
#
|
||||
# MDEV-17863 DROP TEMPORARY TABLE creates a transaction in
|
||||
# binary log on read only server
|
||||
# MDEV-19074 Improved read_only mode for slaves with
|
||||
# gtid_strict_mode enabled
|
||||
#
|
||||
create user test@localhost;
|
||||
grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost;
|
||||
create table t1 (a int) engine=myisam;
|
||||
insert into t1 values (1),(2);
|
||||
reset master;
|
||||
set global read_only=1;
|
||||
# Ensure that optimize and analyze doesn't log to binary log
|
||||
connect con1,localhost,test,,test;
|
||||
insert into t1 values(3);
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
repair table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair Error The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
test.t1 repair error Corrupt
|
||||
optimize table t1;
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
# Ensure that using temporary tables is not logged
|
||||
create temporary table tmp1 (a int) engine=myisam;
|
||||
insert into tmp1 values (1),(2);
|
||||
update tmp1 set a=10 where a=2;
|
||||
delete from tmp1 where a=1;
|
||||
create temporary table tmp2 select * from t1;
|
||||
select * from tmp1;
|
||||
a
|
||||
10
|
||||
select * from tmp2;
|
||||
a
|
||||
1
|
||||
2
|
||||
create temporary table tmp3 like t1;
|
||||
create or replace temporary table tmp3 like t1;
|
||||
alter table tmp2 add column (b int);
|
||||
select * from tmp2;
|
||||
a b
|
||||
1 NULL
|
||||
2 NULL
|
||||
insert into t1 select a+100 from tmp2;
|
||||
ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement
|
||||
drop table tmp1,tmp2,tmp3;
|
||||
# Clean up test connection
|
||||
disconnect con1;
|
||||
connection default;
|
||||
# Execute some commands as root that should not be logged
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status Table is already up to date
|
||||
repair table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
# Changes to temporary tables created under readonly should not
|
||||
# be logged
|
||||
create temporary table tmp4 (a int) engine=myisam;
|
||||
insert into tmp4 values (1),(2);
|
||||
create temporary table tmp5 (a int) engine=myisam;
|
||||
insert into tmp5 select * from tmp4;
|
||||
alter table tmp5 add column (b int);
|
||||
set global read_only=0;
|
||||
insert into tmp4 values (3),(4);
|
||||
insert into tmp5 values (10,3),(11,4);
|
||||
select * from tmp4;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
select * from tmp5;
|
||||
a b
|
||||
1 NULL
|
||||
2 NULL
|
||||
10 3
|
||||
11 4
|
||||
update tmp4 set a=10 where a=2;
|
||||
delete from tmp4 where a=1;
|
||||
create table t2 select * from tmp4;
|
||||
alter table tmp5 add column (c int);
|
||||
insert into tmp5 values (20,5,1),(21,5,2);
|
||||
select * from tmp5;
|
||||
a b c
|
||||
1 NULL NULL
|
||||
2 NULL NULL
|
||||
10 3 NULL
|
||||
11 4 NULL
|
||||
20 5 1
|
||||
21 5 2
|
||||
insert into t1 select a+200 from tmp5;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
201
|
||||
202
|
||||
210
|
||||
211
|
||||
220
|
||||
221
|
||||
drop table tmp4,tmp5;
|
||||
# Check what is logged. Only last create select and the insert...select's should be
|
||||
# row-logged
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Query # # use `test`; CREATE TABLE `t2` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
)
|
||||
master-bin.000001 # Annotate_rows # # create table t2 select * from tmp4
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t2)
|
||||
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
master-bin.000001 # Annotate_rows # # insert into t1 select a+200 from tmp5
|
||||
master-bin.000001 # Table_map # # table_id: # (test.t1)
|
||||
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
|
||||
master-bin.000001 # Query # # COMMIT
|
||||
# Clean up
|
||||
drop user test@localhost;
|
||||
drop table t1,t2;
|
79
mysql-test/suite/binlog/t/read_only.inc
Normal file
79
mysql-test/suite/binlog/t/read_only.inc
Normal file
@ -0,0 +1,79 @@
|
||||
--echo #
|
||||
--echo # MDEV-17863 DROP TEMPORARY TABLE creates a transaction in
|
||||
--echo # binary log on read only server
|
||||
--echo # MDEV-19074 Improved read_only mode for slaves with
|
||||
--echo # gtid_strict_mode enabled
|
||||
--echo #
|
||||
|
||||
create user test@localhost;
|
||||
grant CREATE, DROP, INSERT, SELECT on *.* to test@localhost;
|
||||
create table t1 (a int) engine=myisam;
|
||||
insert into t1 values (1),(2);
|
||||
reset master;
|
||||
|
||||
set global read_only=1;
|
||||
--echo # Ensure that optimize and analyze doesn't log to binary log
|
||||
connect (con1,localhost,test,,test);
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
insert into t1 values(3);
|
||||
analyze table t1;
|
||||
check table t1;
|
||||
repair table t1;
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
optimize table t1;
|
||||
|
||||
--echo # Ensure that using temporary tables is not logged
|
||||
create temporary table tmp1 (a int) engine=myisam;
|
||||
insert into tmp1 values (1),(2);
|
||||
update tmp1 set a=10 where a=2;
|
||||
delete from tmp1 where a=1;
|
||||
create temporary table tmp2 select * from t1;
|
||||
select * from tmp1;
|
||||
select * from tmp2;
|
||||
create temporary table tmp3 like t1;
|
||||
create or replace temporary table tmp3 like t1;
|
||||
alter table tmp2 add column (b int);
|
||||
select * from tmp2;
|
||||
--error ER_OPTION_PREVENTS_STATEMENT
|
||||
insert into t1 select a+100 from tmp2;
|
||||
drop table tmp1,tmp2,tmp3;
|
||||
|
||||
--echo # Clean up test connection
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
||||
--echo # Execute some commands as root that should not be logged
|
||||
optimize table t1;
|
||||
repair table t1;
|
||||
|
||||
--echo # Changes to temporary tables created under readonly should not
|
||||
--echo # be logged
|
||||
create temporary table tmp4 (a int) engine=myisam;
|
||||
insert into tmp4 values (1),(2);
|
||||
create temporary table tmp5 (a int) engine=myisam;
|
||||
insert into tmp5 select * from tmp4;
|
||||
alter table tmp5 add column (b int);
|
||||
|
||||
set global read_only=0;
|
||||
|
||||
insert into tmp4 values (3),(4);
|
||||
insert into tmp5 values (10,3),(11,4);
|
||||
select * from tmp4;
|
||||
select * from tmp5;
|
||||
update tmp4 set a=10 where a=2;
|
||||
delete from tmp4 where a=1;
|
||||
create table t2 select * from tmp4;
|
||||
alter table tmp5 add column (c int);
|
||||
insert into tmp5 values (20,5,1),(21,5,2);
|
||||
select * from tmp5;
|
||||
insert into t1 select a+200 from tmp5;
|
||||
select * from t1;
|
||||
drop table tmp4,tmp5;
|
||||
|
||||
--echo # Check what is logged. Only last create select and the insert...select's should be
|
||||
--echo # row-logged
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
--echo # Clean up
|
||||
drop user test@localhost;
|
||||
drop table t1,t2;
|
2
mysql-test/suite/binlog/t/read_only.test
Normal file
2
mysql-test/suite/binlog/t/read_only.test
Normal file
@ -0,0 +1,2 @@
|
||||
--source include/have_binlog_format_mixed_or_row.inc
|
||||
--source read_only.inc
|
2
mysql-test/suite/binlog/t/read_only_statement.test
Normal file
2
mysql-test/suite/binlog/t/read_only_statement.test
Normal file
@ -0,0 +1,2 @@
|
||||
--source include/have_binlog_format_statement.inc
|
||||
--source read_only.inc
|
@ -337,7 +337,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
SELECT * FROM information_schema.schema_privileges
|
||||
WHERE table_schema = 'information_schema';
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
CREATE VIEW db_datadict.v2 AS
|
||||
CREATE SQL SECURITY INVOKER VIEW db_datadict.v2 AS
|
||||
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
|
||||
FROM information_schema.tables WHERE table_schema = 'db_datadict';
|
||||
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
|
||||
|
@ -281,8 +281,9 @@ WHERE table_schema = 'information_schema';
|
||||
# 2. This user (testuser1) is also able to GRANT the SELECT privilege
|
||||
# on this VIEW to another user (testuser2).
|
||||
# 3. The other user (testuser2) must be able to SELECT on this VIEW
|
||||
# but gets a different result set than testuser1.
|
||||
CREATE VIEW db_datadict.v2 AS
|
||||
# but gets a different result set than testuser1, if the view
|
||||
# has SQL SECURITY INVOKER.
|
||||
CREATE SQL SECURITY INVOKER VIEW db_datadict.v2 AS
|
||||
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
|
||||
FROM information_schema.tables WHERE table_schema = 'db_datadict';
|
||||
SELECT TABLE_SCHEMA,TABLE_NAME,TABLE_TYPE
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- alter_algorithm.result
|
||||
+++ alter_algorithm.reject
|
||||
@@ -7,44 +7,44 @@
|
||||
@@ -7,40 +7,40 @@
|
||||
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
|
||||
SELECT @@alter_algorithm;
|
||||
@@alter_algorithm
|
||||
@ -18,12 +18,6 @@
|
||||
-affected rows: 1
|
||||
-info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
+affected rows: 0
|
||||
+info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
# Make existing column NON-NULLABLE
|
||||
ALTER TABLE t1 MODIFY f3 INT NOT NULL;
|
||||
-affected rows: 1
|
||||
-info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
+affected rows: 0
|
||||
+info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
# Drop Stored Column
|
||||
ALTER TABLE t1 DROP COLUMN f5;
|
||||
@ -64,7 +58,7 @@
|
||||
DROP TABLE t1;
|
||||
affected rows: 0
|
||||
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
|
||||
@@ -57,22 +57,22 @@
|
||||
@@ -53,22 +53,22 @@
|
||||
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
|
||||
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
|
||||
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
|
||||
@ -97,7 +91,7 @@
|
||||
DROP TABLE t2, t1;
|
||||
affected rows: 0
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
@@ -85,27 +85,27 @@
|
||||
@@ -81,27 +81,27 @@
|
||||
INSERT INTO t1(f1, f2) VALUES(1, 1);
|
||||
# Add column at the end of the table
|
||||
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
|
||||
@ -135,7 +129,7 @@
|
||||
# Column length varies
|
||||
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
|
||||
affected rows: 0
|
||||
@@ -113,12 +113,12 @@
|
||||
@@ -109,12 +109,12 @@
|
||||
SET foreign_key_checks = 0;
|
||||
affected rows: 0
|
||||
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- alter_algorithm.result
|
||||
+++ alter_algorithm.reject
|
||||
@@ -7,44 +7,35 @@
|
||||
@@ -7,40 +7,32 @@
|
||||
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
|
||||
SELECT @@alter_algorithm;
|
||||
@@alter_algorithm
|
||||
@ -16,11 +16,6 @@
|
||||
ALTER TABLE t1 MODIFY f2 INT;
|
||||
-affected rows: 1
|
||||
-info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
+Got one of the listed errors
|
||||
# Make existing column NON-NULLABLE
|
||||
ALTER TABLE t1 MODIFY f3 INT NOT NULL;
|
||||
-affected rows: 1
|
||||
-info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
+Got one of the listed errors
|
||||
# Drop Stored Column
|
||||
ALTER TABLE t1 DROP COLUMN f5;
|
||||
@ -55,7 +50,7 @@
|
||||
DROP TABLE t1;
|
||||
affected rows: 0
|
||||
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
|
||||
@@ -57,22 +48,17 @@
|
||||
@@ -53,22 +45,17 @@
|
||||
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
|
||||
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
|
||||
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
|
||||
@ -83,7 +78,7 @@
|
||||
DROP TABLE t2, t1;
|
||||
affected rows: 0
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
@@ -85,27 +71,27 @@
|
||||
@@ -81,27 +68,27 @@
|
||||
INSERT INTO t1(f1, f2) VALUES(1, 1);
|
||||
# Add column at the end of the table
|
||||
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
|
||||
@ -121,7 +116,7 @@
|
||||
# Column length varies
|
||||
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
|
||||
affected rows: 0
|
||||
@@ -113,12 +99,12 @@
|
||||
@@ -109,12 +96,12 @@
|
||||
SET foreign_key_checks = 0;
|
||||
affected rows: 0
|
||||
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- alter_algorithm.result
|
||||
+++ alter_algorithm.reject
|
||||
@@ -7,44 +7,35 @@
|
||||
@@ -7,40 +7,32 @@
|
||||
INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1);
|
||||
SELECT @@alter_algorithm;
|
||||
@@alter_algorithm
|
||||
@ -16,11 +16,6 @@
|
||||
ALTER TABLE t1 MODIFY f2 INT;
|
||||
-affected rows: 1
|
||||
-info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
+Got one of the listed errors
|
||||
# Make existing column NON-NULLABLE
|
||||
ALTER TABLE t1 MODIFY f3 INT NOT NULL;
|
||||
-affected rows: 1
|
||||
-info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
+Got one of the listed errors
|
||||
# Drop Stored Column
|
||||
ALTER TABLE t1 DROP COLUMN f5;
|
||||
@ -55,7 +50,7 @@
|
||||
DROP TABLE t1;
|
||||
affected rows: 0
|
||||
CREATE TABLE t1(f1 INT PRIMARY KEY, f2 INT NOT NULL,
|
||||
@@ -57,22 +48,22 @@
|
||||
@@ -53,22 +45,22 @@
|
||||
FOREIGN KEY fidx(f1) REFERENCES t1(f1))ENGINE=INNODB;
|
||||
INSERT INTO t1(f1, f2, f4, f5) VALUES(1, 2, 3, 4);
|
||||
ALTER TABLE t1 ADD INDEX idx1(f4), page_compressed=1;
|
||||
@ -88,7 +83,7 @@
|
||||
DROP TABLE t2, t1;
|
||||
affected rows: 0
|
||||
CREATE TABLE t1(f1 INT NOT NULL,
|
||||
@@ -85,27 +76,27 @@
|
||||
@@ -81,27 +73,27 @@
|
||||
INSERT INTO t1(f1, f2) VALUES(1, 1);
|
||||
# Add column at the end of the table
|
||||
ALTER TABLE t1 ADD COLUMN f4 char(100) default 'BIG WALL';
|
||||
@ -126,7 +121,7 @@
|
||||
# Column length varies
|
||||
ALTER TABLE t2 CHANGE f3 f3 VARCHAR(20);
|
||||
affected rows: 0
|
||||
@@ -113,12 +104,12 @@
|
||||
@@ -109,12 +101,12 @@
|
||||
SET foreign_key_checks = 0;
|
||||
affected rows: 0
|
||||
ALTER TABLE t3 ADD FOREIGN KEY fidx(f2) REFERENCES t2(f1);
|
||||
|
@ -17,10 +17,6 @@ info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t1 MODIFY f2 INT;
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
# Make existing column NON-NULLABLE
|
||||
ALTER TABLE t1 MODIFY f3 INT NOT NULL;
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
# Drop Stored Column
|
||||
ALTER TABLE t1 DROP COLUMN f5;
|
||||
affected rows: 1
|
||||
|
@ -18,7 +18,7 @@ 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;
|
||||
# restart: --innodb-force-recovery=6
|
||||
# restart: --innodb-force-recovery=6 --innodb-change-buffer-dump
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check Warning InnoDB: Index 'b' contains #### entries, should be 4096.
|
||||
|
304
mysql-test/suite/innodb/r/information_schema_grants.result
Normal file
304
mysql-test/suite/innodb/r/information_schema_grants.result
Normal file
@ -0,0 +1,304 @@
|
||||
select plugin_name,plugin_status as 'Must be ACTIVE' from information_schema.plugins where plugin_name like 'inno%' and plugin_status!='ACTIVE';
|
||||
plugin_name Must be ACTIVE
|
||||
create user select_only@localhost;
|
||||
grant select on *.* to select_only@localhost;
|
||||
connect select_only,localhost,select_only;
|
||||
connection default;
|
||||
create sql security invoker view i_buffer_page as select * from information_schema.innodb_buffer_page;
|
||||
create sql security definer view d_buffer_page as select * from information_schema.innodb_buffer_page;
|
||||
create sql security invoker view i_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru;
|
||||
create sql security definer view d_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru;
|
||||
create sql security invoker view i_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats;
|
||||
create sql security definer view d_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats;
|
||||
create sql security invoker view i_cmp as select * from information_schema.innodb_cmp;
|
||||
create sql security definer view d_cmp as select * from information_schema.innodb_cmp;
|
||||
create sql security invoker view i_cmp_per_index as select * from information_schema.innodb_cmp_per_index;
|
||||
create sql security definer view d_cmp_per_index as select * from information_schema.innodb_cmp_per_index;
|
||||
create sql security invoker view i_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset;
|
||||
create sql security definer view d_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset;
|
||||
create sql security invoker view i_cmp_reset as select * from information_schema.innodb_cmp_reset;
|
||||
create sql security definer view d_cmp_reset as select * from information_schema.innodb_cmp_reset;
|
||||
create sql security invoker view i_cmpmem as select * from information_schema.innodb_cmpmem;
|
||||
create sql security definer view d_cmpmem as select * from information_schema.innodb_cmpmem;
|
||||
create sql security invoker view i_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset;
|
||||
create sql security definer view d_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset;
|
||||
create sql security invoker view i_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted;
|
||||
create sql security definer view d_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted;
|
||||
create sql security invoker view i_ft_config as select * from information_schema.innodb_ft_config;
|
||||
create sql security definer view d_ft_config as select * from information_schema.innodb_ft_config;
|
||||
create sql security invoker view i_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword;
|
||||
create sql security definer view d_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword;
|
||||
create sql security invoker view i_ft_deleted as select * from information_schema.innodb_ft_deleted;
|
||||
create sql security definer view d_ft_deleted as select * from information_schema.innodb_ft_deleted;
|
||||
create sql security invoker view i_ft_index_cache as select * from information_schema.innodb_ft_index_cache;
|
||||
create sql security definer view d_ft_index_cache as select * from information_schema.innodb_ft_index_cache;
|
||||
create sql security invoker view i_ft_index_table as select * from information_schema.innodb_ft_index_table;
|
||||
create sql security definer view d_ft_index_table as select * from information_schema.innodb_ft_index_table;
|
||||
create sql security invoker view i_lock_waits as select * from information_schema.innodb_lock_waits;
|
||||
create sql security definer view d_lock_waits as select * from information_schema.innodb_lock_waits;
|
||||
create sql security invoker view i_locks as select * from information_schema.innodb_locks;
|
||||
create sql security definer view d_locks as select * from information_schema.innodb_locks;
|
||||
create sql security invoker view i_metrics as select * from information_schema.innodb_metrics;
|
||||
create sql security definer view d_metrics as select * from information_schema.innodb_metrics;
|
||||
create sql security invoker view i_mutexes as select * from information_schema.innodb_mutexes;
|
||||
create sql security definer view d_mutexes as select * from information_schema.innodb_mutexes;
|
||||
create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns;
|
||||
create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns;
|
||||
create sql security invoker view i_sys_datafiles as select * from information_schema.innodb_sys_datafiles;
|
||||
create sql security definer view d_sys_datafiles as select * from information_schema.innodb_sys_datafiles;
|
||||
create sql security invoker view i_sys_fields as select * from information_schema.innodb_sys_fields;
|
||||
create sql security definer view d_sys_fields as select * from information_schema.innodb_sys_fields;
|
||||
create sql security invoker view i_sys_foreign as select * from information_schema.innodb_sys_foreign;
|
||||
create sql security definer view d_sys_foreign as select * from information_schema.innodb_sys_foreign;
|
||||
create sql security invoker view i_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols;
|
||||
create sql security definer view d_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols;
|
||||
create sql security invoker view i_sys_indexes as select * from information_schema.innodb_sys_indexes;
|
||||
create sql security definer view d_sys_indexes as select * from information_schema.innodb_sys_indexes;
|
||||
create sql security invoker view i_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits;
|
||||
create sql security definer view d_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits;
|
||||
create sql security invoker view i_sys_tables as select * from information_schema.innodb_sys_tables;
|
||||
create sql security definer view d_sys_tables as select * from information_schema.innodb_sys_tables;
|
||||
create sql security invoker view i_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces;
|
||||
create sql security definer view d_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces;
|
||||
create sql security invoker view i_sys_tablestats as select * from information_schema.innodb_sys_tablestats;
|
||||
create sql security definer view d_sys_tablestats as select * from information_schema.innodb_sys_tablestats;
|
||||
create sql security invoker view i_sys_virtual as select * from information_schema.innodb_sys_virtual;
|
||||
create sql security definer view d_sys_virtual as select * from information_schema.innodb_sys_virtual;
|
||||
create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
|
||||
create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
|
||||
create sql security invoker view i_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
|
||||
create sql security definer view d_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
|
||||
create sql security invoker view i_trx as select * from information_schema.innodb_trx;
|
||||
create sql security definer view d_trx as select * from information_schema.innodb_trx;
|
||||
connection select_only;
|
||||
select count(*) > -1 from information_schema.innodb_buffer_page;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_buffer_page;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_buffer_page;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_buffer_page_lru;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_buffer_page_lru;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_buffer_page_lru;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_buffer_pool_stats;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_buffer_pool_stats;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_buffer_pool_stats;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_cmp;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_cmp;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_cmp;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_cmp_per_index;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_cmp_per_index;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_cmp_per_index;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_cmp_per_index_reset;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_cmp_per_index_reset;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_cmp_per_index_reset;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_cmp_reset;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_cmp_reset;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_cmp_reset;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_cmpmem;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_cmpmem;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_cmpmem;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_cmpmem_reset;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_cmpmem_reset;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_cmpmem_reset;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_ft_being_deleted;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_ft_being_deleted;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_ft_being_deleted;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_ft_config;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_ft_config;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_ft_config;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_ft_default_stopword;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_ft_deleted;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_ft_deleted;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_ft_deleted;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_ft_index_cache;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_ft_index_cache;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_ft_index_cache;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_ft_index_table;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_ft_index_table;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_ft_index_table;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_lock_waits;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_lock_waits;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_lock_waits;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_locks;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_locks;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_locks;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_metrics;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_metrics;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_metrics;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_mutexes;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_mutexes;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_mutexes;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_columns;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_columns;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_columns;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_datafiles;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_datafiles;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_datafiles;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_fields;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_fields;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_fields;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_foreign;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_foreign;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_foreign;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_foreign_cols;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_foreign_cols;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_foreign_cols;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_indexes;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_indexes;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_indexes;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_semaphore_waits;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_semaphore_waits;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_semaphore_waits;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_tables;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_tables;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_tables;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_tablespaces;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_tablespaces;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_tablespaces;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_tablestats;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_tablestats;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_tablestats;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_sys_virtual;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_sys_virtual;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_sys_virtual;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_tablespaces_encryption;
|
||||
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
|
||||
select count(*) > -1 from i_tablespaces_encryption;
|
||||
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
|
||||
select count(*) > -1 from d_tablespaces_encryption;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_tablespaces_scrubbing;
|
||||
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
|
||||
select count(*) > -1 from i_tablespaces_scrubbing;
|
||||
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
|
||||
select count(*) > -1 from d_tablespaces_scrubbing;
|
||||
count(*) > -1
|
||||
1
|
||||
select count(*) > -1 from information_schema.innodb_trx;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from i_trx;
|
||||
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
|
||||
select count(*) > -1 from d_trx;
|
||||
count(*) > -1
|
||||
1
|
||||
connection default;
|
||||
drop database test;
|
||||
create database test;
|
||||
drop user select_only@localhost;
|
@ -96,8 +96,8 @@ INSERT INTO t3 SET c=NULL;
|
||||
SET @old_sql_mode = @@sql_mode;
|
||||
SET sql_mode = '';
|
||||
ALTER TABLE t1 MODIFY c INT NOT NULL;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 1
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 1
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
ALTER TABLE t2 MODIFY c INT NOT NULL;
|
||||
@ -111,10 +111,9 @@ info: Records: 1 Duplicates: 0 Warnings: 1
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
SET sql_mode = @old_sql_mode;
|
||||
# MDEV-18819 FIXME: Wrong result g=NULL
|
||||
SELECT * FROM t1;
|
||||
c g
|
||||
0 NULL
|
||||
0 0
|
||||
SELECT * FROM t2;
|
||||
c v
|
||||
0 0
|
||||
@ -137,8 +136,8 @@ INSERT INTO t1 SET c=NULL;
|
||||
INSERT INTO t2 SET c=NULL;
|
||||
INSERT INTO t3 SET c=NULL;
|
||||
ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 1
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 1
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL;
|
||||
@ -151,10 +150,9 @@ affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 1
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c' at row 1
|
||||
# MDEV-18819 FIXME: Wrong result g=NULL
|
||||
SELECT * FROM t1;
|
||||
c g
|
||||
0 NULL
|
||||
0 0
|
||||
SELECT * FROM t2;
|
||||
c v
|
||||
0 0
|
||||
@ -186,12 +184,11 @@ UPDATE t1 SET c=0;
|
||||
UPDATE t2 SET c=0;
|
||||
UPDATE t3 SET c=0;
|
||||
ALTER TABLE t1 MODIFY c INT NOT NULL;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
ALTER TABLE t2 MODIFY c INT NOT NULL;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
# MDEV-18819 FIXME: This should not require ALGORITHM=COPY.
|
||||
ALTER TABLE t3 MODIFY c INT NOT NULL;
|
||||
affected rows: 1
|
||||
info: Records: 1 Duplicates: 0 Warnings: 0
|
||||
|
@ -567,7 +567,7 @@ Variable_name Value
|
||||
auto_increment_increment 65535
|
||||
auto_increment_offset 65535
|
||||
INSERT INTO t1 VALUES (NULL),(NULL);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
ERROR 22003: Out of range value for column 'c1' at row 1
|
||||
SELECT * FROM t1;
|
||||
c1
|
||||
1
|
||||
@ -677,7 +677,7 @@ SELECT a,b FROM t;
|
||||
a b
|
||||
1 S1
|
||||
3 S2
|
||||
4 S2
|
||||
5 S2
|
||||
disconnect con1;
|
||||
connection default;
|
||||
# Client 1: Insert a record with auto_increment_increment=1
|
||||
@ -688,14 +688,14 @@ t CREATE TABLE `t` (
|
||||
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S1');
|
||||
SELECT a,b FROM t;
|
||||
a b
|
||||
1 S1
|
||||
3 S2
|
||||
4 S2
|
||||
5 S1
|
||||
5 S2
|
||||
6 S1
|
||||
DROP TABLE t;
|
||||
# Autoincrement behaviour with mixed insert.
|
||||
CREATE TABLE t(
|
||||
@ -733,22 +733,22 @@ t CREATE TABLE `t` (
|
||||
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t(b) VALUES('S4');
|
||||
SELECT * FROM t;
|
||||
a b
|
||||
1 S0
|
||||
11 S1
|
||||
22 S3
|
||||
23 S4
|
||||
28 S2
|
||||
31 S3
|
||||
32 S4
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`a` tinyint(4) NOT NULL AUTO_INCREMENT,
|
||||
`b` varchar(200) DEFAULT NULL,
|
||||
PRIMARY KEY (`a`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=5;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
@ -789,7 +789,7 @@ t2 CREATE TABLE `t2` (
|
||||
`n` int(10) unsigned NOT NULL,
|
||||
`o` enum('FALSE','TRUE') DEFAULT NULL,
|
||||
PRIMARY KEY (`m`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=latin1
|
||||
INSERT INTO t1 (b,c) SELECT n,o FROM t2 ;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
@ -1475,13 +1475,13 @@ SELECT * FROM t;
|
||||
i
|
||||
1
|
||||
301
|
||||
351
|
||||
601
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`i` int(11) NOT NULL AUTO_INCREMENT,
|
||||
KEY `i` (`i`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=401 DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=651 DEFAULT CHARSET=latin1
|
||||
DROP TABLE t;
|
||||
SET auto_increment_increment = DEFAULT;
|
||||
#
|
||||
|
@ -1,22 +1,15 @@
|
||||
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked;
|
||||
SET GLOBAL innodb_stats_include_delete_marked = ON;
|
||||
SET @saved_traditional = @@GLOBAL.innodb_stats_traditional;
|
||||
SET GLOBAL innodb_stats_traditional=false;
|
||||
SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter;
|
||||
SET GLOBAL innodb_stats_modified_counter=1;
|
||||
CREATE TABLE t0 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
|
||||
CREATE TABLE t1 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
|
||||
ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
|
||||
CREATE TABLE t1 LIKE t0;
|
||||
CREATE TABLE t2 LIKE t0;
|
||||
INSERT INTO t0 (val) VALUES (4);
|
||||
INSERT INTO t0 (val) SELECT 4 FROM t0;
|
||||
INSERT INTO t0 (val) SELECT 4 FROM t0;
|
||||
INSERT INTO t0 (val) SELECT 4 FROM t0;
|
||||
INSERT INTO t0 (val) SELECT 4 FROM t0;
|
||||
INSERT INTO t1 SELECT * FROM t0;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
COUNT(*)
|
||||
16
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
|
||||
ANALYZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
@ -49,7 +42,7 @@ COUNT(*)
|
||||
0
|
||||
connection default;
|
||||
BEGIN;
|
||||
INSERT INTO t2 SELECT * FROM t0;
|
||||
INSERT INTO t2 (val) SELECT 4 FROM seq_1_to_16;
|
||||
# The INSERT will show up before COMMIT.
|
||||
EXPLAIN SELECT * FROM t2 WHERE val=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -66,17 +59,14 @@ connection con1;
|
||||
EXPLAIN SELECT * FROM t2 WHERE val=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref val val 4 const 1 Using index
|
||||
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
InnoDB 0 transactions not purged
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
||||
# After COMMIT and purge, the DELETE must show up.
|
||||
EXPLAIN SELECT * FROM t1 WHERE val=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref val val 4 const 1 Using index
|
||||
SET GLOBAL innodb_stats_include_delete_marked = OFF;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT * FROM t0;
|
||||
INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
|
||||
EXPLAIN SELECT * FROM t1 WHERE val=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref val val 4 const 16 Using index
|
||||
@ -85,7 +75,7 @@ EXPLAIN SELECT * FROM t1 WHERE val=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref val val 4 const 1 Using index
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT * FROM t0;
|
||||
INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
|
||||
COMMIT;
|
||||
EXPLAIN SELECT * FROM t1 WHERE val=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -111,7 +101,8 @@ COUNT(*)
|
||||
16
|
||||
disconnect con1;
|
||||
connection default;
|
||||
DROP TABLE t0,t1,t2;
|
||||
DROP TABLE t1,t2;
|
||||
SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked;
|
||||
SET GLOBAL innodb_stats_traditional = @saved_traditional;
|
||||
SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
||||
|
@ -130,6 +130,10 @@ HANDLER h READ `PRIMARY` PREV WHERE 0;
|
||||
pk f1 f2 f3 f4 f5 f6 f7 f8 filler
|
||||
HANDLER h CLOSE;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys
|
||||
# which are pointed to the table being altered
|
||||
#
|
||||
CREATE TABLE t1(f1 int not null, primary key(f1))engine=innodb;
|
||||
CREATE TABLE t2(f1 INT AUTO_INCREMENT NOT NULL, f2 INT NOT NULL,
|
||||
status ENUM ('a', 'b', 'c'), INDEX idx1(f2),
|
||||
@ -156,6 +160,17 @@ t2 CREATE TABLE `t2` (
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
ALTER TABLE t2 CHANGE status status VARCHAR(20) DEFAULT NULL;
|
||||
DROP TABLE t2, t1;
|
||||
#
|
||||
# MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE
|
||||
#
|
||||
CREATE TABLE t1 (id INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT UNSIGNED PRIMARY KEY, b INT UNSIGNED UNIQUE,
|
||||
FOREIGN KEY fk1 (b) REFERENCES t1 (id)) ENGINE=InnoDB;
|
||||
ALTER TABLE t2
|
||||
DROP FOREIGN KEY fk1,
|
||||
CHANGE b d INT UNSIGNED,
|
||||
ADD c INT;
|
||||
DROP TABLE t2, t1;
|
||||
create table t (
|
||||
a varchar(9),
|
||||
b int,
|
||||
|
15
mysql-test/suite/innodb/r/stat_tables.result
Normal file
15
mysql-test/suite/innodb/r/stat_tables.result
Normal file
@ -0,0 +1,15 @@
|
||||
rename table mysql.table_stats to mysql.table_stats_save;
|
||||
flush tables;
|
||||
set use_stat_tables= PREFERABLY;
|
||||
create table t1 (a int) engine=InnoDB;
|
||||
start transaction;
|
||||
insert t1 values (1);
|
||||
insert t1 values (2);
|
||||
commit;
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
drop table t1;
|
||||
rename table mysql.table_stats_save to mysql.table_stats;
|
||||
flush tables;
|
@ -31,10 +31,6 @@ ALTER TABLE t1 ADD COLUMN col1 INT NOT NULL,DROP PRIMARY KEY,ADD PRIMARY KEY(col
|
||||
--error $error_code
|
||||
ALTER TABLE t1 MODIFY f2 INT;
|
||||
|
||||
--echo # Make existing column NON-NULLABLE
|
||||
--error $error_code
|
||||
ALTER TABLE t1 MODIFY f3 INT NOT NULL;
|
||||
|
||||
--echo # Drop Stored Column
|
||||
--error $error_code
|
||||
ALTER TABLE t1 DROP COLUMN f5;
|
||||
|
@ -43,7 +43,7 @@ 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 $restart_parameters= --innodb-force-recovery=6
|
||||
--let $restart_parameters= --innodb-force-recovery=6 --innodb-change-buffer-dump
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--replace_regex /contains \d+ entries/contains #### entries/
|
||||
|
33
mysql-test/suite/innodb/t/information_schema_grants.opt
Normal file
33
mysql-test/suite/innodb/t/information_schema_grants.opt
Normal file
@ -0,0 +1,33 @@
|
||||
--enable-plugin-innodb-trx
|
||||
--enable-plugin-innodb-locks
|
||||
--enable-plugin-innodb-lock-waits
|
||||
--enable-plugin-innodb-cmp
|
||||
--enable-plugin-innodb-cmp-reset
|
||||
--enable-plugin-innodb-cmpmem
|
||||
--enable-plugin-innodb-cmpmem-reset
|
||||
--enable-plugin-innodb-cmp-per-index
|
||||
--enable-plugin-innodb-cmp-per-index-reset
|
||||
--enable-plugin-innodb-buffer-page
|
||||
--enable-plugin-innodb-buffer-page-lru
|
||||
--enable-plugin-innodb-buffer-pool-stats
|
||||
--enable-plugin-innodb-metrics
|
||||
--enable-plugin-innodb-ft-default-stopword
|
||||
--enable-plugin-innodb-ft-deleted
|
||||
--enable-plugin-innodb-ft-being-deleted
|
||||
--enable-plugin-innodb-ft-config
|
||||
--enable-plugin-innodb-ft-index-cache
|
||||
--enable-plugin-innodb-ft-index-table
|
||||
--enable-plugin-innodb-sys-tables
|
||||
--enable-plugin-innodb-sys-tablestats
|
||||
--enable-plugin-innodb-sys-indexes
|
||||
--enable-plugin-innodb-sys-columns
|
||||
--enable-plugin-innodb-sys-fields
|
||||
--enable-plugin-innodb-sys-foreign
|
||||
--enable-plugin-innodb-sys-foreign-cols
|
||||
--enable-plugin-innodb-sys-tablespaces
|
||||
--enable-plugin-innodb-sys-datafiles
|
||||
--enable-plugin-innodb-sys-virtual
|
||||
--enable-plugin-innodb-mutexes
|
||||
--enable-plugin-innodb-sys-semaphore-waits
|
||||
--enable-plugin-innodb-tablespaces-encryption
|
||||
--enable-plugin-innodb-tablespaces-scrubbing
|
311
mysql-test/suite/innodb/t/information_schema_grants.test
Normal file
311
mysql-test/suite/innodb/t/information_schema_grants.test
Normal file
@ -0,0 +1,311 @@
|
||||
source include/have_innodb.inc;
|
||||
source include/not_embedded.inc;
|
||||
|
||||
# make sure we've enabled everything:
|
||||
select plugin_name,plugin_status as 'Must be ACTIVE' from information_schema.plugins where plugin_name like 'inno%' and plugin_status!='ACTIVE';
|
||||
|
||||
create user select_only@localhost;
|
||||
grant select on *.* to select_only@localhost;
|
||||
|
||||
connect select_only,localhost,select_only;
|
||||
connection default;
|
||||
|
||||
create sql security invoker view i_buffer_page as select * from information_schema.innodb_buffer_page;
|
||||
create sql security definer view d_buffer_page as select * from information_schema.innodb_buffer_page;
|
||||
|
||||
create sql security invoker view i_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru;
|
||||
create sql security definer view d_buffer_page_lru as select * from information_schema.innodb_buffer_page_lru;
|
||||
|
||||
create sql security invoker view i_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats;
|
||||
create sql security definer view d_buffer_pool_stats as select * from information_schema.innodb_buffer_pool_stats;
|
||||
|
||||
create sql security invoker view i_cmp as select * from information_schema.innodb_cmp;
|
||||
create sql security definer view d_cmp as select * from information_schema.innodb_cmp;
|
||||
|
||||
create sql security invoker view i_cmp_per_index as select * from information_schema.innodb_cmp_per_index;
|
||||
create sql security definer view d_cmp_per_index as select * from information_schema.innodb_cmp_per_index;
|
||||
|
||||
create sql security invoker view i_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset;
|
||||
create sql security definer view d_cmp_per_index_reset as select * from information_schema.innodb_cmp_per_index_reset;
|
||||
|
||||
create sql security invoker view i_cmp_reset as select * from information_schema.innodb_cmp_reset;
|
||||
create sql security definer view d_cmp_reset as select * from information_schema.innodb_cmp_reset;
|
||||
|
||||
create sql security invoker view i_cmpmem as select * from information_schema.innodb_cmpmem;
|
||||
create sql security definer view d_cmpmem as select * from information_schema.innodb_cmpmem;
|
||||
|
||||
create sql security invoker view i_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset;
|
||||
create sql security definer view d_cmpmem_reset as select * from information_schema.innodb_cmpmem_reset;
|
||||
|
||||
create sql security invoker view i_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted;
|
||||
create sql security definer view d_ft_being_deleted as select * from information_schema.innodb_ft_being_deleted;
|
||||
|
||||
create sql security invoker view i_ft_config as select * from information_schema.innodb_ft_config;
|
||||
create sql security definer view d_ft_config as select * from information_schema.innodb_ft_config;
|
||||
|
||||
create sql security invoker view i_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword;
|
||||
create sql security definer view d_ft_default_stopword as select * from information_schema.innodb_ft_default_stopword;
|
||||
|
||||
create sql security invoker view i_ft_deleted as select * from information_schema.innodb_ft_deleted;
|
||||
create sql security definer view d_ft_deleted as select * from information_schema.innodb_ft_deleted;
|
||||
|
||||
create sql security invoker view i_ft_index_cache as select * from information_schema.innodb_ft_index_cache;
|
||||
create sql security definer view d_ft_index_cache as select * from information_schema.innodb_ft_index_cache;
|
||||
|
||||
create sql security invoker view i_ft_index_table as select * from information_schema.innodb_ft_index_table;
|
||||
create sql security definer view d_ft_index_table as select * from information_schema.innodb_ft_index_table;
|
||||
|
||||
create sql security invoker view i_lock_waits as select * from information_schema.innodb_lock_waits;
|
||||
create sql security definer view d_lock_waits as select * from information_schema.innodb_lock_waits;
|
||||
|
||||
create sql security invoker view i_locks as select * from information_schema.innodb_locks;
|
||||
create sql security definer view d_locks as select * from information_schema.innodb_locks;
|
||||
|
||||
create sql security invoker view i_metrics as select * from information_schema.innodb_metrics;
|
||||
create sql security definer view d_metrics as select * from information_schema.innodb_metrics;
|
||||
|
||||
create sql security invoker view i_mutexes as select * from information_schema.innodb_mutexes;
|
||||
create sql security definer view d_mutexes as select * from information_schema.innodb_mutexes;
|
||||
|
||||
create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns;
|
||||
create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns;
|
||||
|
||||
create sql security invoker view i_sys_datafiles as select * from information_schema.innodb_sys_datafiles;
|
||||
create sql security definer view d_sys_datafiles as select * from information_schema.innodb_sys_datafiles;
|
||||
|
||||
create sql security invoker view i_sys_fields as select * from information_schema.innodb_sys_fields;
|
||||
create sql security definer view d_sys_fields as select * from information_schema.innodb_sys_fields;
|
||||
|
||||
create sql security invoker view i_sys_foreign as select * from information_schema.innodb_sys_foreign;
|
||||
create sql security definer view d_sys_foreign as select * from information_schema.innodb_sys_foreign;
|
||||
|
||||
create sql security invoker view i_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols;
|
||||
create sql security definer view d_sys_foreign_cols as select * from information_schema.innodb_sys_foreign_cols;
|
||||
|
||||
create sql security invoker view i_sys_indexes as select * from information_schema.innodb_sys_indexes;
|
||||
create sql security definer view d_sys_indexes as select * from information_schema.innodb_sys_indexes;
|
||||
|
||||
create sql security invoker view i_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits;
|
||||
create sql security definer view d_sys_semaphore_waits as select * from information_schema.innodb_sys_semaphore_waits;
|
||||
|
||||
create sql security invoker view i_sys_tables as select * from information_schema.innodb_sys_tables;
|
||||
create sql security definer view d_sys_tables as select * from information_schema.innodb_sys_tables;
|
||||
|
||||
create sql security invoker view i_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces;
|
||||
create sql security definer view d_sys_tablespaces as select * from information_schema.innodb_sys_tablespaces;
|
||||
|
||||
create sql security invoker view i_sys_tablestats as select * from information_schema.innodb_sys_tablestats;
|
||||
create sql security definer view d_sys_tablestats as select * from information_schema.innodb_sys_tablestats;
|
||||
|
||||
create sql security invoker view i_sys_virtual as select * from information_schema.innodb_sys_virtual;
|
||||
create sql security definer view d_sys_virtual as select * from information_schema.innodb_sys_virtual;
|
||||
|
||||
create sql security invoker view i_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
|
||||
create sql security definer view d_tablespaces_encryption as select * from information_schema.innodb_tablespaces_encryption;
|
||||
|
||||
create sql security invoker view i_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
|
||||
create sql security definer view d_tablespaces_scrubbing as select * from information_schema.innodb_tablespaces_scrubbing;
|
||||
|
||||
create sql security invoker view i_trx as select * from information_schema.innodb_trx;
|
||||
create sql security definer view d_trx as select * from information_schema.innodb_trx;
|
||||
|
||||
connection select_only;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_buffer_page;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_buffer_page;
|
||||
select count(*) > -1 from d_buffer_page;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_buffer_page_lru;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_buffer_page_lru;
|
||||
select count(*) > -1 from d_buffer_page_lru;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_buffer_pool_stats;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_buffer_pool_stats;
|
||||
select count(*) > -1 from d_buffer_pool_stats;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_cmp;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_cmp;
|
||||
select count(*) > -1 from d_cmp;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_cmp_per_index;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_cmp_per_index;
|
||||
select count(*) > -1 from d_cmp_per_index;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_cmp_per_index_reset;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_cmp_per_index_reset;
|
||||
select count(*) > -1 from d_cmp_per_index_reset;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_cmp_reset;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_cmp_reset;
|
||||
select count(*) > -1 from d_cmp_reset;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_cmpmem;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_cmpmem;
|
||||
select count(*) > -1 from d_cmpmem;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_cmpmem_reset;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_cmpmem_reset;
|
||||
select count(*) > -1 from d_cmpmem_reset;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_ft_being_deleted;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_ft_being_deleted;
|
||||
select count(*) > -1 from d_ft_being_deleted;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_ft_config;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_ft_config;
|
||||
select count(*) > -1 from d_ft_config;
|
||||
|
||||
# non-privileged table
|
||||
select count(*) > -1 from information_schema.innodb_ft_default_stopword;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_ft_deleted;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_ft_deleted;
|
||||
select count(*) > -1 from d_ft_deleted;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_ft_index_cache;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_ft_index_cache;
|
||||
select count(*) > -1 from d_ft_index_cache;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_ft_index_table;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_ft_index_table;
|
||||
select count(*) > -1 from d_ft_index_table;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_lock_waits;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_lock_waits;
|
||||
select count(*) > -1 from d_lock_waits;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_locks;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_locks;
|
||||
select count(*) > -1 from d_locks;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_metrics;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_metrics;
|
||||
select count(*) > -1 from d_metrics;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_mutexes;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_mutexes;
|
||||
select count(*) > -1 from d_mutexes;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_columns;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_columns;
|
||||
select count(*) > -1 from d_sys_columns;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_datafiles;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_datafiles;
|
||||
select count(*) > -1 from d_sys_datafiles;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_fields;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_fields;
|
||||
select count(*) > -1 from d_sys_fields;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_foreign;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_foreign;
|
||||
select count(*) > -1 from d_sys_foreign;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_foreign_cols;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_foreign_cols;
|
||||
select count(*) > -1 from d_sys_foreign_cols;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_indexes;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_indexes;
|
||||
select count(*) > -1 from d_sys_indexes;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_semaphore_waits;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_semaphore_waits;
|
||||
select count(*) > -1 from d_sys_semaphore_waits;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_tables;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_tables;
|
||||
select count(*) > -1 from d_sys_tables;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_tablespaces;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_tablespaces;
|
||||
select count(*) > -1 from d_sys_tablespaces;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_tablestats;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_tablestats;
|
||||
select count(*) > -1 from d_sys_tablestats;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_sys_virtual;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_sys_virtual;
|
||||
select count(*) > -1 from d_sys_virtual;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_tablespaces_encryption;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_tablespaces_encryption;
|
||||
select count(*) > -1 from d_tablespaces_encryption;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_tablespaces_scrubbing;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_tablespaces_scrubbing;
|
||||
select count(*) > -1 from d_tablespaces_scrubbing;
|
||||
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from information_schema.innodb_trx;
|
||||
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
|
||||
select count(*) > -1 from i_trx;
|
||||
select count(*) > -1 from d_trx;
|
||||
|
||||
connection default;
|
||||
drop database test;
|
||||
create database test;
|
||||
drop user select_only@localhost;
|
@ -104,7 +104,6 @@ ALTER TABLE t2 MODIFY c INT NOT NULL;
|
||||
ALTER TABLE t3 MODIFY c INT NOT NULL;
|
||||
--disable_info
|
||||
SET sql_mode = @old_sql_mode;
|
||||
--echo # MDEV-18819 FIXME: Wrong result g=NULL
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
SELECT * FROM t3;
|
||||
@ -123,7 +122,6 @@ ALTER IGNORE TABLE t1 MODIFY c INT NOT NULL;
|
||||
ALTER IGNORE TABLE t2 MODIFY c INT NOT NULL;
|
||||
ALTER IGNORE TABLE t3 MODIFY c INT NOT NULL;
|
||||
--disable_info
|
||||
--echo # MDEV-18819 FIXME: Wrong result g=NULL
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
SELECT * FROM t3;
|
||||
@ -151,7 +149,6 @@ UPDATE t3 SET c=0;
|
||||
--enable_info
|
||||
ALTER TABLE t1 MODIFY c INT NOT NULL;
|
||||
ALTER TABLE t2 MODIFY c INT NOT NULL;
|
||||
--echo # MDEV-18819 FIXME: This should not require ALGORITHM=COPY.
|
||||
ALTER TABLE t3 MODIFY c INT NOT NULL;
|
||||
--disable_info
|
||||
SELECT * FROM t1;
|
||||
|
@ -349,7 +349,7 @@ INSERT INTO t1 VALUES (18446744073709551610); #-- 2^64 - 2
|
||||
SELECT * FROM t1;
|
||||
SET @@SESSION.AUTO_INCREMENT_INCREMENT=1152921504606846976, @@SESSION.AUTO_INCREMENT_OFFSET=1152921504606846976;
|
||||
SHOW VARIABLES LIKE "auto_inc%";
|
||||
--error 1467
|
||||
--error HA_ERR_AUTOINC_ERANGE
|
||||
INSERT INTO t1 VALUES (NULL),(NULL);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
@ -1,6 +1,8 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/big_test.inc
|
||||
--source include/have_sequence.inc
|
||||
|
||||
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
SET @saved_include_delete_marked = @@GLOBAL.innodb_stats_include_delete_marked;
|
||||
SET GLOBAL innodb_stats_include_delete_marked = ON;
|
||||
SET @saved_traditional = @@GLOBAL.innodb_stats_traditional;
|
||||
@ -8,19 +10,11 @@ SET GLOBAL innodb_stats_traditional=false;
|
||||
SET @saved_modified_counter = @@GLOBAL.innodb_stats_modified_counter;
|
||||
SET GLOBAL innodb_stats_modified_counter=1;
|
||||
|
||||
CREATE TABLE t0 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
|
||||
CREATE TABLE t1 (id SERIAL, val INT UNSIGNED NOT NULL, KEY(val))
|
||||
ENGINE=INNODB STATS_PERSISTENT=1,STATS_AUTO_RECALC=1;
|
||||
CREATE TABLE t1 LIKE t0;
|
||||
CREATE TABLE t2 LIKE t0;
|
||||
CREATE TABLE t2 LIKE t1;
|
||||
|
||||
INSERT INTO t0 (val) VALUES (4);
|
||||
INSERT INTO t0 (val) SELECT 4 FROM t0;
|
||||
INSERT INTO t0 (val) SELECT 4 FROM t0;
|
||||
INSERT INTO t0 (val) SELECT 4 FROM t0;
|
||||
INSERT INTO t0 (val) SELECT 4 FROM t0;
|
||||
|
||||
INSERT INTO t1 SELECT * FROM t0;
|
||||
SELECT COUNT(*) FROM t1;
|
||||
INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
|
||||
ANALYZE TABLE t1;
|
||||
|
||||
connect(con1, localhost, root,,);
|
||||
@ -46,7 +40,7 @@ SELECT COUNT(*) FROM t1;
|
||||
|
||||
connection default;
|
||||
BEGIN;
|
||||
INSERT INTO t2 SELECT * FROM t0;
|
||||
INSERT INTO t2 (val) SELECT 4 FROM seq_1_to_16;
|
||||
|
||||
--echo # The INSERT will show up before COMMIT.
|
||||
EXPLAIN SELECT * FROM t2 WHERE val=4;
|
||||
@ -57,21 +51,18 @@ SELECT COUNT(*) FROM t2;
|
||||
|
||||
connection con1;
|
||||
EXPLAIN SELECT * FROM t2 WHERE val=4;
|
||||
SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
|
||||
--source include/wait_all_purged.inc
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
||||
--echo # After COMMIT and purge, the DELETE must show up.
|
||||
EXPLAIN SELECT * FROM t1 WHERE val=4;
|
||||
|
||||
SET GLOBAL innodb_stats_include_delete_marked = OFF;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT * FROM t0;
|
||||
INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
|
||||
EXPLAIN SELECT * FROM t1 WHERE val=4;
|
||||
ROLLBACK;
|
||||
EXPLAIN SELECT * FROM t1 WHERE val=4;
|
||||
BEGIN;
|
||||
INSERT INTO t1 SELECT * FROM t0;
|
||||
INSERT INTO t1 (val) SELECT 4 FROM seq_1_to_16;
|
||||
COMMIT;
|
||||
EXPLAIN SELECT * FROM t1 WHERE val=4;
|
||||
BEGIN;
|
||||
@ -89,7 +80,8 @@ disconnect con1;
|
||||
|
||||
connection default;
|
||||
|
||||
DROP TABLE t0,t1,t2;
|
||||
DROP TABLE t1,t2;
|
||||
SET GLOBAL innodb_stats_include_delete_marked = @saved_include_delete_marked;
|
||||
SET GLOBAL innodb_stats_traditional = @saved_traditional;
|
||||
SET GLOBAL innodb_stats_modified_counter = @saved_modified_counter;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
|
||||
|
@ -138,8 +138,10 @@ HANDLER h READ `PRIMARY` PREV WHERE 0;
|
||||
HANDLER h CLOSE;
|
||||
DROP TABLE t1;
|
||||
|
||||
# MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys which are pointed
|
||||
# to the table being altered
|
||||
--echo #
|
||||
--echo # MDEV-19630 ALTER TABLE ... ADD COLUMN damages foreign keys
|
||||
--echo # which are pointed to the table being altered
|
||||
--echo #
|
||||
CREATE TABLE t1(f1 int not null, primary key(f1))engine=innodb;
|
||||
CREATE TABLE t2(f1 INT AUTO_INCREMENT NOT NULL, f2 INT NOT NULL,
|
||||
status ENUM ('a', 'b', 'c'), INDEX idx1(f2),
|
||||
@ -158,6 +160,19 @@ DROP TABLE t2, t1;
|
||||
--let $datadir= `select @@datadir`
|
||||
--remove_file $datadir/test/load.data
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20938 Double free of dict_foreign_t during instant ALTER TABLE
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (id INT UNSIGNED PRIMARY KEY) ENGINE=InnoDB;
|
||||
CREATE TABLE t2 (a INT UNSIGNED PRIMARY KEY, b INT UNSIGNED UNIQUE,
|
||||
FOREIGN KEY fk1 (b) REFERENCES t1 (id)) ENGINE=InnoDB;
|
||||
ALTER TABLE t2
|
||||
DROP FOREIGN KEY fk1,
|
||||
CHANGE b d INT UNSIGNED,
|
||||
ADD c INT;
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
|
||||
create table t (
|
||||
a varchar(9),
|
||||
|
17
mysql-test/suite/innodb/t/stat_tables.test
Normal file
17
mysql-test/suite/innodb/t/stat_tables.test
Normal file
@ -0,0 +1,17 @@
|
||||
source include/have_innodb.inc;
|
||||
|
||||
#
|
||||
# MDEV-20354 All but last insert ignored in InnoDB tables when table locked
|
||||
#
|
||||
rename table mysql.table_stats to mysql.table_stats_save;
|
||||
flush tables;
|
||||
set use_stat_tables= PREFERABLY;
|
||||
create table t1 (a int) engine=InnoDB;
|
||||
start transaction;
|
||||
insert t1 values (1);
|
||||
insert t1 values (2);
|
||||
commit;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
rename table mysql.table_stats_save to mysql.table_stats;
|
||||
flush tables;
|
@ -42,9 +42,11 @@ INSERT INTO articles (title,body) VALUES
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
connect dml, localhost, root,,;
|
||||
BEGIN;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
connection default;
|
||||
# Make durable the AUTO_INCREMENT in the above incomplete transaction.
|
||||
connect flush_redo_log,localhost,root,,;
|
||||
SET GLOBAL innodb_flush_log_at_trx_commit=1;
|
||||
@ -54,6 +56,7 @@ ROLLBACK;
|
||||
disconnect flush_redo_log;
|
||||
connection default;
|
||||
# restart
|
||||
disconnect dml;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
SELECT * FROM articles
|
||||
@ -81,10 +84,40 @@ INSERT INTO articles VALUES
|
||||
(4, 11, '1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
(5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
(7, 4, 'MySQL Security','When configured properly, MySQL ...');
|
||||
connect dml, localhost, root,,;
|
||||
BEGIN;
|
||||
INSERT INTO articles VALUES
|
||||
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
connect dml2, localhost, root,,;
|
||||
#
|
||||
# MDEV-19073 FTS row mismatch after crash recovery
|
||||
#
|
||||
CREATE TABLE mdev19073(id SERIAL, title VARCHAR(200), body TEXT,
|
||||
FULLTEXT(title,body)) ENGINE=InnoDB;
|
||||
INSERT INTO mdev19073 (title, body) VALUES
|
||||
('MySQL Tutorial', 'DBMS stands for Database...');
|
||||
CREATE FULLTEXT INDEX idx ON mdev19073(title, body);
|
||||
CREATE TABLE mdev19073_2 LIKE mdev19073;
|
||||
INSERT INTO mdev19073_2 (title, body) VALUES
|
||||
('MySQL Tutorial', 'DBMS stands for Database...');
|
||||
INSERT INTO mdev19073 (title, body) VALUES
|
||||
('MariaDB Tutorial', 'DB means Database ...');
|
||||
INSERT INTO mdev19073_2 (title, body) VALUES
|
||||
('MariaDB Tutorial', 'DB means Database ...');
|
||||
SELECT * FROM mdev19073 WHERE MATCH (title, body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for Database...
|
||||
2 MariaDB Tutorial DB means Database ...
|
||||
SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for Database...
|
||||
2 MariaDB Tutorial DB means Database ...
|
||||
connection default;
|
||||
# restart
|
||||
disconnect dml;
|
||||
disconnect dml2;
|
||||
INSERT INTO articles VALUES (8, 12, 'MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
SELECT * FROM articles WHERE MATCH (title, body)
|
||||
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
|
||||
@ -93,3 +126,14 @@ id FTS_DOC_ID title body
|
||||
1 10 MySQL Tutorial DBMS stands for DataBase ...
|
||||
8 12 MySQL Tutorial DBMS stands for DataBase ...
|
||||
DROP TABLE articles;
|
||||
SELECT * FROM mdev19073 WHERE MATCH (title, body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for Database...
|
||||
2 MariaDB Tutorial DB means Database ...
|
||||
SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for Database...
|
||||
2 MariaDB Tutorial DB means Database ...
|
||||
DROP TABLE mdev19073, mdev19073_2;
|
||||
|
@ -6,6 +6,7 @@
|
||||
--source include/have_innodb.inc
|
||||
# The embedded server tests do not support restarting.
|
||||
--source include/not_embedded.inc
|
||||
--source include/maybe_debug.inc
|
||||
|
||||
FLUSH TABLES;
|
||||
# Following are test for crash recovery on FTS index, the first scenario
|
||||
@ -73,10 +74,12 @@ INSERT INTO articles (title,body) VALUES
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
|
||||
connect(dml, localhost, root,,);
|
||||
BEGIN;
|
||||
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
connection default;
|
||||
|
||||
--echo # Make durable the AUTO_INCREMENT in the above incomplete transaction.
|
||||
--connect (flush_redo_log,localhost,root,,)
|
||||
@ -89,6 +92,8 @@ ROLLBACK;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
disconnect dml;
|
||||
|
||||
# This insert will re-initialize the Doc ID counter, it should not crash
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
@ -121,6 +126,7 @@ INSERT INTO articles VALUES
|
||||
(5, 6, 'MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
(7, 4, 'MySQL Security','When configured properly, MySQL ...');
|
||||
|
||||
connect(dml, localhost, root,,);
|
||||
BEGIN;
|
||||
|
||||
# Below we do not depend on the durability of the AUTO_INCREMENT sequence,
|
||||
@ -128,7 +134,49 @@ BEGIN;
|
||||
INSERT INTO articles VALUES
|
||||
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
|
||||
connect(dml2, localhost, root,,);
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-19073 FTS row mismatch after crash recovery
|
||||
--echo #
|
||||
|
||||
CREATE TABLE mdev19073(id SERIAL, title VARCHAR(200), body TEXT,
|
||||
FULLTEXT(title,body)) ENGINE=InnoDB;
|
||||
INSERT INTO mdev19073 (title, body) VALUES
|
||||
('MySQL Tutorial', 'DBMS stands for Database...');
|
||||
CREATE FULLTEXT INDEX idx ON mdev19073(title, body);
|
||||
CREATE TABLE mdev19073_2 LIKE mdev19073;
|
||||
if ($have_debug)
|
||||
{
|
||||
--disable_query_log
|
||||
SET @saved_dbug = @@debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,fts_instrument_sync_debug';
|
||||
--enable_query_log
|
||||
}
|
||||
INSERT INTO mdev19073_2 (title, body) VALUES
|
||||
('MySQL Tutorial', 'DBMS stands for Database...');
|
||||
if ($have_debug)
|
||||
{
|
||||
--disable_query_log
|
||||
SET DEBUG_DBUG = @saved_dbug;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
INSERT INTO mdev19073 (title, body) VALUES
|
||||
('MariaDB Tutorial', 'DB means Database ...');
|
||||
INSERT INTO mdev19073_2 (title, body) VALUES
|
||||
('MariaDB Tutorial', 'DB means Database ...');
|
||||
|
||||
# Should return 2 rows
|
||||
SELECT * FROM mdev19073 WHERE MATCH (title, body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
connection default;
|
||||
--source include/restart_mysqld.inc
|
||||
disconnect dml;
|
||||
disconnect dml2;
|
||||
|
||||
# This would re-initialize the FTS index and do the re-tokenization
|
||||
# of above records
|
||||
@ -138,3 +186,10 @@ SELECT * FROM articles WHERE MATCH (title, body)
|
||||
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
DROP TABLE articles;
|
||||
|
||||
# Should return 2 rows
|
||||
SELECT * FROM mdev19073 WHERE MATCH (title, body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
SELECT * FROM mdev19073_2 WHERE MATCH (title, body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
DROP TABLE mdev19073, mdev19073_2;
|
||||
|
@ -109,6 +109,39 @@ ALTER TABLE t1 ADD UNIQUE KEY (f1);
|
||||
ERROR 23000: Duplicate entry 'foo' for key 'f1'
|
||||
ALTER TABLE t1 ADD KEY (f2);
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
|
||||
SELECT * FROM t1;
|
||||
a b
|
||||
CREATE TABLE t2 (c INT) ENGINE=Aria;
|
||||
LOCK TABLE t2 READ, t1 WRITE;
|
||||
ALTER TABLE t1 CHANGE b a INT;
|
||||
ERROR 42S21: Duplicate column name 'a'
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
|
||||
#
|
||||
CREATE TABLE t1 (a INT) ENGINE=Aria;
|
||||
CREATE TABLE t2 (b INT) ENGINE=Aria;
|
||||
LOCK TABLES t1 WRITE, t2 AS t2a WRITE, t2 WRITE;
|
||||
ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1, t2;
|
||||
# More complex test, from RQG
|
||||
CREATE TABLE t1 (a INT) ENGINE=Aria;
|
||||
CREATE TABLE t2 (b INT) ENGINE=Aria;
|
||||
CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2 ;
|
||||
LOCK TABLES t1 WRITE, t2 AS t2a WRITE, v2 WRITE CONCURRENT, t2 WRITE;
|
||||
ALTER TABLE t1 FORCE;
|
||||
ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=INPLACE;
|
||||
ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY
|
||||
ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
|
||||
UNLOCK TABLES;
|
||||
DROP VIEW v2;
|
||||
DROP TABLE t1, t2;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
# MDEV-14669 Assertion `file->trn == trn' failed in ha_maria::start_stmt
|
||||
|
@ -118,6 +118,52 @@ ALTER TABLE t1 ADD UNIQUE KEY (f1);
|
||||
ALTER TABLE t1 ADD KEY (f2);
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT) ENGINE=Aria;
|
||||
SELECT * FROM t1;
|
||||
CREATE TABLE t2 (c INT) ENGINE=Aria;
|
||||
|
||||
LOCK TABLE t2 READ, t1 WRITE;
|
||||
--error ER_DUP_FIELDNAME
|
||||
ALTER TABLE t1 CHANGE b a INT;
|
||||
|
||||
# Cleanup
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10748 Server crashes in ha_maria::implicit_commit upon ALTER TABLE
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=Aria;
|
||||
CREATE TABLE t2 (b INT) ENGINE=Aria;
|
||||
|
||||
LOCK TABLES t1 WRITE, t2 AS t2a WRITE, t2 WRITE;
|
||||
ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo # More complex test, from RQG
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=Aria;
|
||||
CREATE TABLE t2 (b INT) ENGINE=Aria;
|
||||
CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2 ;
|
||||
|
||||
LOCK TABLES t1 WRITE, t2 AS t2a WRITE, v2 WRITE CONCURRENT, t2 WRITE;
|
||||
|
||||
ALTER TABLE t1 FORCE;
|
||||
--error ER_ALTER_OPERATION_NOT_SUPPORTED
|
||||
ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=INPLACE;
|
||||
ALTER TABLE t2 CHANGE b c VARBINARY(30000), ALGORITHM=COPY;
|
||||
|
||||
UNLOCK TABLES;
|
||||
DROP VIEW v2;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo # End of 10.2 tests
|
||||
|
||||
--echo #
|
||||
|
54
mysql-test/suite/rpl/r/rpl_read_only2.result
Normal file
54
mysql-test/suite/rpl/r/rpl_read_only2.result
Normal file
@ -0,0 +1,54 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
#
|
||||
# Ensure that read-only slave logs temporary table statements under statement based
|
||||
# replication. This is related to MDEV-17863.
|
||||
#
|
||||
connection slave;
|
||||
set global read_only=1;
|
||||
connection master;
|
||||
create table t1(a int) engine=MyISAM;
|
||||
create temporary table tmp1 (a int) engine=MyISAM;
|
||||
insert into t1 values(1);
|
||||
insert into tmp1 values (2);
|
||||
insert into t1 select * from tmp1;
|
||||
insert into t1 values(3);
|
||||
select * from t1;
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Engine-independent statistics collected
|
||||
test.t1 analyze status OK
|
||||
drop table t1;
|
||||
drop temporary table tmp1;
|
||||
connection slave;
|
||||
include/show_binlog_events.inc
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; create table t1(a int) engine=MyISAM
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; create temporary table tmp1 (a int) engine=MyISAM
|
||||
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; insert into t1 values(1)
|
||||
slave-bin.000001 # Query # # COMMIT
|
||||
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; insert into tmp1 values (2)
|
||||
slave-bin.000001 # Query # # COMMIT
|
||||
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; insert into t1 select * from tmp1
|
||||
slave-bin.000001 # Query # # COMMIT
|
||||
slave-bin.000001 # Gtid # # BEGIN GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; insert into t1 values(3)
|
||||
slave-bin.000001 # Query # # COMMIT
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; analyze table t1
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `t1` /* generated by server */
|
||||
slave-bin.000001 # Gtid # # GTID #-#-#
|
||||
slave-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tmp1` /* generated by server */
|
||||
set global read_only=0;
|
||||
connection master;
|
||||
include/rpl_end.inc
|
30
mysql-test/suite/rpl/t/rpl_read_only2.test
Normal file
30
mysql-test/suite/rpl/t/rpl_read_only2.test
Normal file
@ -0,0 +1,30 @@
|
||||
--source include/have_binlog_format_statement.inc
|
||||
--source include/master-slave.inc
|
||||
|
||||
--echo #
|
||||
--echo # Ensure that read-only slave logs temporary table statements under statement based
|
||||
--echo # replication. This is related to MDEV-17863.
|
||||
--echo #
|
||||
|
||||
connection slave;
|
||||
set global read_only=1;
|
||||
|
||||
connection master;
|
||||
|
||||
create table t1(a int) engine=MyISAM;
|
||||
create temporary table tmp1 (a int) engine=MyISAM;
|
||||
insert into t1 values(1);
|
||||
insert into tmp1 values (2);
|
||||
insert into t1 select * from tmp1;
|
||||
insert into t1 values(3);
|
||||
select * from t1;
|
||||
analyze table t1;
|
||||
drop table t1;
|
||||
drop temporary table tmp1;
|
||||
|
||||
sync_slave_with_master;
|
||||
--source include/show_binlog_events.inc
|
||||
set global read_only=0;
|
||||
connection master;
|
||||
|
||||
--source include/rpl_end.inc
|
@ -209,4 +209,95 @@ delete s,t1 from t1,s;
|
||||
ERROR HY000: Storage engine SEQUENCE of the table `test`.`s` doesn't have this option
|
||||
DROP SEQUENCE s;
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-20074: Lost connection on update trigger
|
||||
#
|
||||
# INSERT & table
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
|
||||
END;
|
||||
$$
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
drop sequence s1;
|
||||
drop table t1,t2;
|
||||
# INSERT & view
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
create view v2 as select * from t2;
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
|
||||
END;
|
||||
$$
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
drop sequence s1;
|
||||
# INSERT SELECT & view
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
create view v2 as select * from t2;
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name;
|
||||
END;
|
||||
$$
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
drop sequence s1;
|
||||
# REPLACE & view
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
create view v2 as select * from t2;
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
REPLACE INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
|
||||
END;
|
||||
$$
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
drop sequence s1;
|
||||
# REPLACE SELECT & view
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
create view v2 as select * from t2;
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
REPLACE INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name;
|
||||
END;
|
||||
$$
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
drop sequence s1;
|
||||
# End of 10.3 tests
|
||||
|
@ -179,4 +179,140 @@ DROP SEQUENCE s;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20074: Lost connection on update trigger
|
||||
--echo #
|
||||
|
||||
--echo # INSERT & table
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
|
||||
DELIMITER $$;
|
||||
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO t2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
|
||||
drop sequence s1;
|
||||
drop table t1,t2;
|
||||
|
||||
|
||||
--echo # INSERT & view
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
create view v2 as select * from t2;
|
||||
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
|
||||
DELIMITER $$;
|
||||
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
drop sequence s1;
|
||||
|
||||
|
||||
--echo # INSERT SELECT & view
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
create view v2 as select * from t2;
|
||||
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
|
||||
DELIMITER $$;
|
||||
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
INSERT INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
drop sequence s1;
|
||||
|
||||
|
||||
--echo # REPLACE & view
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
create view v2 as select * from t2;
|
||||
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
|
||||
DELIMITER $$;
|
||||
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
REPLACE INTO v2(a_p_name, a_p_first_name) VALUES(old.p_name, old.p_first_name);
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
drop sequence s1;
|
||||
|
||||
|
||||
--echo # REPLACE SELECT & view
|
||||
create sequence s1 increment by 1 start with 1;
|
||||
create table t1 (p_id integer, p_name varchar(128), p_first_name varchar(128));
|
||||
create table t2 (a_id integer default nextval(s1), a_p_name varchar(128), a_p_first_name varchar(128), t timestamp default current_timestamp);
|
||||
create view v2 as select * from t2;
|
||||
|
||||
insert into t1 values
|
||||
(1, 'Luo','Frank'),(2, 'Xe','Emma'),(3, 'Li','Anna'),(4, 'Lun','Serg'),(5, 'Xu','Nils'),(6, 'Ja','Ute'),(7, 'Jin','Mike'),(8, 'Lio','Carl'),(9, 'Lang','Kevin'),(10, 'Ling','Lisa'),(11, 'Fang','Frank'),(12, 'Feng','Emma'),(13, 'Tuo','Anna'),(14, 'Tua','Serg'),(15, 'Moa','Nils'),(16, 'Hua','Ute'),(17, 'Xufa','Mike'),(18, 'Lulu','Carl'),(19, 'Hoho','Kevin'),(20, 'Tata','Lisa');
|
||||
|
||||
DELIMITER $$;
|
||||
|
||||
CREATE TRIGGER tr_upd
|
||||
BEFORE UPDATE on t1
|
||||
FOR EACH ROW
|
||||
BEGIN
|
||||
REPLACE INTO v2(a_p_name, a_p_first_name) SELECT old.p_name, old.p_first_name;
|
||||
END;
|
||||
$$
|
||||
DELIMITER ;$$
|
||||
|
||||
update t1 set p_first_name='Yunxi' where p_id=1;
|
||||
|
||||
drop view v2;
|
||||
drop table t1,t2;
|
||||
drop sequence s1;
|
||||
|
||||
--echo # End of 10.3 tests
|
||||
|
@ -333,6 +333,18 @@ NUMERIC_BLOCK_SIZE 0
|
||||
ENUM_VALUE_LIST NULL
|
||||
READ_ONLY NO
|
||||
COMMAND_LINE_ARGUMENT REQUIRED
|
||||
VARIABLE_NAME INNODB_CHANGE_BUFFER_DUMP
|
||||
SESSION_VALUE NULL
|
||||
DEFAULT_VALUE OFF
|
||||
VARIABLE_SCOPE GLOBAL
|
||||
VARIABLE_TYPE BOOLEAN
|
||||
VARIABLE_COMMENT Dump the change buffer at startup.
|
||||
NUMERIC_MIN_VALUE NULL
|
||||
NUMERIC_MAX_VALUE NULL
|
||||
NUMERIC_BLOCK_SIZE NULL
|
||||
ENUM_VALUE_LIST OFF,ON
|
||||
READ_ONLY YES
|
||||
COMMAND_LINE_ARGUMENT NONE
|
||||
VARIABLE_NAME INNODB_CHANGE_BUFFER_MAX_SIZE
|
||||
SESSION_VALUE NULL
|
||||
DEFAULT_VALUE 25
|
||||
|
@ -274,3 +274,18 @@ index(col_char,vcol_blob(64))
|
||||
insert ignore into t1 (pk) values (1),(2);
|
||||
update t1 set col_char = 'foo' where pk = 1;
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
id int not null primary key,
|
||||
a varchar(200),
|
||||
b varchar(200),
|
||||
c int,
|
||||
va char(200) generated always as (ucase(a)) virtual,
|
||||
vb char(200) generated always as (ucase(b)) virtual,
|
||||
key (c,va,vb)
|
||||
) engine=innodb;
|
||||
insert t1 (id,a,c) select seq,seq,seq from seq_1_to_330;
|
||||
select IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE') from t1;
|
||||
IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE')
|
||||
GOOD
|
||||
alter table t1 drop column va;
|
||||
drop table t1;
|
||||
|
1
mysql-test/suite/vcol/t/vcol_keys_innodb.opt
Normal file
1
mysql-test/suite/vcol/t/vcol_keys_innodb.opt
Normal file
@ -0,0 +1 @@
|
||||
--innodb-sort-buffer-size=64k
|
@ -117,3 +117,21 @@ create table t1 (
|
||||
insert ignore into t1 (pk) values (1),(2);
|
||||
update t1 set col_char = 'foo' where pk = 1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# MDEV-20799 DROP Virtual Column crashes MariaDB
|
||||
#
|
||||
--source include/have_sequence.inc
|
||||
create table t1 (
|
||||
id int not null primary key,
|
||||
a varchar(200),
|
||||
b varchar(200),
|
||||
c int,
|
||||
va char(200) generated always as (ucase(a)) virtual,
|
||||
vb char(200) generated always as (ucase(b)) virtual,
|
||||
key (c,va,vb)
|
||||
) engine=innodb;
|
||||
insert t1 (id,a,c) select seq,seq,seq from seq_1_to_330;
|
||||
select IF(@@innodb_sort_buffer_size < count(*)*200, 'GOOD', 'WRONG SIZE') from t1;
|
||||
alter table t1 drop column va;
|
||||
drop table t1;
|
||||
|
@ -400,3 +400,32 @@ Warning 1265 Data truncated for column 'f12' at row 7
|
||||
SET timestamp = 9;
|
||||
REPLACE INTO t2 SELECT * FROM t2;
|
||||
DROP TABLE t1, t2;
|
||||
#
|
||||
# MDEV-16210 FK constraints on versioned tables use historical rows, which may cause constraint violation
|
||||
#
|
||||
create or replace table t1 (a int, key(a)) engine innodb with system versioning;
|
||||
create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb;
|
||||
insert into t1 values (1),(2);
|
||||
insert into t2 values (1);
|
||||
# DELETE from referenced table is not allowed
|
||||
delete from t1 where a = 1;
|
||||
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`a`))
|
||||
drop tables t2, t1;
|
||||
#
|
||||
# MDEV-20812 Unexpected ER_ROW_IS_REFERENCED_2 or server crash in row_ins_foreign_report_err upon DELETE from versioned table with FK
|
||||
#
|
||||
create or replace table t1 (x int primary key) engine innodb;
|
||||
create or replace table t2 (x int, foreign key (x) references t1(x)) engine innodb with system versioning;
|
||||
set foreign_key_checks= off;
|
||||
insert into t2 values (1), (1);
|
||||
set foreign_key_checks= on;
|
||||
# DELETE from foreign table is allowed
|
||||
delete from t2;
|
||||
drop tables t2, t1;
|
||||
create or replace table t1 (a int, key(a)) engine innodb;
|
||||
insert into t1 values (1);
|
||||
create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb with system versioning;
|
||||
insert into t2 values (1), (1);
|
||||
# DELETE from foreign table is allowed
|
||||
delete from t2;
|
||||
drop tables t2, t1;
|
||||
|
@ -426,4 +426,36 @@ DROP TABLE t1, t2;
|
||||
--remove_file $datadir/test/t1.data.2
|
||||
--remove_file $datadir/test/t2.data
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-16210 FK constraints on versioned tables use historical rows, which may cause constraint violation
|
||||
--echo #
|
||||
create or replace table t1 (a int, key(a)) engine innodb with system versioning;
|
||||
create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb;
|
||||
insert into t1 values (1),(2);
|
||||
insert into t2 values (1);
|
||||
--echo # DELETE from referenced table is not allowed
|
||||
--error ER_ROW_IS_REFERENCED_2
|
||||
delete from t1 where a = 1;
|
||||
drop tables t2, t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20812 Unexpected ER_ROW_IS_REFERENCED_2 or server crash in row_ins_foreign_report_err upon DELETE from versioned table with FK
|
||||
--echo #
|
||||
create or replace table t1 (x int primary key) engine innodb;
|
||||
create or replace table t2 (x int, foreign key (x) references t1(x)) engine innodb with system versioning;
|
||||
set foreign_key_checks= off;
|
||||
insert into t2 values (1), (1);
|
||||
set foreign_key_checks= on;
|
||||
--echo # DELETE from foreign table is allowed
|
||||
delete from t2;
|
||||
drop tables t2, t1;
|
||||
|
||||
create or replace table t1 (a int, key(a)) engine innodb;
|
||||
insert into t1 values (1);
|
||||
create or replace table t2 (b int, foreign key (b) references t1(a)) engine innodb with system versioning;
|
||||
insert into t2 values (1), (1);
|
||||
--echo # DELETE from foreign table is allowed
|
||||
delete from t2;
|
||||
drop tables t2, t1;
|
||||
|
||||
--source suite/versioning/common_finish.inc
|
||||
|
@ -190,14 +190,15 @@ wsrep_thread_count 0
|
||||
# applier/rollbacker threads.
|
||||
SET GLOBAL wsrep_cluster_address= 'gcomm://';
|
||||
# Wait for applier thread to get created 1.
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
VARIABLE_VALUE
|
||||
# Wait for applier thread to get created 2.
|
||||
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
EXPECT_1
|
||||
1
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
VARIABLE_VALUE
|
||||
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
EXPECT_1
|
||||
1
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
|
||||
VARIABLE_VALUE
|
||||
SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
|
||||
EXPECT_2
|
||||
2
|
||||
SELECT @@global.wsrep_provider;
|
||||
@@global.wsrep_provider
|
||||
@ -215,14 +216,14 @@ wsrep_thread_count 2
|
||||
SET @wsrep_slave_threads_saved= @@global.wsrep_slave_threads;
|
||||
SET GLOBAL wsrep_slave_threads= 10;
|
||||
# Wait for 9 applier threads to get created.
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
VARIABLE_VALUE
|
||||
SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
EXPECT_10
|
||||
10
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
VARIABLE_VALUE
|
||||
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
EXPECT_1
|
||||
1
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
|
||||
VARIABLE_VALUE
|
||||
SELECT VARIABLE_VALUE AS EXPECT_11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
|
||||
EXPECT_11
|
||||
11
|
||||
SHOW STATUS LIKE 'threads_connected';
|
||||
Variable_name Value
|
||||
|
@ -102,10 +102,13 @@ SET GLOBAL wsrep_cluster_address= 'gcomm://';
|
||||
--echo # Wait for applier thread to get created 1.
|
||||
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
--source include/wait_condition.inc
|
||||
--echo # Wait for applier thread to get created 2.
|
||||
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
|
||||
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
SELECT VARIABLE_VALUE AS EXPECT_2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
|
||||
|
||||
--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
|
||||
SELECT @@global.wsrep_provider;
|
||||
@ -121,9 +124,9 @@ SET GLOBAL wsrep_slave_threads= 10;
|
||||
--let $wait_condition = SELECT VARIABLE_VALUE = 10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
|
||||
SELECT VARIABLE_VALUE AS EXPECT_10 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count';
|
||||
SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_rollbacker_thread_count';
|
||||
SELECT VARIABLE_VALUE AS EXPECT_11 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_thread_count';
|
||||
|
||||
SHOW STATUS LIKE 'threads_connected';
|
||||
|
||||
|
@ -26,7 +26,7 @@ use Fcntl;
|
||||
BEGIN {
|
||||
# ****************************
|
||||
# static information...
|
||||
$VERSION = "2.06, 20 Dec 2000";
|
||||
$VERSION = "2.10, 13 Sep 2019";
|
||||
$0 =~ m%/([^/]+)$%o;
|
||||
$script = $1;
|
||||
$script = 'MySQLAccess' unless $script;
|
||||
|
@ -3461,8 +3461,7 @@ bool ha_partition::init_partition_bitmaps()
|
||||
|
||||
/*
|
||||
Open handler object
|
||||
|
||||
SYNOPSIS
|
||||
SYNOPSIS
|
||||
open()
|
||||
name Full path of table name
|
||||
mode Open mode flags
|
||||
@ -3588,6 +3587,7 @@ int ha_partition::open(const char *name, int mode, uint test_if_locked)
|
||||
}
|
||||
else
|
||||
{
|
||||
check_insert_autoincrement();
|
||||
if (unlikely((error= open_read_partitions(name_buff, sizeof(name_buff)))))
|
||||
goto err_handler;
|
||||
m_num_locks= m_file_sample->lock_count();
|
||||
@ -4474,11 +4474,8 @@ exit:
|
||||
table->found_next_number_field->field_index))
|
||||
{
|
||||
update_next_auto_inc_val();
|
||||
/*
|
||||
The following call is safe as part_share->auto_inc_initialized
|
||||
(tested in the call) is guaranteed to be set for update statements.
|
||||
*/
|
||||
set_auto_increment_if_higher(table->found_next_number_field);
|
||||
if (part_share->auto_inc_initialized)
|
||||
set_auto_increment_if_higher(table->found_next_number_field);
|
||||
}
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
@ -8139,6 +8136,7 @@ int ha_partition::info(uint flag)
|
||||
if (flag & HA_STATUS_AUTO)
|
||||
{
|
||||
bool auto_inc_is_first_in_idx= (table_share->next_number_keypart == 0);
|
||||
bool all_parts_opened= true;
|
||||
DBUG_PRINT("info", ("HA_STATUS_AUTO"));
|
||||
if (!table->found_next_number_field)
|
||||
stats.auto_increment_value= 0;
|
||||
@ -8169,6 +8167,15 @@ int ha_partition::info(uint flag)
|
||||
("checking all partitions for auto_increment_value"));
|
||||
do
|
||||
{
|
||||
if (!bitmap_is_set(&m_opened_partitions, (uint)(file_array - m_file)))
|
||||
{
|
||||
/*
|
||||
Some partitions aren't opened.
|
||||
So we can't calculate the autoincrement.
|
||||
*/
|
||||
all_parts_opened= false;
|
||||
break;
|
||||
}
|
||||
file= *file_array;
|
||||
file->info(HA_STATUS_AUTO | no_lock_flag);
|
||||
set_if_bigger(auto_increment_value,
|
||||
@ -8177,7 +8184,7 @@ int ha_partition::info(uint flag)
|
||||
|
||||
DBUG_ASSERT(auto_increment_value);
|
||||
stats.auto_increment_value= auto_increment_value;
|
||||
if (auto_inc_is_first_in_idx)
|
||||
if (all_parts_opened && auto_inc_is_first_in_idx)
|
||||
{
|
||||
set_if_bigger(part_share->next_auto_inc_val,
|
||||
auto_increment_value);
|
||||
@ -8486,6 +8493,7 @@ int ha_partition::change_partitions_to_open(List<String> *partition_names)
|
||||
return 0;
|
||||
}
|
||||
|
||||
check_insert_autoincrement();
|
||||
if (bitmap_cmp(&m_opened_partitions, &m_part_info->read_partitions) != 0)
|
||||
return 0;
|
||||
|
||||
|
@ -1329,6 +1329,19 @@ private:
|
||||
unlock_auto_increment();
|
||||
}
|
||||
|
||||
void check_insert_autoincrement()
|
||||
{
|
||||
/*
|
||||
If we INSERT into the table having the AUTO_INCREMENT column,
|
||||
we have to read all partitions for the next autoincrement value
|
||||
unless we already did it.
|
||||
*/
|
||||
if (!part_share->auto_inc_initialized &&
|
||||
ha_thd()->lex->sql_command == SQLCOM_INSERT &&
|
||||
table->found_next_number_field)
|
||||
bitmap_set_all(&m_part_info->read_partitions);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/*
|
||||
|
@ -68,7 +68,7 @@ uchar* find_named(I_List<NAMED_ILINK> *list, const char *name, size_t length,
|
||||
}
|
||||
|
||||
|
||||
bool NAMED_ILIST::delete_element(const char *name, size_t length, void (*free_element)(const char *name, uchar*))
|
||||
bool NAMED_ILIST::delete_element(const char *name, size_t length, void (*free_element)(const char *name, void*))
|
||||
{
|
||||
I_List_iterator<NAMED_ILINK> it(*this);
|
||||
NAMED_ILINK *element;
|
||||
@ -85,7 +85,7 @@ bool NAMED_ILIST::delete_element(const char *name, size_t length, void (*free_el
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
void NAMED_ILIST::delete_elements(void (*free_element)(const char *name, uchar*))
|
||||
void NAMED_ILIST::delete_elements(void (*free_element)(const char *name, void*))
|
||||
{
|
||||
NAMED_ILINK *element;
|
||||
DBUG_ENTER("NAMED_ILIST::delete_elements");
|
||||
@ -157,9 +157,9 @@ KEY_CACHE *get_or_create_key_cache(const char *name, size_t length)
|
||||
}
|
||||
|
||||
|
||||
void free_key_cache(const char *name, KEY_CACHE *key_cache)
|
||||
void free_key_cache(const char *name, void *key_cache)
|
||||
{
|
||||
end_key_cache(key_cache, 1); // Can never fail
|
||||
end_key_cache(static_cast<KEY_CACHE *>(key_cache), 1); // Can never fail
|
||||
my_free(key_cache);
|
||||
}
|
||||
|
||||
@ -221,13 +221,12 @@ Rpl_filter *get_or_create_rpl_filter(const char *name, size_t length)
|
||||
return filter;
|
||||
}
|
||||
|
||||
void free_rpl_filter(const char *name, Rpl_filter *filter)
|
||||
void free_rpl_filter(const char *name, void *filter)
|
||||
{
|
||||
delete filter;
|
||||
filter= 0;
|
||||
delete static_cast<Rpl_filter*>(filter);
|
||||
}
|
||||
|
||||
void free_all_rpl_filters()
|
||||
{
|
||||
rpl_filters.delete_elements((void (*)(const char*, uchar*)) free_rpl_filter);
|
||||
rpl_filters.delete_elements(free_rpl_filter);
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ class NAMED_ILINK;
|
||||
class NAMED_ILIST: public I_List<NAMED_ILINK>
|
||||
{
|
||||
public:
|
||||
void delete_elements(void (*free_element)(const char*, uchar*));
|
||||
bool delete_element(const char *name, size_t length, void (*free_element)(const char*, uchar*));
|
||||
void delete_elements(void (*free_element)(const char*, void*));
|
||||
bool delete_element(const char *name, size_t length, void (*free_element)(const char*, void*));
|
||||
};
|
||||
|
||||
/* For key cache */
|
||||
@ -42,7 +42,7 @@ extern NAMED_ILIST key_caches;
|
||||
KEY_CACHE *create_key_cache(const char *name, size_t length);
|
||||
KEY_CACHE *get_key_cache(const LEX_CSTRING *cache_name);
|
||||
KEY_CACHE *get_or_create_key_cache(const char *name, size_t length);
|
||||
void free_key_cache(const char *name, KEY_CACHE *key_cache);
|
||||
void free_key_cache(const char *name, void *key_cache);
|
||||
bool process_key_caches(process_key_cache_t func, void *param);
|
||||
|
||||
/* For Rpl_filter */
|
||||
@ -52,7 +52,6 @@ extern NAMED_ILIST rpl_filters;
|
||||
Rpl_filter *create_rpl_filter(const char *name, size_t length);
|
||||
Rpl_filter *get_rpl_filter(LEX_CSTRING *filter_name);
|
||||
Rpl_filter *get_or_create_rpl_filter(const char *name, size_t length);
|
||||
void free_rpl_filter(const char *name, Rpl_filter *filter);
|
||||
void free_all_rpl_filters(void);
|
||||
|
||||
#endif /* KEYCACHES_INCLUDED */
|
||||
|
@ -5983,7 +5983,6 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
|
||||
DBUG_ASSERT(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open());
|
||||
DBUG_PRINT("enter", ("event: %p", event));
|
||||
|
||||
int error= 0;
|
||||
binlog_cache_mngr *const cache_mngr=
|
||||
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
|
||||
|
||||
@ -6021,7 +6020,7 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
|
||||
|
||||
thd->binlog_set_pending_rows_event(event, is_transactional);
|
||||
|
||||
DBUG_RETURN(error);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
@ -7733,7 +7732,7 @@ MYSQL_BIN_LOG::queue_for_group_commit(group_commit_entry *orig_entry)
|
||||
mysql_mutex_unlock(&LOCK_prepare_ordered);
|
||||
DEBUG_SYNC(orig_entry->thd, "commit_after_release_LOCK_prepare_ordered");
|
||||
|
||||
DBUG_PRINT("info", ("Queued for group commit as %s\n",
|
||||
DBUG_PRINT("info", ("Queued for group commit as %s",
|
||||
(orig_queue == NULL) ? "leader" : "participant"));
|
||||
DBUG_RETURN(orig_queue == NULL);
|
||||
}
|
||||
|
@ -675,7 +675,9 @@ SHOW_COMP_OPTION have_crypt, have_compress;
|
||||
SHOW_COMP_OPTION have_profiling;
|
||||
SHOW_COMP_OPTION have_openssl;
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
static std::atomic<char*> shutdown_user;
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
|
||||
/* Thread specific variables */
|
||||
|
||||
@ -1995,7 +1997,7 @@ static void clean_up(bool print_message)
|
||||
tdc_deinit();
|
||||
mdl_destroy();
|
||||
dflt_key_cache= 0;
|
||||
key_caches.delete_elements((void (*)(const char*, uchar*)) free_key_cache);
|
||||
key_caches.delete_elements(free_key_cache);
|
||||
wt_end();
|
||||
multi_keycache_free();
|
||||
sp_cache_end();
|
||||
@ -4472,7 +4474,6 @@ static int init_common_variables()
|
||||
return 1;
|
||||
}
|
||||
|
||||
global_system_variables.in_subquery_conversion_threshold= IN_SUBQUERY_CONVERSION_THRESHOLD;
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
/*
|
||||
|
@ -2681,9 +2681,17 @@ bool find_eq_ref_candidate(TABLE *table, table_map sj_inner_tables)
|
||||
{
|
||||
do /* For all equalities on all key parts */
|
||||
{
|
||||
/* Check if this is "t.keypart = expr(outer_tables) */
|
||||
/*
|
||||
Check if this is "t.keypart = expr(outer_tables)
|
||||
|
||||
Don't allow variants that can produce duplicates:
|
||||
- Dont allow "ref or null"
|
||||
- the keyuse (that is, the operation) must be null-rejecting,
|
||||
unless the other expression is non-NULLable.
|
||||
*/
|
||||
if (!(keyuse->used_tables & sj_inner_tables) &&
|
||||
!(keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL))
|
||||
!(keyuse->optimize & KEY_OPTIMIZE_REF_OR_NULL) &&
|
||||
(keyuse->null_rejecting || !keyuse->val->maybe_null))
|
||||
{
|
||||
bound_parts |= 1 << keyuse->keypart;
|
||||
}
|
||||
|
@ -1561,7 +1561,7 @@ scan_one_gtid_slave_pos_table(THD *thd, HASH *hash, DYNAMIC_ARRAY *array,
|
||||
sub_id= (ulonglong)table->field[1]->val_int();
|
||||
server_id= (uint32)table->field[2]->val_int();
|
||||
seq_no= (ulonglong)table->field[3]->val_int();
|
||||
DBUG_PRINT("info", ("Read slave state row: %u-%u-%lu sub_id=%lu\n",
|
||||
DBUG_PRINT("info", ("Read slave state row: %u-%u-%lu sub_id=%lu",
|
||||
(unsigned)domain_id, (unsigned)server_id,
|
||||
(ulong)seq_no, (ulong)sub_id));
|
||||
|
||||
|
@ -806,7 +806,7 @@ int Repl_semi_sync_master::commit_trx(const char* trx_wait_binlog_name,
|
||||
if (!get_master_enabled() || !is_on())
|
||||
goto l_end;
|
||||
|
||||
DBUG_PRINT("semisync", ("%s: wait pos (%s, %lu), repl(%d)\n",
|
||||
DBUG_PRINT("semisync", ("%s: wait pos (%s, %lu), repl(%d)",
|
||||
"Repl_semi_sync_master::commit_trx",
|
||||
trx_wait_binlog_name, (ulong)trx_wait_binlog_pos,
|
||||
(int)is_on()));
|
||||
|
@ -55,7 +55,26 @@ extern "C" const char* wsrep_thd_transaction_state_str(const THD *thd)
|
||||
|
||||
extern "C" const char *wsrep_thd_query(const THD *thd)
|
||||
{
|
||||
return thd ? thd->query() : NULL;
|
||||
if (thd)
|
||||
{
|
||||
switch(thd->lex->sql_command)
|
||||
{
|
||||
case SQLCOM_CREATE_USER:
|
||||
return "CREATE USER";
|
||||
case SQLCOM_GRANT:
|
||||
return "GRANT";
|
||||
case SQLCOM_REVOKE:
|
||||
return "REVOKE";
|
||||
case SQLCOM_SET_OPTION:
|
||||
if (thd->lex->definer)
|
||||
return "SET PASSWORD";
|
||||
/* fallthrough */
|
||||
default:
|
||||
if (thd->query())
|
||||
return thd->query();
|
||||
}
|
||||
}
|
||||
return "NULL";
|
||||
}
|
||||
|
||||
extern "C" query_id_t wsrep_thd_transaction_id(const THD *thd)
|
||||
|
@ -1467,7 +1467,7 @@ log:
|
||||
/* Such a statement can always go directly to binlog, no trans cache */
|
||||
if (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
log_query.ptr(), log_query.length(),
|
||||
FALSE, FALSE, FALSE, 0))
|
||||
FALSE, FALSE, FALSE, 0) > 0)
|
||||
{
|
||||
my_error(ER_ERROR_ON_WRITE, MYF(0), "binary log", -1);
|
||||
goto done;
|
||||
|
@ -4726,6 +4726,7 @@ typedef struct st_sp_table
|
||||
uint lock_count;
|
||||
uint query_lock_count;
|
||||
uint8 trg_event_map;
|
||||
my_bool for_insert_data;
|
||||
} SP_TABLE;
|
||||
|
||||
|
||||
@ -4821,6 +4822,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
|
||||
if (tab->query_lock_count > tab->lock_count)
|
||||
tab->lock_count++;
|
||||
tab->trg_event_map|= table->trg_event_map;
|
||||
tab->for_insert_data|= table->for_insert_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4844,6 +4846,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
|
||||
tab->lock_type= table->lock_type;
|
||||
tab->lock_count= tab->query_lock_count= 1;
|
||||
tab->trg_event_map= table->trg_event_map;
|
||||
tab->for_insert_data= table->for_insert_data;
|
||||
if (my_hash_insert(&m_sptabs, (uchar *)tab))
|
||||
return FALSE;
|
||||
}
|
||||
@ -4927,7 +4930,8 @@ sp_head::add_used_tables_to_table_list(THD *thd,
|
||||
TABLE_LIST::PRELOCK_ROUTINE,
|
||||
belong_to_view,
|
||||
stab->trg_event_map,
|
||||
query_tables_last_ptr);
|
||||
query_tables_last_ptr,
|
||||
stab->for_insert_data);
|
||||
tab_buff+= ALIGN_SIZE(sizeof(TABLE_LIST));
|
||||
result= TRUE;
|
||||
}
|
||||
|
@ -3786,7 +3786,7 @@ bool change_password(THD *thd, LEX_USER *user)
|
||||
DBUG_ASSERT(query_length);
|
||||
thd->clear_error();
|
||||
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
|
||||
FALSE, FALSE, FALSE, 0);
|
||||
FALSE, FALSE, FALSE, 0) > 0;
|
||||
}
|
||||
end:
|
||||
if (result)
|
||||
@ -3938,7 +3938,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user,
|
||||
DBUG_ASSERT(query_length);
|
||||
thd->clear_error();
|
||||
result= thd->binlog_query(THD::STMT_QUERY_TYPE, buff, query_length,
|
||||
FALSE, FALSE, FALSE, 0);
|
||||
FALSE, FALSE, FALSE, 0) > 0;
|
||||
}
|
||||
end:
|
||||
close_mysql_tables(thd);
|
||||
|
@ -1317,7 +1317,7 @@ bool Sql_cmd_analyze_table::execute(THD *thd)
|
||||
"analyze", lock_type, 1, 0, 0, 0,
|
||||
&handler::ha_analyze, 0);
|
||||
/* ! we write after unlocking the table */
|
||||
if (!res && !m_lex->no_write_to_binlog)
|
||||
if (!res && !m_lex->no_write_to_binlog && (!opt_readonly || thd->slave_thread))
|
||||
{
|
||||
/*
|
||||
Presumably, ANALYZE and binlog writing doesn't require synchronization
|
||||
@ -1377,7 +1377,7 @@ bool Sql_cmd_optimize_table::execute(THD *thd)
|
||||
"optimize", TL_WRITE, 1, 0, 0, 0,
|
||||
&handler::ha_optimize, 0);
|
||||
/* ! we write after unlocking the table */
|
||||
if (!res && !m_lex->no_write_to_binlog)
|
||||
if (!res && !m_lex->no_write_to_binlog && (!opt_readonly || thd->slave_thread))
|
||||
{
|
||||
/*
|
||||
Presumably, OPTIMIZE and binlog writing doesn't require synchronization
|
||||
@ -1413,7 +1413,7 @@ bool Sql_cmd_repair_table::execute(THD *thd)
|
||||
&handler::ha_repair, &view_repair);
|
||||
|
||||
/* ! we write after unlocking the table */
|
||||
if (!res && !m_lex->no_write_to_binlog)
|
||||
if (!res && !m_lex->no_write_to_binlog && (!opt_readonly || thd->slave_thread))
|
||||
{
|
||||
/*
|
||||
Presumably, REPAIR and binlog writing doesn't require synchronization
|
||||
|
@ -2669,6 +2669,7 @@ Locked_tables_list::reopen_tables(THD *thd, bool need_reopen)
|
||||
{
|
||||
thd->locked_tables_list.unlink_from_list(thd, table_list, false);
|
||||
mysql_lock_remove(thd, thd->lock, *prev);
|
||||
(*prev)->file->extra(HA_EXTRA_PREPARE_FOR_FORCED_CLOSE);
|
||||
close_thread_table(thd, prev);
|
||||
break;
|
||||
}
|
||||
@ -4605,9 +4606,11 @@ add_internal_tables(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
TABLE_LIST *tables)
|
||||
{
|
||||
TABLE_LIST *global_table_list= prelocking_ctx->query_tables;
|
||||
DBUG_ENTER("add_internal_tables");
|
||||
|
||||
do
|
||||
{
|
||||
DBUG_PRINT("info", ("table name: %s", tables->table_name.str));
|
||||
/*
|
||||
Skip table if already in the list. Can happen with prepared statements
|
||||
*/
|
||||
@ -4617,20 +4620,22 @@ add_internal_tables(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
|
||||
TABLE_LIST *tl= (TABLE_LIST *) thd->alloc(sizeof(TABLE_LIST));
|
||||
if (!tl)
|
||||
return TRUE;
|
||||
DBUG_RETURN(TRUE);
|
||||
tl->init_one_table_for_prelocking(&tables->db,
|
||||
&tables->table_name,
|
||||
NULL, tables->lock_type,
|
||||
TABLE_LIST::PRELOCK_NONE,
|
||||
0, 0,
|
||||
&prelocking_ctx->query_tables_last);
|
||||
&prelocking_ctx->query_tables_last,
|
||||
tables->for_insert_data);
|
||||
/*
|
||||
Store link to the new table_list that will be used by open so that
|
||||
Item_func_nextval() can find it
|
||||
*/
|
||||
tables->next_local= tl;
|
||||
DBUG_PRINT("info", ("table name: %s added", tables->table_name.str));
|
||||
} while ((tables= tables->next_global));
|
||||
return FALSE;
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -4661,6 +4666,7 @@ bool DML_prelocking_strategy::
|
||||
handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
TABLE_LIST *table_list, bool *need_prelocking)
|
||||
{
|
||||
DBUG_ENTER("handle_table");
|
||||
TABLE *table= table_list->table;
|
||||
/* We rely on a caller to check that table is going to be changed. */
|
||||
DBUG_ASSERT(table_list->lock_type >= TL_WRITE_ALLOW_WRITE ||
|
||||
@ -4691,7 +4697,7 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
{
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
return TRUE;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
*need_prelocking= TRUE;
|
||||
@ -4719,7 +4725,8 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
NULL, lock_type,
|
||||
TABLE_LIST::PRELOCK_FK,
|
||||
table_list->belong_to_view, op,
|
||||
&prelocking_ctx->query_tables_last);
|
||||
&prelocking_ctx->query_tables_last,
|
||||
table_list->for_insert_data);
|
||||
}
|
||||
if (arena)
|
||||
thd->restore_active_arena(arena, &backup);
|
||||
@ -4727,8 +4734,11 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
}
|
||||
|
||||
/* Open any tables used by DEFAULT (like sequence tables) */
|
||||
DBUG_PRINT("info", ("table: %p name: %s db: %s flags: %u",
|
||||
table_list, table_list->table_name.str,
|
||||
table_list->db.str, table_list->for_insert_data));
|
||||
if (table->internal_tables &&
|
||||
((sql_command_flags[thd->lex->sql_command] & CF_INSERTS_DATA) ||
|
||||
(table_list->for_insert_data ||
|
||||
thd->lex->default_used))
|
||||
{
|
||||
Query_arena *arena, backup;
|
||||
@ -4741,10 +4751,10 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
if (unlikely(error))
|
||||
{
|
||||
*need_prelocking= TRUE;
|
||||
return TRUE;
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
|
||||
@ -4761,7 +4771,7 @@ bool open_and_lock_internal_tables(TABLE *table, bool lock_table)
|
||||
THD *thd= table->in_use;
|
||||
TABLE_LIST *tl;
|
||||
MYSQL_LOCK *save_lock,*new_lock;
|
||||
DBUG_ENTER("open_internal_tables");
|
||||
DBUG_ENTER("open_and_lock_internal_tables");
|
||||
|
||||
/* remove pointer to old select_lex which is already destroyed */
|
||||
for (tl= table->internal_tables ; tl ; tl= tl->next_global)
|
||||
|
104
sql/sql_class.cc
104
sql/sql_class.cc
@ -49,7 +49,7 @@
|
||||
#include <m_ctype.h>
|
||||
#include <sys/stat.h>
|
||||
#include <thr_alarm.h>
|
||||
#ifdef __WIN__
|
||||
#ifdef __WIN__0
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <mysys_err.h>
|
||||
@ -5865,17 +5865,33 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
||||
Get the capabilities vector for all involved storage engines and
|
||||
mask out the flags for the binary log.
|
||||
*/
|
||||
for (TABLE_LIST *table= tables; table; table= table->next_global)
|
||||
for (TABLE_LIST *tbl= tables; tbl; tbl= tbl->next_global)
|
||||
{
|
||||
if (table->placeholder())
|
||||
TABLE *table;
|
||||
TABLE_SHARE *share;
|
||||
handler::Table_flags flags;
|
||||
if (tbl->placeholder())
|
||||
continue;
|
||||
|
||||
handler::Table_flags const flags= table->table->file->ha_table_flags();
|
||||
table= tbl->table;
|
||||
share= table->s;
|
||||
flags= table->file->ha_table_flags();
|
||||
if (!share->table_creation_was_logged)
|
||||
{
|
||||
/*
|
||||
This is a temporary table which was not logged in the binary log.
|
||||
Disable statement logging to enforce row level logging.
|
||||
*/
|
||||
DBUG_ASSERT(share->tmp_table);
|
||||
flags&= ~HA_BINLOG_STMT_CAPABLE;
|
||||
/* We can only use row logging */
|
||||
set_current_stmt_binlog_format_row();
|
||||
}
|
||||
|
||||
DBUG_PRINT("info", ("table: %s; ha_table_flags: 0x%llx",
|
||||
table->table_name.str, flags));
|
||||
tbl->table_name.str, flags));
|
||||
|
||||
if (table->table->s->no_replicate)
|
||||
if (share->no_replicate)
|
||||
{
|
||||
/*
|
||||
The statement uses a table that is not replicated.
|
||||
@ -5893,44 +5909,44 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
||||
*/
|
||||
lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_TABLE);
|
||||
|
||||
if (table->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
if (tbl->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
{
|
||||
non_replicated_tables_count++;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (table == lex->first_not_own_table())
|
||||
if (tbl == lex->first_not_own_table())
|
||||
found_first_not_own_table= true;
|
||||
|
||||
replicated_tables_count++;
|
||||
|
||||
if (table->prelocking_placeholder != TABLE_LIST::PRELOCK_FK)
|
||||
if (tbl->prelocking_placeholder != TABLE_LIST::PRELOCK_FK)
|
||||
{
|
||||
if (table->lock_type <= TL_READ_NO_INSERT)
|
||||
if (tbl->lock_type <= TL_READ_NO_INSERT)
|
||||
has_read_tables= true;
|
||||
else if (table->table->found_next_number_field &&
|
||||
(table->lock_type >= TL_WRITE_ALLOW_WRITE))
|
||||
else if (table->found_next_number_field &&
|
||||
(tbl->lock_type >= TL_WRITE_ALLOW_WRITE))
|
||||
{
|
||||
has_auto_increment_write_tables= true;
|
||||
has_auto_increment_write_tables_not_first= found_first_not_own_table;
|
||||
if (table->table->s->next_number_keypart != 0)
|
||||
if (share->next_number_keypart != 0)
|
||||
has_write_table_auto_increment_not_first_in_pk= true;
|
||||
}
|
||||
}
|
||||
|
||||
if (table->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
if (tbl->lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
{
|
||||
bool trans;
|
||||
if (prev_write_table && prev_write_table->file->ht !=
|
||||
table->table->file->ht)
|
||||
table->file->ht)
|
||||
multi_write_engine= TRUE;
|
||||
if (table->table->s->non_determinstic_insert &&
|
||||
if (share->non_determinstic_insert &&
|
||||
!(sql_command_flags[lex->sql_command] & CF_SCHEMA_CHANGE))
|
||||
has_write_tables_with_unsafe_statements= true;
|
||||
|
||||
trans= table->table->file->has_transactions();
|
||||
trans= table->file->has_transactions();
|
||||
|
||||
if (table->table->s->tmp_table)
|
||||
if (share->tmp_table)
|
||||
lex->set_stmt_accessed_table(trans ? LEX::STMT_WRITES_TEMP_TRANS_TABLE :
|
||||
LEX::STMT_WRITES_TEMP_NON_TRANS_TABLE);
|
||||
else
|
||||
@ -5941,17 +5957,16 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
||||
flags_write_some_set |= flags;
|
||||
is_write= TRUE;
|
||||
|
||||
prev_write_table= table->table;
|
||||
prev_write_table= table;
|
||||
|
||||
}
|
||||
flags_access_some_set |= flags;
|
||||
|
||||
if (lex->sql_command != SQLCOM_CREATE_TABLE ||
|
||||
(lex->sql_command == SQLCOM_CREATE_TABLE && lex->tmp_table()))
|
||||
if (lex->sql_command != SQLCOM_CREATE_TABLE || lex->tmp_table())
|
||||
{
|
||||
my_bool trans= table->table->file->has_transactions();
|
||||
my_bool trans= table->file->has_transactions();
|
||||
|
||||
if (table->table->s->tmp_table)
|
||||
if (share->tmp_table)
|
||||
lex->set_stmt_accessed_table(trans ? LEX::STMT_READS_TEMP_TRANS_TABLE :
|
||||
LEX::STMT_READS_TEMP_NON_TRANS_TABLE);
|
||||
else
|
||||
@ -5960,10 +5975,10 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
||||
}
|
||||
|
||||
if (prev_access_table && prev_access_table->file->ht !=
|
||||
table->table->file->ht)
|
||||
table->file->ht)
|
||||
multi_access_engine= TRUE;
|
||||
|
||||
prev_access_table= table->table;
|
||||
prev_access_table= table;
|
||||
}
|
||||
|
||||
if (wsrep_binlog_format() != BINLOG_FORMAT_ROW)
|
||||
@ -6092,10 +6107,17 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
||||
{
|
||||
/*
|
||||
5. Error: Cannot modify table that uses a storage engine
|
||||
limited to row-logging when binlog_format = STATEMENT
|
||||
limited to row-logging when binlog_format = STATEMENT, except
|
||||
if all tables that are updated are temporary tables
|
||||
*/
|
||||
if (IF_WSREP((!WSREP_NNULL(this) ||
|
||||
wsrep_cs().mode() == wsrep::client_state::m_local),1))
|
||||
if (!lex->stmt_writes_to_non_temp_table())
|
||||
{
|
||||
/* As all updated tables are temporary, nothing will be logged */
|
||||
set_current_stmt_binlog_format_row();
|
||||
}
|
||||
else if (IF_WSREP((!WSREP(this) ||
|
||||
wsrep_cs().mode() ==
|
||||
wsrep::client_state::m_local),1))
|
||||
{
|
||||
my_error((error= ER_BINLOG_STMT_MODE_AND_ROW_ENGINE), MYF(0), "");
|
||||
}
|
||||
@ -6164,10 +6186,8 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
||||
"ROW" : "STATEMENT"));
|
||||
|
||||
if (variables.binlog_format == BINLOG_FORMAT_ROW &&
|
||||
(lex->sql_command == SQLCOM_UPDATE ||
|
||||
lex->sql_command == SQLCOM_UPDATE_MULTI ||
|
||||
lex->sql_command == SQLCOM_DELETE ||
|
||||
lex->sql_command == SQLCOM_DELETE_MULTI))
|
||||
(sql_command_flags[lex->sql_command] &
|
||||
(CF_UPDATES_DATA | CF_DELETES_DATA)))
|
||||
{
|
||||
String table_names;
|
||||
/*
|
||||
@ -6187,8 +6207,8 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
||||
}
|
||||
if (!table_names.is_empty())
|
||||
{
|
||||
bool is_update= (lex->sql_command == SQLCOM_UPDATE ||
|
||||
lex->sql_command == SQLCOM_UPDATE_MULTI);
|
||||
bool is_update= MY_TEST(sql_command_flags[lex->sql_command] &
|
||||
CF_UPDATES_DATA);
|
||||
/*
|
||||
Replace the last ',' with '.' for table_names
|
||||
*/
|
||||
@ -7025,11 +7045,12 @@ void THD::issue_unsafe_warnings()
|
||||
|
||||
@see decide_logging_format
|
||||
|
||||
@retval < 0 No logging of query (ok)
|
||||
@retval 0 Success
|
||||
|
||||
@retval nonzero If there is a failure when writing the query (e.g.,
|
||||
write failure), then the error code is returned.
|
||||
@retval > 0 If there is a failure when writing the query (e.g.,
|
||||
write failure), then the error code is returned.
|
||||
*/
|
||||
|
||||
int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
|
||||
ulong query_len, bool is_trans, bool direct,
|
||||
bool suppress_use, int errcode)
|
||||
@ -7055,7 +7076,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
|
||||
The current statement is to be ignored, and not written to
|
||||
the binlog. Do not call issue_unsafe_warnings().
|
||||
*/
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -7071,7 +7092,10 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
|
||||
{
|
||||
int error;
|
||||
if (unlikely(error= binlog_flush_pending_rows_event(TRUE, is_trans)))
|
||||
{
|
||||
DBUG_ASSERT(error > 0);
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -7114,7 +7138,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
|
||||
("is_current_stmt_binlog_format_row: %d",
|
||||
is_current_stmt_binlog_format_row()));
|
||||
if (is_current_stmt_binlog_format_row())
|
||||
DBUG_RETURN(0);
|
||||
DBUG_RETURN(-1);
|
||||
/* Fall through */
|
||||
|
||||
/*
|
||||
@ -7155,7 +7179,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
|
||||
}
|
||||
|
||||
binlog_table_maps= 0;
|
||||
DBUG_RETURN(error);
|
||||
DBUG_RETURN(error >= 0 ? error : 1);
|
||||
}
|
||||
|
||||
case THD::QUERY_TYPE_COUNT:
|
||||
|
@ -1617,12 +1617,16 @@ public:
|
||||
/**
|
||||
@class Sub_statement_state
|
||||
@brief Used to save context when executing a function or trigger
|
||||
|
||||
operations on stat tables aren't technically a sub-statement, but they are
|
||||
similar in a sense that they cannot change the transaction status.
|
||||
*/
|
||||
|
||||
/* Defines used for Sub_statement_state::in_sub_stmt */
|
||||
|
||||
#define SUB_STMT_TRIGGER 1
|
||||
#define SUB_STMT_FUNCTION 2
|
||||
#define SUB_STMT_STAT_TABLES 4
|
||||
|
||||
|
||||
class Sub_statement_state
|
||||
@ -6473,6 +6477,11 @@ public:
|
||||
|
||||
/* Bits in server_command_flags */
|
||||
|
||||
/**
|
||||
Statement that deletes existing rows (DELETE, DELETE_MULTI)
|
||||
*/
|
||||
#define CF_DELETES_DATA (1U << 24)
|
||||
|
||||
/**
|
||||
Skip the increase of the global query id counter. Commonly set for
|
||||
commands that are stateless (won't cause any change on the server
|
||||
@ -6678,6 +6687,22 @@ class Sql_mode_save
|
||||
sql_mode_t old_mode; // SQL mode saved at construction time.
|
||||
};
|
||||
|
||||
class Switch_to_definer_security_ctx
|
||||
{
|
||||
public:
|
||||
Switch_to_definer_security_ctx(THD *thd, TABLE_LIST *table) :
|
||||
m_thd(thd), m_sctx(thd->security_ctx)
|
||||
{
|
||||
if (table->security_ctx)
|
||||
thd->security_ctx= table->security_ctx;
|
||||
}
|
||||
~Switch_to_definer_security_ctx() { m_thd->security_ctx = m_sctx; }
|
||||
|
||||
private:
|
||||
THD *m_thd;
|
||||
Security_context *m_sctx;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
This class resembles the SQL Standard schema qualified object name:
|
||||
|
@ -945,7 +945,7 @@ cleanup:
|
||||
transactional_table, FALSE, FALSE,
|
||||
errcode);
|
||||
|
||||
if (log_result)
|
||||
if (log_result > 0)
|
||||
{
|
||||
error=1;
|
||||
}
|
||||
@ -1640,7 +1640,7 @@ bool multi_delete::send_eof()
|
||||
if (unlikely(thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
thd->query(), thd->query_length(),
|
||||
transactional_tables, FALSE, FALSE,
|
||||
errcode)) &&
|
||||
errcode) > 0) &&
|
||||
!normal_tables)
|
||||
{
|
||||
local_error=1; // Log write failed: roll back the SQL statement
|
||||
|
@ -1190,13 +1190,13 @@ values_loop_end:
|
||||
else if (thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
log_query.c_ptr(), log_query.length(),
|
||||
transactional_table, FALSE, FALSE,
|
||||
errcode))
|
||||
errcode) > 0)
|
||||
error= 1;
|
||||
}
|
||||
else if (thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
thd->query(), thd->query_length(),
|
||||
transactional_table, FALSE, FALSE,
|
||||
errcode))
|
||||
errcode) > 0)
|
||||
error= 1;
|
||||
}
|
||||
}
|
||||
@ -3947,6 +3947,7 @@ bool select_insert::prepare_eof()
|
||||
int error;
|
||||
bool const trans_table= table->file->has_transactions();
|
||||
bool changed;
|
||||
bool binary_logged= 0;
|
||||
killed_state killed_status= thd->killed;
|
||||
|
||||
DBUG_ENTER("select_insert::prepare_eof");
|
||||
@ -3997,18 +3998,22 @@ bool select_insert::prepare_eof()
|
||||
(likely(!error) || thd->transaction.stmt.modified_non_trans_table))
|
||||
{
|
||||
int errcode= 0;
|
||||
int res;
|
||||
if (likely(!error))
|
||||
thd->clear_error();
|
||||
else
|
||||
errcode= query_error_code(thd, killed_status == NOT_KILLED);
|
||||
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
thd->query(), thd->query_length(),
|
||||
trans_table, FALSE, FALSE, errcode))
|
||||
res= thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
thd->query(), thd->query_length(),
|
||||
trans_table, FALSE, FALSE, errcode);
|
||||
if (res > 0)
|
||||
{
|
||||
table->file->ha_release_auto_increment();
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
binary_logged= res == 0 || !table->s->tmp_table;
|
||||
}
|
||||
table->s->table_creation_was_logged|= binary_logged;
|
||||
table->file->ha_release_auto_increment();
|
||||
|
||||
if (unlikely(error))
|
||||
@ -4059,8 +4064,9 @@ bool select_insert::send_eof()
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
void select_insert::abort_result_set() {
|
||||
|
||||
void select_insert::abort_result_set()
|
||||
{
|
||||
bool binary_logged= 0;
|
||||
DBUG_ENTER("select_insert::abort_result_set");
|
||||
/*
|
||||
If the creation of the table failed (due to a syntax error, for
|
||||
@ -4112,16 +4118,20 @@ void select_insert::abort_result_set() {
|
||||
if(WSREP_EMULATE_BINLOG(thd) || mysql_bin_log.is_open())
|
||||
{
|
||||
int errcode= query_error_code(thd, thd->killed == NOT_KILLED);
|
||||
int res;
|
||||
/* error of writing binary log is ignored */
|
||||
(void) thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
|
||||
thd->query_length(),
|
||||
transactional_table, FALSE, FALSE, errcode);
|
||||
res= thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
|
||||
thd->query_length(),
|
||||
transactional_table, FALSE, FALSE, errcode);
|
||||
binary_logged= res == 0 || !table->s->tmp_table;
|
||||
}
|
||||
if (changed)
|
||||
query_cache_invalidate3(thd, table, 1);
|
||||
}
|
||||
DBUG_ASSERT(transactional_table || !changed ||
|
||||
thd->transaction.stmt.modified_non_trans_table);
|
||||
|
||||
table->s->table_creation_was_logged|= binary_logged;
|
||||
table->file->ha_release_auto_increment();
|
||||
}
|
||||
|
||||
@ -4190,6 +4200,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
/* Add selected items to field list */
|
||||
List_iterator_fast<Item> it(*items);
|
||||
Item *item;
|
||||
bool save_table_creation_was_logged;
|
||||
DBUG_ENTER("select_create::create_table_from_items");
|
||||
|
||||
tmp_table.s= &share;
|
||||
@ -4343,6 +4354,14 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
|
||||
table->reginfo.lock_type=TL_WRITE;
|
||||
hooks->prelock(&table, 1); // Call prelock hooks
|
||||
|
||||
/*
|
||||
Ensure that decide_logging_format(), called by mysql_lock_tables(), works
|
||||
with temporary tables that will be logged later if needed.
|
||||
*/
|
||||
save_table_creation_was_logged= table->s->table_creation_was_logged;
|
||||
table->s->table_creation_was_logged= 1;
|
||||
|
||||
/*
|
||||
mysql_lock_tables() below should never fail with request to reopen table
|
||||
since it won't wait for the table lock (we have exclusive metadata lock on
|
||||
@ -4355,8 +4374,11 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
/*
|
||||
This can happen in innodb when you get a deadlock when using same table
|
||||
in insert and select or when you run out of memory.
|
||||
It can also happen if there was a conflict in
|
||||
THD::decide_logging_format()
|
||||
*/
|
||||
my_error(ER_CANT_LOCK, MYF(0), my_errno);
|
||||
if (!thd->is_error())
|
||||
my_error(ER_CANT_LOCK, MYF(0), my_errno);
|
||||
if (*lock)
|
||||
{
|
||||
mysql_unlock_tables(thd, *lock);
|
||||
@ -4366,6 +4388,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
|
||||
DBUG_RETURN(0);
|
||||
/* purecov: end */
|
||||
}
|
||||
table->s->table_creation_was_logged= save_table_creation_was_logged;
|
||||
DBUG_RETURN(table);
|
||||
}
|
||||
|
||||
@ -4569,7 +4592,7 @@ select_create::binlog_show_create_table(TABLE **tables, uint count)
|
||||
/* is_trans */ TRUE,
|
||||
/* direct */ FALSE,
|
||||
/* suppress_use */ FALSE,
|
||||
errcode);
|
||||
errcode) > 0;
|
||||
}
|
||||
#ifdef WITH_WSREP
|
||||
if (thd->wsrep_trx().active())
|
||||
@ -4693,8 +4716,6 @@ bool select_create::send_eof()
|
||||
}
|
||||
#endif /* WITH_WSREP */
|
||||
}
|
||||
else if (!thd->is_current_stmt_binlog_format_row())
|
||||
table->s->table_creation_was_logged= 1;
|
||||
|
||||
/*
|
||||
exit_done must only be set after last potential call to
|
||||
@ -4780,7 +4801,8 @@ void select_create::abort_result_set()
|
||||
if (table)
|
||||
{
|
||||
bool tmp_table= table->s->tmp_table;
|
||||
|
||||
bool table_creation_was_logged= (!tmp_table ||
|
||||
table->s->table_creation_was_logged);
|
||||
if (tmp_table)
|
||||
{
|
||||
DBUG_ASSERT(saved_tmp_table_share);
|
||||
@ -4809,7 +4831,9 @@ void select_create::abort_result_set()
|
||||
/* Remove logging of drop, create + insert rows */
|
||||
binlog_reset_cache(thd);
|
||||
/* Original table was deleted. We have to log it */
|
||||
log_drop_table(thd, &create_table->db, &create_table->table_name, tmp_table);
|
||||
if (table_creation_was_logged)
|
||||
log_drop_table(thd, &create_table->db, &create_table->table_name,
|
||||
tmp_table);
|
||||
}
|
||||
}
|
||||
DBUG_VOID_RETURN;
|
||||
|
@ -7713,7 +7713,7 @@ uint binlog_unsafe_map[256];
|
||||
|
||||
#define UNSAFE(a, b, c) \
|
||||
{ \
|
||||
DBUG_PRINT("unsafe_mixed_statement", ("SETTING BASE VALUES: %s, %s, %02X\n", \
|
||||
DBUG_PRINT("unsafe_mixed_statement", ("SETTING BASE VALUES: %s, %s, %02X", \
|
||||
LEX::stmt_accessed_table_string(a), \
|
||||
LEX::stmt_accessed_table_string(b), \
|
||||
c)); \
|
||||
|
@ -2175,6 +2175,14 @@ public:
|
||||
((1U << STMT_READS_TEMP_TRANS_TABLE) |
|
||||
(1U << STMT_WRITES_TEMP_TRANS_TABLE))) != 0);
|
||||
}
|
||||
inline bool stmt_writes_to_non_temp_table()
|
||||
{
|
||||
DBUG_ENTER("THD::stmt_writes_to_non_temp_table");
|
||||
|
||||
DBUG_RETURN((stmt_accessed_table_flag &
|
||||
((1U << STMT_WRITES_TRANS_TABLE) |
|
||||
(1U << STMT_WRITES_NON_TRANS_TABLE))));
|
||||
}
|
||||
|
||||
/**
|
||||
Checks if a temporary non-transactional table is about to be accessed
|
||||
@ -2226,7 +2234,7 @@ public:
|
||||
unsafe= (binlog_unsafe_map[stmt_accessed_table_flag] & condition);
|
||||
|
||||
#if !defined(DBUG_OFF)
|
||||
DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("RESULT %02X %02X %02X\n", condition,
|
||||
DBUG_PRINT("LEX::is_mixed_stmt_unsafe", ("RESULT %02X %02X %02X", condition,
|
||||
binlog_unsafe_map[stmt_accessed_table_flag],
|
||||
(binlog_unsafe_map[stmt_accessed_table_flag] & condition)));
|
||||
|
||||
@ -4531,6 +4539,8 @@ public:
|
||||
Item_result return_type,
|
||||
const LEX_CSTRING &soname);
|
||||
Spvar_definition *row_field_name(THD *thd, const Lex_ident_sys_st &name);
|
||||
|
||||
void mark_first_table_as_inserting();
|
||||
};
|
||||
|
||||
|
||||
|
@ -2053,7 +2053,7 @@ int READ_INFO::read_xml(THD *thd)
|
||||
chr= read_value(delim, &value);
|
||||
if (attribute.length() > 0 && value.length() > 0)
|
||||
{
|
||||
DBUG_PRINT("read_xml", ("lev:%i att:%s val:%s\n",
|
||||
DBUG_PRINT("read_xml", ("lev:%i att:%s val:%s",
|
||||
level + 1,
|
||||
attribute.c_ptr_safe(),
|
||||
value.c_ptr_safe()));
|
||||
|
@ -606,11 +606,12 @@ void init_update_queries(void)
|
||||
CF_CAN_GENERATE_ROW_EVENTS |
|
||||
CF_OPTIMIZER_TRACE |
|
||||
CF_CAN_BE_EXPLAINED |
|
||||
CF_SP_BULK_SAFE;
|
||||
CF_SP_BULK_SAFE | CF_DELETES_DATA;
|
||||
sql_command_flags[SQLCOM_DELETE_MULTI]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
|
||||
CF_CAN_GENERATE_ROW_EVENTS |
|
||||
CF_OPTIMIZER_TRACE |
|
||||
CF_CAN_BE_EXPLAINED;
|
||||
CF_CAN_BE_EXPLAINED |
|
||||
CF_DELETES_DATA;
|
||||
sql_command_flags[SQLCOM_REPLACE]= CF_CHANGES_DATA | CF_REEXECUTION_FRAGILE |
|
||||
CF_CAN_GENERATE_ROW_EVENTS |
|
||||
CF_OPTIMIZER_TRACE |
|
||||
@ -3307,6 +3308,10 @@ mysql_execute_command(THD *thd)
|
||||
#endif
|
||||
DBUG_ENTER("mysql_execute_command");
|
||||
|
||||
// check that we correctly marked first table for data insertion
|
||||
DBUG_ASSERT(!(sql_command_flags[lex->sql_command] & CF_INSERTS_DATA) ||
|
||||
first_table->for_insert_data);
|
||||
|
||||
if (thd->security_ctx->password_expired &&
|
||||
lex->sql_command != SQLCOM_SET_OPTION)
|
||||
{
|
||||
@ -6751,11 +6756,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
|
||||
bool check_single_table_access(THD *thd, ulong privilege,
|
||||
TABLE_LIST *all_tables, bool no_errors)
|
||||
{
|
||||
Security_context * backup_ctx= thd->security_ctx;
|
||||
|
||||
/* we need to switch to the saved context (if any) */
|
||||
if (all_tables->security_ctx)
|
||||
thd->security_ctx= all_tables->security_ctx;
|
||||
Switch_to_definer_security_ctx backup_sctx(thd, all_tables);
|
||||
|
||||
const char *db_name;
|
||||
if ((all_tables->view || all_tables->field_translation) &&
|
||||
@ -6768,20 +6769,15 @@ bool check_single_table_access(THD *thd, ulong privilege,
|
||||
&all_tables->grant.privilege,
|
||||
&all_tables->grant.m_internal,
|
||||
0, no_errors))
|
||||
goto deny;
|
||||
return 1;
|
||||
|
||||
/* Show only 1 table for check_grant */
|
||||
if (!(all_tables->belong_to_view &&
|
||||
(thd->lex->sql_command == SQLCOM_SHOW_FIELDS)) &&
|
||||
check_grant(thd, privilege, all_tables, FALSE, 1, no_errors))
|
||||
goto deny;
|
||||
return 1;
|
||||
|
||||
thd->security_ctx= backup_ctx;
|
||||
return 0;
|
||||
|
||||
deny:
|
||||
thd->security_ctx= backup_ctx;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -6956,7 +6952,6 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
|
||||
{
|
||||
TABLE_LIST *org_tables= tables;
|
||||
TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table();
|
||||
Security_context *sctx= thd->security_ctx, *backup_ctx= thd->security_ctx;
|
||||
uint i= 0;
|
||||
/*
|
||||
The check that first_not_own_table is not reached is for the case when
|
||||
@ -6968,12 +6963,9 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
|
||||
{
|
||||
TABLE_LIST *const table_ref= tables->correspondent_table ?
|
||||
tables->correspondent_table : tables;
|
||||
Switch_to_definer_security_ctx backup_ctx(thd, table_ref);
|
||||
|
||||
ulong want_access= requirements;
|
||||
if (table_ref->security_ctx)
|
||||
sctx= table_ref->security_ctx;
|
||||
else
|
||||
sctx= backup_ctx;
|
||||
|
||||
/*
|
||||
Register access for view underlying table.
|
||||
@ -6984,7 +6976,7 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
|
||||
if (table_ref->schema_table_reformed)
|
||||
{
|
||||
if (check_show_access(thd, table_ref))
|
||||
goto deny;
|
||||
return 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -6994,8 +6986,6 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
|
||||
if (table_ref->is_anonymous_derived_table())
|
||||
continue;
|
||||
|
||||
thd->security_ctx= sctx;
|
||||
|
||||
if (table_ref->sequence)
|
||||
{
|
||||
/* We want to have either SELECT or INSERT rights to sequences depending
|
||||
@ -7009,15 +6999,11 @@ check_table_access(THD *thd, ulong requirements,TABLE_LIST *tables,
|
||||
&table_ref->grant.privilege,
|
||||
&table_ref->grant.m_internal,
|
||||
0, no_errors))
|
||||
goto deny;
|
||||
return 1;
|
||||
}
|
||||
thd->security_ctx= backup_ctx;
|
||||
return check_grant(thd,requirements,org_tables,
|
||||
any_combination_of_privileges_will_do,
|
||||
number, no_errors);
|
||||
deny:
|
||||
thd->security_ctx= backup_ctx;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -10315,3 +10301,14 @@ CHARSET_INFO *find_bin_collation(CHARSET_INFO *cs)
|
||||
}
|
||||
return cs;
|
||||
}
|
||||
|
||||
void LEX::mark_first_table_as_inserting()
|
||||
{
|
||||
TABLE_LIST *t= first_select_lex()->table_list.first;
|
||||
DBUG_ENTER("Query_tables_list::mark_tables_with_important_flags");
|
||||
DBUG_ASSERT(sql_command_flags[sql_command] & CF_INSERTS_DATA);
|
||||
t->for_insert_data= TRUE;
|
||||
DBUG_PRINT("info", ("table_list: %p name: %s db: %s command: %u",
|
||||
t, t->table_name.str,t->db.str, sql_command));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ Item* convert_charset_partition_constant(Item *item, CHARSET_INFO *cs)
|
||||
item= item->safe_charset_converter(thd, cs);
|
||||
context->table_list= NULL;
|
||||
thd->where= "convert character set partition constant";
|
||||
if (item->fix_fields_if_needed(thd, (Item**)NULL))
|
||||
if (item && item->fix_fields_if_needed(thd, (Item**)NULL))
|
||||
item= NULL;
|
||||
thd->where= save_where;
|
||||
context->table_list= save_list;
|
||||
|
@ -3294,7 +3294,7 @@ void mysql_sql_stmt_execute(THD *thd)
|
||||
/* Query text for binary, general or slow log, if any of them is open */
|
||||
String expanded_query;
|
||||
DBUG_ENTER("mysql_sql_stmt_execute");
|
||||
DBUG_PRINT("info", ("EXECUTE: %.*s\n", (int) name->length, name->str));
|
||||
DBUG_PRINT("info", ("EXECUTE: %.*s", (int) name->length, name->str));
|
||||
|
||||
if (!(stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
|
||||
{
|
||||
@ -3532,7 +3532,7 @@ void mysql_sql_stmt_close(THD *thd)
|
||||
{
|
||||
Prepared_statement* stmt;
|
||||
const LEX_CSTRING *name= &thd->lex->prepared_stmt.name();
|
||||
DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s\n", (int) name->length,
|
||||
DBUG_PRINT("info", ("DEALLOCATE PREPARE: %.*s", (int) name->length,
|
||||
name->str));
|
||||
|
||||
if (! (stmt= (Prepared_statement*) thd->stmt_map.find_by_name(name)))
|
||||
|
@ -2979,8 +2979,12 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
||||
else
|
||||
protocol->store_null();
|
||||
protocol->store(thd_info->state_info, system_charset_info);
|
||||
protocol->store(thd_info->query_string.str(),
|
||||
thd_info->query_string.charset());
|
||||
if (thd_info->query_string.length())
|
||||
protocol->store(thd_info->query_string.str(),
|
||||
thd_info->query_string.length(),
|
||||
thd_info->query_string.charset());
|
||||
else
|
||||
protocol->store_null();
|
||||
if (!thd->variables.old_mode &&
|
||||
!(thd->variables.old_behavior & OLD_MODE_NO_PROGRESS_INFO))
|
||||
protocol->store(thd_info->progress, 3, &store_buffer);
|
||||
@ -8314,8 +8318,7 @@ TABLE *create_schema_table(THD *thd, TABLE_LIST *table_list)
|
||||
item->maybe_null= (fields_info->field_flags & MY_I_S_MAYBE_NULL);
|
||||
field_count++;
|
||||
}
|
||||
TMP_TABLE_PARAM *tmp_table_param =
|
||||
(TMP_TABLE_PARAM*) (thd->alloc(sizeof(TMP_TABLE_PARAM)));
|
||||
TMP_TABLE_PARAM *tmp_table_param = new (thd->mem_root) TMP_TABLE_PARAM;
|
||||
tmp_table_param->init();
|
||||
tmp_table_param->table_charset= cs;
|
||||
tmp_table_param->field_count= field_count;
|
||||
@ -8894,6 +8897,7 @@ bool get_schema_tables_result(JOIN *join,
|
||||
cond= tab->cache_select->cond;
|
||||
}
|
||||
|
||||
Switch_to_definer_security_ctx backup_ctx(thd, table_list);
|
||||
if (table_list->schema_table->fill_table(thd, table_list, cond))
|
||||
{
|
||||
result= 1;
|
||||
|
@ -230,10 +230,8 @@ index_stat_def= {INDEX_STAT_N_FIELDS, index_stat_fields, 4, index_stat_pk_col};
|
||||
Open all statistical tables and lock them
|
||||
*/
|
||||
|
||||
static
|
||||
inline int open_stat_tables(THD *thd, TABLE_LIST *tables,
|
||||
Open_tables_backup *backup,
|
||||
bool for_write)
|
||||
static int open_stat_tables(THD *thd, TABLE_LIST *tables,
|
||||
Open_tables_backup *backup, bool for_write)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@ -241,12 +239,14 @@ inline int open_stat_tables(THD *thd, TABLE_LIST *tables,
|
||||
thd->push_internal_handler(&deh);
|
||||
init_table_list_for_stat_tables(tables, for_write);
|
||||
init_mdl_requests(tables);
|
||||
thd->in_sub_stmt|= SUB_STMT_STAT_TABLES;
|
||||
rc= open_system_tables_for_read(thd, tables, backup);
|
||||
thd->in_sub_stmt&= ~SUB_STMT_STAT_TABLES;
|
||||
thd->pop_internal_handler();
|
||||
|
||||
|
||||
/* If the number of tables changes, we should revise the check below. */
|
||||
DBUG_ASSERT(STATISTICS_TABLES == 3);
|
||||
compile_time_assert(STATISTICS_TABLES == 3);
|
||||
|
||||
if (!rc &&
|
||||
(stat_table_intact.check(tables[TABLE_STAT].table, &table_stat_def) ||
|
||||
|
@ -1987,7 +1987,7 @@ int write_bin_log(THD *thd, bool clear_error,
|
||||
errcode= query_error_code(thd, TRUE);
|
||||
error= thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
query, query_length, is_trans, FALSE, FALSE,
|
||||
errcode);
|
||||
errcode) > 0;
|
||||
thd_proc_info(thd, 0);
|
||||
}
|
||||
return error;
|
||||
@ -2603,24 +2603,24 @@ err:
|
||||
/* Chop of the last comma */
|
||||
built_non_trans_tmp_query.chop();
|
||||
built_non_trans_tmp_query.append(" /* generated by server */");
|
||||
error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_non_trans_tmp_query.ptr(),
|
||||
built_non_trans_tmp_query.length(),
|
||||
FALSE, FALSE,
|
||||
is_drop_tmp_if_exists_added,
|
||||
0);
|
||||
error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_non_trans_tmp_query.ptr(),
|
||||
built_non_trans_tmp_query.length(),
|
||||
FALSE, FALSE,
|
||||
is_drop_tmp_if_exists_added,
|
||||
0) > 0);
|
||||
}
|
||||
if (trans_tmp_table_deleted)
|
||||
{
|
||||
/* Chop of the last comma */
|
||||
built_trans_tmp_query.chop();
|
||||
built_trans_tmp_query.append(" /* generated by server */");
|
||||
error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_trans_tmp_query.ptr(),
|
||||
built_trans_tmp_query.length(),
|
||||
TRUE, FALSE,
|
||||
is_drop_tmp_if_exists_added,
|
||||
0);
|
||||
error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_trans_tmp_query.ptr(),
|
||||
built_trans_tmp_query.length(),
|
||||
TRUE, FALSE,
|
||||
is_drop_tmp_if_exists_added,
|
||||
0) > 0);
|
||||
}
|
||||
if (non_tmp_table_deleted)
|
||||
{
|
||||
@ -2629,11 +2629,11 @@ err:
|
||||
built_query.append(" /* generated by server */");
|
||||
int error_code = non_tmp_error ? thd->get_stmt_da()->sql_errno()
|
||||
: 0;
|
||||
error |= thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_query.ptr(),
|
||||
built_query.length(),
|
||||
TRUE, FALSE, FALSE,
|
||||
error_code);
|
||||
error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_query.ptr(),
|
||||
built_query.length(),
|
||||
TRUE, FALSE, FALSE,
|
||||
error_code) > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2716,7 +2716,7 @@ bool log_drop_table(THD *thd, const LEX_CSTRING *db_name,
|
||||
"failed CREATE OR REPLACE */"));
|
||||
error= thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
query.ptr(), query.length(),
|
||||
FALSE, FALSE, temporary_table, 0);
|
||||
FALSE, FALSE, temporary_table, 0) > 0;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
@ -5271,9 +5271,13 @@ bool mysql_create_table(THD *thd, TABLE_LIST *create_table,
|
||||
}
|
||||
|
||||
err:
|
||||
/* In RBR we don't need to log CREATE TEMPORARY TABLE */
|
||||
if (!result && thd->is_current_stmt_binlog_format_row() && create_info->tmp_table())
|
||||
/* In RBR or readonly server we don't need to log CREATE TEMPORARY TABLE */
|
||||
if (!result && create_info->tmp_table() &&
|
||||
(thd->is_current_stmt_binlog_format_row() || (opt_readonly && !thd->slave_thread)))
|
||||
{
|
||||
/* Note that table->s->table_creation_was_logged is not set! */
|
||||
DBUG_RETURN(result);
|
||||
}
|
||||
|
||||
if (create_info->tmp_table())
|
||||
thd->transaction.stmt.mark_created_temp_table();
|
||||
@ -5290,11 +5294,13 @@ err:
|
||||
*/
|
||||
thd->locked_tables_list.unlock_locked_table(thd, mdl_ticket);
|
||||
}
|
||||
else if (likely(!result) && create_info->tmp_table() && create_info->table)
|
||||
else if (likely(!result) && create_info->table)
|
||||
{
|
||||
/*
|
||||
Remember that tmp table creation was logged so that we know if
|
||||
Remember that table creation was logged so that we know if
|
||||
we should log a delete of it.
|
||||
If create_info->table was not set, it's a normal table and
|
||||
table_creation_was_logged will be set when the share is created.
|
||||
*/
|
||||
create_info->table->s->table_creation_was_logged= 1;
|
||||
}
|
||||
@ -6883,7 +6889,7 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
||||
}
|
||||
|
||||
if (field->vcol_info->is_in_partitioning_expr() ||
|
||||
field->flags & PART_KEY_FLAG)
|
||||
field->flags & PART_KEY_FLAG || field->stored_in_db())
|
||||
{
|
||||
if (value_changes)
|
||||
ha_alter_info->handler_flags|= ALTER_COLUMN_VCOL;
|
||||
|
@ -1263,7 +1263,7 @@ update_end:
|
||||
|
||||
if (thd->binlog_query(THD::ROW_QUERY_TYPE,
|
||||
thd->query(), thd->query_length(),
|
||||
transactional_table, FALSE, FALSE, errcode))
|
||||
transactional_table, FALSE, FALSE, errcode) > 0)
|
||||
{
|
||||
error=1; // Rollback update
|
||||
}
|
||||
@ -2992,7 +2992,7 @@ bool multi_update::send_eof()
|
||||
|
||||
if (thd->binlog_query(THD::ROW_QUERY_TYPE, thd->query(),
|
||||
thd->query_length(), transactional_tables, FALSE,
|
||||
FALSE, errcode))
|
||||
FALSE, errcode) > 0)
|
||||
local_error= 1; // Rollback update
|
||||
thd->set_current_stmt_binlog_format(save_binlog_format);
|
||||
}
|
||||
|
@ -698,7 +698,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
||||
thd->reset_unsafe_warnings();
|
||||
if (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
buff.ptr(), buff.length(), FALSE, FALSE, FALSE,
|
||||
errcode))
|
||||
errcode) > 0)
|
||||
res= TRUE;
|
||||
}
|
||||
|
||||
@ -1501,6 +1501,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
|
||||
privileges of top_view
|
||||
*/
|
||||
tbl->grant.want_privilege= SELECT_ACL;
|
||||
|
||||
/*
|
||||
After unfolding the view we lose the list of tables referenced in it
|
||||
(we will have only a list of underlying tables in case of MERGE
|
||||
@ -1551,6 +1552,18 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
|
||||
views with subqueries in select list.
|
||||
*/
|
||||
view_main_select_tables= lex->first_select_lex()->table_list.first;
|
||||
/*
|
||||
Mergeable view can be used for inserting, so we move the flag down
|
||||
*/
|
||||
if (table->for_insert_data)
|
||||
{
|
||||
for (TABLE_LIST *t= view_main_select_tables;
|
||||
t;
|
||||
t= t->next_local)
|
||||
{
|
||||
t->for_insert_data= TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Let us set proper lock type for tables of the view's main
|
||||
|
@ -7795,6 +7795,7 @@ alter:
|
||||
Lex->first_select_lex()->db=
|
||||
(Lex->first_select_lex()->table_list.first)->db;
|
||||
Lex->create_last_non_select_table= Lex->last_table();
|
||||
Lex->mark_first_table_as_inserting();
|
||||
}
|
||||
alter_commands
|
||||
{
|
||||
@ -13492,6 +13493,7 @@ insert:
|
||||
Lex->pop_select(); //main select
|
||||
if (Lex->check_main_unit_semantics())
|
||||
MYSQL_YYABORT;
|
||||
Lex->mark_first_table_as_inserting();
|
||||
}
|
||||
;
|
||||
|
||||
@ -13516,6 +13518,7 @@ replace:
|
||||
Lex->pop_select(); //main select
|
||||
if (Lex->check_main_unit_semantics())
|
||||
MYSQL_YYABORT;
|
||||
Lex->mark_first_table_as_inserting();
|
||||
}
|
||||
;
|
||||
|
||||
@ -15004,6 +15007,7 @@ load:
|
||||
Lex->pop_select(); //main select
|
||||
if (Lex->check_main_unit_semantics())
|
||||
MYSQL_YYABORT;
|
||||
Lex->mark_first_table_as_inserting();
|
||||
}
|
||||
;
|
||||
|
||||
|
@ -7896,6 +7896,7 @@ alter:
|
||||
Lex->first_select_lex()->db=
|
||||
(Lex->first_select_lex()->table_list.first)->db;
|
||||
Lex->create_last_non_select_table= Lex->last_table();
|
||||
Lex->mark_first_table_as_inserting();
|
||||
}
|
||||
alter_commands
|
||||
{
|
||||
@ -13618,6 +13619,7 @@ insert:
|
||||
Lex->pop_select(); //main select
|
||||
if (Lex->check_main_unit_semantics())
|
||||
MYSQL_YYABORT;
|
||||
Lex->mark_first_table_as_inserting();
|
||||
}
|
||||
;
|
||||
|
||||
@ -13642,6 +13644,7 @@ replace:
|
||||
Lex->pop_select(); //main select
|
||||
if (Lex->check_main_unit_semantics())
|
||||
MYSQL_YYABORT;
|
||||
Lex->mark_first_table_as_inserting();
|
||||
}
|
||||
;
|
||||
|
||||
@ -15136,6 +15139,7 @@ load:
|
||||
Lex->pop_select(); //main select
|
||||
if (Lex->check_main_unit_semantics())
|
||||
MYSQL_YYABORT;
|
||||
Lex->mark_first_table_as_inserting();
|
||||
}
|
||||
;
|
||||
|
||||
|
11
sql/table.cc
11
sql/table.cc
@ -694,7 +694,11 @@ enum open_frm_error open_table_def(THD *thd, TABLE_SHARE *share, uint flags)
|
||||
frmlen= read_length + sizeof(head);
|
||||
|
||||
share->init_from_binary_frm_image(thd, false, buf, frmlen);
|
||||
error_given= true; // init_from_binary_frm_image has already called my_error()
|
||||
/*
|
||||
Don't give any additional errors. If there would be a problem,
|
||||
init_from_binary_frm_image would call my_error() itself.
|
||||
*/
|
||||
error_given= true;
|
||||
my_free(buf);
|
||||
|
||||
goto err_not_open;
|
||||
@ -703,6 +707,9 @@ err:
|
||||
mysql_file_close(file, MYF(MY_WME));
|
||||
|
||||
err_not_open:
|
||||
/* Mark that table was created earlier and thus should have been logged */
|
||||
share->table_creation_was_logged= 1;
|
||||
|
||||
if (unlikely(share->error && !error_given))
|
||||
{
|
||||
share->open_errno= my_errno;
|
||||
@ -3179,6 +3186,8 @@ ret:
|
||||
sql_copy);
|
||||
DBUG_RETURN(HA_ERR_GENERIC);
|
||||
}
|
||||
/* Treat the table as normal table from binary logging point of view */
|
||||
table_creation_was_logged= 1;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
11
sql/table.h
11
sql/table.h
@ -750,10 +750,15 @@ struct TABLE_SHARE
|
||||
bool system; /* Set if system table (one record) */
|
||||
bool not_usable_by_query_cache;
|
||||
bool online_backup; /* Set if on-line backup supported */
|
||||
/*
|
||||
This is used by log tables, for tables that have their own internal
|
||||
binary logging or for tables that doesn't support statement or row logging
|
||||
*/
|
||||
bool no_replicate;
|
||||
bool crashed;
|
||||
bool is_view;
|
||||
bool can_cmp_whole_record;
|
||||
/* This is set for temporary tables where CREATE was binary logged */
|
||||
bool table_creation_was_logged;
|
||||
bool non_determinstic_insert;
|
||||
bool vcols_need_refixing;
|
||||
@ -2060,7 +2065,8 @@ struct TABLE_LIST
|
||||
prelocking_types prelocking_type,
|
||||
TABLE_LIST *belong_to_view_arg,
|
||||
uint8 trg_event_map_arg,
|
||||
TABLE_LIST ***last_ptr)
|
||||
TABLE_LIST ***last_ptr,
|
||||
my_bool insert_data)
|
||||
|
||||
{
|
||||
init_one_table(db_arg, table_name_arg, alias_arg, lock_type_arg);
|
||||
@ -2075,6 +2081,7 @@ struct TABLE_LIST
|
||||
**last_ptr= this;
|
||||
prev_global= *last_ptr;
|
||||
*last_ptr= &next_global;
|
||||
for_insert_data= insert_data;
|
||||
}
|
||||
|
||||
|
||||
@ -2501,6 +2508,8 @@ struct TABLE_LIST
|
||||
return period_conditions.is_set();
|
||||
}
|
||||
|
||||
my_bool for_insert_data;
|
||||
|
||||
/**
|
||||
@brief
|
||||
Find the bottom in the chain of embedded table VIEWs.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user