Merge remote-tracking branch 'origin/10.1' into 10.2

This commit is contained in:
Vicențiu Ciorbaru 2017-12-22 12:23:39 +02:00
commit 985d2d393c
87 changed files with 1806 additions and 350 deletions

View File

@ -1797,8 +1797,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_MYSQL_PROTOCOL:
#ifndef EMBEDDED_LIBRARY
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
#endif
break;
case OPT_SERVER_ARG:

View File

@ -299,8 +299,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
}
return 0;

View File

@ -1928,8 +1928,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
one_table= 1;
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
#ifdef WHEN_FLASHBACK_REVIEW_READY
case opt_flashback_review:
@ -1947,8 +1951,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_base64_output_mode= BASE64_OUTPUT_ALWAYS;
else
{
opt_base64_output_mode= (enum_base64_output_mode)
(find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);
int val;
if ((val= find_type_with_warning(argument, &base64_output_mode_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
opt_base64_output_mode= (enum_base64_output_mode) (val - 1);
}
break;
case OPT_REWRITE_DB: // db_from->db_to

View File

@ -367,8 +367,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
print_version(); exit(0);
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
}

View File

@ -960,8 +960,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
}
case (int) OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
}
return 0;

View File

@ -249,8 +249,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
#endif
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");

View File

@ -330,8 +330,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");

View File

@ -779,8 +779,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);

View File

@ -7291,8 +7291,12 @@ get_one_option(int optid, const struct my_option *opt, char *argument)
exit(0);
case OPT_MYSQL_PROTOCOL:
#ifndef EMBEDDED_LIBRARY
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
#endif
break;
case '?':

View File

@ -162,6 +162,8 @@ SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql")
SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock")
SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d")
#
# DEB layout
@ -191,6 +193,8 @@ SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql")
SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock")
SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d")
#
# SVR4 layout
@ -232,7 +236,7 @@ SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "")
# layout is chosen)
FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF SYSCONF2
INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA UNIX_ADDR
SYSTEMD_UNIT)
SYSTEMD_UNIT SYSTEMD_SYSUSERS SYSTEMD_TMPFILES)
SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
CACHE STRING "${var} installation directory" ${FORCE})
MARK_AS_ADVANCED(INSTALL_${var}DIR)

View File

@ -1421,8 +1421,12 @@ xb_get_one_option(int optid,
case OPT_PROTOCOL:
if (argument)
{
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
}
break;
#include "sslopt-case.h"

View File

@ -65,15 +65,6 @@
extern "C" {
#endif
/*
my_str_malloc(), my_str_realloc() and my_str_free() are assigned to
implementations in strings/alloc.c, but can be overridden in
the calling program.
*/
extern void *(*my_str_malloc)(size_t);
extern void *(*my_str_realloc)(void *, size_t);
extern void (*my_str_free)(void *);
#ifdef DBUG_OFF
#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
#define strmov(A,B) __builtin_stpcpy((A),(B))

View File

@ -249,8 +249,6 @@ typedef struct st_typelib {
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib,
const char *option);
extern int find_type_or_exit(const char *x, TYPELIB *typelib,
const char *option);
extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);

View File

@ -30,8 +30,6 @@ typedef struct st_typelib { /* Different types saved here */
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib,
const char *option);
extern int find_type_or_exit(const char *x, TYPELIB *typelib,
const char *option);
#define FIND_TYPE_BASIC 0
/** makes @c find_type() require the whole name, no prefix */
#define FIND_TYPE_NO_PREFIX (1U << 0)

View File

@ -121,6 +121,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
my_free(mysql->options.my_cnf_file);
my_free(mysql->options.my_cnf_group);
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
if (mysql->options.protocol == UINT_MAX32)
goto error;
}
if (!db || !db[0])

View File

@ -221,21 +221,11 @@ NULL
DROP TABLE t1;
#
# Start of 5.3 tests
#
#
# MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
8
8
Warnings:
Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1
Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2
DROP TABLE t1;
#
# End of 5.3 tests
# MDEV-14596 Crash in INTERVAL(ROW(..),ROW(..))
#
SELECT INTERVAL(ROW(1,1),ROW(1,2));
ERROR 21000: Operand should contain 1 column(s)
SELECT INTERVAL(1,ROW(1,2));
ERROR 21000: Operand should contain 1 column(s)
SELECT INTERVAL(ROW(1,2),1);
ERROR 21000: Operand should contain 1 column(s)

View File

@ -2667,6 +2667,31 @@ create table t2 (c1 int, c2 int);
select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3;
c1 c1
drop table t1, t2;
SET @old_sort_buff_size = @@sort_buffer_size;
SET @@sort_buffer_size=256*1024;
CREATE TABLE t1 (c INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES
(2011),(1977),(1982),(2027),(2023),(NULL),(NULL),(2004),(1974),(2032),
(1993),(NULL),(1995),(2034),(NULL),(2009),(1900),(NULL),(2025),(1900),
(2033),(1900),(2012),(NULL),(2009),(1992),(1974),(1974),(2012),(2028),
(2007),(2012),(1900),(1983),(1900),(2010),(1987),(1994),(1981),(2032),
(2010),(1989),(2014),(1900),(1900),(1976),(1978),(2007),(2030),(NULL),
(2002),(1997),(1900),(NULL),(2000),(2027),(1975),(2026),(1975),(2026),
(2029),(1977),(1900),(1900),(2031),(1993),(1986),(2012),(1979),(2013),
(1994),(2014),(2025),(2006),(1971),(1974),(2021),(2011),(NULL),(1991),
(2001),(1977),(2023),(2012),(1900),(1978),(1998),(NULL),(1988),(1999),
(2017),(2008),(1976),(1900),(2005),(2030),(2023),(1900),(1978),(1990),
(1978),(1987),(2030),(1900),(2034),(2006),(2015),(2001),(2019),(2024),
(2030),(1989),(1997),(2007),(2023),(1994),(1971),(2011),(2011),(2015),
(1984),(1978),(1979),(1989),(2008),(2030);
SELECT ExtractValue('<a></a>','/a') AS f1, SPACE(c) AS f2 FROM t1 GROUP BY f1, f2 WITH ROLLUP;
f1 f2
NULL
NULL
NULL NULL
SET @@sort_buffer_size = @old_sort_buff_size;
DROP TABLE t1;
#
# Bug #58782
# Missing rows with SELECT .. WHERE .. IN subquery

View File

@ -696,6 +696,21 @@ id column_1
expected -- 1 row(s) returned not ER_BAD_FIELD_ERROR
drop table t1;
#
# mdev-14368: grouping query with alias for aggregate function in HAVING
# when sql_mode = 'ONLY_FULL_GROUP_BY'
set @save_sql_mode= @@sql_mode;
set sql_mode = 'ONLY_FULL_GROUP_BY';
create table t1(a int);
insert t1 values (4),(1),(2),(1), (3),(4);
SELECT a, COUNT(a) as ct FROM t1 GROUP BY a HAVING ct>0;
a ct
1 2
2 1
3 1
4 2
set sql_mode=@save_sql_mode;
drop table t1;
#
# Bug mdev-5160: two-way join with HAVING over the second table
#
CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;

View File

@ -2431,5 +2431,18 @@ Warnings:
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
DROP FUNCTION f1;
DROP TABLE t1,t2;
#
# MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields
#
CREATE TABLE t1 (b1 BIT NOT NULL);
INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
t1.b1+'0' t2.b2 + '0'
0 0
1 1
DROP TABLE t1, t2;
# end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;

View File

@ -2442,6 +2442,19 @@ Warnings:
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
DROP FUNCTION f1;
DROP TABLE t1,t2;
#
# MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields
#
CREATE TABLE t1 (b1 BIT NOT NULL);
INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
t1.b1+'0' t2.b2 + '0'
0 0
1 1
DROP TABLE t1, t2;
# end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;

View File

@ -5677,6 +5677,20 @@ PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
ERROR HY000: Can not insert into join view 'test.v2' without fields list
drop view v1,v2;
drop table t3;
#
# MDEV-14619: VIEW and GROUP_CONCAT
#
CREATE TABLE t1 (str text);
INSERT INTO t1 VALUES ("My"),("SQL");
CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1;
SELECT * FROM v1;
GROUP_CONCAT(str SEPARATOR '\\')
My\SQL
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select group_concat(`t1`.`str` separator '\\') AS `GROUP_CONCAT(str SEPARATOR '\\')` from `t1` latin1 latin1_swedish_ci
drop view v1;
drop table t1;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------

View File

@ -1363,3 +1363,9 @@ SELECT * FROM t1;
c1
1e19
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-1);
SELECT * FROM t1;
a
-1
DROP TABLE t1;

View File

@ -112,6 +112,35 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB AUTO_INCREMENT=1023 DEFAULT CHARSET=latin1
drop table t1;
drop table t480;
#
# MDEV-12827 Assertion failure when reporting duplicate key error
# in online table rebuild
#
CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB;
connect con1,localhost,root,,test;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log';
ALTER TABLE t1 DROP j, FORCE;
connection default;
SET DEBUG_SYNC='now WAIT_FOR built';
INSERT INTO t1 (i) VALUES (0),(0);
ERROR 23000: Duplicate entry '0' for key 'i'
SET DEBUG_SYNC='now SIGNAL log';
connection con1;
ERROR 23000: Duplicate entry '0' for key 'i'
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2';
ALTER TABLE t1 DROP j, FORCE;
connection default;
SET DEBUG_SYNC='now WAIT_FOR built2';
INSERT INTO t1 (i) VALUES (0),(1);
UPDATE t1 SET i=0;
ERROR 23000: Duplicate entry '0' for key 'i'
SET DEBUG_SYNC='now SIGNAL log2';
connection con1;
ERROR 23000: Duplicate entry '0' for key 'i'
disconnect con1;
connection default;
SET DEBUG_SYNC='RESET';
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
#
# BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP

View File

@ -695,3 +695,8 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES ();
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-1);
SELECT * FROM t1;
DROP TABLE t1;

View File

@ -114,6 +114,45 @@ connection default;
show create table t1;
drop table t1;
drop table t480;
--echo #
--echo # MDEV-12827 Assertion failure when reporting duplicate key error
--echo # in online table rebuild
--echo #
CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB;
--connect (con1,localhost,root,,test)
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log';
--send
ALTER TABLE t1 DROP j, FORCE;
--connection default
SET DEBUG_SYNC='now WAIT_FOR built';
--error ER_DUP_ENTRY
INSERT INTO t1 (i) VALUES (0),(0);
SET DEBUG_SYNC='now SIGNAL log';
--connection con1
--error ER_DUP_ENTRY
reap;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2';
--send
ALTER TABLE t1 DROP j, FORCE;
--connection default
SET DEBUG_SYNC='now WAIT_FOR built2';
INSERT INTO t1 (i) VALUES (0),(1);
--error ER_DUP_ENTRY
UPDATE t1 SET i=0;
SET DEBUG_SYNC='now SIGNAL log2';
--connection con1
--error ER_DUP_ENTRY
reap;
--disconnect con1
--connection default
SET DEBUG_SYNC='RESET';
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
--source include/wait_until_count_sessions.inc

View File

