--- lock0lock.c 2007-02-16 18:34:22.000000000 +0200 +++ lock0lock.c-25494 2007-02-16 18:37:04.000000000 +0200 @@ -3259,12 +3259,6 @@ *cost = *cost + 1; - if ((depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK) - || (*cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK)) { - - return(LOCK_VICTIM_IS_START); - } - lock = wait_lock; if (lock_get_type(wait_lock) == LOCK_REC) { @@ -3298,9 +3292,14 @@ lock_trx = lock->trx; - if (lock_trx == start) { + if (lock_trx == start + || depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK + || *cost > LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK) { + /* We came back to the recursion starting - point: a deadlock detected */ + point: a deadlock detected; or we have + searched the waits-for graph too long */ + FILE* ef = lock_latest_err_file; rewind(ef); @@ -3342,7 +3341,9 @@ } #ifdef UNIV_DEBUG if (lock_print_waits) { - fputs("Deadlock detected\n", stderr); + fputs( + "Deadlock detected or too long search\n", + stderr); } #endif /* UNIV_DEBUG */ if (ut_dulint_cmp(wait_lock->trx->undo_no, @@ -3353,7 +3354,17 @@ back it */ return(LOCK_VICTIM_IS_START); - } + } + + if (depth > LOCK_MAX_DEPTH_IN_DEADLOCK_CHECK + || *cost > + LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK) { + + fputs( +"TOO DEEP OR LONG SEARCH IN THE LOCK TABLE WAITS-FOR GRAPH\n", ef); + + return(LOCK_VICTIM_IS_START); + } lock_deadlock_found = TRUE;