Skip to content

Commit ad0c218

Browse files
committed
Merge 10.0 into 10.1
Also, implement MDEV-11027 a little differently from 5.5 and 10.0: recv_apply_hashed_log_recs(): Change the return type back to void (DB_SUCCESS was always returned). Report progress also via systemd using sd_notifyf().
2 parents bb4ef47 + 9fe92a9 commit ad0c218

File tree

338 files changed

+11297
-5856
lines changed

Some content is hidden

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

338 files changed

+11297
-5856
lines changed

CMakeLists.txt

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

329329
# Common defines and includes
330330
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
331+
IF(_FILE_OFFSET_BITS)
332+
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
333+
ENDIF()
331334
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/include)
332335

333336
# Add bundled or system zlib.

client/mysqldump.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,9 @@ static void write_header(FILE *sql_file, char *db_name)
700700
"-- MySQL dump %s Distrib %s, for %s (%s)\n--\n",
701701
DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE,
702702
MACHINE_TYPE);
703-
print_comment(sql_file, 0, "-- Host: %s Database: %s\n",
704-
fix_for_comment(current_host ? current_host : "localhost"),
703+
print_comment(sql_file, 0, "-- Host: %s ",
704+
fix_for_comment(current_host ? current_host : "localhost"));
705+
print_comment(sql_file, 0, "Database: %s\n",
705706
fix_for_comment(db_name ? db_name : ""));
706707
print_comment(sql_file, 0,
707708
"-- ------------------------------------------------------\n"

config.h.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,6 @@
492492
#cmakedefine _LARGE_FILES 1
493493
#cmakedefine _LARGEFILE_SOURCE 1
494494
#cmakedefine _LARGEFILE64_SOURCE 1
495-
#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
496495

497496
#cmakedefine TIME_WITH_SYS_TIME 1
498497

include/my_sys.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,10 @@ typedef struct my_aio_result {
6666
#define MY_FAE 8 /* Fatal if any error */
6767
#define MY_WME 16 /* Write message on error */
6868
#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
69-
#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
69+
#define MY_IGNORE_BADFD 32 /* my_sync(): ignore 'bad descriptor' errors */
7070
#define MY_ENCRYPT 64 /* Encrypt IO_CACHE temporary files */
71-
#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
71+
#define MY_NOSYMLINKS 512 /* my_open(): don't follow symlinks */
72+
#define MY_FULL_IO 512 /* my_read(): loop intil I/O is complete */
7273
#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
7374
#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
7475
#define MY_COPYTIME 64 /* my_redel() copys time */
@@ -261,7 +262,7 @@ extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
261262
extern ulong my_file_total_opened;
262263
extern ulong my_sync_count;
263264
extern uint mysys_usage_id;
264-
extern my_bool my_init_done;
265+
extern my_bool my_init_done, my_thr_key_mysys_exists;
265266
extern my_bool my_assert_on_error;
266267
extern myf my_global_flags; /* Set to MY_WME for more error messages */
267268
/* Point to current my_message() */
@@ -615,6 +616,7 @@ int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos);
615616

616617
typedef uint32 ha_checksum;
617618

619+
extern int (*mysys_test_invalid_symlink)(const char *filename);
618620
#include <my_alloc.h>
619621

620622
/* Prototypes for mysys and my_func functions */
@@ -642,9 +644,11 @@ extern int my_realpath(char *to, const char *filename, myf MyFlags);
642644
extern File my_create_with_symlink(const char *linkname, const char *filename,
643645
int createflags, int access_flags,
644646
myf MyFlags);
645-
extern int my_delete_with_symlink(const char *name, myf MyFlags);
646647
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
647648
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
649+
extern int my_handler_delete_with_symlink(PSI_file_key key, const char *name,
650+
const char *ext, myf sync_dir);
651+
648652
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
649653
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
650654
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,
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--source include/have_partition.inc
2+
--source include/gap_lock_error_init.inc
3+
4+
let $select_lock=for update;
5+
let $autocommit = 0;
6+
--source include/gap_lock_error_select.inc
7+
let $autocommit = 1;
8+
--source include/gap_lock_error_select.inc
9+
10+
let $select_lock=lock in share mode;
11+
let $autocommit = 0;
12+
--source include/gap_lock_error_select.inc
13+
let $autocommit = 1;
14+
--source include/gap_lock_error_select.inc
15+
16+
let $select_lock=;
17+
let $autocommit = 0;
18+
--source include/gap_lock_error_select.inc
19+
let $autocommit = 1;
20+
--source include/gap_lock_error_select.inc
21+
22+
let $autocommit = 0;
23+
--source include/gap_lock_error_update.inc
24+
let $autocommit = 1;
25+
--source include/gap_lock_error_update.inc
26+
27+
--source include/gap_lock_error_cleanup.inc
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
drop table gap1, gap2, gap3, gap4;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
eval CREATE TABLE gap1 (id1 INT, id2 INT, id3 INT, c1 INT, value INT,
2+
PRIMARY KEY (id1, id2, id3),
3+
INDEX i (c1)) ENGINE=$engine;
4+
CREATE TABLE gap2 like gap1;
5+
eval CREATE TABLE gap3 (id INT, value INT,
6+
PRIMARY KEY (id),
7+
UNIQUE KEY ui(value)) ENGINE=$engine;
8+
eval CREATE TABLE gap4 (id INT, value INT,
9+
PRIMARY KEY (id)) ENGINE=$engine
10+
PARTITION BY HASH(id) PARTITIONS 2;
11+
--disable_query_log
12+
let $max = 1000;
13+
let $i = 1;
14+
while ($i <= $max) {
15+
eval INSERT INTO gap1 (id1, id2, id3, c1, value)
16+
VALUES ($i div 2, $i div 10, $i, $i, $i);
17+
eval INSERT INTO gap2 (id1, id2, id3, c1, value)
18+
VALUES ($i div 2, $i div 10, $i, $i, $i);
19+
inc $i;
20+
}
21+
--enable_query_log
22+
23+
insert into gap3 values (1,1), (2,2),(3,3),(4,4),(5,5);
24+
insert into gap4 values (1,1), (2,2),(3,3),(4,4),(5,5);
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
eval set session autocommit=$autocommit;
2+
let $is_gaplock_target = `SELECT @@autocommit = 0 && '$select_lock' != '' && '$expect_gap_lock_errors' = 1`;
3+
4+
if ($is_gaplock_target)
5+
{
6+
# rnd_init
7+
--error ER_UNKNOWN_ERROR
8+
eval select * from gap1 limit 1 $select_lock;
9+
--error ER_UNKNOWN_ERROR
10+
eval select * from gap1 where value != 100 limit 1 $select_lock;
11+
# index_read_map
12+
--error ER_UNKNOWN_ERROR
13+
eval select * from gap1 where id1=1 $select_lock;
14+
--error ER_UNKNOWN_ERROR
15+
eval select * from gap1 where id1=1 and id2= 1 $select_lock;
16+
# read_range_first
17+
--error ER_UNKNOWN_ERROR
18+
eval select * from gap1 where id1=1 and id2= 1 and id3 != 1 $select_lock;
19+
--error ER_UNKNOWN_ERROR
20+
eval select * from gap1 where id1=1 and id2= 1 and id3
21+
between 1 and 3 $select_lock;
22+
--error ER_UNKNOWN_ERROR
23+
eval select * from gap1 where id1=1 and id2= 1 order by id3 asc
24+
limit 1 $select_lock;
25+
--error ER_UNKNOWN_ERROR
26+
eval select * from gap1 where id1=1 and id2= 1 order by id3 desc
27+
limit 1 $select_lock;
28+
# index_first
29+
--error ER_UNKNOWN_ERROR
30+
eval select * from gap1 order by id1 asc limit 1 $select_lock;
31+
--error ER_UNKNOWN_ERROR
32+
eval select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 $select_lock;
33+
# index_last
34+
--error ER_UNKNOWN_ERROR
35+
eval select * from gap1 order by id1 desc limit 1 $select_lock;
36+
--error ER_UNKNOWN_ERROR
37+
eval select * from gap1 order by id1 desc, id2 desc, id3 desc
38+
limit 1 $select_lock;
39+
# secondary index lookup
40+
--error ER_UNKNOWN_ERROR
41+
eval select * from gap1 force index(i) where c1=1 $select_lock;
42+
# unique index lookup, ensure no gap lock errors as this is effectively a
43+
# single point select that does not lock ranges or gaps of keys
44+
eval select * from gap3 force index(ui) where value=1 $select_lock;
45+
# primary key lookup, ensure no gap lock errors as these are effectively
46+
# single point selects that do not lock ranges or gaps of keys
47+
eval select * from gap1 where id1=1 and id2=1 and id3=1 $select_lock;
48+
eval select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) $select_lock;
49+
eval select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
50+
order by c1 $select_lock;
51+
eval select * from gap3 where id=1 $select_lock;
52+
eval select * from gap4 where id=1 $select_lock;
53+
eval select * from gap4 where id in (1, 2, 3) $select_lock;
54+
--error ER_UNKNOWN_ERROR
55+
eval select * from gap4 $select_lock;
56+
--error ER_UNKNOWN_ERROR
57+
eval select * from gap4 where id between 3 and 7 $select_lock;
58+
}
59+
60+
if (!$is_gaplock_target)
61+
{
62+
eval select * from gap1 limit 1 $select_lock;
63+
eval select * from gap1 where value != 100 limit 1 $select_lock;
64+
eval select * from gap1 where id1=1 $select_lock;
65+
eval select * from gap1 where id1=1 and id2= 1 $select_lock;
66+
eval select * from gap1 where id1=1 and id2= 1 and id3 != 1 $select_lock;
67+
eval select * from gap1 where id1=1 and id2= 1 and id3
68+
between 1 and 3 $select_lock;
69+
eval select * from gap1 where id1=1 and id2= 1 order by id3 asc
70+
limit 1 $select_lock;
71+
eval select * from gap1 where id1=1 and id2= 1 order by id3 desc
72+
limit 1 $select_lock;
73+
eval select * from gap1 order by id1 asc limit 1 $select_lock;
74+
eval select * from gap1 order by id1 asc, id2 asc, id3 asc limit 1 $select_lock;
75+
eval select * from gap1 order by id1 desc limit 1 $select_lock;
76+
eval select * from gap1 order by id1 desc, id2 desc, id3 desc
77+
limit 1 $select_lock;
78+
eval select * from gap1 force index(i) where c1=1 $select_lock;
79+
eval select * from gap3 force index(ui) where value=1 $select_lock;
80+
eval select * from gap1 where id1=1 and id2=1 and id3=1 $select_lock;
81+
eval select * from gap1 where id1=1 and id2=1 and id3 in (1, 2, 3) $select_lock;
82+
eval select * from gap1 where id1=1 and id2=1 and id3=1 and value=1
83+
order by c1 $select_lock;
84+
eval select * from gap3 where id=1 $select_lock;
85+
eval select * from gap4 where id=1 $select_lock;
86+
eval select * from gap4 where id in (1, 2, 3) $select_lock;
87+
eval select * from gap4 $select_lock;
88+
eval select * from gap4 where id between 3 and 7 $select_lock;
89+
}

0 commit comments

Comments
 (0)