Skip to content

Commit 1acfa94

Browse files
committed
Merge branch '5.5' into 10.0
2 parents cc413ce + 5a0fff5 commit 1acfa94

File tree

154 files changed

+3475
-1793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+3475
-1793
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ support-files/mysql.spec
214214
support-files/mysqld_multi.server
215215
support-files/wsrep.cnf
216216
support-files/wsrep_notify
217-
support-files/SELinux/centos6-mariadb.pp
217+
support-files/SELinux/mariadb.pp
218218
tags
219219
tests/async_queries
220220
tests/bug25714

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,9 @@ SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
348348

349349
# Common defines and includes
350350
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
351+
IF(_FILE_OFFSET_BITS)
352+
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
353+
ENDIF()
351354
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
352355

353356
# Add bundled or system zlib.

client/mysqldump.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,8 +698,9 @@ static void write_header(FILE *sql_file, char *db_name)
698698
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
699699
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
700700
MACHINE_TYPE);
701-
print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
702-
fix_for_comment(current_host ? current_host : "localhost"),
701+
print_comment(sql_file, 0, "-- Host: %s ",
702+
fix_for_comment(current_host ? current_host : "localhost"));
703+
print_comment(sql_file, 0, "Database: %s\n",
703704
fix_for_comment(db_name ? db_name : ""));
704705
print_comment(sql_file, 0,
705706
"-- ------------------------------------------------------\n"

config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@
484484
#cmakedefine _LARGE_FILES 1
485485
#cmakedefine _LARGEFILE_SOURCE 1
486486
#cmakedefine _LARGEFILE64_SOURCE 1
487-
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
488487

489488
#cmakedefine TIME_WITH_SYS_TIME 1
490489

include/my_sys.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ typedef struct my_aio_result {
6464
#define MY_FAE 8 /* Fatal if any error */
6565
#define MY_WME 16 /* Write message on error */
6666
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
67-
#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
68-
#define MY_UNUSED 64 /* Unused (was support for RAID) */
69-
#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
67+
#define MY_IGNORE_BADFD 32 /* my_sync(): ignore 'bad descriptor' errors */
68+
#define MY_NOSYMLINKS 512 /* my_open(): don't follow symlinks */
69+
#define MY_FULL_IO 512 /* my_read(): loop intil I/O is complete */
7070
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
7171
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
7272
#define MY_COPYTIME 64 /* my_redel() copys time */
@@ -253,7 +253,7 @@ extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
253253
extern ulong my_file_total_opened;
254254
extern ulong my_sync_count;
255255
extern uint mysys_usage_id;
256-
extern my_bool my_init_done;
256+
extern my_bool my_init_done, my_thr_key_mysys_exists;
257257
extern my_bool my_assert_on_error;
258258
extern myf my_global_flags; /* Set to MY_WME for more error messages */
259259
/* Point to current my_message() */
@@ -567,6 +567,7 @@ my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
567567
typedef uint32 ha_checksum;
568568
extern ulong my_crc_dbug_check;
569569

570+
extern int (*mysys_test_invalid_symlink)(const char *filename);
570571
#include <my_alloc.h>
571572

572573
/* Prototypes for mysys and my_func functions */
@@ -594,9 +595,11 @@ extern int my_realpath(char *to, const char *filename, myf MyFlags);
594595
extern File my_create_with_symlink(const char *linkname, const char *filename,
595596
int createflags, int access_flags,
596597
myf MyFlags);
597-
extern int my_delete_with_symlink(const char *name, myf MyFlags);
598598
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
599599
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
600+
extern int my_handler_delete_with_symlink(PSI_file_key key, const char *name,
601+
const char *ext, myf sync_dir);
602+
600603
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
601604
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
602605
myf MyFlags);

include/mysql/psi/mysql_file.h

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -441,20 +441,6 @@
441441
inline_mysql_file_create_with_symlink(P1, P2, P3, P4, P5)
442442
#endif
443443

444-
/**
445-
@def mysql_file_delete_with_symlink(K, P1, P2)
446-
Instrumented delete with symbolic link.
447-
@c mysql_file_delete_with_symlink is a replacement
448-
for @c my_delete_with_symlink.
449-
*/
450-
#ifdef HAVE_PSI_FILE_INTERFACE
451-
#define mysql_file_delete_with_symlink(K, P1, P2) \
452-
inline_mysql_file_delete_with_symlink(K, __FILE__, __LINE__, P1, P2)
453-
#else
454-
#define mysql_file_delete_with_symlink(K, P1, P2) \
455-
inline_mysql_file_delete_with_symlink(P1, P2)
456-
#endif
457-
458444
/**
459445
@def mysql_file_rename_with_symlink(K, P1, P2, P3)
460446
Instrumented rename with symbolic link.
@@ -1337,31 +1323,6 @@ inline_mysql_file_create_with_symlink(
13371323
return file;
13381324
}
13391325

1340-
static inline int
1341-
inline_mysql_file_delete_with_symlink(
1342-
#ifdef HAVE_PSI_FILE_INTERFACE
1343-
PSI_file_key key, const char *src_file, uint src_line,
1344-
#endif
1345-
const char *name, myf flags)
1346-
{
1347-
int result;
1348-
#ifdef HAVE_PSI_FILE_INTERFACE
1349-
struct PSI_file_locker *locker;
1350-
PSI_file_locker_state state;
1351-
locker= PSI_FILE_CALL(get_thread_file_name_locker)
1352-
(&state, key, PSI_FILE_DELETE, name, &locker);
1353-
if (likely(locker != NULL))
1354-
{
1355-
PSI_FILE_CALL(start_file_close_wait)(locker, src_file, src_line);
1356-
result= my_delete_with_symlink(name, flags);
1357-
PSI_FILE_CALL(end_file_close_wait)(locker, result);
1358-
return result;
1359-
}
1360-
#endif
1361-
1362-
result= my_delete_with_symlink(name, flags);
1363-
return result;
1364-
}
13651326

13661327
static inline int
13671328
inline_mysql_file_rename_with_symlink(

include/mysql/psi/psi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ enum PSI_file_operation
417417
PSI_FILE_FSTAT= 12,
418418
/** File chsize, as in @c my_chsize(). */
419419
PSI_FILE_CHSIZE= 13,
420-
/** File delete, such as @c my_delete() or @c my_delete_with_symlink(). */
420+
/** File delete, such as @c my_delete() or @c my_handler_delete_with_symlink(). */
421421
PSI_FILE_DELETE= 14,
422422
/** File rename, such as @c my_rename() or @c my_rename_with_symlink(). */
423423
PSI_FILE_RENAME= 15,

mysql-test/r/derived.result

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,4 +1014,27 @@ David Yes 210
10141014
Edward Yes 150
10151015
DROP TABLE example1463;
10161016
set sql_mode= @save_sql_mode;
1017+
#
1018+
# MDEV-9028: SELECT DISTINCT constant column of derived table
1019+
# used as the second operand of LEFT JOIN
1020+
#
1021+
create table t1 (id int, data varchar(255));
1022+
insert into t1 values (1,'yes'),(2,'yes');
1023+
select distinct t1.id, tt.id, tt.data
1024+
from t1
1025+
left join
1026+
(select t1.id, 'yes' as data from t1) as tt
1027+
on t1.id = tt.id;
1028+
id id data
1029+
1 1 yes
1030+
2 2 yes
1031+
select distinct t1.id, tt.id, tt.data
1032+
from t1
1033+
left join
1034+
(select t1.id, 'yes' as data from t1 where id > 1) as tt
1035+
on t1.id = tt.id;
1036+
id id data
1037+
2 2 yes
1038+
1 NULL NULL
1039+
drop table t1;
10171040
# end of 5.5

mysql-test/r/grant.result

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2526,6 +2526,54 @@ DROP USER mysqltest_u1@localhost;
25262526

25272527
# End of Bug#38347.
25282528

2529+
#
2530+
# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
2531+
# DIFFERENTLY'.
2532+
#
2533+
drop database if exists mysqltest_db1;
2534+
create database mysqltest_db1;
2535+
create user mysqltest_u1;
2536+
# Both GRANT statements below should fail with the same error.
2537+
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
2538+
ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
2539+
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
2540+
ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
2541+
# Let us show that GRANT behaviour for routines is consistent
2542+
# with GRANT behaviour for tables. Attempt to grant privilege
2543+
# on non-existent table also results in an error.
2544+
grant select on mysqltest_db1.t1 to mysqltest_u1;
2545+
ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
2546+
show grants for mysqltest_u1;
2547+
Grants for mysqltest_u1@%
2548+
GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
2549+
drop database mysqltest_db1;
2550+
drop user mysqltest_u1;
2551+
#
2552+
# Bug#12766319 - 61865: RENAME USER DOES NOT WORK CORRECTLY -
2553+
# REQUIRES FLUSH PRIVILEGES
2554+
#
2555+
CREATE USER foo@'127.0.0.1';
2556+
GRANT ALL ON *.* TO foo@'127.0.0.1';
2557+
# First attempt, should connect successfully
2558+
SELECT user(), current_user();
2559+
user() current_user()
2560+
foo@localhost foo@127.0.0.1
2561+
# Rename the user
2562+
RENAME USER foo@'127.0.0.1' to foo@'127.0.0.0/255.0.0.0';
2563+
# Second attempt, should connect successfully as its valid mask
2564+
# This was failing without fix
2565+
SELECT user(), current_user();
2566+
user() current_user()
2567+
foo@localhost foo@127.0.0.0/255.0.0.0
2568+
# Rename the user back to original
2569+
RENAME USER foo@'127.0.0.0/255.0.0.0' to foo@'127.0.0.1';
2570+
# Third attempt, should connect successfully
2571+
SELECT user(), current_user();
2572+
user() current_user()
2573+
foo@localhost foo@127.0.0.1
2574+
# Clean-up
2575+
DROP USER foo@'127.0.0.1';
2576+
# End of Bug#12766319
25292577
#
25302578
# Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS
25312579
# DATABASE SECURITY
@@ -2552,25 +2600,3 @@ ERROR 42000: Access denied for user 'untrusted'@'localhost' to database 'secret'
25522600
# Connection default
25532601
DROP USER untrusted@localhost;
25542602
DROP DATABASE secret;
2555-
#
2556-
# BUG#11759114 - '51401: GRANT TREATS NONEXISTENT FUNCTIONS/PRIVILEGES
2557-
# DIFFERENTLY'.
2558-
#
2559-
drop database if exists mysqltest_db1;
2560-
create database mysqltest_db1;
2561-
create user mysqltest_u1;
2562-
# Both GRANT statements below should fail with the same error.
2563-
grant execute on function mysqltest_db1.f1 to mysqltest_u1;
2564-
ERROR 42000: FUNCTION or PROCEDURE f1 does not exist
2565-
grant execute on procedure mysqltest_db1.p1 to mysqltest_u1;
2566-
ERROR 42000: FUNCTION or PROCEDURE p1 does not exist
2567-
# Let us show that GRANT behaviour for routines is consistent
2568-
# with GRANT behaviour for tables. Attempt to grant privilege
2569-
# on non-existent table also results in an error.
2570-
grant select on mysqltest_db1.t1 to mysqltest_u1;
2571-
ERROR 42S02: Table 'mysqltest_db1.t1' doesn't exist
2572-
show grants for mysqltest_u1;
2573-
Grants for mysqltest_u1@%
2574-
GRANT USAGE ON *.* TO 'mysqltest_u1'@'%'
2575-
drop database mysqltest_db1;
2576-
drop user mysqltest_u1;

mysql-test/r/join_nested.result

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,4 +1870,99 @@ f4
18701870
NULL
18711871
NULL
18721872
DROP TABLE t1,t2,t3,t4,t5;
1873+
#
1874+
# MDEV-7992: Nested left joins + 'not exists' optimization
1875+
#
1876+
CREATE TABLE t1(
1877+
K1 INT PRIMARY KEY,
1878+
Name VARCHAR(15)
1879+
);
1880+
INSERT INTO t1 VALUES
1881+
(1,'T1Row1'), (2,'T1Row2');
1882+
CREATE TABLE t2(
1883+
K2 INT PRIMARY KEY,
1884+
K1r INT,
1885+
rowTimestamp DATETIME,
1886+
Event VARCHAR(15)
1887+
);
1888+
INSERT INTO t2 VALUES
1889+
(1, 1, '2015-04-13 10:42:11' ,'T1Row1Event1'),
1890+
(2, 1, '2015-04-13 10:42:12' ,'T1Row1Event2'),
1891+
(3, 1, '2015-04-13 10:42:12' ,'T1Row1Event3');
1892+
SELECT t1a.*, t2a.*,
1893+
t2i.K2 AS K2B, t2i.K1r AS K1rB,
1894+
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
1895+
FROM
1896+
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
1897+
LEFT JOIN
1898+
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
1899+
ON (t1i.K1 = 1) AND
1900+
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
1901+
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
1902+
OR (t2i.K2 IS NULL))
1903+
WHERE
1904+
t2a.K1r = 1 AND t2i.K2 IS NULL;
1905+
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1906+
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
1907+
EXPLAIN EXTENDED SELECT t1a.*, t2a.*,
1908+
t2i.K2 AS K2B, t2i.K1r AS K1rB,
1909+
t2i.rowTimestamp AS rowTimestampB, t2i.Event AS EventB
1910+
FROM
1911+
t1 t1a JOIN t2 t2a ON t2a.K1r = t1a.K1
1912+
LEFT JOIN
1913+
( t1 t1i LEFT JOIN t2 t2i ON t2i.K1r = t1i.K1)
1914+
ON (t1i.K1 = 1) AND
1915+
(((t2i.K1r = t1a.K1 AND t2i.rowTimestamp > t2a.rowTimestamp ) OR
1916+
(t2i.rowTimestamp = t2a.rowTimestamp AND t2i.K2 > t2a.K2))
1917+
OR (t2i.K2 IS NULL))
1918+
WHERE
1919+
t2a.K1r = 1 AND t2i.K2 IS NULL;
1920+
id select_type table type possible_keys key key_len ref rows filtered Extra
1921+
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1922+
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1923+
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1924+
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
1925+
Warnings:
1926+
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`test`.`t2a`.`K2` AS `K2`,`test`.`t2a`.`K1r` AS `K1r`,`test`.`t2a`.`rowTimestamp` AS `rowTimestamp`,`test`.`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `test`.`t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `test`.`t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `test`.`t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`test`.`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
1927+
CREATE VIEW v1 AS
1928+
SELECT t2i.*
1929+
FROM t1 as t1i LEFT JOIN t2 as t2i ON t2i.K1r = t1i.K1
1930+
WHERE t1i.K1 = 1 ;
1931+
SELECT
1932+
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
1933+
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
1934+
FROM
1935+
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
1936+
LEFT JOIN
1937+
v1 as t2b
1938+
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
1939+
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
1940+
OR (t2b.K2 IS NULL)
1941+
WHERE
1942+
t1a.K1 = 1 AND
1943+
t2b.K2 IS NULL;
1944+
K1 Name K2 K1r rowTimestamp Event K2B K1rB rowTimestampB EventB
1945+
1 T1Row1 3 1 2015-04-13 10:42:12 T1Row1Event3 NULL NULL NULL NULL
1946+
EXPLAIN EXTENDED SELECT
1947+
t1a.*, t2a.*, t2b.K2 as K2B, t2b.K1r as K1rB,
1948+
t2b.rowTimestamp as rowTimestampB, t2b.Event as EventB
1949+
FROM
1950+
t1 as t1a JOIN t2 as t2a ON t2a.K1r = t1a.K1
1951+
LEFT JOIN
1952+
v1 as t2b
1953+
ON ((t2b.K1r = t1a.K1 AND t2b.rowTimestamp > t2a.rowTimestamp) OR
1954+
(t2b.rowTimestamp = t2a.rowTimestamp AND t2b.K2 > t2a.K2))
1955+
OR (t2b.K2 IS NULL)
1956+
WHERE
1957+
t1a.K1 = 1 AND
1958+
t2b.K2 IS NULL;
1959+
id select_type table type possible_keys key key_len ref rows filtered Extra
1960+
1 SIMPLE t1a const PRIMARY PRIMARY 4 const 1 100.00
1961+
1 SIMPLE t2a ALL NULL NULL NULL NULL 3 100.00 Using where
1962+
1 SIMPLE t1i const PRIMARY PRIMARY 4 const 1 100.00 Using index
1963+
1 SIMPLE t2i ALL NULL NULL NULL NULL 3 100.00 Using where; Not exists
1964+
Warnings:
1965+
Note 1003 select 1 AS `K1`,'T1Row1' AS `Name`,`t2a`.`K2` AS `K2`,`t2a`.`K1r` AS `K1r`,`t2a`.`rowTimestamp` AS `rowTimestamp`,`t2a`.`Event` AS `Event`,`test`.`t2i`.`K2` AS `K2B`,`test`.`t2i`.`K1r` AS `K1rB`,`test`.`t2i`.`rowTimestamp` AS `rowTimestampB`,`test`.`t2i`.`Event` AS `EventB` from `test`.`t1` `t1a` join `test`.`t2` `t2a` left join (`test`.`t1` `t1i` left join `test`.`t2` `t2i` on((`test`.`t2i`.`K1r` = 1))) on(((`test`.`t1i`.`K1` = 1) and (((`test`.`t2i`.`K1r` = 1) and (`test`.`t2i`.`rowTimestamp` > `t2a`.`rowTimestamp`)) or ((`test`.`t2i`.`rowTimestamp` = `t2a`.`rowTimestamp`) and (`test`.`t2i`.`K2` > `t2a`.`K2`)) or isnull(`test`.`t2i`.`K2`)))) where ((`t2a`.`K1r` = 1) and isnull(`test`.`t2i`.`K2`))
1966+
DROP VIEW v1;
1967+
DROP TABLE t1,t2;
18731968
set optimizer_search_depth= @tmp_mdev621;

0 commit comments

Comments
 (0)