diff options
author | marko@hundin.mysql.fi <> | 2004-08-06 15:55:50 +0300 |
---|---|---|
committer | marko@hundin.mysql.fi <> | 2004-08-06 15:55:50 +0300 |
commit | 3cb09c98176c794328e209996a26f13f6bc2010e (patch) | |
tree | c1d7d9cd3e693926714ec72a5dba2d8ea59dde2d /innobase | |
parent | 1097805cf2bdf833f7d07886c7a35b9af54ba068 (diff) | |
download | mariadb-git-3cb09c98176c794328e209996a26f13f6bc2010e.tar.gz |
InnoDB: Add option for disabling innodb_status.<pid> files.
InnoDB: Implement tmpfile() differently on Windows (Bug #3998)
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/dict/dict0dict.c | 1 | ||||
-rw-r--r-- | innobase/include/os0file.h | 2 | ||||
-rw-r--r-- | innobase/include/srv0srv.h | 2 | ||||
-rw-r--r-- | innobase/lock/lock0lock.c | 1 | ||||
-rw-r--r-- | innobase/os/os0file.c | 25 | ||||
-rw-r--r-- | innobase/srv/srv0srv.c | 3 | ||||
-rw-r--r-- | innobase/srv/srv0start.c | 34 |
7 files changed, 51 insertions, 17 deletions
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c index e2c2043db74..ccaa5720c20 100644 --- a/innobase/dict/dict0dict.c +++ b/innobase/dict/dict0dict.c @@ -643,6 +643,7 @@ dict_init(void) rw_lock_set_level(&dict_operation_lock, SYNC_DICT_OPERATION); dict_foreign_err_file = os_file_create_tmpfile(); + ut_a(dict_foreign_err_file); mutex_create(&dict_foreign_err_mutex); mutex_set_level(&dict_foreign_err_mutex, SYNC_ANY_LATCH); } diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h index 43741f79855..4a8b9623eeb 100644 --- a/innobase/include/os0file.h +++ b/innobase/include/os0file.h @@ -139,7 +139,7 @@ Creates a temporary file. In case of error, causes abnormal termination. */ FILE* os_file_create_tmpfile(void); /*========================*/ - /* out: temporary file handle (never NULL) */ + /* out: temporary file handle, or NULL */ /******************************************************************** A simple function to open or create a file. */ diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 0be13528fd7..57ca1f84f26 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -92,6 +92,8 @@ extern lint srv_conc_n_threads; extern ibool srv_fast_shutdown; +extern ibool srv_innodb_status; + extern ibool srv_use_doublewrite_buf; extern ibool srv_set_thread_priorities; diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c index 68dd2aa18c1..1c9b1263130 100644 --- a/innobase/lock/lock0lock.c +++ b/innobase/lock/lock0lock.c @@ -509,6 +509,7 @@ lock_sys_create( /* hash_create_mutexes(lock_sys->rec_hash, 2, SYNC_REC_LOCK); */ lock_latest_err_file = os_file_create_tmpfile(); + ut_a(lock_latest_err_file); } /************************************************************************* diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index a70333ba6ab..c33066b1476 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -377,16 +377,33 @@ Creates a temporary file. In case of error, causes abnormal termination. */ FILE* os_file_create_tmpfile(void) /*========================*/ - /* out: temporary file handle (never NULL) */ + /* out: temporary file handle, or NULL */ { - FILE* file = tmpfile(); + FILE* file; +#ifdef __WIN__ + int fd = -1; + char* name; + file = NULL; + if (NULL == (name = tempnam(fil_path_to_mysql_datadir, "ib")) + || -1 == (fd = _open(name, _O_CREAT | _O_EXCL | _O_RDWR + | _O_SEQUENTIAL | _O_SHORT_LIVED | _O_TEMPORARY)) + || NULL == (file = fdopen(fd, "w+b"))) { + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Error: unable to create" + " temporary file %s\n", name ? name : "name"); + if (fd != -1) { + _close(fd); + } + } + free(name); +#else /* __WIN__ */ + file = tmpfile(); if (file == NULL) { ut_print_timestamp(stderr); fputs(" InnoDB: Error: unable to create temporary file\n", stderr); - os_file_handle_error(NULL, "tmpfile"); - ut_error; } +#endif /* __WIN__ */ return(file); } diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index 174214f9efe..d799ada1e20 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -223,6 +223,9 @@ merge to completion before shutdown */ ibool srv_fast_shutdown = FALSE; +/* Generate a innodb_status.<pid> file */ +ibool srv_innodb_status = FALSE; + ibool srv_use_doublewrite_buf = TRUE; ibool srv_set_thread_priorities = TRUE; diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 3223854652f..30c9982068e 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1023,16 +1023,24 @@ NetWare. */ mutex_create(&srv_monitor_file_mutex); mutex_set_level(&srv_monitor_file_mutex, SYNC_NO_ORDER_CHECK); - srv_monitor_file_name = mem_alloc( - strlen(fil_path_to_mysql_datadir) + - 20 + sizeof "/innodb_status."); - sprintf(srv_monitor_file_name, "%s/innodb_status.%lu", - fil_path_to_mysql_datadir, os_proc_get_number()); - srv_monitor_file = fopen(srv_monitor_file_name, "w+"); - if (!srv_monitor_file) { - fprintf(stderr, "InnoDB: unable to create %s: %s\n", - srv_monitor_file_name, strerror(errno)); - return(DB_ERROR); + if (srv_innodb_status) { + srv_monitor_file_name = mem_alloc( + strlen(fil_path_to_mysql_datadir) + + 20 + sizeof "/innodb_status."); + sprintf(srv_monitor_file_name, "%s/innodb_status.%lu", + fil_path_to_mysql_datadir, os_proc_get_number()); + srv_monitor_file = fopen(srv_monitor_file_name, "w+"); + if (!srv_monitor_file) { + fprintf(stderr, "InnoDB: unable to create %s: %s\n", + srv_monitor_file_name, strerror(errno)); + return(DB_ERROR); + } + } else { + srv_monitor_file_name = NULL; + srv_monitor_file = os_file_create_tmpfile(); + if (!srv_monitor_file) { + return(DB_ERROR); + } } /* Restrict the maximum number of file i/o threads */ @@ -1527,8 +1535,10 @@ innobase_shutdown_for_mysql(void) if (srv_monitor_file) { fclose(srv_monitor_file); srv_monitor_file = 0; - unlink(srv_monitor_file_name); - mem_free(srv_monitor_file_name); + if (srv_monitor_file_name) { + unlink(srv_monitor_file_name); + mem_free(srv_monitor_file_name); + } } mutex_free(&srv_monitor_file_mutex); |