@ -3,6 +3,13 @@ CREATE TABLE t(a INT UNSIGNED PRIMARY KEY) ENGINE INNODB;
INSERT INTO t VALUES(0);
COMMIT;
start transaction;
connect flush_log,localhost,root,,;
BEGIN;
DELETE FROM t LIMIT 1;
SET GLOBAL innodb_flush_log_at_trx_commit = 1;
ROLLBACK;
disconnect flush_log;
connection default;
NOT FOUND /Rollback of trx with id/ in current_test
# expect NOT FOUND
NOT FOUND /Rollback of trx with id/ in current_test

View File

@ -26,6 +26,13 @@ eval INSERT t VALUES(201-$n);
dec $n;
}
--enable_query_log
connect (flush_log,localhost,root,,);
BEGIN;
DELETE FROM t LIMIT 1;
SET GLOBAL innodb_flush_log_at_trx_commit = 1;
ROLLBACK;
disconnect flush_log;
connection default;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir ;

View File

@ -0,0 +1,37 @@
--echo #
--echo # MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
--echo #
--eval CREATE TABLE t1 (i INT) ENGINE=$engine PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
# Cleanup
DROP TABLE t1;
--echo #
--echo # MDEV-13788 Server crash when issuing bad SQL partition syntax
--echo #
--eval CREATE TABLE t1 (id int, d date) ENGINE=$engine PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE))
SHOW CREATE TABLE t1;
--error ER_PARTITION_REQUIRES_VALUES_ERROR
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES LESS THAN (MAXVALUE)
);
DROP TABLE t1;
--eval CREATE TABLE t1 (id int, d date) ENGINE=$engine PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3))
SHOW CREATE TABLE t1;
--error ER_PARTITION_REQUIRES_VALUES_ERROR
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES IN (4,5,6)
);
DROP TABLE t1;

View File

@ -0,0 +1,44 @@
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
CREATE TABLE t1 (i INT) ENGINE=InnoDB PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
i
DROP TABLE t1;
#
# MDEV-13788 Server crash when issuing bad SQL partition syntax
#
CREATE TABLE t1 (id int, d date) ENGINE=InnoDB PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(`d`)
(PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES LESS THAN (MAXVALUE)
);
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
DROP TABLE t1;
CREATE TABLE t1 (id int, d date) ENGINE=InnoDB PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY LIST (`id`)
(PARTITION `p1` VALUES IN (1,2,3) ENGINE = InnoDB)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;

View File

@ -16,3 +16,47 @@ select * from t1;
pk dt
1 2017-09-28 15:12:00
drop table t1;
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
CREATE TABLE t1 (i INT) ENGINE=Aria PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
i
DROP TABLE t1;
#
# MDEV-13788 Server crash when issuing bad SQL partition syntax
#
CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=Aria DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(`d`)
(PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = Aria)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES LESS THAN (MAXVALUE)
);
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
DROP TABLE t1;
CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=Aria DEFAULT CHARSET=latin1
PARTITION BY LIST (`id`)
(PARTITION `p1` VALUES IN (1,2,3) ENGINE = Aria)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;

View File

@ -1,10 +1,44 @@
CREATE TABLE t1 (i INT) ENGINE=MYISAM
PARTITION BY LIST(i) (
PARTITION p0 VALUES IN (1),
PARTITION p1 VALUES IN (2)
);
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
CREATE TABLE t1 (i INT) ENGINE=MyISAM PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
i
DROP TABLE t1;
#
# MDEV-13788 Server crash when issuing bad SQL partition syntax
#
CREATE TABLE t1 (id int, d date) ENGINE=MyISAM PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(`d`)
(PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = MyISAM)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES LESS THAN (MAXVALUE)
);
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
DROP TABLE t1;
CREATE TABLE t1 (id int, d date) ENGINE=MyISAM PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST (`id`)
(PARTITION `p1` VALUES IN (1,2,3) ENGINE = MyISAM)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;

View File

@ -0,0 +1,4 @@
--source include/have_innodb.inc
--source include/have_partition.inc
--let $engine=InnoDB
--source inc/part_alter_values.inc

View File

@ -16,3 +16,6 @@ select * from t1;
alter table t1 drop partition p20181231;
select * from t1;
drop table t1;
--let $engine=Aria
--source inc/part_alter_values.inc

View File

@ -1,17 +1,3 @@
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
--source include/have_partition.inc
CREATE TABLE t1 (i INT) ENGINE=MYISAM
PARTITION BY LIST(i) (
PARTITION p0 VALUES IN (1),
PARTITION p1 VALUES IN (2)
);
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
# Cleanup
DROP TABLE t1;
--let $engine=MyISAM
--source inc/part_alter_values.inc

View File

@ -0,0 +1,19 @@
INSTALL SONAME "simple_password_check";
SELECT PLUGIN_NAME FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME='simple_password_check';
PLUGIN_NAME
simple_password_check
#
# MDEV-14031 Password policy causes replication failure
#
CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85';
CREATE USER user2@localhost IDENTIFIED BY 'bsg9#d.cem#!85';
ERROR HY000: Your password does not satisfy the current policy requirements
DROP USER user1@localhost;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85'
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP USER user1@localhost
UNINSTALL PLUGIN simple_password_check;

View File

@ -0,0 +1,31 @@
--source include/not_embedded.inc
--source include/have_binlog_format_statement.inc
if (!$SIMPLE_PASSWORD_CHECK_SO) {
skip No SIMPLE_PASSWORD_CHECK plugin;
}
INSTALL SONAME "simple_password_check";
SELECT PLUGIN_NAME FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME='simple_password_check';
--echo #
--echo # MDEV-14031 Password policy causes replication failure
--echo #
--disable_query_log
RESET MASTER; # get rid of previous tests binlog
--enable_query_log
CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85';
--error ER_NOT_VALID_PASSWORD
CREATE USER user2@localhost IDENTIFIED BY 'bsg9#d.cem#!85';
DROP USER user1@localhost;
--let $binlog_file = LAST
source include/show_binlog_events.inc;
UNINSTALL PLUGIN simple_password_check;

View File

