mirror of
https://github.com/MariaDB/server.git
synced 2025-05-27 01:57:48 +03:00
auto-merge
This commit is contained in:
commit
09c50b6303
@ -196,6 +196,10 @@ test-bt-fast:
|
||||
-cd mysql-test ; MTR_BUILD_THREAD=auto \
|
||||
@PERL@ ./mysql-test-run.pl --force --comment=stress --suite=stress
|
||||
|
||||
test-bt-fast:
|
||||
-cd mysql-test ; MTR_BUILD_THREAD=auto \
|
||||
@PERL@ ./mysql-test-run.pl --force --comment=ps --ps-protocol --report-features
|
||||
|
||||
test-bt-debug:
|
||||
-cd mysql-test ; MTR_BUILD_THREAD=auto \
|
||||
@PERL@ ./mysql-test-run.pl --comment=debug --force --timer \
|
||||
@ -203,6 +207,8 @@ test-bt-debug:
|
||||
|
||||
test-bt-debug-fast:
|
||||
|
||||
test-bt-debug-fast:
|
||||
|
||||
# Keep these for a while
|
||||
test-pl: test
|
||||
test-full-pl: test-full
|
||||
|
@ -992,11 +992,13 @@ static struct my_option my_long_options[] =
|
||||
/* 'unspec' is not mentioned because it is just a placeholder. */
|
||||
"Determine when the output statements should be base64-encoded BINLOG "
|
||||
"statements: 'never' disables it and works only for binlogs without "
|
||||
"row-based events; 'auto' prints base64 only when necessary (i.e., "
|
||||
"for row-based events and format description events); 'always' prints "
|
||||
"base64 whenever possible. 'always' is for debugging only and should "
|
||||
"not be used in a production system. If this argument is not given, "
|
||||
"the default is 'auto'; if it is given with no argument, 'always' is used."
|
||||
"row-based events; 'decode-rows' decodes row events into commented SQL "
|
||||
"statements if the --verbose option is also given; 'auto' prints base64 "
|
||||
"only when necessary (i.e., for row-based events and format description "
|
||||
"events); 'always' prints base64 whenever possible. 'always' is for "
|
||||
"debugging only and should not be used in a production system. If this "
|
||||
"argument is not given, the default is 'auto'; if it is given with no "
|
||||
"argument, 'always' is used."
|
||||
,(uchar**) &opt_base64_output_mode_str,
|
||||
(uchar**) &opt_base64_output_mode_str,
|
||||
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
@ -6913,35 +6913,39 @@ void run_query_stmt(MYSQL *mysql, struct st_command *command,
|
||||
Need to grab affected rows information before getting
|
||||
warnings here
|
||||
*/
|
||||
if (!disable_info)
|
||||
affected_rows= mysql_affected_rows(mysql);
|
||||
|
||||
if (!disable_warnings)
|
||||
{
|
||||
/* Get the warnings from execute */
|
||||
ulonglong affected_rows;
|
||||
LINT_INIT(affected_rows);
|
||||
|
||||
/* Append warnings to ds - if there are any */
|
||||
if (append_warnings(&ds_execute_warnings, mysql) ||
|
||||
ds_execute_warnings.length ||
|
||||
ds_prepare_warnings.length ||
|
||||
ds_warnings->length)
|
||||
if (!disable_info)
|
||||
affected_rows= mysql_affected_rows(mysql);
|
||||
|
||||
if (!disable_warnings)
|
||||
{
|
||||
dynstr_append_mem(ds, "Warnings:\n", 10);
|
||||
if (ds_warnings->length)
|
||||
dynstr_append_mem(ds, ds_warnings->str,
|
||||
ds_warnings->length);
|
||||
if (ds_prepare_warnings.length)
|
||||
dynstr_append_mem(ds, ds_prepare_warnings.str,
|
||||
ds_prepare_warnings.length);
|
||||
if (ds_execute_warnings.length)
|
||||
dynstr_append_mem(ds, ds_execute_warnings.str,
|
||||
ds_execute_warnings.length);
|
||||
/* Get the warnings from execute */
|
||||
|
||||
/* Append warnings to ds - if there are any */
|
||||
if (append_warnings(&ds_execute_warnings, mysql) ||
|
||||
ds_execute_warnings.length ||
|
||||
ds_prepare_warnings.length ||
|
||||
ds_warnings->length)
|
||||
{
|
||||
dynstr_append_mem(ds, "Warnings:\n", 10);
|
||||
if (ds_warnings->length)
|
||||
dynstr_append_mem(ds, ds_warnings->str,
|
||||
ds_warnings->length);
|
||||
if (ds_prepare_warnings.length)
|
||||
dynstr_append_mem(ds, ds_prepare_warnings.str,
|
||||
ds_prepare_warnings.length);
|
||||
if (ds_execute_warnings.length)
|
||||
dynstr_append_mem(ds, ds_execute_warnings.str,
|
||||
ds_execute_warnings.length);
|
||||
}
|
||||
}
|
||||
|
||||
if (!disable_info)
|
||||
append_info(ds, affected_rows, mysql_info(mysql));
|
||||
}
|
||||
|
||||
if (!disable_info)
|
||||
append_info(ds, affected_rows, mysql_info(mysql));
|
||||
|
||||
}
|
||||
|
||||
end:
|
||||
|
@ -432,6 +432,10 @@ typedef struct st_mi_check_param
|
||||
const char *db_name, *table_name;
|
||||
const char *op_name;
|
||||
enum_mi_stats_method stats_method;
|
||||
#ifdef THREAD
|
||||
pthread_mutex_t print_msg_mutex;
|
||||
my_bool need_print_msg_lock;
|
||||
#endif
|
||||
} MI_CHECK;
|
||||
|
||||
typedef struct st_sort_ft_buf
|
||||
|
4
mysql-test/include/have_case_insensitive_fs.inc
Normal file
4
mysql-test/include/have_case_insensitive_fs.inc
Normal file
@ -0,0 +1,4 @@
|
||||
--require r/case_insensitive_fs.require
|
||||
--disable_query_log
|
||||
show variables like 'lower_case_file_system';
|
||||
--enable_query_log
|
@ -19,81 +19,10 @@ test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
|
||||
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
|
||||
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
|
||||
create table t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
|
||||
test.t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
|
||||
test.t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
|
||||
test.t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
|
||||
test.t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
|
||||
drop table t1,t2;
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
|
||||
drop table t1;
|
||||
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
create table t1 (a int not null);
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`Field_name` varbinary(255) NOT NULL DEFAULT '',
|
||||
`Min_value` varbinary(255) DEFAULT NULL,
|
||||
`Max_value` varbinary(255) DEFAULT NULL,
|
||||
`Min_length` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Max_length` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Nulls` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
|
||||
`Std` varbinary(255) DEFAULT NULL,
|
||||
`Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t1 where 0=1 procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
insert into t1 values(1);
|
||||
drop table t2;
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`Field_name` varbinary(255) NOT NULL DEFAULT '',
|
||||
`Min_value` varbinary(255) DEFAULT NULL,
|
||||
`Max_value` varbinary(255) DEFAULT NULL,
|
||||
`Min_length` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Max_length` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Nulls` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
|
||||
`Std` varbinary(255) DEFAULT NULL,
|
||||
`Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
insert into t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.a 1 1 1 1 0 0 1.0000 0.0000 ENUM('1') NOT NULL
|
||||
insert into t1 values(2);
|
||||
drop table t2;
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
t2 CREATE TABLE `t2` (
|
||||
`Field_name` varbinary(255) NOT NULL DEFAULT '',
|
||||
`Min_value` varbinary(255) DEFAULT NULL,
|
||||
`Max_value` varbinary(255) DEFAULT NULL,
|
||||
`Min_length` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Max_length` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Empties_or_zeros` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Nulls` bigint(11) NOT NULL DEFAULT '0',
|
||||
`Avg_value_or_avg_length` varbinary(255) NOT NULL DEFAULT '',
|
||||
`Std` varbinary(255) DEFAULT NULL,
|
||||
`Optimal_fieldtype` varbinary(64) NOT NULL DEFAULT ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
insert into t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
test.t1.a 1 2 1 1 0 0 1.5000 0.5000 ENUM('1','2') NOT NULL
|
||||
drop table t1,t2;
|
||||
create table t1 (v varchar(128));
|
||||
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
|
||||
select * from t1 procedure analyse();
|
||||
@ -157,3 +86,40 @@ SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
#
|
||||
# Bug #48293: crash with procedure analyse, view with > 10 columns,
|
||||
# having clause...
|
||||
#
|
||||
CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
|
||||
f INT, g INT, h INT, i INT, j INT,k INT);
|
||||
INSERT INTO t1 VALUES (),();
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||
#should have a derived table
|
||||
EXPLAIN SELECT * FROM v1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 2
|
||||
2 DERIVED t1 ALL NULL NULL NULL NULL 2
|
||||
#should not crash
|
||||
SELECT * FROM v1 PROCEDURE analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and view
|
||||
#should not crash
|
||||
SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and view
|
||||
#should not crash
|
||||
SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
#should not crash
|
||||
SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
#should not crash
|
||||
SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
|
||||
ERROR HY000: Can't use ORDER clause with this procedure
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
# should not crash
|
||||
CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and non-SELECT
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
|
2
mysql-test/r/case_insensitive_fs.require
Normal file
2
mysql-test/r/case_insensitive_fs.require
Normal file
@ -0,0 +1,2 @@
|
||||
Variable_name Value
|
||||
lower_case_file_system ON
|
@ -1007,8 +1007,8 @@ DROP TABLE mysqltest1.t2;
|
||||
SHOW GRANTS;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, INSERT, CREATE, DROP, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
|
||||
RENAME TABLE t1 TO t2;
|
||||
RENAME TABLE t2 TO t1;
|
||||
ALTER TABLE t1 RENAME TO t2;
|
||||
@ -1018,8 +1018,8 @@ REVOKE DROP, INSERT ON mysqltest1.t2 FROM mysqltest_1@localhost;
|
||||
SHOW GRANTS;
|
||||
Grants for mysqltest_1@localhost
|
||||
GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t1` TO 'mysqltest_1'@'localhost'
|
||||
GRANT SELECT, CREATE, ALTER ON `mysqltest1`.`t2` TO 'mysqltest_1'@'localhost'
|
||||
RENAME TABLE t1 TO t2;
|
||||
ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 't1'
|
||||
ALTER TABLE t1 RENAME TO t2;
|
||||
|
16
mysql-test/r/grant_lowercase_fs.result
Normal file
16
mysql-test/r/grant_lowercase_fs.result
Normal file
@ -0,0 +1,16 @@
|
||||
create database db1;
|
||||
GRANT CREATE ON db1.* to user_1@localhost;
|
||||
GRANT SELECT ON db1.* to USER_1@localhost;
|
||||
CREATE TABLE t1(f1 int);
|
||||
SELECT * FROM t1;
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
|
||||
SELECT * FROM t1;
|
||||
f1
|
||||
CREATE TABLE t2(f1 int);
|
||||
ERROR 42000: CREATE command denied to user 'USER_1'@'localhost' for table 't2'
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
|
||||
DROP USER user_1@localhost;
|
||||
DROP USER USER_1@localhost;
|
||||
DROP DATABASE db1;
|
||||
use test;
|
@ -26,4 +26,27 @@ SELECT * FROM t1;
|
||||
a b
|
||||
1070109 99
|
||||
DROP TABLE t2, t1;
|
||||
End of 5.0 tests
|
||||
# End of 5.0 tests
|
||||
#
|
||||
# Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
|
||||
# FOR UPDATE
|
||||
#
|
||||
drop table if exists t1;
|
||||
create table t1 (a int primary key auto_increment,
|
||||
b int, index(b)) engine=innodb;
|
||||
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
set autocommit=0;
|
||||
begin;
|
||||
select * from t1 where b=5 for update;
|
||||
a b
|
||||
5 5
|
||||
insert ignore into t1 (b) select a as b from t1;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
# Cleanup
|
||||
#
|
||||
commit;
|
||||
set autocommit=default;
|
||||
drop table t1;
|
||||
#
|
||||
# End of 5.1 tests
|
||||
#
|
@ -1063,6 +1063,60 @@ a b c d
|
||||
127 NULL 127 NULL
|
||||
128 NULL 128 NULL
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
#
|
||||
# Bug #42116: Mysql crash on specific query
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
CREATE TABLE t3 (a INT, INDEX (a));
|
||||
CREATE TABLE t4 (a INT);
|
||||
CREATE TABLE t5 (a INT);
|
||||
CREATE TABLE t6 (a INT);
|
||||
INSERT INTO t1 VALUES (1), (1), (1);
|
||||
INSERT INTO t2 VALUES
|
||||
(2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
|
||||
INSERT INTO t3 VALUES
|
||||
(3), (3), (3), (3), (3), (3), (3), (3), (3), (3);
|
||||
EXPLAIN
|
||||
SELECT *
|
||||
FROM
|
||||
t1 JOIN t2 ON t1.a = t2.a
|
||||
LEFT JOIN
|
||||
(
|
||||
(
|
||||
t3 LEFT JOIN t4 ON t3.a = t4.a
|
||||
)
|
||||
LEFT JOIN
|
||||
(
|
||||
t5 LEFT JOIN t6 ON t5.a = t6.a
|
||||
)
|
||||
ON t4.a = t5.a
|
||||
)
|
||||
ON t1.a = t3.a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3
|
||||
1 SIMPLE t3 ref a a 5 test.t1.a 2 Using index
|
||||
1 SIMPLE t4 ALL NULL NULL NULL NULL 0
|
||||
1 SIMPLE t5 ALL NULL NULL NULL NULL 0
|
||||
1 SIMPLE t6 ALL NULL NULL NULL NULL 0
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where; Using join buffer
|
||||
SELECT *
|
||||
FROM
|
||||
t1 JOIN t2 ON t1.a = t2.a
|
||||
LEFT JOIN
|
||||
(
|
||||
(
|
||||
t3 LEFT JOIN t4 ON t3.a = t4.a
|
||||
)
|
||||
LEFT JOIN
|
||||
(
|
||||
t5 LEFT JOIN t6 ON t5.a = t6.a
|
||||
)
|
||||
ON t4.a = t5.a
|
||||
)
|
||||
ON t1.a = t3.a;
|
||||
a a a a a a
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6;
|
||||
End of 5.0 tests.
|
||||
CREATE TABLE t1 (f1 int);
|
||||
CREATE TABLE t2 (f1 int);
|
||||
|
@ -10,3 +10,48 @@ create database D1;
|
||||
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
|
||||
drop user 'sample'@'localhost';
|
||||
drop database if exists d1;
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE T1(f1 INT);
|
||||
CREATE TABLE t1(f1 INT);
|
||||
GRANT SELECT ON T1 to user_1@localhost;
|
||||
select * from t1;
|
||||
ERROR 42000: SELECT command denied to user 'user_1'@'localhost' for table 't1'
|
||||
select * from T1;
|
||||
f1
|
||||
GRANT SELECT ON t1 to user_1@localhost;
|
||||
select * from information_schema.table_privileges;
|
||||
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
|
||||
'user_1'@'localhost' NULL d1 T1 SELECT NO
|
||||
'user_1'@'localhost' NULL d1 t1 SELECT NO
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
||||
DROP USER user_1@localhost;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE PROCEDURE p1() BEGIN END;
|
||||
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
|
||||
GRANT USAGE ON db1.* to user_1@localhost;
|
||||
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
|
||||
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
|
||||
GRANT UPDATE ON db1.* to USER_1@localhost;
|
||||
call p1();
|
||||
call P1();
|
||||
select f1(1);
|
||||
f1(1)
|
||||
2
|
||||
call p1();
|
||||
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
|
||||
call P1();
|
||||
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.p1'
|
||||
select f1(1);
|
||||
ERROR 42000: execute command denied to user 'USER_1'@'localhost' for routine 'db1.f1'
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
|
||||
DROP FUNCTION f1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP USER user_1@localhost;
|
||||
DROP USER USER_1@localhost;
|
||||
DROP DATABASE db1;
|
||||
use test;
|
||||
|
@ -2290,6 +2290,12 @@ Table Op Msg_type Msg_text
|
||||
test.t1 repair error myisam_sort_buffer_size is too small
|
||||
test.t1 repair warning Number of rows changed from 0 to 7168
|
||||
test.t1 repair status OK
|
||||
SET myisam_repair_threads=2;
|
||||
REPAIR TABLE t1;
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
CHECK TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
|
@ -733,4 +733,24 @@ SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #48131: crash group by with rollup, distinct,
|
||||
# filesort, with temporary tables
|
||||
#
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (100);
|
||||
SELECT a, b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
|
||||
a b
|
||||
1 100
|
||||
1 NULL
|
||||
2 100
|
||||
2 NULL
|
||||
NULL NULL
|
||||
SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
|
||||
b
|
||||
100
|
||||
NULL
|
||||
DROP TABLE t1, t2;
|
||||
End of 5.0 tests
|
||||
|
@ -32,19 +32,19 @@ identified by 'looser' ;
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
drop table mysqltest.t9 ;
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
show grants for second_user@localhost ;
|
||||
Grants for second_user@localhost
|
||||
GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t9` TO 'second_user'@'localhost'
|
||||
GRANT SELECT ON `mysqltest`.`t1` TO 'second_user'@'localhost'
|
||||
prepare s_t1 from 'select a as my_col from t1' ;
|
||||
execute s_t1 ;
|
||||
my_col
|
||||
|
@ -4415,6 +4415,18 @@ SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
|
||||
1
|
||||
1
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #48291 : crash with row() operator,select into @var, and
|
||||
# subquery returning multiple rows
|
||||
#
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (2),(3);
|
||||
# Should not crash
|
||||
SELECT 1 FROM t1 WHERE a <> 1 AND NOT
|
||||
ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1))
|
||||
INTO @var0;
|
||||
ERROR 21000: Subquery returns more than 1 row
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests
|
||||
create table t1(a INT, KEY (a));
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
|
@ -75,7 +75,7 @@ SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
|
||||
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
|
||||
ERROR HY000: Incorrect usage of PROCEDURE and subquery
|
||||
ERROR HY000: Incorrect parameters to procedure 'ANALYSE'
|
||||
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
|
||||
ERROR 42S22: Unknown column 'a' in 'field list'
|
||||
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NOT NULL;
|
||||
|
@ -161,7 +161,7 @@ procs_priv CREATE TABLE `procs_priv` (
|
||||
`Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Routine_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
`Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
|
||||
`Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
`Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
|
||||
|
@ -89,3 +89,28 @@ xa start 'a';
|
||||
xa end 'a';
|
||||
xa prepare 'a';
|
||||
xa commit 'a';
|
||||
CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1),(2);
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=3 WHERE a=1;
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=4 WHERE a=2;
|
||||
UPDATE t1 SET a=5 WHERE a=2;
|
||||
UPDATE t1 SET a=5 WHERE a=1;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
ROLLBACK;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=3 WHERE a=1;
|
||||
XA START 'xid1';
|
||||
UPDATE t1 SET a=4 WHERE a=2;
|
||||
UPDATE t1 SET a=5 WHERE a=2;
|
||||
UPDATE t1 SET a=5 WHERE a=1;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
XA END 'xid1';
|
||||
ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
|
||||
XA ROLLBACK 'xid1';
|
||||
XA START 'xid1';
|
||||
XA END 'xid1';
|
||||
XA ROLLBACK 'xid1';
|
||||
DROP TABLE t1;
|
||||
|
42
mysql-test/suite/binlog/r/binlog_stm_do_db.result
Normal file
42
mysql-test/suite/binlog/r/binlog_stm_do_db.result
Normal file
@ -0,0 +1,42 @@
|
||||
SET @old_isolation_level= @@session.tx_isolation;
|
||||
SET @@session.tx_isolation= 'READ-COMMITTED';
|
||||
CREATE DATABASE b42829;
|
||||
use b42829;
|
||||
CREATE TABLE t1 (x int, y int) engine=InnoDB;
|
||||
CREATE TABLE t2 (x int, y int) engine=InnoDB;
|
||||
CREATE DATABASE b42829_filtered;
|
||||
use b42829_filtered;
|
||||
CREATE TABLE t1 (x int, y int) engine=InnoDB;
|
||||
CREATE TABLE t2 (x int, y int) engine=InnoDB;
|
||||
SET @@session.sql_log_bin= 0;
|
||||
INSERT INTO b42829_filtered.t1 VALUES (100,100);
|
||||
INSERT INTO b42829.t1 VALUES (100,100);
|
||||
SET @@session.sql_log_bin= 1;
|
||||
### assertion: the inserts will not raise log error because
|
||||
### binlog-do-db is filtering used database
|
||||
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
### assertion: assert that despite updating a not filtered
|
||||
### database this wont trigger an error as the
|
||||
### used database is the filtered one.
|
||||
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
|
||||
use b42829;
|
||||
### assertion: the statements *will* raise log error because
|
||||
### binlog-do-db is not filtering used database
|
||||
BEGIN;
|
||||
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
|
||||
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
|
||||
UPDATE b42829_filtered.t1 ft1, b42829.t1 nft1 SET ft1.x=1, nft1.x=2;
|
||||
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
|
||||
COMMIT;
|
||||
### assertion: filtered events did not make into the binlog
|
||||
show binlog events from <binlog_start>;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 # Query # # CREATE DATABASE b42829
|
||||
master-bin.000001 # Query # # use `b42829`; CREATE TABLE t1 (x int, y int) engine=InnoDB
|
||||
master-bin.000001 # Query # # use `b42829`; CREATE TABLE t2 (x int, y int) engine=InnoDB
|
||||
DROP DATABASE b42829;
|
||||
DROP DATABASE b42829_filtered;
|
||||
SET @@session.tx_isolation= @old_isolation_level;
|
1
mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
Normal file
1
mysql-test/suite/binlog/t/binlog_stm_do_db-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--binlog-do-db=b42829
|
90
mysql-test/suite/binlog/t/binlog_stm_do_db.test
Normal file
90
mysql-test/suite/binlog/t/binlog_stm_do_db.test
Normal file
@ -0,0 +1,90 @@
|
||||
# BUG#42829: binlogging enabled for all schemas regardless of
|
||||
# binlog-db-db / binlog-ignore-db
|
||||
#
|
||||
# WHAT
|
||||
# ====
|
||||
#
|
||||
# We want to test whether filtered events from binlog will cause
|
||||
# raising an error mentioning that statement is unable to be logged or
|
||||
# not, when:
|
||||
#
|
||||
# 1. isolation level READ-COMMITTED; AND
|
||||
#
|
||||
# 2. using InnoDB engine; AND
|
||||
#
|
||||
# 3. using SBL (in which case InnoDB will only allow RBL).
|
||||
#
|
||||
# HOW
|
||||
# ===
|
||||
#
|
||||
# The test is implemented as follows:
|
||||
#
|
||||
# i) set tx_isolation to read-committed.
|
||||
#
|
||||
# ii) create two databases (one filtered other not - using
|
||||
# binlog-do-db)
|
||||
#
|
||||
# iii) Create statements that are to be filtered on filtered db
|
||||
#
|
||||
# - At this point, before fix, an error would be raised
|
||||
#
|
||||
# iv) do the same thing for not the filtered database and check
|
||||
# that events throw an error:
|
||||
#
|
||||
# - Error: ER_BINLOG_STMT_MODE_AND_ROW_ENGINE
|
||||
#
|
||||
|
||||
-- source include/have_log_bin.inc
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/have_binlog_format_statement.inc
|
||||
|
||||
SET @old_isolation_level= @@session.tx_isolation;
|
||||
SET @@session.tx_isolation= 'READ-COMMITTED';
|
||||
|
||||
-- let $engine= InnoDB
|
||||
-- let $filtered= b42829_filtered
|
||||
-- let $not_filtered= b42829
|
||||
|
||||
-- eval CREATE DATABASE $not_filtered
|
||||
-- eval use $not_filtered
|
||||
-- eval CREATE TABLE t1 (x int, y int) engine=$engine
|
||||
-- eval CREATE TABLE t2 (x int, y int) engine=$engine
|
||||
|
||||
-- eval CREATE DATABASE $filtered
|
||||
-- eval use $filtered
|
||||
-- eval CREATE TABLE t1 (x int, y int) engine=$engine
|
||||
-- eval CREATE TABLE t2 (x int, y int) engine=$engine
|
||||
|
||||
SET @@session.sql_log_bin= 0;
|
||||
-- eval INSERT INTO $filtered.t1 VALUES (100,100)
|
||||
-- eval INSERT INTO $not_filtered.t1 VALUES (100,100)
|
||||
SET @@session.sql_log_bin= 1;
|
||||
|
||||
-- echo ### assertion: the inserts will not raise log error because
|
||||
-- echo ### binlog-do-db is filtering used database
|
||||
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
|
||||
-- echo ### assertion: assert that despite updating a not filtered
|
||||
-- echo ### database this wont trigger an error as the
|
||||
-- echo ### used database is the filtered one.
|
||||
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
|
||||
|
||||
-- eval use $not_filtered
|
||||
-- echo ### assertion: the statements *will* raise log error because
|
||||
-- echo ### binlog-do-db is not filtering used database
|
||||
BEGIN;
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
INSERT INTO t2 VALUES (1,2), (1,3), (1,4);
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
-- eval UPDATE $filtered.t1 ft1, $not_filtered.t1 nft1 SET ft1.x=1, nft1.x=2
|
||||
-- error ER_BINLOG_LOGGING_IMPOSSIBLE
|
||||
INSERT INTO t1 SELECT * FROM t2;
|
||||
COMMIT;
|
||||
|
||||
-- echo ### assertion: filtered events did not make into the binlog
|
||||
source include/show_binlog_events.inc;
|
||||
|
||||
-- eval DROP DATABASE $not_filtered
|
||||
-- eval DROP DATABASE $filtered
|
||||
SET @@session.tx_isolation= @old_isolation_level;
|
@ -130,7 +130,7 @@ NULL mysql procs_priv Db 2 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI
|
||||
NULL mysql procs_priv Grantor 6 NO char 77 231 NULL NULL utf8 utf8_bin char(77) MUL select,insert,update,references
|
||||
NULL mysql procs_priv Host 1 NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
|
||||
NULL mysql procs_priv Proc_priv 7 NO set 27 81 NULL NULL utf8 utf8_general_ci set('Execute','Alter Routine','Grant') select,insert,update,references
|
||||
NULL mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references
|
||||
NULL mysql procs_priv Routine_name 4 NO char 64 192 NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references
|
||||
NULL mysql procs_priv Routine_type 5 NULL NO enum 9 27 NULL NULL utf8 utf8_bin enum('FUNCTION','PROCEDURE') PRI select,insert,update,references
|
||||
NULL mysql procs_priv Timestamp 8 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
|
||||
NULL mysql procs_priv User 3 NO char 16 48 NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
|
||||
@ -411,7 +411,7 @@ NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp
|
||||
3.0000 mysql procs_priv Host char 60 180 utf8 utf8_bin char(60)
|
||||
3.0000 mysql procs_priv Db char 64 192 utf8 utf8_bin char(64)
|
||||
3.0000 mysql procs_priv User char 16 48 utf8 utf8_bin char(16)
|
||||
3.0000 mysql procs_priv Routine_name char 64 192 utf8 utf8_bin char(64)
|
||||
3.0000 mysql procs_priv Routine_name char 64 192 utf8 utf8_general_ci char(64)
|
||||
3.0000 mysql procs_priv Routine_type enum 9 27 utf8 utf8_bin enum('FUNCTION','PROCEDURE')
|
||||
3.0000 mysql procs_priv Grantor char 77 231 utf8 utf8_bin char(77)
|
||||
3.0000 mysql procs_priv Proc_priv set 27 81 utf8 utf8_general_ci set('Execute','Alter Routine','Grant')
|
||||
|
@ -166,8 +166,8 @@ NULL db_datadict_2 t4 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH
|
||||
SHOW GRANTS FOR 'testuser1'@'localhost';
|
||||
Grants for testuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
|
||||
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
|
||||
GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
|
||||
SHOW GRANTS FOR 'testuser2'@'localhost';
|
||||
Grants for testuser2@localhost
|
||||
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
|
||||
@ -185,8 +185,8 @@ NULL db_datadict_2 t3 0 db_datadict_2 PRIMARY 1 f1 NULL 0 NULL NULL HASH
|
||||
SHOW GRANTS FOR 'testuser1'@'localhost';
|
||||
Grants for testuser1@localhost
|
||||
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
|
||||
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
|
||||
GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
|
||||
SHOW GRANTS FOR 'testuser2'@'localhost';
|
||||
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
|
||||
# Switch to connection testuser2
|
||||
|
@ -4,8 +4,10 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'");
|
||||
call mtr.add_suppression("Get master clock failed with error: ");
|
||||
call mtr.add_suppression("Get master SERVER_ID failed with error: ");
|
||||
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again");
|
||||
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
|
||||
SELECT IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP");
|
||||
IS_FREE_LOCK("debug_lock.before_get_UNIX_TIMESTAMP")
|
||||
1
|
||||
|
@ -0,0 +1 @@
|
||||
--master-retry-count=60
|
@ -16,8 +16,10 @@
|
||||
|
||||
source include/master-slave.inc;
|
||||
source include/have_debug.inc;
|
||||
call mtr.add_suppression("Slave I/O: .* failed with error: Lost connection to MySQL server at 'reading initial communication packet'");
|
||||
call mtr.add_suppression("Get master clock failed with error: ");
|
||||
call mtr.add_suppression("Get master SERVER_ID failed with error: ");
|
||||
call mtr.add_suppression("Slave I/O: Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again");
|
||||
call mtr.add_suppression("Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; .*");
|
||||
#Test case 1: Try to get the value of the UNIX_TIMESTAMP from master under network disconnection
|
||||
connection slave;
|
||||
let $debug_saved= `select @@global.debug`;
|
||||
|
@ -10,36 +10,13 @@ insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6
|
||||
select count(*) from t1 procedure analyse();
|
||||
select * from t1 procedure analyse();
|
||||
select * from t1 procedure analyse(2);
|
||||
--error ER_WRONG_USAGE
|
||||
create table t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
drop table t1;
|
||||
|
||||
--error ER_WRONG_USAGE
|
||||
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
||||
|
||||
#
|
||||
# Test with impossible where
|
||||
#
|
||||
create table t1 (a int not null);
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
select * from t1 where 0=1 procedure analyse();
|
||||
insert into t1 values(1);
|
||||
drop table t2;
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
select * from t2;
|
||||
insert into t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
insert into t1 values(2);
|
||||
drop table t2;
|
||||
create table t2 select * from t1 where 0=1 procedure analyse();
|
||||
show create table t2;
|
||||
select * from t2;
|
||||
insert into t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug#2813 - analyse does not quote string values in enums from string
|
||||
#
|
||||
@ -113,3 +90,46 @@ SELECT * FROM (SELECT * FROM t1) d PROCEDURE ANALYSE();
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug #48293: crash with procedure analyse, view with > 10 columns,
|
||||
--echo # having clause...
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1(a INT, b INT, c INT, d INT, e INT,
|
||||
f INT, g INT, h INT, i INT, j INT,k INT);
|
||||
INSERT INTO t1 VALUES (),();
|
||||
|
||||
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||
--echo #should have a derived table
|
||||
EXPLAIN SELECT * FROM v1;
|
||||
--echo #should not crash
|
||||
--error ER_WRONG_USAGE
|
||||
SELECT * FROM v1 PROCEDURE analyse();
|
||||
--echo #should not crash
|
||||
--error ER_WRONG_USAGE
|
||||
SELECT * FROM t1 a, v1, t1 b PROCEDURE analyse();
|
||||
--echo #should not crash
|
||||
--error ER_WRONG_USAGE
|
||||
SELECT * FROM (SELECT * FROM t1 having a > 1) x PROCEDURE analyse();
|
||||
--echo #should not crash
|
||||
--error ER_WRONG_USAGE
|
||||
SELECT * FROM t1 a, (SELECT * FROM t1 having a > 1) x, t1 b PROCEDURE analyse();
|
||||
--echo #should not crash
|
||||
--error ER_ORDER_WITH_PROC
|
||||
SELECT 1 FROM t1 group by a having a > 1 order by 1 PROCEDURE analyse();
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP TABLE t1;
|
||||
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
||||
--echo # should not crash
|
||||
--error ER_WRONG_USAGE
|
||||
CREATE TABLE t2 SELECT 1 FROM t1, t1 t3 GROUP BY t3.a PROCEDURE ANALYSE();
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
30
mysql-test/t/grant_lowercase_fs.test
Normal file
30
mysql-test/t/grant_lowercase_fs.test
Normal file
@ -0,0 +1,30 @@
|
||||
-- source include/have_case_insensitive_fs.inc
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
|
||||
#
|
||||
# Bug#41049 does syntax "grant" case insensitive?
|
||||
#
|
||||
create database db1;
|
||||
GRANT CREATE ON db1.* to user_1@localhost;
|
||||
GRANT SELECT ON db1.* to USER_1@localhost;
|
||||
|
||||
connect (con1,localhost,user_1,,db1);
|
||||
CREATE TABLE t1(f1 int);
|
||||
--error 1142
|
||||
SELECT * FROM t1;
|
||||
connect (con2,localhost,USER_1,,db1);
|
||||
SELECT * FROM t1;
|
||||
--error 1142
|
||||
CREATE TABLE t2(f1 int);
|
||||
|
||||
connection default;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
|
||||
DROP USER user_1@localhost;
|
||||
DROP USER USER_1@localhost;
|
||||
DROP DATABASE db1;
|
||||
use test;
|
@ -43,4 +43,33 @@ DISCONNECT addconroot;
|
||||
|
||||
DROP TABLE t2, t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
--echo # End of 5.0 tests
|
||||
|
||||
--echo #
|
||||
--echo # Bug#46539 Various crashes on INSERT IGNORE SELECT + SELECT
|
||||
--echo # FOR UPDATE
|
||||
--echo #
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a int primary key auto_increment,
|
||||
b int, index(b)) engine=innodb;
|
||||
insert into t1 (b) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
|
||||
set autocommit=0;
|
||||
begin;
|
||||
select * from t1 where b=5 for update;
|
||||
connect (con1, localhost, root,,);
|
||||
connection con1;
|
||||
--error ER_LOCK_WAIT_TIMEOUT
|
||||
insert ignore into t1 (b) select a as b from t1;
|
||||
connection default;
|
||||
--echo # Cleanup
|
||||
--echo #
|
||||
disconnect con1;
|
||||
commit;
|
||||
set autocommit=default;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.1 tests
|
||||
--echo #
|
@ -730,6 +730,60 @@ SELECT * FROM t1 JOIN t2 ON a=c ORDER BY a;
|
||||
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #42116: Mysql crash on specific query
|
||||
--echo #
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (a INT);
|
||||
CREATE TABLE t3 (a INT, INDEX (a));
|
||||
CREATE TABLE t4 (a INT);
|
||||
CREATE TABLE t5 (a INT);
|
||||
CREATE TABLE t6 (a INT);
|
||||
|
||||
INSERT INTO t1 VALUES (1), (1), (1);
|
||||
|
||||
INSERT INTO t2 VALUES
|
||||
(2), (2), (2), (2), (2), (2), (2), (2), (2), (2);
|
||||
|
||||
INSERT INTO t3 VALUES
|
||||
(3), (3), (3), (3), (3), (3), (3), (3), (3), (3);
|
||||
|
||||
EXPLAIN
|
||||
SELECT *
|
||||
FROM
|
||||
t1 JOIN t2 ON t1.a = t2.a
|
||||
LEFT JOIN
|
||||
(
|
||||
(
|
||||
t3 LEFT JOIN t4 ON t3.a = t4.a
|
||||
)
|
||||
LEFT JOIN
|
||||
(
|
||||
t5 LEFT JOIN t6 ON t5.a = t6.a
|
||||
)
|
||||
ON t4.a = t5.a
|
||||
)
|
||||
ON t1.a = t3.a;
|
||||
|
||||
SELECT *
|
||||
FROM
|
||||
t1 JOIN t2 ON t1.a = t2.a
|
||||
LEFT JOIN
|
||||
(
|
||||
(
|
||||
t3 LEFT JOIN t4 ON t3.a = t4.a
|
||||
)
|
||||
LEFT JOIN
|
||||
(
|
||||
t5 LEFT JOIN t6 ON t5.a = t6.a
|
||||
)
|
||||
ON t4.a = t5.a
|
||||
)
|
||||
ON t1.a = t3.a;
|
||||
|
||||
DROP TABLE t1,t2,t3,t4,t5,t6;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
||||
|
||||
|
@ -29,3 +29,65 @@ disconnect master;
|
||||
connection default;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#41049 does syntax "grant" case insensitive?
|
||||
#
|
||||
CREATE DATABASE d1;
|
||||
USE d1;
|
||||
CREATE TABLE T1(f1 INT);
|
||||
CREATE TABLE t1(f1 INT);
|
||||
GRANT SELECT ON T1 to user_1@localhost;
|
||||
|
||||
connect (con1,localhost,user_1,,d1);
|
||||
--error ER_TABLEACCESS_DENIED_ERROR
|
||||
select * from t1;
|
||||
select * from T1;
|
||||
connection default;
|
||||
GRANT SELECT ON t1 to user_1@localhost;
|
||||
connection con1;
|
||||
select * from information_schema.table_privileges;
|
||||
connection default;
|
||||
disconnect con1;
|
||||
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
||||
DROP USER user_1@localhost;
|
||||
DROP DATABASE d1;
|
||||
USE test;
|
||||
|
||||
CREATE DATABASE db1;
|
||||
USE db1;
|
||||
CREATE PROCEDURE p1() BEGIN END;
|
||||
CREATE FUNCTION f1(i INT) RETURNS INT RETURN i+1;
|
||||
|
||||
GRANT USAGE ON db1.* to user_1@localhost;
|
||||
GRANT EXECUTE ON PROCEDURE db1.P1 to user_1@localhost;
|
||||
GRANT EXECUTE ON FUNCTION db1.f1 to user_1@localhost;
|
||||
GRANT UPDATE ON db1.* to USER_1@localhost;
|
||||
|
||||
connect (con1,localhost,user_1,,db1);
|
||||
call p1();
|
||||
call P1();
|
||||
select f1(1);
|
||||
connect (con2,localhost,USER_1,,db1);
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
call p1();
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
call P1();
|
||||
--error ER_PROCACCESS_DENIED_ERROR
|
||||
select f1(1);
|
||||
|
||||
connection default;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user_1@localhost;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM USER_1@localhost;
|
||||
DROP FUNCTION f1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP USER user_1@localhost;
|
||||
DROP USER USER_1@localhost;
|
||||
DROP DATABASE db1;
|
||||
use test;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -1539,14 +1539,14 @@ INSERT INTO t1 SELECT a+5120,b FROM t1;
|
||||
SET myisam_sort_buffer_size=4;
|
||||
REPAIR TABLE t1;
|
||||
|
||||
# !!! Disabled until additional fix for BUG#47073 is pushed.
|
||||
#SET myisam_repair_threads=2;
|
||||
SET myisam_repair_threads=2;
|
||||
# May report different values depending on threads activity.
|
||||
#--replace_regex /changed from [0-9]+/changed from #/
|
||||
#REPAIR TABLE t1;
|
||||
#SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
|
||||
--disable_result_log
|
||||
REPAIR TABLE t1;
|
||||
--enable_result_log
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
|
||||
CHECK TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -375,4 +375,19 @@ INSERT INTO t1 VALUES(0);
|
||||
SELECT 1 FROM t1 GROUP BY (DATE(NULL)) WITH ROLLUP;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #48131: crash group by with rollup, distinct,
|
||||
--echo # filesort, with temporary tables
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY);
|
||||
INSERT INTO t1 VALUES (1), (2);
|
||||
CREATE TABLE t2 (b INT);
|
||||
INSERT INTO t2 VALUES (100);
|
||||
|
||||
SELECT a, b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
|
||||
SELECT DISTINCT b FROM t1, t2 GROUP BY a, b WITH ROLLUP;
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -3755,7 +3755,24 @@ EXPLAIN SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
|
||||
SELECT 1 FROM t1 NATURAL LEFT JOIN t1 AS t2 FORCE INDEX(a);
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # Bug #48291 : crash with row() operator,select into @var, and
|
||||
--echo # subquery returning multiple rows
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1(a INT);
|
||||
INSERT INTO t1 VALUES (2),(3);
|
||||
|
||||
--echo # Should not crash
|
||||
--error ER_SUBQUERY_NO_1_ROW
|
||||
SELECT 1 FROM t1 WHERE a <> 1 AND NOT
|
||||
ROW(a,a) <=> ROW((SELECT 1 FROM t1 WHERE 1=2),(SELECT 1 FROM t1))
|
||||
INTO @var0;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
#
|
||||
|
@ -30,7 +30,7 @@ SELECT 1 IN (SELECT 1);
|
||||
SELECT 1 FROM (SELECT 1 as a) b WHERE 1 IN (SELECT (SELECT a));
|
||||
-- error ER_WRONG_USAGE
|
||||
select (SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(1));
|
||||
-- error ER_WRONG_USAGE
|
||||
-- error ER_WRONG_PARAMETERS_TO_PROCEDURE
|
||||
SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE((SELECT 1));
|
||||
-- error ER_BAD_FIELD_ERROR
|
||||
SELECT (SELECT 1) as a FROM (SELECT 1) b WHERE (SELECT a) IS NULL;
|
||||
|
@ -149,6 +149,68 @@ xa end 'a';
|
||||
xa prepare 'a';
|
||||
xa commit 'a';
|
||||
|
||||
#
|
||||
# BUG#43171 - Assertion failed: thd->transaction.xid_state.xid.is_null()
|
||||
#
|
||||
CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1),(2);
|
||||
connect(con1,localhost,root,,);
|
||||
|
||||
# Part 1: Prepare to test XA START after regular transaction deadlock
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=3 WHERE a=1;
|
||||
|
||||
connection default;
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=4 WHERE a=2;
|
||||
|
||||
connection con1;
|
||||
let $conn_id= `SELECT CONNECTION_ID()`;
|
||||
SEND UPDATE t1 SET a=5 WHERE a=2;
|
||||
|
||||
connection default;
|
||||
let $wait_timeout= 2;
|
||||
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE ID=$conn_id AND STATE='Searching rows for update';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--error ER_LOCK_DEADLOCK
|
||||
UPDATE t1 SET a=5 WHERE a=1;
|
||||
ROLLBACK;
|
||||
|
||||
# Part 2: Prepare to test XA START after XA transaction deadlock
|
||||
connection con1;
|
||||
REAP;
|
||||
ROLLBACK;
|
||||
BEGIN;
|
||||
UPDATE t1 SET a=3 WHERE a=1;
|
||||
|
||||
connection default;
|
||||
XA START 'xid1';
|
||||
UPDATE t1 SET a=4 WHERE a=2;
|
||||
|
||||
connection con1;
|
||||
SEND UPDATE t1 SET a=5 WHERE a=2;
|
||||
|
||||
connection default;
|
||||
let $wait_timeout= 2;
|
||||
let $wait_condition= SELECT 1 FROM INFORMATION_SCHEMA.PROCESSLIST
|
||||
WHERE ID=$conn_id AND STATE='Searching rows for update';
|
||||
--source include/wait_condition.inc
|
||||
|
||||
--error ER_LOCK_DEADLOCK
|
||||
UPDATE t1 SET a=5 WHERE a=1;
|
||||
--error ER_XA_RBDEADLOCK
|
||||
XA END 'xid1';
|
||||
XA ROLLBACK 'xid1';
|
||||
|
||||
XA START 'xid1';
|
||||
XA END 'xid1';
|
||||
XA ROLLBACK 'xid1';
|
||||
|
||||
disconnect con1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Wait till all disconnects are completed
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
||||
|
@ -1012,9 +1012,11 @@ static void init_one_value(const struct my_option *option, uchar* *variable,
|
||||
*((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL);
|
||||
break;
|
||||
case GET_ULL:
|
||||
case GET_SET:
|
||||
*((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL);
|
||||
break;
|
||||
case GET_SET:
|
||||
*((ulonglong*) variable)= (ulonglong) value;
|
||||
break;
|
||||
case GET_DOUBLE:
|
||||
*((double*) variable)= (double) value;
|
||||
break;
|
||||
|
@ -182,7 +182,10 @@ my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err)
|
||||
{
|
||||
(*err)++;
|
||||
i= x;
|
||||
while (*x && *x != field_separator) x++;
|
||||
while (*x && *x != field_separator)
|
||||
x++;
|
||||
if (x[0] && x[1]) // skip separator if found
|
||||
x++;
|
||||
if ((find= find_type(i, lib, 2 | 8) - 1) < 0)
|
||||
DBUG_RETURN(0);
|
||||
result|= (ULL(1) << find);
|
||||
|
@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS time_zone_leap_second ( Transition_time bigint sign
|
||||
|
||||
CREATE TABLE IF NOT EXISTS proc (db char(64) collate utf8_bin DEFAULT '' NOT NULL, name char(64) DEFAULT '' NOT NULL, type enum('FUNCTION','PROCEDURE') NOT NULL, specific_name char(64) DEFAULT '' NOT NULL, language enum('SQL') DEFAULT 'SQL' NOT NULL, sql_data_access enum( 'CONTAINS_SQL', 'NO_SQL', 'READS_SQL_DATA', 'MODIFIES_SQL_DATA') DEFAULT 'CONTAINS_SQL' NOT NULL, is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, param_list blob NOT NULL, returns longblob DEFAULT '' NOT NULL, body longblob NOT NULL, definer char(77) collate utf8_bin DEFAULT '' NOT NULL, created timestamp, modified timestamp, sql_mode set( 'REAL_AS_FLOAT', 'PIPES_AS_CONCAT', 'ANSI_QUOTES', 'IGNORE_SPACE', 'NOT_USED', 'ONLY_FULL_GROUP_BY', 'NO_UNSIGNED_SUBTRACTION', 'NO_DIR_IN_CREATE', 'POSTGRESQL', 'ORACLE', 'MSSQL', 'DB2', 'MAXDB', 'NO_KEY_OPTIONS', 'NO_TABLE_OPTIONS', 'NO_FIELD_OPTIONS', 'MYSQL323', 'MYSQL40', 'ANSI', 'NO_AUTO_VALUE_ON_ZERO', 'NO_BACKSLASH_ESCAPES', 'STRICT_TRANS_TABLES', 'STRICT_ALL_TABLES', 'NO_ZERO_IN_DATE', 'NO_ZERO_DATE', 'INVALID_DATES', 'ERROR_FOR_DIVISION_BY_ZERO', 'TRADITIONAL', 'NO_AUTO_CREATE_USER', 'HIGH_NOT_PRECEDENCE', 'NO_ENGINE_SUBSTITUTION', 'PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) collate utf8_bin DEFAULT '' NOT NULL, character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db,name,type)) engine=MyISAM character set utf8 comment='Stored Procedures';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) binary DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
|
||||
CREATE TABLE IF NOT EXISTS procs_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(16) binary DEFAULT '' NOT NULL, Routine_name char(64) COLLATE utf8_general_ci DEFAULT '' NOT NULL, Routine_type enum('FUNCTION','PROCEDURE') NOT NULL, Grantor char(77) DEFAULT '' NOT NULL, Proc_priv set('Execute','Alter Routine','Grant') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Timestamp timestamp(14), PRIMARY KEY (Host,Db,User,Routine_name,Routine_type), KEY Grantor (Grantor) ) engine=MyISAM CHARACTER SET utf8 COLLATE utf8_bin comment='Procedure privileges';
|
||||
|
||||
-- Create general_log if CSV is enabled.
|
||||
|
||||
|
@ -337,6 +337,10 @@ ALTER TABLE procs_priv
|
||||
MODIFY Proc_priv set('Execute','Alter Routine','Grant')
|
||||
COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
|
||||
ALTER IGNORE TABLE procs_priv
|
||||
MODIFY Routine_name char(64)
|
||||
COLLATE utf8_general_ci DEFAULT '' NOT NULL;
|
||||
|
||||
ALTER TABLE procs_priv
|
||||
ADD Routine_type enum('FUNCTION','PROCEDURE')
|
||||
COLLATE utf8_general_ci NOT NULL AFTER Routine_name;
|
||||
|
@ -1311,7 +1311,8 @@ int ha_rollback_trans(THD *thd, bool all)
|
||||
}
|
||||
trans->ha_list= 0;
|
||||
trans->no_2pc=0;
|
||||
if (is_real_trans && thd->transaction_rollback_request)
|
||||
if (is_real_trans && thd->transaction_rollback_request &&
|
||||
thd->transaction.xid_state.xa_state != XA_NOTR)
|
||||
thd->transaction.xid_state.rm_error= thd->main_da.sql_errno();
|
||||
if (all)
|
||||
thd->variables.tx_isolation=thd->session_tx_isolation;
|
||||
|
@ -263,8 +263,7 @@ my_bool acl_init(bool dont_read_acl_tables)
|
||||
acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
|
||||
(hash_get_key) acl_entry_get_key,
|
||||
(hash_free_key) free,
|
||||
lower_case_file_system ?
|
||||
system_charset_info : &my_charset_bin);
|
||||
&my_charset_utf8_bin);
|
||||
if (dont_read_acl_tables)
|
||||
{
|
||||
DBUG_RETURN(0); /* purecov: tested */
|
||||
@ -2251,12 +2250,13 @@ public:
|
||||
ulong sort;
|
||||
size_t key_length;
|
||||
GRANT_NAME(const char *h, const char *d,const char *u,
|
||||
const char *t, ulong p);
|
||||
GRANT_NAME (TABLE *form);
|
||||
const char *t, ulong p, bool is_routine);
|
||||
GRANT_NAME (TABLE *form, bool is_routine);
|
||||
virtual ~GRANT_NAME() {};
|
||||
virtual bool ok() { return privs != 0; }
|
||||
void set_user_details(const char *h, const char *d,
|
||||
const char *u, const char *t);
|
||||
const char *u, const char *t,
|
||||
bool is_routine);
|
||||
};
|
||||
|
||||
|
||||
@ -2275,7 +2275,8 @@ public:
|
||||
|
||||
|
||||
void GRANT_NAME::set_user_details(const char *h, const char *d,
|
||||
const char *u, const char *t)
|
||||
const char *u, const char *t,
|
||||
bool is_routine)
|
||||
{
|
||||
/* Host given by user */
|
||||
update_hostname(&host, strdup_root(&memex, h));
|
||||
@ -2290,7 +2291,7 @@ void GRANT_NAME::set_user_details(const char *h, const char *d,
|
||||
if (tname != t)
|
||||
{
|
||||
tname= strdup_root(&memex, t);
|
||||
if (lower_case_table_names)
|
||||
if (lower_case_table_names || is_routine)
|
||||
my_casedn_str(files_charset_info, tname);
|
||||
}
|
||||
key_length= strlen(d) + strlen(u)+ strlen(t)+3;
|
||||
@ -2299,22 +2300,22 @@ void GRANT_NAME::set_user_details(const char *h, const char *d,
|
||||
}
|
||||
|
||||
GRANT_NAME::GRANT_NAME(const char *h, const char *d,const char *u,
|
||||
const char *t, ulong p)
|
||||
const char *t, ulong p, bool is_routine)
|
||||
:db(0), tname(0), privs(p)
|
||||
{
|
||||
set_user_details(h, d, u, t);
|
||||
set_user_details(h, d, u, t, is_routine);
|
||||
}
|
||||
|
||||
GRANT_TABLE::GRANT_TABLE(const char *h, const char *d,const char *u,
|
||||
const char *t, ulong p, ulong c)
|
||||
:GRANT_NAME(h,d,u,t,p), cols(c)
|
||||
:GRANT_NAME(h,d,u,t,p, FALSE), cols(c)
|
||||
{
|
||||
(void) hash_init2(&hash_columns,4,system_charset_info,
|
||||
0,0,0, (hash_get_key) get_key_column,0,0);
|
||||
}
|
||||
|
||||
|
||||
GRANT_NAME::GRANT_NAME(TABLE *form)
|
||||
GRANT_NAME::GRANT_NAME(TABLE *form, bool is_routine)
|
||||
{
|
||||
update_hostname(&host, get_field(&memex, form->field[0]));
|
||||
db= get_field(&memex,form->field[1]);
|
||||
@ -2332,6 +2333,9 @@ GRANT_NAME::GRANT_NAME(TABLE *form)
|
||||
if (lower_case_table_names)
|
||||
{
|
||||
my_casedn_str(files_charset_info, db);
|
||||
}
|
||||
if (lower_case_table_names || is_routine)
|
||||
{
|
||||
my_casedn_str(files_charset_info, tname);
|
||||
}
|
||||
key_length= (strlen(db) + strlen(user) + strlen(tname) + 3);
|
||||
@ -2343,7 +2347,7 @@ GRANT_NAME::GRANT_NAME(TABLE *form)
|
||||
|
||||
|
||||
GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
|
||||
:GRANT_NAME(form)
|
||||
:GRANT_NAME(form, FALSE)
|
||||
{
|
||||
uchar key[MAX_KEY_LENGTH];
|
||||
|
||||
@ -3338,7 +3342,7 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc,
|
||||
}
|
||||
grant_name= new GRANT_NAME(Str->host.str, db_name,
|
||||
Str->user.str, table_name,
|
||||
rights);
|
||||
rights, TRUE);
|
||||
if (!grant_name)
|
||||
{
|
||||
result= TRUE;
|
||||
@ -3549,10 +3553,10 @@ static my_bool grant_load_procs_priv(TABLE *p_table)
|
||||
MEM_ROOT **save_mem_root_ptr= my_pthread_getspecific_ptr(MEM_ROOT**,
|
||||
THR_MALLOC);
|
||||
DBUG_ENTER("grant_load_procs_priv");
|
||||
(void) hash_init(&proc_priv_hash,system_charset_info,
|
||||
(void) hash_init(&proc_priv_hash, &my_charset_utf8_bin,
|
||||
0,0,0, (hash_get_key) get_grant_table,
|
||||
0,0);
|
||||
(void) hash_init(&func_priv_hash,system_charset_info,
|
||||
(void) hash_init(&func_priv_hash, &my_charset_utf8_bin,
|
||||
0,0,0, (hash_get_key) get_grant_table,
|
||||
0,0);
|
||||
p_table->file->ha_index_init(0, 1);
|
||||
@ -3566,7 +3570,7 @@ static my_bool grant_load_procs_priv(TABLE *p_table)
|
||||
{
|
||||
GRANT_NAME *mem_check;
|
||||
HASH *hash;
|
||||
if (!(mem_check=new (memex_ptr) GRANT_NAME(p_table)))
|
||||
if (!(mem_check=new (memex_ptr) GRANT_NAME(p_table, TRUE)))
|
||||
{
|
||||
/* This could only happen if we are out memory */
|
||||
goto end_unlock;
|
||||
@ -3650,7 +3654,7 @@ static my_bool grant_load(THD *thd, TABLE_LIST *tables)
|
||||
|
||||
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
|
||||
|
||||
(void) hash_init(&column_priv_hash,system_charset_info,
|
||||
(void) hash_init(&column_priv_hash, &my_charset_utf8_bin,
|
||||
0,0,0, (hash_get_key) get_grant_table,
|
||||
(hash_free_key) free_grant_table,0);
|
||||
|
||||
@ -5452,7 +5456,8 @@ static int handle_grant_struct(uint struct_no, bool drop,
|
||||
host name
|
||||
*/
|
||||
grant_name->set_user_details(user_to->host.str, grant_name->db,
|
||||
user_to->user.str, grant_name->tname);
|
||||
user_to->user.str, grant_name->tname,
|
||||
TRUE);
|
||||
|
||||
/*
|
||||
Since username is part of the hash key, when the user name
|
||||
@ -6139,7 +6144,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name,
|
||||
for (counter= 0, revoked= 0 ; counter < hash->records ; )
|
||||
{
|
||||
GRANT_NAME *grant_proc= (GRANT_NAME*) hash_element(hash, counter);
|
||||
if (!my_strcasecmp(system_charset_info, grant_proc->db, sp_db) &&
|
||||
if (!my_strcasecmp(&my_charset_utf8_bin, grant_proc->db, sp_db) &&
|
||||
!my_strcasecmp(system_charset_info, grant_proc->tname, sp_name))
|
||||
{
|
||||
LEX_USER lex_user;
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <m_ctype.h>
|
||||
#include <my_dir.h>
|
||||
#include <hash.h>
|
||||
#include "rpl_filter.h"
|
||||
#ifdef __WIN__
|
||||
#include <io.h>
|
||||
#endif
|
||||
@ -5098,7 +5099,16 @@ static void mark_real_tables_as_free_for_reuse(TABLE_LIST *table)
|
||||
|
||||
int decide_logging_format(THD *thd, TABLE_LIST *tables)
|
||||
{
|
||||
if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG))
|
||||
/*
|
||||
In SBR mode, we are only proceeding if we are binlogging this
|
||||
statement, ie, the filtering rules won't later filter this out.
|
||||
|
||||
This check here is needed to prevent some spurious error to be
|
||||
raised in some cases (See BUG#42829).
|
||||
*/
|
||||
if (mysql_bin_log.is_open() && (thd->options & OPTION_BIN_LOG) &&
|
||||
(thd->variables.binlog_format != BINLOG_FORMAT_STMT ||
|
||||
binlog_filter->db_ok(thd->db)))
|
||||
{
|
||||
/*
|
||||
Compute the starting vectors for the computations by creating a
|
||||
|
@ -2723,9 +2723,11 @@ bool select_dumpvar::send_data(List<Item> &items)
|
||||
else
|
||||
{
|
||||
Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
|
||||
suv->fix_fields(thd, 0);
|
||||
if (suv->fix_fields(thd, 0))
|
||||
DBUG_RETURN (1);
|
||||
suv->save_item_result(item);
|
||||
suv->update();
|
||||
if (suv->update())
|
||||
DBUG_RETURN (1);
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(thd->is_error());
|
||||
@ -3043,6 +3045,11 @@ extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all)
|
||||
{
|
||||
mark_transaction_to_rollback(thd, all);
|
||||
}
|
||||
|
||||
extern "C" bool thd_binlog_filter_ok(const MYSQL_THD thd)
|
||||
{
|
||||
return binlog_filter->db_ok(thd->db);
|
||||
}
|
||||
#endif // INNODB_COMPATIBILITY_HOOKS */
|
||||
|
||||
/****************************************************************************
|
||||
@ -3215,6 +3222,16 @@ void mark_transaction_to_rollback(THD *thd, bool all)
|
||||
{
|
||||
thd->is_fatal_sub_stmt_error= TRUE;
|
||||
thd->transaction_rollback_request= all;
|
||||
/*
|
||||
Aborted transactions can not be IGNOREd.
|
||||
Switch off the IGNORE flag for the current
|
||||
SELECT_LEX. This should allow my_error()
|
||||
to report the error and abort the execution
|
||||
flow, even in presence
|
||||
of IGNORE clause.
|
||||
*/
|
||||
if (thd->lex->current_select)
|
||||
thd->lex->current_select->no_error= FALSE;
|
||||
}
|
||||
}
|
||||
/***************************************************************************
|
||||
|
@ -122,6 +122,14 @@ static bool xa_trans_rolled_back(XID_STATE *xid_state)
|
||||
*/
|
||||
static bool xa_trans_rollback(THD *thd)
|
||||
{
|
||||
/*
|
||||
Resource Manager error is meaningless at this point, as we perform
|
||||
explicit rollback request by user. We must reset rm_error before
|
||||
calling ha_rollback(), so thd->transaction.xid structure gets reset
|
||||
by ha_rollback()/THD::transaction::cleanup().
|
||||
*/
|
||||
thd->transaction.xid_state.rm_error= 0;
|
||||
|
||||
bool status= test(ha_rollback(thd));
|
||||
|
||||
thd->options&= ~(ulong) OPTION_BEGIN;
|
||||
@ -129,7 +137,6 @@ static bool xa_trans_rollback(THD *thd)
|
||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||
xid_cache_delete(&thd->transaction.xid_state);
|
||||
thd->transaction.xid_state.xa_state= XA_NOTR;
|
||||
thd->transaction.xid_state.rm_error= 0;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -2066,7 +2066,7 @@ static int check_func_set(THD *thd, struct st_mysql_sys_var *var,
|
||||
const char *strvalue= "NULL", *str;
|
||||
TYPELIB *typelib;
|
||||
ulonglong result;
|
||||
uint error_len;
|
||||
uint error_len= 0; // init as only set on error
|
||||
bool not_used;
|
||||
int length;
|
||||
|
||||
@ -2665,7 +2665,9 @@ uchar* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type,
|
||||
{
|
||||
if (!(value & mask))
|
||||
continue;
|
||||
str.append(typelib->type_names[i], typelib->type_lengths[i]);
|
||||
str.append(typelib->type_names[i], typelib->type_lengths
|
||||
? typelib->type_lengths[i]
|
||||
: strlen(typelib->type_names[i]));
|
||||
str.append(',');
|
||||
}
|
||||
|
||||
|
@ -633,6 +633,18 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
MYF(0)); /* purecov: inspected */
|
||||
goto err; /* purecov: inspected */
|
||||
}
|
||||
if (thd->lex->derived_tables)
|
||||
{
|
||||
my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE",
|
||||
thd->lex->derived_tables & DERIVED_VIEW ?
|
||||
"view" : "subquery");
|
||||
goto err;
|
||||
}
|
||||
if (thd->lex->sql_command != SQLCOM_SELECT)
|
||||
{
|
||||
my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "non-SELECT");
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (!procedure && result && result->prepare(fields_list, unit_arg))
|
||||
@ -969,6 +981,12 @@ JOIN::optimize()
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
if (select_lex->olap == ROLLUP_TYPE && rollup_process_const_fields())
|
||||
{
|
||||
DBUG_PRINT("error", ("Error: rollup_process_fields() failed"));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
/* Remove distinct if only const tables */
|
||||
select_distinct= select_distinct && (const_tables != tables);
|
||||
thd_proc_info(thd, "preparing");
|
||||
@ -1099,7 +1117,7 @@ JOIN::optimize()
|
||||
join_tab[const_tables].select->quick->get_type() !=
|
||||
QUICK_SELECT_I::QS_TYPE_GROUP_MIN_MAX))
|
||||
{
|
||||
if (group_list &&
|
||||
if (group_list && rollup.state == ROLLUP::STATE_NONE &&
|
||||
list_contains_unique_index(join_tab[const_tables].table,
|
||||
find_field_in_order_list,
|
||||
(void *) group_list))
|
||||
@ -1143,7 +1161,8 @@ JOIN::optimize()
|
||||
if (! hidden_group_fields && rollup.state == ROLLUP::STATE_NONE)
|
||||
select_distinct=0;
|
||||
}
|
||||
else if (select_distinct && tables - const_tables == 1)
|
||||
else if (select_distinct && tables - const_tables == 1 &&
|
||||
rollup.state == ROLLUP::STATE_NONE)
|
||||
{
|
||||
/*
|
||||
We are only using one table. In this case we change DISTINCT to a
|
||||
@ -8964,7 +8983,10 @@ static void restore_prev_nj_state(JOIN_TAB *last)
|
||||
join->cur_embedding_map&= ~last_emb->nested_join->nj_map;
|
||||
else if (last_emb->nested_join->join_list.elements-1 ==
|
||||
last_emb->nested_join->counter)
|
||||
{
|
||||
join->cur_embedding_map|= last_emb->nested_join->nj_map;
|
||||
break;
|
||||
}
|
||||
else
|
||||
break;
|
||||
last_emb= last_emb->embedding;
|
||||
@ -10212,6 +10234,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
|
||||
for (; cur_group ; cur_group= cur_group->next, key_part_info++)
|
||||
{
|
||||
Field *field=(*cur_group->item)->get_tmp_table_field();
|
||||
DBUG_ASSERT(field->table == table);
|
||||
bool maybe_null=(*cur_group->item)->maybe_null;
|
||||
key_part_info->null_bit=0;
|
||||
key_part_info->field= field;
|
||||
@ -11189,6 +11212,7 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
|
||||
bool not_used_in_distinct=join_tab->not_used_in_distinct;
|
||||
ha_rows found_records=join->found_records;
|
||||
COND *select_cond= join_tab->select_cond;
|
||||
bool select_cond_result= TRUE;
|
||||
|
||||
if (error > 0 || (join->thd->is_error())) // Fatal error
|
||||
return NESTED_LOOP_ERROR;
|
||||
@ -11200,7 +11224,17 @@ evaluate_join_record(JOIN *join, JOIN_TAB *join_tab,
|
||||
return NESTED_LOOP_KILLED; /* purecov: inspected */
|
||||
}
|
||||
DBUG_PRINT("info", ("select cond 0x%lx", (ulong)select_cond));
|
||||
if (!select_cond || select_cond->val_int())
|
||||
|
||||
if (select_cond)
|
||||
{
|
||||
select_cond_result= test(select_cond->val_int());
|
||||
|
||||
/* check for errors evaluating the condition */
|
||||
if (join->thd->is_error())
|
||||
return NESTED_LOOP_ERROR;
|
||||
}
|
||||
|
||||
if (!select_cond || select_cond_result)
|
||||
{
|
||||
/*
|
||||
There is no select condition or the attached pushed down
|
||||
@ -15637,32 +15671,7 @@ bool JOIN::rollup_init()
|
||||
{
|
||||
item->maybe_null= 1;
|
||||
found_in_group= 1;
|
||||
if (item->const_item())
|
||||
{
|
||||
/*
|
||||
For ROLLUP queries each constant item referenced in GROUP BY list
|
||||
is wrapped up into an Item_func object yielding the same value
|
||||
as the constant item. The objects of the wrapper class are never
|
||||
considered as constant items and besides they inherit all
|
||||
properties of the Item_result_field class.
|
||||
This wrapping allows us to ensure writing constant items
|
||||
into temporary tables whenever the result of the ROLLUP
|
||||
operation has to be written into a temporary table, e.g. when
|
||||
ROLLUP is used together with DISTINCT in the SELECT list.
|
||||
Usually when creating temporary tables for a intermidiate
|
||||
result we do not include fields for constant expressions.
|
||||
*/
|
||||
Item* new_item= new Item_func_rollup_const(item);
|
||||
if (!new_item)
|
||||
return 1;
|
||||
new_item->fix_fields(thd, (Item **) 0);
|
||||
thd->change_item_tree(it.ref(), new_item);
|
||||
for (ORDER *tmp= group_tmp; tmp; tmp= tmp->next)
|
||||
{
|
||||
if (*tmp->item == item)
|
||||
thd->change_item_tree(tmp->item, new_item);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (item->type() == Item::FUNC_ITEM && !found_in_group)
|
||||
@ -15681,6 +15690,59 @@ bool JOIN::rollup_init()
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Wrap all constant Items in GROUP BY list.
|
||||
|
||||
For ROLLUP queries each constant item referenced in GROUP BY list
|
||||
is wrapped up into an Item_func object yielding the same value
|
||||
as the constant item. The objects of the wrapper class are never
|
||||
considered as constant items and besides they inherit all
|
||||
properties of the Item_result_field class.
|
||||
This wrapping allows us to ensure writing constant items
|
||||
into temporary tables whenever the result of the ROLLUP
|
||||
operation has to be written into a temporary table, e.g. when
|
||||
ROLLUP is used together with DISTINCT in the SELECT list.
|
||||
Usually when creating temporary tables for a intermidiate
|
||||
result we do not include fields for constant expressions.
|
||||
|
||||
@retval
|
||||
0 if ok
|
||||
@retval
|
||||
1 on error
|
||||
*/
|
||||
|
||||
bool JOIN::rollup_process_const_fields()
|
||||
{
|
||||
ORDER *group_tmp;
|
||||
Item *item;
|
||||
List_iterator<Item> it(all_fields);
|
||||
|
||||
for (group_tmp= group_list; group_tmp; group_tmp= group_tmp->next)
|
||||
{
|
||||
if (!(*group_tmp->item)->const_item())
|
||||
continue;
|
||||
while ((item= it++))
|
||||
{
|
||||
if (*group_tmp->item == item)
|
||||
{
|
||||
Item* new_item= new Item_func_rollup_const(item);
|
||||
if (!new_item)
|
||||
return 1;
|
||||
new_item->fix_fields(thd, (Item **) 0);
|
||||
thd->change_item_tree(it.ref(), new_item);
|
||||
for (ORDER *tmp= group_tmp; tmp; tmp= tmp->next)
|
||||
{
|
||||
if (*tmp->item == item)
|
||||
thd->change_item_tree(tmp->item, new_item);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
it.rewind();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
@ -512,6 +512,7 @@ public:
|
||||
}
|
||||
|
||||
bool rollup_init();
|
||||
bool rollup_process_const_fields();
|
||||
bool rollup_make_fields(List<Item> &all_fields, List<Item> &fields,
|
||||
Item_sum ***func);
|
||||
int rollup_send_data(uint idx);
|
||||
|
@ -9082,8 +9082,7 @@ procedure_clause:
|
||||
MYSQL_YYABORT;
|
||||
}
|
||||
|
||||
if (&lex->select_lex != lex->current_select ||
|
||||
lex->select_lex.get_table_list()->derived)
|
||||
if (&lex->select_lex != lex->current_select)
|
||||
{
|
||||
my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery");
|
||||
MYSQL_YYABORT;
|
||||
|
@ -7027,8 +7027,9 @@ ha_innobase::external_lock(
|
||||
{
|
||||
ulong const binlog_format= thd_binlog_format(thd);
|
||||
ulong const tx_isolation = thd_tx_isolation(current_thd);
|
||||
if (tx_isolation <= ISO_READ_COMMITTED &&
|
||||
binlog_format == BINLOG_FORMAT_STMT)
|
||||
if (tx_isolation <= ISO_READ_COMMITTED
|
||||
&& binlog_format == BINLOG_FORMAT_STMT
|
||||
&& thd_binlog_filter_ok(thd))
|
||||
{
|
||||
char buf[256];
|
||||
my_snprintf(buf, sizeof(buf),
|
||||
|
@ -252,4 +252,11 @@ int thd_binlog_format(const MYSQL_THD thd);
|
||||
@param all TRUE <=> rollback main transaction.
|
||||
*/
|
||||
void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
|
||||
|
||||
/**
|
||||
Check if binary logging is filtered for thread's current db.
|
||||
@param thd Thread handle
|
||||
@retval 1 the query is not filtered, 0 otherwise.
|
||||
*/
|
||||
bool thd_binlog_filter_ok(const MYSQL_THD thd);
|
||||
}
|
||||
|
@ -7891,8 +7891,9 @@ ha_innobase::external_lock(
|
||||
{
|
||||
ulong const binlog_format= thd_binlog_format(thd);
|
||||
ulong const tx_isolation = thd_tx_isolation(ha_thd());
|
||||
if (tx_isolation <= ISO_READ_COMMITTED &&
|
||||
binlog_format == BINLOG_FORMAT_STMT)
|
||||
if (tx_isolation <= ISO_READ_COMMITTED
|
||||
&& binlog_format == BINLOG_FORMAT_STMT
|
||||
&& thd_binlog_filter_ok(thd))
|
||||
{
|
||||
char buf[256];
|
||||
my_snprintf(buf, sizeof(buf),
|
||||
|
@ -257,6 +257,13 @@ int thd_binlog_format(const MYSQL_THD thd);
|
||||
@param all TRUE <=> rollback main transaction.
|
||||
*/
|
||||
void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
|
||||
|
||||
/**
|
||||
Check if binary logging is filtered for thread's current db.
|
||||
@param thd Thread handle
|
||||
@retval 1 the query is not filtered, 0 otherwise.
|
||||
*/
|
||||
bool thd_binlog_filter_ok(const MYSQL_THD thd);
|
||||
}
|
||||
|
||||
typedef struct trx_struct trx_t;
|
||||
|
@ -115,6 +115,10 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
|
||||
Also we likely need to lock mutex here (in both cases with protocol and
|
||||
push_warning).
|
||||
*/
|
||||
#ifdef THREAD
|
||||
if (param->need_print_msg_lock)
|
||||
pthread_mutex_lock(¶m->print_msg_mutex);
|
||||
#endif
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(name, length, system_charset_info);
|
||||
protocol->store(param->op_name, system_charset_info);
|
||||
@ -123,6 +127,10 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
|
||||
if (protocol->write())
|
||||
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
|
||||
msgbuf);
|
||||
#ifdef THREAD
|
||||
if (param->need_print_msg_lock)
|
||||
pthread_mutex_unlock(¶m->print_msg_mutex);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,9 @@ void myisamchk_init(MI_CHECK *param)
|
||||
param->max_record_length= LONGLONG_MAX;
|
||||
param->key_cache_block_size= KEY_CACHE_BLOCK_SIZE;
|
||||
param->stats_method= MI_STATS_METHOD_NULLS_NOT_EQUAL;
|
||||
#ifdef THREAD
|
||||
param->need_print_msg_lock= 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Check the status flags for the table */
|
||||
@ -2703,6 +2706,8 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
|
||||
/* Initialize pthread structures before goto err. */
|
||||
pthread_mutex_init(&sort_info.mutex, MY_MUTEX_INIT_FAST);
|
||||
pthread_cond_init(&sort_info.cond, 0);
|
||||
pthread_mutex_init(¶m->print_msg_mutex, MY_MUTEX_INIT_FAST);
|
||||
param->need_print_msg_lock= 1;
|
||||
|
||||
if (!(sort_info.key_block=
|
||||
alloc_key_blocks(param, (uint) param->sort_key_blocks,
|
||||
@ -3108,6 +3113,8 @@ err:
|
||||
|
||||
pthread_cond_destroy (&sort_info.cond);
|
||||
pthread_mutex_destroy(&sort_info.mutex);
|
||||
pthread_mutex_destroy(¶m->print_msg_mutex);
|
||||
param->need_print_msg_lock= 0;
|
||||
|
||||
my_free((uchar*) sort_info.ft_buf, MYF(MY_ALLOW_ZERO_PTR));
|
||||
my_free((uchar*) sort_info.key_block,MYF(MY_ALLOW_ZERO_PTR));
|
||||
|
@ -466,8 +466,12 @@ ok:
|
||||
Detach from the share if the writer is involved. Avoid others to
|
||||
be blocked. This includes a flush of the write buffer. This will
|
||||
also indicate EOF to the readers.
|
||||
That means that a writer always gets here first and readers -
|
||||
only when they see EOF. But if a reader finishes prematurely
|
||||
because of an error it may reach this earlier - don't allow it
|
||||
to detach the writer thread.
|
||||
*/
|
||||
if (sort_param->sort_info->info->rec_cache.share)
|
||||
if (sort_param->master && sort_param->sort_info->info->rec_cache.share)
|
||||
remove_io_thread(&sort_param->sort_info->info->rec_cache);
|
||||
|
||||
/* Readers detach from the share if any. Avoid others to be blocked. */
|
||||
@ -789,6 +793,7 @@ cleanup:
|
||||
close_cached_file(to_file); /* This holds old result */
|
||||
if (to_file == t_file)
|
||||
{
|
||||
DBUG_ASSERT(t_file2.type == WRITE_CACHE);
|
||||
*t_file=t_file2; /* Copy result file */
|
||||
t_file->current_pos= &t_file->write_pos;
|
||||
t_file->current_end= &t_file->write_end;
|
||||
|
@ -144,55 +144,6 @@ vio_set_cert_stuff(SSL_CTX *ctx, const char *cert_file, const char *key_file,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
vio_verify_callback(int ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
char buf[256];
|
||||
X509 *err_cert;
|
||||
|
||||
DBUG_ENTER("vio_verify_callback");
|
||||
DBUG_PRINT("enter", ("ok: %d ctx: 0x%lx", ok, (long) ctx));
|
||||
|
||||
err_cert= X509_STORE_CTX_get_current_cert(ctx);
|
||||
X509_NAME_oneline(X509_get_subject_name(err_cert), buf, sizeof(buf));
|
||||
DBUG_PRINT("info", ("cert: %s", buf));
|
||||
if (!ok)
|
||||
{
|
||||
int err, depth;
|
||||
err= X509_STORE_CTX_get_error(ctx);
|
||||
depth= X509_STORE_CTX_get_error_depth(ctx);
|
||||
|
||||
DBUG_PRINT("error",("verify error: %d '%s'",err,
|
||||
X509_verify_cert_error_string(err)));
|
||||
/*
|
||||
Approve cert if depth is greater then "verify_depth", currently
|
||||
verify_depth is always 0 and there is no way to increase it.
|
||||
*/
|
||||
if (verify_depth >= depth)
|
||||
ok= 1;
|
||||
}
|
||||
switch (ctx->error)
|
||||
{
|
||||
case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
|
||||
X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, 256);
|
||||
DBUG_PRINT("info",("issuer= %s\n", buf));
|
||||
break;
|
||||
case X509_V_ERR_CERT_NOT_YET_VALID:
|
||||
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
|
||||
DBUG_PRINT("error", ("notBefore"));
|
||||
/*ASN1_TIME_print_fp(stderr,X509_get_notBefore(ctx->current_cert));*/
|
||||
break;
|
||||
case X509_V_ERR_CERT_HAS_EXPIRED:
|
||||
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
|
||||
DBUG_PRINT("error", ("notAfter error"));
|
||||
/*ASN1_TIME_print_fp(stderr,X509_get_notAfter(ctx->current_cert));*/
|
||||
break;
|
||||
}
|
||||
DBUG_PRINT("exit", ("%d", ok));
|
||||
DBUG_RETURN(ok);
|
||||
}
|
||||
|
||||
|
||||
#ifdef __NETWARE__
|
||||
|
||||
/* NetWare SSL cleanup */
|
||||
@ -354,11 +305,7 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
|
||||
|
||||
/* Init the VioSSLFd as a "connector" ie. the client side */
|
||||
|
||||
/*
|
||||
The verify_callback function is used to control the behaviour
|
||||
when the SSL_VERIFY_PEER flag is set.
|
||||
*/
|
||||
SSL_CTX_set_verify(ssl_fd->ssl_context, verify, vio_verify_callback);
|
||||
SSL_CTX_set_verify(ssl_fd->ssl_context, verify, NULL);
|
||||
|
||||
return ssl_fd;
|
||||
}
|
||||
@ -382,11 +329,7 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
|
||||
/* Set max number of cached sessions, returns the previous size */
|
||||
SSL_CTX_sess_set_cache_size(ssl_fd->ssl_context, 128);
|
||||
|
||||
/*
|
||||
The verify_callback function is used to control the behaviour
|
||||
when the SSL_VERIFY_PEER flag is set.
|
||||
*/
|
||||
SSL_CTX_set_verify(ssl_fd->ssl_context, verify, vio_verify_callback);
|
||||
SSL_CTX_set_verify(ssl_fd->ssl_context, verify, NULL);
|
||||
|
||||
/*
|
||||
Set session_id - an identifier for this server session
|
||||
|
Loading…
x
Reference in New Issue
Block a user