summaryrefslogtreecommitdiff
path: root/innobase/os
diff options
context:
space:
mode:
authorunknown <heikki@donna.mysql.fi>2001-08-04 19:36:14 +0300
committerunknown <heikki@donna.mysql.fi>2001-08-04 19:36:14 +0300
commitc67510f0939fbcad4f2f0efcc79272322d5ffa57 (patch)
treee6dc89cb458f496f2b93e907afb60d3cd886cc18 /innobase/os
parentee82985a98c2c302e54a81ef586ffc8a867a550c (diff)
downloadmariadb-git-c67510f0939fbcad4f2f0efcc79272322d5ffa57.tar.gz
srv0srv.h Support raw disk partitions as data files
srv0start.c Support raw disk partitions as data files srv0srv.c Support raw disk partitions as data files row0purge.c < 4 GB rows, doublewrite, hang fixes row0row.c < 4 GB rows, doublewrite, hang fixes row0sel.c < 4 GB rows, doublewrite, hang fixes row0uins.c < 4 GB rows, doublewrite, hang fixes row0umod.c < 4 GB rows, doublewrite, hang fixes row0undo.c < 4 GB rows, doublewrite, hang fixes row0upd.c < 4 GB rows, doublewrite, hang fixes srv0srv.c < 4 GB rows, doublewrite, hang fixes srv0start.c < 4 GB rows, doublewrite, hang fixes sync0rw.c < 4 GB rows, doublewrite, hang fixes sync0sync.c < 4 GB rows, doublewrite, hang fixes trx0purge.c < 4 GB rows, doublewrite, hang fixes trx0rec.c < 4 GB rows, doublewrite, hang fixes trx0sys.c < 4 GB rows, doublewrite, hang fixes btr0btr.c < 4 GB rows, doublewrite, hang fixes btr0cur.c < 4 GB rows, doublewrite, hang fixes buf0buf.c < 4 GB rows, doublewrite, hang fixes buf0flu.c < 4 GB rows, doublewrite, hang fixes buf0rea.c < 4 GB rows, doublewrite, hang fixes data0data.c < 4 GB rows, doublewrite, hang fixes fil0fil.c < 4 GB rows, doublewrite, hang fixes fsp0fsp.c < 4 GB rows, doublewrite, hang fixes ibuf0ibuf.c < 4 GB rows, doublewrite, hang fixes lock0lock.c < 4 GB rows, doublewrite, hang fixes log0log.c < 4 GB rows, doublewrite, hang fixes log0recv.c < 4 GB rows, doublewrite, hang fixes os0file.c < 4 GB rows, doublewrite, hang fixes page0cur.c < 4 GB rows, doublewrite, hang fixes pars0pars.c < 4 GB rows, doublewrite, hang fixes rem0cmp.c < 4 GB rows, doublewrite, hang fixes rem0rec.c < 4 GB rows, doublewrite, hang fixes row0ins.c < 4 GB rows, doublewrite, hang fixes row0mysql.c < 4 GB rows, doublewrite, hang fixes univ.i < 4 GB rows, doublewrite, hang fixes data0data.ic < 4 GB rows, doublewrite, hang fixes mach0data.ic < 4 GB rows, doublewrite, hang fixes rem0rec.ic < 4 GB rows, doublewrite, hang fixes row0upd.ic < 4 GB rows, doublewrite, hang fixes trx0rec.ic < 4 GB rows, doublewrite, hang fixes rem0cmp.h < 4 GB rows, doublewrite, hang fixes rem0rec.h < 4 GB rows, doublewrite, hang fixes row0ins.h < 4 GB rows, doublewrite, hang fixes row0mysql.h < 4 GB rows, doublewrite, hang fixes row0row.h < 4 GB rows, doublewrite, hang fixes row0upd.h < 4 GB rows, doublewrite, hang fixes srv0srv.h < 4 GB rows, doublewrite, hang fixes sync0sync.h < 4 GB rows, doublewrite, hang fixes trx0rec.h < 4 GB rows, doublewrite, hang fixes trx0sys.h < 4 GB rows, doublewrite, hang fixes trx0types.h < 4 GB rows, doublewrite, hang fixes trx0undo.h < 4 GB rows, doublewrite, hang fixes ut0dbg.h < 4 GB rows, doublewrite, hang fixes ut0ut.h < 4 GB rows, doublewrite, hang fixes btr0btr.h < 4 GB rows, doublewrite, hang fixes btr0cur.h < 4 GB rows, doublewrite, hang fixes buf0buf.h < 4 GB rows, doublewrite, hang fixes buf0flu.h < 4 GB rows, doublewrite, hang fixes data0data.h < 4 GB rows, doublewrite, hang fixes dict0mem.h < 4 GB rows, doublewrite, hang fixes fil0fil.h < 4 GB rows, doublewrite, hang fixes fsp0fsp.h < 4 GB rows, doublewrite, hang fixes os0file.h < 4 GB rows, doublewrite, hang fixes innobase/include/btr0btr.h: < 4 GB rows, doublewrite, hang fixes innobase/include/btr0cur.h: < 4 GB rows, doublewrite, hang fixes innobase/include/buf0buf.h: < 4 GB rows, doublewrite, hang fixes innobase/include/buf0flu.h: < 4 GB rows, doublewrite, hang fixes innobase/include/data0data.h: < 4 GB rows, doublewrite, hang fixes innobase/include/dict0mem.h: < 4 GB rows, doublewrite, hang fixes innobase/include/fil0fil.h: < 4 GB rows, doublewrite, hang fixes innobase/include/fsp0fsp.h: < 4 GB rows, doublewrite, hang fixes innobase/include/os0file.h: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0cmp.h: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0rec.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0ins.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0mysql.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0row.h: < 4 GB rows, doublewrite, hang fixes innobase/include/row0upd.h: < 4 GB rows, doublewrite, hang fixes innobase/include/sync0sync.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0rec.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0sys.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0types.h: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0undo.h: < 4 GB rows, doublewrite, hang fixes innobase/include/ut0dbg.h: < 4 GB rows, doublewrite, hang fixes innobase/include/ut0ut.h: < 4 GB rows, doublewrite, hang fixes innobase/include/data0data.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/mach0data.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/rem0rec.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/row0upd.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/trx0rec.ic: < 4 GB rows, doublewrite, hang fixes innobase/include/univ.i: < 4 GB rows, doublewrite, hang fixes innobase/btr/btr0btr.c: < 4 GB rows, doublewrite, hang fixes innobase/btr/btr0cur.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0buf.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0flu.c: < 4 GB rows, doublewrite, hang fixes innobase/buf/buf0rea.c: < 4 GB rows, doublewrite, hang fixes innobase/data/data0data.c: < 4 GB rows, doublewrite, hang fixes innobase/fil/fil0fil.c: < 4 GB rows, doublewrite, hang fixes innobase/fsp/fsp0fsp.c: < 4 GB rows, doublewrite, hang fixes innobase/ibuf/ibuf0ibuf.c: < 4 GB rows, doublewrite, hang fixes innobase/lock/lock0lock.c: < 4 GB rows, doublewrite, hang fixes innobase/log/log0log.c: < 4 GB rows, doublewrite, hang fixes innobase/log/log0recv.c: < 4 GB rows, doublewrite, hang fixes innobase/os/os0file.c: < 4 GB rows, doublewrite, hang fixes innobase/page/page0cur.c: < 4 GB rows, doublewrite, hang fixes innobase/pars/pars0pars.c: < 4 GB rows, doublewrite, hang fixes innobase/rem/rem0cmp.c: < 4 GB rows, doublewrite, hang fixes innobase/rem/rem0rec.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0ins.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0mysql.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0purge.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0row.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0sel.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0uins.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0umod.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0undo.c: < 4 GB rows, doublewrite, hang fixes innobase/row/row0upd.c: < 4 GB rows, doublewrite, hang fixes innobase/sync/sync0rw.c: < 4 GB rows, doublewrite, hang fixes innobase/sync/sync0sync.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0purge.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0rec.c: < 4 GB rows, doublewrite, hang fixes innobase/trx/trx0sys.c: < 4 GB rows, doublewrite, hang fixes innobase/srv/srv0srv.c: Support raw disk partitions as data files innobase/srv/srv0start.c: Support raw disk partitions as data files innobase/include/srv0srv.h: Support raw disk partitions as data files
Diffstat (limited to 'innobase/os')
-rw-r--r--innobase/os/os0file.c84
1 files changed, 61 insertions, 23 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c
index d3c6232031a..0525fd7b59a 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -10,6 +10,7 @@ Created 10/21/1995 Heikki Tuuri
#include "os0sync.h"
#include "ut0mem.h"
#include "srv0srv.h"
+#include "trx0sys.h"
#undef HAVE_FDATASYNC
@@ -74,9 +75,12 @@ typedef struct os_aio_array_struct os_aio_array_t;
struct os_aio_array_struct{
os_mutex_t mutex; /* the mutex protecting the aio array */
- os_event_t not_full; /* The event which is set to signaled
+ os_event_t not_full; /* The event which is set to the signaled
state when there is space in the aio
outside the ibuf segment */
+ os_event_t is_empty; /* The event which is set to the signaled
+ state when there are no pending i/os
+ in this array */
ulint n_slots; /* Total number of slots in the aio array.
This must be divisible by n_threads. */
ulint n_segments;/* Number of segments in the aio array of
@@ -254,6 +258,7 @@ os_file_create(
if a new is created or an old overwritten */
ulint purpose,/* in: OS_FILE_AIO, if asynchronous, non-buffered i/o
is desired, OS_FILE_NORMAL, if any normal file */
+ ulint type, /* in: OS_DATA_FILE or OS_LOG_FILE */
ibool* success)/* out: TRUE if succeed, FALSE if error */
{
#ifdef __WIN__
@@ -347,11 +352,10 @@ try_again:
UT_NOT_USED(purpose);
- /* Currently use only O_SYNC because there may be a bug in
- Linux O_DSYNC! */
-
#ifdef O_SYNC
- if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
+ if ((!srv_use_doublewrite_buf || type != OS_DATA_FILE)
+ && srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
+
create_flag = create_flag | O_SYNC;
}
#endif
@@ -551,12 +555,6 @@ os_file_flush(
#else
int ret;
-#ifdef O_DSYNC
- if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
- return(TRUE);
- }
-#endif
-
#ifdef HAVE_FDATASYNC
ret = fdatasync(file);
#else
@@ -637,7 +635,8 @@ os_file_pwrite(
ret = pwrite(file, buf, n, offs);
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
- && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
+ && !trx_doublewrite) {
/* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
@@ -666,7 +665,8 @@ os_file_pwrite(
ret = write(file, buf, n);
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
- && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
+ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
+ && !trx_doublewrite) {
/* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
@@ -825,7 +825,9 @@ try_again:
/* 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));
+ if (!trx_doublewrite) {
+ ut_a(TRUE == os_file_flush(file));
+ }
os_mutex_exit(os_file_seek_mutexes[i]);
@@ -900,6 +902,10 @@ os_aio_array_create(
array->mutex = os_mutex_create(NULL);
array->not_full = os_event_create(NULL);
+ array->is_empty = os_event_create(NULL);
+
+ os_event_set(array->is_empty);
+
array->n_slots = n;
array->n_segments = n_segments;
array->n_reserved = 0;
@@ -999,6 +1005,17 @@ os_aio_init(
#endif
}
+/****************************************************************************
+Waits until there are no pending writes in os_aio_write_array. There can
+be other, synchronous, pending writes. */
+
+void
+os_aio_wait_until_no_pending_writes(void)
+/*=====================================*/
+{
+ os_event_wait(os_aio_write_array->is_empty);
+}
+
/**************************************************************************
Calculates segment number for a slot. */
static
@@ -1191,6 +1208,10 @@ loop:
array->n_reserved++;
+ if (array->n_reserved == 1) {
+ os_event_reset(array->is_empty);
+ }
+
if (array->n_reserved == array->n_slots) {
os_event_reset(array->not_full);
}
@@ -1264,6 +1285,10 @@ os_aio_array_free_slot(
os_event_set(array->not_full);
}
+ if (array->n_reserved == 0) {
+ os_event_set(array->is_empty);
+ }
+
#ifdef WIN_ASYNC_IO
os_event_reset(slot->control.hEvent);
#endif
@@ -1377,6 +1402,7 @@ os_aio(
DWORD len = n;
void* dummy_mess1;
void* dummy_mess2;
+ ulint dummy_type;
#endif
ulint err = 0;
ibool retry;
@@ -1489,8 +1515,9 @@ try_again:
use the same wait mechanism as for async i/o */
return(os_aio_windows_handle(ULINT_UNDEFINED,
- slot->pos,
- &dummy_mess1, &dummy_mess2));
+ slot->pos,
+ &dummy_mess1, &dummy_mess2,
+ &dummy_type));
}
return(TRUE);
@@ -1547,7 +1574,8 @@ os_aio_windows_handle(
the aio operation failed, these output
parameters are valid and can be used to
restart the operation, for example */
- void** message2)
+ void** message2,
+ ulint* type) /* out: OS_FILE_WRITE or ..._READ */
{
os_aio_array_t* array;
os_aio_slot_t* slot;
@@ -1592,10 +1620,12 @@ os_aio_windows_handle(
*message1 = slot->message1;
*message2 = slot->message2;
+ *type = slot->type;
+
if (ret && len == slot->len) {
ret_val = TRUE;
- if (slot->type == OS_FILE_WRITE) {
+ if (slot->type == OS_FILE_WRITE && !trx_doublewrite) {
ut_a(TRUE == os_file_flush(slot->file));
}
} else {
@@ -1679,7 +1709,7 @@ os_aio_posix_handle(
*message1 = slot->message1;
*message2 = slot->message2;
- if (slot->type == OS_FILE_WRITE) {
+ if (slot->type == OS_FILE_WRITE && !trx_doublewrite) {
ut_a(TRUE == os_file_flush(slot->file));
}
@@ -1709,7 +1739,8 @@ os_aio_simulated_handle(
the aio operation failed, these output
parameters are valid and can be used to
restart the operation, for example */
- void** message2)
+ void** message2,
+ ulint* type) /* out: OS_FILE_WRITE or ..._READ */
{
os_aio_array_t* array;
ulint segment;
@@ -1906,6 +1937,8 @@ slot_io_done:
*message1 = slot->message1;
*message2 = slot->message2;
+ *type = slot->type;
+
os_mutex_exit(array->mutex);
os_aio_array_free_slot(array, slot);
@@ -1989,13 +2022,13 @@ os_aio_print(void)
os_aio_slot_t* slot;
ulint n_reserved;
ulint i;
-
+
+ printf("Pending normal aio reads:\n");
+
array = os_aio_read_array;
loop:
ut_a(array);
- printf("INFO OF AN AIO ARRAY\n");
-
os_mutex_enter(array->mutex);
ut_a(array->n_slots > 0);
@@ -2022,24 +2055,29 @@ loop:
os_mutex_exit(array->mutex);
if (array == os_aio_read_array) {
+ printf("Pending aio writes:\n");
+
array = os_aio_write_array;
goto loop;
}
if (array == os_aio_write_array) {
+ printf("Pending insert buffer aio reads:\n");
array = os_aio_ibuf_array;
goto loop;
}
if (array == os_aio_ibuf_array) {
+ printf("Pending log writes or reads:\n");
array = os_aio_log_array;
goto loop;
}
if (array == os_aio_log_array) {
+ printf("Pending synchronous reads or writes:\n");
array = os_aio_sync_array;
goto loop;