From 7949ffc86aa4789a8c3fe886721db974d9914c79 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Oct 2004 15:58:47 +0300 Subject: InnoDB: tolerate system clock glitches a little better in the error monitor thread. (Bug #5898) innobase/include/sync0arr.h: sync_array_print_long_waits(): return error status innobase/srv/srv0srv.c: srv_error_monitor_thread(): Keep track on successive fatal timeouts, and crash the server only if the timeouts have been exceeded for several times in succession. innobase/sync/sync0arr.c: sync_array_print_long_waits(): return error status --- innobase/include/sync0arr.h | 4 +++- innobase/srv/srv0srv.c | 20 ++++++++++++++++---- innobase/sync/sync0arr.c | 15 +++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/innobase/include/sync0arr.h b/innobase/include/sync0arr.h index 4324f2d3f2c..73496a2ea84 100644 --- a/innobase/include/sync0arr.h +++ b/innobase/include/sync0arr.h @@ -97,9 +97,11 @@ sync_arr_wake_threads_if_sema_free(void); /************************************************************************** Prints warnings of long semaphore waits to stderr. */ -void +ibool sync_array_print_long_waits(void); /*=============================*/ + /* out: TRUE if fatal semaphore wait threshold + was exceeded */ /************************************************************************ Validates the integrity of the wait array. Checks that the number of reserved cells equals the count variable. */ diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index d799ada1e20..0643ab96c1d 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -1754,7 +1754,8 @@ srv_error_monitor_thread( /* in: a dummy parameter required by os_thread_create */ { - ulint cnt = 0; + /* number of successive fatal timeouts observed */ + ulint fatal_cnt = 0; #ifdef UNIV_DEBUG_THREAD_CREATION fprintf(stderr, "Error monitor thread starts, id %lu\n", @@ -1763,8 +1764,6 @@ srv_error_monitor_thread( loop: srv_error_monitor_active = TRUE; - cnt++; - os_thread_sleep(2000000); if (difftime(time(NULL), srv_last_monitor_time) > 60) { @@ -1774,7 +1773,20 @@ loop: srv_refresh_innodb_monitor_stats(); } - sync_array_print_long_waits(); + if (sync_array_print_long_waits()) { + fatal_cnt++; + if (fatal_cnt > 5) { + + fprintf(stderr, +"InnoDB: Error: semaphore wait has lasted > %lu seconds\n" +"InnoDB: We intentionally crash the server, because it appears to be hung.\n", + srv_fatal_semaphore_wait_threshold); + + ut_error; + } + } else { + fatal_cnt = 0; + } /* Flush stderr so that a database user gets the output to possible MySQL error file */ diff --git a/innobase/sync/sync0arr.c b/innobase/sync/sync0arr.c index 09ddfd1d309..a443d630425 100644 --- a/innobase/sync/sync0arr.c +++ b/innobase/sync/sync0arr.c @@ -889,15 +889,18 @@ sync_arr_wake_threads_if_sema_free(void) /************************************************************************** Prints warnings of long semaphore waits to stderr. */ -void +ibool sync_array_print_long_waits(void) /*=============================*/ + /* out: TRUE if fatal semaphore wait threshold + was exceeded */ { sync_cell_t* cell; ibool old_val; ibool noticed = FALSE; ulint i; ulint fatal_timeout = srv_fatal_semaphore_wait_threshold; + ibool fatal = FALSE; for (i = 0; i < sync_primary_wait_array->n_cells; i++) { @@ -914,13 +917,7 @@ sync_array_print_long_waits(void) if (cell->wait_object != NULL && difftime(time(NULL), cell->reservation_time) > fatal_timeout) { - - fprintf(stderr, -"InnoDB: Error: semaphore wait has lasted > %lu seconds\n" -"InnoDB: We intentionally crash the server, because it appears to be hung.\n", - fatal_timeout); - - ut_error; + fatal = TRUE; } } @@ -948,6 +945,8 @@ sync_array_print_long_waits(void) fprintf(stderr, "InnoDB: ###### Diagnostic info printed to the standard error stream\n"); } + + return(fatal); } /************************************************************************** -- cgit v1.2.1 From 66bdcf8439c3397856d028b13a6f0bb09769434d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 7 Oct 2004 20:30:30 +0300 Subject: Fixed Bug#5575, mysqlhotcopy is broken when using --noindices BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + scripts/mysqlhotcopy.sh | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 8f9c0f60122..8347685b9b2 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -47,6 +47,7 @@ igor@hundin.mysql.fi igor@rurik.mysql.com ingo@mysql.com jani@a80-186-24-72.elisa-laajakaista.fi +jani@a80-186-41-201.elisa-laajakaista.fi jani@dsl-jkl1657.dial.inet.fi jani@hynda.(none) jani@hynda.mysql.fi diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index b90ca4dc7c0..f9e29e33195 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -8,7 +8,7 @@ use File::Path; use DBI; use Sys::Hostname; use File::Copy; -use File::Temp; +use File::Temp qw(tempfile); =head1 NAME @@ -39,7 +39,7 @@ WARNING: THIS PROGRAM IS STILL IN BETA. Comments/patches welcome. # Documentation continued at end of file -my $VERSION = "1.21"; +my $VERSION = "1.22"; my $opt_tmpdir = $ENV{TMPDIR} || "/tmp"; @@ -654,8 +654,8 @@ sub copy_index } elsif ($opt{method} =~ /^scp\b/) { - my ($fh, $tmp)=tempfile('mysqlhotcopy-XXXXXX', DIR => $opt_tmpdir); - die "Can\'t create/open file in $opt_tmpdir\n"; + my ($fh, $tmp)= tempfile('mysqlhotcopy-XXXXXX', DIR => $opt_tmpdir) or + die "Can\'t create/open file in $opt_tmpdir\n"; if (syswrite($fh,$buff) != length($buff)) { die "Error when writing data to $tmp: $!\n"; -- cgit v1.2.1