@ -0,0 +1,543 @@
#
# MDEV-12366: FLUSH PRIVILEGES can break hierarchy of roles
#
# This testcase contains a user, who is granted a master role
# operations_cluster. operations_cluster is granted 8 different roles
# who in turn each have 4 different roles granted to them.
#
# Only the leaf roles contain privileges to access databases.
# Make sure the user has access to all databases if the master role
# is granted to him.
#
CREATE USER u;
CREATE ROLE operations_cluster;
GRANT operations_cluster TO u;
CREATE DATABASE bob_live_sg;
CREATE TABLE bob_live_sg.a (i INT(10));
CREATE TABLE bob_live_sg.b (i INT(10));
CREATE TABLE bob_live_sg.c (i INT(10));
CREATE TABLE bob_live_sg.d (i INT(10));
CREATE DATABASE oms_live_sg;
CREATE TABLE oms_live_sg.a (i INT(10));
CREATE TABLE oms_live_sg.b (i INT(10));
CREATE TABLE oms_live_sg.c (i INT(10));
CREATE TABLE oms_live_sg.d (i INT(10));
CREATE DATABASE bob_live_ph;
CREATE TABLE bob_live_ph.a (i INT(10));
CREATE TABLE bob_live_ph.b (i INT(10));
CREATE TABLE bob_live_ph.c (i INT(10));
CREATE TABLE bob_live_ph.d (i INT(10));
CREATE DATABASE oms_live_ph;
CREATE TABLE oms_live_ph.a (i INT(10));
CREATE TABLE oms_live_ph.b (i INT(10));
CREATE TABLE oms_live_ph.c (i INT(10));
CREATE TABLE oms_live_ph.d (i INT(10));
CREATE DATABASE bob_live_id;
CREATE TABLE bob_live_id.a (i INT(10));
CREATE TABLE bob_live_id.b (i INT(10));
CREATE TABLE bob_live_id.c (i INT(10));
CREATE TABLE bob_live_id.d (i INT(10));
CREATE DATABASE oms_live_id;
CREATE TABLE oms_live_id.a (i INT(10));
CREATE TABLE oms_live_id.b (i INT(10));
CREATE TABLE oms_live_id.c (i INT(10));
CREATE TABLE oms_live_id.d (i INT(10));
CREATE DATABASE bob_live_hk;
CREATE TABLE bob_live_hk.a (i INT(10));
CREATE TABLE bob_live_hk.b (i INT(10));
CREATE TABLE bob_live_hk.c (i INT(10));
CREATE TABLE bob_live_hk.d (i INT(10));
CREATE DATABASE oms_live_hk;
CREATE TABLE oms_live_hk.a (i INT(10));
CREATE TABLE oms_live_hk.b (i INT(10));
CREATE TABLE oms_live_hk.c (i INT(10));
CREATE TABLE oms_live_hk.d (i INT(10));
CREATE DATABASE bob_live_vn;
CREATE TABLE bob_live_vn.a (i INT(10));
CREATE TABLE bob_live_vn.b (i INT(10));
CREATE TABLE bob_live_vn.c (i INT(10));
CREATE TABLE bob_live_vn.d (i INT(10));
CREATE DATABASE oms_live_vn;
CREATE TABLE oms_live_vn.a (i INT(10));
CREATE TABLE oms_live_vn.b (i INT(10));
CREATE TABLE oms_live_vn.c (i INT(10));
CREATE TABLE oms_live_vn.d (i INT(10));
CREATE DATABASE bob_live_tw;
CREATE TABLE bob_live_tw.a (i INT(10));
CREATE TABLE bob_live_tw.b (i INT(10));
CREATE TABLE bob_live_tw.c (i INT(10));
CREATE TABLE bob_live_tw.d (i INT(10));
CREATE DATABASE oms_live_tw;
CREATE TABLE oms_live_tw.a (i INT(10));
CREATE TABLE oms_live_tw.b (i INT(10));
CREATE TABLE oms_live_tw.c (i INT(10));
CREATE TABLE oms_live_tw.d (i INT(10));
CREATE DATABASE bob_live_my;
CREATE TABLE bob_live_my.a (i INT(10));
CREATE TABLE bob_live_my.b (i INT(10));
CREATE TABLE bob_live_my.c (i INT(10));
CREATE TABLE bob_live_my.d (i INT(10));
CREATE DATABASE oms_live_my;
CREATE TABLE oms_live_my.a (i INT(10));
CREATE TABLE oms_live_my.b (i INT(10));
CREATE TABLE oms_live_my.c (i INT(10));
CREATE TABLE oms_live_my.d (i INT(10));
CREATE DATABASE bob_live_th;
CREATE TABLE bob_live_th.a (i INT(10));
CREATE TABLE bob_live_th.b (i INT(10));
CREATE TABLE bob_live_th.c (i INT(10));
CREATE TABLE bob_live_th.d (i INT(10));
CREATE DATABASE oms_live_th;
CREATE TABLE oms_live_th.a (i INT(10));
CREATE TABLE oms_live_th.b (i INT(10));
CREATE TABLE oms_live_th.c (i INT(10));
CREATE TABLE oms_live_th.d (i INT(10));
CREATE ROLE a_sg;
CREATE ROLE b_sg;
CREATE ROLE c_sg;
CREATE ROLE d_sg;
CREATE ROLE operations_sg;
GRANT a_sg TO operations_sg;
GRANT b_sg TO operations_sg;
GRANT c_sg TO operations_sg;
GRANT d_sg TO operations_sg;
GRANT SELECT ON bob_live_sg.a TO a_sg;
GRANT SELECT ON bob_live_sg.b TO b_sg;
GRANT SELECT ON bob_live_sg.c TO c_sg;
GRANT SELECT ON bob_live_sg.d TO d_sg;
GRANT SELECT ON oms_live_sg.a TO a_sg;
GRANT SELECT ON oms_live_sg.b TO b_sg;
GRANT SELECT ON oms_live_sg.c TO c_sg;
GRANT SELECT ON oms_live_sg.d TO d_sg;
CREATE ROLE a_ph;
CREATE ROLE b_ph;
CREATE ROLE c_ph;
CREATE ROLE d_ph;
CREATE ROLE operations_ph;
GRANT a_ph TO operations_ph;
GRANT b_ph TO operations_ph;
GRANT c_ph TO operations_ph;
GRANT d_ph TO operations_ph;
GRANT SELECT ON bob_live_ph.a TO a_ph;
GRANT SELECT ON bob_live_ph.b TO b_ph;
GRANT SELECT ON bob_live_ph.c TO c_ph;
GRANT SELECT ON bob_live_ph.d TO d_ph;
GRANT SELECT ON oms_live_ph.a TO a_ph;
GRANT SELECT ON oms_live_ph.b TO b_ph;
GRANT SELECT ON oms_live_ph.c TO c_ph;
GRANT SELECT ON oms_live_ph.d TO d_ph;
CREATE ROLE a_id;
CREATE ROLE b_id;
CREATE ROLE c_id;
CREATE ROLE d_id;
CREATE ROLE operations_id;
GRANT a_id TO operations_id;
GRANT b_id TO operations_id;
GRANT c_id TO operations_id;
GRANT d_id TO operations_id;
GRANT SELECT ON bob_live_id.a TO a_id;
GRANT SELECT ON bob_live_id.b TO b_id;
GRANT SELECT ON bob_live_id.c TO c_id;
GRANT SELECT ON bob_live_id.d TO d_id;
GRANT SELECT ON oms_live_id.a TO a_id;
GRANT SELECT ON oms_live_id.b TO b_id;
GRANT SELECT ON oms_live_id.c TO c_id;
GRANT SELECT ON oms_live_id.d TO d_id;
CREATE ROLE a_hk;
CREATE ROLE b_hk;
CREATE ROLE c_hk;
CREATE ROLE d_hk;
CREATE ROLE operations_hk;
GRANT a_hk TO operations_hk;
GRANT b_hk TO operations_hk;
GRANT c_hk TO operations_hk;
GRANT d_hk TO operations_hk;
GRANT SELECT ON bob_live_hk.a TO a_hk;
GRANT SELECT ON bob_live_hk.b TO b_hk;
GRANT SELECT ON bob_live_hk.c TO c_hk;
GRANT SELECT ON bob_live_hk.d TO d_hk;
GRANT SELECT ON oms_live_hk.a TO a_hk;
GRANT SELECT ON oms_live_hk.b TO b_hk;
GRANT SELECT ON oms_live_hk.c TO c_hk;
GRANT SELECT ON oms_live_hk.d TO d_hk;
CREATE ROLE a_vn;
CREATE ROLE b_vn;
CREATE ROLE c_vn;
CREATE ROLE d_vn;
CREATE ROLE operations_vn;
GRANT a_vn TO operations_vn;
GRANT b_vn TO operations_vn;
GRANT c_vn TO operations_vn;
GRANT d_vn TO operations_vn;
GRANT SELECT ON bob_live_vn.a TO a_vn;
GRANT SELECT ON bob_live_vn.b TO b_vn;
GRANT SELECT ON bob_live_vn.c TO c_vn;
GRANT SELECT ON bob_live_vn.d TO d_vn;
GRANT SELECT ON oms_live_vn.a TO a_vn;
GRANT SELECT ON oms_live_vn.b TO b_vn;
GRANT SELECT ON oms_live_vn.c TO c_vn;
GRANT SELECT ON oms_live_vn.d TO d_vn;
CREATE ROLE a_tw;
CREATE ROLE b_tw;
CREATE ROLE c_tw;
CREATE ROLE d_tw;
CREATE ROLE operations_tw;
GRANT a_tw TO operations_tw;
GRANT b_tw TO operations_tw;
GRANT c_tw TO operations_tw;
GRANT d_tw TO operations_tw;
GRANT SELECT ON bob_live_tw.a TO a_tw;
GRANT SELECT ON bob_live_tw.b TO b_tw;
GRANT SELECT ON bob_live_tw.c TO c_tw;
GRANT SELECT ON bob_live_tw.d TO d_tw;
GRANT SELECT ON oms_live_tw.a TO a_tw;
GRANT SELECT ON oms_live_tw.b TO b_tw;
GRANT SELECT ON oms_live_tw.c TO c_tw;
GRANT SELECT ON oms_live_tw.d TO d_tw;
CREATE ROLE a_my;
CREATE ROLE b_my;
CREATE ROLE c_my;
CREATE ROLE d_my;
CREATE ROLE operations_my;
GRANT a_my TO operations_my;
GRANT b_my TO operations_my;
GRANT c_my TO operations_my;
GRANT d_my TO operations_my;
GRANT SELECT ON bob_live_my.a TO a_my;
GRANT SELECT ON bob_live_my.b TO b_my;
GRANT SELECT ON bob_live_my.c TO c_my;
GRANT SELECT ON bob_live_my.d TO d_my;
GRANT SELECT ON oms_live_my.a TO a_my;
GRANT SELECT ON oms_live_my.b TO b_my;
GRANT SELECT ON oms_live_my.c TO c_my;
GRANT SELECT ON oms_live_my.d TO d_my;
CREATE ROLE a_th;
CREATE ROLE b_th;
CREATE ROLE c_th;
CREATE ROLE d_th;
CREATE ROLE operations_th;
GRANT a_th TO operations_th;
GRANT b_th TO operations_th;
GRANT c_th TO operations_th;
GRANT d_th TO operations_th;
GRANT SELECT ON bob_live_th.a TO a_th;
GRANT SELECT ON bob_live_th.b TO b_th;
GRANT SELECT ON bob_live_th.c TO c_th;
GRANT SELECT ON bob_live_th.d TO d_th;
GRANT SELECT ON oms_live_th.a TO a_th;
GRANT SELECT ON oms_live_th.b TO b_th;
GRANT SELECT ON oms_live_th.c TO c_th;
GRANT SELECT ON oms_live_th.d TO d_th;
GRANT operations_sg TO operations_cluster;
GRANT operations_ph TO operations_cluster;
GRANT operations_id TO operations_cluster;
GRANT operations_hk TO operations_cluster;
GRANT operations_vn TO operations_cluster;
GRANT operations_tw TO operations_cluster;
GRANT operations_my TO operations_cluster;
GRANT operations_th TO operations_cluster;
connect con1,localhost,u,,;
SHOW DATABASES;
Database
information_schema
test
SET ROLE operations_cluster;
SHOW DATABASES;
Database
bob_live_hk
bob_live_id
bob_live_my
bob_live_ph
bob_live_sg
bob_live_th
bob_live_tw
bob_live_vn
information_schema
oms_live_hk
oms_live_id
oms_live_my
oms_live_ph
oms_live_sg
oms_live_th
oms_live_tw
oms_live_vn
test
SELECT COUNT(1) FROM oms_live_sg.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.d;
COUNT(1)
0
connect con2,localhost,root,,;
FLUSH PRIVILEGES;
connect con3,localhost,u,,;
SHOW DATABASES;
Database
information_schema
test
SET ROLE operations_cluster;
SHOW DATABASES;
Database
bob_live_hk
bob_live_id
bob_live_my
bob_live_ph
bob_live_sg
bob_live_th
bob_live_tw
bob_live_vn
information_schema
oms_live_hk
oms_live_id
oms_live_my
oms_live_ph
oms_live_sg
oms_live_th
oms_live_tw
oms_live_vn
test
SELECT COUNT(1) FROM oms_live_sg.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.d;
COUNT(1)
0
connect con4,localhost,root,,;
DROP DATABASE bob_live_sg;
DROP DATABASE oms_live_sg;
DROP DATABASE bob_live_ph;
DROP DATABASE oms_live_ph;
DROP DATABASE bob_live_id;
DROP DATABASE oms_live_id;
DROP DATABASE bob_live_hk;
DROP DATABASE oms_live_hk;
DROP DATABASE bob_live_vn;
DROP DATABASE oms_live_vn;
DROP DATABASE bob_live_tw;
DROP DATABASE oms_live_tw;
DROP DATABASE bob_live_my;
DROP DATABASE oms_live_my;
DROP DATABASE bob_live_th;
DROP DATABASE oms_live_th;
DROP ROLE operations_sg;
DROP ROLE a_sg;
DROP ROLE b_sg;
DROP ROLE c_sg;
DROP ROLE d_sg;
DROP ROLE operations_ph;
DROP ROLE a_ph;
DROP ROLE b_ph;
DROP ROLE c_ph;
DROP ROLE d_ph;
DROP ROLE operations_id;
DROP ROLE a_id;
DROP ROLE b_id;
DROP ROLE c_id;
DROP ROLE d_id;
DROP ROLE operations_hk;
DROP ROLE a_hk;
DROP ROLE b_hk;
DROP ROLE c_hk;
DROP ROLE d_hk;
DROP ROLE operations_vn;
DROP ROLE a_vn;
DROP ROLE b_vn;
DROP ROLE c_vn;
DROP ROLE d_vn;
DROP ROLE operations_tw;
DROP ROLE a_tw;
DROP ROLE b_tw;
DROP ROLE c_tw;
DROP ROLE d_tw;
DROP ROLE operations_my;
DROP ROLE a_my;
DROP ROLE b_my;
DROP ROLE c_my;
DROP ROLE d_my;
DROP ROLE operations_th;
DROP ROLE a_th;
DROP ROLE b_th;
DROP ROLE c_th;
DROP ROLE d_th;
DROP USER u;
DROP ROLE operations_cluster;

View File

