Commit b31f909d authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

Many files:

  Fix hang introduced by selective deadlock resolution
srv0srv.c, row0mysql.c:
  Fix hang introduced by selective deadlock resolution + corruption caused by lock timeout or sel deadl res in ON DELETE CASCADE
parent aa4e1658
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ que_thr_stop(
/**************************************************************************
Moves a thread from another state to the QUE_THR_RUNNING state. Increments
the n_active_thrs counters of the query graph and transaction. */

void
que_thr_move_to_run_state_for_mysql(
/*================================*/
@@ -125,14 +126,17 @@ que_thr_move_to_run_state_for_mysql(
/**************************************************************************
A patch for MySQL used to 'stop' a dummy query thread used in MySQL
select, when there is no error or lock wait. */

void
que_thr_stop_for_mysql_no_error(
/*============================*/
	que_thr_t*	thr,	/* in: query thread */
	trx_t*		trx);	/* in: transaction */
/**************************************************************************
A patch for MySQL used to 'stop' a dummy query thread used in MySQL
select. */
A patch for MySQL used to 'stop' a dummy query thread used in MySQL. The
query thread is stopped and made inactive, except in the case where
it was put to the lock wait state in lock0lock.c, but the lock has already
been granted or the transaction chosen as a victim in deadlock resolution. */

void
que_thr_stop_for_mysql(
+10 −1
Original line number Diff line number Diff line
@@ -429,7 +429,10 @@ struct trx_struct{
					MySQL */
	/*------------------------------*/
	ulint		error_state;	/* 0 if no error, otherwise error
					number */
					number; NOTE That ONLY the thread
					doing the transaction is allowed to
					set this field: this is NOT protected
					by the kernel mutex */
	void*		error_info;	/* if the error number indicates a
					duplicate key error, a pointer to
					the problematic index is stored here */
@@ -466,6 +469,12 @@ struct trx_struct{
					TRX_QUE_LOCK_WAIT, this points to
					the lock request, otherwise this is
					NULL */
	ibool		was_chosen_as_deadlock_victim;
					/* when the transaction decides to wait
					for a lock, this it sets this to FALSE;
					if another transaction chooses this
					transaction as a victim in deadlock
					resolution, it sets this to TRUE */
	time_t          wait_started;   /* lock wait started at this time */
	UT_LIST_BASE_NODE_T(que_thr_t)
			wait_thrs;	/* query threads belonging to this
+0 −1
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ Created 1/20/1994 Heikki Tuuri
#define ut0ut_h

#include "univ.i"
#include <string.h>
#include <time.h>
#ifndef MYSQL_SERVER
#include <ctype.h>
+4 −1
Original line number Diff line number Diff line
@@ -1727,6 +1727,7 @@ index->table_name);
	}

	trx->que_state = TRX_QUE_LOCK_WAIT;
	trx->was_chosen_as_deadlock_victim = FALSE;
	trx->wait_started = time(NULL);

	ut_a(que_thr_stop(thr));
@@ -3173,7 +3174,8 @@ lock_deadlock_recursive(
				err_buf += sprintf(err_buf,
				"*** WE ROLL BACK TRANSACTION (1)\n");
				
				wait_lock->trx->error_state = DB_DEADLOCK;
				wait_lock->trx->was_chosen_as_deadlock_victim
								= TRUE;
				
				lock_cancel_waiting_and_release(wait_lock);

@@ -3353,6 +3355,7 @@ table->name);
	}
	
	trx->que_state = TRX_QUE_LOCK_WAIT;
	trx->was_chosen_as_deadlock_victim = FALSE;
	trx->wait_started = time(NULL);

	ut_a(que_thr_stop(thr));
+2 −2
Original line number Diff line number Diff line
@@ -1654,8 +1654,8 @@ log_reset_first_header_and_checkpoint(
	lsn = ut_dulint_add(start, LOG_BLOCK_HDR_SIZE);

	/* Write the label of ibbackup --restore */
	sprintf((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, "ibbackup ");
	ut_sprintf_timestamp((char*) hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
	sprintf(hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP, "ibbackup ");
	ut_sprintf_timestamp(hdr_buf + LOG_FILE_WAS_CREATED_BY_HOT_BACKUP
						+ strlen("ibbackup "));
	buf = hdr_buf + LOG_CHECKPOINT_1;
	
Loading