Commit 7b6fc58f authored by unknown's avatar unknown
Browse files

InnoDB: Increment the lock wait watchdog timeout during CHECK TABLE

(Bug #2694)


innobase/include/srv0srv.h:
  Add srv_fatal_semaphore_wait_threshold
innobase/include/sync0arr.h:
  Improve comment of sync_array_print_long_waits()
innobase/row/row0mysql.c:
  Lengthen the srv_fatal_semaphore_wait_threshold by 2 hours during
  CHECK TABLE
innobase/srv/srv0srv.c:
  Add srv_fatal_semaphore_wait_threshold
innobase/sync/sync0arr.c:
  Improve comment of sync_array_print_long_waits().
  Replace the fixed timeout of 600 seconds with
  srv_fatal_semaphore_wait_threshold.
parent 45485da7
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -149,6 +149,7 @@ extern ulint srv_test_n_mutexes;
extern	ulint	srv_test_array_size;

extern ulint	srv_activity_count;
extern ulint	srv_fatal_semaphore_wait_threshold;

extern mutex_t*	kernel_mutex_temp;/* mutex protecting the server, trx structs,
				query threads, and lock table: we allocate
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ void
sync_arr_wake_threads_if_sema_free(void);
/*====================================*/
/**************************************************************************
Prints warnings of long semaphore waits to stderr. Currently > 120 sec. */
Prints warnings of long semaphore waits to stderr. */

void
sync_array_print_long_waits(void);
+11 −1
Original line number Diff line number Diff line
@@ -2806,6 +2806,11 @@ row_check_table_for_mysql(

	prebuilt->trx->isolation_level = TRX_ISO_REPEATABLE_READ;

	/* Enlarge the fatal lock wait timeout during CHECK TABLE. */
	mutex_enter(&kernel_mutex);
	srv_fatal_semaphore_wait_threshold += 7200; /* 2 hours */
	mutex_exit(&kernel_mutex);

	index = dict_table_get_first_index(table);

	while (index != NULL) {
@@ -2853,6 +2858,11 @@ row_check_table_for_mysql(
		ret = DB_ERROR;
	}

	/* Restore the fatal lock wait timeout after CHECK TABLE. */
	mutex_enter(&kernel_mutex);
	srv_fatal_semaphore_wait_threshold -= 7200; /* 2 hours */
	mutex_exit(&kernel_mutex);

	prebuilt->trx->op_info = (char *) "";

	return(ret);
+3 −0
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ ibool srv_lower_case_table_names = FALSE;
in the server */
ulint	srv_activity_count	= 0;

/* The following is the maximum allowed duration of a lock wait. */
ulint	srv_fatal_semaphore_wait_threshold = 600;

ibool	srv_lock_timeout_and_monitor_active = FALSE;
ibool	srv_error_monitor_active = FALSE;

+7 −5
Original line number Diff line number Diff line
@@ -890,7 +890,7 @@ sync_arr_wake_threads_if_sema_free(void)
}

/**************************************************************************
Prints warnings of long semaphore waits to stderr. Currently > 120 sec. */
Prints warnings of long semaphore waits to stderr. */

void
sync_array_print_long_waits(void)
@@ -900,6 +900,7 @@ sync_array_print_long_waits(void)
        ibool		old_val;
	ibool		noticed = FALSE;
	ulint           i;
	ulint		fatal_timeout = srv_fatal_semaphore_wait_threshold;

        for (i = 0; i < sync_primary_wait_array->n_cells; i++) {

@@ -914,12 +915,13 @@ sync_array_print_long_waits(void)
                }

                if (cell->wait_object != NULL
		    && difftime(time(NULL), cell->reservation_time) > 600) {
		    && difftime(time(NULL), cell->reservation_time)
		    > fatal_timeout) {

			fputs(
"InnoDB: Error: semaphore wait has lasted > 600 seconds\n"
			fprintf(stderr,
"InnoDB: Error: semaphore wait has lasted > %lu seconds\n"
"InnoDB: We intentionally crash the server, because it appears to be hung.\n",
				stderr);
				fatal_timeout);

		    	ut_error;
                }