@ -0,0 +1,379 @@
--source include/not_embedded.inc
--echo #
--echo # MDEV-12366: FLUSH PRIVILEGES can break hierarchy of roles
--echo #
--echo # This testcase contains a user, who is granted a master role
--echo # operations_cluster. operations_cluster is granted 8 different roles
--echo # who in turn each have 4 different roles granted to them.
--echo #
--echo # Only the leaf roles contain privileges to access databases.
--echo # Make sure the user has access to all databases if the master role
--echo # is granted to him.
--echo #
CREATE USER u;
CREATE ROLE operations_cluster;
GRANT operations_cluster TO u;
CREATE DATABASE bob_live_sg;
CREATE TABLE bob_live_sg.a (i INT(10));
CREATE TABLE bob_live_sg.b (i INT(10));
CREATE TABLE bob_live_sg.c (i INT(10));
CREATE TABLE bob_live_sg.d (i INT(10));
CREATE DATABASE oms_live_sg;
CREATE TABLE oms_live_sg.a (i INT(10));
CREATE TABLE oms_live_sg.b (i INT(10));
CREATE TABLE oms_live_sg.c (i INT(10));
CREATE TABLE oms_live_sg.d (i INT(10));
CREATE DATABASE bob_live_ph;
CREATE TABLE bob_live_ph.a (i INT(10));
CREATE TABLE bob_live_ph.b (i INT(10));
CREATE TABLE bob_live_ph.c (i INT(10));
CREATE TABLE bob_live_ph.d (i INT(10));
CREATE DATABASE oms_live_ph;
CREATE TABLE oms_live_ph.a (i INT(10));
CREATE TABLE oms_live_ph.b (i INT(10));
CREATE TABLE oms_live_ph.c (i INT(10));
CREATE TABLE oms_live_ph.d (i INT(10));
CREATE DATABASE bob_live_id;
CREATE TABLE bob_live_id.a (i INT(10));
CREATE TABLE bob_live_id.b (i INT(10));
CREATE TABLE bob_live_id.c (i INT(10));
CREATE TABLE bob_live_id.d (i INT(10));
CREATE DATABASE oms_live_id;
CREATE TABLE oms_live_id.a (i INT(10));
CREATE TABLE oms_live_id.b (i INT(10));
CREATE TABLE oms_live_id.c (i INT(10));
CREATE TABLE oms_live_id.d (i INT(10));
CREATE DATABASE bob_live_hk;
CREATE TABLE bob_live_hk.a (i INT(10));
CREATE TABLE bob_live_hk.b (i INT(10));
CREATE TABLE bob_live_hk.c (i INT(10));
CREATE TABLE bob_live_hk.d (i INT(10));
CREATE DATABASE oms_live_hk;
CREATE TABLE oms_live_hk.a (i INT(10));
CREATE TABLE oms_live_hk.b (i INT(10));
CREATE TABLE oms_live_hk.c (i INT(10));
CREATE TABLE oms_live_hk.d (i INT(10));
CREATE DATABASE bob_live_vn;
CREATE TABLE bob_live_vn.a (i INT(10));
CREATE TABLE bob_live_vn.b (i INT(10));
CREATE TABLE bob_live_vn.c (i INT(10));
CREATE TABLE bob_live_vn.d (i INT(10));
CREATE DATABASE oms_live_vn;
CREATE TABLE oms_live_vn.a (i INT(10));
CREATE TABLE oms_live_vn.b (i INT(10));
CREATE TABLE oms_live_vn.c (i INT(10));
CREATE TABLE oms_live_vn.d (i INT(10));
CREATE DATABASE bob_live_tw;
CREATE TABLE bob_live_tw.a (i INT(10));
CREATE TABLE bob_live_tw.b (i INT(10));
CREATE TABLE bob_live_tw.c (i INT(10));
CREATE TABLE bob_live_tw.d (i INT(10));
CREATE DATABASE oms_live_tw;
CREATE TABLE oms_live_tw.a (i INT(10));
CREATE TABLE oms_live_tw.b (i INT(10));
CREATE TABLE oms_live_tw.c (i INT(10));
CREATE TABLE oms_live_tw.d (i INT(10));
CREATE DATABASE bob_live_my;
CREATE TABLE bob_live_my.a (i INT(10));
CREATE TABLE bob_live_my.b (i INT(10));
CREATE TABLE bob_live_my.c (i INT(10));
CREATE TABLE bob_live_my.d (i INT(10));
CREATE DATABASE oms_live_my;
CREATE TABLE oms_live_my.a (i INT(10));
CREATE TABLE oms_live_my.b (i INT(10));
CREATE TABLE oms_live_my.c (i INT(10));
CREATE TABLE oms_live_my.d (i INT(10));
CREATE DATABASE bob_live_th;
CREATE TABLE bob_live_th.a (i INT(10));
CREATE TABLE bob_live_th.b (i INT(10));
CREATE TABLE bob_live_th.c (i INT(10));
CREATE TABLE bob_live_th.d (i INT(10));
CREATE DATABASE oms_live_th;
CREATE TABLE oms_live_th.a (i INT(10));
CREATE TABLE oms_live_th.b (i INT(10));
CREATE TABLE oms_live_th.c (i INT(10));
CREATE TABLE oms_live_th.d (i INT(10));
CREATE ROLE a_sg;
CREATE ROLE b_sg;
CREATE ROLE c_sg;
CREATE ROLE d_sg;
CREATE ROLE operations_sg;
GRANT a_sg TO operations_sg;
GRANT b_sg TO operations_sg;
GRANT c_sg TO operations_sg;
GRANT d_sg TO operations_sg;
GRANT SELECT ON bob_live_sg.a TO a_sg;
GRANT SELECT ON bob_live_sg.b TO b_sg;
GRANT SELECT ON bob_live_sg.c TO c_sg;
GRANT SELECT ON bob_live_sg.d TO d_sg;
GRANT SELECT ON oms_live_sg.a TO a_sg;
GRANT SELECT ON oms_live_sg.b TO b_sg;
GRANT SELECT ON oms_live_sg.c TO c_sg;
GRANT SELECT ON oms_live_sg.d TO d_sg;
CREATE ROLE a_ph;
CREATE ROLE b_ph;
CREATE ROLE c_ph;
CREATE ROLE d_ph;
CREATE ROLE operations_ph;
GRANT a_ph TO operations_ph;
GRANT b_ph TO operations_ph;
GRANT c_ph TO operations_ph;
GRANT d_ph TO operations_ph;
GRANT SELECT ON bob_live_ph.a TO a_ph;
GRANT SELECT ON bob_live_ph.b TO b_ph;
GRANT SELECT ON bob_live_ph.c TO c_ph;
GRANT SELECT ON bob_live_ph.d TO d_ph;
GRANT SELECT ON oms_live_ph.a TO a_ph;
GRANT SELECT ON oms_live_ph.b TO b_ph;
GRANT SELECT ON oms_live_ph.c TO c_ph;
GRANT SELECT ON oms_live_ph.d TO d_ph;
CREATE ROLE a_id;
CREATE ROLE b_id;
CREATE ROLE c_id;
CREATE ROLE d_id;
CREATE ROLE operations_id;
GRANT a_id TO operations_id;
GRANT b_id TO operations_id;
GRANT c_id TO operations_id;
GRANT d_id TO operations_id;
GRANT SELECT ON bob_live_id.a TO a_id;
GRANT SELECT ON bob_live_id.b TO b_id;
GRANT SELECT ON bob_live_id.c TO c_id;
GRANT SELECT ON bob_live_id.d TO d_id;
GRANT SELECT ON oms_live_id.a TO a_id;
GRANT SELECT ON oms_live_id.b TO b_id;
GRANT SELECT ON oms_live_id.c TO c_id;
GRANT SELECT ON oms_live_id.d TO d_id;
CREATE ROLE a_hk;
CREATE ROLE b_hk;
CREATE ROLE c_hk;
CREATE ROLE d_hk;
CREATE ROLE operations_hk;
GRANT a_hk TO operations_hk;
GRANT b_hk TO operations_hk;
GRANT c_hk TO operations_hk;
GRANT d_hk TO operations_hk;
GRANT SELECT ON bob_live_hk.a TO a_hk;
GRANT SELECT ON bob_live_hk.b TO b_hk;
GRANT SELECT ON bob_live_hk.c TO c_hk;
GRANT SELECT ON bob_live_hk.d TO d_hk;
GRANT SELECT ON oms_live_hk.a TO a_hk;
GRANT SELECT ON oms_live_hk.b TO b_hk;
GRANT SELECT ON oms_live_hk.c TO c_hk;
GRANT SELECT ON oms_live_hk.d TO d_hk;
CREATE ROLE a_vn;
CREATE ROLE b_vn;
CREATE ROLE c_vn;
CREATE ROLE d_vn;
CREATE ROLE operations_vn;
GRANT a_vn TO operations_vn;
GRANT b_vn TO operations_vn;
GRANT c_vn TO operations_vn;
GRANT d_vn TO operations_vn;
GRANT SELECT ON bob_live_vn.a TO a_vn;
GRANT SELECT ON bob_live_vn.b TO b_vn;
GRANT SELECT ON bob_live_vn.c TO c_vn;
GRANT SELECT ON bob_live_vn.d TO d_vn;
GRANT SELECT ON oms_live_vn.a TO a_vn;
GRANT SELECT ON oms_live_vn.b TO b_vn;
GRANT SELECT ON oms_live_vn.c TO c_vn;
GRANT SELECT ON oms_live_vn.d TO d_vn;
CREATE ROLE a_tw;
CREATE ROLE b_tw;
CREATE ROLE c_tw;
CREATE ROLE d_tw;
CREATE ROLE operations_tw;
GRANT a_tw TO operations_tw;
GRANT b_tw TO operations_tw;
GRANT c_tw TO operations_tw;
GRANT d_tw TO operations_tw;
GRANT SELECT ON bob_live_tw.a TO a_tw;
GRANT SELECT ON bob_live_tw.b TO b_tw;
GRANT SELECT ON bob_live_tw.c TO c_tw;
GRANT SELECT ON bob_live_tw.d TO d_tw;
GRANT SELECT ON oms_live_tw.a TO a_tw;
GRANT SELECT ON oms_live_tw.b TO b_tw;
GRANT SELECT ON oms_live_tw.c TO c_tw;
GRANT SELECT ON oms_live_tw.d TO d_tw;
CREATE ROLE a_my;
CREATE ROLE b_my;
CREATE ROLE c_my;
CREATE ROLE d_my;
CREATE ROLE operations_my;
GRANT a_my TO operations_my;
GRANT b_my TO operations_my;
GRANT c_my TO operations_my;
GRANT d_my TO operations_my;
GRANT SELECT ON bob_live_my.a TO a_my;
GRANT SELECT ON bob_live_my.b TO b_my;
GRANT SELECT ON bob_live_my.c TO c_my;
GRANT SELECT ON bob_live_my.d TO d_my;
GRANT SELECT ON oms_live_my.a TO a_my;
GRANT SELECT ON oms_live_my.b TO b_my;
GRANT SELECT ON oms_live_my.c TO c_my;
GRANT SELECT ON oms_live_my.d TO d_my;
CREATE ROLE a_th;
CREATE ROLE b_th;
CREATE ROLE c_th;
CREATE ROLE d_th;
CREATE ROLE operations_th;
GRANT a_th TO operations_th;
GRANT b_th TO operations_th;
GRANT c_th TO operations_th;
GRANT d_th TO operations_th;
GRANT SELECT ON bob_live_th.a TO a_th;
GRANT SELECT ON bob_live_th.b TO b_th;
GRANT SELECT ON bob_live_th.c TO c_th;
GRANT SELECT ON bob_live_th.d TO d_th;
GRANT SELECT ON oms_live_th.a TO a_th;
GRANT SELECT ON oms_live_th.b TO b_th;
GRANT SELECT ON oms_live_th.c TO c_th;
GRANT SELECT ON oms_live_th.d TO d_th;
GRANT operations_sg TO operations_cluster;
GRANT operations_ph TO operations_cluster;
GRANT operations_id TO operations_cluster;
GRANT operations_hk TO operations_cluster;
GRANT operations_vn TO operations_cluster;
GRANT operations_tw TO operations_cluster;
GRANT operations_my TO operations_cluster;
GRANT operations_th TO operations_cluster;
connect(con1,localhost,u,,);
SHOW DATABASES;
SET ROLE operations_cluster;
SHOW DATABASES;
SELECT COUNT(1) FROM oms_live_sg.a;
SELECT COUNT(1) FROM oms_live_sg.b;
SELECT COUNT(1) FROM oms_live_sg.c;
SELECT COUNT(1) FROM oms_live_sg.d;
SELECT COUNT(1) FROM oms_live_ph.a;
SELECT COUNT(1) FROM oms_live_ph.b;
SELECT COUNT(1) FROM oms_live_ph.c;
SELECT COUNT(1) FROM oms_live_ph.d;
SELECT COUNT(1) FROM oms_live_id.a;
SELECT COUNT(1) FROM oms_live_id.b;
SELECT COUNT(1) FROM oms_live_id.c;
SELECT COUNT(1) FROM oms_live_id.d;
SELECT COUNT(1) FROM oms_live_hk.a;
SELECT COUNT(1) FROM oms_live_hk.b;
SELECT COUNT(1) FROM oms_live_hk.c;
SELECT COUNT(1) FROM oms_live_hk.d;
SELECT COUNT(1) FROM oms_live_vn.a;
SELECT COUNT(1) FROM oms_live_vn.b;
SELECT COUNT(1) FROM oms_live_vn.c;
SELECT COUNT(1) FROM oms_live_vn.d;
SELECT COUNT(1) FROM oms_live_tw.a;
SELECT COUNT(1) FROM oms_live_tw.b;
SELECT COUNT(1) FROM oms_live_tw.c;
SELECT COUNT(1) FROM oms_live_tw.d;
SELECT COUNT(1) FROM oms_live_my.a;
SELECT COUNT(1) FROM oms_live_my.b;
SELECT COUNT(1) FROM oms_live_my.c;
SELECT COUNT(1) FROM oms_live_my.d;
SELECT COUNT(1) FROM oms_live_th.a;
SELECT COUNT(1) FROM oms_live_th.b;
SELECT COUNT(1) FROM oms_live_th.c;
SELECT COUNT(1) FROM oms_live_th.d;
connect(con2,localhost,root,,);
FLUSH PRIVILEGES;
connect(con3,localhost,u,,);
SHOW DATABASES;
SET ROLE operations_cluster;
SHOW DATABASES;
SELECT COUNT(1) FROM oms_live_sg.a;
SELECT COUNT(1) FROM oms_live_sg.b;
SELECT COUNT(1) FROM oms_live_sg.c;
SELECT COUNT(1) FROM oms_live_sg.d;
SELECT COUNT(1) FROM oms_live_ph.a;
SELECT COUNT(1) FROM oms_live_ph.b;
SELECT COUNT(1) FROM oms_live_ph.c;
SELECT COUNT(1) FROM oms_live_ph.d;
SELECT COUNT(1) FROM oms_live_id.a;
SELECT COUNT(1) FROM oms_live_id.b;
SELECT COUNT(1) FROM oms_live_id.c;
SELECT COUNT(1) FROM oms_live_id.d;
SELECT COUNT(1) FROM oms_live_hk.a;
SELECT COUNT(1) FROM oms_live_hk.b;
SELECT COUNT(1) FROM oms_live_hk.c;
SELECT COUNT(1) FROM oms_live_hk.d;
SELECT COUNT(1) FROM oms_live_vn.a;
SELECT COUNT(1) FROM oms_live_vn.b;
SELECT COUNT(1) FROM oms_live_vn.c;
SELECT COUNT(1) FROM oms_live_vn.d;
SELECT COUNT(1) FROM oms_live_tw.a;
SELECT COUNT(1) FROM oms_live_tw.b;
SELECT COUNT(1) FROM oms_live_tw.c;
SELECT COUNT(1) FROM oms_live_tw.d;
SELECT COUNT(1) FROM oms_live_my.a;
SELECT COUNT(1) FROM oms_live_my.b;
SELECT COUNT(1) FROM oms_live_my.c;
SELECT COUNT(1) FROM oms_live_my.d;
SELECT COUNT(1) FROM oms_live_th.a;
SELECT COUNT(1) FROM oms_live_th.b;
SELECT COUNT(1) FROM oms_live_th.c;
SELECT COUNT(1) FROM oms_live_th.d;
connect(con4,localhost,root,,);
DROP DATABASE bob_live_sg;
DROP DATABASE oms_live_sg;
DROP DATABASE bob_live_ph;
DROP DATABASE oms_live_ph;
DROP DATABASE bob_live_id;
DROP DATABASE oms_live_id;
DROP DATABASE bob_live_hk;
DROP DATABASE oms_live_hk;
DROP DATABASE bob_live_vn;
DROP DATABASE oms_live_vn;
DROP DATABASE bob_live_tw;
DROP DATABASE oms_live_tw;
DROP DATABASE bob_live_my;
DROP DATABASE oms_live_my;
DROP DATABASE bob_live_th;
DROP DATABASE oms_live_th;
DROP ROLE operations_sg;
DROP ROLE a_sg;
DROP ROLE b_sg;
DROP ROLE c_sg;
DROP ROLE d_sg;
DROP ROLE operations_ph;
DROP ROLE a_ph;
DROP ROLE b_ph;
DROP ROLE c_ph;
DROP ROLE d_ph;
DROP ROLE operations_id;
DROP ROLE a_id;
DROP ROLE b_id;
DROP ROLE c_id;
DROP ROLE d_id;
DROP ROLE operations_hk;
DROP ROLE a_hk;
DROP ROLE b_hk;
DROP ROLE c_hk;
DROP ROLE d_hk;
DROP ROLE operations_vn;
DROP ROLE a_vn;
DROP ROLE b_vn;
DROP ROLE c_vn;
DROP ROLE d_vn;
DROP ROLE operations_tw;
DROP ROLE a_tw;
DROP ROLE b_tw;
DROP ROLE c_tw;
DROP ROLE d_tw;
DROP ROLE operations_my;
DROP ROLE a_my;
DROP ROLE b_my;
DROP ROLE c_my;
DROP ROLE d_my;
DROP ROLE operations_th;
DROP ROLE a_th;
DROP ROLE b_th;
DROP ROLE c_th;
DROP ROLE d_th;
DROP USER u;
DROP ROLE operations_cluster;

