summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <jan@hundin.mysql.fi>2004-08-19 11:37:46 +0300
committerunknown <jan@hundin.mysql.fi>2004-08-19 11:37:46 +0300
commit97699411aaaacec1b8b9c70eb9690f20253f7178 (patch)
tree6f63c5ab6b2e7d7145839a127ef2d20350472b1d /innobase
parent15c3cbfd43cd76e2a9007de248f0105220a3df12 (diff)
parent13b0c809ec6b50ed1e910f34937179755f830fed (diff)
downloadmariadb-git-97699411aaaacec1b8b9c70eb9690f20253f7178.tar.gz
Merge jlindstrom@build.mysql.com:/home/bk/mysql-4.1
into hundin.mysql.fi:/home/jan/mysql-4.1 innobase/lock/lock0lock.c: Auto merged
Diffstat (limited to 'innobase')
-rw-r--r--innobase/buf/buf0flu.c53
-rw-r--r--innobase/dict/dict0crea.c1
-rw-r--r--innobase/dict/dict0dict.c1
-rw-r--r--innobase/include/dyn0dyn.h3
-rw-r--r--innobase/include/mtr0log.h3
-rw-r--r--innobase/include/mtr0log.ic3
-rw-r--r--innobase/include/os0file.h4
-rw-r--r--innobase/include/page0page.ic15
-rw-r--r--innobase/include/srv0srv.h2
-rw-r--r--innobase/include/srv0start.h6
-rw-r--r--innobase/include/ut0dbg.h34
-rw-r--r--innobase/lock/lock0lock.c1
-rw-r--r--innobase/os/os0file.c69
-rw-r--r--innobase/row/row0mysql.c24
-rw-r--r--innobase/row/row0sel.c9
-rw-r--r--innobase/srv/srv0srv.c3
-rw-r--r--innobase/srv/srv0start.c57
-rw-r--r--innobase/ut/ut0dbg.c7
-rw-r--r--innobase/ut/ut0mem.c6
19 files changed, 265 insertions, 36 deletions
diff --git a/innobase/buf/buf0flu.c b/innobase/buf/buf0flu.c
index cad51c224e2..964c396dd08 100644
--- a/innobase/buf/buf0flu.c
+++ b/innobase/buf/buf0flu.c
@@ -217,7 +217,9 @@ buf_flush_buffered_writes(void)
/*===========================*/
{
buf_block_t* block;
+ byte* write_buf;
ulint len;
+ ulint len2;
ulint i;
if (trx_doublewrite == NULL) {
@@ -244,6 +246,16 @@ buf_flush_buffered_writes(void)
block = trx_doublewrite->buf_block_arr[i];
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
+ if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
+ != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+" InnoDB: ERROR: The page to be written seems corrupt!\n"
+"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
+"InnoDB: before posting to the doublewrite buffer.\n");
+ }
+
if (block->check_index_page_at_flush
&& !page_simple_validate(block->frame)) {
@@ -272,6 +284,19 @@ buf_flush_buffered_writes(void)
trx_doublewrite->block1, 0, len,
(void*)trx_doublewrite->write_buf, NULL);
+ write_buf = trx_doublewrite->write_buf;
+
+ for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len; len2 += UNIV_PAGE_SIZE) {
+ if (mach_read_from_4(write_buf + len2 + FIL_PAGE_LSN + 4)
+ != mach_read_from_4(write_buf + len2 + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+" InnoDB: ERROR: The page to be written seems corrupt!\n"
+"InnoDB: The lsn fields do not match! Noticed in the doublewrite block1.\n");
+ }
+ }
+
if (trx_doublewrite->first_free > TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) {
len = (trx_doublewrite->first_free
- TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) * UNIV_PAGE_SIZE;
@@ -282,6 +307,22 @@ buf_flush_buffered_writes(void)
(void*)(trx_doublewrite->write_buf
+ TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE),
NULL);
+
+ write_buf = trx_doublewrite->write_buf
+ + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE;
+ for (len2 = 0; len2 + UNIV_PAGE_SIZE <= len;
+ len2 += UNIV_PAGE_SIZE) {
+ if (mach_read_from_4(write_buf + len2
+ + FIL_PAGE_LSN + 4)
+ != mach_read_from_4(write_buf + len2
+ + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+" InnoDB: ERROR: The page to be written seems corrupt!\n"
+"InnoDB: The lsn fields do not match! Noticed in the doublewrite block2.\n");
+ }
+ }
}
/* Now flush the doublewrite buffer data to disk */
@@ -295,6 +336,18 @@ buf_flush_buffered_writes(void)
for (i = 0; i < trx_doublewrite->first_free; i++) {
block = trx_doublewrite->buf_block_arr[i];
+ if (mach_read_from_4(block->frame + FIL_PAGE_LSN + 4)
+ != mach_read_from_4(block->frame + UNIV_PAGE_SIZE
+ - FIL_PAGE_END_LSN_OLD_CHKSUM + 4)) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+" InnoDB: ERROR: The page to be written seems corrupt!\n"
+"InnoDB: The lsn fields do not match! Noticed in the buffer pool\n"
+"InnoDB: after posting and flushing the doublewrite buffer.\n"
+"InnoDB: Page buf fix count %lu, io fix %lu, state %lu\n",
+ (ulong)block->buf_fix_count, (ulong)block->io_fix,
+ (ulong)block->state);
+ }
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER,
diff --git a/innobase/dict/dict0crea.c b/innobase/dict/dict0crea.c
index fd8e02585ae..1e4d906b7b5 100644
--- a/innobase/dict/dict0crea.c
+++ b/innobase/dict/dict0crea.c
@@ -32,6 +32,7 @@ static
dtuple_t*
dict_create_sys_tables_tuple(
/*=========================*/
+ /* out: the tuple which should be inserted */
dict_table_t* table, /* in: table */
mem_heap_t* heap) /* in: memory heap from which the memory for
the built tuple is allocated */
diff --git a/innobase/dict/dict0dict.c b/innobase/dict/dict0dict.c
index 71cf908db4e..eeefd7bf1ae 100644
--- a/innobase/dict/dict0dict.c
+++ b/innobase/dict/dict0dict.c
@@ -682,6 +682,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/dyn0dyn.h b/innobase/include/dyn0dyn.h
index 501fde05e90..abee62300e3 100644
--- a/innobase/include/dyn0dyn.h
+++ b/innobase/include/dyn0dyn.h
@@ -47,7 +47,8 @@ dyn_array_open(
/*===========*/
/* out: pointer to the buffer */
dyn_array_t* arr, /* in: dynamic array */
- ulint size); /* in: size in bytes of the buffer */
+ ulint size); /* in: size in bytes of the buffer; MUST be
+ smaller than DYN_ARRAY_DATA_SIZE! */
/*************************************************************************
Closes the buffer returned by dyn_array_open. */
UNIV_INLINE
diff --git a/innobase/include/mtr0log.h b/innobase/include/mtr0log.h
index 41be168a371..9c9c6f696e8 100644
--- a/innobase/include/mtr0log.h
+++ b/innobase/include/mtr0log.h
@@ -111,7 +111,8 @@ mlog_open(
/*======*/
/* out: buffer, NULL if log mode MTR_LOG_NONE */
mtr_t* mtr, /* in: mtr */
- ulint size); /* in: buffer size in bytes */
+ ulint size); /* in: buffer size in bytes; MUST be
+ smaller than DYN_ARRAY_DATA_SIZE! */
/************************************************************
Closes a buffer opened to mlog. */
UNIV_INLINE
diff --git a/innobase/include/mtr0log.ic b/innobase/include/mtr0log.ic
index aa3f945c202..08d9a6448eb 100644
--- a/innobase/include/mtr0log.ic
+++ b/innobase/include/mtr0log.ic
@@ -18,7 +18,8 @@ mlog_open(
/*======*/
/* out: buffer, NULL if log mode MTR_LOG_NONE */
mtr_t* mtr, /* in: mtr */
- ulint size) /* in: buffer size in bytes */
+ ulint size) /* in: buffer size in bytes; MUST be
+ smaller than DYN_ARRAY_DATA_SIZE! */
{
dyn_array_t* mlog;
diff --git a/innobase/include/os0file.h b/innobase/include/os0file.h
index 6549a3748df..f1647c47bce 100644
--- a/innobase/include/os0file.h
+++ b/innobase/include/os0file.h
@@ -169,12 +169,12 @@ void
os_io_init_simple(void);
/*===================*/
/***************************************************************************
-Creates a temporary file. In case of error, causes abnormal termination. */
+Creates a temporary file. */
FILE*
os_file_create_tmpfile(void);
/*========================*/
- /* out: temporary file handle (never NULL) */
+ /* out: temporary file handle (never NULL) */
/***************************************************************************
The os_file_opendir() function opens a directory stream corresponding to the
directory named by the dirname argument. The directory stream is positioned
diff --git a/innobase/include/page0page.ic b/innobase/include/page0page.ic
index e7c0f8ee07c..3d2bf3b090e 100644
--- a/innobase/include/page0page.ic
+++ b/innobase/include/page0page.ic
@@ -479,7 +479,20 @@ page_rec_get_next(
offs = rec_get_next_offs(rec);
- ut_a(offs < UNIV_PAGE_SIZE);
+ if (offs >= UNIV_PAGE_SIZE) {
+ fprintf(stderr,
+"InnoDB: Next record offset is nonsensical %lu in record at offset %lu\n",
+ (ulong)offs, (ulong)(rec - page));
+ fprintf(stderr,
+"\nInnoDB: rec address %lx, first buffer frame %lx\n"
+"InnoDB: buffer pool high end %lx, buf fix count %lu\n",
+ (ulong)rec, (ulong)buf_pool->frame_zero,
+ (ulong)buf_pool->high_end,
+ (ulong)buf_block_align(rec)->buf_fix_count);
+ buf_page_print(page);
+
+ ut_a(0);
+ }
if (offs == 0) {
diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h
index caee374d2ef..2e42c2f5036 100644
--- a/innobase/include/srv0srv.h
+++ b/innobase/include/srv0srv.h
@@ -99,6 +99,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/include/srv0start.h b/innobase/include/srv0start.h
index 0074de537c3..75af1a212b4 100644
--- a/innobase/include/srv0start.h
+++ b/innobase/include/srv0start.h
@@ -64,15 +64,17 @@ innobase_start_or_create_for_mysql(void);
/* out: DB_SUCCESS or error code */
/********************************************************************
Shuts down the Innobase database. */
-
int
innobase_shutdown_for_mysql(void);
/*=============================*/
/* out: DB_SUCCESS or error code */
-
extern dulint srv_shutdown_lsn;
extern dulint srv_start_lsn;
+#ifdef __NETWARE__
+void set_panic_flag_for_netware(void);
+#endif
+
extern ulint srv_sizeof_trx_t_in_ha_innodb_cc;
extern ibool srv_is_being_started;
diff --git a/innobase/include/ut0dbg.h b/innobase/include/ut0dbg.h
index a155f68bd12..5f30a894874 100644
--- a/innobase/include/ut0dbg.h
+++ b/innobase/include/ut0dbg.h
@@ -22,7 +22,38 @@ extern ulint* ut_dbg_null_ptr;
extern const char* ut_dbg_msg_assert_fail;
extern const char* ut_dbg_msg_trap;
extern const char* ut_dbg_msg_stop;
-
+/* Have a graceful exit on NetWare rather than a segfault to avoid abends */
+#ifdef __NETWARE__
+extern ibool panic_shutdown;
+#define ut_a(EXPR) do {\
+ if (!((ulint)(EXPR) + ut_dbg_zero)) {\
+ ut_print_timestamp(stderr);\
+ fprintf(stderr, ut_dbg_msg_assert_fail,\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__,\
+ (ulint)__LINE__);\
+ fputs("InnoDB: Failing assertion: " #EXPR "\n", stderr);\
+ fputs(ut_dbg_msg_trap, stderr);\
+ ut_dbg_stop_threads = TRUE;\
+ if (ut_dbg_stop_threads) {\
+ fprintf(stderr, ut_dbg_msg_stop,\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
+ }\
+ if(!panic_shutdown){\
+ panic_shutdown = TRUE;\
+ innobase_shutdown_for_mysql();}\
+ exit(1);\
+ }\
+} while (0)
+#define ut_error do {\
+ ut_print_timestamp(stderr);\
+ fprintf(stderr, ut_dbg_msg_assert_fail,\
+ os_thread_pf(os_thread_get_curr_id()), __FILE__, (ulint)__LINE__);\
+ fprintf(stderr, ut_dbg_msg_trap);\
+ ut_dbg_stop_threads = TRUE;\
+ if(!panic_shutdown){panic_shutdown = TRUE;\
+ innobase_shutdown_for_mysql();}\
+} while (0)
+#else
#define ut_a(EXPR) do {\
if (!((ulint)(EXPR) + ut_dbg_zero)) {\
ut_print_timestamp(stderr);\
@@ -49,6 +80,7 @@ extern const char* ut_dbg_msg_stop;
ut_dbg_stop_threads = TRUE;\
if (*(ut_dbg_null_ptr)) ut_dbg_null_ptr = NULL;\
} while (0)
+#endif
#ifdef UNIV_DEBUG
#define ut_ad(EXPR) ut_a(EXPR)
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 0f2784e00bc..5705c8b0b3e 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 d5ca8f927c6..392580eb570 100644
--- a/innobase/os/os0file.c
+++ b/innobase/os/os0file.c
@@ -478,22 +478,72 @@ os_io_init_simple(void)
}
}
+#ifndef UNIV_HOTBACKUP
+/*************************************************************************
+Creates a temporary file. This function is defined in ha_innodb.cc. */
+
+int
+innobase_mysql_tmpfile(void);
+/*========================*/
+ /* out: temporary file descriptor, or < 0 on error */
+#endif /* !UNIV_HOTBACKUP */
+
/***************************************************************************
-Creates a temporary file. In case of error, causes abnormal termination. */
+Creates a temporary file. */
FILE*
os_file_create_tmpfile(void)
/*========================*/
- /* out: temporary file handle (never NULL) */
+ /* out: temporary file handle, or NULL on error */
{
- FILE* file = tmpfile();
- if (file == NULL) {
+ FILE* file = NULL;
+ int fd = -1;
+#ifdef UNIV_HOTBACKUP
+ int tries;
+ for (tries = 10; tries--; ) {
+ char* name = tempnam(fil_path_to_mysql_datadir, "ib");
+ if (!name) {
+ break;
+ }
+
+ fd = open(name,
+# ifdef __WIN__
+ O_SEQUENTIAL | O_SHORT_LIVED | O_TEMPORARY |
+# endif /* __WIN__ */
+ O_CREAT | O_EXCL | O_RDWR,
+ S_IREAD | S_IWRITE);
+ if (fd >= 0) {
+# ifndef __WIN__
+ unlink(name);
+# endif /* !__WIN__ */
+ free(name);
+ break;
+ }
+
ut_print_timestamp(stderr);
- fputs(" InnoDB: Error: unable to create temporary file\n",
- stderr);
- os_file_handle_error(NULL, "tmpfile");
- ut_error;
+ fprintf(stderr, " InnoDB: Warning: "
+ "unable to create temporary file %s, retrying\n",
+ name);
+ free(name);
+ }
+#else /* UNIV_HOTBACKUP */
+ fd = innobase_mysql_tmpfile();
+#endif /* UNIV_HOTBACKUP */
+
+ if (fd >= 0) {
+ file = fdopen(fd, "w+b");
+ }
+
+ if (!file) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: unable to create temporary file;"
+ " errno: %d\n", errno);
+ if (fd >= 0) {
+ close(fd);
+ }
}
+
return(file);
}
@@ -3623,6 +3673,9 @@ consecutive_loop:
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: ERROR: The page to be written seems corrupt!\n");
+ fprintf(stderr,
+"InnoDB: Writing a block of %lu bytes, currently writing at offset %lu\n",
+ (ulong)total_len, (ulong)len2);
buf_page_print(combined_buf + len2);
fprintf(stderr,
"InnoDB: ERROR: The page to be written seems corrupt!\n");
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index dfe7f070637..fd12759ad0a 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -3010,6 +3010,30 @@ row_rename_table_for_mysql(
NULL);
trx->error_state = DB_SUCCESS;
}
+ } else {
+ err = dict_load_foreigns(new_name);
+
+ if (err != DB_SUCCESS) {
+
+ ut_print_timestamp(stderr);
+
+ fputs(
+ " InnoDB: Error: in RENAME TABLE table ",
+ stderr);
+ ut_print_name(stderr, new_name);
+ fputs("\n"
+ "InnoDB: is referenced in foreign key constraints\n"
+ "InnoDB: which are not compatible with the new table definition.\n",
+ stderr);
+
+ ut_a(dict_table_rename_in_cache(table,
+ old_name, FALSE));
+
+ trx->error_state = DB_SUCCESS;
+ trx_general_rollback_for_mysql(trx, FALSE,
+ NULL);
+ trx->error_state = DB_SUCCESS;
+ }
}
}
funct_exit:
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index bf7f6f1fc3a..2c0092adc6e 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -3224,8 +3224,15 @@ rec_loop:
if (srv_force_recovery == 0 || moves_up == FALSE) {
ut_print_timestamp(stderr);
+ buf_page_print(buf_frame_align(rec));
fprintf(stderr,
-" InnoDB: Index corruption: rec offs %lu next offs %lu, page no %lu,\n"
+"\nInnoDB: rec address %lx, first buffer frame %lx\n"
+"InnoDB: buffer pool high end %lx, buf block fix count %lu\n",
+ (ulong)rec, (ulong)buf_pool->frame_zero,
+ (ulong)buf_pool->high_end,
+ (ulong)buf_block_align(rec)->buf_fix_count);
+ fprintf(stderr,
+"InnoDB: Index corruption: rec offs %lu next offs %lu, page no %lu,\n"
"InnoDB: ",
(ulong) (rec - buf_frame_align(rec)),
(ulong) next_offs,
diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c
index 813adbc0e43..389cd5b779d 100644
--- a/innobase/srv/srv0srv.c
+++ b/innobase/srv/srv0srv.c
@@ -242,6 +242,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 74dd23e4252..3d49a594924 100644
--- a/innobase/srv/srv0start.c
+++ b/innobase/srv/srv0start.c
@@ -1112,16 +1112,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 */
@@ -1177,6 +1185,7 @@ NetWare. */
for (i = 0; i < srv_n_file_io_threads; i++) {
n[i] = i;
+
os_thread_create(io_handler_thread, n + i, thread_ids + i);
}
@@ -1606,7 +1615,9 @@ innobase_shutdown_for_mysql(void)
/* out: DB_SUCCESS or error code */
{
ulint i;
-
+#ifdef __NETWARE__
+ extern ibool panic_shutdown;
+#endif
if (!srv_was_started) {
if (srv_is_being_started) {
ut_print_timestamp(stderr);
@@ -1623,8 +1634,11 @@ innobase_shutdown_for_mysql(void)
The step 1 is the real InnoDB shutdown. The remaining steps 2 - ...
just free data structures after the shutdown. */
+#ifdef __NETWARE__
+ if(!panic_shutdown)
+#endif
logs_empty_and_mark_files_at_shutdown();
-
+
if (srv_conc_n_threads != 0) {
fprintf(stderr,
"InnoDB: Warning: query counter shows %ld queries still\n"
@@ -1687,15 +1701,16 @@ 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);
/* 3. Free all InnoDB's own mutexes and the os_fast_mutexes inside
them */
-
sync_close();
/* 4. Free the os_conc_mutex and all os_events and os_mutexes */
@@ -1706,7 +1721,7 @@ innobase_shutdown_for_mysql(void)
/* 5. Free all allocated memory and the os_fast_mutex created in
ut0mem.c */
- ut_free_all_mem();
+ ut_free_all_mem();
if (os_thread_count != 0
|| os_event_count != 0
@@ -1736,3 +1751,11 @@ innobase_shutdown_for_mysql(void)
return((int) DB_SUCCESS);
}
+
+#ifdef __NETWARE__
+void set_panic_flag_for_netware()
+{
+ extern ibool panic_shutdown;
+ panic_shutdown = TRUE;
+}
+#endif
diff --git a/innobase/ut/ut0dbg.c b/innobase/ut/ut0dbg.c
index 65703ec1c86..2a0cfe1f13a 100644
--- a/innobase/ut/ut0dbg.c
+++ b/innobase/ut/ut0dbg.c
@@ -14,7 +14,12 @@ ulint ut_dbg_zero = 0;
/* If this is set to TRUE all threads will stop into the next assertion
and assert */
ibool ut_dbg_stop_threads = FALSE;
-
+#ifdef __NETWARE__
+ibool panic_shutdown = FALSE; /* This is set to TRUE when on NetWare there
+ happens an InnoDB assertion failure or other
+ fatal error condition that requires an
+ immediate shutdown. */
+#endif
/* Null pointer used to generate memory trap */
ulint* ut_dbg_null_ptr = NULL;
diff --git a/innobase/ut/ut0mem.c b/innobase/ut/ut0mem.c
index 9a591df9f77..09410e348c2 100644
--- a/innobase/ut/ut0mem.c
+++ b/innobase/ut/ut0mem.c
@@ -107,7 +107,13 @@ ut_malloc_low(
/* Make an intentional seg fault so that we get a stack
trace */
+ /* Intentional segfault on NetWare causes an abend. Avoid this
+ by graceful exit handling in ut_a(). */
+#if (!defined __NETWARE__)
if (*ut_mem_null_ptr) ut_mem_null_ptr = 0;
+#else
+ ut_a(0);
+#endif
}
if (set_to_zero) {