mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
os0file.c Fixed an extraneous error message at the start of db, changed from O_SYNC back to fdatasync because extremely slow on Sun
innobase/os/os0file.c: Fixed an extraneous error message at the start of db, changed from O_SYNC back to fdatasync because extremely slow on Sun
This commit is contained in:
parent
1609fcd3b9
commit
8dada46395
1 changed files with 22 additions and 21 deletions
|
@ -120,9 +120,11 @@ os_file_get_last_error(void)
|
||||||
|
|
||||||
err = (ulint) GetLastError();
|
err = (ulint) GetLastError();
|
||||||
|
|
||||||
fprintf(stderr,
|
if (err != ERROR_FILE_EXISTS) {
|
||||||
|
fprintf(stderr,
|
||||||
"InnoDB: operating system error number %li in a file operation.\n",
|
"InnoDB: operating system error number %li in a file operation.\n",
|
||||||
(long) err);
|
(long) err);
|
||||||
|
}
|
||||||
|
|
||||||
if (err == ERROR_FILE_NOT_FOUND) {
|
if (err == ERROR_FILE_NOT_FOUND) {
|
||||||
return(OS_FILE_NOT_FOUND);
|
return(OS_FILE_NOT_FOUND);
|
||||||
|
@ -134,11 +136,13 @@ os_file_get_last_error(void)
|
||||||
return(100 + err);
|
return(100 + err);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf(stderr,
|
err = (ulint) errno;
|
||||||
|
|
||||||
|
if (err != EEXIST) {
|
||||||
|
fprintf(stderr,
|
||||||
"InnoDB: operating system error number %i in a file operation.\n",
|
"InnoDB: operating system error number %i in a file operation.\n",
|
||||||
errno);
|
errno);
|
||||||
|
}
|
||||||
err = (ulint) errno;
|
|
||||||
|
|
||||||
if (err == ENOSPC ) {
|
if (err == ENOSPC ) {
|
||||||
return(OS_FILE_DISK_FULL);
|
return(OS_FILE_DISK_FULL);
|
||||||
|
@ -310,12 +314,11 @@ try_again:
|
||||||
UT_NOT_USED(purpose);
|
UT_NOT_USED(purpose);
|
||||||
|
|
||||||
/* On Linux opening a file in the O_SYNC mode seems to be much
|
/* On Linux opening a file in the O_SYNC mode seems to be much
|
||||||
more efficient than calling an explicit fsync or fdatasync after
|
more efficient for small writes than calling an explicit fsync or
|
||||||
each write */
|
fdatasync after each write, but on Solaris O_SYNC and O_DSYNC is
|
||||||
|
extremely slow in large block writes to a big file. Therefore we
|
||||||
|
do not use these options, but use explicit fdatasync. */
|
||||||
|
|
||||||
#ifdef O_SYNC
|
|
||||||
create_flag = create_flag | O_SYNC;
|
|
||||||
#endif
|
|
||||||
if (create_mode == OS_FILE_CREATE) {
|
if (create_mode == OS_FILE_CREATE) {
|
||||||
file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP
|
file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP
|
||||||
| S_IWGRP | S_IROTH | S_IWOTH);
|
| S_IWGRP | S_IROTH | S_IWOTH);
|
||||||
|
@ -435,10 +438,13 @@ os_file_set_size(
|
||||||
byte* buf;
|
byte* buf;
|
||||||
|
|
||||||
try_again:
|
try_again:
|
||||||
buf = ut_malloc(UNIV_PAGE_SIZE * 64);
|
/* We use a very big 16 MB buffer in writing because Linux is
|
||||||
|
extremely slow in fdatasync on 1 MB writes */
|
||||||
|
|
||||||
|
buf = ut_malloc(UNIV_PAGE_SIZE * 1024);
|
||||||
|
|
||||||
/* Write buffer full of zeros */
|
/* Write buffer full of zeros */
|
||||||
for (i = 0; i < UNIV_PAGE_SIZE * 64; i++) {
|
for (i = 0; i < UNIV_PAGE_SIZE * 1024; i++) {
|
||||||
buf[i] = '\0';
|
buf[i] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,10 +456,10 @@ try_again:
|
||||||
UT_NOT_USED(size_high);
|
UT_NOT_USED(size_high);
|
||||||
#endif
|
#endif
|
||||||
while (offset < low) {
|
while (offset < low) {
|
||||||
if (low - offset < UNIV_PAGE_SIZE * 64) {
|
if (low - offset < UNIV_PAGE_SIZE * 1024) {
|
||||||
n_bytes = low - offset;
|
n_bytes = low - offset;
|
||||||
} else {
|
} else {
|
||||||
n_bytes = UNIV_PAGE_SIZE * 64;
|
n_bytes = UNIV_PAGE_SIZE * 1024;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = os_file_write(name, file, buf, offset, 0, n_bytes);
|
ret = os_file_write(name, file, buf, offset, 0, n_bytes);
|
||||||
|
@ -469,6 +475,8 @@ try_again:
|
||||||
|
|
||||||
ret = os_file_flush(file);
|
ret = os_file_flush(file);
|
||||||
|
|
||||||
|
fsync(file);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
@ -509,14 +517,7 @@ os_file_flush(
|
||||||
#else
|
#else
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#ifdef O_SYNC
|
#ifdef HAVE_FDATASYNC
|
||||||
/* We open all files with the O_SYNC option, which means there
|
|
||||||
should be no need for fsync or fdatasync. In practice such a need
|
|
||||||
may be because on a Linux Xeon computer "donna" the OS seemed to be
|
|
||||||
fooled to believe that 500 disk writes/second are possible. */
|
|
||||||
|
|
||||||
ret = 0;
|
|
||||||
#elif defined(HAVE_FDATASYNC)
|
|
||||||
ret = fdatasync(file);
|
ret = fdatasync(file);
|
||||||
#else
|
#else
|
||||||
ret = fsync(file);
|
ret = fsync(file);
|
||||||
|
|
Loading…
Reference in a new issue