View File

@ -0,0 +1,52 @@
#
# MDEV-13655: SET ROLE does not properly grant privileges.
#
# We must test that if aditional db privileges get granted to a role
# which previously inherited privileges from another granted role
# keep the internal memory structures intact.
#
create role simple;
#
# First we create an entry with privileges for databases for the simple role.
#
grant select, insert, update, delete, lock tables, execute on t.* to simple;
create role admin;
#
# Now we grant the simple role to admin. This means that db privileges
# should propagate to admin.
#
grant simple to admin;
show grants for admin;
Grants for admin
GRANT simple TO 'admin'
GRANT USAGE ON *.* TO 'admin'
GRANT USAGE ON *.* TO 'simple'
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO 'simple'
#
# Finally, we give the admin all the available privileges for the db.
#
grant all on t.* to admin;
#
# Create a user to test out the new roles;
#
create user foo;
grant admin to foo;
connect foo,localhost,foo,,,,,;
create database t;
ERROR 42000: Access denied for user 'foo'@'%' to database 't'
set role admin;
show grants;
Grants for foo@%
GRANT admin TO 'foo'@'%'
GRANT USAGE ON *.* TO 'foo'@'%'
GRANT simple TO 'admin'
GRANT USAGE ON *.* TO 'admin'
GRANT ALL PRIVILEGES ON `t`.* TO 'admin'
GRANT USAGE ON *.* TO 'simple'
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO 'simple'
create database t;
drop database t;
connection default;
drop role simple;
drop role admin;
drop user foo;

View File

@ -0,0 +1,49 @@
source include/not_embedded.inc;
--echo #
--echo # MDEV-13655: SET ROLE does not properly grant privileges.
--echo #
--echo # We must test that if aditional db privileges get granted to a role
--echo # which previously inherited privileges from another granted role
--echo # keep the internal memory structures intact.
--echo #
create role simple;
--echo #
--echo # First we create an entry with privileges for databases for the simple role.
--echo #
grant select, insert, update, delete, lock tables, execute on t.* to simple;
create role admin;
--echo #
--echo # Now we grant the simple role to admin. This means that db privileges
--echo # should propagate to admin.
--echo #
grant simple to admin;
show grants for admin;
--echo #
--echo # Finally, we give the admin all the available privileges for the db.
--echo #
grant all on t.* to admin;
--echo #
--echo # Create a user to test out the new roles;
--echo #
create user foo;
grant admin to foo;
connect (foo,localhost,foo,,,,,);
--error ER_DBACCESS_DENIED_ERROR
create database t;
set role admin;
show grants;
create database t;
drop database t;
connection default;
drop role simple;
drop role admin;
drop user foo;

View File

@ -136,18 +136,14 @@ SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN;
--echo
DROP TABLE t1;
--echo #
--echo # Start of 5.3 tests
--echo #
--echo #
--echo # MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
--echo # MDEV-14596 Crash in INTERVAL(ROW(..),ROW(..))
--echo #
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.3 tests
--echo #
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(ROW(1,1),ROW(1,2));
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(1,ROW(1,2));
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(ROW(1,2),1);

View File

