summaryrefslogtreecommitdiff
path: root/innobase/srv
diff options
context:
space:
mode:
authorunknown <marko@hundin.mysql.fi>2005-01-13 16:15:14 +0200
committerunknown <marko@hundin.mysql.fi>2005-01-13 16:15:14 +0200
commit8dc27f1ef94d909f063dd2fa3cea2619eae74518 (patch)
tree659d860f58d0e5fb621683c5ec4620cf701ed34d /innobase/srv
parentb895e877724fdd1fe6735fd20a74ea439f486582 (diff)
downloadmariadb-git-8dc27f1ef94d909f063dd2fa3cea2619eae74518.tar.gz
InnoDB: Detect the availability of the Mac OS X fsync() work-around
at run-time, so that an executable compiled on Mac OS X 10.2 can be run on Mac OS X 10.2 (without the work-around) and Mac OS X 10.3 and later with the work-aroud enabled. innobase/include/srv0start.h: Mac OS X: Add srv_have_fullfsync innobase/os/os0file.c: os_file_flush(): Use F_FULLFSYNC on Mac OS X 10.3, but not on 10.2 innobase/srv/srv0start.c: innobase_start_or_create_for_mysql(): When compiled on OS X 10.2, detect if the binary is running on OS X 10.3 or later, and set srv_have_fullfsync accordingly.
Diffstat (limited to 'innobase/srv')
-rw-r--r--innobase/srv/srv0start.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c
index 7a61a885ef9..fe05f07df21 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -61,6 +61,11 @@ dulint srv_start_lsn;
/* Log sequence number at shutdown */
dulint srv_shutdown_lsn;
+#ifdef HAVE_DARWIN_THREADS
+# include <sys/utsname.h>
+ibool srv_have_fullfsync = FALSE;
+#endif
+
ibool srv_start_raw_disk_in_use = FALSE;
static ibool srv_start_has_been_called = FALSE;
@@ -935,6 +940,28 @@ innobase_start_or_create_for_mysql(void)
ulint i;
ibool srv_file_per_table_original_value = srv_file_per_table;
mtr_t mtr;
+#ifdef HAVE_DARWIN_THREADS
+# ifdef F_FULLFSYNC
+ /* This executable has been compiled on Mac OS X 10.3 or later.
+ Assume that F_FULLFSYNC is available at run-time. */
+ srv_have_fullfsync = TRUE;
+# else /* F_FULLFSYNC */
+ /* This executable has been compiled on Mac OS X 10.2
+ or earlier. Determine if the executable is running
+ on Mac OS X 10.3 or later. */
+ struct utsname utsname;
+ if (uname(&utsname)) {
+ fputs("InnoDB: cannot determine Mac OS X version!\n", stderr);
+ } else {
+ srv_have_fullfsync = strcmp(utsname.release, "7.") >= 0;
+ }
+ if (!srv_have_fullfsync) {
+ fputs(
+"InnoDB: On Mac OS X, fsync() may be broken on internal drives,\n"
+"InnoDB: making transactions unsafe!\n", stderr);
+ }
+# endif /* F_FULLFSYNC */
+#endif /* HAVE_DARWIN_THREADS */
if (sizeof(ulint) != sizeof(void*)) {
fprintf(stderr,