Skip to content

Commit 852d12b

Browse files
author
Bin Su
committed
Merge branch 'mysql-5.5' into mysql-5.6
Conflicts: storage/innobase/os/os0file.c
2 parents 5b6041b + b4daac2 commit 852d12b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

storage/innobase/os/os0file.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,7 @@ os_file_create_simple_no_error_handling_func(
13801380
*success = (file != INVALID_HANDLE_VALUE);
13811381
#else /* __WIN__ */
13821382
int create_flag;
1383+
const char* mode_str = NULL;
13831384

13841385
ut_a(name);
13851386

@@ -1388,6 +1389,8 @@ os_file_create_simple_no_error_handling_func(
13881389

13891390
if (create_mode == OS_FILE_OPEN) {
13901391

1392+
mode_str = "OPEN";
1393+
13911394
if (access_type == OS_FILE_READ_ONLY) {
13921395

13931396
create_flag = O_RDONLY;
@@ -1406,10 +1409,14 @@ os_file_create_simple_no_error_handling_func(
14061409

14071410
} else if (srv_read_only_mode) {
14081411

1412+
mode_str = "OPEN";
1413+
14091414
create_flag = O_RDONLY;
14101415

14111416
} else if (create_mode == OS_FILE_CREATE) {
14121417

1418+
mode_str = "CREATE";
1419+
14131420
create_flag = O_RDWR | O_CREAT | O_EXCL;
14141421

14151422
} else {
@@ -1424,6 +1431,17 @@ os_file_create_simple_no_error_handling_func(
14241431

14251432
*success = file == -1 ? FALSE : TRUE;
14261433

1434+
/* This function is always called for data files, we should disable
1435+
OS caching (O_DIRECT) here as we do in os_file_create_func(), so
1436+
we open the same file in the same mode, see man page of open(2). */
1437+
if (!srv_read_only_mode
1438+
&& *success
1439+
&& (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT
1440+
|| srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) {
1441+
1442+
os_file_set_nocache(file, name, mode_str);
1443+
}
1444+
14271445
#ifdef USE_FILE_LOCK
14281446
if (!srv_read_only_mode
14291447
&& *success

0 commit comments

Comments
 (0)