@ -1789,6 +1789,32 @@ create table t2 (c1 int, c2 int);
select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3;
drop table t1, t2;
#
# MDEV-12350: Heap corruption, overrun buffer, ASAN errors, server crash in my_fill_8bit / filesort
#
SET @old_sort_buff_size = @@sort_buffer_size;
SET @@sort_buffer_size=256*1024;
CREATE TABLE t1 (c INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES
(2011),(1977),(1982),(2027),(2023),(NULL),(NULL),(2004),(1974),(2032),
(1993),(NULL),(1995),(2034),(NULL),(2009),(1900),(NULL),(2025),(1900),
(2033),(1900),(2012),(NULL),(2009),(1992),(1974),(1974),(2012),(2028),
(2007),(2012),(1900),(1983),(1900),(2010),(1987),(1994),(1981),(2032),
(2010),(1989),(2014),(1900),(1900),(1976),(1978),(2007),(2030),(NULL),
(2002),(1997),(1900),(NULL),(2000),(2027),(1975),(2026),(1975),(2026),
(2029),(1977),(1900),(1900),(2031),(1993),(1986),(2012),(1979),(2013),
(1994),(2014),(2025),(2006),(1971),(1974),(2021),(2011),(NULL),(1991),
(2001),(1977),(2023),(2012),(1900),(1978),(1998),(NULL),(1988),(1999),
(2017),(2008),(1976),(1900),(2005),(2030),(2023),(1900),(1978),(1990),
(1978),(1987),(2030),(1900),(2034),(2006),(2015),(2001),(2019),(2024),
(2030),(1989),(1997),(2007),(2023),(1994),(1971),(2011),(2011),(2015),
(1984),(1978),(1979),(1989),(2008),(2030);
SELECT ExtractValue('<a></a>','/a') AS f1, SPACE(c) AS f2 FROM t1 GROUP BY f1, f2 WITH ROLLUP;
SET @@sort_buffer_size = @old_sort_buff_size;
DROP TABLE t1;
#
# End of MariaDB 5.5 tests
#

View File

@ -728,6 +728,23 @@ HAVING UPPER(`column_1`) LIKE '8%';
drop table t1;
--echo #
--echo # mdev-14368: grouping query with alias for aggregate function in HAVING
--echo # when sql_mode = 'ONLY_FULL_GROUP_BY'
set @save_sql_mode= @@sql_mode;
set sql_mode = 'ONLY_FULL_GROUP_BY';
create table t1(a int);
insert t1 values (4),(1),(2),(1), (3),(4);
SELECT a, COUNT(a) as ct FROM t1 GROUP BY a HAVING ct>0;
set sql_mode=@save_sql_mode;
drop table t1;
--echo #
--echo # Bug mdev-5160: two-way join with HAVING over the second table
--echo #

View File

@ -1962,6 +1962,20 @@ DROP FUNCTION f1;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields
--echo #
CREATE TABLE t1 (b1 BIT NOT NULL);
INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
DROP TABLE t1, t2;
--echo # end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;

View File

@ -5583,6 +5583,18 @@ PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
drop view v1,v2;
drop table t3;
--echo #
--echo # MDEV-14619: VIEW and GROUP_CONCAT
--echo #
CREATE TABLE t1 (str text);
INSERT INTO t1 VALUES ("My"),("SQL");
CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1;
SELECT * FROM v1;
SHOW CREATE VIEW v1;
drop view v1;
drop table t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------

View File

@ -713,7 +713,7 @@ FROM t1;
SELECT UPDATEXML(txt, CONCAT('//', REPEAT('b', 63)), '63/63+') FROM t1;
DROP TABLE t1;
# This will call my_str_realloc_mysqld()
# This will call realloc()
CREATE TABLE t1 (a TEXT);
INSERT INTO t1 VALUES (CONCAT('<a><', REPEAT('b',128),'>b128</',REPEAT('b',128),'><',REPEAT('c',512),'>c512</',REPEAT('c',512),'></a>'));
SELECT ExtractValue (a, CONCAT('//',REPEAT('c',512))) AS c512 FROM t1;

View File

@ -487,8 +487,7 @@ int load_defaults(const char *conf_file, const char **groups,
easily command line options override options in configuration files
NOTES
In case of fatal error, the function will print a warning and do
exit(1)
In case of fatal error, the function will print a warning and returns 2
To free used memory one should call free_defaults() with the argument
that was put in *argv
@ -641,8 +640,7 @@ int my_load_defaults(const char *conf_file, const char **groups,
err:
fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
exit(1);
return 0; /* Keep compiler happy */
return 2;
}

View File

@ -109,7 +109,7 @@ void *my_malloc(size_t size, myf my_flags)
my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG +
ME_NOREFRESH + ME_FATALERROR),size);
if (my_flags & MY_FAE)
exit(1);
abort();
}
else
{

View File

@ -45,18 +45,6 @@ int find_type_with_warning(const char *x, TYPELIB *typelib, const char *option)
}
int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
{
int res;
if ((res= find_type_with_warning(x, typelib, option)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
return res;
}
/**
Search after a string in a list of strings. Endspace in x is not compared.

View File

@ -977,8 +977,8 @@ if expr "${-}" : '.*x' > /dev/null
then
:
else
exec 1>&-
exec 2>&-
exec 1>/dev/null
exec 2>/dev/null
fi
# maximum number of wsrep restarts

View File

@ -1072,7 +1072,7 @@ then
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
tempdir=$(parse_cnf mysqld log-bin "")
if [[ -n ${tempdir:-} ]];then

View File

@ -1234,11 +1234,12 @@ void mysql_read_default_options(struct st_mysql_options *options,
options->max_allowed_packet= atoi(opt_arg);
break;
case OPT_protocol:
if ((options->protocol= find_type(opt_arg, &sql_protocol_typelib,
if (options->protocol != UINT_MAX32 &&
(options->protocol= find_type(opt_arg, &sql_protocol_typelib,
FIND_TYPE_BASIC)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg);
exit(1);
options->protocol= UINT_MAX32;
}
break;
case OPT_shared_memory_base_name:
@ -3133,6 +3134,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
my_free(mysql->options.my_cnf_file);
my_free(mysql->options.my_cnf_group);
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
if (mysql->options.protocol == UINT_MAX32)
goto error;
}
/* Some empty-string-tests are done because of ODBC */

View File

@ -420,7 +420,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data)
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
DBUG_RETURN(true);
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}

View File

@ -997,7 +997,8 @@ Type_handler_string_result::make_sort_key(uchar *to, Item *item,
if (maybe_null)
*to++= 1;
char *tmp_buffer= param->tmp_buffer ? param->tmp_buffer : (char*) to;
String tmp(tmp_buffer, param->sort_length, cs);
String tmp(tmp_buffer, param->tmp_buffer ? param->sort_length :
sort_field->length, cs);
String *res= item->str_result(&tmp);
if (!res)
{

View File

@ -105,7 +105,7 @@ uchar **Filesort_buffer::alloc_sort_buffer(uint num_records,
DBUG_EXECUTE_IF("alloc_sort_buffer_fail",
DBUG_SET("+d,simulate_out_of_memory"););
buff_size= num_records * (record_length + sizeof(uchar*));
buff_size= ((size_t)num_records) * (record_length + sizeof(uchar*));
set_if_bigger(buff_size, record_length * MERGEBUFF2);
if (!m_idx_array.is_null())

View File

@ -4991,7 +4991,8 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
select->having_fix_field &&
select_ref != not_found_item && !group_by_ref)
select_ref != not_found_item && !group_by_ref &&
!ref->alias_name_used)
{
/*
Report the error if fields was found only in the SELECT item list and

View File

@ -1875,6 +1875,19 @@ bool Item_func_opt_neg::eq(const Item *item, bool binary_cmp) const
}
bool Item_func_interval::fix_fields(THD *thd, Item **ref)
{
if (Item_int_func::fix_fields(thd, ref))
return true;
for (uint i= 0 ; i < row->cols(); i++)
{
if (row->element_index(i)->check_cols(1))
return true;
}
return false;
}
void Item_func_interval::fix_length_and_dec()
{
uint rows= row->cols();

View File

@ -937,6 +937,7 @@ public:
{
allowed_arg_cols= 0; // Fetch this value from first argument
}
bool fix_fields(THD *, Item **);
longlong val_int();
void fix_length_and_dec();
const char *func_name() const { return "interval"; }

View File

@ -3746,7 +3746,7 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
}
}
str->append(STRING_WITH_LEN(" separator \'"));
str->append(*separator);
str->append_for_single_quote(separator->ptr(), separator->length());
str->append(STRING_WITH_LEN("\')"));
}

View File

@ -3640,8 +3640,6 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
extern "C" void *my_str_malloc_mysqld(size_t size);
extern "C" void my_str_free_mysqld(void *ptr);
extern "C" void *my_str_realloc_mysqld(void *ptr, size_t size);
void *my_str_malloc_mysqld(size_t size)
{
@ -3649,17 +3647,6 @@ void *my_str_malloc_mysqld(size_t size)
}
void my_str_free_mysqld(void *ptr)
{
my_free(ptr);
}
void *my_str_realloc_mysqld(void *ptr, size_t size)
{
return my_realloc(ptr, size, MYF(MY_FAE));
}
#ifdef __WIN__
pthread_handler_t handle_shutdown(void *arg)
@ -3715,14 +3702,8 @@ check_enough_stack_size(int recurse_level)
}
/*
Initialize my_str_malloc() and my_str_free()
*/
static void init_libstrings()
{
my_str_malloc= &my_str_malloc_mysqld;
my_str_free= &my_str_free_mysqld;
my_str_realloc= &my_str_realloc_mysqld;
#ifndef EMBEDDED_LIBRARY
my_string_stack_guard= check_enough_stack_size;
#endif
@ -3733,7 +3714,7 @@ ulonglong my_pcre_frame_size;
static void init_pcre()
{
pcre_malloc= pcre_stack_malloc= my_str_malloc_mysqld;
pcre_free= pcre_stack_free= my_str_free_mysqld;
pcre_free= pcre_stack_free= my_free;
pcre_stack_guard= check_enough_stack_size_slow;
/* See http://pcre.org/original/doc/html/pcrestack.html */
my_pcre_frame_size= -pcre_exec(NULL, NULL, NULL, -999, -999, 0, NULL, 0);

View File

@ -2382,6 +2382,24 @@ end:
DBUG_RETURN(result);
}
bool partition_info::error_if_requires_values() const
{
switch (part_type) {
case NOT_A_PARTITION:
case HASH_PARTITION:
break;
case RANGE_PARTITION:
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "RANGE", "LESS THAN");
return true;
case LIST_PARTITION:
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0), "LIST", "IN");
return true;
}
return false;
}
/**
Fix partition data from parser.
@ -2472,6 +2490,8 @@ bool partition_info::fix_parser_data(THD *thd)
part_elem= it++;
List_iterator<part_elem_value> list_val_it(part_elem->list_val_list);
num_elements= part_elem->list_val_list.elements;
if (!num_elements && error_if_requires_values())
DBUG_RETURN(true);
DBUG_ASSERT(part_type == RANGE_PARTITION ?
num_elements == 1U : TRUE);

View File

@ -332,6 +332,7 @@ public:
size_t file_name_size, uint32 *part_id);
void report_part_expr_error(bool use_subpart_expr);
bool has_same_partitioning(partition_info *new_part_info);
bool error_if_requires_values() const;
private:
static int list_part_cmp(const void* a, const void* b);
bool set_up_default_partitions(THD *thd, handler *file, HA_CREATE_INFO *info,

View File

@ -1804,30 +1804,30 @@ ER_WRONG_AUTO_KEY 42000 S1009
ER_BINLOG_CANT_DELETE_GTID_DOMAIN
eng "Could not delete gtid domain. Reason: %s."
ER_NORMAL_SHUTDOWN
cze "%s (%s): normální ukončení\n"
dan "%s (%s): Normal nedlukning\n"
nla "%s (%s): Normaal afgesloten \n"
eng "%s (%s): Normal shutdown\n"
est "%s (%s): MariaDB lõpetas\n"
fre "%s (%s): Arrêt normal du serveur\n"
ger "%s (%s): Normal heruntergefahren\n"
greek "%s (%s): Φυσιολογική διαδικασία shutdown\n"
hindi "%s (%s): सामान्य शटडाउन\n"
hun "%s (%s): Normal leallitas\n"
ita "%s (%s): Shutdown normale\n"
jpn "%s (%s): 通常シャットダウン\n"
kor "%s (%s): 정상적인 shutdown\n"
nor "%s (%s): Normal avslutning\n"
norwegian-ny "%s (%s): Normal nedkopling\n"
pol "%s (%s): Standardowe zakończenie działania\n"
por "%s (%s): 'Shutdown' normal\n"
rum "%s (%s): Terminare normala\n"
rus "%s (%s): Корректная остановка\n"
serbian "%s (%s): Normalno gašenje\n"
slo "%s (%s): normálne ukončenie\n"
spa "%s (%s): Apagado normal\n"
swe "%s (%s): Normal avslutning\n"
ukr "%s (%s): Нормальне завершення\n"
cze "%s (%s): normální ukončení"
dan "%s (%s): Normal nedlukning"
nla "%s (%s): Normaal afgesloten "
eng "%s (%s): Normal shutdown"
est "%s (%s): MariaDB lõpetas"
fre "%s (%s): Arrêt normal du serveur"
ger "%s (%s): Normal heruntergefahren"
greek "%s (%s): Φυσιολογική διαδικασία shutdown"
hindi "%s (%s): सामान्य शटडाउन"
hun "%s (%s): Normal leallitas"
ita "%s (%s): Shutdown normale"
jpn "%s (%s): 通常シャットダウン"
kor "%s (%s): 정상적인 shutdown"
nor "%s (%s): Normal avslutning"
norwegian-ny "%s (%s): Normal nedkopling"
pol "%s (%s): Standardowe zakończenie działania"
por "%s (%s): 'Shutdown' normal"
rum "%s (%s): Terminare normala"
rus "%s (%s): Корректная остановка"
serbian "%s (%s): Normalno gašenje"
slo "%s (%s): normálne ukončenie"
spa "%s (%s): Apagado normal"
swe "%s (%s): Normal avslutning"
ukr "%s (%s): Нормальне завершення"
ER_GOT_SIGNAL
cze "%s: přijat signal %d, končím\n"
dan "%s: Fangede signal %d. Afslutter!!\n"

View File

@ -2851,37 +2851,42 @@ static void acl_insert_user(const char *user, const char *host,
}
static void acl_update_db(const char *user, const char *host, const char *db,
static bool acl_update_db(const char *user, const char *host, const char *db,
ulong privileges)
{
mysql_mutex_assert_owner(&acl_cache->lock);
bool updated= false;
for (uint i=0 ; i < acl_dbs.elements ; i++)
{
ACL_DB *acl_db=dynamic_element(&acl_dbs,i,ACL_DB*);
if ((!acl_db->user && !user[0]) ||
(acl_db->user &&
!strcmp(user,acl_db->user)))
(acl_db->user &&
!strcmp(user,acl_db->user)))
{
if ((!acl_db->host.hostname && !host[0]) ||
(acl_db->host.hostname &&
!strcmp(host, acl_db->host.hostname)))
(acl_db->host.hostname &&
!strcmp(host, acl_db->host.hostname)))
{
if ((!acl_db->db && !db[0]) ||
(acl_db->db && !strcmp(db,acl_db->db)))
if ((!acl_db->db && !db[0]) ||
(acl_db->db && !strcmp(db,acl_db->db)))
{
if (privileges)
{
if (privileges)
{
acl_db->access= privileges;
acl_db->initial_access= acl_db->access;
}
else
delete_dynamic_element(&acl_dbs,i);
}
else
delete_dynamic_element(&acl_dbs,i);
updated= true;
}
}
}
}
return updated;
}
@ -4373,9 +4378,21 @@ static int replace_db_table(TABLE *table, const char *db,
acl_cache->clear(1); // Clear privilege cache
if (old_row_exists)
acl_update_db(combo.user.str,combo.host.str,db,rights);
else
if (rights)
acl_insert_db(combo.user.str,combo.host.str,db,rights);
else if (rights)
{
/*
If we did not have an already existing row, for users, we must always
insert an ACL_DB entry. For roles however, it is possible that one was
already created when DB privileges were propagated from other granted
roles onto the current role. For this case, first try to update the
existing entry, otherwise insert a new one.
*/
if (!combo.is_role() ||
!acl_update_db(combo.user.str, combo.host.str, db, rights))
{
acl_insert_db(combo.user.str,combo.host.str,db,rights);
}
}
DBUG_RETURN(0);
/* This could only happen if the grant tables got corrupted */
@ -6280,6 +6297,7 @@ static int merge_role_privileges(ACL_ROLE *role __attribute__((unused)),
{
PRIVS_TO_MERGE *data= (PRIVS_TO_MERGE *)context;
DBUG_ASSERT(grantee->counter > 0);
if (--grantee->counter)
return 1; // don't recurse into grantee just yet
@ -7381,17 +7399,14 @@ end_index_init:
DBUG_RETURN(return_val);
}
static my_bool role_propagate_grants_action(void *ptr,
void *unused __attribute__((unused)))
static my_bool collect_leaf_roles(void *role_ptr,
void *roles_array)
{
ACL_ROLE *role= (ACL_ROLE *)ptr;
if (role->counter)
return 0;
mysql_mutex_assert_owner(&acl_cache->lock);
PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 };
traverse_role_graph_up(role, &data, NULL, merge_role_privileges);
ACL_ROLE *role= static_cast<ACL_ROLE *>(role_ptr);
Dynamic_array<ACL_ROLE *> *array=
static_cast<Dynamic_array<ACL_ROLE *> *>(roles_array);
if (!role->counter)
array->push(role);
return 0;
}
@ -7461,7 +7476,15 @@ bool grant_reload(THD *thd)
}
mysql_mutex_lock(&acl_cache->lock);
my_hash_iterate(&acl_roles, role_propagate_grants_action, NULL);
Dynamic_array<ACL_ROLE *> leaf_roles;
my_hash_iterate(&acl_roles, collect_leaf_roles, &leaf_roles);
PRIVS_TO_MERGE data= { PRIVS_TO_MERGE::ALL, 0, 0 };
for (size_t i= 0; i < leaf_roles.elements(); i++)
{
traverse_role_graph_up(leaf_roles.at(i), &data, NULL,
merge_role_privileges);
}
mysql_mutex_unlock(&acl_cache->lock);
mysql_rwlock_unlock(&LOCK_grant);
@ -10181,13 +10204,13 @@ bool mysql_create_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
}
}
binlog= true;
if (replace_user_table(thd, tables.user_table(), *user_name, 0, 0, 1, 0))
{
append_user(thd, &wrong_users, user_name);
result= TRUE;
continue;
}
binlog= true;
// every created role is automatically granted to its creator-admin
if (handle_as_role)

