Merge 10.3 into 10.4
This commit is contained in:
commit
d3dcec5d65
@ -228,7 +228,7 @@ IF (WITH_UBSAN)
|
||||
IF(SECURITY_HARDENED)
|
||||
MESSAGE(FATAL_ERROR "WITH_UBSAN and SECURITY_HARDENED are mutually exclusive")
|
||||
ENDIF()
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined" DEBUG RELWITHDEBINFO)
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=undefined -fno-sanitize=alignment" DEBUG RELWITHDEBINFO)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WITH_TSAN)
|
||||
|
@ -1211,7 +1211,7 @@ static struct my_option innochecksum_options[] = {
|
||||
{"verbose", 'v', "Verbose (prints progress every 5 seconds).",
|
||||
&verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#ifndef DBUG_OFF
|
||||
{"debug", '#', "Output debug log. See " REFMAN "dbug-package.html",
|
||||
{"debug", '#', "Output debug log. See https://mariadb.com/kb/en/library/creating-a-trace-file/",
|
||||
&dbug_setting, &dbug_setting, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
#endif /* !DBUG_OFF */
|
||||
{"count", 'c', "Print the count of pages in the file and exits.",
|
||||
@ -1278,7 +1278,8 @@ static void usage(void)
|
||||
"[-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] "
|
||||
"[-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] "
|
||||
"[-l <log>] [-l] [-m <merge pages>] <filename or [-]>\n", my_progname);
|
||||
printf("See " REFMAN "innochecksum.html for usage hints.\n");
|
||||
printf("See https://mariadb.com/kb/en/library/innochecksum/"
|
||||
" for usage hints.\n");
|
||||
my_print_help(innochecksum_options);
|
||||
my_print_variables(innochecksum_options);
|
||||
}
|
||||
|
@ -986,6 +986,65 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n)
|
||||
return(ret);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <accctrl.h>
|
||||
#include <aclapi.h>
|
||||
/*
|
||||
On Windows, fix permission of the file after "copyback"
|
||||
We assume that after copyback, mysqld will run as service as NetworkService
|
||||
user, thus well give full permission on given file to that user.
|
||||
*/
|
||||
|
||||
static int fix_win_file_permissions(const char *file)
|
||||
{
|
||||
struct {
|
||||
TOKEN_USER tokenUser;
|
||||
BYTE buffer[SECURITY_MAX_SID_SIZE];
|
||||
} tokenInfoBuffer;
|
||||
HANDLE hFile = CreateFile(file, READ_CONTROL | WRITE_DAC, 0, NULL, OPEN_EXISTING,
|
||||
FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (hFile == INVALID_HANDLE_VALUE)
|
||||
return -1;
|
||||
ACL* pOldDACL;
|
||||
SECURITY_DESCRIPTOR* pSD = NULL;
|
||||
EXPLICIT_ACCESS ea = { 0 };
|
||||
BOOL isWellKnownSID = FALSE;
|
||||
PSID pSid = NULL;
|
||||
|
||||
GetSecurityInfo(hFile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL,
|
||||
&pOldDACL, NULL, (void**)&pSD);
|
||||
DWORD size = SECURITY_MAX_SID_SIZE;
|
||||
pSid = (PSID)tokenInfoBuffer.buffer;
|
||||
if (!CreateWellKnownSid(WinNetworkServiceSid, NULL, pSid,
|
||||
&size))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
|
||||
ea.Trustee.ptstrName = (LPTSTR)pSid;
|
||||
|
||||
ea.grfAccessMode = GRANT_ACCESS;
|
||||
ea.grfAccessPermissions = GENERIC_ALL;
|
||||
ea.grfInheritance = CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE;
|
||||
ea.Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN;
|
||||
ACL* pNewDACL = 0;
|
||||
DWORD err = SetEntriesInAcl(1, &ea, pOldDACL, &pNewDACL);
|
||||
if (pNewDACL)
|
||||
{
|
||||
SetSecurityInfo(hFile, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL,
|
||||
pNewDACL, NULL);
|
||||
}
|
||||
if (pSD != NULL)
|
||||
LocalFree((HLOCAL)pSD);
|
||||
if (pNewDACL != NULL)
|
||||
LocalFree((HLOCAL)pNewDACL);
|
||||
CloseHandle(hFile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/************************************************************************
|
||||
Copy file for backup/restore.
|
||||
@ -1034,6 +1093,10 @@ copy_file(ds_ctxt_t *datasink,
|
||||
/* close */
|
||||
msg(thread_n," ...done");
|
||||
datafile_close(&cursor);
|
||||
#ifdef _WIN32
|
||||
if (xtrabackup_copy_back || xtrabackup_move_back)
|
||||
ut_a(!fix_win_file_permissions(dstfile->path));
|
||||
#endif
|
||||
if (ds_close(dstfile)) {
|
||||
goto error_close;
|
||||
}
|
||||
@ -1104,7 +1167,10 @@ move_file(ds_ctxt_t *datasink,
|
||||
errbuf);
|
||||
return(false);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (xtrabackup_copy_back || xtrabackup_move_back)
|
||||
ut_a(!fix_win_file_permissions(dst_file_path_abs));
|
||||
#endif
|
||||
msg(thread_n," ...done");
|
||||
|
||||
return(true);
|
||||
|
@ -4162,7 +4162,7 @@ reread_log_header:
|
||||
memset(&stat_info, 0, sizeof(MY_STAT));
|
||||
dst_log_file = ds_open(ds_redo, "ib_logfile0", &stat_info);
|
||||
if (dst_log_file == NULL) {
|
||||
msg("§rror: failed to open the target stream for "
|
||||
msg("Error: failed to open the target stream for "
|
||||
"'ib_logfile0'.");
|
||||
goto fail;
|
||||
}
|
||||
@ -4914,9 +4914,9 @@ xtrabackup_apply_delta(
|
||||
/* first block of block cluster */
|
||||
offset = ((incremental_buffers * (page_size / 4))
|
||||
<< page_size_shift);
|
||||
success = os_file_read(IORequestRead, src_file,
|
||||
incremental_buffer, offset, page_size);
|
||||
if (success != DB_SUCCESS) {
|
||||
if (os_file_read(IORequestRead, src_file,
|
||||
incremental_buffer, offset, page_size)
|
||||
!= DB_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -4946,10 +4946,10 @@ xtrabackup_apply_delta(
|
||||
ut_a(last_buffer || page_in_buffer == page_size / 4);
|
||||
|
||||
/* read whole of the cluster */
|
||||
success = os_file_read(IORequestRead, src_file,
|
||||
if (os_file_read(IORequestRead, src_file,
|
||||
incremental_buffer,
|
||||
offset, page_in_buffer * page_size);
|
||||
if (success != DB_SUCCESS) {
|
||||
offset, page_in_buffer * page_size)
|
||||
!= DB_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
@ -4995,9 +4995,9 @@ xtrabackup_apply_delta(
|
||||
}
|
||||
}
|
||||
|
||||
success = os_file_write(IORequestWrite,
|
||||
dst_path, dst_file, buf, off, page_size);
|
||||
if (success != DB_SUCCESS) {
|
||||
if (os_file_write(IORequestWrite,
|
||||
dst_path, dst_file, buf, off,
|
||||
page_size) != DB_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@ -5763,7 +5763,18 @@ static bool check_all_privileges()
|
||||
PRIVILEGE_WARNING);
|
||||
}
|
||||
|
||||
return !(check_result & PRIVILEGE_ERROR);
|
||||
if (check_result & PRIVILEGE_ERROR) {
|
||||
msg("Current privileges, as reported by 'SHOW GRANTS': ");
|
||||
int n=1;
|
||||
for (std::list<std::string>::const_iterator it = granted_privileges.begin();
|
||||
it != granted_privileges.end();
|
||||
it++,n++) {
|
||||
msg(" %d.%s", n, it->c_str());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 1285dc72a043f09d9a51abcfc3a4fbfb5192067e
|
||||
Subproject commit 1dd39fb9f7418f533da05ca1156aa8f60937b7ec
|
@ -119,7 +119,6 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
|
||||
../sql/sql_sequence.cc ../sql/sql_sequence.h
|
||||
../sql/ha_sequence.cc ../sql/ha_sequence.h
|
||||
../sql/temporary_tables.cc
|
||||
../sql/session_tracker.cc
|
||||
../sql/proxy_protocol.cc ../sql/backup.cc
|
||||
../sql/sql_tvc.cc ../sql/sql_tvc.h
|
||||
../sql/opt_split.cc
|
||||
|
@ -1277,3 +1277,9 @@ END;
|
||||
$$
|
||||
ERROR 22007: Truncated incorrect CHAR(1) value: '10:20:30'
|
||||
SET sql_mode=DEFAULT;
|
||||
#
|
||||
# MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warning
|
||||
#
|
||||
SELECT CAST(11068046444225730969 AS SIGNED);
|
||||
CAST(11068046444225730969 AS SIGNED)
|
||||
-7378697629483820647
|
||||
|
@ -724,3 +724,9 @@ $$
|
||||
DELIMITER ;$$
|
||||
|
||||
SET sql_mode=DEFAULT;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-10307 CAST(11068046444225730969 AS SIGNED) does not return a warning
|
||||
--echo #
|
||||
|
||||
SELECT CAST(11068046444225730969 AS SIGNED);
|
||||
|
@ -1,4 +1,3 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (a int check (a>0));
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
@ -111,6 +110,25 @@ long_enough_name CREATE TABLE `long_enough_name` (
|
||||
CONSTRAINT `constr` CHECK (`f6` >= 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE long_enough_name;
|
||||
CREATE TABLE test.t(t int COMMENT 't_comment' CHECK(t>0));
|
||||
SHOW CREATE TABLE test.t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`t` int(11) DEFAULT NULL COMMENT 't_comment' CHECK (`t` > 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP table test.t;
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE;
|
||||
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
|
||||
CREATE TABLE test.t (f int foo=bar check(f>0));
|
||||
Warnings:
|
||||
Warning 1911 Unknown option 'foo'
|
||||
SHOW CREATE TABLE t;
|
||||
Table Create Table
|
||||
t CREATE TABLE `t` (
|
||||
`f` int(11) DEFAULT NULL `foo`=bar CHECK (`f` > 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP table test.t;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
create table t1 (a int check (a>10)) select 100 as 'a';
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
|
@ -1,10 +1,6 @@
|
||||
#
|
||||
# Testing of constraints
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int check (a>0));
|
||||
show create table t1;
|
||||
insert into t1 values (1);
|
||||
@ -104,7 +100,24 @@ SHOW CREATE TABLE long_enough_name;
|
||||
DROP TABLE long_enough_name;
|
||||
|
||||
#
|
||||
# Check that we don't loose constraints as part of CREATE ... SELECT
|
||||
# MDEV-17654 Incorrect syntax returned for column with CHECK constraint
|
||||
# in the "SHOW CREATE TABLE ..." result
|
||||
#
|
||||
|
||||
CREATE TABLE test.t(t int COMMENT 't_comment' CHECK(t>0));
|
||||
SHOW CREATE TABLE test.t;
|
||||
DROP table test.t;
|
||||
|
||||
SET @OLD_SQL_MODE=@@SQL_MODE;
|
||||
SET SQL_MODE='IGNORE_BAD_TABLE_OPTIONS';
|
||||
|
||||
CREATE TABLE test.t (f int foo=bar check(f>0));
|
||||
SHOW CREATE TABLE t;
|
||||
DROP table test.t;
|
||||
SET @@SQL_MODE=@OLD_SQL_MODE;
|
||||
|
||||
#
|
||||
# Check that we don't lose constraints as part of CREATE ... SELECT
|
||||
#
|
||||
|
||||
create table t1 (a int check (a>10)) select 100 as 'a';
|
||||
|
@ -244,7 +244,7 @@ with t as (select distinct a from t1 where b >= 'c')
|
||||
select * from t as r1, t as r2 where r1.a=r2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where
|
||||
1 PRIMARY <derived3> ref key0 key0 5 r1.a 2
|
||||
1 PRIMARY <derived3> ref key0 key0 5 r1.a 1
|
||||
3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
|
||||
explain
|
||||
@ -253,7 +253,7 @@ select * from (select distinct a from t1 where b >= 'c') as r1,
|
||||
where r1.a=r2.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 8 Using where
|
||||
1 PRIMARY <derived3> ref key0 key0 5 r1.a 2
|
||||
1 PRIMARY <derived3> ref key0 key0 5 r1.a 1
|
||||
3 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where; Using temporary
|
||||
# two references to t specified by a query
|
||||
@ -369,7 +369,7 @@ select c as a from t2 where c < 4)
|
||||
select * from t2,t where t2.c=t.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 1
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where
|
||||
3 UNION t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
@ -381,7 +381,7 @@ select c as a from t2 where c < 4) as t
|
||||
where t2.c=t.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 2
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.c 1
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using where
|
||||
3 UNION t2 ALL NULL NULL NULL NULL 4 Using where
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
|
||||
|
@ -1195,3 +1195,57 @@ drop table t1,t2,t3;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-9959: A serious MariaDB server performance bug
|
||||
#
|
||||
create table t1(a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6);
|
||||
create table t2(a int, b int,c int);
|
||||
insert into t2(a,b,c) values (1,1,2),(2,2,3),(3,1,4),(4,2,2),(5,1,1),(6,2,5);
|
||||
create table t3(a int, b int);
|
||||
insert into t3(a,b) values (1,1),(2,2),(2,1),(1,2),(5,1),(9,2);
|
||||
table "<derived2>" should have type=ref and rows=1
|
||||
one select in derived table
|
||||
with distinct
|
||||
analyze select * from t1 , ((select distinct t2.a from t2 order by c))q where t1.a=q.a;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort
|
||||
analyze select * from t1 , ((select distinct t2.a, t2.b from t2 order by c))q where t1.a=q.a;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 1.00 100.00 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using temporary; Using filesort
|
||||
# multiple selects in derived table
|
||||
# NO UNION ALL
|
||||
analyze select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 1.00 100.00 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
3 UNION t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 6.00 NULL NULL
|
||||
select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
|
||||
a a
|
||||
1 1
|
||||
2 2
|
||||
3 3
|
||||
4 4
|
||||
5 5
|
||||
6 6
|
||||
# UNION ALL and EXCEPT
|
||||
analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00 Using where
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 1 0.50 100.00 100.00
|
||||
2 DERIVED t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
3 UNION t2 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
4 EXCEPT t3 ALL NULL NULL NULL NULL 6 6.00 100.00 100.00
|
||||
NULL UNIT RESULT <unit2,3,4> ALL NULL NULL NULL NULL NULL 3.00 NULL NULL
|
||||
select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
|
||||
a a
|
||||
3 3
|
||||
4 4
|
||||
6 6
|
||||
drop table t1,t2,t3;
|
||||
|
@ -1032,3 +1032,33 @@ drop table t1,t2,t3;
|
||||
--echo #
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-9959: A serious MariaDB server performance bug
|
||||
--echo #
|
||||
|
||||
create table t1(a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6);
|
||||
create table t2(a int, b int,c int);
|
||||
insert into t2(a,b,c) values (1,1,2),(2,2,3),(3,1,4),(4,2,2),(5,1,1),(6,2,5);
|
||||
create table t3(a int, b int);
|
||||
insert into t3(a,b) values (1,1),(2,2),(2,1),(1,2),(5,1),(9,2);
|
||||
|
||||
--echo table "<derived2>" should have type=ref and rows=1
|
||||
--echo one select in derived table
|
||||
|
||||
--echo with distinct
|
||||
analyze select * from t1 , ((select distinct t2.a from t2 order by c))q where t1.a=q.a;
|
||||
analyze select * from t1 , ((select distinct t2.a, t2.b from t2 order by c))q where t1.a=q.a;
|
||||
|
||||
--echo # multiple selects in derived table
|
||||
--echo # NO UNION ALL
|
||||
analyze select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
|
||||
select * from t1 , ( (select t2.a from t2 order by c) union (select t2.a from t2 order by c))q where t1.a=q.a;
|
||||
|
||||
--echo # UNION ALL and EXCEPT
|
||||
analyze select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
|
||||
|
||||
select * from t1 , ( (select t2.a from t2 order by c) union all (select t2.a from t2 order by c) except(select t3.a from t3 order by b))q where t1.a=q.a;
|
||||
|
||||
drop table t1,t2,t3;
|
||||
|
@ -1525,7 +1525,7 @@ EXPLAIN
|
||||
SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1)
|
||||
1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 1 FirstMatch(t1)
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 6
|
||||
4 UNION t3 ALL NULL NULL NULL NULL 4
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
|
@ -23,7 +23,7 @@ SHOW GRANTS;
|
||||
Grants for ev_test@localhost
|
||||
GRANT USAGE ON *.* TO 'ev_test'@'localhost'
|
||||
GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER, DELETE VERSIONING ROWS ON `events_test2`.* TO 'ev_test'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, TRIGGER, DELETE HISTORY ON `events_test2`.* TO 'ev_test'@'localhost'
|
||||
"Here comes an error:";
|
||||
SHOW EVENTS;
|
||||
ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2'
|
||||
|
@ -1378,5 +1378,19 @@ group_concat(a,b limit ?)
|
||||
1a,1b,2x,2y
|
||||
drop table t2;
|
||||
#
|
||||
# MDEV-18943: Group Concat with limit not working with views
|
||||
#
|
||||
create table t1 (a int, b varchar(10));
|
||||
insert into t1 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
|
||||
select group_concat(a,b limit 2) from t1;
|
||||
group_concat(a,b limit 2)
|
||||
1a,1b
|
||||
create view v1 as select group_concat(a,b limit 2) from t1;
|
||||
select * from v1;
|
||||
group_concat(a,b limit 2)
|
||||
1a,1b
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -985,6 +985,18 @@ prepare STMT from 'select group_concat(a,b limit ?) from t2';
|
||||
execute STMT using @x;
|
||||
drop table t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-18943: Group Concat with limit not working with views
|
||||
--echo #
|
||||
|
||||
create table t1 (a int, b varchar(10));
|
||||
insert into t1 values(1,'a'),(1,'b'),(NULL,'c'),(2,'x'),(2,'y');
|
||||
select group_concat(a,b limit 2) from t1;
|
||||
create view v1 as select group_concat(a,b limit 2) from t1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -227,7 +227,7 @@ revoke LOCK TABLES, ALTER on mysqltest.* from mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, CREATE TEMPORARY TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `mysqltest`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION
|
||||
revoke all privileges on mysqltest.* from mysqltest_1@localhost;
|
||||
delete from mysql.user where user='mysqltest_1';
|
||||
flush privileges;
|
||||
@ -664,8 +664,8 @@ SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
|
||||
PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
|
||||
= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME PRIVILEGES
|
||||
mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
|
||||
mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
|
||||
mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE HISTORY, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
|
||||
mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE HISTORY, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR dummy@localhost;
|
||||
Grants for dummy@localhost
|
||||
@ -676,8 +676,8 @@ SELECT TABLE_SCHEMA, TABLE_NAME, GROUP_CONCAT(PRIVILEGE_TYPE ORDER BY
|
||||
PRIVILEGE_TYPE SEPARATOR ', ') AS PRIVILEGES FROM TABLE_PRIVILEGES WHERE GRANTEE
|
||||
= '\'dummy\'@\'localhost\'' GROUP BY TABLE_SCHEMA, TABLE_NAME;
|
||||
TABLE_SCHEMA TABLE_NAME PRIVILEGES
|
||||
mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
|
||||
mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE VERSIONING ROWS, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
|
||||
mysqltest dummytable ALTER, CREATE, CREATE VIEW, DELETE, DELETE HISTORY, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
|
||||
mysqltest dummyview ALTER, CREATE, CREATE VIEW, DELETE, DELETE HISTORY, DROP, INDEX, INSERT, REFERENCES, SELECT, SHOW VIEW, TRIGGER, UPDATE
|
||||
SHOW FIELDS FROM mysql.tables_priv;
|
||||
Field Type Null Key Default Extra
|
||||
Host char(60) NO PRI
|
||||
|
@ -493,7 +493,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'mysqltest_1'@'localhost' def test ALTER ROUTINE YES
|
||||
'mysqltest_1'@'localhost' def test EVENT YES
|
||||
'mysqltest_1'@'localhost' def test TRIGGER YES
|
||||
'mysqltest_1'@'localhost' def test DELETE VERSIONING ROWS YES
|
||||
'mysqltest_1'@'localhost' def test DELETE HISTORY YES
|
||||
select * from information_schema.TABLE_PRIVILEGES where grantee like '%mysqltest_1%';
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'mysqltest_1'@'localhost' def test t1 SELECT NO
|
||||
|
@ -5202,7 +5202,7 @@ SELECT * FROM (SELECT DISTINCT * FROM t1) t
|
||||
WHERE t.a IN (SELECT t2.a FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 2 End temporary
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 1 End temporary
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary
|
||||
SELECT * FROM (SELECT DISTINCT * FROM t1) t
|
||||
WHERE t.a IN (SELECT t2.a FROM t2);
|
||||
@ -5213,8 +5213,8 @@ EXPLAIN
|
||||
SELECT * FROM (SELECT DISTINCT * FROM t1) t
|
||||
WHERE t.a IN (SELECT t2.a FROM t2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 3
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join)
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; Start temporary
|
||||
1 PRIMARY <derived2> ref key0 key0 5 test.t2.a 1 End temporary
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary
|
||||
SELECT * FROM (SELECT DISTINCT * FROM t1) t
|
||||
WHERE t.a IN (SELECT t2.a FROM t2);
|
||||
|
@ -413,7 +413,7 @@ EXPLAIN
|
||||
SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 2 FirstMatch(t1)
|
||||
1 PRIMARY <derived3> ref key0 key0 10 test.t1.a,test.t1.b 1 FirstMatch(t1)
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 6
|
||||
4 UNION t3 ALL NULL NULL NULL NULL 4
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
|
@ -415,7 +415,7 @@ EXPLAIN
|
||||
SELECT a FROM t1 WHERE (a,b) IN (SELECT * FROM v2);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 10 func,func 2 Using where
|
||||
2 DEPENDENT SUBQUERY <derived3> index_subquery key0 key0 10 func,func 1 Using where
|
||||
3 DERIVED t2 ALL NULL NULL NULL NULL 6
|
||||
4 UNION t3 ALL NULL NULL NULL NULL 4
|
||||
NULL UNION RESULT <union3,4> ALL NULL NULL NULL NULL NULL
|
||||
|
@ -1964,7 +1964,7 @@ ERROR HY000: Can't update table 't2' in stored function/trigger because it is al
|
||||
DROP TABLE t1;
|
||||
DROP TRIGGER t_insert;
|
||||
DROP TABLE t2;
|
||||
End of 5.0 tests
|
||||
# End of 5.0 tests
|
||||
drop table if exists table_25411_a;
|
||||
drop table if exists table_25411_b;
|
||||
create table table_25411_a(a int);
|
||||
@ -2135,7 +2135,7 @@ b
|
||||
# Work around Bug#45235
|
||||
DROP DATABASE db1;
|
||||
USE test;
|
||||
End of 5.1 tests.
|
||||
# End of 5.1 tests.
|
||||
create table t1 (i int);
|
||||
create table t2 (i int);
|
||||
flush tables;
|
||||
@ -2154,7 +2154,7 @@ select * from t2;
|
||||
i
|
||||
2
|
||||
drop table t1,t2;
|
||||
End of 5.2 tests.
|
||||
# End of 5.2 tests.
|
||||
#
|
||||
# Bug#34453 Can't change size of file (Errcode: 1224)
|
||||
#
|
||||
@ -2257,7 +2257,7 @@ c
|
||||
aaa
|
||||
DROP TABLE t1;
|
||||
|
||||
End of 5.5 tests.
|
||||
# End of 5.5 tests.
|
||||
#
|
||||
# BUG #910083: materialized subquery in a trigger
|
||||
#
|
||||
@ -2304,7 +2304,7 @@ b
|
||||
SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TRIGGER tr;
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.3 tests.
|
||||
# End of 5.3 tests.
|
||||
set time_zone="+00:00";
|
||||
SET TIMESTAMP=UNIX_TIMESTAMP('2001-01-01 10:20:30');
|
||||
SET @@session.sql_mode = 'STRICT_ALL_TABLES,STRICT_TRANS_TABLES';
|
||||
@ -2411,7 +2411,24 @@ AFTER UPDATE ON t1 FOR EACH ROW SELECT (SELECT b FROM t2) INTO @x;
|
||||
# Running 20000 queries
|
||||
DROP TABLE t1,t2;
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
# MDEV-19188 Server Crash When Using a Trigger With A Number of Virtual Columns on INSERT/UPDATE
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
virt1 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt2 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt3 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt4 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt5 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt6 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt7 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt8 INT GENERATED ALWAYS AS (0) VIRTUAL
|
||||
);
|
||||
INSERT INTO t1 () VALUES ();
|
||||
CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
|
||||
INSERT INTO t1 () VALUES ();
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# MDEV-12461 TYPE OF and ROW TYPE OF anchored data types
|
||||
@ -2430,3 +2447,6 @@ SELECT * FROM t1;
|
||||
a b total
|
||||
10 20 30
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
@ -2184,7 +2184,7 @@ DROP TABLE t1;
|
||||
DROP TRIGGER t_insert;
|
||||
DROP TABLE t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
--echo # End of 5.0 tests
|
||||
|
||||
#
|
||||
# Bug#25411 (trigger code truncated)
|
||||
@ -2406,7 +2406,7 @@ let $MYSQLD_DATADIR = `select @@datadir`;
|
||||
DROP DATABASE db1;
|
||||
USE test;
|
||||
|
||||
--echo End of 5.1 tests.
|
||||
--echo # End of 5.1 tests.
|
||||
|
||||
#
|
||||
# Test that using a trigger will not open mysql.proc
|
||||
@ -2430,7 +2430,7 @@ select * from t1;
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
--echo End of 5.2 tests.
|
||||
--echo # End of 5.2 tests.
|
||||
|
||||
--echo #
|
||||
--echo # Bug#34453 Can't change size of file (Errcode: 1224)
|
||||
@ -2574,7 +2574,7 @@ SELECT c FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo
|
||||
--echo End of 5.5 tests.
|
||||
--echo # End of 5.5 tests.
|
||||
|
||||
--echo #
|
||||
--echo # BUG #910083: materialized subquery in a trigger
|
||||
@ -2613,7 +2613,7 @@ SET optimizer_switch=@save_optimizer_switch;
|
||||
DROP TRIGGER tr;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.3 tests.
|
||||
--echo # End of 5.3 tests.
|
||||
|
||||
#
|
||||
# MDEV-4829 BEFORE INSERT triggers dont issue 1406 error
|
||||
@ -2737,9 +2737,27 @@ while ($n)
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-19188 Server Crash When Using a Trigger With A Number of Virtual Columns on INSERT/UPDATE
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (
|
||||
virt1 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt2 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt3 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt4 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt5 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt6 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt7 INT GENERATED ALWAYS AS (0) VIRTUAL,
|
||||
virt8 INT GENERATED ALWAYS AS (0) VIRTUAL
|
||||
);
|
||||
INSERT INTO t1 () VALUES ();
|
||||
CREATE TRIGGER t1_trigger BEFORE INSERT ON t1 FOR EACH ROW BEGIN END;
|
||||
INSERT INTO t1 () VALUES ();
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
@ -2760,3 +2778,7 @@ DELIMITER ;$$
|
||||
INSERT INTO t1 (a,b) VALUES (10, 20);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
@ -39,10 +39,6 @@ NAME ENCRYPTION_SCHEME CURRENT_KEY_ID
|
||||
enctests/t7 0 1
|
||||
enctests/t8 0 1
|
||||
enctests/t9 0 1
|
||||
SET GLOBAL innodb_encrypt_tables=OFF;
|
||||
ERROR 42000: Variable 'innodb_encrypt_tables' can't be set to the value of 'OFF'
|
||||
SET GLOBAL innodb_encrypt_tables=ON;
|
||||
ERROR 42000: Variable 'innodb_encrypt_tables' can't be set to the value of 'ON'
|
||||
# t1 default on expecting NOT FOUND
|
||||
NOT FOUND /secred/ in t1.ibd
|
||||
# t2 default on expecting NOT FOUND
|
||||
|
@ -0,0 +1,80 @@
|
||||
CREATE TABLE t1 (f1 INT, f2 VARCHAR(256))engine=innodb;
|
||||
INSERT INTO t1 VALUES(1, 'MariaDB'), (2, 'Robot'), (3, 'Science');
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
CREATE TABLE t2(f1 INT, f2 VARCHAR(256))engine=innodb;
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
CREATE TABLE t3(f1 INT, f2 VARCHAR(256))engine=innodb encrypted=yes;
|
||||
INSERT INTO t3 SELECT * FROM t1;
|
||||
# Restart the server with encryption
|
||||
# Wait until encryption threads have encrypted all tablespaces
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
NAME
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
NAME
|
||||
innodb_system
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/transaction_registry
|
||||
test/t1
|
||||
test/t2
|
||||
test/t3
|
||||
# Restart the server with innodb_encryption_rotate_key_age= 0
|
||||
create table t4 (f1 int not null)engine=innodb encrypted=NO;
|
||||
# Wait until encryption threads have encrypted all tablespaces
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
NAME
|
||||
test/t4
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
NAME
|
||||
innodb_system
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/transaction_registry
|
||||
test/t1
|
||||
test/t2
|
||||
test/t3
|
||||
# Disable encryption when innodb_encryption_rotate_key_age is 0
|
||||
set global innodb_encrypt_tables = OFF;
|
||||
# Wait until encryption threads to decrypt all unencrypted tablespaces
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
NAME
|
||||
innodb_system
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/transaction_registry
|
||||
test/t1
|
||||
test/t2
|
||||
test/t4
|
||||
# Display only encrypted create tables (t3)
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
NAME
|
||||
test/t3
|
||||
# Enable encryption when innodb_encryption_rotate_key_age is 0
|
||||
set global innodb_encrypt_tables = ON;
|
||||
# Wait until encryption threads to encrypt all unencrypted tablespaces
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
NAME
|
||||
test/t4
|
||||
# Display only unencrypted create tables (t4)
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
NAME
|
||||
innodb_system
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/transaction_registry
|
||||
test/t1
|
||||
test/t2
|
||||
test/t3
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
NAME
|
||||
test/t4
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
NAME
|
||||
innodb_system
|
||||
mysql/innodb_index_stats
|
||||
mysql/innodb_table_stats
|
||||
mysql/transaction_registry
|
||||
test/t1
|
||||
test/t2
|
||||
test/t3
|
||||
DROP TABLE t4, t3, t2, t1;
|
@ -38,11 +38,6 @@ SELECT NAME,ENCRYPTION_SCHEME,CURRENT_KEY_ID FROM INFORMATION_SCHEMA.INNODB_TABL
|
||||
--echo # should list tables t7-t9
|
||||
SELECT NAME,ENCRYPTION_SCHEME,CURRENT_KEY_ID FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 and NAME LIKE 'enctests%';
|
||||
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET GLOBAL innodb_encrypt_tables=OFF;
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
SET GLOBAL innodb_encrypt_tables=ON;
|
||||
|
||||
--let $MYSQLD_DATADIR=`select @@datadir`
|
||||
|
||||
-- source include/shutdown_mysqld.inc
|
||||
|
@ -0,0 +1,2 @@
|
||||
--innodb-tablespaces-encryption
|
||||
--innodb_encrypt_tables=ON
|
@ -0,0 +1,83 @@
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/not_embedded.inc
|
||||
-- source include/have_example_key_management_plugin.inc
|
||||
|
||||
CREATE TABLE t1 (f1 INT, f2 VARCHAR(256))engine=innodb;
|
||||
INSERT INTO t1 VALUES(1, 'MariaDB'), (2, 'Robot'), (3, 'Science');
|
||||
INSERT INTO t1 SELECT * FROM t1;
|
||||
|
||||
CREATE TABLE t2(f1 INT, f2 VARCHAR(256))engine=innodb;
|
||||
INSERT INTO t2 SELECT * FROM t1;
|
||||
|
||||
CREATE TABLE t3(f1 INT, f2 VARCHAR(256))engine=innodb encrypted=yes;
|
||||
INSERT INTO t3 SELECT * FROM t1;
|
||||
|
||||
--echo # Restart the server with encryption
|
||||
|
||||
let $restart_noprint=2;
|
||||
let $restart_parameters= --innodb_encryption_threads=5 --innodb_encryption_rotate_key_age=16384;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
--echo # Wait until encryption threads have encrypted all tablespaces
|
||||
|
||||
--let $tables_count= `select count(*) + 1 from information_schema.tables where engine = 'InnoDB'`
|
||||
--let $wait_timeout= 600
|
||||
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
|
||||
--echo # Restart the server with innodb_encryption_rotate_key_age= 0
|
||||
|
||||
let $restart_parameters= --innodb_encryption_threads=1 --innodb_encryption_rotate_key_age=0;
|
||||
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
create table t4 (f1 int not null)engine=innodb encrypted=NO;
|
||||
|
||||
--echo # Wait until encryption threads have encrypted all tablespaces
|
||||
|
||||
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
|
||||
--let $wait_timeout= 600
|
||||
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
|
||||
--echo # Disable encryption when innodb_encryption_rotate_key_age is 0
|
||||
set global innodb_encrypt_tables = OFF;
|
||||
|
||||
--echo # Wait until encryption threads to decrypt all unencrypted tablespaces
|
||||
|
||||
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
|
||||
--let $wait_timeout= 600
|
||||
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND ROTATING_OR_FLUSHING = 0;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
--echo # Display only encrypted create tables (t3)
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
|
||||
--echo # Enable encryption when innodb_encryption_rotate_key_age is 0
|
||||
set global innodb_encrypt_tables = ON;
|
||||
|
||||
--echo # Wait until encryption threads to encrypt all unencrypted tablespaces
|
||||
|
||||
--let $tables_count= `select count(*) from information_schema.tables where engine = 'InnoDB'`
|
||||
--let $wait_timeout= 600
|
||||
--let $wait_condition=SELECT COUNT(*) >= $tables_count FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
--echo # Display only unencrypted create tables (t4)
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
|
||||
--let $restart_parameters=
|
||||
-- source include/restart_mysqld.inc
|
||||
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0;
|
||||
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0;
|
||||
DROP TABLE t4, t3, t2, t1;
|
@ -78,7 +78,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke TRIGGER on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
|
||||
@ -168,7 +168,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke UPDATE on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
@ -183,7 +183,7 @@ test_noprivs@localhost
|
||||
use priv_db;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
@ -248,7 +248,7 @@ connection no_privs_424b;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4b_1 before UPDATE on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1b';
|
||||
@ -329,7 +329,7 @@ connection no_privs_424c;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4c_1 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1c';
|
||||
@ -441,7 +441,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke SELECT on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
@ -457,7 +457,7 @@ test_noprivs@localhost
|
||||
use priv_db;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
create trigger trg5a_1 before INSERT on t1 for each row
|
||||
set @test_var = new.f1;
|
||||
connection default;
|
||||
@ -503,7 +503,7 @@ revoke SELECT on priv_db.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.* to test_yesprivs@localhost;
|
||||
@ -518,7 +518,7 @@ connection no_privs_425b;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5b_1 before UPDATE on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
@ -565,7 +565,7 @@ revoke SELECT on priv_db.t1 from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
|
||||
@ -580,7 +580,7 @@ connection no_privs_425c;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5c_1 before INSERT on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
|
@ -603,7 +603,7 @@ trig 1_1-yes
|
||||
revoke TRIGGER on *.* from test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
disconnect yes_privs;
|
||||
connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
|
||||
select current_user;
|
||||
@ -656,7 +656,7 @@ root@localhost
|
||||
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
|
||||
|
||||
trigger privilege on db level for create:
|
||||
@ -929,7 +929,7 @@ grant TRIGGER on priv1_db.t1 to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE VERSIONING ROWS ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE HISTORY ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
|
||||
|
@ -140,7 +140,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'testuser3'@'localhost' def db_datadict CREATE TEMPORARY TABLES NO
|
||||
'testuser3'@'localhost' def db_datadict CREATE VIEW NO
|
||||
'testuser3'@'localhost' def db_datadict DELETE NO
|
||||
'testuser3'@'localhost' def db_datadict DELETE VERSIONING ROWS NO
|
||||
'testuser3'@'localhost' def db_datadict DELETE HISTORY NO
|
||||
'testuser3'@'localhost' def db_datadict DROP NO
|
||||
'testuser3'@'localhost' def db_datadict EVENT NO
|
||||
'testuser3'@'localhost' def db_datadict EXECUTE NO
|
||||
|
@ -68,7 +68,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE
|
||||
''@'%' def test CREATE ROUTINE
|
||||
''@'%' def test EVENT
|
||||
''@'%' def test TRIGGER
|
||||
''@'%' def test DELETE VERSIONING ROWS
|
||||
''@'%' def test DELETE HISTORY
|
||||
''@'%' def test\_% SELECT
|
||||
''@'%' def test\_% INSERT
|
||||
''@'%' def test\_% UPDATE
|
||||
@ -85,7 +85,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE
|
||||
''@'%' def test\_% CREATE ROUTINE
|
||||
''@'%' def test\_% EVENT
|
||||
''@'%' def test\_% TRIGGER
|
||||
''@'%' def test\_% DELETE VERSIONING ROWS
|
||||
''@'%' def test\_% DELETE HISTORY
|
||||
###############################################################################
|
||||
# Testcase 3.2.15.2-3.2.15.4 INFORMATION_SCHEMA.SCHEMA_PRIVILEGES accessibility
|
||||
###############################################################################
|
||||
|
@ -16,7 +16,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA PRIVILEGE_TYPE IS_GRANTABLE
|
||||
''@'%' def test CREATE TEMPORARY TABLES NO
|
||||
''@'%' def test CREATE VIEW NO
|
||||
''@'%' def test DELETE NO
|
||||
''@'%' def test DELETE VERSIONING ROWS NO
|
||||
''@'%' def test DELETE HISTORY NO
|
||||
''@'%' def test DROP NO
|
||||
''@'%' def test EVENT NO
|
||||
''@'%' def test INDEX NO
|
||||
|
@ -96,7 +96,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'testuser2'@'localhost' def db_datadict tb1 CREATE YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 CREATE VIEW YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 DELETE YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 DELETE VERSIONING ROWS YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 DELETE HISTORY YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 DROP YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 INDEX YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 INSERT YES
|
||||
@ -132,7 +132,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'testuser2'@'localhost' def db_datadict tb1 CREATE YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 CREATE VIEW YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 DELETE YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 DELETE VERSIONING ROWS YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 DELETE HISTORY YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 DROP YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 INDEX YES
|
||||
'testuser2'@'localhost' def db_datadict tb1 INSERT YES
|
||||
@ -186,7 +186,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'testuser1'@'localhost' def test t1_table CREATE NO
|
||||
'testuser1'@'localhost' def test t1_table CREATE VIEW NO
|
||||
'testuser1'@'localhost' def test t1_table DELETE NO
|
||||
'testuser1'@'localhost' def test t1_table DELETE VERSIONING ROWS NO
|
||||
'testuser1'@'localhost' def test t1_table DELETE HISTORY NO
|
||||
'testuser1'@'localhost' def test t1_table DROP NO
|
||||
'testuser1'@'localhost' def test t1_table INDEX NO
|
||||
'testuser1'@'localhost' def test t1_table INSERT NO
|
||||
@ -199,7 +199,7 @@ GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'testuser1'@'localhost' def test t1_view CREATE NO
|
||||
'testuser1'@'localhost' def test t1_view CREATE VIEW NO
|
||||
'testuser1'@'localhost' def test t1_view DELETE NO
|
||||
'testuser1'@'localhost' def test t1_view DELETE VERSIONING ROWS NO
|
||||
'testuser1'@'localhost' def test t1_view DELETE HISTORY NO
|
||||
'testuser1'@'localhost' def test t1_view DROP NO
|
||||
'testuser1'@'localhost' def test t1_view INDEX NO
|
||||
'testuser1'@'localhost' def test t1_view INSERT NO
|
||||
|
@ -145,7 +145,7 @@ connect testuser2, localhost, testuser2, , db_datadict;
|
||||
SHOW GRANTS FOR 'testuser2'@'localhost';
|
||||
Grants for testuser2@localhost
|
||||
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, DELETE VERSIONING ROWS ON `db_datadict`.`t1` TO 'testuser2'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, DELETE HISTORY ON `db_datadict`.`t1` TO 'testuser2'@'localhost'
|
||||
# No TRIGGER Privilege --> no result for query
|
||||
SELECT * FROM information_schema.triggers
|
||||
WHERE trigger_name = 'trg1';
|
||||
|
@ -78,7 +78,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke TRIGGER on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
|
||||
@ -168,7 +168,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke UPDATE on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
@ -183,7 +183,7 @@ test_noprivs@localhost
|
||||
use priv_db;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
@ -248,7 +248,7 @@ connection no_privs_424b;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4b_1 before UPDATE on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1b';
|
||||
@ -329,7 +329,7 @@ connection no_privs_424c;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4c_1 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1c';
|
||||
@ -441,7 +441,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke SELECT on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
@ -457,7 +457,7 @@ test_noprivs@localhost
|
||||
use priv_db;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
create trigger trg5a_1 before INSERT on t1 for each row
|
||||
set @test_var = new.f1;
|
||||
connection default;
|
||||
@ -503,7 +503,7 @@ revoke SELECT on priv_db.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.* to test_yesprivs@localhost;
|
||||
@ -518,7 +518,7 @@ connection no_privs_425b;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5b_1 before UPDATE on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
@ -565,7 +565,7 @@ revoke SELECT on priv_db.t1 from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
|
||||
@ -580,7 +580,7 @@ connection no_privs_425c;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5c_1 before INSERT on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
|
@ -604,7 +604,7 @@ trig 1_1-yes
|
||||
revoke TRIGGER on *.* from test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
disconnect yes_privs;
|
||||
connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
|
||||
select current_user;
|
||||
@ -657,7 +657,7 @@ root@localhost
|
||||
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
|
||||
|
||||
trigger privilege on db level for create:
|
||||
@ -930,7 +930,7 @@ grant TRIGGER on priv1_db.t1 to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE VERSIONING ROWS ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE HISTORY ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
|
||||
|
@ -78,7 +78,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke TRIGGER on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
|
||||
@ -168,7 +168,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke UPDATE on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER, UPDATE on *.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
@ -183,7 +183,7 @@ test_noprivs@localhost
|
||||
use priv_db;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
select f1 from t1 order by f1;
|
||||
f1
|
||||
insert 3.5.3.2-no
|
||||
@ -248,7 +248,7 @@ connection no_privs_424b;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT USAGE ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4b_1 before UPDATE on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1b';
|
||||
@ -329,7 +329,7 @@ connection no_privs_424c;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg4c_1 before INSERT on t1 for each row
|
||||
set new.f1 = 'trig 3.5.3.7-1c';
|
||||
@ -441,7 +441,7 @@ grant ALL on *.* to test_noprivs@localhost;
|
||||
revoke SELECT on *.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER, SELECT on *.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
@ -457,7 +457,7 @@ test_noprivs@localhost
|
||||
use priv_db;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
create trigger trg5a_1 before INSERT on t1 for each row
|
||||
set @test_var = new.f1;
|
||||
connection default;
|
||||
@ -503,7 +503,7 @@ revoke SELECT on priv_db.* from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.* to test_yesprivs@localhost;
|
||||
@ -518,7 +518,7 @@ connection no_privs_425b;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, TRIGGER, DELETE HISTORY ON `priv_db`.* TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5b_1 before UPDATE on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
@ -565,7 +565,7 @@ revoke SELECT on priv_db.t1 from test_noprivs@localhost;
|
||||
show grants for test_noprivs@localhost;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
revoke ALL PRIVILEGES, GRANT OPTION FROM test_yesprivs@localhost;
|
||||
grant TRIGGER on *.* to test_yesprivs@localhost;
|
||||
grant SELECT on priv_db.t1 to test_yesprivs@localhost;
|
||||
@ -580,7 +580,7 @@ connection no_privs_425c;
|
||||
show grants;
|
||||
Grants for test_noprivs@localhost
|
||||
GRANT TRIGGER ON *.* TO 'test_noprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE VERSIONING ROWS ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
GRANT INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER, DELETE HISTORY ON `priv_db`.`t1` TO 'test_noprivs'@'localhost'
|
||||
use priv_db;
|
||||
create trigger trg5c_1 before INSERT on t1 for each row
|
||||
set @test_var= new.f1;
|
||||
|
@ -604,7 +604,7 @@ trig 1_1-yes
|
||||
revoke TRIGGER on *.* from test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
disconnect yes_privs;
|
||||
connect yes_privs,localhost,test_yesprivs,PWD,test,$MASTER_MYPORT,$MASTER_MYSOCK;
|
||||
select current_user;
|
||||
@ -657,7 +657,7 @@ root@localhost
|
||||
grant TRIGGER on priv_db.* to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE VERSIONING ROWS ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, CREATE TABLESPACE, DELETE HISTORY ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT TRIGGER ON `priv_db`.* TO 'test_yesprivs'@'localhost'
|
||||
|
||||
trigger privilege on db level for create:
|
||||
@ -930,7 +930,7 @@ grant TRIGGER on priv1_db.t1 to test_yesprivs@localhost;
|
||||
show grants for test_yesprivs@localhost;
|
||||
Grants for test_yesprivs@localhost
|
||||
GRANT USAGE ON *.* TO 'test_yesprivs'@'localhost' IDENTIFIED BY PASSWORD '*C49735D016A099C0CF104EF9183F374A54CA2576'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE VERSIONING ROWS ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EVENT, DELETE HISTORY ON `priv1_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT SELECT, UPDATE ON `priv2_db`.* TO 'test_yesprivs'@'localhost'
|
||||
GRANT TRIGGER ON `priv1_db`.`t1` TO 'test_yesprivs'@'localhost'
|
||||
|
||||
|
27
mysql-test/suite/innodb/r/page_reorganize.result
Normal file
27
mysql-test/suite/innodb/r/page_reorganize.result
Normal file
@ -0,0 +1,27 @@
|
||||
#
|
||||
# Bug# 20005279 ASSERT !OTHER_LOCK, LOCK_MOVE_REORGANIZE_PAGE()
|
||||
#
|
||||
create table t1 (f1 int auto_increment primary key,
|
||||
f2 char(255)) engine=innodb;
|
||||
start transaction;
|
||||
commit;
|
||||
start transaction;
|
||||
select f1, f2 from t1 where f1 = 20 for update;
|
||||
f1 f2
|
||||
20 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
connect con1,localhost,root,,;
|
||||
select f1 from t1 where f1 = 20 for update;
|
||||
connection default;
|
||||
SET @save_dbug = @@debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,do_page_reorganize,do_lock_reverse_page_reorganize';
|
||||
insert into t1(f2) values (repeat('+', 100));
|
||||
SET DEBUG = @save_dbug;
|
||||
Warnings:
|
||||
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
|
||||
commit;
|
||||
connection con1;
|
||||
f1
|
||||
20
|
||||
disconnect con1;
|
||||
connection default;
|
||||
drop table t1;
|
56
mysql-test/suite/innodb/t/page_reorganize.test
Normal file
56
mysql-test/suite/innodb/t/page_reorganize.test
Normal file
@ -0,0 +1,56 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/have_innodb_16k.inc
|
||||
--source include/have_debug.inc
|
||||
|
||||
--source include/count_sessions.inc
|
||||
|
||||
--echo #
|
||||
--echo # Bug# 20005279 ASSERT !OTHER_LOCK, LOCK_MOVE_REORGANIZE_PAGE()
|
||||
--echo #
|
||||
|
||||
create table t1 (f1 int auto_increment primary key,
|
||||
f2 char(255)) engine=innodb;
|
||||
|
||||
let $inc = 50;
|
||||
|
||||
start transaction;
|
||||
--disable_query_log
|
||||
|
||||
while ($inc)
|
||||
{
|
||||
insert into t1(f2) values (repeat('~', 50));
|
||||
dec $inc;
|
||||
}
|
||||
|
||||
--enable_query_log
|
||||
commit;
|
||||
|
||||
start transaction;
|
||||
select f1, f2 from t1 where f1 = 20 for update;
|
||||
|
||||
connect (con1,localhost,root,,);
|
||||
--send
|
||||
select f1 from t1 where f1 = 20 for update;
|
||||
|
||||
connection default;
|
||||
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where INFO = 'select f1 from t1 where f1 = 20 for update';
|
||||
|
||||
--source include/wait_condition.inc
|
||||
|
||||
SET @save_dbug = @@debug_dbug;
|
||||
SET DEBUG_DBUG = '+d,do_page_reorganize,do_lock_reverse_page_reorganize';
|
||||
insert into t1(f2) values (repeat('+', 100));
|
||||
SET DEBUG = @save_dbug;
|
||||
commit;
|
||||
|
||||
connection con1;
|
||||
reap;
|
||||
disconnect con1;
|
||||
connection default;
|
||||
|
||||
drop table t1;
|
||||
|
||||
--source include/wait_until_count_sessions.inc
|
@ -43,10 +43,12 @@ Copyright (c) YEAR, YEAR , Oracle, MariaDB Corporation Ab and others.
|
||||
|
||||
InnoDB offline file checksum utility.
|
||||
Usage: innochecksum [-c] [-s <start page>] [-e <end page>] [-p <page>] [-i] [-v] [-a <allow mismatches>] [-n] [-C <strict-check>] [-w <write>] [-S] [-D <page type dump>] [-l <log>] [-l] [-m <merge pages>] <filename or [-]>
|
||||
See https://mariadb.com/kb/en/library/innochecksum/ for usage hints.
|
||||
-?, --help Displays this help and exits.
|
||||
-I, --info Synonym for --help.
|
||||
-V, --version Displays version information and exits.
|
||||
-v, --verbose Verbose (prints progress every 5 seconds).
|
||||
https://mariadb.com/kb/en/library/creating-a-trace-file/
|
||||
-c, --count Print the count of pages in the file and exits.
|
||||
-s, --start-page=# Start on this page number (0 based).
|
||||
-e, --end-page=# End at this page number (0 based).
|
||||
|
@ -1,5 +1,6 @@
|
||||
CREATE user backup@localhost;
|
||||
FOUND 1 /missing required privilege RELOAD/ in backup.log
|
||||
FOUND 1 /missing required privilege PROCESS/ in backup.log
|
||||
FOUND 1 /GRANT USAGE ON/ in backup.log
|
||||
GRANT RELOAD, PROCESS on *.* to backup@localhost;
|
||||
DROP USER backup@localhost;
|
||||
|
@ -18,7 +18,8 @@ let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/backup.log;
|
||||
--source include/search_pattern_in_file.inc
|
||||
--let SEARCH_PATTERN= missing required privilege PROCESS
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--let SEARCH_PATTERN= GRANT USAGE ON
|
||||
--source include/search_pattern_in_file.inc
|
||||
# backup succeeds with RELOAD privilege
|
||||
GRANT RELOAD, PROCESS on *.* to backup@localhost;
|
||||
--disable_result_log
|
||||
|
@ -21,6 +21,16 @@ set global server_audit_incl_users=null;
|
||||
set global server_audit_file_path='server_audit.log';
|
||||
set global server_audit_output_type=file;
|
||||
set global server_audit_logging=on;
|
||||
set global server_audit_incl_users= repeat("'root',", 10000);
|
||||
ERROR 42000: Variable 'server_audit_incl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','roo'
|
||||
show variables like 'server_audit_incl_users';
|
||||
Variable_name Value
|
||||
server_audit_incl_users
|
||||
set global server_audit_excl_users= repeat("'root',", 10000);
|
||||
ERROR 42000: Variable 'server_audit_excl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','roo'
|
||||
show variables like 'server_audit_excl_users';
|
||||
Variable_name Value
|
||||
server_audit_excl_users
|
||||
connect con1,localhost,root,,mysql;
|
||||
connection default;
|
||||
disconnect con1;
|
||||
@ -202,6 +212,8 @@ select 2;
|
||||
2
|
||||
2
|
||||
drop table t1;
|
||||
set global server_audit_logging= off;
|
||||
set global server_audit_logging= on;
|
||||
set global server_audit_events='';
|
||||
set global server_audit_query_log_limit= 15;
|
||||
select (1), (2), (3), (4);
|
||||
@ -251,6 +263,10 @@ uninstall plugin server_audit;
|
||||
Warnings:
|
||||
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_logging=on',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_incl_users= repeat("\'root\',", 10000)',ID
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit_incl_users\'',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_excl_users= repeat("\'root\',", 10000)',ID
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'show variables like \'server_audit_excl_users\'',0
|
||||
TIME,HOSTNAME,root,localhost,ID,0,CONNECT,mysql,,0
|
||||
TIME,HOSTNAME,root,localhost,ID,0,DISCONNECT,mysql,,0
|
||||
TIME,HOSTNAME,no_such_user,localhost,ID,0,FAILED_CONNECT,,,ID
|
||||
@ -376,6 +392,7 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= off',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
|
||||
|
@ -13,6 +13,14 @@ set global server_audit_incl_users=null;
|
||||
set global server_audit_file_path='server_audit.log';
|
||||
set global server_audit_output_type=file;
|
||||
set global server_audit_logging=on;
|
||||
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global server_audit_incl_users= repeat("'root',", 10000);
|
||||
show variables like 'server_audit_incl_users';
|
||||
--error ER_WRONG_VALUE_FOR_VAR
|
||||
set global server_audit_excl_users= repeat("'root',", 10000);
|
||||
show variables like 'server_audit_excl_users';
|
||||
|
||||
--sleep 2
|
||||
connect (con1,localhost,root,,mysql);
|
||||
connection default;
|
||||
@ -128,6 +136,9 @@ select * from t1;
|
||||
select 2;
|
||||
drop table t1;
|
||||
|
||||
set global server_audit_logging= off;
|
||||
set global server_audit_logging= on;
|
||||
|
||||
set global server_audit_events='';
|
||||
|
||||
set global server_audit_query_log_limit= 15;
|
||||
|
@ -11,7 +11,7 @@ show grants;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
delete history from mysqltest.t before system_time now();
|
||||
ERROR 42000: DELETE VERSIONING ROWS command denied to user 'mysqltest_1'@'localhost' for table 't'
|
||||
ERROR 42000: DELETE HISTORY command denied to user 'mysqltest_1'@'localhost' for table 't'
|
||||
connection root;
|
||||
grant delete history on mysqltest.* to mysqltest_1@localhost;
|
||||
grant delete history on mysqltest.t to mysqltest_1@localhost;
|
||||
@ -19,15 +19,15 @@ connection user1;
|
||||
show grants;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT DELETE VERSIONING ROWS ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT DELETE VERSIONING ROWS ON `mysqltest`.`t` TO 'mysqltest_1'@'localhost'
|
||||
GRANT DELETE HISTORY ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT DELETE HISTORY ON `mysqltest`.`t` TO 'mysqltest_1'@'localhost'
|
||||
delete history from mysqltest.t before system_time now();
|
||||
connection root;
|
||||
grant all on *.* to mysqltest_1@localhost;
|
||||
show grants for mysqltest_1@localhost;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT DELETE VERSIONING ROWS ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT DELETE VERSIONING ROWS ON `mysqltest`.`t` TO 'mysqltest_1'@'localhost'
|
||||
GRANT DELETE HISTORY ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT DELETE HISTORY ON `mysqltest`.`t` TO 'mysqltest_1'@'localhost'
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database mysqltest;
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
#define PLUGIN_VERSION 0x104
|
||||
#define PLUGIN_STR_VERSION "1.4.4"
|
||||
#define PLUGIN_STR_VERSION "1.4.5"
|
||||
|
||||
#define _my_thread_var loc_thread_var
|
||||
|
||||
@ -333,6 +333,10 @@ static void update_file_rotations(MYSQL_THD thd, struct st_mysql_sys_var *var,
|
||||
void *var_ptr, const void *save);
|
||||
static void update_incl_users(MYSQL_THD thd, struct st_mysql_sys_var *var,
|
||||
void *var_ptr, const void *save);
|
||||
static int check_incl_users(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
|
||||
struct st_mysql_value *value);
|
||||
static int check_excl_users(MYSQL_THD thd, struct st_mysql_sys_var *var, void *save,
|
||||
struct st_mysql_value *value);
|
||||
static void update_excl_users(MYSQL_THD thd, struct st_mysql_sys_var *var,
|
||||
void *var_ptr, const void *save);
|
||||
static void update_output_type(MYSQL_THD thd, struct st_mysql_sys_var *var,
|
||||
@ -352,10 +356,10 @@ static void rotate_log(MYSQL_THD thd, struct st_mysql_sys_var *var,
|
||||
|
||||
static MYSQL_SYSVAR_STR(incl_users, incl_users, PLUGIN_VAR_RQCMDARG,
|
||||
"Comma separated list of users to monitor.",
|
||||
NULL, update_incl_users, NULL);
|
||||
check_incl_users, update_incl_users, NULL);
|
||||
static MYSQL_SYSVAR_STR(excl_users, excl_users, PLUGIN_VAR_RQCMDARG,
|
||||
"Comma separated list of users to exclude from auditing.",
|
||||
NULL, update_excl_users, NULL);
|
||||
check_excl_users, update_excl_users, NULL);
|
||||
/* bits in the event filter. */
|
||||
#define EVENT_CONNECT 1
|
||||
#define EVENT_QUERY_ALL 2
|
||||
@ -1621,7 +1625,7 @@ static int log_statement_ex(const struct connection_info *cn,
|
||||
}
|
||||
|
||||
if (query && !(events & EVENT_QUERY_ALL) &&
|
||||
(events & EVENT_QUERY))
|
||||
(events & EVENT_QUERY && !cn->log_always))
|
||||
{
|
||||
const char *orig_query= query;
|
||||
|
||||
@ -2555,9 +2559,10 @@ static void log_current_query(MYSQL_THD thd)
|
||||
if (!ci_needs_setup(cn) && cn->query_length &&
|
||||
FILTER(EVENT_QUERY) && do_log_user(cn->user))
|
||||
{
|
||||
cn->log_always= 1;
|
||||
log_statement_ex(cn, cn->query_time, thd_get_thread_id(thd),
|
||||
cn->query, cn->query_length, 0, "QUERY");
|
||||
cn->log_always= 1;
|
||||
cn->log_always= 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2646,16 +2651,56 @@ static void update_file_rotate_size(MYSQL_THD thd __attribute__((unused)),
|
||||
}
|
||||
|
||||
|
||||
static int check_users(void *save, struct st_mysql_value *value,
|
||||
size_t s, const char *name)
|
||||
{
|
||||
const char *users;
|
||||
int len= 0;
|
||||
|
||||
users= value->val_str(value, NULL, &len);
|
||||
if ((size_t) len > s)
|
||||
{
|
||||
error_header();
|
||||
fprintf(stderr,
|
||||
"server_audit_%s_users value can't be longer than %zu characters.\n",
|
||||
name, s);
|
||||
return 1;
|
||||
}
|
||||
*((const char**)save)= users;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int check_incl_users(MYSQL_THD thd __attribute__((unused)),
|
||||
struct st_mysql_sys_var *var __attribute__((unused)),
|
||||
void *save, struct st_mysql_value *value)
|
||||
{
|
||||
return check_users(save, value, sizeof(incl_user_buffer), "incl");
|
||||
}
|
||||
|
||||
static int check_excl_users(MYSQL_THD thd __attribute__((unused)),
|
||||
struct st_mysql_sys_var *var __attribute__((unused)),
|
||||
void *save, struct st_mysql_value *value)
|
||||
{
|
||||
return check_users(save, value, sizeof(excl_user_buffer), "excl");
|
||||
}
|
||||
|
||||
|
||||
static void update_incl_users(MYSQL_THD thd,
|
||||
struct st_mysql_sys_var *var __attribute__((unused)),
|
||||
void *var_ptr __attribute__((unused)), const void *save)
|
||||
{
|
||||
char *new_users= (*(char **) save) ? *(char **) save : empty_str;
|
||||
size_t new_len= strlen(new_users) + 1;
|
||||
if (!maria_55_started || !debug_server_started)
|
||||
flogger_mutex_lock(&lock_operations);
|
||||
mark_always_logged(thd);
|
||||
strncpy(incl_user_buffer, new_users, sizeof(incl_user_buffer)-1);
|
||||
incl_user_buffer[sizeof(incl_user_buffer)-1]= 0;
|
||||
|
||||
if (new_len > sizeof(incl_user_buffer))
|
||||
new_len= sizeof(incl_user_buffer);
|
||||
|
||||
memcpy(incl_user_buffer, new_users, new_len - 1);
|
||||
incl_user_buffer[new_len - 1]= 0;
|
||||
|
||||
incl_users= incl_user_buffer;
|
||||
user_coll_fill(&incl_user_coll, incl_users, &excl_user_coll, 1);
|
||||
error_header();
|
||||
@ -2670,11 +2715,17 @@ static void update_excl_users(MYSQL_THD thd __attribute__((unused)),
|
||||
void *var_ptr __attribute__((unused)), const void *save)
|
||||
{
|
||||
char *new_users= (*(char **) save) ? *(char **) save : empty_str;
|
||||
size_t new_len= strlen(new_users) + 1;
|
||||
if (!maria_55_started || !debug_server_started)
|
||||
flogger_mutex_lock(&lock_operations);
|
||||
mark_always_logged(thd);
|
||||
strncpy(excl_user_buffer, new_users, sizeof(excl_user_buffer)-1);
|
||||
excl_user_buffer[sizeof(excl_user_buffer)-1]= 0;
|
||||
|
||||
if (new_len > sizeof(excl_user_buffer))
|
||||
new_len= sizeof(excl_user_buffer);
|
||||
|
||||
memcpy(excl_user_buffer, new_users, new_len - 1);
|
||||
excl_user_buffer[new_len - 1]= 0;
|
||||
|
||||
excl_users= excl_user_buffer;
|
||||
user_coll_fill(&excl_user_coll, excl_users, &incl_user_coll, 0);
|
||||
error_header();
|
||||
|
11
sql/item.cc
11
sql/item.cc
@ -1,6 +1,6 @@
|
||||
/*
|
||||
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
|
||||
Copyright (c) 2010, 2018, MariaDB Corporation
|
||||
Copyright (c) 2010, 2019, MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -265,6 +265,15 @@ longlong Item::val_int_unsigned_typecast_from_str()
|
||||
}
|
||||
|
||||
|
||||
longlong Item::val_int_signed_typecast_from_int()
|
||||
{
|
||||
longlong value= val_int();
|
||||
if (!null_value && unsigned_flag && value < 0)
|
||||
push_note_converted_to_negative_complement(current_thd);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
longlong Item::val_int_unsigned_typecast_from_int()
|
||||
{
|
||||
longlong value= val_int();
|
||||
|
@ -1247,6 +1247,13 @@ public:
|
||||
}
|
||||
longlong val_int_unsigned_typecast_from_int();
|
||||
longlong val_int_unsigned_typecast_from_str();
|
||||
|
||||
/**
|
||||
Get a value for CAST(x AS UNSIGNED).
|
||||
Huge positive unsigned values are converted to negative complements.
|
||||
*/
|
||||
longlong val_int_signed_typecast_from_int();
|
||||
|
||||
/*
|
||||
This is just a shortcut to avoid the cast. You should still use
|
||||
unsigned_flag to check the sign of the item.
|
||||
|
@ -4134,7 +4134,19 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
|
||||
}
|
||||
str->append(STRING_WITH_LEN(" separator \'"));
|
||||
str->append_for_single_quote(separator->ptr(), separator->length());
|
||||
str->append(STRING_WITH_LEN("\')"));
|
||||
str->append(STRING_WITH_LEN("\'"));
|
||||
|
||||
if (limit_clause)
|
||||
{
|
||||
str->append(STRING_WITH_LEN(" limit "));
|
||||
if (offset_limit)
|
||||
{
|
||||
offset_limit->print(str, query_type);
|
||||
str->append(',');
|
||||
}
|
||||
row_limit->print(str, query_type);
|
||||
}
|
||||
str->append(STRING_WITH_LEN(")"));
|
||||
}
|
||||
|
||||
|
||||
|
11
sql/lock.cc
11
sql/lock.cc
@ -253,16 +253,11 @@ static void track_table_access(THD *thd, TABLE **tables, size_t count)
|
||||
{
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
{
|
||||
Transaction_state_tracker *tst= (Transaction_state_tracker *)
|
||||
thd->session_tracker.get_tracker(TRANSACTION_INFO_TRACKER);
|
||||
|
||||
while (count--)
|
||||
{
|
||||
TABLE *t= tables[count];
|
||||
|
||||
if (t)
|
||||
tst->add_trx_state(thd, t->reginfo.lock_type,
|
||||
t->file->has_transaction_manager());
|
||||
if (TABLE *t= tables[count])
|
||||
thd->session_tracker.transaction_info.add_trx_state(thd,
|
||||
t->reginfo.lock_type, t->file->has_transaction_manager());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7964,6 +7964,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
|
||||
*/
|
||||
for (current= queue; current != NULL; current= current->next)
|
||||
{
|
||||
set_current_thd(current->thd);
|
||||
binlog_cache_mngr *cache_mngr= current->cache_mngr;
|
||||
|
||||
/*
|
||||
@ -7999,6 +8000,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader)
|
||||
cache_mngr->delayed_error= false;
|
||||
}
|
||||
}
|
||||
set_current_thd(leader->thd);
|
||||
|
||||
bool synced= 0;
|
||||
if (unlikely(flush_and_sync(&synced)))
|
||||
|
@ -889,6 +889,7 @@ PSI_mutex_key key_LOCK_relaylog_end_pos;
|
||||
PSI_mutex_key key_LOCK_thread_id;
|
||||
PSI_mutex_key key_LOCK_slave_state, key_LOCK_binlog_state,
|
||||
key_LOCK_rpl_thread, key_LOCK_rpl_thread_pool, key_LOCK_parallel_entry;
|
||||
PSI_mutex_key key_LOCK_rpl_semi_sync_master_enabled;
|
||||
PSI_mutex_key key_LOCK_binlog;
|
||||
|
||||
PSI_mutex_key key_LOCK_stats,
|
||||
@ -983,6 +984,7 @@ static PSI_mutex_info all_server_mutexes[]=
|
||||
{ &key_LOCK_rpl_thread_pool, "LOCK_rpl_thread_pool", 0},
|
||||
{ &key_LOCK_parallel_entry, "LOCK_parallel_entry", 0},
|
||||
{ &key_LOCK_ack_receiver, "Ack_receiver::mutex", 0},
|
||||
{ &key_LOCK_rpl_semi_sync_master_enabled, "LOCK_rpl_semi_sync_master_enabled", 0},
|
||||
{ &key_LOCK_binlog, "LOCK_binlog", 0}
|
||||
};
|
||||
|
||||
@ -2724,9 +2726,8 @@ static bool cache_thread(THD *thd)
|
||||
Create new instrumentation for the new THD job,
|
||||
and attach it to this running pthread.
|
||||
*/
|
||||
PSI_thread *psi= PSI_CALL_new_thread(key_thread_one_connection,
|
||||
thd, thd->thread_id);
|
||||
PSI_CALL_set_thread(psi);
|
||||
PSI_CALL_set_thread(PSI_CALL_new_thread(key_thread_one_connection,
|
||||
thd, thd->thread_id));
|
||||
|
||||
/* reset abort flag for the thread */
|
||||
thd->mysys_var->abort= 0;
|
||||
@ -5194,14 +5195,8 @@ static int init_server_components()
|
||||
#endif
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
{
|
||||
if (Session_tracker::server_boot_verify(system_charset_info))
|
||||
{
|
||||
sql_print_error("The variable session_track_system_variables has "
|
||||
"invalid values.");
|
||||
unireg_abort(1);
|
||||
}
|
||||
}
|
||||
if (session_tracker_init())
|
||||
return 1;
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
|
||||
/* we do want to exit if there are any other unknown options */
|
||||
|
@ -352,7 +352,7 @@ Repl_semi_sync_master::Repl_semi_sync_master()
|
||||
|
||||
int Repl_semi_sync_master::init_object()
|
||||
{
|
||||
int result;
|
||||
int result= 0;
|
||||
|
||||
m_init_done = true;
|
||||
|
||||
@ -362,6 +362,8 @@ int Repl_semi_sync_master::init_object()
|
||||
set_wait_point(rpl_semi_sync_master_wait_point);
|
||||
|
||||
/* Mutex initialization can only be done after MY_INIT(). */
|
||||
mysql_mutex_init(key_LOCK_rpl_semi_sync_master_enabled,
|
||||
&LOCK_rpl_semi_sync_master_enabled, MY_MUTEX_INIT_FAST);
|
||||
mysql_mutex_init(key_LOCK_binlog,
|
||||
&LOCK_binlog, MY_MUTEX_INIT_FAST);
|
||||
mysql_cond_init(key_COND_binlog_send,
|
||||
@ -383,7 +385,7 @@ int Repl_semi_sync_master::init_object()
|
||||
}
|
||||
else
|
||||
{
|
||||
result = disable_master();
|
||||
disable_master();
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -421,7 +423,7 @@ int Repl_semi_sync_master::enable_master()
|
||||
return result;
|
||||
}
|
||||
|
||||
int Repl_semi_sync_master::disable_master()
|
||||
void Repl_semi_sync_master::disable_master()
|
||||
{
|
||||
/* Must have the lock when we do enable of disable. */
|
||||
lock();
|
||||
@ -446,14 +448,13 @@ int Repl_semi_sync_master::disable_master()
|
||||
}
|
||||
|
||||
unlock();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Repl_semi_sync_master::cleanup()
|
||||
{
|
||||
if (m_init_done)
|
||||
{
|
||||
mysql_mutex_destroy(&LOCK_rpl_semi_sync_master_enabled);
|
||||
mysql_mutex_destroy(&LOCK_binlog);
|
||||
mysql_cond_destroy(&COND_binlog_send);
|
||||
m_init_done= 0;
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "semisync_master_ack_receiver.h"
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
extern PSI_mutex_key key_LOCK_rpl_semi_sync_master_enabled;
|
||||
extern PSI_mutex_key key_LOCK_binlog;
|
||||
extern PSI_cond_key key_COND_binlog_send;
|
||||
#endif
|
||||
@ -365,7 +366,6 @@ public:
|
||||
*/
|
||||
class Repl_semi_sync_master
|
||||
:public Repl_semi_sync_base {
|
||||
private:
|
||||
Active_tranx *m_active_tranxs; /* active transaction list: the list will
|
||||
be cleared when semi-sync switches off. */
|
||||
|
||||
@ -491,8 +491,8 @@ class Repl_semi_sync_master
|
||||
/* Enable the object to enable semi-sync replication inside the master. */
|
||||
int enable_master();
|
||||
|
||||
/* Enable the object to enable semi-sync replication inside the master. */
|
||||
int disable_master();
|
||||
/* Disable the object to disable semi-sync replication inside the master. */
|
||||
void disable_master();
|
||||
|
||||
/* Add a semi-sync replication slave */
|
||||
void add_slave();
|
||||
@ -619,6 +619,8 @@ class Repl_semi_sync_master
|
||||
int before_reset_master();
|
||||
|
||||
void check_and_switch();
|
||||
|
||||
mysql_mutex_t LOCK_rpl_semi_sync_master_enabled;
|
||||
};
|
||||
|
||||
enum rpl_semi_sync_master_wait_point_t {
|
||||
|
@ -185,8 +185,7 @@ static void init_net(NET *net, unsigned char *buff, unsigned int buff_len)
|
||||
|
||||
void Ack_receiver::run()
|
||||
{
|
||||
// skip LOCK_global_system_variables due to the 3rd arg
|
||||
THD *thd= new THD(next_thread_id(), false, true);
|
||||
THD *thd= new THD(next_thread_id());
|
||||
NET net;
|
||||
unsigned char net_buff[REPLY_MESSAGE_MAX_LENGTH];
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,6 @@ enum enum_session_tracker
|
||||
SESSION_SYSVARS_TRACKER, /* Session system variables */
|
||||
CURRENT_SCHEMA_TRACKER, /* Current schema */
|
||||
SESSION_STATE_CHANGE_TRACKER,
|
||||
SESSION_GTIDS_TRACKER, /* Tracks GTIDs */
|
||||
TRANSACTION_INFO_TRACKER, /* Transaction state */
|
||||
SESSION_TRACKER_END /* must be the last */
|
||||
};
|
||||
@ -67,17 +66,12 @@ protected:
|
||||
*/
|
||||
bool m_enabled;
|
||||
|
||||
private:
|
||||
/** Has the session state type changed ? */
|
||||
bool m_changed;
|
||||
|
||||
public:
|
||||
/** Constructor */
|
||||
State_tracker() : m_enabled(false), m_changed(false)
|
||||
{}
|
||||
|
||||
/** Destructor */
|
||||
virtual ~State_tracker()
|
||||
{}
|
||||
virtual ~State_tracker() {}
|
||||
|
||||
/** Getters */
|
||||
bool is_enabled() const
|
||||
@ -86,8 +80,20 @@ public:
|
||||
bool is_changed() const
|
||||
{ return m_changed; }
|
||||
|
||||
/** Called in the constructor of THD*/
|
||||
virtual bool enable(THD *thd)= 0;
|
||||
void reset_changed() { m_changed= false; }
|
||||
|
||||
/**
|
||||
Called by THD::init() when new connection is being created
|
||||
|
||||
We may inherit m_changed from previous connection served by this THD if
|
||||
connection was broken or client didn't have session tracking capability.
|
||||
Thus we have to reset it here.
|
||||
*/
|
||||
virtual bool enable(THD *thd)
|
||||
{
|
||||
reset_changed();
|
||||
return update(thd, 0);
|
||||
}
|
||||
|
||||
/** To be invoked when the tracker's system variable is updated (ON_UPDATE).*/
|
||||
virtual bool update(THD *thd, set_var *var)= 0;
|
||||
@ -99,74 +105,156 @@ public:
|
||||
virtual void mark_as_changed(THD *thd, LEX_CSTRING *name);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
Session_sysvars_tracker
|
||||
|
||||
This is a tracker class that enables & manages the tracking of session
|
||||
system variables. It internally maintains a hash of user supplied variable
|
||||
references and a boolean field to store if the variable was changed by the
|
||||
last statement.
|
||||
*/
|
||||
|
||||
class Session_sysvars_tracker: public State_tracker
|
||||
{
|
||||
struct sysvar_node_st {
|
||||
sys_var *m_svar;
|
||||
bool *test_load;
|
||||
bool m_changed;
|
||||
};
|
||||
|
||||
class vars_list
|
||||
{
|
||||
/**
|
||||
Registered system variables. (@@session_track_system_variables)
|
||||
A hash to store the name of all the system variables specified by the
|
||||
user.
|
||||
*/
|
||||
HASH m_registered_sysvars;
|
||||
/**
|
||||
If TRUE then we want to check all session variable.
|
||||
*/
|
||||
bool track_all;
|
||||
void init()
|
||||
{
|
||||
my_hash_init(&m_registered_sysvars, &my_charset_bin, 0, 0, 0,
|
||||
(my_hash_get_key) sysvars_get_key, my_free,
|
||||
HASH_UNIQUE | (mysqld_server_initialized ?
|
||||
HASH_THREAD_SPECIFIC : 0));
|
||||
}
|
||||
void free_hash()
|
||||
{
|
||||
DBUG_ASSERT(my_hash_inited(&m_registered_sysvars));
|
||||
my_hash_free(&m_registered_sysvars);
|
||||
}
|
||||
|
||||
sysvar_node_st *search(const sys_var *svar)
|
||||
{
|
||||
return reinterpret_cast<sysvar_node_st*>(
|
||||
my_hash_search(&m_registered_sysvars,
|
||||
reinterpret_cast<const uchar*>(&svar),
|
||||
sizeof(sys_var*)));
|
||||
}
|
||||
|
||||
sysvar_node_st *at(ulong i)
|
||||
{
|
||||
DBUG_ASSERT(i < m_registered_sysvars.records);
|
||||
return reinterpret_cast<sysvar_node_st*>(
|
||||
my_hash_element(&m_registered_sysvars, i));
|
||||
}
|
||||
public:
|
||||
vars_list(): track_all(false) { init(); }
|
||||
~vars_list() { if (my_hash_inited(&m_registered_sysvars)) free_hash(); }
|
||||
void deinit() { free_hash(); }
|
||||
|
||||
sysvar_node_st *insert_or_search(const sys_var *svar)
|
||||
{
|
||||
sysvar_node_st *res= search(svar);
|
||||
if (!res)
|
||||
{
|
||||
if (track_all)
|
||||
{
|
||||
insert(svar);
|
||||
return search(svar);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool insert(const sys_var *svar);
|
||||
void reinit();
|
||||
void reset();
|
||||
inline bool is_enabled()
|
||||
{
|
||||
return track_all || m_registered_sysvars.records;
|
||||
}
|
||||
void copy(vars_list* from, THD *thd);
|
||||
bool parse_var_list(THD *thd, LEX_STRING var_list, bool throw_error,
|
||||
CHARSET_INFO *char_set);
|
||||
bool construct_var_list(char *buf, size_t buf_len);
|
||||
bool store(THD *thd, String *buf);
|
||||
};
|
||||
/**
|
||||
Two objects of vars_list type are maintained to manage
|
||||
various operations.
|
||||
*/
|
||||
vars_list orig_list;
|
||||
bool m_parsed;
|
||||
|
||||
public:
|
||||
void init(THD *thd);
|
||||
void deinit(THD *thd);
|
||||
bool enable(THD *thd);
|
||||
bool update(THD *thd, set_var *var);
|
||||
bool store(THD *thd, String *buf);
|
||||
void mark_as_changed(THD *thd, LEX_CSTRING *tracked_item_name);
|
||||
void deinit() { orig_list.deinit(); }
|
||||
/* callback */
|
||||
static uchar *sysvars_get_key(const char *entry, size_t *length,
|
||||
my_bool not_used __attribute__((unused)));
|
||||
|
||||
friend bool sysvartrack_global_update(THD *thd, char *str, size_t len);
|
||||
};
|
||||
|
||||
|
||||
bool sysvartrack_validate_value(THD *thd, const char *str, size_t len);
|
||||
bool sysvartrack_reprint_value(THD *thd, char *str, size_t len);
|
||||
bool sysvartrack_update(THD *thd, set_var *var);
|
||||
size_t sysvartrack_value_len(THD *thd);
|
||||
bool sysvartrack_value_construct(THD *thd, char *val, size_t len);
|
||||
bool sysvartrack_global_update(THD *thd, char *str, size_t len);
|
||||
|
||||
|
||||
/**
|
||||
Session_tracker
|
||||
Current_schema_tracker,
|
||||
|
||||
This class holds an object each for all tracker classes and provides
|
||||
methods necessary for systematic detection and generation of session
|
||||
state change information.
|
||||
This is a tracker class that enables & manages the tracking of current
|
||||
schema for a particular connection.
|
||||
*/
|
||||
|
||||
class Session_tracker
|
||||
class Current_schema_tracker: public State_tracker
|
||||
{
|
||||
private:
|
||||
State_tracker *m_trackers[SESSION_TRACKER_END];
|
||||
|
||||
/* The following two functions are private to disable copying. */
|
||||
Session_tracker(Session_tracker const &other)
|
||||
{
|
||||
DBUG_ASSERT(FALSE);
|
||||
}
|
||||
Session_tracker& operator= (Session_tracker const &rhs)
|
||||
{
|
||||
DBUG_ASSERT(FALSE);
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
bool update(THD *thd, set_var *var);
|
||||
bool store(THD *thd, String *buf);
|
||||
};
|
||||
|
||||
Session_tracker();
|
||||
~Session_tracker()
|
||||
|
||||
/*
|
||||
Session_state_change_tracker
|
||||
|
||||
This is a boolean tracker class that will monitor any change that contributes
|
||||
to a session state change.
|
||||
Attributes that contribute to session state change include:
|
||||
- Successful change to System variables
|
||||
- User defined variables assignments
|
||||
- temporary tables created, altered or deleted
|
||||
- prepared statements added or removed
|
||||
- change in current database
|
||||
- change of current role
|
||||
*/
|
||||
|
||||
class Session_state_change_tracker: public State_tracker
|
||||
{
|
||||
deinit();
|
||||
}
|
||||
|
||||
/* trick to make happy memory accounting system */
|
||||
void deinit()
|
||||
{
|
||||
for (int i= 0; i < SESSION_TRACKER_END; i++)
|
||||
{
|
||||
if (m_trackers[i])
|
||||
delete m_trackers[i];
|
||||
m_trackers[i]= NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void enable(THD *thd);
|
||||
static bool server_boot_verify(CHARSET_INFO *char_set);
|
||||
|
||||
/** Returns the pointer to the tracker object for the specified tracker. */
|
||||
inline State_tracker *get_tracker(enum_session_tracker tracker) const
|
||||
{
|
||||
return m_trackers[tracker];
|
||||
}
|
||||
|
||||
inline void mark_as_changed(THD *thd, enum enum_session_tracker tracker,
|
||||
LEX_CSTRING *data)
|
||||
{
|
||||
if (m_trackers[tracker]->is_enabled())
|
||||
m_trackers[tracker]->mark_as_changed(thd, data);
|
||||
}
|
||||
|
||||
|
||||
void store(THD *thd, String *main_buf);
|
||||
public:
|
||||
bool update(THD *thd, set_var *var);
|
||||
bool store(THD *thd, String *buf);
|
||||
};
|
||||
|
||||
|
||||
@ -231,14 +319,21 @@ enum enum_session_track_transaction_info {
|
||||
|
||||
class Transaction_state_tracker : public State_tracker
|
||||
{
|
||||
private:
|
||||
/** Helper function: turn table info into table access flag */
|
||||
enum_tx_state calc_trx_state(THD *thd, thr_lock_type l, bool has_trx);
|
||||
public:
|
||||
/** Constructor */
|
||||
Transaction_state_tracker();
|
||||
|
||||
bool enable(THD *thd)
|
||||
{ return update(thd, NULL); }
|
||||
{
|
||||
m_enabled= false;
|
||||
tx_changed= TX_CHG_NONE;
|
||||
tx_curr_state= TX_EMPTY;
|
||||
tx_reported_state= TX_EMPTY;
|
||||
tx_read_flags= TX_READ_INHERIT;
|
||||
tx_isol_level= TX_ISOL_INHERIT;
|
||||
return State_tracker::enable(thd);
|
||||
}
|
||||
|
||||
bool update(THD *thd, set_var *var);
|
||||
bool store(THD *thd, String *buf);
|
||||
|
||||
@ -276,8 +371,6 @@ private:
|
||||
/** isolation level */
|
||||
enum enum_tx_isol_level tx_isol_level;
|
||||
|
||||
void reset();
|
||||
|
||||
inline void update_change_flags(THD *thd)
|
||||
{
|
||||
tx_changed &= uint(~TX_CHG_STATE);
|
||||
@ -289,11 +382,67 @@ private:
|
||||
|
||||
#define TRANSACT_TRACKER(X) \
|
||||
do { if (thd->variables.session_track_transaction_info > TX_TRACK_NONE) \
|
||||
{((Transaction_state_tracker *) \
|
||||
thd->session_tracker.get_tracker(TRANSACTION_INFO_TRACKER)) \
|
||||
->X; } } while(0)
|
||||
thd->session_tracker.transaction_info.X; } while(0)
|
||||
#define SESSION_TRACKER_CHANGED(A,B,C) \
|
||||
thd->session_tracker.mark_as_changed(A,B,C)
|
||||
|
||||
|
||||
/**
|
||||
Session_tracker
|
||||
|
||||
This class holds an object each for all tracker classes and provides
|
||||
methods necessary for systematic detection and generation of session
|
||||
state change information.
|
||||
*/
|
||||
|
||||
class Session_tracker
|
||||
{
|
||||
State_tracker *m_trackers[SESSION_TRACKER_END];
|
||||
|
||||
/* The following two functions are private to disable copying. */
|
||||
Session_tracker(Session_tracker const &other)
|
||||
{
|
||||
DBUG_ASSERT(FALSE);
|
||||
}
|
||||
Session_tracker& operator= (Session_tracker const &rhs)
|
||||
{
|
||||
DBUG_ASSERT(FALSE);
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
Current_schema_tracker current_schema;
|
||||
Session_state_change_tracker state_change;
|
||||
Transaction_state_tracker transaction_info;
|
||||
Session_sysvars_tracker sysvars;
|
||||
|
||||
Session_tracker()
|
||||
{
|
||||
m_trackers[SESSION_SYSVARS_TRACKER]= &sysvars;
|
||||
m_trackers[CURRENT_SCHEMA_TRACKER]= ¤t_schema;
|
||||
m_trackers[SESSION_STATE_CHANGE_TRACKER]= &state_change;
|
||||
m_trackers[TRANSACTION_INFO_TRACKER]= &transaction_info;
|
||||
}
|
||||
|
||||
void enable(THD *thd)
|
||||
{
|
||||
for (int i= 0; i < SESSION_TRACKER_END; i++)
|
||||
m_trackers[i]->enable(thd);
|
||||
}
|
||||
|
||||
inline void mark_as_changed(THD *thd, enum enum_session_tracker tracker,
|
||||
LEX_CSTRING *data)
|
||||
{
|
||||
if (m_trackers[tracker]->is_enabled())
|
||||
m_trackers[tracker]->mark_as_changed(thd, data);
|
||||
}
|
||||
|
||||
|
||||
void store(THD *thd, String *main_buf);
|
||||
};
|
||||
|
||||
|
||||
int session_tracker_init();
|
||||
#else
|
||||
|
||||
#define TRANSACT_TRACKER(X) do{}while(0)
|
||||
|
@ -1016,13 +1016,13 @@ int set_var_collation_client::update(THD *thd)
|
||||
|
||||
/* Mark client collation variables as changed */
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->is_enabled())
|
||||
if (thd->session_tracker.sysvars.is_enabled())
|
||||
{
|
||||
thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->
|
||||
thd->session_tracker.sysvars.
|
||||
mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_client_ptr);
|
||||
thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->
|
||||
thd->session_tracker.sysvars.
|
||||
mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_results_ptr);
|
||||
thd->session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->
|
||||
thd->session_tracker.sysvars.
|
||||
mark_as_changed(thd, (LEX_CSTRING*)Sys_character_set_connection_ptr);
|
||||
}
|
||||
thd->session_tracker.mark_as_changed(thd, SESSION_STATE_CHANGE_TRACKER, NULL);
|
||||
|
@ -407,7 +407,8 @@ extern SHOW_COMP_OPTION have_openssl;
|
||||
SHOW_VAR* enumerate_sys_vars(THD *thd, bool sorted, enum enum_var_type type);
|
||||
int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond);
|
||||
|
||||
sys_var *find_sys_var(THD *thd, const char *str, size_t length=0);
|
||||
sys_var *find_sys_var(THD *thd, const char *str, size_t length= 0,
|
||||
bool throw_error= false);
|
||||
int sql_set_variables(THD *thd, List<set_var_base> *var_list, bool free);
|
||||
|
||||
#define SYSVAR_AUTOSIZE(VAR,VAL) \
|
||||
|
@ -30,6 +30,10 @@
|
||||
#define SIGNAL_FMT "signal %d"
|
||||
#endif
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
|
||||
/*
|
||||
We are handling signals/exceptions in this file.
|
||||
Any global variables we read should be 'volatile sig_atomic_t'
|
||||
@ -44,6 +48,43 @@ extern volatile sig_atomic_t ld_assume_kernel_is_set;
|
||||
|
||||
extern const char *optimizer_switch_names[];
|
||||
|
||||
static inline void output_core_info()
|
||||
{
|
||||
/* proc is optional on some BSDs so it can't hurt to look */
|
||||
#ifdef HAVE_READLINK
|
||||
char buff[PATH_MAX];
|
||||
ssize_t len;
|
||||
int fd;
|
||||
if ((len= readlink("/proc/self/cwd", buff, sizeof(buff))) >= 0)
|
||||
{
|
||||
my_safe_printf_stderr("Writing a core file...\nWorking directory at %.*s\n",
|
||||
(int) len, buff);
|
||||
}
|
||||
if ((fd= my_open("/proc/self/limits", O_RDONLY, MYF(0))) >= 0)
|
||||
{
|
||||
my_safe_printf_stderr("Resource Limits:\n");
|
||||
while ((len= my_read(fd, (uchar*)buff, sizeof(buff), MYF(0))) > 0)
|
||||
{
|
||||
my_write_stderr(buff, len);
|
||||
}
|
||||
my_close(fd, MYF(0));
|
||||
}
|
||||
#ifdef __linux__
|
||||
if ((fd= my_open("/proc/sys/kernel/core_pattern", O_RDONLY, MYF(0))) >= 0)
|
||||
{
|
||||
len= my_read(fd, (uchar*)buff, sizeof(buff), MYF(0));
|
||||
my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff);
|
||||
my_close(fd, MYF(0));
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
char buff[80];
|
||||
my_getwd(buff, sizeof(buff), 0);
|
||||
my_safe_printf_stderr("Writing a core file at %s\n", buff);
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for fatal signals on POSIX, exception handler on Windows.
|
||||
*
|
||||
@ -295,13 +336,10 @@ extern "C" sig_handler handle_fatal_signal(int sig)
|
||||
}
|
||||
#endif
|
||||
|
||||
output_core_info();
|
||||
#ifdef HAVE_WRITE_CORE
|
||||
if (test_flags & TEST_CORE_ON_SIGNAL)
|
||||
{
|
||||
char buff[80];
|
||||
my_getwd(buff, sizeof(buff), 0);
|
||||
my_safe_printf_stderr("Writing a core file at %s\n", buff);
|
||||
fflush(stderr);
|
||||
my_write_core(sig);
|
||||
}
|
||||
#endif
|
||||
|
@ -8817,13 +8817,13 @@ static const char *command_array[]=
|
||||
"LOCK TABLES", "EXECUTE", "REPLICATION SLAVE", "REPLICATION CLIENT",
|
||||
"CREATE VIEW", "SHOW VIEW", "CREATE ROUTINE", "ALTER ROUTINE",
|
||||
"CREATE USER", "EVENT", "TRIGGER", "CREATE TABLESPACE",
|
||||
"DELETE VERSIONING ROWS"
|
||||
"DELETE HISTORY"
|
||||
};
|
||||
|
||||
static uint command_lengths[]=
|
||||
{
|
||||
6, 6, 6, 6, 6, 4, 6, 8, 7, 4, 5, 10, 5, 5, 14, 5, 23, 11, 7, 17, 18, 11, 9,
|
||||
14, 13, 11, 5, 7, 17, 22,
|
||||
14, 13, 11, 5, 7, 17, 14,
|
||||
};
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
|
||||
else if (r_limit == 0)
|
||||
writer->add_str(varied_str);
|
||||
else
|
||||
writer->add_ll((longlong) rint(r_limit));
|
||||
writer->add_ll(r_limit);
|
||||
}
|
||||
|
||||
writer->add_member("r_used_priority_queue");
|
||||
@ -61,13 +61,13 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
|
||||
if (!get_r_loops())
|
||||
writer->add_member("r_output_rows").add_null();
|
||||
else
|
||||
writer->add_member("r_output_rows").add_ll((longlong) rint(r_output_rows /
|
||||
get_r_loops()));
|
||||
writer->add_member("r_output_rows").add_ll(
|
||||
(longlong) rint((double)r_output_rows / get_r_loops()));
|
||||
|
||||
if (sort_passes)
|
||||
{
|
||||
writer->add_member("r_sort_passes").add_ll((longlong) rint(sort_passes /
|
||||
get_r_loops()));
|
||||
writer->add_member("r_sort_passes").add_ll(
|
||||
(longlong) rint((double)sort_passes / get_r_loops()));
|
||||
}
|
||||
|
||||
if (sort_buffer_size != 0)
|
||||
|
@ -600,7 +600,7 @@ extern "C" void thd_kill_timeout(THD* thd)
|
||||
thd->awake(KILL_TIMEOUT);
|
||||
}
|
||||
|
||||
THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
|
||||
THD::THD(my_thread_id id, bool is_wsrep_applier)
|
||||
:Statement(&main_lex, &main_mem_root, STMT_CONVENTIONAL_EXECUTION,
|
||||
/* statement id */ 0),
|
||||
rli_fake(0), rgi_fake(0), rgi_slave(NULL),
|
||||
@ -808,7 +808,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier, bool skip_global_sys_var_lock)
|
||||
/* Call to init() below requires fully initialized Open_tables_state. */
|
||||
reset_open_tables_state(this);
|
||||
|
||||
init(skip_global_sys_var_lock);
|
||||
init();
|
||||
#if defined(ENABLED_PROFILING)
|
||||
profiling.set_thd(this);
|
||||
#endif
|
||||
@ -1216,10 +1216,9 @@ const Type_handler *THD::type_handler_for_date() const
|
||||
Init common variables that has to be reset on start and on change_user
|
||||
*/
|
||||
|
||||
void THD::init(bool skip_lock)
|
||||
void THD::init()
|
||||
{
|
||||
DBUG_ENTER("thd::init");
|
||||
if (!skip_lock)
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
plugin_thdvar_init(this);
|
||||
/*
|
||||
@ -1233,7 +1232,6 @@ void THD::init(bool skip_lock)
|
||||
::strmake(default_master_connection_buff,
|
||||
global_system_variables.default_master_connection.str,
|
||||
variables.default_master_connection.length);
|
||||
if (!skip_lock)
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
|
||||
user_time.val= start_time= start_time_sec_part= 0;
|
||||
@ -1723,7 +1721,7 @@ THD::~THD()
|
||||
|
||||
/* trick to make happy memory accounting system */
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
session_tracker.deinit();
|
||||
session_tracker.sysvars.deinit();
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
|
||||
if (status_var.local_memory_used != 0)
|
||||
@ -7151,10 +7149,10 @@ void THD::set_last_commit_gtid(rpl_gtid >id)
|
||||
#endif
|
||||
m_last_commit_gtid= gtid;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (changed_gtid &&
|
||||
session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->is_enabled())
|
||||
if (changed_gtid && session_tracker.sysvars.is_enabled())
|
||||
{
|
||||
session_tracker.get_tracker(SESSION_SYSVARS_TRACKER)->
|
||||
DBUG_ASSERT(current_thd == this);
|
||||
session_tracker.sysvars.
|
||||
mark_as_changed(this, (LEX_CSTRING*)Sys_last_gtid_ptr);
|
||||
}
|
||||
#endif
|
||||
|
@ -3239,17 +3239,12 @@ public:
|
||||
/**
|
||||
@param id thread identifier
|
||||
@param is_wsrep_applier thread type
|
||||
@param skip_lock instruct whether @c LOCK_global_system_variables
|
||||
is already locked, to not acquire it then.
|
||||
*/
|
||||
THD(my_thread_id id, bool is_wsrep_applier= false, bool skip_lock= false);
|
||||
THD(my_thread_id id, bool is_wsrep_applier= false);
|
||||
|
||||
~THD();
|
||||
/**
|
||||
@param skip_lock instruct whether @c LOCK_global_system_variables
|
||||
is already locked, to not acquire it then.
|
||||
*/
|
||||
void init(bool skip_lock= false);
|
||||
|
||||
void init();
|
||||
/*
|
||||
Initialize memory roots necessary for query processing and (!)
|
||||
pre-allocate memory for it. We can't do that in THD constructor because
|
||||
|
@ -7640,8 +7640,7 @@ bool LEX::set_system_variable(THD *thd, enum_var_type var_type,
|
||||
{
|
||||
sys_var *tmp;
|
||||
if (unlikely(check_reserved_words(name1)) ||
|
||||
unlikely(!(tmp= find_sys_var_ex(thd, name2->str, name2->length, true,
|
||||
false))))
|
||||
unlikely(!(tmp= find_sys_var(thd, name2->str, name2->length, true))))
|
||||
{
|
||||
my_error(ER_UNKNOWN_STRUCTURED_VARIABLE, MYF(0),
|
||||
(int) name1->length, name1->str);
|
||||
@ -8208,7 +8207,7 @@ int set_statement_var_if_exists(THD *thd, const char *var_name,
|
||||
my_error(ER_SP_BADSTATEMENT, MYF(0), "[NO]WAIT");
|
||||
return 1;
|
||||
}
|
||||
if ((sysvar= find_sys_var_ex(thd, var_name, var_name_length, true, false)))
|
||||
if ((sysvar= find_sys_var(thd, var_name, var_name_length, true)))
|
||||
{
|
||||
Item *item= new (thd->mem_root) Item_uint(thd, value);
|
||||
set_var *var= new (thd->mem_root) set_var(thd, OPT_SESSION, sysvar,
|
||||
|
@ -968,6 +968,7 @@ public:
|
||||
bool union_needs_tmp_table();
|
||||
|
||||
void set_unique_exclude();
|
||||
bool check_distinct_in_union();
|
||||
|
||||
friend struct LEX;
|
||||
friend int subselect_union_engine::exec();
|
||||
|
@ -2834,37 +2834,25 @@ static void update_func_double(THD *thd, struct st_mysql_sys_var *var,
|
||||
System Variables support
|
||||
****************************************************************************/
|
||||
|
||||
sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length,
|
||||
bool throw_error, bool locked)
|
||||
sys_var *find_sys_var(THD *thd, const char *str, size_t length,
|
||||
bool throw_error)
|
||||
{
|
||||
sys_var *var;
|
||||
sys_var_pluginvar *pi= NULL;
|
||||
plugin_ref plugin;
|
||||
DBUG_ENTER("find_sys_var_ex");
|
||||
sys_var_pluginvar *pi;
|
||||
DBUG_ENTER("find_sys_var");
|
||||
DBUG_PRINT("enter", ("var '%.*s'", (int)length, str));
|
||||
|
||||
if (!locked)
|
||||
mysql_mutex_lock(&LOCK_plugin);
|
||||
mysql_prlock_rdlock(&LOCK_system_variables_hash);
|
||||
if ((var= intern_find_sys_var(str, length)) &&
|
||||
(pi= var->cast_pluginvar()))
|
||||
{
|
||||
mysql_prlock_unlock(&LOCK_system_variables_hash);
|
||||
LEX *lex= thd ? thd->lex : 0;
|
||||
if (!(plugin= intern_plugin_lock(lex, plugin_int_to_ref(pi->plugin))))
|
||||
mysql_mutex_lock(&LOCK_plugin);
|
||||
if (!intern_plugin_lock(thd ? thd->lex : 0, plugin_int_to_ref(pi->plugin),
|
||||
PLUGIN_IS_READY))
|
||||
var= NULL; /* failed to lock it, it must be uninstalling */
|
||||
else
|
||||
if (!(plugin_state(plugin) & PLUGIN_IS_READY))
|
||||
{
|
||||
/* initialization not completed */
|
||||
var= NULL;
|
||||
intern_plugin_unlock(lex, plugin);
|
||||
}
|
||||
}
|
||||
else
|
||||
mysql_prlock_unlock(&LOCK_system_variables_hash);
|
||||
if (!locked)
|
||||
mysql_mutex_unlock(&LOCK_plugin);
|
||||
}
|
||||
mysql_prlock_unlock(&LOCK_system_variables_hash);
|
||||
|
||||
if (unlikely(!throw_error && !var))
|
||||
my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0),
|
||||
@ -2873,11 +2861,6 @@ sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length,
|
||||
}
|
||||
|
||||
|
||||
sys_var *find_sys_var(THD *thd, const char *str, size_t length)
|
||||
{
|
||||
return find_sys_var_ex(thd, str, length, false, false);
|
||||
}
|
||||
|
||||
/*
|
||||
called by register_var, construct_options and test_plugin_options.
|
||||
Returns the 'bookmark' for the named variable.
|
||||
@ -3161,6 +3144,11 @@ void plugin_thdvar_init(THD *thd)
|
||||
thd->variables.enforced_table_plugin= NULL;
|
||||
cleanup_variables(&thd->variables);
|
||||
|
||||
/* This and all other variable cleanups are here for COM_CHANGE_USER :( */
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
thd->session_tracker.sysvars.deinit(thd);
|
||||
#endif
|
||||
|
||||
thd->variables= global_system_variables;
|
||||
|
||||
/* we are going to allocate these lazily */
|
||||
@ -3182,6 +3170,9 @@ void plugin_thdvar_init(THD *thd)
|
||||
intern_plugin_unlock(NULL, old_enforced_table_plugin);
|
||||
mysql_mutex_unlock(&LOCK_plugin);
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
thd->session_tracker.sysvars.init(thd);
|
||||
#endif
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -3247,6 +3238,10 @@ void plugin_thdvar_cleanup(THD *thd)
|
||||
plugin_ref *list;
|
||||
DBUG_ENTER("plugin_thdvar_cleanup");
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
thd->session_tracker.sysvars.deinit(thd);
|
||||
#endif
|
||||
|
||||
mysql_mutex_lock(&LOCK_plugin);
|
||||
|
||||
unlock_variables(thd, &thd->variables);
|
||||
|
@ -196,9 +196,6 @@ extern void sync_dynamic_session_variables(THD* thd, bool global_lock);
|
||||
extern bool plugin_dl_foreach(THD *thd, const LEX_CSTRING *dl,
|
||||
plugin_foreach_func *func, void *arg);
|
||||
|
||||
sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length,
|
||||
bool throw_error, bool locked);
|
||||
|
||||
extern void sync_dynamic_session_variables(THD* thd, bool global_lock);
|
||||
#endif
|
||||
|
||||
|
@ -2318,6 +2318,16 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
||||
!(sql_mode & MODE_NO_FIELD_OPTIONS))
|
||||
packet->append(STRING_WITH_LEN(" AUTO_INCREMENT"));
|
||||
}
|
||||
|
||||
if (field->comment.length)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" COMMENT "));
|
||||
append_unescaped(packet, field->comment.str, field->comment.length);
|
||||
}
|
||||
|
||||
append_create_options(thd, packet, field->option_list, check_options,
|
||||
hton->field_options);
|
||||
|
||||
if (field->check_constraint)
|
||||
{
|
||||
StringBuffer<MAX_FIELD_WIDTH> str(&my_charset_utf8mb4_general_ci);
|
||||
@ -2327,13 +2337,6 @@ int show_create_table(THD *thd, TABLE_LIST *table_list, String *packet,
|
||||
packet->append(STRING_WITH_LEN(")"));
|
||||
}
|
||||
|
||||
if (field->comment.length)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" COMMENT "));
|
||||
append_unescaped(packet, field->comment.str, field->comment.length);
|
||||
}
|
||||
append_create_options(thd, packet, field->option_list, check_options,
|
||||
hton->field_options);
|
||||
}
|
||||
|
||||
key_info= table->s->key_info;
|
||||
|
@ -278,7 +278,7 @@ public:
|
||||
Field **nullable_fields() { return record0_field; }
|
||||
void reset_extra_null_bitmap()
|
||||
{
|
||||
size_t null_bytes= (trigger_table->s->stored_fields -
|
||||
size_t null_bytes= (trigger_table->s->fields -
|
||||
trigger_table->s->null_fields + 7)/8;
|
||||
bzero(extra_null_bitmap, null_bytes);
|
||||
}
|
||||
|
@ -4490,7 +4490,7 @@ void Type_handler_temporal_result::Item_get_date(THD *thd, Item *item,
|
||||
longlong Type_handler_real_result::
|
||||
Item_val_int_signed_typecast(Item *item) const
|
||||
{
|
||||
return item->val_int();
|
||||
return item->val_int_signed_typecast_from_int();
|
||||
}
|
||||
|
||||
longlong Type_handler_int_result::
|
||||
|
@ -2049,3 +2049,43 @@ void st_select_lex_unit::set_unique_exclude()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@brief
|
||||
Check if the derived table is guaranteed to have distinct rows because of
|
||||
UNION operations used to populate it.
|
||||
|
||||
@detail
|
||||
UNION operation removes duplicate rows from its output. That is, a query like
|
||||
|
||||
select * from t1 UNION select * from t2
|
||||
|
||||
will not produce duplicate rows in its output, even if table t1 (and/or t2)
|
||||
contain duplicate rows. EXCEPT and INTERSECT operations also have this
|
||||
property.
|
||||
|
||||
On the other hand, UNION ALL operation doesn't remove duplicates. (The SQL
|
||||
standard also defines EXCEPT ALL and INTERSECT ALL, but we don't support
|
||||
them).
|
||||
|
||||
st_select_lex_unit computes its value left to right. That is, if there is
|
||||
a st_select_lex_unit object describing
|
||||
|
||||
(select #1) OP1 (select #2) OP2 (select #3)
|
||||
|
||||
then ((select #1) OP1 (select #2)) is computed first, and OP2 is computed
|
||||
second.
|
||||
|
||||
How can one tell if st_select_lex_unit is guaranteed to have distinct
|
||||
output rows? This depends on whether the last operation was duplicate-
|
||||
removing or not:
|
||||
- UNION ALL is not duplicate-removing
|
||||
- all other operations are duplicate-removing
|
||||
*/
|
||||
|
||||
bool st_select_lex_unit::check_distinct_in_union()
|
||||
{
|
||||
if (union_distinct && !union_distinct->next_select())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -3206,6 +3206,8 @@ static Sys_var_replicate_events_marked_for_skip Replicate_events_marked_for_skip
|
||||
static bool fix_rpl_semi_sync_master_enabled(sys_var *self, THD *thd,
|
||||
enum_var_type type)
|
||||
{
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
mysql_mutex_lock(&repl_semisync_master.LOCK_rpl_semi_sync_master_enabled);
|
||||
if (rpl_semi_sync_master_enabled)
|
||||
{
|
||||
if (repl_semisync_master.enable_master() != 0)
|
||||
@ -3218,11 +3220,11 @@ static bool fix_rpl_semi_sync_master_enabled(sys_var *self, THD *thd,
|
||||
}
|
||||
else
|
||||
{
|
||||
if (repl_semisync_master.disable_master() != 0)
|
||||
rpl_semi_sync_master_enabled= true;
|
||||
if (!rpl_semi_sync_master_enabled)
|
||||
repl_semisync_master.disable_master();
|
||||
ack_receiver.stop();
|
||||
}
|
||||
mysql_mutex_unlock(&repl_semisync_master.LOCK_rpl_semi_sync_master_enabled);
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -3806,14 +3808,12 @@ bool Sys_var_tx_read_only::session_update(THD *thd, set_var *var)
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
{
|
||||
Transaction_state_tracker *tst= (Transaction_state_tracker *)
|
||||
thd->session_tracker.get_tracker(TRANSACTION_INFO_TRACKER);
|
||||
|
||||
if (var->type == OPT_DEFAULT)
|
||||
tst->set_read_flags(thd,
|
||||
thd->session_tracker.transaction_info.set_read_flags(thd,
|
||||
thd->tx_read_only ? TX_READ_ONLY : TX_READ_WRITE);
|
||||
else
|
||||
tst->set_read_flags(thd, TX_READ_INHERIT);
|
||||
thd->session_tracker.transaction_info.set_read_flags(thd,
|
||||
TX_READ_INHERIT);
|
||||
}
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
}
|
||||
@ -6255,8 +6255,7 @@ static bool update_session_track_schema(sys_var *self, THD *thd,
|
||||
enum_var_type type)
|
||||
{
|
||||
DBUG_ENTER("update_session_track_schema");
|
||||
DBUG_RETURN(thd->session_tracker.get_tracker(CURRENT_SCHEMA_TRACKER)->
|
||||
update(thd, NULL));
|
||||
DBUG_RETURN(thd->session_tracker.current_schema.update(thd, NULL));
|
||||
}
|
||||
|
||||
static Sys_var_mybool Sys_session_track_schema(
|
||||
@ -6273,8 +6272,7 @@ static bool update_session_track_tx_info(sys_var *self, THD *thd,
|
||||
enum_var_type type)
|
||||
{
|
||||
DBUG_ENTER("update_session_track_tx_info");
|
||||
DBUG_RETURN(thd->session_tracker.get_tracker(TRANSACTION_INFO_TRACKER)->
|
||||
update(thd, NULL));
|
||||
DBUG_RETURN(thd->session_tracker.transaction_info.update(thd, NULL));
|
||||
}
|
||||
|
||||
static const char *session_track_transaction_info_names[]=
|
||||
@ -6299,8 +6297,7 @@ static bool update_session_track_state_change(sys_var *self, THD *thd,
|
||||
enum_var_type type)
|
||||
{
|
||||
DBUG_ENTER("update_session_track_state_change");
|
||||
DBUG_RETURN(thd->session_tracker.get_tracker(SESSION_STATE_CHANGE_TRACKER)->
|
||||
update(thd, NULL));
|
||||
DBUG_RETURN(thd->session_tracker.state_change.update(thd, NULL));
|
||||
}
|
||||
|
||||
static Sys_var_mybool Sys_session_track_state_change(
|
||||
|
@ -615,7 +615,7 @@ public:
|
||||
char *new_val= global_update_prepare(thd, var);
|
||||
if (new_val)
|
||||
{
|
||||
if (sysvartrack_reprint_value(thd, new_val,
|
||||
if (sysvartrack_global_update(thd, new_val,
|
||||
var->save_result.string_value.length))
|
||||
new_val= 0;
|
||||
}
|
||||
@ -623,9 +623,7 @@ public:
|
||||
return (new_val == 0 && var->save_result.string_value.str != 0);
|
||||
}
|
||||
bool session_update(THD *thd, set_var *var)
|
||||
{
|
||||
return sysvartrack_update(thd, var);
|
||||
}
|
||||
{ return thd->session_tracker.sysvars.update(thd, var); }
|
||||
void session_save_default(THD *thd, set_var *var)
|
||||
{
|
||||
var->save_result.string_value.str= global_var(char*);
|
||||
@ -643,19 +641,6 @@ public:
|
||||
DBUG_ASSERT(res == 0);
|
||||
}
|
||||
}
|
||||
uchar *session_value_ptr(THD *thd, const LEX_CSTRING *base)
|
||||
{
|
||||
DBUG_ASSERT(thd != NULL);
|
||||
size_t len= sysvartrack_value_len(thd);
|
||||
char *res= (char *)thd->alloc(len + sizeof(char *));
|
||||
if (res)
|
||||
{
|
||||
char *buf= res + sizeof(char *);
|
||||
*((char**) res)= buf;
|
||||
sysvartrack_value_construct(thd, buf, len);
|
||||
}
|
||||
return (uchar *)res;
|
||||
}
|
||||
};
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
|
||||
@ -2229,14 +2214,6 @@ public:
|
||||
return TRUE;
|
||||
if (var->type == OPT_DEFAULT || !thd->in_active_multi_stmt_transaction())
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
Transaction_state_tracker *tst= NULL;
|
||||
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
tst= (Transaction_state_tracker *)
|
||||
thd->session_tracker.get_tracker(TRANSACTION_INFO_TRACKER);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
|
||||
thd->tx_isolation= (enum_tx_isolation) var->save_result.ulonglong_value;
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
@ -2260,13 +2237,11 @@ public:
|
||||
DBUG_ASSERT(0);
|
||||
return TRUE;
|
||||
}
|
||||
if (tst)
|
||||
tst->set_isol_level(thd, l);
|
||||
}
|
||||
else if (tst)
|
||||
{
|
||||
tst->set_isol_level(thd, TX_ISOL_INHERIT);
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
thd->session_tracker.transaction_info.set_isol_level(thd, l);
|
||||
}
|
||||
else if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
thd->session_tracker.transaction_info.set_isol_level(thd, TX_ISOL_INHERIT);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
}
|
||||
return FALSE;
|
||||
|
20
sql/table.cc
20
sql/table.cc
@ -7639,6 +7639,26 @@ bool TABLE::add_tmp_key(uint key, uint key_parts,
|
||||
key_part_info++;
|
||||
}
|
||||
|
||||
/*
|
||||
For the case when there is a derived table that would give distinct rows,
|
||||
the index statistics are passed to the join optimizer to tell that a ref
|
||||
access to all the fields of the derived table will produce only one row.
|
||||
*/
|
||||
|
||||
st_select_lex_unit* derived= pos_in_table_list ?
|
||||
pos_in_table_list->derived: NULL;
|
||||
if (derived)
|
||||
{
|
||||
st_select_lex* first= derived->first_select();
|
||||
uint select_list_items= first->get_item_list()->elements;
|
||||
if (key_parts == select_list_items)
|
||||
{
|
||||
if ((!first->is_part_of_union() && (first->options & SELECT_DISTINCT)) ||
|
||||
derived->check_distinct_in_union())
|
||||
keyinfo->rec_per_key[key_parts - 1]= 1;
|
||||
}
|
||||
}
|
||||
|
||||
set_if_bigger(s->max_key_length, keyinfo->key_length);
|
||||
s->keys++;
|
||||
return FALSE;
|
||||
|
@ -35,10 +35,7 @@ void trans_track_end_trx(THD *thd)
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
{
|
||||
((Transaction_state_tracker *)
|
||||
thd->session_tracker.get_tracker(TRANSACTION_INFO_TRACKER))->end_trx(thd);
|
||||
}
|
||||
thd->session_tracker.transaction_info.end_trx(thd);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
}
|
||||
|
||||
@ -52,11 +49,8 @@ void trans_reset_one_shot_chistics(THD *thd)
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
{
|
||||
Transaction_state_tracker *tst= (Transaction_state_tracker *)
|
||||
thd->session_tracker.get_tracker(TRANSACTION_INFO_TRACKER);
|
||||
|
||||
tst->set_read_flags(thd, TX_READ_INHERIT);
|
||||
tst->set_isol_level(thd, TX_ISOL_INHERIT);
|
||||
thd->session_tracker.transaction_info.set_read_flags(thd, TX_READ_INHERIT);
|
||||
thd->session_tracker.transaction_info.set_isol_level(thd, TX_ISOL_INHERIT);
|
||||
}
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
|
||||
@ -101,20 +95,11 @@ static bool trans_check(THD *thd)
|
||||
bool trans_begin(THD *thd, uint flags)
|
||||
{
|
||||
int res= FALSE;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
Transaction_state_tracker *tst= NULL;
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
DBUG_ENTER("trans_begin");
|
||||
|
||||
if (trans_check(thd))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
tst= (Transaction_state_tracker *)
|
||||
thd->session_tracker.get_tracker(TRANSACTION_INFO_TRACKER);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
|
||||
thd->locked_tables_list.unlock_locked_tables(thd);
|
||||
|
||||
DBUG_ASSERT(!thd->locked_tables_mode);
|
||||
@ -162,8 +147,8 @@ bool trans_begin(THD *thd, uint flags)
|
||||
{
|
||||
thd->tx_read_only= true;
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (tst)
|
||||
tst->set_read_flags(thd, TX_READ_ONLY);
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
thd->session_tracker.transaction_info.set_read_flags(thd, TX_READ_ONLY);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
}
|
||||
else if (flags & MYSQL_START_TRANS_OPT_READ_WRITE)
|
||||
@ -187,8 +172,8 @@ bool trans_begin(THD *thd, uint flags)
|
||||
just from the session's default.
|
||||
*/
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (tst)
|
||||
tst->set_read_flags(thd, TX_READ_WRITE);
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
thd->session_tracker.transaction_info.set_read_flags(thd, TX_READ_WRITE);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
}
|
||||
|
||||
@ -210,16 +195,16 @@ bool trans_begin(THD *thd, uint flags)
|
||||
DBUG_PRINT("info", ("setting SERVER_STATUS_IN_TRANS"));
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (tst)
|
||||
tst->add_trx_state(thd, TX_EXPLICIT);
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
thd->session_tracker.transaction_info.add_trx_state(thd, TX_EXPLICIT);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
|
||||
/* ha_start_consistent_snapshot() relies on OPTION_BEGIN flag set. */
|
||||
if (flags & MYSQL_START_TRANS_OPT_WITH_CONS_SNAPSHOT)
|
||||
{
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
if (tst)
|
||||
tst->add_trx_state(thd, TX_WITH_SNAPSHOT);
|
||||
if (thd->variables.session_track_transaction_info > TX_TRACK_NONE)
|
||||
thd->session_tracker.transaction_info.add_trx_state(thd, TX_WITH_SNAPSHOT);
|
||||
#endif //EMBEDDED_LIBRARY
|
||||
res= ha_start_consistent_snapshot(thd);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ wsrep::storage_service* Wsrep_server_service::storage_service(
|
||||
{
|
||||
Wsrep_client_service& cs=
|
||||
static_cast<Wsrep_client_service&>(client_service);
|
||||
THD* thd= new THD(next_thread_id(), true, true);
|
||||
THD* thd= new THD(next_thread_id(), true);
|
||||
init_service_thd(thd, cs.m_thd->thread_stack);
|
||||
WSREP_DEBUG("Created storage service with thread id %llu",
|
||||
thd->thread_id);
|
||||
@ -58,7 +58,7 @@ wsrep::storage_service* Wsrep_server_service::storage_service(
|
||||
{
|
||||
Wsrep_high_priority_service& hps=
|
||||
static_cast<Wsrep_high_priority_service&>(high_priority_service);
|
||||
THD* thd= new THD(next_thread_id(), true, true);
|
||||
THD* thd= new THD(next_thread_id(), true);
|
||||
init_service_thd(thd, hps.m_thd->thread_stack);
|
||||
WSREP_DEBUG("Created high priority storage service with thread id %llu",
|
||||
thd->thread_id);
|
||||
@ -81,7 +81,7 @@ Wsrep_server_service::streaming_applier_service(
|
||||
{
|
||||
Wsrep_client_service& orig_cs=
|
||||
static_cast<Wsrep_client_service&>(orig_client_service);
|
||||
THD* thd= new THD(next_thread_id(), true, true);
|
||||
THD* thd= new THD(next_thread_id(), true);
|
||||
init_service_thd(thd, orig_cs.m_thd->thread_stack);
|
||||
WSREP_DEBUG("Created streaming applier service in local context with "
|
||||
"thread id %llu", thd->thread_id);
|
||||
@ -94,7 +94,7 @@ Wsrep_server_service::streaming_applier_service(
|
||||
{
|
||||
Wsrep_high_priority_service&
|
||||
orig_hps(static_cast<Wsrep_high_priority_service&>(orig_high_priority_service));
|
||||
THD* thd= new THD(next_thread_id(), true, true);
|
||||
THD* thd= new THD(next_thread_id(), true);
|
||||
init_service_thd(thd, orig_hps.m_thd->thread_stack);
|
||||
WSREP_DEBUG("Created streaming applier service in high priority "
|
||||
"context with thread id %llu", thd->thread_id);
|
||||
|
@ -173,11 +173,11 @@ struct CheckZipFree {
|
||||
|
||||
void operator()(const buf_buddy_free_t* elem) const
|
||||
{
|
||||
ut_a(buf_buddy_stamp_is_free(elem));
|
||||
ut_a(elem->stamp.size <= m_i);
|
||||
ut_ad(buf_buddy_stamp_is_free(elem));
|
||||
ut_ad(elem->stamp.size <= m_i);
|
||||
}
|
||||
|
||||
ulint m_i;
|
||||
const ulint m_i;
|
||||
};
|
||||
|
||||
/** Validate a buddy list.
|
||||
@ -189,8 +189,7 @@ buf_buddy_list_validate(
|
||||
const buf_pool_t* buf_pool,
|
||||
ulint i)
|
||||
{
|
||||
CheckZipFree check(i);
|
||||
ut_list_validate(buf_pool->zip_free[i], check);
|
||||
ut_list_validate(buf_pool->zip_free[i], CheckZipFree(i));
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
|
@ -325,7 +325,7 @@ too_small:
|
||||
mtr_commit(&mtr);
|
||||
|
||||
/* Flush the modified pages to disk and make a checkpoint */
|
||||
log_make_checkpoint_at(LSN_MAX, TRUE);
|
||||
log_make_checkpoint_at(LSN_MAX);
|
||||
|
||||
/* Remove doublewrite pages from LRU */
|
||||
buf_pool_invalidate();
|
||||
|
@ -3528,7 +3528,7 @@ buf_flush_request_force(
|
||||
|
||||
/** Functor to validate the flush list. */
|
||||
struct Check {
|
||||
void operator()(const buf_page_t* elem)
|
||||
void operator()(const buf_page_t* elem) const
|
||||
{
|
||||
ut_a(elem->in_flush_list);
|
||||
}
|
||||
@ -3545,11 +3545,10 @@ buf_flush_validate_low(
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
const ib_rbt_node_t* rnode = NULL;
|
||||
Check check;
|
||||
|
||||
ut_ad(buf_flush_list_mutex_own(buf_pool));
|
||||
|
||||
ut_list_validate(buf_pool->flush_list, check);
|
||||
ut_list_validate(buf_pool->flush_list, Check());
|
||||
|
||||
bpage = UT_LIST_GET_FIRST(buf_pool->flush_list);
|
||||
|
||||
|
@ -37,7 +37,7 @@ Created 5/30/1994 Heikki Tuuri
|
||||
/** Dummy variable to catch access to uninitialized fields. In the
|
||||
debug version, dtuple_create() will make all fields of dtuple_t point
|
||||
to data_error. */
|
||||
byte data_error;
|
||||
ut_d(byte data_error);
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/** Trim the tail of an index tuple before insert or update.
|
||||
@ -455,7 +455,7 @@ dfield_print_also_hex(
|
||||
break;
|
||||
}
|
||||
|
||||
data = static_cast<byte*>(dfield_get_data(dfield));
|
||||
data = static_cast<const byte*>(dfield_get_data(dfield));
|
||||
/* fall through */
|
||||
|
||||
case DATA_BINARY:
|
||||
|
@ -416,45 +416,6 @@ fil_space_crypt_t::write_page0(
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
Set crypt data for a tablespace
|
||||
@param[in,out] space Tablespace
|
||||
@param[in,out] crypt_data Crypt data to be set
|
||||
@return crypt_data in tablespace */
|
||||
static
|
||||
fil_space_crypt_t*
|
||||
fil_space_set_crypt_data(
|
||||
fil_space_t* space,
|
||||
fil_space_crypt_t* crypt_data)
|
||||
{
|
||||
fil_space_crypt_t* free_crypt_data = NULL;
|
||||
fil_space_crypt_t* ret_crypt_data = NULL;
|
||||
|
||||
/* Provided space is protected using fil_space_acquire()
|
||||
from concurrent operations. */
|
||||
if (space->crypt_data != NULL) {
|
||||
/* There is already crypt data present,
|
||||
merge new crypt_data */
|
||||
fil_space_merge_crypt_data(space->crypt_data,
|
||||
crypt_data);
|
||||
ret_crypt_data = space->crypt_data;
|
||||
free_crypt_data = crypt_data;
|
||||
} else {
|
||||
space->crypt_data = crypt_data;
|
||||
ret_crypt_data = space->crypt_data;
|
||||
}
|
||||
|
||||
if (free_crypt_data != NULL) {
|
||||
/* there was already crypt data present and the new crypt
|
||||
* data provided as argument to this function has been merged
|
||||
* into that => free new crypt data
|
||||
*/
|
||||
fil_space_destroy_crypt_data(&free_crypt_data);
|
||||
}
|
||||
|
||||
return ret_crypt_data;
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
Parse a MLOG_FILE_WRITE_CRYPT_DATA log entry
|
||||
@param[in] ptr Log entry start
|
||||
@ -512,26 +473,36 @@ fil_parse_write_crypt_data(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fil_space_crypt_t* crypt_data = fil_space_create_crypt_data(encryption, key_id);
|
||||
/* Need to overwrite these as above will initialize fields. */
|
||||
mutex_enter(&fil_system.mutex);
|
||||
|
||||
fil_space_t* space = fil_space_get_by_id(space_id);
|
||||
|
||||
if (!space) {
|
||||
mutex_exit(&fil_system.mutex);
|
||||
return ptr + len;
|
||||
}
|
||||
|
||||
fil_space_crypt_t* crypt_data = fil_space_create_crypt_data(
|
||||
encryption, key_id);
|
||||
|
||||
crypt_data->page0_offset = offset;
|
||||
crypt_data->min_key_version = min_key_version;
|
||||
crypt_data->encryption = encryption;
|
||||
crypt_data->type = type;
|
||||
memcpy(crypt_data->iv, ptr, len);
|
||||
ptr += len;
|
||||
|
||||
/* update fil_space memory cache with crypt_data */
|
||||
if (fil_space_t* space = fil_space_acquire_silent(space_id)) {
|
||||
crypt_data = fil_space_set_crypt_data(space, crypt_data);
|
||||
space->release();
|
||||
/* Check is used key found from encryption plugin */
|
||||
if (crypt_data->should_encrypt()
|
||||
&& !crypt_data->is_key_found()) {
|
||||
*err = DB_DECRYPTION_FAILED;
|
||||
}
|
||||
} else {
|
||||
if (space->crypt_data) {
|
||||
fil_space_merge_crypt_data(space->crypt_data, crypt_data);
|
||||
fil_space_destroy_crypt_data(&crypt_data);
|
||||
crypt_data = space->crypt_data;
|
||||
} else {
|
||||
space->crypt_data = crypt_data;
|
||||
}
|
||||
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
if (crypt_data->should_encrypt() && !crypt_data->is_key_found()) {
|
||||
*err = DB_DECRYPTION_FAILED;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
@ -1138,11 +1109,15 @@ fil_crypt_needs_rotation(
|
||||
|
||||
if (crypt_data->encryption == FIL_ENCRYPTION_DEFAULT
|
||||
&& crypt_data->type == CRYPT_SCHEME_1
|
||||
&& srv_encrypt_tables == 0 ) {
|
||||
&& !srv_encrypt_tables) {
|
||||
/* This is rotation encrypted => unencrypted */
|
||||
return true;
|
||||
}
|
||||
|
||||
if (rotate_key_age == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* this is rotation encrypted => encrypted,
|
||||
* only reencrypt if key is sufficiently old */
|
||||
if (key_version + rotate_key_age < latest_key_version) {
|
||||
@ -1225,7 +1200,8 @@ fil_crypt_start_encrypting_space(
|
||||
* crypt data in page 0 */
|
||||
|
||||
/* 1 - create crypt data */
|
||||
crypt_data = fil_space_create_crypt_data(FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
|
||||
crypt_data = fil_space_create_crypt_data(
|
||||
FIL_ENCRYPTION_DEFAULT, FIL_DEFAULT_ENCRYPTION_KEY);
|
||||
|
||||
if (crypt_data == NULL) {
|
||||
mutex_exit(&fil_crypt_threads_mutex);
|
||||
@ -1238,9 +1214,9 @@ fil_crypt_start_encrypting_space(
|
||||
crypt_data->rotate_state.starting = true;
|
||||
crypt_data->rotate_state.active_threads = 1;
|
||||
|
||||
mutex_enter(&crypt_data->mutex);
|
||||
crypt_data = fil_space_set_crypt_data(space, crypt_data);
|
||||
mutex_exit(&crypt_data->mutex);
|
||||
mutex_enter(&fil_system.mutex);
|
||||
space->crypt_data = crypt_data;
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
fil_crypt_start_converting = true;
|
||||
mutex_exit(&fil_crypt_threads_mutex);
|
||||
@ -2505,6 +2481,64 @@ fil_crypt_set_thread_cnt(
|
||||
}
|
||||
}
|
||||
|
||||
/** Initialize the tablespace rotation_list
|
||||
if innodb_encryption_rotate_key_age=0. */
|
||||
static void fil_crypt_rotation_list_fill()
|
||||
{
|
||||
ut_ad(mutex_own(&fil_system.mutex));
|
||||
|
||||
for (fil_space_t* space = UT_LIST_GET_FIRST(fil_system.space_list);
|
||||
space != NULL;
|
||||
space = UT_LIST_GET_NEXT(space_list, space)) {
|
||||
if (space->purpose != FIL_TYPE_TABLESPACE
|
||||
|| space->is_in_rotation_list()
|
||||
|| space->is_stopping()
|
||||
|| UT_LIST_GET_LEN(space->chain) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Ensure that crypt_data has been initialized. */
|
||||
if (!space->size) {
|
||||
/* Protect the tablespace while we may
|
||||
release fil_system.mutex. */
|
||||
space->n_pending_ops++;
|
||||
fil_space_t* s= fil_system.read_page0(
|
||||
space->id);
|
||||
ut_ad(!s || s == space);
|
||||
space->n_pending_ops--;
|
||||
if (!space->size) {
|
||||
/* Page 0 was not loaded.
|
||||
Skip this tablespace. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Skip ENCRYPTION!=DEFAULT tablespaces. */
|
||||
if (space->crypt_data
|
||||
&& !space->crypt_data->is_default_encryption()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (srv_encrypt_tables) {
|
||||
/* Skip encrypted tablespaces if
|
||||
innodb_encrypt_tables!=OFF */
|
||||
if (space->crypt_data
|
||||
&& space->crypt_data->min_key_version) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
/* Skip unencrypted tablespaces if
|
||||
innodb_encrypt_tables=OFF */
|
||||
if (!space->crypt_data
|
||||
|| !space->crypt_data->min_key_version) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
UT_LIST_ADD_LAST(fil_system.rotation_list, space);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
Adjust max key age
|
||||
@param[in] val New max key age */
|
||||
@ -2513,7 +2547,12 @@ void
|
||||
fil_crypt_set_rotate_key_age(
|
||||
uint val)
|
||||
{
|
||||
mutex_enter(&fil_system.mutex);
|
||||
srv_fil_crypt_rotate_key_age = val;
|
||||
if (val == 0) {
|
||||
fil_crypt_rotation_list_fill();
|
||||
}
|
||||
mutex_exit(&fil_system.mutex);
|
||||
os_event_set(fil_crypt_threads_event);
|
||||
}
|
||||
|
||||
@ -2537,7 +2576,16 @@ void
|
||||
fil_crypt_set_encrypt_tables(
|
||||
uint val)
|
||||
{
|
||||
mutex_enter(&fil_system.mutex);
|
||||
|
||||
srv_encrypt_tables = val;
|
||||
|
||||
if (srv_fil_crypt_rotate_key_age == 0) {
|
||||
fil_crypt_rotation_list_fill();
|
||||
}
|
||||
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
os_event_set(fil_crypt_threads_event);
|
||||
}
|
||||
|
||||
|
@ -327,6 +327,7 @@ fil_space_get_by_id(
|
||||
{
|
||||
fil_space_t* space;
|
||||
|
||||
ut_ad(fil_system.is_initialised());
|
||||
ut_ad(mutex_own(&fil_system.mutex));
|
||||
|
||||
HASH_SEARCH(hash, fil_system.spaces, id,
|
||||
@ -1358,45 +1359,21 @@ fil_assign_new_space_id(
|
||||
return(success);
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Returns a pointer to the fil_space_t that is in the memory cache
|
||||
associated with a space id. The caller must lock fil_system.mutex.
|
||||
@return file_space_t pointer, NULL if space not found */
|
||||
UNIV_INLINE
|
||||
fil_space_t*
|
||||
fil_space_get_space(
|
||||
/*================*/
|
||||
ulint id) /*!< in: space id */
|
||||
/** Trigger a call to fil_node_t::read_page0()
|
||||
@param[in] id tablespace identifier
|
||||
@return tablespace
|
||||
@retval NULL if the tablespace does not exist or cannot be read */
|
||||
fil_space_t* fil_system_t::read_page0(ulint id)
|
||||
{
|
||||
fil_space_t* space;
|
||||
fil_node_t* node;
|
||||
mutex_exit(&mutex);
|
||||
|
||||
ut_ad(fil_system.is_initialised());
|
||||
ut_ad(id != 0);
|
||||
|
||||
space = fil_space_get_by_id(id);
|
||||
if (space == NULL || space->size != 0) {
|
||||
return(space);
|
||||
}
|
||||
|
||||
switch (space->purpose) {
|
||||
case FIL_TYPE_LOG:
|
||||
break;
|
||||
case FIL_TYPE_TEMPORARY:
|
||||
case FIL_TYPE_TABLESPACE:
|
||||
case FIL_TYPE_IMPORT:
|
||||
ut_a(id != 0);
|
||||
|
||||
mutex_exit(&fil_system.mutex);
|
||||
|
||||
/* It is possible that the space gets evicted at this point
|
||||
before the fil_mutex_enter_and_prepare_for_io() acquires
|
||||
the fil_system.mutex. Check for this after completing the
|
||||
call to fil_mutex_enter_and_prepare_for_io(). */
|
||||
/* It is possible that the tablespace is dropped while we are
|
||||
not holding the mutex. */
|
||||
fil_mutex_enter_and_prepare_for_io(id);
|
||||
|
||||
/* We are still holding the fil_system.mutex. Check if
|
||||
the space is still in memory cache. */
|
||||
space = fil_space_get_by_id(id);
|
||||
fil_space_t* space = fil_space_get_by_id(id);
|
||||
|
||||
if (space == NULL || UT_LIST_GET_LEN(space->chain) == 0) {
|
||||
return(NULL);
|
||||
@ -1406,7 +1383,7 @@ fil_space_get_space(
|
||||
multiple datafiles per tablespace. */
|
||||
ut_a(1 == UT_LIST_GET_LEN(space->chain));
|
||||
|
||||
node = UT_LIST_GET_FIRST(space->chain);
|
||||
fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
|
||||
|
||||
/* It must be a single-table tablespace and we have not opened
|
||||
the file yet; the following calls will open it and update the
|
||||
@ -1419,6 +1396,32 @@ fil_space_get_space(
|
||||
}
|
||||
|
||||
fil_node_complete_io(node, IORequestRead);
|
||||
|
||||
return space;
|
||||
}
|
||||
|
||||
/*******************************************************************//**
|
||||
Returns a pointer to the fil_space_t that is in the memory cache
|
||||
associated with a space id. The caller must lock fil_system.mutex.
|
||||
@return file_space_t pointer, NULL if space not found */
|
||||
UNIV_INLINE
|
||||
fil_space_t*
|
||||
fil_space_get_space(
|
||||
/*================*/
|
||||
ulint id) /*!< in: space id */
|
||||
{
|
||||
fil_space_t* space = fil_space_get_by_id(id);
|
||||
if (space == NULL || space->size != 0) {
|
||||
return(space);
|
||||
}
|
||||
|
||||
switch (space->purpose) {
|
||||
case FIL_TYPE_LOG:
|
||||
break;
|
||||
case FIL_TYPE_TEMPORARY:
|
||||
case FIL_TYPE_TABLESPACE:
|
||||
case FIL_TYPE_IMPORT:
|
||||
space = fil_system.read_page0(id);
|
||||
}
|
||||
|
||||
return(space);
|
||||
@ -4587,7 +4590,7 @@ fil_validate(void)
|
||||
|
||||
ut_a(fil_system.n_open == n_open);
|
||||
|
||||
UT_LIST_CHECK(fil_system.LRU);
|
||||
ut_list_validate(fil_system.LRU);
|
||||
|
||||
for (fil_node = UT_LIST_GET_FIRST(fil_system.LRU);
|
||||
fil_node != 0;
|
||||
|
@ -3331,12 +3331,11 @@ fts_fetch_doc_from_tuple(
|
||||
const dict_field_t* ifield;
|
||||
const dict_col_t* col;
|
||||
ulint pos;
|
||||
dfield_t* field;
|
||||
|
||||
ifield = dict_index_get_nth_field(index, i);
|
||||
col = dict_field_get_col(ifield);
|
||||
pos = dict_col_get_no(col);
|
||||
field = dtuple_get_nth_field(tuple, pos);
|
||||
const dfield_t* field = dtuple_get_nth_field(tuple, pos);
|
||||
|
||||
if (!get_doc->index_cache->charset) {
|
||||
get_doc->index_cache->charset = fts_get_charset(
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -69,9 +70,9 @@ static
|
||||
int
|
||||
rtree_add_point_to_mbr(
|
||||
/*===================*/
|
||||
uchar** wkb, /*!< in: pointer to wkb,
|
||||
const uchar** wkb, /*!< in: pointer to wkb,
|
||||
where point is stored */
|
||||
uchar* end, /*!< in: end of wkb. */
|
||||
const uchar* end, /*!< in: end of wkb. */
|
||||
uint n_dims, /*!< in: dimensions. */
|
||||
double* mbr) /*!< in/out: mbr, which
|
||||
must be of length n_dims * 2. */
|
||||
@ -108,9 +109,9 @@ static
|
||||
int
|
||||
rtree_get_point_mbr(
|
||||
/*================*/
|
||||
uchar** wkb, /*!< in: pointer to wkb,
|
||||
const uchar** wkb, /*!< in: pointer to wkb,
|
||||
where point is stored. */
|
||||
uchar* end, /*!< in: end of wkb. */
|
||||
const uchar* end, /*!< in: end of wkb. */
|
||||
uint n_dims, /*!< in: dimensions. */
|
||||
double* mbr) /*!< in/out: mbr,
|
||||
must be of length n_dims * 2. */
|
||||
@ -126,9 +127,9 @@ static
|
||||
int
|
||||
rtree_get_linestring_mbr(
|
||||
/*=====================*/
|
||||
uchar** wkb, /*!< in: pointer to wkb,
|
||||
const uchar** wkb, /*!< in: pointer to wkb,
|
||||
where point is stored. */
|
||||
uchar* end, /*!< in: end of wkb. */
|
||||
const uchar* end, /*!< in: end of wkb. */
|
||||
uint n_dims, /*!< in: dimensions. */
|
||||
double* mbr) /*!< in/out: mbr,
|
||||
must be of length n_dims * 2. */
|
||||
@ -155,9 +156,9 @@ static
|
||||
int
|
||||
rtree_get_polygon_mbr(
|
||||
/*==================*/
|
||||
uchar** wkb, /*!< in: pointer to wkb,
|
||||
const uchar** wkb, /*!< in: pointer to wkb,
|
||||
where point is stored. */
|
||||
uchar* end, /*!< in: end of wkb. */
|
||||
const uchar* end, /*!< in: end of wkb. */
|
||||
uint n_dims, /*!< in: dimensions. */
|
||||
double* mbr) /*!< in/out: mbr,
|
||||
must be of length n_dims * 2. */
|
||||
@ -190,9 +191,9 @@ static
|
||||
int
|
||||
rtree_get_geometry_mbr(
|
||||
/*===================*/
|
||||
uchar** wkb, /*!< in: pointer to wkb,
|
||||
const uchar** wkb, /*!< in: pointer to wkb,
|
||||
where point is stored. */
|
||||
uchar* end, /*!< in: end of wkb. */
|
||||
const uchar* end, /*!< in: end of wkb. */
|
||||
uint n_dims, /*!< in: dimensions. */
|
||||
double* mbr, /*!< in/out: mbr. */
|
||||
int top) /*!< in: if it is the top,
|
||||
@ -287,7 +288,7 @@ stored in "well-known binary representation" (wkb) format.
|
||||
int
|
||||
rtree_mbr_from_wkb(
|
||||
/*===============*/
|
||||
uchar* wkb, /*!< in: wkb */
|
||||
const uchar* wkb, /*!< in: wkb */
|
||||
uint size, /*!< in: size of wkb. */
|
||||
uint n_dims, /*!< in: dimensions. */
|
||||
double* mbr) /*!< in/out: mbr, which must
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2018, MariaDB Corporation.
|
||||
Copyright (c) 2018, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -66,7 +66,7 @@ rtr_page_split_initialize_nodes(
|
||||
page_t* page;
|
||||
ulint n_uniq;
|
||||
ulint len;
|
||||
byte* source_cur;
|
||||
const byte* source_cur;
|
||||
|
||||
block = btr_cur_get_block(cursor);
|
||||
page = buf_block_get_frame(block);
|
||||
@ -106,7 +106,7 @@ rtr_page_split_initialize_nodes(
|
||||
}
|
||||
|
||||
/* Put the insert key to node list */
|
||||
source_cur = static_cast<byte*>(dfield_get_data(
|
||||
source_cur = static_cast<const byte*>(dfield_get_data(
|
||||
dtuple_get_nth_field(tuple, 0)));
|
||||
cur->coords = reserve_coords(buf_pos, SPDIMS);
|
||||
rec = (byte*) mem_heap_alloc(
|
||||
@ -1855,11 +1855,10 @@ rtr_estimate_n_rows_in_range(
|
||||
/* Read mbr from tuple. */
|
||||
rtr_mbr_t range_mbr;
|
||||
double range_area;
|
||||
const byte* range_mbr_ptr;
|
||||
|
||||
const dfield_t* dtuple_field = dtuple_get_nth_field(tuple, 0);
|
||||
ut_ad(dfield_get_len(dtuple_field) >= DATA_MBR_LEN);
|
||||
range_mbr_ptr = reinterpret_cast<const byte*>(
|
||||
const byte* range_mbr_ptr = reinterpret_cast<const byte*>(
|
||||
dfield_get_data(dtuple_field));
|
||||
|
||||
rtr_read_mbr(range_mbr_ptr, &range_mbr);
|
||||
|
@ -1627,15 +1627,13 @@ rtr_get_mbr_from_tuple(
|
||||
{
|
||||
const dfield_t* dtuple_field;
|
||||
ulint dtuple_f_len;
|
||||
byte* data;
|
||||
|
||||
dtuple_field = dtuple_get_nth_field(dtuple, 0);
|
||||
dtuple_f_len = dfield_get_len(dtuple_field);
|
||||
ut_a(dtuple_f_len >= 4 * sizeof(double));
|
||||
|
||||
data = static_cast<byte*>(dfield_get_data(dtuple_field));
|
||||
|
||||
rtr_read_mbr(data, mbr);
|
||||
rtr_read_mbr(static_cast<const byte*>(dfield_get_data(dtuple_field)),
|
||||
mbr);
|
||||
}
|
||||
|
||||
/****************************************************************//**
|
||||
|
@ -6159,9 +6159,9 @@ no_such_table:
|
||||
<< n_cols << " user"
|
||||
" defined columns in InnoDB, but " << n_fields
|
||||
<< " columns in MariaDB. Please check"
|
||||
" INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and " REFMAN
|
||||
"innodb-troubleshooting.html for how to resolve the"
|
||||
" issue.";
|
||||
" INFORMATION_SCHEMA.INNODB_SYS_COLUMNS and"
|
||||
" https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/"
|
||||
" for how to resolve the issue.";
|
||||
|
||||
/* Mark this table as corrupted, so the drop table
|
||||
or force recovery can still use it, but not others. */
|
||||
@ -18348,7 +18348,7 @@ checkpoint_now_set(THD*, st_mysql_sys_var*, void*, const void* save)
|
||||
+ (log_sys.append_on_checkpoint != NULL
|
||||
? log_sys.append_on_checkpoint->size() : 0)
|
||||
< log_sys.lsn) {
|
||||
log_make_checkpoint_at(LSN_MAX, TRUE);
|
||||
log_make_checkpoint_at(LSN_MAX);
|
||||
fil_flush_file_spaces(FIL_TYPE_LOG);
|
||||
}
|
||||
|
||||
@ -20683,7 +20683,7 @@ void innobase_free_row_for_vcol(VCOL_STORAGE *storage)
|
||||
to store the value in passed in "my_rec" */
|
||||
dfield_t*
|
||||
innobase_get_computed_value(
|
||||
const dtuple_t* row,
|
||||
dtuple_t* row,
|
||||
const dict_v_col_t* col,
|
||||
const dict_index_t* index,
|
||||
mem_heap_t** local_heap,
|
||||
@ -21013,11 +21013,11 @@ ib_errf(
|
||||
/* Keep the first 16 characters as-is, since the url is sometimes used
|
||||
as an offset from this.*/
|
||||
const char* TROUBLESHOOTING_MSG =
|
||||
"Please refer to " REFMAN "innodb-troubleshooting.html"
|
||||
"Please refer to https://mariadb.com/kb/en/innodb-troubleshooting/"
|
||||
" for how to resolve the issue.";
|
||||
|
||||
const char* TROUBLESHOOT_DATADICT_MSG =
|
||||
"Please refer to " REFMAN "innodb-troubleshooting-datadict.html"
|
||||
"Please refer to https://mariadb.com/kb/en/innodb-data-dictionary-troubleshooting/"
|
||||
" for how to resolve the issue.";
|
||||
|
||||
const char* BUG_REPORT_MSG =
|
||||
@ -21028,9 +21028,6 @@ const char* FORCE_RECOVERY_MSG =
|
||||
"https://mariadb.com/kb/en/library/innodb-recovery-modes/"
|
||||
" for information about forcing recovery.";
|
||||
|
||||
const char* ERROR_CREATING_MSG =
|
||||
"Please refer to " REFMAN "error-creating-innodb.html";
|
||||
|
||||
const char* OPERATING_SYSTEM_ERROR_MSG =
|
||||
"Some operating system error numbers are described at"
|
||||
" https://mariadb.com/kb/en/library/operating-system-error-codes/";
|
||||
@ -21314,16 +21311,6 @@ innodb_encrypt_tables_validate(
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!srv_fil_crypt_rotate_key_age) {
|
||||
const char *msg = (encrypt_tables ? "enable" : "disable");
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||
HA_ERR_UNSUPPORTED,
|
||||
"InnoDB: cannot %s encryption, "
|
||||
"innodb_encryption_rotate_key_age=0"
|
||||
" i.e. key rotation disabled", msg);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -21418,8 +21405,7 @@ ib_push_frm_error(
|
||||
" Have you mixed up "
|
||||
".frm files from different "
|
||||
"installations? See "
|
||||
REFMAN
|
||||
"innodb-troubleshooting.html\n",
|
||||
"https://mariadb.com/kb/en/innodb-troubleshooting/\n",
|
||||
ib_table->name.m_name);
|
||||
|
||||
if (push_warning) {
|
||||
@ -21462,8 +21448,7 @@ ib_push_frm_error(
|
||||
" Have you mixed up "
|
||||
".frm files from different "
|
||||
"installations? See "
|
||||
REFMAN
|
||||
"innodb-troubleshooting.html\n",
|
||||
"https://mariadb.com/kb/en/innodb-troubleshooting/\n",
|
||||
ib_table->name.m_name, n_keys,
|
||||
table->s->keys);
|
||||
|
||||
|
@ -10989,7 +10989,6 @@ ha_innobase::commit_inplace_alter_table(
|
||||
and the .frm files must be swapped manually by
|
||||
the administrator. No loss of data. */
|
||||
DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit",
|
||||
log_make_checkpoint_at(LSN_MAX, TRUE);
|
||||
log_buffer_flush_to_disk();
|
||||
DBUG_SUICIDE(););
|
||||
}
|
||||
|
@ -2500,8 +2500,7 @@ struct CheckInLRUList {
|
||||
|
||||
static void validate(const buf_pool_t* buf_pool)
|
||||
{
|
||||
CheckInLRUList check;
|
||||
ut_list_validate(buf_pool->LRU, check);
|
||||
ut_list_validate(buf_pool->LRU, CheckInLRUList());
|
||||
}
|
||||
};
|
||||
|
||||
@ -2514,8 +2513,7 @@ struct CheckInFreeList {
|
||||
|
||||
static void validate(const buf_pool_t* buf_pool)
|
||||
{
|
||||
CheckInFreeList check;
|
||||
ut_list_validate(buf_pool->free, check);
|
||||
ut_list_validate(buf_pool->free, CheckInFreeList());
|
||||
}
|
||||
};
|
||||
|
||||
@ -2528,8 +2526,8 @@ struct CheckUnzipLRUAndLRUList {
|
||||
|
||||
static void validate(const buf_pool_t* buf_pool)
|
||||
{
|
||||
CheckUnzipLRUAndLRUList check;
|
||||
ut_list_validate(buf_pool->unzip_LRU, check);
|
||||
ut_list_validate(buf_pool->unzip_LRU,
|
||||
CheckUnzipLRUAndLRUList());
|
||||
}
|
||||
};
|
||||
#endif /* UNIV_DEBUG || defined UNIV_BUF_DEBUG */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2018, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
@ -31,6 +31,7 @@ Created 5/30/1994 Heikki Tuuri
|
||||
#include "data0type.h"
|
||||
#include "mem0mem.h"
|
||||
#include "dict0types.h"
|
||||
#include "btr0types.h"
|
||||
|
||||
#include <ostream>
|
||||
|
||||
@ -39,29 +40,11 @@ index record which needs external storage of data fields */
|
||||
struct big_rec_t;
|
||||
struct upd_t;
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/*********************************************************************//**
|
||||
Gets pointer to the type struct of SQL data field.
|
||||
@return pointer to the type struct */
|
||||
UNIV_INLINE
|
||||
dtype_t*
|
||||
dfield_get_type(
|
||||
/*============*/
|
||||
const dfield_t* field) /*!< in: SQL data field */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
/*********************************************************************//**
|
||||
Gets pointer to the data in a field.
|
||||
@return pointer to data */
|
||||
UNIV_INLINE
|
||||
void*
|
||||
dfield_get_data(
|
||||
/*============*/
|
||||
const dfield_t* field) /*!< in: field */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
#else /* UNIV_DEBUG */
|
||||
# define dfield_get_type(field) (&(field)->type)
|
||||
# define dfield_get_data(field) ((field)->data)
|
||||
#endif /* UNIV_DEBUG */
|
||||
/** Dummy variable to catch access to uninitialized fields. In the
|
||||
debug version, dtuple_create() will make all fields of dtuple_t point
|
||||
to data_error. */
|
||||
ut_d(extern byte data_error);
|
||||
|
||||
/*********************************************************************//**
|
||||
Sets the type struct of SQL data field. */
|
||||
UNIV_INLINE
|
||||
@ -72,15 +55,6 @@ dfield_set_type(
|
||||
const dtype_t* type); /*!< in: pointer to data type struct */
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets length of field data.
|
||||
@return length of data; UNIV_SQL_NULL if SQL null data */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dfield_get_len(
|
||||
/*===========*/
|
||||
const dfield_t* field) /*!< in: field */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
/*********************************************************************//**
|
||||
Sets length in a field. */
|
||||
UNIV_INLINE
|
||||
void
|
||||
@ -89,32 +63,6 @@ dfield_set_len(
|
||||
dfield_t* field, /*!< in: field */
|
||||
ulint len) /*!< in: length or UNIV_SQL_NULL */
|
||||
MY_ATTRIBUTE((nonnull));
|
||||
/*********************************************************************//**
|
||||
Determines if a field is SQL NULL
|
||||
@return nonzero if SQL null data */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dfield_is_null(
|
||||
/*===========*/
|
||||
const dfield_t* field) /*!< in: field */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
/*********************************************************************//**
|
||||
Determines if a field is externally stored
|
||||
@return nonzero if externally stored */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dfield_is_ext(
|
||||
/*==========*/
|
||||
const dfield_t* field) /*!< in: field */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
/*********************************************************************//**
|
||||
Sets the "external storage" flag */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dfield_set_ext(
|
||||
/*===========*/
|
||||
dfield_t* field) /*!< in/out: field */
|
||||
MY_ATTRIBUTE((nonnull));
|
||||
|
||||
/** Gets spatial status for "external storage"
|
||||
@param[in,out] field field */
|
||||
@ -221,46 +169,7 @@ dfield_data_is_binary_equal(
|
||||
ulint len, /*!< in: data length or UNIV_SQL_NULL */
|
||||
const byte* data) /*!< in: data */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
/*********************************************************************//**
|
||||
Gets number of fields in a data tuple.
|
||||
@return number of fields */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dtuple_get_n_fields(
|
||||
/*================*/
|
||||
const dtuple_t* tuple) /*!< in: tuple */
|
||||
MY_ATTRIBUTE((nonnull, warn_unused_result));
|
||||
/** Gets number of virtual fields in a data tuple.
|
||||
@param[in] tuple dtuple to check
|
||||
@return number of fields */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dtuple_get_n_v_fields(
|
||||
const dtuple_t* tuple);
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/** Gets nth field of a tuple.
|
||||
@param[in] tuple tuple
|
||||
@param[in] n index of field
|
||||
@return nth field */
|
||||
UNIV_INLINE
|
||||
dfield_t*
|
||||
dtuple_get_nth_field(
|
||||
const dtuple_t* tuple,
|
||||
ulint n);
|
||||
/** Gets nth virtual field of a tuple.
|
||||
@param[in] tuple tuple
|
||||
@oaran[in] n the nth field to get
|
||||
@return nth field */
|
||||
UNIV_INLINE
|
||||
dfield_t*
|
||||
dtuple_get_nth_v_field(
|
||||
const dtuple_t* tuple,
|
||||
ulint n);
|
||||
#else /* UNIV_DEBUG */
|
||||
# define dtuple_get_nth_field(tuple, n) ((tuple)->fields + (n))
|
||||
# define dtuple_get_nth_v_field(tuple, n) ((tuple)->fields + (tuple)->n_fields + (n))
|
||||
#endif /* UNIV_DEBUG */
|
||||
/*********************************************************************//**
|
||||
Gets info bits in a data tuple.
|
||||
@return info bits */
|
||||
@ -338,19 +247,12 @@ dtuple_create(
|
||||
|
||||
/** Initialize the virtual field data in a dtuple_t
|
||||
@param[in,out] vrow dtuple contains the virtual fields */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dtuple_init_v_fld(
|
||||
const dtuple_t* vrow);
|
||||
UNIV_INLINE void dtuple_init_v_fld(dtuple_t* vrow);
|
||||
|
||||
/** Duplicate the virtual field data in a dtuple_t
|
||||
@param[in,out] vrow dtuple contains the virtual fields
|
||||
@param[in] heap heap memory to use */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dtuple_dup_v_fld(
|
||||
const dtuple_t* vrow,
|
||||
mem_heap_t* heap);
|
||||
UNIV_INLINE void dtuple_dup_v_fld(dtuple_t* vrow, mem_heap_t* heap);
|
||||
|
||||
/** Creates a data tuple with possible virtual columns to a memory heap.
|
||||
@param[in] heap memory heap where the tuple is created
|
||||
@ -672,6 +574,73 @@ struct dtuple_t {
|
||||
bool is_metadata() const { return is_metadata(info_bits); }
|
||||
};
|
||||
|
||||
inline ulint dtuple_get_n_fields(const dtuple_t* tuple)
|
||||
{ return tuple->n_fields; }
|
||||
inline dtype_t* dfield_get_type(dfield_t* field) { return &field->type; }
|
||||
inline const dtype_t* dfield_get_type(const dfield_t* field)
|
||||
{ return &field->type; }
|
||||
inline void* dfield_get_data(dfield_t* field)
|
||||
{
|
||||
ut_ad(field->len == UNIV_SQL_NULL || field->data != &data_error);
|
||||
return field->data;
|
||||
}
|
||||
inline const void* dfield_get_data(const dfield_t* field)
|
||||
{
|
||||
ut_ad(field->len == UNIV_SQL_NULL || field->data != &data_error);
|
||||
return field->data;
|
||||
}
|
||||
inline ulint dfield_get_len(const dfield_t* field) {
|
||||
ut_ad(field->len == UNIV_SQL_NULL || field->data != &data_error);
|
||||
ut_ad(field->len != UNIV_SQL_DEFAULT);
|
||||
return field->len;
|
||||
}
|
||||
inline bool dfield_is_null(const dfield_t* field)
|
||||
{ return field->len == UNIV_SQL_NULL; }
|
||||
/** @return whether a column is to be stored off-page */
|
||||
inline bool dfield_is_ext(const dfield_t* field)
|
||||
{
|
||||
ut_ad(!field->ext || field->len >= BTR_EXTERN_FIELD_REF_SIZE);
|
||||
return static_cast<bool>(field->ext);
|
||||
}
|
||||
/** Set the "external storage" flag */
|
||||
inline void dfield_set_ext(dfield_t* field) { field->ext = 1; }
|
||||
|
||||
/** Gets number of virtual fields in a data tuple.
|
||||
@param[in] tuple dtuple to check
|
||||
@return number of fields */
|
||||
inline ulint
|
||||
dtuple_get_n_v_fields(const dtuple_t* tuple) { return tuple->n_v_fields; }
|
||||
|
||||
inline const dfield_t* dtuple_get_nth_field(const dtuple_t* tuple, ulint n)
|
||||
{
|
||||
ut_ad(n < tuple->n_fields);
|
||||
return &tuple->fields[n];
|
||||
}
|
||||
inline dfield_t* dtuple_get_nth_field(dtuple_t* tuple, ulint n)
|
||||
{
|
||||
ut_ad(n < tuple->n_fields);
|
||||
return &tuple->fields[n];
|
||||
}
|
||||
|
||||
/** Get a virtual column in a table row or an extended clustered index record.
|
||||
@param[in] tuple tuple
|
||||
@oaran[in] n the nth virtual field to get
|
||||
@return nth virtual field */
|
||||
inline const dfield_t* dtuple_get_nth_v_field(const dtuple_t* tuple, ulint n)
|
||||
{
|
||||
ut_ad(n < tuple->n_v_fields);
|
||||
return &tuple->v_fields[n];
|
||||
}
|
||||
/** Get a virtual column in a table row or an extended clustered index record.
|
||||
@param[in] tuple tuple
|
||||
@oaran[in] n the nth virtual field to get
|
||||
@return nth virtual field */
|
||||
inline dfield_t* dtuple_get_nth_v_field(dtuple_t* tuple, ulint n)
|
||||
{
|
||||
ut_ad(n < tuple->n_v_fields);
|
||||
return &tuple->v_fields[n];
|
||||
}
|
||||
|
||||
/** A slot for a field in a big rec vector */
|
||||
struct big_rec_field_t {
|
||||
|
||||
|
@ -24,28 +24,7 @@ SQL data field and tuple
|
||||
Created 5/30/1994 Heikki Tuuri
|
||||
*************************************************************************/
|
||||
|
||||
#include "mem0mem.h"
|
||||
#include "ut0rnd.h"
|
||||
#include "btr0types.h"
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/** Dummy variable to catch access to uninitialized fields. In the
|
||||
debug version, dtuple_create() will make all fields of dtuple_t point
|
||||
to data_error. */
|
||||
extern byte data_error;
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets pointer to the type struct of SQL data field.
|
||||
@return pointer to the type struct */
|
||||
UNIV_INLINE
|
||||
dtype_t*
|
||||
dfield_get_type(
|
||||
/*============*/
|
||||
const dfield_t* field) /*!< in: SQL data field */
|
||||
{
|
||||
return((dtype_t*) &(field->type));
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/*********************************************************************//**
|
||||
Sets the type struct of SQL data field. */
|
||||
@ -62,39 +41,6 @@ dfield_set_type(
|
||||
field->type = *type;
|
||||
}
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
/*********************************************************************//**
|
||||
Gets pointer to the data in a field.
|
||||
@return pointer to data */
|
||||
UNIV_INLINE
|
||||
void*
|
||||
dfield_get_data(
|
||||
/*============*/
|
||||
const dfield_t* field) /*!< in: field */
|
||||
{
|
||||
ut_ad((field->len == UNIV_SQL_NULL)
|
||||
|| (field->data != &data_error));
|
||||
|
||||
return((void*) field->data);
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets length of field data.
|
||||
@return length of data; UNIV_SQL_NULL if SQL null data */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dfield_get_len(
|
||||
/*===========*/
|
||||
const dfield_t* field) /*!< in: field */
|
||||
{
|
||||
ut_ad((field->len == UNIV_SQL_NULL)
|
||||
|| (field->data != &data_error));
|
||||
ut_ad(field->len != UNIV_SQL_DEFAULT);
|
||||
|
||||
return(field->len);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Sets length in a field. */
|
||||
UNIV_INLINE
|
||||
@ -113,42 +59,6 @@ dfield_set_len(
|
||||
field->len = static_cast<unsigned int>(len);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Determines if a field is SQL NULL
|
||||
@return nonzero if SQL null data */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dfield_is_null(
|
||||
/*===========*/
|
||||
const dfield_t* field) /*!< in: field */
|
||||
{
|
||||
return(field->len == UNIV_SQL_NULL);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Determines if a field is externally stored
|
||||
@return nonzero if externally stored */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dfield_is_ext(
|
||||
/*==========*/
|
||||
const dfield_t* field) /*!< in: field */
|
||||
{
|
||||
ut_ad(!field->ext || field->len >= BTR_EXTERN_FIELD_REF_SIZE);
|
||||
return(field->ext);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Sets the "external storage" flag */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dfield_set_ext(
|
||||
/*===========*/
|
||||
dfield_t* field) /*!< in/out: field */
|
||||
{
|
||||
field->ext = 1;
|
||||
}
|
||||
|
||||
/** Gets spatial status for "external storage"
|
||||
@param[in,out] field field */
|
||||
UNIV_INLINE
|
||||
@ -369,63 +279,6 @@ dtuple_set_n_fields_cmp(
|
||||
tuple->n_fields_cmp = n_fields_cmp;
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets number of fields in a data tuple.
|
||||
@return number of fields */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dtuple_get_n_fields(
|
||||
/*================*/
|
||||
const dtuple_t* tuple) /*!< in: tuple */
|
||||
{
|
||||
return(tuple->n_fields);
|
||||
}
|
||||
|
||||
/** Gets the number of virtual fields in a data tuple.
|
||||
@param[in] tuple dtuple to check
|
||||
@return number of fields */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
dtuple_get_n_v_fields(
|
||||
const dtuple_t* tuple)
|
||||
{
|
||||
ut_ad(tuple);
|
||||
|
||||
return(tuple->n_v_fields);
|
||||
}
|
||||
#ifdef UNIV_DEBUG
|
||||
/** Gets nth field of a tuple.
|
||||
@param[in] tuple tuple
|
||||
@param[in] n index of field
|
||||
@return nth field */
|
||||
UNIV_INLINE
|
||||
dfield_t*
|
||||
dtuple_get_nth_field(
|
||||
const dtuple_t* tuple,
|
||||
ulint n)
|
||||
{
|
||||
ut_ad(tuple);
|
||||
ut_ad(n < tuple->n_fields);
|
||||
|
||||
return((dfield_t*) tuple->fields + n);
|
||||
}
|
||||
/** Gets nth virtual field of a tuple.
|
||||
@param[in] tuple tuple
|
||||
@oaran[in] n the nth field to get
|
||||
@return nth field */
|
||||
UNIV_INLINE
|
||||
dfield_t*
|
||||
dtuple_get_nth_v_field(
|
||||
const dtuple_t* tuple,
|
||||
ulint n)
|
||||
{
|
||||
ut_ad(tuple);
|
||||
ut_ad(n < tuple->n_v_fields);
|
||||
|
||||
return(static_cast<dfield_t*>(tuple->v_fields + n));
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/** Creates a data tuple from an already allocated chunk of memory.
|
||||
The size of the chunk must be at least DTUPLE_EST_ALLOC(n_fields).
|
||||
The default value for number of fields used in record comparisons
|
||||
@ -490,12 +343,10 @@ dtuple_create_from_mem(
|
||||
|
||||
/** Duplicate the virtual field data in a dtuple_t
|
||||
@param[in,out] vrow dtuple contains the virtual fields
|
||||
@param[in] heap heap memory to use */
|
||||
@param[in,out] heap heap memory to use */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dtuple_dup_v_fld(
|
||||
const dtuple_t* vrow,
|
||||
mem_heap_t* heap)
|
||||
dtuple_dup_v_fld(dtuple_t* vrow, mem_heap_t* heap)
|
||||
{
|
||||
for (ulint i = 0; i < vrow->n_v_fields; i++) {
|
||||
dfield_t* dfield = dtuple_get_nth_v_field(vrow, i);
|
||||
@ -507,8 +358,7 @@ dtuple_dup_v_fld(
|
||||
@param[in,out] vrow dtuple contains the virtual fields */
|
||||
UNIV_INLINE
|
||||
void
|
||||
dtuple_init_v_fld(
|
||||
const dtuple_t* vrow)
|
||||
dtuple_init_v_fld(dtuple_t* vrow)
|
||||
{
|
||||
for (ulint i = 0; i < vrow->n_v_fields; i++) {
|
||||
dfield_t* dfield = dtuple_get_nth_v_field(vrow, i);
|
||||
|
@ -959,6 +959,12 @@ public:
|
||||
/*!< whether fil_space_create()
|
||||
has issued a warning about
|
||||
potential space_id reuse */
|
||||
|
||||
/** Trigger a call to fil_node_t::read_page0()
|
||||
@param[in] id tablespace identifier
|
||||
@return tablespace
|
||||
@retval NULL if the tablespace does not exist or cannot be read */
|
||||
fil_space_t* read_page0(ulint id);
|
||||
};
|
||||
|
||||
/** The tablespace memory cache. */
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*****************************************************************************
|
||||
Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2019, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -73,7 +74,7 @@ stored in "well-known binary representation" (wkb) format.
|
||||
int
|
||||
rtree_mbr_from_wkb(
|
||||
/*===============*/
|
||||
uchar* wkb, /*!< in: pointer to wkb. */
|
||||
const uchar* wkb, /*!< in: pointer to wkb. */
|
||||
uint size, /*!< in: size of wkb. */
|
||||
uint n_dims, /*!< in: dimensions. */
|
||||
double* mbr); /*!< in/out: mbr. */
|
||||
|
@ -431,7 +431,6 @@ extern const char* TROUBLESHOOTING_MSG;
|
||||
extern const char* TROUBLESHOOT_DATADICT_MSG;
|
||||
extern const char* BUG_REPORT_MSG;
|
||||
extern const char* FORCE_RECOVERY_MSG;
|
||||
extern const char* ERROR_CREATING_MSG;
|
||||
extern const char* OPERATING_SYSTEM_ERROR_MSG;
|
||||
extern const char* FOREIGN_KEY_CONSTRAINTS_MSG;
|
||||
extern const char* SET_TRANSACTION_MSG;
|
||||
|
@ -190,23 +190,13 @@ blocks from the buffer pool: it only checks what is lsn of the oldest
|
||||
modification in the pool, and writes information about the lsn in
|
||||
log files. Use log_make_checkpoint_at() to flush also the pool.
|
||||
@param[in] sync whether to wait for the write to complete
|
||||
@param[in] write_always force a write even if no log
|
||||
has been generated since the latest checkpoint
|
||||
@return true if success, false if a checkpoint write was already running */
|
||||
bool
|
||||
log_checkpoint(
|
||||
bool sync,
|
||||
bool write_always);
|
||||
bool log_checkpoint(bool sync);
|
||||
|
||||
/** Make a checkpoint at or after a specified LSN.
|
||||
@param[in] lsn the log sequence number, or LSN_MAX
|
||||
for the latest LSN
|
||||
@param[in] write_always force a write even if no log
|
||||
has been generated since the latest checkpoint */
|
||||
void
|
||||
log_make_checkpoint_at(
|
||||
lsn_t lsn,
|
||||
bool write_always);
|
||||
for the latest LSN */
|
||||
void log_make_checkpoint_at(lsn_t lsn);
|
||||
|
||||
/****************************************************************//**
|
||||
Makes a checkpoint at the latest lsn and writes it to first page of each
|
||||
|
@ -69,16 +69,6 @@ Initiates the rollback of active transactions. */
|
||||
void
|
||||
recv_recovery_rollback_active(void);
|
||||
/*===============================*/
|
||||
/******************************************************//**
|
||||
Resets the logs. The contents of log files will be lost! */
|
||||
void
|
||||
recv_reset_logs(
|
||||
/*============*/
|
||||
lsn_t lsn); /*!< in: reset to this lsn
|
||||
rounded up to be divisible by
|
||||
OS_FILE_LOG_BLOCK_SIZE, after
|
||||
which we add
|
||||
LOG_BLOCK_HDR_SIZE */
|
||||
/** Clean up after recv_sys_init() */
|
||||
void
|
||||
recv_sys_close();
|
||||
|
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