Skip to content

Commit

Permalink
Merge branch '10.2' into 10.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sanja-byelkin committed Oct 31, 2019
2 parents d6d621c + 259edb1 commit 55b2281
Show file tree
Hide file tree
Showing 107 changed files with 2,600 additions and 1,358 deletions.
3 changes: 0 additions & 3 deletions dbug/dbug.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,8 @@ typedef struct _db_code_state_ {
const char *file; /* Name of current user file */
struct _db_stack_frame_ *framep; /* Pointer to current frame */
struct settings *stack; /* debugging settings */
const char *jmpfunc; /* Remember current function for setjmp */
const char *jmpfile; /* Remember current file for setjmp */
int lineno; /* Current debugger output line number */
uint level; /* Current function nesting level */
int jmplevel; /* Remember nesting level at setjmp() */

/*
* The following variables are used to hold the state information
Expand Down
2 changes: 0 additions & 2 deletions debian/additions/my.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ max_binlog_size = 100M
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB
# you can't just change log file size, requires special procedure
#innodb_log_file_size = 50M
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
Expand Down
4 changes: 2 additions & 2 deletions include/mysql/service_wsrep.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ extern struct wsrep_service_st {
enum wsrep_conflict_state (*wsrep_thd_get_conflict_state_func)(MYSQL_THD);
my_bool (*wsrep_thd_is_BF_func)(MYSQL_THD , my_bool);
my_bool (*wsrep_thd_is_wsrep_func)(MYSQL_THD thd);
char * (*wsrep_thd_query_func)(THD *thd);
const char * (*wsrep_thd_query_func)(THD *thd);
enum wsrep_query_state (*wsrep_thd_query_state_func)(THD *thd);
const char * (*wsrep_thd_query_state_str_func)(THD *thd);
int (*wsrep_thd_retry_counter_func)(THD *thd);
Expand Down Expand Up @@ -186,7 +186,7 @@ extern long wsrep_protocol_version;

bool wsrep_consistency_check(THD *thd);
bool wsrep_prepare_key(const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len);
char *wsrep_thd_query(THD *thd);
const char *wsrep_thd_query(THD *thd);
const char *wsrep_thd_conflict_state_str(THD *thd);
const char *wsrep_thd_exec_mode_str(THD *thd);
const char *wsrep_thd_query_state_str(THD *thd);
Expand Down
2 changes: 1 addition & 1 deletion libmariadb
1 change: 0 additions & 1 deletion mysql-test/collections/10.0-compatible.list
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ main.function_defaults_innodb
main.gcc296
main.get_diagnostics
main.gis
main.gis2
main.gis-alter_table_online
main.gis-precise
main.gis-rt-precise
Expand Down
43 changes: 43 additions & 0 deletions mysql-test/main/func_math.result
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,49 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
# Bug #29723340: MYSQL SERVER CRASH AFTER SQL QUERY WITH DATA ?AST
#
create table t1(a int);
insert ignore t1 values("1e-214748364");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert ignore t1 values("1e-2147483648");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert ignore t1 values("1e-21474836480");
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
insert ignore t1 values("1e+214748364");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
insert ignore t1 values("1e+2147483647");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
insert ignore t1 values("1e+21474836470");
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
set global max_allowed_packet= cast(2*1024*1024*1024+1024 as unsigned);
Warnings:
Warning 1292 Truncated incorrect max_allowed_packet value: '2147484672'
connect foo,localhost,root;
set @a=2147483647;
insert ignore t1 values (concat('1', repeat('0', @a+18), 'e-', @a-1, '0'));
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1073741824) - truncated
disconnect foo;
connection default;
set global max_allowed_packet=default;
select * from t1;
a
0
0
0
2147483647
2147483647
2147483647
NULL
drop table t1;
#
# End of 5.5 tests
#
#
Expand Down
25 changes: 25 additions & 0 deletions mysql-test/main/func_math.test
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,31 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;


--echo #
--echo # Bug #29723340: MYSQL SERVER CRASH AFTER SQL QUERY WITH DATA ?AST
--echo #

create table t1(a int);
insert ignore t1 values("1e-214748364");
insert ignore t1 values("1e-2147483648");
insert ignore t1 values("1e-21474836480");
insert ignore t1 values("1e+214748364");
insert ignore t1 values("1e+2147483647");
insert ignore t1 values("1e+21474836470");

# if max max_allowed_packet will ever be increased beyond 2GB, this could
# break again:
set global max_allowed_packet= cast(2*1024*1024*1024+1024 as unsigned);
connect foo,localhost,root;
set @a=2147483647;
insert ignore t1 values (concat('1', repeat('0', @a+18), 'e-', @a-1, '0'));
disconnect foo;
connection default;
set global max_allowed_packet=default;

select * from t1;
drop table t1;

--echo #
--echo # End of 5.5 tests
--echo #
Expand Down
79 changes: 79 additions & 0 deletions mysql-test/main/information_schema_db.result
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,82 @@ connection user1;
disconnect user1;
connection default;
set global sql_mode=default;
create user foo@localhost;
grant select on test.* to foo@localhost;
create procedure rootonly() select 1;
create sql security definer view v1d as select current_user(),user from information_schema.processlist;
create sql security invoker view v1i as select current_user(),user from information_schema.processlist;
create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
create sql security invoker view v3i as select schema_name from information_schema.schemata where schema_name like '%mysql%';
create sql security definer view v4d as select routine_name from information_schema.routines where routine_schema='test';
create sql security invoker view v4i as select routine_name from information_schema.routines where routine_schema='test';
create sql security definer view v5d as select view_definition > '' from information_schema.views where table_name='v1d';
create sql security invoker view v5i as select view_definition > '' from information_schema.views where table_name='v1d';
connect foo,localhost,foo;
select * from v1d;
current_user() user
root@localhost root
root@localhost root
select * from v1i;
current_user() user
foo@localhost foo
select * from v2d;
table_name
user
select * from v2i;
table_name
select * from v3d;
schema_name
mysql
select * from v3i;
schema_name
select * from v4d;
routine_name
rootonly
select * from v4i;
routine_name
select * from v5d;
view_definition > ''
1
select * from v5i;
view_definition > ''
0
connection default;
select * from v1d;
current_user() user
root@localhost foo
root@localhost root
select * from v1i;
current_user() user
root@localhost foo
root@localhost root
select * from v2d;
table_name
user
select * from v2i;
table_name
user
select * from v3d;
schema_name
mysql
select * from v3i;
schema_name
mysql
select * from v4d;
routine_name
rootonly
select * from v4i;
routine_name
rootonly
select * from v5d;
view_definition > ''
1
select * from v5i;
view_definition > ''
1
disconnect foo;
drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
drop user foo@localhost;
drop procedure rootonly;
44 changes: 44 additions & 0 deletions mysql-test/main/information_schema_db.test
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,47 @@ disconnect user1;
connection default;

set global sql_mode=default;

#
# MDEV-20549 SQL SECURITY DEFINER does not work for INFORMATION_SCHEMA tables
#

create user foo@localhost;
grant select on test.* to foo@localhost;
create procedure rootonly() select 1;
create sql security definer view v1d as select current_user(),user from information_schema.processlist;
create sql security invoker view v1i as select current_user(),user from information_schema.processlist;
create sql security definer view v2d as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security invoker view v2i as select table_name from information_schema.tables where table_schema='mysql' and table_name like '%user%';
create sql security definer view v3d as select schema_name from information_schema.schemata where schema_name like '%mysql%';
create sql security invoker view v3i as select schema_name from information_schema.schemata where schema_name like '%mysql%';
create sql security definer view v4d as select routine_name from information_schema.routines where routine_schema='test';
create sql security invoker view v4i as select routine_name from information_schema.routines where routine_schema='test';
create sql security definer view v5d as select view_definition > '' from information_schema.views where table_name='v1d';
create sql security invoker view v5i as select view_definition > '' from information_schema.views where table_name='v1d';
connect foo,localhost,foo;
select * from v1d;
select * from v1i;
select * from v2d;
select * from v2i;
select * from v3d;
select * from v3i;
select * from v4d;
select * from v4i;
select * from v5d;
select * from v5i;
connection default;
select * from v1d;
select * from v1i;
select * from v2d;
select * from v2i;
select * from v3d;
select * from v3i;
select * from v4d;
select * from v4i;
select * from v5d;
select * from v5i;
disconnect foo;
drop view v1d, v1i, v2d, v2i, v3d, v3i, v4d, v4i, v5d, v5i;
drop user foo@localhost;
drop procedure rootonly;
3 changes: 2 additions & 1 deletion mysql-test/main/processlist.result
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ select command, time < 5 from information_schema.processlist where id != connect
command time < 5
Sleep 1
disconnect con1;
set debug_sync='reset';
connection default;
set debug_sync='reset';
End of 5.5 tests
#
# 10.1 tests
#
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/main/processlist.test
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ SET DEBUG_SYNC = 'now WAIT_FOR query_done';
select command, time < 5 from information_schema.processlist where id != connection_id();

disconnect con1;
set debug_sync='reset';

connection default;
set debug_sync='reset';

--echo End of 5.5 tests

--echo #
--echo # 10.1 tests
Expand Down
12 changes: 12 additions & 0 deletions mysql-test/main/processlist_notembedded.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
#
connect con1,localhost,root,,;
connection con1;
SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
connection default;
SET DEBUG_SYNC= 'now WAIT_FOR in_sync';
FOUND 1 /sleep \(30\)/ in MDEV-20466.text
disconnect con1;
SET DEBUG_SYNC = 'RESET';
End of 5.5 tests
34 changes: 34 additions & 0 deletions mysql-test/main/processlist_notembedded.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
source include/have_debug.inc;
source include/have_debug_sync.inc;
source include/not_embedded.inc;

--echo #
--echo # MDEV-20466: SHOW PROCESSLIST truncates query text on \0 bytes
--echo #

connect (con1,localhost,root,,);

connection con1;

let $q= `select CONCAT("SELECT user FROM mysql.user WHERE user ='some", CHAR(0), "' or sleep (30)")`;

SET DEBUG_SYNC= 'before_join_optimize SIGNAL in_sync';
--disable_query_log
--send_eval $q;
--enable_query_log
connection default;

SET DEBUG_SYNC= 'now WAIT_FOR in_sync';

exec $MYSQL test -e "SHOW PROCESSLIST" > $MYSQLTEST_VARDIR/tmp/MDEV-20466.text;

let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/MDEV-20466.text;
let SEARCH_PATTERN=sleep \(30\);
source include/search_pattern_in_file.inc;
remove_file $MYSQLTEST_VARDIR/tmp/MDEV-20466.text;

disconnect con1;

SET DEBUG_SYNC = 'RESET';

--echo End of 5.5 tests
26 changes: 26 additions & 0 deletions mysql-test/main/subselect_sj.result
Original file line number Diff line number Diff line change
Expand Up @@ -3259,6 +3259,32 @@ create table t1 (a1 varchar(25));
create table t2 (a2 varchar(25)) ;
insert into t1 select 'xxx' from dual where 'xxx' in (select a2 from t2);
drop table t1,t2;
#
# MDEV-13172: Wrong result / SELECT ... WHERE EXISTS ... (with UNIQUE Key)
#
CREATE TABLE `t1` (
`Id` int(11) NOT NULL,
PRIMARY KEY (`Id`)
);
INSERT INTO `t1` (`Id`) VALUES (1);
CREATE TABLE `t2` (
`t1_Id` int(11) NOT NULL DEFAULT 0,
`col1` int(11) DEFAULT NULL,
UNIQUE KEY `col1` (`col1`)
);
INSERT INTO `t2` (`t1_Id`, `col1`) VALUES (1, NULL), (1, NULL);
SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
Id
1
explain extended
SELECT Id FROM t1 WHERE Id in (SELECT t1_Id FROM t2 WHERE t2.col1 IS NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
2 MATERIALIZED t2 ref col1 col1 5 const 1 100.00 Using index condition; Using where
Warnings:
Note 1003 select 1 AS `Id` from (`test`.`t2`) where `test`.`t2`.`t1_Id` = 1 and `test`.`t2`.`col1` is null
DROP TABLE t1, t2;
# End of 5.5 test
#
# MDEV-20109: Optimizer ignores distinct key created for materialized
Expand Down
Loading

0 comments on commit 55b2281

Please sign in to comment.