View File

@ -314,13 +314,9 @@ extern "C" void free_user(struct user_conn *uc)
void init_max_user_conn(void)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (my_hash_init(&hash_user_connections,system_charset_info,max_connections,
0,0, (my_hash_get_key) get_key_conn,
(my_hash_free_key) free_user, 0))
{
sql_print_error("Initializing hash_user_connections failed.");
exit(1);
}
my_hash_init(&hash_user_connections, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_conn,
(my_hash_free_key) free_user, 0);
#endif
}
@ -479,24 +475,16 @@ void init_user_stats(USER_STATS *user_stats,
void init_global_user_stats(void)
{
if (my_hash_init(&global_user_stats, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_user_stats,
(my_hash_free_key)free_user_stats, 0))
{
sql_print_error("Initializing global_user_stats failed.");
exit(1);
}
my_hash_init(&global_user_stats, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_user_stats,
(my_hash_free_key) free_user_stats, 0);
}
void init_global_client_stats(void)
{
if (my_hash_init(&global_client_stats, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_user_stats,
(my_hash_free_key)free_user_stats, 0))
{
sql_print_error("Initializing global_client_stats failed.");
exit(1);
}
my_hash_init(&global_client_stats, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_user_stats,
(my_hash_free_key) free_user_stats, 0);
}
extern "C" uchar *get_key_table_stats(TABLE_STATS *table_stats, size_t *length,
@ -513,12 +501,9 @@ extern "C" void free_table_stats(TABLE_STATS* table_stats)
void init_global_table_stats(void)
{
if (my_hash_init(&global_table_stats, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_table_stats,
(my_hash_free_key)free_table_stats, 0)) {
sql_print_error("Initializing global_table_stats failed.");
exit(1);
}
my_hash_init(&global_table_stats, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_table_stats,
(my_hash_free_key) free_table_stats, 0);
}
extern "C" uchar *get_key_index_stats(INDEX_STATS *index_stats, size_t *length,
@ -535,13 +520,9 @@ extern "C" void free_index_stats(INDEX_STATS* index_stats)
void init_global_index_stats(void)
{
if (my_hash_init(&global_index_stats, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_index_stats,
(my_hash_free_key)free_index_stats, 0))
{
sql_print_error("Initializing global_index_stats failed.");
exit(1);
}
my_hash_init(&global_index_stats, system_charset_info, max_connections,
0, 0, (my_hash_get_key) get_key_index_stats,
(my_hash_free_key) free_index_stats, 0);
}

View File

@ -4602,16 +4602,11 @@ uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
my_error(ER_PARTITION_WRONG_VALUES_ERROR, MYF(0),
"LIST", "IN");
}
else if (tab_part_info->part_type == RANGE_PARTITION)
{
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN");
}
else
{
DBUG_ASSERT(tab_part_info->part_type == LIST_PARTITION);
my_error(ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"LIST", "IN");
DBUG_ASSERT(tab_part_info->part_type == RANGE_PARTITION ||
tab_part_info->part_type == LIST_PARTITION);
(void) tab_part_info->error_if_requires_values();
}
goto err;
}

View File

@ -5208,12 +5208,8 @@ opt_part_values:
partition_info *part_info= lex->part_info;
if (! lex->is_partition_management())
{
if (part_info->part_type == RANGE_PARTITION)
my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"RANGE", "LESS THAN"));
if (part_info->part_type == LIST_PARTITION)
my_yyabort_error((ER_PARTITION_REQUIRES_VALUES_ERROR, MYF(0),
"LIST", "IN"));
if (part_info->error_if_requires_values())
MYSQL_YYABORT;
}
else
part_info->part_type= HASH_PARTITION;

View File

@ -6772,6 +6772,14 @@ void TABLE::create_key_part_by_field(KEY_PART_INFO *key_part_info,
might be reused.
*/
key_part_info->store_length= key_part_info->length;
/*
For BIT fields null_bit is not set to 0 even if the field is defined
as NOT NULL, look at Field_bit::Field_bit
*/
if (!field->real_maybe_null())
{
key_part_info->null_bit= 0;
}
/*
The total store length of the key part is the raw length of the field +

View File

@ -204,10 +204,8 @@ trx_undo_report_row_operation(
marking, the record in the clustered
index; NULL if insert */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
inserted undo log record,
0 if BTR_NO_UNDO_LOG
flag was specified */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result));
/** status bit used for trx_undo_prev_version_build() */

View File

