summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-04-26 16:36:59 +0300
committerunknown <heikki@donna.mysql.fi>2001-04-26 16:36:59 +0300
commit26f9b9af380f411f4d5f6a23a228e0ab32e1bd92 (patch)
tree353ca7848bb2600d6acfe371191ca0df8fbf2d87 /innobase
parentd3eb9d52b86d8963366496558c97b1f81e9a2deb (diff)
downloadmariadb-git-26f9b9af380f411f4d5f6a23a228e0ab32e1bd92.tar.gz
os0file.c Always do fsync after a file write to reduce possibility of a partially written page in an OS crash
buf0rea.c Fixed a recovery hang associated with ibuf bitmap pages innobase/buf/buf0rea.c: Fixed a recovery hang associated with ibuf bitmap pages innobase/os/os0file.c: Always do fsync after a file write to reduce possibility of a partially written page in an OS crash
Diffstat (limited to 'innobase')
-rw-r--r--innobase/buf/buf0rea.c6
-rw-r--r--innobase/os/os0file.c32
2 files changed, 33 insertions, 5 deletions
diff --git a/innobase/buf/buf0rea.c b/innobase/buf/buf0rea.c
index 13e9ed0476b..644dd226a0e 100644
--- a/innobase/buf/buf0rea.c
+++ b/innobase/buf/buf0rea.c
@@ -73,11 +73,13 @@ buf_read_page_low(
sync = TRUE;
}
#endif
- if (trx_sys_hdr_page(space, offset)) {
+ if (ibuf_bitmap_page(offset) || trx_sys_hdr_page(space, offset)) {
/* Trx sys header is so low in the latching order that we play
safe and do not leave the i/o-completion to an asynchronous
- i/o-thread: */
+ i/o-thread. Ibuf bitmap pages must always be read with
+ syncronous i/o, to make sure they do not get involved in
+ thread deadlocks. */
sync = TRUE;
}
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index 804a63507ce..c2cedba5137 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -559,10 +559,18 @@ os_file_pwrite(
ulint n, /* in: number of bytes to write */
ulint offset) /* in: offset where to write */
{
+ ssize_t ret;
+
#ifdef HAVE_PWRITE
- return(pwrite(file, buf, n, (off_t) offset));
+ ret = pwrite(file, buf, n, (off_t) offset);
+
+ /* Always do fsync to reduce the probability that when the OS crashes,
+ a database page is only partially physically written to disk. */
+
+ ut_a(TRUE == os_file_flush(file));
+
+ return(ret);
#else
- ssize_t ret;
ulint i;
/* Protect the seek / write operation with a mutex */
@@ -580,6 +588,11 @@ os_file_pwrite(
ret = write(file, buf, n);
+ /* Always do fsync to reduce the probability that when the OS crashes,
+ a database page is only partially physically written to disk. */
+
+ ut_a(TRUE == os_file_flush(file));
+
os_mutex_exit(os_file_seek_mutexes[i]);
return(ret);
@@ -733,9 +746,14 @@ try_again:
}
ret = WriteFile(file, buf, n, &len, NULL);
+
+ /* Always do fsync to reduce the probability that when the OS crashes,
+ a database page is only partially physically written to disk. */
+
+ ut_a(TRUE == os_file_flush(file));
os_mutex_exit(os_file_seek_mutexes[i]);
-
+
if (ret && len == n) {
return(TRUE);
}
@@ -1497,6 +1515,10 @@ os_aio_windows_handle(
if (ret && len == slot->len) {
ret_val = TRUE;
+
+ if (slot->type == OS_FILE_WRITE) {
+ ut_a(TRUE == os_file_flush(slot->file));
+ }
} else {
err = GetLastError();
ut_error;
@@ -1578,6 +1600,10 @@ os_aio_posix_handle(
*message1 = slot->message1;
*message2 = slot->message2;
+ if (slot->type == OS_FILE_WRITE) {
+ ut_a(TRUE == os_file_flush(slot->file));
+ }
+
os_mutex_exit(array->mutex);
os_aio_array_free_slot(array, slot);