Merge 10.4 into 10.5
This commit is contained in:
commit
0792aff161
@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2021, MariaDB Corporation.
|
||||
# Copyright (c) 2011, 2022, 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
|
||||
@ -107,12 +107,12 @@ ELSEIF(RPM)
|
||||
SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
|
||||
SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "")
|
||||
SET(WITH_PCRE system CACHE STRING "")
|
||||
IF(RPM MATCHES "fedora|centos|rhel")
|
||||
IF(RPM MATCHES "fedora|centos|rhel|rocky|alma")
|
||||
SET(WITH_INNODB_BZIP2 OFF CACHE STRING "")
|
||||
SET(WITH_INNODB_LZO OFF CACHE STRING "")
|
||||
SET(WITH_ROCKSDB_BZip2 OFF CACHE STRING "")
|
||||
ENDIF()
|
||||
IF(RPM MATCHES "opensuse|sles|centos|rhel")
|
||||
IF(RPM MATCHES "opensuse|sles|centos|rhel|rocky|alma")
|
||||
SET(WITH_INNODB_LZ4 OFF CACHE STRING "")
|
||||
SET(WITH_ROCKSDB_LZ4 OFF CACHE STRING "")
|
||||
SET(GRN_WITH_LZ4 no CACHE STRING "")
|
||||
|
@ -455,7 +455,7 @@ log_online_open_bitmap_file_read_only(
|
||||
bitmap_file->size = os_file_get_size(bitmap_file->file);
|
||||
bitmap_file->offset = 0;
|
||||
|
||||
#ifdef UNIV_LINUX
|
||||
#ifdef __linux__
|
||||
posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
posix_fadvise(bitmap_file->file, 0, 0, POSIX_FADV_NOREUSE);
|
||||
#endif
|
||||
|
@ -1050,7 +1050,7 @@ static inline char *dlerror(void)
|
||||
{
|
||||
static char win_errormsg[2048];
|
||||
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
0, GetLastError(), 0, win_errormsg, 2048, NULL);
|
||||
0, GetLastError(), MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), win_errormsg, 2048, NULL);
|
||||
return win_errormsg;
|
||||
}
|
||||
#define HAVE_DLOPEN 1
|
||||
|
@ -21,7 +21,7 @@ t1 CREATE TABLE `t1` (
|
||||
`c7` binary(1) DEFAULT NULL,
|
||||
`c8` varbinary(10) DEFAULT NULL,
|
||||
`c9` geometry DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=binary COLLATE=binary
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=binary
|
||||
INSERT INTO t1 VALUES ('tinyblob-text readable', 'blob-text readable',
|
||||
'mediumblob-text readable', 'longblob-text readable',
|
||||
'text readable', b'1', 'c', 'variable',
|
||||
|
@ -3171,7 +3171,7 @@ CREATE TABLE t1(a ENUM(0x6100,0x6200,0x6300) CHARACTER SET 'Binary');
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` enum('a\0','b\0','c\0') CHARACTER SET binary COLLATE binary DEFAULT NULL
|
||||
`a` enum('a\0','b\0','c\0') CHARACTER SET binary DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO t1 VALUES (1),(2),(3);
|
||||
SELECT HEX(a) FROM t1 ORDER BY a;
|
||||
@ -3269,7 +3269,7 @@ CREATE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary', d JSON);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c` enum('\0a') CHARACTER SET binary COLLATE binary DEFAULT NULL,
|
||||
`c` enum('\0a') CHARACTER SET binary DEFAULT NULL,
|
||||
`d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`d`))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO t1 (c) VALUES (1);
|
||||
@ -3284,7 +3284,7 @@ d INT DEFAULT NULL CHECK (d>0)
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c` enum('\0a') CHARACTER SET binary COLLATE binary DEFAULT NULL,
|
||||
`c` enum('\0a') CHARACTER SET binary DEFAULT NULL,
|
||||
`d` int(11) DEFAULT NULL CHECK (`d` > 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO t1 VALUES (1,1);
|
||||
@ -3296,7 +3296,7 @@ CREATE TABLE t1(c ENUM(0x0061) CHARACTER SET 'Binary' CHECK (c>0));
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c` enum('\0a') CHARACTER SET binary COLLATE binary DEFAULT NULL CHECK (`c` > 0)
|
||||
`c` enum('\0a') CHARACTER SET binary DEFAULT NULL CHECK (`c` > 0)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO t1 VALUES (1);
|
||||
SELECT HEX(c) FROM t1;
|
||||
@ -3307,6 +3307,50 @@ DROP TABLE t1;
|
||||
# End of 10.2 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-29561 SHOW CREATE TABLE produces syntactically incorrect structure
|
||||
#
|
||||
CREATE TABLE t1 (a ENUM('x') CHARACTER SET BINARY);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` enum('x') CHARACTER SET binary DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE `t1` (
|
||||
`a` enum('x') CHARACTER SET binary DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT ) CHARSET=binary;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=binary
|
||||
DROP TABLE t1;
|
||||
CREATE DATABASE db1 CHARACTER SET BINARY;
|
||||
SHOW CREATE DATABASE db1;
|
||||
Database Create Database
|
||||
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET binary */
|
||||
DROP DATABASE db1;
|
||||
CREATE FUNCTION f1() RETURNS ENUM('a') CHARACTER SET binary RETURN NULL;
|
||||
SHOW CREATE FUNCTION f1;
|
||||
Function sql_mode Create Function character_set_client collation_connection Database Collation
|
||||
f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS enum('a') CHARSET binary
|
||||
RETURN NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP FUNCTION f1;
|
||||
CREATE FUNCTION f1(a ENUM('a') CHARACTER SET binary) RETURNS INT RETURN NULL;
|
||||
SHOW CREATE FUNCTION f1;
|
||||
Function sql_mode Create Function character_set_client collation_connection Database Collation
|
||||
f1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`(a ENUM('a') CHARACTER SET binary) RETURNS int(11)
|
||||
RETURN NULL latin1 latin1_swedish_ci latin1_swedish_ci
|
||||
DROP FUNCTION f1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
#
|
||||
# Start of 10.5 tests
|
||||
#
|
||||
#
|
||||
|
@ -157,6 +157,42 @@ DROP TABLE t1;
|
||||
--echo # End of 10.2 tests
|
||||
--echo #
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29561 SHOW CREATE TABLE produces syntactically incorrect structure
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a ENUM('x') CHARACTER SET BINARY);
|
||||
SHOW CREATE TABLE t1;
|
||||
let $def= query_get_value(show create table t1,'Create Table',1);
|
||||
DROP TABLE t1;
|
||||
eval $def;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1 (a INT ) CHARSET=binary;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE DATABASE db1 CHARACTER SET BINARY;
|
||||
SHOW CREATE DATABASE db1;
|
||||
DROP DATABASE db1;
|
||||
|
||||
CREATE FUNCTION f1() RETURNS ENUM('a') CHARACTER SET binary RETURN NULL;
|
||||
SHOW CREATE FUNCTION f1;
|
||||
DROP FUNCTION f1;
|
||||
|
||||
CREATE FUNCTION f1(a ENUM('a') CHARACTER SET binary) RETURNS INT RETURN NULL;
|
||||
SHOW CREATE FUNCTION f1;
|
||||
DROP FUNCTION f1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # Start of 10.5 tests
|
||||
--echo #
|
||||
|
@ -7907,7 +7907,7 @@ CREATE TABLE t1(c ENUM('aaaaaaaa') CHARACTER SET 'Binary',d JSON);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c` enum('\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary COLLATE binary DEFAULT NULL,
|
||||
`c` enum('\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL,
|
||||
`d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`d`))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO t1 (c) VALUES (1);
|
||||
@ -7919,7 +7919,7 @@ CREATE OR REPLACE TABLE t1(c ENUM('aaaaaaaaa') CHARACTER SET 'Binary',d JSON);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c` enum('\0a\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary COLLATE binary DEFAULT NULL,
|
||||
`c` enum('\0a\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL,
|
||||
`d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`d`))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO t1 (c) VALUES (1);
|
||||
@ -7931,7 +7931,7 @@ CREATE OR REPLACE TABLE t1(c ENUM('aaaaaaaaaa') CHARACTER SET 'Binary',d JSON);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c` enum('\0a\0a\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary COLLATE binary DEFAULT NULL,
|
||||
`c` enum('\0a\0a\0a\0a\0a\0a\0a\0a\0a\0a') CHARACTER SET binary DEFAULT NULL,
|
||||
`d` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`d`))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO t1 (c) VALUES (1);
|
||||
|
@ -2878,7 +2878,7 @@ CREATE TABLE t1(c1 ENUM('a','b','ac') CHARACTER SET 'Binary',c2 JSON,c3 INT);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` enum('\0\0\0a','\0\0\0b','\0\0\0a\0\0\0c') CHARACTER SET binary COLLATE binary DEFAULT NULL,
|
||||
`c1` enum('\0\0\0a','\0\0\0b','\0\0\0a\0\0\0c') CHARACTER SET binary DEFAULT NULL,
|
||||
`c2` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`c2`)),
|
||||
`c3` int(11) DEFAULT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
|
@ -7969,7 +7969,7 @@ CREATE TABLE t1(c1 SET('a') COLLATE 'Binary',c2 JSON);
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`c1` set('\0\0\0a') CHARACTER SET binary COLLATE binary DEFAULT NULL,
|
||||
`c1` set('\0\0\0a') CHARACTER SET binary DEFAULT NULL,
|
||||
`c2` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`c2`))
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
DROP TABLE t1;
|
||||
|
@ -12,13 +12,13 @@ SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
connection node_1;
|
||||
SHOW CREATE TABLE t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`f1` int(11) DEFAULT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
DROP TABLE t1;
|
||||
DROP TABLE ten;
|
||||
CALL mtr.add_suppression("Ignoring error 'Duplicate entry '111110' for key 'PRIMARY'' on query.");
|
||||
|
@ -181,3 +181,10 @@ test/parent 1 2
|
||||
DROP TABLE child;
|
||||
DROP TABLE parent;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
|
||||
#
|
||||
# MDEV-29479 I_S.INNODB_SYS_TABLESPACES doesn't have
|
||||
# temporary tablespace information
|
||||
#
|
||||
SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE name like 'innodb_temporary';
|
||||
SPACE
|
||||
4294967294
|
||||
|
@ -141,3 +141,9 @@ DROP TABLE child;
|
||||
|
||||
DROP TABLE parent;
|
||||
SET GLOBAL innodb_purge_rseg_truncate_frequency=@save_frequency;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29479 I_S.INNODB_SYS_TABLESPACES doesn't have
|
||||
--echo # temporary tablespace information
|
||||
--echo #
|
||||
SELECT SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES WHERE name like 'innodb_temporary';
|
||||
|
@ -56,7 +56,7 @@ connection default;
|
||||
grant select on *.* to role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 19
|
||||
Debug_role_merges_global 20
|
||||
Debug_role_merges_db 0
|
||||
Debug_role_merges_table 0
|
||||
Debug_role_merges_column 0
|
||||
@ -106,7 +106,7 @@ connection default;
|
||||
revoke select on *.* from role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 0
|
||||
Debug_role_merges_table 0
|
||||
Debug_role_merges_column 0
|
||||
@ -124,8 +124,8 @@ connection default;
|
||||
grant select on mysql.* to role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 8
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 9
|
||||
Debug_role_merges_table 0
|
||||
Debug_role_merges_column 0
|
||||
Debug_role_merges_routine 0
|
||||
@ -164,8 +164,8 @@ connection default;
|
||||
revoke select on mysql.* from role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 0
|
||||
Debug_role_merges_column 0
|
||||
Debug_role_merges_routine 0
|
||||
@ -177,9 +177,9 @@ connection default;
|
||||
grant select on mysql.roles_mapping to role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 8
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 9
|
||||
Debug_role_merges_column 0
|
||||
Debug_role_merges_routine 0
|
||||
connection foo;
|
||||
@ -217,9 +217,9 @@ connection default;
|
||||
revoke select on mysql.roles_mapping from role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 16
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 17
|
||||
Debug_role_merges_column 0
|
||||
Debug_role_merges_routine 0
|
||||
connection foo;
|
||||
@ -230,10 +230,10 @@ connection default;
|
||||
grant select(User) on mysql.roles_mapping to role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 24
|
||||
Debug_role_merges_column 8
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 26
|
||||
Debug_role_merges_column 9
|
||||
Debug_role_merges_routine 0
|
||||
connection foo;
|
||||
select count(*) from mysql.roles_mapping;
|
||||
@ -272,10 +272,10 @@ connection default;
|
||||
grant select(Host) on mysql.roles_mapping to role3;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 30
|
||||
Debug_role_merges_column 14
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 33
|
||||
Debug_role_merges_column 16
|
||||
Debug_role_merges_routine 0
|
||||
connection foo;
|
||||
select count(concat(User,Host,Role)) from mysql.roles_mapping;
|
||||
@ -312,10 +312,10 @@ connection default;
|
||||
revoke select(User) on mysql.roles_mapping from role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 38
|
||||
Debug_role_merges_column 22
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 41
|
||||
Debug_role_merges_column 24
|
||||
Debug_role_merges_routine 0
|
||||
connection foo;
|
||||
select count(concat(User,Host)) from mysql.roles_mapping;
|
||||
@ -327,10 +327,10 @@ connection default;
|
||||
revoke select(Host) on mysql.roles_mapping from role3;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 44
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 47
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 0
|
||||
connection foo;
|
||||
select count(concat(Host)) from mysql.roles_mapping;
|
||||
@ -342,11 +342,11 @@ create function fn1() returns char(10) return "fn1";
|
||||
grant execute on procedure test.pr1 to role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 44
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 8
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 47
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 9
|
||||
connection foo;
|
||||
call pr1();
|
||||
ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.pr1'
|
||||
@ -360,11 +360,11 @@ connection default;
|
||||
grant execute on function test.fn1 to role5;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 44
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 13
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 47
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 15
|
||||
connection foo;
|
||||
select fn1();
|
||||
fn1()
|
||||
@ -373,11 +373,11 @@ connection default;
|
||||
revoke execute on procedure test.pr1 from role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 44
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 21
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 47
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 23
|
||||
connection foo;
|
||||
call pr1();
|
||||
ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.pr1'
|
||||
@ -388,11 +388,11 @@ connection default;
|
||||
revoke execute on function test.fn1 from role5;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 44
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 47
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
connection foo;
|
||||
select fn1();
|
||||
ERROR 42000: execute command denied to user 'foo'@'localhost' for routine 'test.fn1'
|
||||
@ -403,67 +403,67 @@ drop function fn1;
|
||||
grant select on mysql.roles_mapping to role3;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 50
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 54
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
grant select on mysql.roles_mapping to role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 53
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 58
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
revoke select on mysql.roles_mapping from role3;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 54
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 59
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
revoke select on mysql.roles_mapping from role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 16
|
||||
Debug_role_merges_table 62
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 17
|
||||
Debug_role_merges_table 67
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
grant select on mysql.* to role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 24
|
||||
Debug_role_merges_table 62
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 26
|
||||
Debug_role_merges_table 67
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
grant select on test.* to role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 32
|
||||
Debug_role_merges_table 62
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 35
|
||||
Debug_role_merges_table 67
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
revoke select on mysql.* from role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 40
|
||||
Debug_role_merges_table 62
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 43
|
||||
Debug_role_merges_table 67
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
revoke select on test.* from role1;
|
||||
show status like 'debug%';
|
||||
Variable_name Value
|
||||
Debug_role_merges_global 27
|
||||
Debug_role_merges_db 48
|
||||
Debug_role_merges_table 62
|
||||
Debug_role_merges_column 28
|
||||
Debug_role_merges_routine 26
|
||||
Debug_role_merges_global 29
|
||||
Debug_role_merges_db 51
|
||||
Debug_role_merges_table 67
|
||||
Debug_role_merges_column 30
|
||||
Debug_role_merges_routine 28
|
||||
connection default;
|
||||
drop user foo@localhost;
|
||||
drop role role1;
|
||||
|
136
mysql-test/suite/roles/role_grant_propagate-29458.result
Normal file
136
mysql-test/suite/roles/role_grant_propagate-29458.result
Normal file
@ -0,0 +1,136 @@
|
||||
create user foo;
|
||||
create database some_db;
|
||||
create table some_db.t1 (a int, b int, secret int);
|
||||
CREATE PROCEDURE some_db.p1 (OUT param1 INT)
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO param1 FROM some_db.t1;
|
||||
END;
|
||||
//
|
||||
CREATE FUNCTION some_db.f1 (param1 INT) RETURNS INT
|
||||
BEGIN
|
||||
DECLARE c INT;
|
||||
SET c = 100;
|
||||
RETURN param1 + c;
|
||||
END;
|
||||
//
|
||||
#
|
||||
# These roles will form a two level hierarchy.
|
||||
# The "select" role will have the select privilege, while
|
||||
# the active role will inherit the select role.
|
||||
#
|
||||
# The active role will be granted a different privilege but on the same
|
||||
# level (global, database, table, proc respectively) *after* the 'select'
|
||||
# role has been granted its select privilege.
|
||||
#
|
||||
create role r_select_global;
|
||||
create role r_active_global;
|
||||
create role r_select_database;
|
||||
create role r_active_database;
|
||||
create role r_select_table;
|
||||
create role r_active_table;
|
||||
create role r_select_column;
|
||||
create role r_active_column;
|
||||
create role r_execute_proc;
|
||||
create role r_active_proc;
|
||||
create role r_execute_func;
|
||||
create role r_active_func;
|
||||
grant r_select_global to r_active_global;
|
||||
grant r_select_database to r_active_database;
|
||||
grant r_select_table to r_active_table;
|
||||
grant r_select_column to r_active_column;
|
||||
grant r_execute_proc to r_active_proc;
|
||||
grant r_execute_func to r_active_func;
|
||||
#
|
||||
# These 3 roles form a chain, where only the upper level has select
|
||||
# privileges and the middle level will receive a grant for the same level
|
||||
# privilege, but different kind (for example select on upper and insert
|
||||
# on middle).
|
||||
#
|
||||
# The lower level should inherit both rights.
|
||||
#
|
||||
create role upper_level;
|
||||
create role middle_level;
|
||||
create role lower_level;
|
||||
grant upper_level to middle_level;
|
||||
grant middle_level to lower_level;
|
||||
grant r_active_global to foo;
|
||||
grant r_active_database to foo;
|
||||
grant r_active_table to foo;
|
||||
grant r_active_column to foo;
|
||||
grant r_active_proc to foo;
|
||||
grant r_active_func to foo;
|
||||
grant lower_level to foo;
|
||||
grant select on *.* to r_select_global;
|
||||
grant select on some_db.* to r_select_database;
|
||||
grant select on some_db.t1 to r_select_table;
|
||||
grant select(a) on some_db.t1 to r_select_column;
|
||||
grant select on *.* to upper_level;
|
||||
grant execute on procedure some_db.p1 to r_execute_proc;
|
||||
grant execute on function some_db.f1 to r_execute_func;
|
||||
#
|
||||
# Granting a privilege different than select on the corresponding level.
|
||||
# This tests that the base role correctly inherits its granted roles
|
||||
# privileges.
|
||||
#
|
||||
grant insert on *.* to r_active_global;
|
||||
grant insert on some_db.* to r_active_database;
|
||||
grant insert on some_db.t1 to r_active_table;
|
||||
grant insert(a) on some_db.t1 to r_active_column;
|
||||
grant insert on *.* to middle_level;
|
||||
grant alter routine on procedure some_db.p1 to r_active_proc;
|
||||
grant alter routine on function some_db.f1 to r_active_func;
|
||||
connect con1, localhost, foo,,;
|
||||
select * from some_db.t1;
|
||||
ERROR 42000: SELECT command denied to user 'foo'@'localhost' for table 't1'
|
||||
#
|
||||
# Before MDEV-29458 fix, all these commands would return
|
||||
# ER_TABLEACCESS_DENIED_ERROR
|
||||
#
|
||||
set role r_active_global;
|
||||
select * from some_db.t1;
|
||||
a b secret
|
||||
set role r_active_database;
|
||||
select * from some_db.t1;
|
||||
a b secret
|
||||
set role r_active_table;
|
||||
select * from some_db.t1;
|
||||
a b secret
|
||||
set role r_active_column;
|
||||
select a from some_db.t1;
|
||||
a
|
||||
set role lower_level;
|
||||
select * from some_db.t1;
|
||||
a b secret
|
||||
set role r_active_proc;
|
||||
set @var=100;
|
||||
call some_db.p1(@var);
|
||||
set role r_active_func;
|
||||
select some_db.f1(10);
|
||||
some_db.f1(10)
|
||||
110
|
||||
disconnect con1;
|
||||
#
|
||||
# Cleanup.
|
||||
#
|
||||
connection default;
|
||||
drop database some_db;
|
||||
drop role r_select_global, r_select_database, r_select_table, r_select_column;
|
||||
drop role r_active_global, r_active_database, r_active_table, r_active_column;
|
||||
drop role r_execute_proc, r_execute_func;
|
||||
drop role r_active_proc, r_active_func;
|
||||
drop role upper_level, middle_level, lower_level;
|
||||
drop user foo;
|
||||
#
|
||||
# Test that dropping of roles clears the intermediate generated
|
||||
# (such as an `acl_dbs` element with 0 init_access, but with access != 0)
|
||||
# datastructures.
|
||||
#
|
||||
create role test_role1;
|
||||
create role test_role2;
|
||||
grant test_role2 to test_role1;
|
||||
grant select on mysql.* to test_role2;
|
||||
grant select on mysql.user to test_role2;
|
||||
grant select(user) on mysql.user to test_role2;
|
||||
drop role test_role1, test_role2;
|
||||
create role test_role1;
|
||||
drop role test_role1;
|
163
mysql-test/suite/roles/role_grant_propagate-29458.test
Normal file
163
mysql-test/suite/roles/role_grant_propagate-29458.test
Normal file
@ -0,0 +1,163 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
create user foo;
|
||||
create database some_db;
|
||||
create table some_db.t1 (a int, b int, secret int);
|
||||
|
||||
delimiter //;
|
||||
CREATE PROCEDURE some_db.p1 (OUT param1 INT)
|
||||
BEGIN
|
||||
SELECT COUNT(*) INTO param1 FROM some_db.t1;
|
||||
END;
|
||||
//
|
||||
delimiter ;//
|
||||
|
||||
delimiter //;
|
||||
CREATE FUNCTION some_db.f1 (param1 INT) RETURNS INT
|
||||
BEGIN
|
||||
DECLARE c INT;
|
||||
SET c = 100;
|
||||
RETURN param1 + c;
|
||||
END;
|
||||
//
|
||||
delimiter ;//
|
||||
|
||||
--echo #
|
||||
--echo # These roles will form a two level hierarchy.
|
||||
--echo # The "select" role will have the select privilege, while
|
||||
--echo # the active role will inherit the select role.
|
||||
--echo #
|
||||
--echo # The active role will be granted a different privilege but on the same
|
||||
--echo # level (global, database, table, proc respectively) *after* the 'select'
|
||||
--echo # role has been granted its select privilege.
|
||||
--echo #
|
||||
|
||||
create role r_select_global;
|
||||
create role r_active_global;
|
||||
|
||||
create role r_select_database;
|
||||
create role r_active_database;
|
||||
|
||||
create role r_select_table;
|
||||
create role r_active_table;
|
||||
|
||||
create role r_select_column;
|
||||
create role r_active_column;
|
||||
|
||||
create role r_execute_proc;
|
||||
create role r_active_proc;
|
||||
|
||||
create role r_execute_func;
|
||||
create role r_active_func;
|
||||
|
||||
grant r_select_global to r_active_global;
|
||||
grant r_select_database to r_active_database;
|
||||
grant r_select_table to r_active_table;
|
||||
grant r_select_column to r_active_column;
|
||||
grant r_execute_proc to r_active_proc;
|
||||
grant r_execute_func to r_active_func;
|
||||
|
||||
--echo #
|
||||
--echo # These 3 roles form a chain, where only the upper level has select
|
||||
--echo # privileges and the middle level will receive a grant for the same level
|
||||
--echo # privilege, but different kind (for example select on upper and insert
|
||||
--echo # on middle).
|
||||
--echo #
|
||||
--echo # The lower level should inherit both rights.
|
||||
--echo #
|
||||
create role upper_level;
|
||||
create role middle_level;
|
||||
create role lower_level;
|
||||
|
||||
grant upper_level to middle_level;
|
||||
grant middle_level to lower_level;
|
||||
|
||||
grant r_active_global to foo;
|
||||
grant r_active_database to foo;
|
||||
grant r_active_table to foo;
|
||||
grant r_active_column to foo;
|
||||
grant r_active_proc to foo;
|
||||
grant r_active_func to foo;
|
||||
grant lower_level to foo;
|
||||
|
||||
grant select on *.* to r_select_global;
|
||||
grant select on some_db.* to r_select_database;
|
||||
grant select on some_db.t1 to r_select_table;
|
||||
grant select(a) on some_db.t1 to r_select_column;
|
||||
grant select on *.* to upper_level;
|
||||
|
||||
grant execute on procedure some_db.p1 to r_execute_proc;
|
||||
grant execute on function some_db.f1 to r_execute_func;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Granting a privilege different than select on the corresponding level.
|
||||
--echo # This tests that the base role correctly inherits its granted roles
|
||||
--echo # privileges.
|
||||
--echo #
|
||||
grant insert on *.* to r_active_global;
|
||||
grant insert on some_db.* to r_active_database;
|
||||
grant insert on some_db.t1 to r_active_table;
|
||||
grant insert(a) on some_db.t1 to r_active_column;
|
||||
grant insert on *.* to middle_level;
|
||||
|
||||
grant alter routine on procedure some_db.p1 to r_active_proc;
|
||||
grant alter routine on function some_db.f1 to r_active_func;
|
||||
|
||||
--connect (con1, localhost, foo,,)
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from some_db.t1;
|
||||
|
||||
--echo #
|
||||
--echo # Before MDEV-29458 fix, all these commands would return
|
||||
--echo # ER_TABLEACCESS_DENIED_ERROR
|
||||
--echo #
|
||||
set role r_active_global;
|
||||
select * from some_db.t1;
|
||||
set role r_active_database;
|
||||
select * from some_db.t1;
|
||||
set role r_active_table;
|
||||
select * from some_db.t1;
|
||||
set role r_active_column;
|
||||
select a from some_db.t1;
|
||||
set role lower_level;
|
||||
select * from some_db.t1;
|
||||
|
||||
set role r_active_proc;
|
||||
set @var=100;
|
||||
call some_db.p1(@var);
|
||||
|
||||
set role r_active_func;
|
||||
select some_db.f1(10);
|
||||
|
||||
disconnect con1;
|
||||
|
||||
--echo #
|
||||
--echo # Cleanup.
|
||||
--echo #
|
||||
connection default;
|
||||
|
||||
drop database some_db;
|
||||
drop role r_select_global, r_select_database, r_select_table, r_select_column;
|
||||
drop role r_active_global, r_active_database, r_active_table, r_active_column;
|
||||
drop role r_execute_proc, r_execute_func;
|
||||
drop role r_active_proc, r_active_func;
|
||||
drop role upper_level, middle_level, lower_level;
|
||||
drop user foo;
|
||||
|
||||
--echo #
|
||||
--echo # Test that dropping of roles clears the intermediate generated
|
||||
--echo # (such as an `acl_dbs` element with 0 init_access, but with access != 0)
|
||||
--echo # datastructures.
|
||||
--echo #
|
||||
create role test_role1;
|
||||
create role test_role2;
|
||||
|
||||
grant test_role2 to test_role1;
|
||||
grant select on mysql.* to test_role2;
|
||||
grant select on mysql.user to test_role2;
|
||||
grant select(user) on mysql.user to test_role2;
|
||||
drop role test_role1, test_role2;
|
||||
|
||||
create role test_role1;
|
||||
drop role test_role1;
|
38
mysql-test/suite/roles/roles_tables_priv-29465.result
Normal file
38
mysql-test/suite/roles/roles_tables_priv-29465.result
Normal file
@ -0,0 +1,38 @@
|
||||
create user foo;
|
||||
create database some_db;
|
||||
create table some_db.t1 (a int, b int, secret int);
|
||||
create role r_select_column;
|
||||
create role r_active_column;
|
||||
grant r_select_column to r_active_column;
|
||||
grant r_active_column to foo;
|
||||
grant select(a) on some_db.t1 to r_select_column;
|
||||
select * from mysql.tables_priv order by user;
|
||||
Host Db User Table_name Grantor Timestamp Table_priv Column_priv
|
||||
localhost mysql mariadb.sys global_priv root@localhost 0000-00-00 00:00:00 Select,Delete
|
||||
some_db r_select_column t1 root@localhost 0000-00-00 00:00:00 Select
|
||||
grant insert(a) on some_db.t1 to r_active_column;
|
||||
select * from mysql.tables_priv order by user;
|
||||
Host Db User Table_name Grantor Timestamp Table_priv Column_priv
|
||||
localhost mysql mariadb.sys global_priv root@localhost 0000-00-00 00:00:00 Select,Delete
|
||||
some_db r_active_column t1 root@localhost 0000-00-00 00:00:00 Insert
|
||||
some_db r_select_column t1 root@localhost 0000-00-00 00:00:00 Select
|
||||
connect con1, localhost, foo,,;
|
||||
insert into some_db.t1(a) values (1);
|
||||
ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table 't1'
|
||||
set role r_active_column;
|
||||
insert into some_db.t1(a) values (1);
|
||||
disconnect con1;
|
||||
connection default;
|
||||
revoke insert(a) on some_db.t1 from r_active_column;
|
||||
connect con1, localhost, foo,,;
|
||||
insert into some_db.t1(a) values (1);
|
||||
ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table 't1'
|
||||
set role r_active_column;
|
||||
insert into some_db.t1(a) values (1);
|
||||
ERROR 42000: INSERT command denied to user 'foo'@'localhost' for table 't1'
|
||||
disconnect con1;
|
||||
connection default;
|
||||
drop role r_select_column;
|
||||
drop role r_active_column;
|
||||
drop user foo;
|
||||
drop database some_db;
|
40
mysql-test/suite/roles/roles_tables_priv-29465.test
Normal file
40
mysql-test/suite/roles/roles_tables_priv-29465.test
Normal file
@ -0,0 +1,40 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
create user foo;
|
||||
create database some_db;
|
||||
create table some_db.t1 (a int, b int, secret int);
|
||||
|
||||
create role r_select_column;
|
||||
create role r_active_column;
|
||||
grant r_select_column to r_active_column;
|
||||
grant r_active_column to foo;
|
||||
|
||||
grant select(a) on some_db.t1 to r_select_column;
|
||||
select * from mysql.tables_priv order by user;
|
||||
grant insert(a) on some_db.t1 to r_active_column;
|
||||
select * from mysql.tables_priv order by user;
|
||||
|
||||
--connect (con1, localhost, foo,,)
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
insert into some_db.t1(a) values (1);
|
||||
set role r_active_column;
|
||||
insert into some_db.t1(a) values (1);
|
||||
disconnect con1;
|
||||
|
||||
connection default;
|
||||
revoke insert(a) on some_db.t1 from r_active_column;
|
||||
|
||||
--connect (con1, localhost, foo,,)
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
insert into some_db.t1(a) values (1);
|
||||
set role r_active_column;
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
insert into some_db.t1(a) values (1);
|
||||
disconnect con1;
|
||||
|
||||
connection default;
|
||||
|
||||
drop role r_select_column;
|
||||
drop role r_active_column;
|
||||
drop user foo;
|
||||
drop database some_db;
|
@ -1074,8 +1074,11 @@ sp_returns_type(THD *thd, String &result, const sp_head *sp)
|
||||
{
|
||||
result.append(STRING_WITH_LEN(" CHARSET "));
|
||||
result.append(field->charset()->csname);
|
||||
result.append(STRING_WITH_LEN(" COLLATE "));
|
||||
result.append(field->charset()->name);
|
||||
if (Charset(field->charset()).can_have_collate_clause())
|
||||
{
|
||||
result.append(STRING_WITH_LEN(" COLLATE "));
|
||||
result.append(field->charset()->name);
|
||||
}
|
||||
}
|
||||
|
||||
delete field;
|
||||
|
@ -5386,7 +5386,7 @@ GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
|
||||
|
||||
GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
|
||||
const char *t, privilege_t p, privilege_t c)
|
||||
:GRANT_NAME(h,d,u,t,p, FALSE), cols(c), init_cols(NO_ACL)
|
||||
:GRANT_NAME(h,d,u,t,p, FALSE), cols(c), init_cols(c)
|
||||
{
|
||||
init_hash();
|
||||
}
|
||||
@ -6177,6 +6177,7 @@ static int count_subgraph_nodes(ACL_ROLE *role, ACL_ROLE *grantee, void *context
|
||||
}
|
||||
|
||||
static int merge_role_privileges(ACL_ROLE *, ACL_ROLE *, void *);
|
||||
static bool merge_one_role_privileges(ACL_ROLE *grantee, PRIVS_TO_MERGE what);
|
||||
|
||||
/**
|
||||
rebuild privileges of all affected roles
|
||||
@ -6195,6 +6196,11 @@ static void propagate_role_grants(ACL_ROLE *role,
|
||||
mysql_mutex_assert_owner(&acl_cache->lock);
|
||||
PRIVS_TO_MERGE data= { what, db, name };
|
||||
|
||||
/*
|
||||
Before updating grants to roles that inherit from this role, ensure that
|
||||
the effective grants on this role are up-to-date from *its* granted roles.
|
||||
*/
|
||||
merge_one_role_privileges(role, data);
|
||||
/*
|
||||
Changing privileges of a role causes all other roles that had
|
||||
this role granted to them to have their rights invalidated.
|
||||
@ -6643,7 +6649,6 @@ static int table_name_sort(GRANT_TABLE * const *tbl1, GRANT_TABLE * const *tbl2)
|
||||
*/
|
||||
static int update_role_columns(GRANT_TABLE *merged,
|
||||
GRANT_TABLE **cur, GRANT_TABLE **last)
|
||||
|
||||
{
|
||||
privilege_t rights __attribute__((unused)) (NO_ACL);
|
||||
int changed= 0;
|
||||
@ -6994,11 +6999,12 @@ static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)),
|
||||
return !changed; // don't recurse into the subgraph if privs didn't change
|
||||
}
|
||||
|
||||
static bool merge_one_role_privileges(ACL_ROLE *grantee)
|
||||
static
|
||||
bool merge_one_role_privileges(ACL_ROLE *grantee,
|
||||
PRIVS_TO_MERGE what)
|
||||
{
|
||||
PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 };
|
||||
grantee->counter= 1;
|
||||
return merge_role_privileges(0, grantee, &data);
|
||||
return merge_role_privileges(0, grantee, &what);
|
||||
}
|
||||
|
||||
/*****************************************************************
|
||||
@ -7188,15 +7194,15 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
|
||||
/* Find/create cached table grant */
|
||||
grant_table= table_hash_search(Str->host.str, NullS, db_name,
|
||||
Str->user.str, table_name, 1);
|
||||
Str->user.str, table_name, 1);
|
||||
if (!grant_table)
|
||||
{
|
||||
if (revoke_grant)
|
||||
{
|
||||
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
|
||||
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
|
||||
Str->user.str, Str->host.str, table_list->table_name.str);
|
||||
result= TRUE;
|
||||
continue;
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
grant_table= new (&grant_memroot) GRANT_TABLE(Str->host.str, db_name,
|
||||
Str->user.str, table_name,
|
||||
@ -7205,8 +7211,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
if (!grant_table ||
|
||||
column_priv_insert(grant_table))
|
||||
{
|
||||
result= TRUE; /* purecov: deadcode */
|
||||
continue; /* purecov: deadcode */
|
||||
result= TRUE; /* purecov: deadcode */
|
||||
continue; /* purecov: deadcode */
|
||||
}
|
||||
}
|
||||
|
||||
@ -7220,11 +7226,15 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
/* Fix old grants */
|
||||
while ((column = column_iter++))
|
||||
{
|
||||
grant_column = column_hash_search(grant_table,
|
||||
column->column.ptr(),
|
||||
column->column.length());
|
||||
if (grant_column)
|
||||
grant_column->rights&= ~(column->rights | rights);
|
||||
grant_column = column_hash_search(grant_table,
|
||||
column->column.ptr(),
|
||||
column->column.length());
|
||||
if (grant_column)
|
||||
{
|
||||
grant_column->init_rights&= ~(column->rights | rights);
|
||||
// If this is a role, rights will need to be reconstructed.
|
||||
grant_column->rights= grant_column->init_rights;
|
||||
}
|
||||
}
|
||||
/* scan trough all columns to get new column grant */
|
||||
column_priv= NO_ACL;
|
||||
@ -7232,13 +7242,14 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
|
||||
{
|
||||
grant_column= (GRANT_COLUMN*)
|
||||
my_hash_element(&grant_table->hash_columns, idx);
|
||||
grant_column->rights&= ~rights; // Fix other columns
|
||||
column_priv|= grant_column->rights;
|
||||
grant_column->init_rights&= ~rights; // Fix other columns
|
||||
grant_column->rights= grant_column->init_rights;
|
||||
column_priv|= grant_column->init_rights;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
column_priv|= grant_table->cols;
|
||||
column_priv|= grant_table->init_cols;
|
||||
}
|
||||
|
||||
|
||||
@ -7366,23 +7377,24 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list,
|
||||
table_name= table_list->table_name.str;
|
||||
grant_name= routine_hash_search(Str->host.str, NullS, db_name,
|
||||
Str->user.str, table_name, sph, 1);
|
||||
if (!grant_name || !grant_name->init_privs)
|
||||
if (revoke_grant && (!grant_name || !grant_name->init_privs))
|
||||
{
|
||||
if (revoke_grant)
|
||||
{
|
||||
my_error(ER_NONEXISTING_PROC_GRANT, MYF(0),
|
||||
Str->user.str, Str->host.str, table_name);
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
my_error(ER_NONEXISTING_PROC_GRANT, MYF(0),
|
||||
Str->user.str, Str->host.str, table_name);
|
||||
result= TRUE;
|
||||
continue;
|
||||
}
|
||||
if (!grant_name)
|
||||
{
|
||||
DBUG_ASSERT(!revoke_grant);
|
||||
grant_name= new GRANT_NAME(Str->host.str, db_name,
|
||||
Str->user.str, table_name,
|
||||
rights, TRUE);
|
||||
Str->user.str, table_name,
|
||||
rights, TRUE);
|
||||
if (!grant_name ||
|
||||
my_hash_insert(sph->get_priv_hash(), (uchar*) grant_name))
|
||||
my_hash_insert(sph->get_priv_hash(), (uchar*) grant_name))
|
||||
{
|
||||
result= TRUE;
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7719,7 +7731,7 @@ bool mysql_grant_role(THD *thd, List <LEX_USER> &list, bool revoke)
|
||||
Only need to propagate grants when granting/revoking a role to/from
|
||||
a role
|
||||
*/
|
||||
if (role_as_user && merge_one_role_privileges(role_as_user) == 0)
|
||||
if (role_as_user)
|
||||
propagate_role_grants(role_as_user, PRIVS_TO_MERGE::ALL);
|
||||
}
|
||||
|
||||
@ -10336,9 +10348,6 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
|
||||
size_t old_key_length= acl_role->user.length;
|
||||
if (drop)
|
||||
{
|
||||
/* all grants must be revoked from this role by now. propagate this */
|
||||
propagate_role_grants(acl_role, PRIVS_TO_MERGE::ALL);
|
||||
|
||||
// delete the role from cross-reference arrays
|
||||
for (uint i=0; i < acl_role->role_grants.elements; i++)
|
||||
{
|
||||
@ -10354,6 +10363,12 @@ static int handle_grant_struct(enum enum_acl_lists struct_no, bool drop,
|
||||
remove_ptr_from_dynarray(&grantee->role_grants, acl_role);
|
||||
}
|
||||
|
||||
/* Remove all of the role_grants from this role. */
|
||||
delete_dynamic(&acl_role->role_grants);
|
||||
|
||||
/* all grants must be revoked from this role by now. propagate this */
|
||||
propagate_role_grants(acl_role, PRIVS_TO_MERGE::ALL);
|
||||
|
||||
my_hash_delete(&acl_roles, (uchar*) acl_role);
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -113,8 +113,6 @@ void mysql_audit_acquire_plugins(THD *thd, ulong *event_class_mask)
|
||||
{
|
||||
DBUG_ENTER("mysql_audit_acquire_plugins");
|
||||
DBUG_ASSERT(thd);
|
||||
DBUG_ASSERT(!check_audit_mask(mysql_global_audit_mask, event_class_mask));
|
||||
|
||||
if (check_audit_mask(thd->audit_class_mask, event_class_mask))
|
||||
{
|
||||
plugin_foreach(thd, acquire_plugins, MYSQL_AUDIT_PLUGIN, event_class_mask);
|
||||
|
@ -1432,8 +1432,11 @@ bool mysqld_show_create_db(THD *thd, LEX_CSTRING *dbname,
|
||||
buffer.append(STRING_WITH_LEN(" /*!40100"));
|
||||
buffer.append(STRING_WITH_LEN(" DEFAULT CHARACTER SET "));
|
||||
buffer.append(create.default_table_charset->csname);
|
||||
buffer.append(STRING_WITH_LEN(" COLLATE "));
|
||||
buffer.append(create.default_table_charset->name);
|
||||
if (Charset(create.default_table_charset).can_have_collate_clause())
|
||||
{
|
||||
buffer.append(STRING_WITH_LEN(" COLLATE "));
|
||||
buffer.append(create.default_table_charset->name);
|
||||
}
|
||||
buffer.append(STRING_WITH_LEN(" */"));
|
||||
}
|
||||
|
||||
@ -1889,8 +1892,11 @@ static void add_table_options(THD *thd, TABLE *table,
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" DEFAULT CHARSET="));
|
||||
packet->append(share->table_charset->csname);
|
||||
packet->append(STRING_WITH_LEN(" COLLATE="));
|
||||
packet->append(table->s->table_charset->name);
|
||||
if (Charset(table->s->table_charset).can_have_collate_clause())
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" COLLATE="));
|
||||
packet->append(table->s->table_charset->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2170,10 +2176,13 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
||||
{
|
||||
if (field->charset() != share->table_charset)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" CHARACTER SET "));
|
||||
packet->append(field->charset()->csname);
|
||||
packet->append(STRING_WITH_LEN(" COLLATE "));
|
||||
packet->append(field->charset()->name);
|
||||
packet->append(STRING_WITH_LEN(" CHARACTER SET "));
|
||||
packet->append(field->charset()->csname);
|
||||
if (Charset(field->charset()).can_have_collate_clause())
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" COLLATE "));
|
||||
packet->append(field->charset()->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3544,6 +3553,7 @@ union Any_pointer {
|
||||
@param variable [in] Details of the variable.
|
||||
@param value_type [in] Variable type.
|
||||
@param show_type [in] Variable show type.
|
||||
@param status_var [in] Status variable pointer
|
||||
@param charset [out] Character set of the value.
|
||||
@param buff [in,out] Buffer to store the value.
|
||||
(Needs to have enough memory
|
||||
|
@ -193,6 +193,10 @@ public:
|
||||
LEX_CSTRING collation_specific_name() const;
|
||||
bool encoding_allows_reinterpret_as(CHARSET_INFO *cs) const;
|
||||
bool eq_collation_specific_names(CHARSET_INFO *cs) const;
|
||||
bool can_have_collate_clause() const
|
||||
{
|
||||
return m_charset != &my_charset_bin;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
@ -5339,7 +5339,6 @@ Sys_var_rpl_filter::global_value_ptr(THD *thd,
|
||||
}
|
||||
|
||||
rpl_filter= mi->rpl_filter;
|
||||
tmp.length(0);
|
||||
|
||||
mysql_mutex_lock(&LOCK_active_mi);
|
||||
switch (opt_id) {
|
||||
|
@ -553,7 +553,8 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort)
|
||||
if (!tdbp)
|
||||
return rc; // Nothing to do
|
||||
else if (tdbp->GetUse() != USE_OPEN) {
|
||||
if (tdbp->GetAmType() == TYPE_AM_XML)
|
||||
if (tdbp->GetAmType() == TYPE_AM_XML ||
|
||||
tdbp->GetAmType() == TYPE_AM_JSN)
|
||||
tdbp->CloseDB(g); // Opened by GetMaxSize
|
||||
|
||||
return rc;
|
||||
|
@ -515,3 +515,27 @@ Beth 4 Food 17.00
|
||||
Beth 4 Beer 15.00
|
||||
Janet 4 Car 17.00
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
#
|
||||
# MDEV-29426 memory leak on "SHOW INDEX"
|
||||
#
|
||||
CREATE TABLE t1
|
||||
(
|
||||
ISBN CHAR(15) NOT NULL,
|
||||
Language CHAR(2) JPATH='$.LANG',
|
||||
Subject CHAR(32) JPATH='$.SUBJECT',
|
||||
AuthorFN CHAR(128) JPATH='$.AUTHOR[*].FIRSTNAME',
|
||||
AuthorLN CHAR(128) JPATH='$.AUTHOR[*].LASTNAME',
|
||||
Title CHAR(32) JPATH='$.TITLE',
|
||||
Translation CHAR(32) JPATH='$.TRANSLATED.PREFIX',
|
||||
TranslatorFN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.FIRSTNAME',
|
||||
TranslatorLN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.LASTNAME',
|
||||
Publisher CHAR(20) JPATH='$.PUBLISHER.NAME',
|
||||
Location CHAR(16) JPATH='$.PUBLISHER.PLACE',
|
||||
Year int(4) JPATH='$.DATEPUB',
|
||||
INDEX IX(ISBN)
|
||||
)
|
||||
ENGINE=CONNECT TABLE_TYPE=BSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0';
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 1 IX 1 ISBN A NULL NULL NULL XINDEX
|
||||
DROP TABLE t1;
|
||||
|
@ -515,3 +515,27 @@ Beth 4 Food 17.00
|
||||
Beth 4 Beer 15.00
|
||||
Janet 4 Car 17.00
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
#
|
||||
# MDEV-29426 memory leak on "SHOW INDEX"
|
||||
#
|
||||
CREATE TABLE t1
|
||||
(
|
||||
ISBN CHAR(15) NOT NULL,
|
||||
Language CHAR(2) JPATH='$.LANG',
|
||||
Subject CHAR(32) JPATH='$.SUBJECT',
|
||||
AuthorFN CHAR(128) JPATH='$.AUTHOR[*].FIRSTNAME',
|
||||
AuthorLN CHAR(128) JPATH='$.AUTHOR[*].LASTNAME',
|
||||
Title CHAR(32) JPATH='$.TITLE',
|
||||
Translation CHAR(32) JPATH='$.TRANSLATED.PREFIX',
|
||||
TranslatorFN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.FIRSTNAME',
|
||||
TranslatorLN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.LASTNAME',
|
||||
Publisher CHAR(20) JPATH='$.PUBLISHER.NAME',
|
||||
Location CHAR(16) JPATH='$.PUBLISHER.PLACE',
|
||||
Year int(4) JPATH='$.DATEPUB',
|
||||
INDEX IX(ISBN)
|
||||
)
|
||||
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0';
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment
|
||||
t1 1 IX 1 ISBN A NULL NULL NULL XINDEX
|
||||
DROP TABLE t1;
|
||||
|
@ -282,6 +282,29 @@ SELECT * FROM t1;
|
||||
SELECT * FROM t1 WHERE WEEK = 4;
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29426 memory leak on "SHOW INDEX"
|
||||
--echo #
|
||||
CREATE TABLE t1
|
||||
(
|
||||
ISBN CHAR(15) NOT NULL,
|
||||
Language CHAR(2) JPATH='$.LANG',
|
||||
Subject CHAR(32) JPATH='$.SUBJECT',
|
||||
AuthorFN CHAR(128) JPATH='$.AUTHOR[*].FIRSTNAME',
|
||||
AuthorLN CHAR(128) JPATH='$.AUTHOR[*].LASTNAME',
|
||||
Title CHAR(32) JPATH='$.TITLE',
|
||||
Translation CHAR(32) JPATH='$.TRANSLATED.PREFIX',
|
||||
TranslatorFN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.FIRSTNAME',
|
||||
TranslatorLN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.LASTNAME',
|
||||
Publisher CHAR(20) JPATH='$.PUBLISHER.NAME',
|
||||
Location CHAR(16) JPATH='$.PUBLISHER.PLACE',
|
||||
Year int(4) JPATH='$.DATEPUB',
|
||||
INDEX IX(ISBN)
|
||||
)
|
||||
ENGINE=CONNECT TABLE_TYPE=BSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0';
|
||||
SHOW INDEX FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
|
@ -282,6 +282,30 @@ SELECT * FROM t1;
|
||||
SELECT * FROM t1 WHERE WEEK = 4;
|
||||
DROP TABLE t1, t2, t3, t4;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-29426 memory leak on "SHOW INDEX"
|
||||
--echo #
|
||||
CREATE TABLE t1
|
||||
(
|
||||
ISBN CHAR(15) NOT NULL,
|
||||
Language CHAR(2) JPATH='$.LANG',
|
||||
Subject CHAR(32) JPATH='$.SUBJECT',
|
||||
AuthorFN CHAR(128) JPATH='$.AUTHOR[*].FIRSTNAME',
|
||||
AuthorLN CHAR(128) JPATH='$.AUTHOR[*].LASTNAME',
|
||||
Title CHAR(32) JPATH='$.TITLE',
|
||||
Translation CHAR(32) JPATH='$.TRANSLATED.PREFIX',
|
||||
TranslatorFN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.FIRSTNAME',
|
||||
TranslatorLN CHAR(80) JPATH='$.TRANSLATED.TRANSLATOR.LASTNAME',
|
||||
Publisher CHAR(20) JPATH='$.PUBLISHER.NAME',
|
||||
Location CHAR(16) JPATH='$.PUBLISHER.PLACE',
|
||||
Year int(4) JPATH='$.DATEPUB',
|
||||
INDEX IX(ISBN)
|
||||
)
|
||||
ENGINE=CONNECT TABLE_TYPE=JSON FILE_NAME='bib0.json' LRECL=320 OPTION_LIST='Pretty=0';
|
||||
SHOW INDEX FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
# Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2014, 2021, MariaDB Corporation.
|
||||
# Copyright (c) 2014, 2022, 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
|
||||
@ -17,9 +17,154 @@
|
||||
|
||||
# This is the CMakeLists for InnoDB
|
||||
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
INCLUDE(CheckCSourceRuns)
|
||||
INCLUDE(lz4.cmake)
|
||||
INCLUDE(lzo.cmake)
|
||||
INCLUDE(lzma.cmake)
|
||||
INCLUDE(bzip2.cmake)
|
||||
INCLUDE(snappy.cmake)
|
||||
INCLUDE(numa)
|
||||
INCLUDE(TestBigEndian)
|
||||
|
||||
MYSQL_CHECK_LZ4()
|
||||
MYSQL_CHECK_LZO()
|
||||
MYSQL_CHECK_LZMA()
|
||||
MYSQL_CHECK_BZIP2()
|
||||
MYSQL_CHECK_SNAPPY()
|
||||
MYSQL_CHECK_NUMA()
|
||||
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
|
||||
|
||||
IF(CMAKE_CROSSCOMPILING)
|
||||
# Use CHECK_C_SOURCE_COMPILES instead of CHECK_C_SOURCE_RUNS when
|
||||
# cross-compiling. Not as precise, but usually good enough.
|
||||
# This only make sense for atomic tests in this file, this trick doesn't
|
||||
# work in a general case.
|
||||
MACRO(CHECK_C_SOURCE SOURCE VAR)
|
||||
CHECK_C_SOURCE_COMPILES("${SOURCE}" "${VAR}")
|
||||
ENDMACRO()
|
||||
ELSE()
|
||||
MACRO(CHECK_C_SOURCE SOURCE VAR)
|
||||
CHECK_C_SOURCE_RUNS("${SOURCE}" "${VAR}")
|
||||
ENDMACRO()
|
||||
ENDIF()
|
||||
|
||||
# OS tests
|
||||
IF(UNIX)
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
ADD_DEFINITIONS("-D_GNU_SOURCE=1")
|
||||
|
||||
CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H)
|
||||
CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
|
||||
|
||||
IF(HAVE_LIBAIO_H AND HAVE_LIBAIO)
|
||||
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO=1)
|
||||
LINK_LIBRARIES(aio)
|
||||
ENDIF()
|
||||
IF(HAVE_LIBNUMA)
|
||||
LINK_LIBRARIES(numa)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Enable InnoDB's UNIV_DEBUG in debug builds
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG")
|
||||
|
||||
OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON)
|
||||
OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON)
|
||||
IF(WITH_INNODB_AHI)
|
||||
ADD_DEFINITIONS(-DBTR_CUR_HASH_ADAPT -DBTR_CUR_ADAPT)
|
||||
IF(NOT WITH_INNODB_ROOT_GUESS)
|
||||
MESSAGE(WARNING "WITH_INNODB_AHI implies WITH_INNODB_ROOT_GUESS")
|
||||
SET(WITH_INNODB_ROOT_GUESS ON)
|
||||
ENDIF()
|
||||
ELSEIF(WITH_INNODB_ROOT_GUESS)
|
||||
ADD_DEFINITIONS(-DBTR_CUR_ADAPT)
|
||||
ENDIF()
|
||||
ADD_FEATURE_INFO(INNODB_AHI WITH_INNODB_AHI "InnoDB Adaptive Hash Index")
|
||||
ADD_FEATURE_INFO(INNODB_ROOT_GUESS WITH_INNODB_ROOT_GUESS
|
||||
"Cache index root block descriptors in InnoDB")
|
||||
|
||||
OPTION(WITH_INNODB_EXTRA_DEBUG "Enable extra InnoDB debug checks" OFF)
|
||||
IF(WITH_INNODB_EXTRA_DEBUG)
|
||||
ADD_DEFINITIONS(-DUNIV_ZIP_DEBUG)
|
||||
ENDIF()
|
||||
ADD_FEATURE_INFO(INNODB_EXTRA_DEBUG WITH_INNODB_EXTRA_DEBUG "Extra InnoDB debug checks")
|
||||
|
||||
|
||||
INCLUDE(innodb.cmake)
|
||||
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
|
||||
IF(HAVE_SCHED_GETCPU)
|
||||
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
|
||||
IF(HAVE_NANOSLEEP)
|
||||
ADD_DEFINITIONS(-DHAVE_NANOSLEEP=1)
|
||||
ENDIF()
|
||||
|
||||
IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE)
|
||||
ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1)
|
||||
ENDIF()
|
||||
|
||||
IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
|
||||
CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wno-sign-conversion")
|
||||
SET_SOURCE_FILES_PROPERTIES(fts/fts0pars.cc
|
||||
PROPERTIES COMPILE_FLAGS -Wno-conversion)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT MSVC)
|
||||
# Work around MDEV-18417, MDEV-18656, MDEV-18417
|
||||
IF(WITH_ASAN AND CMAKE_COMPILER_IS_GNUCC AND
|
||||
CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
|
||||
SET_SOURCE_FILES_PROPERTIES(trx/trx0rec.cc PROPERTIES COMPILE_FLAGS -O1)
|
||||
ENDIF()
|
||||
ENDIF(NOT MSVC)
|
||||
|
||||
CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
|
||||
|
||||
SET(MUTEXTYPE "event" CACHE STRING "Mutex type: event, sys or futex")
|
||||
|
||||
IF(MUTEXTYPE MATCHES "event")
|
||||
ADD_DEFINITIONS(-DMUTEX_EVENT)
|
||||
ELSEIF(MUTEXTYPE MATCHES "futex" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
ADD_DEFINITIONS(-DMUTEX_FUTEX)
|
||||
ELSE()
|
||||
ADD_DEFINITIONS(-DMUTEX_SYS)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Include directories under innobase
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include
|
||||
${CMAKE_SOURCE_DIR}/storage/innobase/handler)
|
||||
|
||||
# Sun Studio bug with -xO2
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro"
|
||||
AND CMAKE_CXX_FLAGS_RELEASE MATCHES "O2"
|
||||
AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# Sun Studio 12 crashes with -xO2 flag, but not with higher optimization
|
||||
# -xO3
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/rem/rem0rec.cc
|
||||
PROPERTIES COMPILE_FLAGS -xO3)
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(MSVC)
|
||||
# Avoid "unreferenced label" warning in generated file
|
||||
GET_FILENAME_COMPONENT(_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/pars0grm.c
|
||||
PROPERTIES COMPILE_FLAGS "/wd4102")
|
||||
SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/lexyy.c
|
||||
PROPERTIES COMPILE_FLAGS "/wd4003")
|
||||
ENDIF()
|
||||
|
||||
# Include directories under innobase
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include
|
||||
${CMAKE_SOURCE_DIR}/storage/innobase/handler
|
||||
${CMAKE_SOURCE_DIR}/libbinlogevents/include)
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/tpool)
|
||||
|
||||
SET(INNOBASE_SOURCES
|
||||
|
@ -50,7 +50,7 @@ Created 10/25/1995 Heikki Tuuri
|
||||
#include "sync0sync.h"
|
||||
#include "buf0flu.h"
|
||||
#include "log.h"
|
||||
#ifdef UNIV_LINUX
|
||||
#ifdef __linux__
|
||||
# include <sys/types.h>
|
||||
# include <sys/sysmacros.h>
|
||||
# include <dirent.h>
|
||||
@ -1248,7 +1248,7 @@ void fil_system_t::create(ulint hash_size)
|
||||
spaces.create(hash_size);
|
||||
|
||||
fil_space_crypt_init();
|
||||
#ifdef UNIV_LINUX
|
||||
#ifdef __linux__
|
||||
ssd.clear();
|
||||
char fn[sizeof(dirent::d_name)
|
||||
+ sizeof "/sys/block/" "/queue/rotational"];
|
||||
@ -1328,10 +1328,10 @@ void fil_system_t::close()
|
||||
|
||||
ut_ad(!spaces.array);
|
||||
|
||||
#ifdef UNIV_LINUX
|
||||
#ifdef __linux__
|
||||
ssd.clear();
|
||||
ssd.shrink_to_fit();
|
||||
#endif /* UNIV_LINUX */
|
||||
#endif /* __linux__ */
|
||||
}
|
||||
|
||||
/** Extend all open data files to the recovered size */
|
||||
|
@ -6592,6 +6592,11 @@ i_s_sys_tablespaces_fill_table(
|
||||
mutex_exit(&dict_sys.mutex);
|
||||
mem_heap_free(heap);
|
||||
|
||||
i_s_dict_fill_sys_tablespaces(
|
||||
thd, uint32_t(fil_system.temp_space->id),
|
||||
fil_system.temp_space->name,
|
||||
fil_system.temp_space->flags, tables->table);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
/*******************************************************************//**
|
||||
|
@ -1361,7 +1361,7 @@ struct fil_system_t {
|
||||
|
||||
private:
|
||||
bool m_initialised;
|
||||
#ifdef UNIV_LINUX
|
||||
#ifdef __linux__
|
||||
/** available block devices that reside on non-rotational storage */
|
||||
std::vector<dev_t> ssd;
|
||||
public:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2022, 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
|
||||
|
@ -498,7 +498,7 @@ contains the sum of the following flag and the locally stored len. */
|
||||
#endif /* CHECK FOR GCC VER_GT_2 */
|
||||
|
||||
/* Some macros to improve branch prediction and reduce cache misses */
|
||||
#if defined(COMPILER_HINTS) && defined(__GNUC__)
|
||||
#ifdef __GNUC__
|
||||
/* Tell the compiler that 'expr' probably evaluates to 'constant'. */
|
||||
# define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant)
|
||||
/* Tell the compiler that a pointer is likely to be NULL */
|
||||
@ -518,16 +518,11 @@ it is read or written. */
|
||||
# define UNIV_EXPECT(expr,value) (expr)
|
||||
# define UNIV_LIKELY_NULL(expr) (expr)
|
||||
|
||||
# if defined(COMPILER_HINTS)
|
||||
//# define UNIV_PREFETCH_R(addr) sun_prefetch_read_many((void*) addr)
|
||||
# define UNIV_PREFETCH_R(addr) ((void) 0)
|
||||
# define UNIV_PREFETCH_RW(addr) sun_prefetch_write_many(addr)
|
||||
# else
|
||||
# define UNIV_PREFETCH_R(addr) ((void) 0)
|
||||
# define UNIV_PREFETCH_RW(addr) ((void) 0)
|
||||
# endif /* COMPILER_HINTS */
|
||||
# define UNIV_PREFETCH_R(addr) ((void) 0)
|
||||
# define UNIV_PREFETCH_RW(addr) sun_prefetch_write_many(addr)
|
||||
|
||||
# elif defined __WIN__ && defined COMPILER_HINTS
|
||||
# elif defined __WIN__
|
||||
# include <xmmintrin.h>
|
||||
# define UNIV_EXPECT(expr,value) (expr)
|
||||
# define UNIV_LIKELY_NULL(expr) (expr)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 2015, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2022, 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
|
||||
|
@ -1,180 +0,0 @@
|
||||
# Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2017, 2022, 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 Foundation; version 2 of the License.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# This is the CMakeLists for InnoDB
|
||||
|
||||
INCLUDE(CheckFunctionExists)
|
||||
INCLUDE(CheckCSourceCompiles)
|
||||
INCLUDE(CheckCSourceRuns)
|
||||
INCLUDE(lz4.cmake)
|
||||
INCLUDE(lzo.cmake)
|
||||
INCLUDE(lzma.cmake)
|
||||
INCLUDE(bzip2.cmake)
|
||||
INCLUDE(snappy.cmake)
|
||||
INCLUDE(numa)
|
||||
INCLUDE(TestBigEndian)
|
||||
|
||||
MYSQL_CHECK_LZ4()
|
||||
MYSQL_CHECK_LZO()
|
||||
MYSQL_CHECK_LZMA()
|
||||
MYSQL_CHECK_BZIP2()
|
||||
MYSQL_CHECK_SNAPPY()
|
||||
MYSQL_CHECK_NUMA()
|
||||
|
||||
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
|
||||
|
||||
IF(CMAKE_CROSSCOMPILING)
|
||||
# Use CHECK_C_SOURCE_COMPILES instead of CHECK_C_SOURCE_RUNS when
|
||||
# cross-compiling. Not as precise, but usually good enough.
|
||||
# This only make sense for atomic tests in this file, this trick doesn't
|
||||
# work in a general case.
|
||||
MACRO(CHECK_C_SOURCE SOURCE VAR)
|
||||
CHECK_C_SOURCE_COMPILES("${SOURCE}" "${VAR}")
|
||||
ENDMACRO()
|
||||
ELSE()
|
||||
MACRO(CHECK_C_SOURCE SOURCE VAR)
|
||||
CHECK_C_SOURCE_RUNS("${SOURCE}" "${VAR}")
|
||||
ENDMACRO()
|
||||
ENDIF()
|
||||
|
||||
# OS tests
|
||||
IF(UNIX)
|
||||
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
|
||||
ADD_DEFINITIONS("-DUNIV_LINUX -D_GNU_SOURCE=1")
|
||||
|
||||
CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H)
|
||||
CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
|
||||
|
||||
IF(HAVE_LIBAIO_H AND HAVE_LIBAIO)
|
||||
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO=1)
|
||||
LINK_LIBRARIES(aio)
|
||||
ENDIF()
|
||||
IF(HAVE_LIBNUMA)
|
||||
LINK_LIBRARIES(numa)
|
||||
ENDIF()
|
||||
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP*")
|
||||
ADD_DEFINITIONS("-DUNIV_HPUX")
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "AIX")
|
||||
ADD_DEFINITIONS("-DUNIV_AIX")
|
||||
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
||||
ADD_DEFINITIONS("-DUNIV_SOLARIS")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
OPTION(INNODB_COMPILER_HINTS "Compile InnoDB with compiler hints" ON)
|
||||
MARK_AS_ADVANCED(INNODB_COMPILER_HINTS)
|
||||
|
||||
IF(INNODB_COMPILER_HINTS)
|
||||
ADD_DEFINITIONS("-DCOMPILER_HINTS")
|
||||
ENDIF()
|
||||
ADD_FEATURE_INFO(INNODB_COMPILER_HINTS INNODB_COMPILER_HINTS "InnoDB compiled with compiler hints")
|
||||
|
||||
# Enable InnoDB's UNIV_DEBUG in debug builds
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG")
|
||||
|
||||
OPTION(WITH_INNODB_AHI "Include innodb_adaptive_hash_index" ON)
|
||||
OPTION(WITH_INNODB_ROOT_GUESS "Cache index root block descriptors" ON)
|
||||
IF(WITH_INNODB_AHI)
|
||||
ADD_DEFINITIONS(-DBTR_CUR_HASH_ADAPT -DBTR_CUR_ADAPT)
|
||||
IF(NOT WITH_INNODB_ROOT_GUESS)
|
||||
MESSAGE(WARNING "WITH_INNODB_AHI implies WITH_INNODB_ROOT_GUESS")
|
||||
SET(WITH_INNODB_ROOT_GUESS ON)
|
||||
ENDIF()
|
||||
ELSEIF(WITH_INNODB_ROOT_GUESS)
|
||||
ADD_DEFINITIONS(-DBTR_CUR_ADAPT)
|
||||
ENDIF()
|
||||
ADD_FEATURE_INFO(INNODB_AHI WITH_INNODB_AHI "InnoDB Adaptive Hash Index")
|
||||
ADD_FEATURE_INFO(INNODB_ROOT_GUESS WITH_INNODB_ROOT_GUESS
|
||||
"Cache index root block descriptors in InnoDB")
|
||||
|
||||
OPTION(WITH_INNODB_EXTRA_DEBUG "Enable extra InnoDB debug checks" OFF)
|
||||
IF(WITH_INNODB_EXTRA_DEBUG)
|
||||
ADD_DEFINITIONS(-DUNIV_ZIP_DEBUG)
|
||||
ENDIF()
|
||||
ADD_FEATURE_INFO(INNODB_EXTRA_DEBUG WITH_INNODB_EXTRA_DEBUG "Extra InnoDB debug checks")
|
||||
|
||||
|
||||
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
|
||||
IF(HAVE_SCHED_GETCPU)
|
||||
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
|
||||
IF(HAVE_NANOSLEEP)
|
||||
ADD_DEFINITIONS(-DHAVE_NANOSLEEP=1)
|
||||
ENDIF()
|
||||
|
||||
IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE)
|
||||
ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1)
|
||||
ENDIF()
|
||||
|
||||
IF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR
|
||||
CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wno-sign-conversion")
|
||||
SET_SOURCE_FILES_PROPERTIES(fts/fts0pars.cc
|
||||
PROPERTIES COMPILE_FLAGS -Wno-conversion)
|
||||
ENDIF()
|
||||
|
||||
IF(NOT MSVC)
|
||||
# Work around MDEV-18417, MDEV-18656, MDEV-18417
|
||||
IF(WITH_ASAN AND CMAKE_COMPILER_IS_GNUCC AND
|
||||
CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
|
||||
SET_SOURCE_FILES_PROPERTIES(trx/trx0rec.cc PROPERTIES COMPILE_FLAGS -O1)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF)
|
||||
|
||||
SET(MUTEXTYPE "event" CACHE STRING "Mutex type: event, sys or futex")
|
||||
|
||||
IF(MUTEXTYPE MATCHES "event")
|
||||
ADD_DEFINITIONS(-DMUTEX_EVENT)
|
||||
ELSEIF(MUTEXTYPE MATCHES "futex" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
ADD_DEFINITIONS(-DMUTEX_FUTEX)
|
||||
ELSE()
|
||||
ADD_DEFINITIONS(-DMUTEX_SYS)
|
||||
ENDIF()
|
||||
|
||||
|
||||
# Include directories under innobase
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include
|
||||
${CMAKE_SOURCE_DIR}/storage/innobase/handler)
|
||||
|
||||
# Sun Studio bug with -xO2
|
||||
IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro"
|
||||
AND CMAKE_CXX_FLAGS_RELEASE MATCHES "O2"
|
||||
AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# Sun Studio 12 crashes with -xO2 flag, but not with higher optimization
|
||||
# -xO3
|
||||
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/rem/rem0rec.cc
|
||||
PROPERTIES COMPILE_FLAGS -xO3)
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(MSVC)
|
||||
# Avoid "unreferenced label" warning in generated file
|
||||
GET_FILENAME_COMPONENT(_SRC_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||
SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/pars0grm.c
|
||||
PROPERTIES COMPILE_FLAGS "/wd4102")
|
||||
SET_SOURCE_FILES_PROPERTIES(${_SRC_DIR}/pars/lexyy.c
|
||||
PROPERTIES COMPILE_FLAGS "/wd4003")
|
||||
ENDIF()
|
||||
|
||||
# Include directories under innobase
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/storage/innobase/include
|
||||
${CMAKE_SOURCE_DIR}/storage/innobase/handler
|
||||
${CMAKE_SOURCE_DIR}/libbinlogevents/include )
|
@ -37,7 +37,7 @@ Created 10/21/1995 Heikki Tuuri
|
||||
#include "os0file.h"
|
||||
#include "sql_const.h"
|
||||
|
||||
#ifdef UNIV_LINUX
|
||||
#ifdef __linux__
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
@ -64,7 +64,7 @@ Created 10/21/1995 Heikki Tuuri
|
||||
# include <linux/falloc.h>
|
||||
#endif /* HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE */
|
||||
|
||||
#if defined(UNIV_LINUX) && defined(HAVE_SYS_IOCTL_H)
|
||||
#if defined(__linux__) && defined(HAVE_SYS_IOCTL_H)
|
||||
# include <sys/ioctl.h>
|
||||
# ifndef DFS_IOCTL_ATOMIC_WRITE_SET
|
||||
# define DFS_IOCTL_ATOMIC_WRITE_SET _IOW(0x95, 2, uint)
|
||||
@ -763,7 +763,7 @@ os_file_punch_hole_posix(
|
||||
|
||||
return(DB_IO_ERROR);
|
||||
|
||||
#elif defined(UNIV_SOLARIS)
|
||||
#elif defined __sun__
|
||||
|
||||
// Use F_FREESP
|
||||
|
||||
@ -2858,10 +2858,11 @@ os_file_io(
|
||||
@param[in] type IO context
|
||||
@param[in] file handle to an open file
|
||||
@param[out] buf buffer from which to write
|
||||
@param[in] n number of bytes to read, starting from offset
|
||||
@param[in] offset file offset from the start where to read
|
||||
@param[in] n number of bytes to write, starting from offset
|
||||
@param[in] offset file offset from the start where to write
|
||||
@param[out] err DB_SUCCESS or error code
|
||||
@return number of bytes written, -1 if error */
|
||||
@return number of bytes written
|
||||
@retval -1 on error */
|
||||
static MY_ATTRIBUTE((warn_unused_result))
|
||||
ssize_t
|
||||
os_file_pwrite(
|
||||
@ -3139,7 +3140,7 @@ os_file_set_nocache(
|
||||
const char* operation_name MY_ATTRIBUTE((unused)))
|
||||
{
|
||||
/* some versions of Solaris may not have DIRECTIO_ON */
|
||||
#if defined(UNIV_SOLARIS) && defined(DIRECTIO_ON)
|
||||
#if defined(__sun__) && defined(DIRECTIO_ON)
|
||||
if (directio(fd, DIRECTIO_ON) == -1) {
|
||||
int errno_save = errno;
|
||||
|
||||
@ -3156,7 +3157,7 @@ os_file_set_nocache(
|
||||
if (errno_save == EINVAL) {
|
||||
if (!warning_message_printed) {
|
||||
warning_message_printed = true;
|
||||
# ifdef UNIV_LINUX
|
||||
# ifdef __linux__
|
||||
ib::warn()
|
||||
<< "Failed to set O_DIRECT on file"
|
||||
<< file_name << "; " << operation_name
|
||||
@ -3165,12 +3166,12 @@ os_file_set_nocache(
|
||||
"known to result in 'Invalid argument' "
|
||||
"on Linux on tmpfs, "
|
||||
"see MySQL Bug#26662.";
|
||||
# else /* UNIV_LINUX */
|
||||
# else /* __linux__ */
|
||||
goto short_warning;
|
||||
# endif /* UNIV_LINUX */
|
||||
# endif /* __linux__ */
|
||||
}
|
||||
} else {
|
||||
# ifndef UNIV_LINUX
|
||||
# ifndef __linux__
|
||||
short_warning:
|
||||
# endif
|
||||
ib::warn()
|
||||
@ -3180,7 +3181,7 @@ short_warning:
|
||||
<< ", continuing anyway.";
|
||||
}
|
||||
}
|
||||
#endif /* defined(UNIV_SOLARIS) && defined(DIRECTIO_ON) */
|
||||
#endif /* defined(__sun__) && defined(DIRECTIO_ON) */
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
@ -4169,7 +4170,7 @@ void fil_node_t::find_metadata(os_file_t file
|
||||
block_size = statbuf->st_blksize;
|
||||
}
|
||||
on_ssd = space->atomic_write_supported
|
||||
# ifdef UNIV_LINUX
|
||||
# ifdef __linux__
|
||||
|| (statbuf && fil_system.is_ssd(statbuf->st_dev))
|
||||
# endif
|
||||
;
|
||||
@ -4279,7 +4280,7 @@ invalid:
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef UNIV_LINUX
|
||||
#ifdef __linux__
|
||||
find_metadata(handle, &statbuf);
|
||||
#else
|
||||
find_metadata();
|
||||
|
@ -3319,12 +3319,12 @@ row_merge_sort(
|
||||
is used. MDEV-9356: innodb.innodb_bug53290 fails (crashes) on
|
||||
sol10-64 in buildbot.
|
||||
*/
|
||||
#ifndef UNIV_SOLARIS
|
||||
#ifndef __sun__
|
||||
/* Progress report only for "normal" indexes. */
|
||||
if (!(dup->index->type & DICT_FTS)) {
|
||||
thd_progress_init(trx->mysql_thd, 1);
|
||||
}
|
||||
#endif /* UNIV_SOLARIS */
|
||||
#endif /* __sun__ */
|
||||
|
||||
if (global_system_variables.log_warnings > 2) {
|
||||
sql_print_information("InnoDB: Online DDL : merge-sorting"
|
||||
@ -3337,11 +3337,11 @@ row_merge_sort(
|
||||
/* Report progress of merge sort to MySQL for
|
||||
show processlist progress field */
|
||||
/* Progress report only for "normal" indexes. */
|
||||
#ifndef UNIV_SOLARIS
|
||||
#ifndef __sun__
|
||||
if (!(dup->index->type & DICT_FTS)) {
|
||||
thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset);
|
||||
}
|
||||
#endif /* UNIV_SOLARIS */
|
||||
#endif /* __sun__ */
|
||||
|
||||
error = row_merge(trx, dup, file, block, tmpfd,
|
||||
&num_runs, run_offset, stage,
|
||||
@ -3367,11 +3367,11 @@ row_merge_sort(
|
||||
ut_free(run_offset);
|
||||
|
||||
/* Progress report only for "normal" indexes. */
|
||||
#ifndef UNIV_SOLARIS
|
||||
#ifndef __sun__
|
||||
if (!(dup->index->type & DICT_FTS)) {
|
||||
thd_progress_end(trx->mysql_thd);
|
||||
}
|
||||
#endif /* UNIV_SOLARIS */
|
||||
#endif /* __sun__ */
|
||||
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
@ -397,12 +397,12 @@ static dberr_t srv_undo_tablespace_create(const char* name)
|
||||
|
||||
if (!ret) {
|
||||
if (os_file_get_last_error(false) != OS_FILE_ALREADY_EXISTS
|
||||
#ifdef UNIV_AIX
|
||||
#ifdef _AIX
|
||||
/* AIX 5.1 after security patch ML7 may have
|
||||
errno set to 0 here, which causes our function
|
||||
to return 100; work around that AIX problem */
|
||||
&& os_file_get_last_error(false) != 100
|
||||
#endif /* UNIV_AIX */
|
||||
#endif
|
||||
) {
|
||||
ib::error() << "Can't create UNDO tablespace "
|
||||
<< name;
|
||||
|
@ -401,7 +401,7 @@ int test_write(MI_INFO *file,int id,int lock_type)
|
||||
|
||||
int test_update(MI_INFO *file,int id,int lock_type)
|
||||
{
|
||||
uint i,lock,found,next,prev,update;
|
||||
uint i,lock,update;
|
||||
uint32 tmp;
|
||||
char find[4];
|
||||
struct record new_record;
|
||||
@ -424,24 +424,20 @@ int test_update(MI_INFO *file,int id,int lock_type)
|
||||
bzero((char*) &new_record,sizeof(new_record));
|
||||
strmov((char*) new_record.text,"Updated");
|
||||
|
||||
found=next=prev=update=0;
|
||||
update=0;
|
||||
for (i=0 ; i < 100 ; i++)
|
||||
{
|
||||
tmp=rnd(100000);
|
||||
int4store(find,tmp);
|
||||
if (!mi_rkey(file,record.id,1,(uchar*) find, HA_WHOLE_KEY,
|
||||
HA_READ_KEY_EXACT))
|
||||
found++;
|
||||
else
|
||||
if (mi_rkey(file,record.id,1,(uchar*) find, HA_WHOLE_KEY,
|
||||
HA_READ_KEY_EXACT))
|
||||
{
|
||||
if (my_errno != HA_ERR_KEY_NOT_FOUND)
|
||||
{
|
||||
fprintf(stderr,"%2d: Got error %d from read in update\n",id,my_errno);
|
||||
return 1;
|
||||
}
|
||||
else if (!mi_rnext(file,record.id,1))
|
||||
next++;
|
||||
else
|
||||
else if (mi_rnext(file,record.id,1))
|
||||
{
|
||||
if (my_errno != HA_ERR_END_OF_FILE)
|
||||
{
|
||||
@ -449,9 +445,7 @@ int test_update(MI_INFO *file,int id,int lock_type)
|
||||
id,my_errno);
|
||||
return 1;
|
||||
}
|
||||
else if (!mi_rprev(file,record.id,1))
|
||||
prev++;
|
||||
else
|
||||
else if (mi_rprev(file,record.id,1))
|
||||
{
|
||||
if (my_errno != HA_ERR_END_OF_FILE)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user