@ -383,10 +383,8 @@ trx_id_t
trx_sys_get_new_trx_id()
/*====================*/
{
#ifndef WITH_WSREP
/* wsrep_fake_trx_id violates this assert */
ut_ad(trx_sys_mutex_own());
#endif /* WITH_WSREP */
/* VERY important: after the database is started, max_trx_id value is
divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if

View File

@ -1588,13 +1588,10 @@ row_log_table_apply_insert_low(
return(error);
}
do {
n_index++;
if (!(index = dict_table_get_next_index(index))) {
break;
}
ut_ad(dict_index_is_clust(index));
for (n_index += index->type != DICT_CLUSTERED;
(index = dict_table_get_next_index(index)); n_index++) {
if (index->type & DICT_FTS) {
continue;
}
@ -1605,12 +1602,13 @@ row_log_table_apply_insert_low(
index, offsets_heap, heap, entry, trx_id, thr,
false);
/* Report correct index name for duplicate key error. */
if (error == DB_DUPLICATE_KEY) {
thr_get_trx(thr)->error_key_num = n_index;
if (error != DB_SUCCESS) {
if (error == DB_DUPLICATE_KEY) {
thr_get_trx(thr)->error_key_num = n_index;
}
break;
}
} while (error == DB_SUCCESS);
}
return(error);
}
@ -2190,17 +2188,16 @@ func_exit_committed:
dtuple_big_rec_free(big_rec);
}
while ((index = dict_table_get_next_index(index)) != NULL) {
if (error != DB_SUCCESS) {
break;
}
n_index++;
for (n_index += index->type != DICT_CLUSTERED;
(index = dict_table_get_next_index(index)); n_index++) {
if (index->type & DICT_FTS) {
continue;
}
if (error != DB_SUCCESS) {
break;
}
if (!row_upd_changes_ord_field_binary(
index, update, thr, old_row, NULL)) {
continue;

View File

@ -1880,10 +1880,8 @@ trx_undo_report_row_operation(
marking, the record in the clustered
index; NULL if insert */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
inserted undo log record,
0 if BTR_NO_UNDO_LOG
flag was specified */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
{
trx_t* trx;
ulint page_no;

View File

@ -146,12 +146,10 @@ trx_sys_flush_max_trx_id(void)
mtr_t mtr;
trx_sysf_t* sys_header;
#ifndef WITH_WSREP
/* wsrep_fake_trx_id violates this assert
Copied from trx_sys_get_new_trx_id
*/
ut_ad(trx_sys_mutex_own());
#endif /* WITH_WSREP */
if (!srv_read_only_mode) {
mtr_start(&mtr);

View File

@ -2136,7 +2136,8 @@ fil_write_flushed_lsn(
/* If tablespace is not encrypted, stamp flush_lsn to
first page of all system tablespace datafiles to avoid
unnecessary error messages on possible downgrade. */
if (!space->crypt_data || space->crypt_data->min_key_version == 0) {
if (!space->crypt_data
|| !space->crypt_data->should_encrypt()) {
fil_node_t* node;
ulint sum_of_sizes = 0;

View File

@ -226,10 +226,8 @@ trx_undo_report_row_operation(
marking, the record in the clustered
index, otherwise NULL */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
inserted undo log record,
0 if BTR_NO_UNDO_LOG
flag was specified */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result));
/******************************************************************//**
Copies an undo record to heap. This function can be called if we know that

View File

@ -474,10 +474,7 @@ trx_id_t
trx_sys_get_new_trx_id(void)
/*========================*/
{
#ifndef WITH_WSREP
/* wsrep_fake_trx_id violates this assert */
ut_ad(mutex_own(&trx_sys->mutex));
#endif /* WITH_WSREP */
/* VERY important: after the database is started, max_trx_id value is
divisible by TRX_SYS_TRX_ID_WRITE_MARGIN, and the following if

View File

@ -1573,13 +1573,10 @@ row_log_table_apply_insert_low(
return(error);
}
do {
n_index++;
if (!(index = dict_table_get_next_index(index))) {
break;
}
ut_ad(dict_index_is_clust(index));
for (n_index += index->type != DICT_CLUSTERED;
(index = dict_table_get_next_index(index)); n_index++) {
if (index->type & DICT_FTS) {
continue;
}
@ -1589,12 +1586,13 @@ row_log_table_apply_insert_low(
flags, BTR_MODIFY_TREE,
index, offsets_heap, heap, entry, trx_id, thr);
/* Report correct index name for duplicate key error. */
if (error == DB_DUPLICATE_KEY) {
thr_get_trx(thr)->error_key_num = n_index;
if (error != DB_SUCCESS) {
if (error == DB_DUPLICATE_KEY) {
thr_get_trx(thr)->error_key_num = n_index;
}
break;
}
} while (error == DB_SUCCESS);
}
return(error);
}
@ -2173,17 +2171,16 @@ func_exit_committed:
dtuple_big_rec_free(big_rec);
}
while ((index = dict_table_get_next_index(index)) != NULL) {
if (error != DB_SUCCESS) {
break;
}
n_index++;
for (n_index += index->type != DICT_CLUSTERED;
(index = dict_table_get_next_index(index)); n_index++) {
if (index->type & DICT_FTS) {
continue;
}
if (error != DB_SUCCESS) {
break;
}
if (!row_upd_changes_ord_field_binary(
index, update, thr, old_row, NULL)) {
continue;

View File

@ -1221,10 +1221,8 @@ trx_undo_report_row_operation(
marking, the record in the clustered
index, otherwise NULL */
const ulint* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: rollback pointer to the
inserted undo log record,
0 if BTR_NO_UNDO_LOG
flag was specified */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
{
trx_t* trx;
trx_undo_t* undo;

View File

@ -184,12 +184,7 @@ trx_sys_flush_max_trx_id(void)
mtr_t mtr;
trx_sysf_t* sys_header;
#ifndef WITH_WSREP
/* wsrep_fake_trx_id violates this assert
* Copied from trx_sys_get_new_trx_id
*/
ut_ad(mutex_own(&trx_sys->mutex));
#endif /* WITH_WSREP */
if (!srv_read_only_mode) {
mtr_start(&mtr);

View File

@ -20,7 +20,7 @@ SET(STRINGS_SOURCES bchange.c bmove_upp.c ctype-big5.c ctype-bin.c ctype-cp932.c
ctype-latin1.c ctype-mb.c ctype-simple.c ctype-sjis.c ctype-tis620.c ctype-uca.c
ctype-ucs2.c ctype-ujis.c ctype-utf8.c ctype-win1250ch.c ctype.c decimal.c dtoa.c int2str.c
is_prefix.c llstr.c longlong2str.c my_strtoll10.c my_vsnprintf.c
str2int.c str_alloc.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c
str2int.c strcend.c strend.c strfill.c strmake.c strmov.c strnmov.c
strxmov.c strxnmov.c xml.c
strmov_overlapp.c
my_strchr.c strcont.c strappend.c json_lib.c)

View File

@ -524,7 +524,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
tc1= buf;
if ((len1 + len2 +2) > (int) sizeof(buf))
tc1= (uchar*) my_str_malloc(len1+len2+2);
tc1= (uchar*) my_malloc(len1+len2+2, MYF(MY_FAE));
tc2= tc1 + len1+1;
memcpy((char*) tc1, (char*) s1, len1);
tc1[len1]= 0; /* if length(s1)> len1, need to put 'end of string' */
@ -534,7 +534,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)),
thai2sortable(tc2, len2);
i= strcmp((char*)tc1, (char*)tc2);
if (tc1 != buf)
my_str_free(tc1);
my_free(tc1);
return i;
}
@ -550,7 +550,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
a= buf;
if ((a_length + b_length +2) > (int) sizeof(buf))
alloced= a= (uchar*) my_str_malloc(a_length+b_length+2);
alloced= a= (uchar*) my_malloc(a_length+b_length+2, MYF(MY_FAE));
b= a + a_length+1;
memcpy((char*) a, (char*) a0, a_length);
@ -578,7 +578,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)),
ret:
if (alloced)
my_str_free(alloced);
my_free(alloced);
return res;
}

View File

@ -752,14 +752,14 @@ int my_vfprintf(FILE *stream, const char* format, va_list args)
and try again.
*/
if (alloc)
(*my_str_free)(p);
my_free(p);
else
alloc= 1;
new_len= cur_len*2;
if (new_len < cur_len)
return 0; /* Overflow */
cur_len= new_len;
p= (*my_str_malloc)(cur_len);
p= my_malloc(cur_len, MYF(MY_FAE));
if (!p)
return 0;
}
@ -767,7 +767,7 @@ int my_vfprintf(FILE *stream, const char* format, va_list args)
if (fputs(p, stream) < 0)
ret= -1;
if (alloc)
(*my_str_free)(p);
my_free(p);
return ret;
}

View File

@ -1,41 +0,0 @@
/* Copyright (c) 2005, 2006 MySQL AB
Copyright (c) 2009-2011, Monty Program Ab
Use is subject to license terms.
Copyright (c) 2009-2011, Monty Program Ab
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 */
#include "strings_def.h"
static void *my_str_malloc_default(size_t size)
{
void *ret= malloc(size);
if (!ret)
exit(1);
return ret;
}
static void my_str_free_default(void *ptr)
{
free(ptr);
}
void *my_str_realloc_default(void *ptr, size_t size)
{
return realloc(ptr, size);
}
void *(*my_str_malloc)(size_t)= &my_str_malloc_default;
void (*my_str_free)(void *)= &my_str_free_default;
void *(*my_str_realloc)(void *, size_t)= &my_str_realloc_default;

View File

@ -17,6 +17,7 @@
#include "strings_def.h"
#include "m_string.h"
#include "my_xml.h"
#include "my_sys.h"
#define MY_XML_UNKNOWN 'U'
@ -231,13 +232,13 @@ static int my_xml_attr_ensure_space(MY_XML_PARSER *st, size_t len)
if (!st->attr.buffer)
{
st->attr.buffer= (char *) my_str_malloc(st->attr.buffer_size);
st->attr.buffer= (char *) my_malloc(st->attr.buffer_size, MYF(0));
if (st->attr.buffer)
memcpy(st->attr.buffer, st->attr.static_buffer, ofs + 1 /*term. zero */);
}
else
st->attr.buffer= (char *) my_str_realloc(st->attr.buffer,
st->attr.buffer_size);
st->attr.buffer= (char *) my_realloc(st->attr.buffer,
st->attr.buffer_size, MYF(0));
st->attr.start= st->attr.buffer;
st->attr.end= st->attr.start + ofs;
@ -507,7 +508,7 @@ void my_xml_parser_free(MY_XML_PARSER *p)
{
if (p->attr.buffer)
{
my_str_free(p->attr.buffer);
my_free(p->attr.buffer);
p->attr.buffer= NULL;
}
}

View File

@ -104,6 +104,21 @@ IF(UNIX)
${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
IF(INSTALL_SYSTEMD_SYSUSERSDIR)
CONFIGURE_FILE(sysusers.conf.in
${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf
DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR} COMPONENT Server)
ENDIF()
IF(INSTALL_SYSTEMD_TMPFILESDIR)
get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY)
CONFIGURE_FILE(tmpfiles.conf.in
${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf
DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR} COMPONENT Server)
ENDIF()
# @ in directory name broken between CMake version 2.8.12.2 and 3.3
# http://public.kitware.com/Bug/view.php?id=14782
IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)

View File

@ -0,0 +1 @@
u @MYSQLD_USER@ - "MariaDB" @MYSQL_DATADIR@

View File

@ -0,0 +1 @@
d @MYSQL_UNIX_DIR@ 0755 @MYSQLD_USER@ @MYSQLD_USER@ -