Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
093e2e4f
Commit
093e2e4f
authored
Nov 05, 2020
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "MDEV-18706 InnoDB locking code debug helpers"
This reverts commit
b8de3548
.
parent
4b9e6f48
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
80 additions
and
256 deletions
+80
-256
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+0
-1
storage/innobase/include/lock0lock.h
storage/innobase/include/lock0lock.h
+0
-24
storage/innobase/include/lock0priv.h
storage/innobase/include/lock0priv.h
+54
-19
storage/innobase/include/lock0priv.ic
storage/innobase/include/lock0priv.ic
+1
-13
storage/innobase/include/lock0types.h
storage/innobase/include/lock0types.h
+19
-139
storage/innobase/lock/lock0lock.cc
storage/innobase/lock/lock0lock.cc
+6
-23
storage/innobase/lock/lock0wait.cc
storage/innobase/lock/lock0wait.cc
+0
-2
storage/innobase/ut/ut0ut.cc
storage/innobase/ut/ut0ut.cc
+0
-35
No files found.
storage/innobase/handler/ha_innodb.cc
View file @
093e2e4f
...
@@ -19684,7 +19684,6 @@ wsrep_innobase_kill_one_trx(
...
@@ -19684,7 +19684,6 @@ wsrep_innobase_kill_one_trx(
if
(
wait_lock
)
{
if
(
wait_lock
)
{
WSREP_DEBUG
(
"canceling wait lock"
);
WSREP_DEBUG
(
"canceling wait lock"
);
DBUG_LOG
(
"ib_lock"
,
VICTIM
(
victim_trx
)
<<
*
wait_lock
);
victim_trx
->
lock
.
was_chosen_as_deadlock_victim
=
TRUE
;
victim_trx
->
lock
.
was_chosen_as_deadlock_victim
=
TRUE
;
lock_cancel_waiting_and_release
(
wait_lock
);
lock_cancel_waiting_and_release
(
wait_lock
);
}
}
...
...
storage/innobase/include/lock0lock.h
View file @
093e2e4f
...
@@ -1050,28 +1050,4 @@ lock_get_info(
...
@@ -1050,28 +1050,4 @@ lock_get_info(
#include "lock0lock.ic"
#include "lock0lock.ic"
/** The global output operator is overloaded to conveniently
print the lock_table_t object into the given output stream.
@param[in,out] out the output stream
@param[in] lock the table lock
@return the given output stream */
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
lock_table_t
&
lock
)
{
return
(
lock
.
print
(
out
));
}
/** The global output operator is overloaded to conveniently
print the ib_lock_t object into the given output stream.
@param[in,out] out the output stream
@param[in] lock the record lock
@return the given output stream */
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
ib_lock_t
&
lock
)
{
return
(
lock
.
print
(
out
));
}
#endif
#endif
storage/innobase/include/lock0priv.h
View file @
093e2e4f
...
@@ -48,21 +48,56 @@ those functions in lock/ */
...
@@ -48,21 +48,56 @@ those functions in lock/ */
inline
inline
std
::
ostream
&
lock_table_t
::
print
(
std
::
ostream
&
out
)
const
std
::
ostream
&
lock_table_t
::
print
(
std
::
ostream
&
out
)
const
{
{
out
<<
"[
"
<<
table
->
name
.
m_
name
<<
"]"
;
out
<<
"[
lock_table_t: name="
<<
table
->
name
<<
"]"
;
return
(
out
);
return
(
out
);
}
}
/** The global output operator is overloaded to conveniently
print the lock_table_t object into the given output stream.
@param[in,out] out the output stream
@param[in] lock the table lock
@return the given output stream */
inline
inline
std
::
ostream
&
std
::
ostream
&
ib_lock_t
::
print
(
std
::
ostream
&
out
)
const
operator
<<
(
std
::
ostream
&
out
,
const
lock_table_t
&
lock
)
{
{
out
<<
"[trx="
<<
trx
<<
"("
<<
trx
->
lock
.
trx_locks
.
count
return
(
lock
.
print
(
out
));
<<
":"
<<
trx
->
lock
.
table_locks
.
size
()
<<
"), "
;
}
if
(
index
)
{
out
<<
"index="
<<
index
<<
"("
/** Convert the member 'type_mode' into a human readable string.
<<
(
index
->
is_primary
()
?
"#"
:
index
->
name
())
<<
"), "
;
@return human readable string */
inline
std
::
string
ib_lock_t
::
type_mode_string
()
const
{
std
::
ostringstream
sout
;
sout
<<
type_string
();
sout
<<
" | "
<<
lock_mode_string
(
mode
());
if
(
is_record_not_gap
())
{
sout
<<
" | LOCK_REC_NOT_GAP"
;
}
if
(
is_waiting
())
{
sout
<<
" | LOCK_WAIT"
;
}
}
out
<<
"type_mode="
<<
type_mode
<<
"="
<<
type_mode_string
()
<<
" "
;
if
(
is_gap
())
{
sout
<<
" | LOCK_GAP"
;
}
if
(
is_insert_intention
())
{
sout
<<
" | LOCK_INSERT_INTENTION"
;
}
return
(
sout
.
str
());
}
inline
std
::
ostream
&
ib_lock_t
::
print
(
std
::
ostream
&
out
)
const
{
out
<<
"[lock_t: type_mode="
<<
type_mode
<<
"("
<<
type_mode_string
()
<<
")"
;
if
(
is_record_lock
())
{
if
(
is_record_lock
())
{
out
<<
un_member
.
rec_lock
;
out
<<
un_member
.
rec_lock
;
...
@@ -74,6 +109,17 @@ ib_lock_t::print(std::ostream& out) const
...
@@ -74,6 +109,17 @@ ib_lock_t::print(std::ostream& out) const
return
(
out
);
return
(
out
);
}
}
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
ib_lock_t
&
lock
)
{
return
(
lock
.
print
(
out
));
}
#ifdef UNIV_DEBUG
extern
ibool
lock_print_waits
;
#endif
/* UNIV_DEBUG */
/** Restricts the length of search we will do in the waits-for
/** Restricts the length of search we will do in the waits-for
graph of transactions */
graph of transactions */
static
const
ulint
LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK
=
1000000
;
static
const
ulint
LOCK_MAX_N_STEPS_IN_DEADLOCK_CHECK
=
1000000
;
...
@@ -548,15 +594,6 @@ lock_rec_get_first(
...
@@ -548,15 +594,6 @@ lock_rec_get_first(
const
buf_block_t
*
block
,
/*!< in: block containing the record */
const
buf_block_t
*
block
,
/*!< in: block containing the record */
ulint
heap_no
);
/*!< in: heap number of the record */
ulint
heap_no
);
/*!< in: heap number of the record */
/*********************************************************************//**
Gets the mode from type_mode.
@return mode */
UNIV_INLINE
enum
lock_mode
lock_get_mode
(
/*==========*/
const
ib_uint32_t
type_mode
);
/*********************************************************************//**
/*********************************************************************//**
Gets the mode of a lock.
Gets the mode of a lock.
@return mode */
@return mode */
...
@@ -634,7 +671,6 @@ inline void lock_set_lock_and_trx_wait(lock_t* lock, trx_t* trx)
...
@@ -634,7 +671,6 @@ inline void lock_set_lock_and_trx_wait(lock_t* lock, trx_t* trx)
trx
->
lock
.
wait_lock
=
lock
;
trx
->
lock
.
wait_lock
=
lock
;
lock
->
type_mode
|=
LOCK_WAIT
;
lock
->
type_mode
|=
LOCK_WAIT
;
DBUG_LOG
(
"ib_lock"
,
"+WAIT("
<<
lock
<<
") "
<<
*
lock
);
}
}
/** Reset the wait status of a lock.
/** Reset the wait status of a lock.
...
@@ -647,7 +683,6 @@ inline void lock_reset_lock_and_trx_wait(lock_t* lock)
...
@@ -647,7 +683,6 @@ inline void lock_reset_lock_and_trx_wait(lock_t* lock)
||
lock
->
trx
->
lock
.
wait_lock
==
lock
);
||
lock
->
trx
->
lock
.
wait_lock
==
lock
);
lock
->
trx
->
lock
.
wait_lock
=
NULL
;
lock
->
trx
->
lock
.
wait_lock
=
NULL
;
lock
->
type_mode
&=
~
LOCK_WAIT
;
lock
->
type_mode
&=
~
LOCK_WAIT
;
DBUG_LOG
(
"ib_lock"
,
"-WAIT("
<<
lock
<<
") "
<<
*
lock
);
}
}
inline
inline
...
...
storage/innobase/include/lock0priv.ic
View file @
093e2e4f
...
@@ -286,18 +286,6 @@ lock_rec_get_next_on_page_const(
...
@@ -286,18 +286,6 @@ lock_rec_get_next_on_page_const(
return
(
NULL
);
return
(
NULL
);
}
}
/*********************************************************************//**
Gets the mode from type_mode.
@return mode */
UNIV_INLINE
enum
lock_mode
lock_get_mode
(
/*==========*/
const
ib_uint32_t
type_mode
)
{
return
(
static_cast
<
enum
lock_mode
>
(
type_mode
&
LOCK_MODE_MASK
));
}
/*********************************************************************//**
/*********************************************************************//**
Gets the mode of a lock.
Gets the mode of a lock.
@return mode */
@return mode */
...
@@ -309,7 +297,7 @@ lock_get_mode(
...
@@ -309,7 +297,7 @@ lock_get_mode(
{
{
ut_ad
(
lock
);
ut_ad
(
lock
);
return
(
lock_get_mode
(
lock
->
type_mode
));
return
(
static_cast
<
enum
lock_mode
>
(
lock
->
type_mode
&
LOCK_MODE_MASK
));
}
}
/*********************************************************************//**
/*********************************************************************//**
...
...
storage/innobase/include/lock0types.h
View file @
093e2e4f
...
@@ -57,19 +57,19 @@ const char* lock_mode_string(enum lock_mode mode)
...
@@ -57,19 +57,19 @@ const char* lock_mode_string(enum lock_mode mode)
{
{
switch
(
mode
)
{
switch
(
mode
)
{
case
LOCK_IS
:
case
LOCK_IS
:
return
(
"IS"
);
return
(
"
LOCK_
IS"
);
case
LOCK_IX
:
case
LOCK_IX
:
return
(
"IX"
);
return
(
"
LOCK_
IX"
);
case
LOCK_S
:
case
LOCK_S
:
return
(
"S"
);
return
(
"
LOCK_
S"
);
case
LOCK_X
:
case
LOCK_X
:
return
(
"X"
);
return
(
"
LOCK_
X"
);
case
LOCK_AUTO_INC
:
case
LOCK_AUTO_INC
:
return
(
"AUTO_INC"
);
return
(
"
LOCK_
AUTO_INC"
);
case
LOCK_NONE
:
case
LOCK_NONE
:
return
(
"NONE"
);
return
(
"
LOCK_
NONE"
);
case
LOCK_NONE_UNSET
:
case
LOCK_NONE_UNSET
:
return
(
"NONE_UNSET"
);
return
(
"
LOCK_
NONE_UNSET"
);
default:
default:
ut_error
;
ut_error
;
}
}
...
@@ -109,7 +109,7 @@ struct lock_rec_t {
...
@@ -109,7 +109,7 @@ struct lock_rec_t {
inline
inline
std
::
ostream
&
lock_rec_t
::
print
(
std
::
ostream
&
out
)
const
std
::
ostream
&
lock_rec_t
::
print
(
std
::
ostream
&
out
)
const
{
{
out
<<
"[space="
<<
space
<<
", page_no="
<<
page_no
out
<<
"[
lock_rec_t:
space="
<<
space
<<
", page_no="
<<
page_no
<<
", n_bits="
<<
n_bits
<<
"]"
;
<<
", n_bits="
<<
n_bits
<<
"]"
;
return
(
out
);
return
(
out
);
}
}
...
@@ -176,51 +176,6 @@ operator<<(std::ostream& out, const lock_rec_t& lock)
...
@@ -176,51 +176,6 @@ operator<<(std::ostream& out, const lock_rec_t& lock)
#endif
#endif
/* @} */
/* @} */
inline
const
char
*
type_string
(
ulint
type_mode
)
{
switch
(
type_mode
&
LOCK_TYPE_MASK
)
{
case
LOCK_REC
:
return
(
"REC"
);
case
LOCK_TABLE
:
return
(
"TABLE"
);
default:
ut_error
;
}
}
/** Convert 'type_mode' into a human readable string.
@return human readable string */
inline
std
::
string
type_mode_string
(
ulint
type_mode
)
{
std
::
ostringstream
sout
;
lock_mode
mode
=
static_cast
<
enum
lock_mode
>
(
type_mode
&
LOCK_MODE_MASK
);
if
(
type_mode
&
LOCK_TYPE_MASK
)
{
sout
<<
type_string
(
type_mode
)
<<
"|"
;
}
sout
<<
lock_mode_string
(
mode
);
if
(
type_mode
&
LOCK_REC_NOT_GAP
)
{
sout
<<
"|REC_NOT_GAP"
;
}
if
(
type_mode
&
LOCK_WAIT
)
{
sout
<<
"|WAIT"
;
}
if
(
type_mode
&
LOCK_GAP
)
{
sout
<<
"|GAP"
;
}
if
(
type_mode
&
LOCK_INSERT_INTENTION
)
{
sout
<<
"|INSERT_INTENTION"
;
}
return
(
sout
.
str
());
}
/** Lock struct; protected by lock_sys->mutex */
/** Lock struct; protected by lock_sys->mutex */
struct
ib_lock_t
struct
ib_lock_t
{
{
...
@@ -299,98 +254,23 @@ struct ib_lock_t
...
@@ -299,98 +254,23 @@ struct ib_lock_t
@return the given output stream. */
@return the given output stream. */
std
::
ostream
&
print
(
std
::
ostream
&
out
)
const
;
std
::
ostream
&
print
(
std
::
ostream
&
out
)
const
;
std
::
string
type_mode_string
()
const
/** Convert the member 'type_mode' into a human readable string.
{
@return human readable string */
return
::
type_mode_string
(
type_mode
);
std
::
string
type_mode_string
()
const
;
}
const
char
*
type_string
()
const
const
char
*
type_string
()
const
{
{
return
::
type_string
(
type_mode
);
switch
(
type_mode
&
LOCK_TYPE_MASK
)
{
case
LOCK_REC
:
return
(
"LOCK_REC"
);
case
LOCK_TABLE
:
return
(
"LOCK_TABLE"
);
default:
ut_error
;
}
}
}
};
};
typedef
UT_LIST_BASE_NODE_T
(
ib_lock_t
)
trx_lock_list_t
;
typedef
UT_LIST_BASE_NODE_T
(
ib_lock_t
)
trx_lock_list_t
;
#ifndef DBUG_OFF
/* Classes used to catch various locking situations in code */
struct
ADD
/* add lock */
{
const
lock_t
*
lock
;
ADD
(
const
lock_t
*
l
)
:
lock
(
l
)
{
}
};
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
ADD
&
a
)
{
out
<<
"ADD("
<<
a
.
lock
<<
") "
;
return
out
;
}
struct
VICTIM
/* deadlock victim */
{
const
trx_t
*
trx
;
bool
set
;
VICTIM
(
const
trx_t
*
t
,
bool
s
=
true
)
:
trx
(
t
),
set
(
s
)
{
}
};
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
VICTIM
&
v
)
{
out
<<
(
v
.
set
?
'+'
:
'-'
)
<<
"VICTIM(trx="
<<
v
.
trx
<<
") "
;
return
out
;
}
struct
WEAKER
/* precise_mode is weaker than existing lock (of same trx) */
{
ulint
precise_mode
;
lock_t
*
lock
;
WEAKER
(
ulint
m
,
lock_t
*
l
)
:
precise_mode
(
m
),
lock
(
l
)
{
}
};
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
WEAKER
&
w
)
{
out
<<
"WEAKER("
<<
type_mode_string
(
w
.
precise_mode
)
<<
", "
<<
w
.
lock
<<
") "
;
w
.
lock
->
print
(
out
);
out
<<
" "
;
return
out
;
}
struct
CONFLICTS
/* precise_mode conflicts (or doesn't) with any existing locks */
{
const
trx_t
*
trx
;
ulint
precise_mode
;
const
lock_t
*
conflict
;
CONFLICTS
(
const
trx_t
*
t
,
ulint
m
,
const
lock_t
*
c
)
:
trx
(
t
),
precise_mode
(
m
),
conflict
(
c
)
{
}
};
inline
std
::
ostream
&
operator
<<
(
std
::
ostream
&
out
,
const
CONFLICTS
&
c
)
{
out
<<
(
c
.
conflict
?
"CONFLICTS(trx="
:
"NO_CONFLICTS(trx="
)
<<
c
.
trx
<<
", "
<<
type_mode_string
(
c
.
precise_mode
)
<<
", "
<<
c
.
conflict
<<
") "
;
if
(
c
.
conflict
)
{
c
.
conflict
->
print
(
out
);
out
<<
" "
;
}
return
out
;
}
#endif
/* !DBUG_OFF */
#endif
/* lock0types_h */
#endif
/* lock0types_h */
storage/innobase/lock/lock0lock.cc
View file @
093e2e4f
...
@@ -1004,7 +1004,6 @@ lock_rec_has_expl(
...
@@ -1004,7 +1004,6 @@ lock_rec_has_expl(
{
{
lock_t
*
lock
;
lock_t
*
lock
;
DBUG_ENTER
(
"lock_rec_has_expl"
);
ut_ad
(
lock_mutex_own
());
ut_ad
(
lock_mutex_own
());
ut_ad
((
precise_mode
&
LOCK_MODE_MASK
)
==
LOCK_S
ut_ad
((
precise_mode
&
LOCK_MODE_MASK
)
==
LOCK_S
||
(
precise_mode
&
LOCK_MODE_MASK
)
==
LOCK_X
);
||
(
precise_mode
&
LOCK_MODE_MASK
)
==
LOCK_X
);
...
@@ -1016,12 +1015,11 @@ lock_rec_has_expl(
...
@@ -1016,12 +1015,11 @@ lock_rec_has_expl(
if
(
lock
->
is_stronger
(
precise_mode
,
heap_no
,
trx
))
{
if
(
lock
->
is_stronger
(
precise_mode
,
heap_no
,
trx
))
{
DBUG_LOG
(
"ib_lock"
,
WEAKER
(
precise_mode
,
lock
));
return
(
lock
);
DBUG_RETURN
(
lock
);
}
}
}
}
DBUG_RETURN
(
NULL
);
return
(
NULL
);
}
}
#ifdef UNIV_DEBUG
#ifdef UNIV_DEBUG
...
@@ -1156,7 +1154,6 @@ lock_rec_other_has_conflicting(
...
@@ -1156,7 +1154,6 @@ lock_rec_other_has_conflicting(
lock_t
*
conflict
=
NULL
;
lock_t
*
conflict
=
NULL
;
bool
skip_waiting
=
false
;
bool
skip_waiting
=
false
;
DBUG_ENTER
(
"lock_rec_other_has_conflicting"
);
ut_ad
(
lock_mutex_own
());
ut_ad
(
lock_mutex_own
());
bool
is_supremum
=
(
heap_no
==
PAGE_HEAP_NO_SUPREMUM
);
bool
is_supremum
=
(
heap_no
==
PAGE_HEAP_NO_SUPREMUM
);
...
@@ -1172,10 +1169,7 @@ lock_rec_other_has_conflicting(
...
@@ -1172,10 +1169,7 @@ lock_rec_other_has_conflicting(
/* If current trx already acquired a lock not weaker covering
/* If current trx already acquired a lock not weaker covering
same types then we don't have to wait for any locks. */
same types then we don't have to wait for any locks. */
if
(
lock
->
is_stronger
(
mode
,
heap_no
,
trx
))
{
if
(
lock
->
is_stronger
(
mode
,
heap_no
,
trx
))
{
return
NULL
;
DBUG_LOG
(
"ib_lock"
,
CONFLICTS
(
trx
,
mode
,
NULL
)
<<
"because: "
<<
WEAKER
(
mode
,
lock
))
;
DBUG_RETURN
(
NULL
);
}
else
if
(
lock
->
trx
==
trx
&&
!
lock
->
is_waiting
())
{
}
else
if
(
lock
->
trx
==
trx
&&
!
lock
->
is_waiting
())
{
if
(
conflict
&&
conflict
->
is_waiting
())
{
if
(
conflict
&&
conflict
->
is_waiting
())
{
conflict
=
NULL
;
conflict
=
NULL
;
...
@@ -1203,8 +1197,7 @@ lock_rec_other_has_conflicting(
...
@@ -1203,8 +1197,7 @@ lock_rec_other_has_conflicting(
}
}
#endif
/* WITH_WSREP */
#endif
/* WITH_WSREP */
DBUG_LOG
(
"ib_lock"
,
CONFLICTS
(
trx
,
mode
,
conflict
));
return
conflict
;
DBUG_RETURN
(
conflict
);
}
}
/*********************************************************************//**
/*********************************************************************//**
...
@@ -1480,7 +1473,6 @@ lock_rec_create_low(
...
@@ -1480,7 +1473,6 @@ lock_rec_create_low(
lock
->
un_member
.
rec_lock
.
n_bits
=
8
;
lock
->
un_member
.
rec_lock
.
n_bits
=
8
;
}
}
lock_rec_bitmap_reset
(
lock
);
lock_rec_bitmap_reset
(
lock
);
DBUG_LOG
(
"ib_lock"
,
ADD
(
lock
)
<<
*
lock
);
lock_rec_set_nth_bit
(
lock
,
heap_no
);
lock_rec_set_nth_bit
(
lock
,
heap_no
);
index
->
table
->
n_rec_locks
++
;
index
->
table
->
n_rec_locks
++
;
ut_ad
(
index
->
table
->
get_ref_count
()
>
0
||
!
index
->
table
->
can_be_evicted
);
ut_ad
(
index
->
table
->
get_ref_count
()
>
0
||
!
index
->
table
->
can_be_evicted
);
...
@@ -1509,7 +1501,7 @@ lock_rec_create_low(
...
@@ -1509,7 +1501,7 @@ lock_rec_create_low(
*/
*/
trx_mutex_enter
(
c_lock
->
trx
);
trx_mutex_enter
(
c_lock
->
trx
);
if
(
c_lock
->
trx
->
lock
.
que_state
==
TRX_QUE_LOCK_WAIT
)
{
if
(
c_lock
->
trx
->
lock
.
que_state
==
TRX_QUE_LOCK_WAIT
)
{
DBUG_LOG
(
"ib_lock"
,
VICTIM
(
c_lock
->
trx
)
<<
*
c_lock
);
c_lock
->
trx
->
lock
.
was_chosen_as_deadlock_victim
=
TRUE
;
c_lock
->
trx
->
lock
.
was_chosen_as_deadlock_victim
=
TRUE
;
if
(
UNIV_UNLIKELY
(
wsrep_debug
))
{
if
(
UNIV_UNLIKELY
(
wsrep_debug
))
{
...
@@ -3657,7 +3649,6 @@ lock_table_create(
...
@@ -3657,7 +3649,6 @@ lock_table_create(
trx_mutex_enter
(
c_lock
->
trx
);
trx_mutex_enter
(
c_lock
->
trx
);
if
(
c_lock
->
trx
->
lock
.
que_state
==
TRX_QUE_LOCK_WAIT
)
{
if
(
c_lock
->
trx
->
lock
.
que_state
==
TRX_QUE_LOCK_WAIT
)
{
DBUG_LOG
(
"ib_lock"
,
VICTIM
(
c_lock
->
trx
)
<<
*
c_lock
);
c_lock
->
trx
->
lock
.
was_chosen_as_deadlock_victim
=
TRUE
;
c_lock
->
trx
->
lock
.
was_chosen_as_deadlock_victim
=
TRUE
;
if
(
UNIV_UNLIKELY
(
wsrep_debug
))
{
if
(
UNIV_UNLIKELY
(
wsrep_debug
))
{
...
@@ -3684,7 +3675,6 @@ lock_table_create(
...
@@ -3684,7 +3675,6 @@ lock_table_create(
lock_set_lock_and_trx_wait
(
lock
,
trx
);
lock_set_lock_and_trx_wait
(
lock
,
trx
);
}
}
DBUG_LOG
(
"ib_lock"
,
ADD
(
lock
)
<<
*
lock
);
lock
->
trx
->
lock
.
table_locks
.
push_back
(
lock
);
lock
->
trx
->
lock
.
table_locks
.
push_back
(
lock
);
MONITOR_INC
(
MONITOR_TABLELOCK_CREATED
);
MONITOR_INC
(
MONITOR_TABLELOCK_CREATED
);
...
@@ -3820,8 +3810,6 @@ lock_table_remove_low(
...
@@ -3820,8 +3810,6 @@ lock_table_remove_low(
UT_LIST_REMOVE
(
trx
->
lock
.
trx_locks
,
lock
);
UT_LIST_REMOVE
(
trx
->
lock
.
trx_locks
,
lock
);
ut_list_remove
(
table
->
locks
,
lock
,
TableLockGetNode
());
ut_list_remove
(
table
->
locks
,
lock
,
TableLockGetNode
());
DBUG_LOG
(
"ib_lock"
,
"DEL("
<<
lock
<<
") "
<<
*
lock
);
MONITOR_INC
(
MONITOR_TABLELOCK_REMOVED
);
MONITOR_INC
(
MONITOR_TABLELOCK_REMOVED
);
MONITOR_DEC
(
MONITOR_NUM_TABLELOCK
);
MONITOR_DEC
(
MONITOR_NUM_TABLELOCK
);
}
}
...
@@ -3867,8 +3855,7 @@ lock_table_enqueue_waiting(
...
@@ -3867,8 +3855,7 @@ lock_table_enqueue_waiting(
}
}
#ifdef WITH_WSREP
#ifdef WITH_WSREP
if
(
trx
->
lock
.
was_chosen_as_deadlock_victim
&&
trx
->
is_wsrep
())
{
if
(
trx
->
is_wsrep
()
&&
trx
->
lock
.
was_chosen_as_deadlock_victim
)
{
DBUG_LOG
(
"ib_lock"
,
"DEADLOCK("
<<
trx
<<
") "
);
return
(
DB_DEADLOCK
);
return
(
DB_DEADLOCK
);
}
}
#endif
/* WITH_WSREP */
#endif
/* WITH_WSREP */
...
@@ -3891,7 +3878,6 @@ lock_table_enqueue_waiting(
...
@@ -3891,7 +3878,6 @@ lock_table_enqueue_waiting(
lock_table_remove_low
(
lock
);
lock_table_remove_low
(
lock
);
lock_reset_lock_and_trx_wait
(
lock
);
lock_reset_lock_and_trx_wait
(
lock
);
DBUG_LOG
(
"ib_lock"
,
"DEADLOCK("
<<
trx
<<
") "
);
return
(
DB_DEADLOCK
);
return
(
DB_DEADLOCK
);
}
else
if
(
trx
->
lock
.
wait_lock
==
NULL
)
{
}
else
if
(
trx
->
lock
.
wait_lock
==
NULL
)
{
...
@@ -3904,7 +3890,6 @@ lock_table_enqueue_waiting(
...
@@ -3904,7 +3890,6 @@ lock_table_enqueue_waiting(
trx
->
lock
.
que_state
=
TRX_QUE_LOCK_WAIT
;
trx
->
lock
.
que_state
=
TRX_QUE_LOCK_WAIT
;
trx
->
lock
.
wait_started
=
time
(
NULL
);
trx
->
lock
.
wait_started
=
time
(
NULL
);
DBUG_LOG
(
"ib_lock"
,
VICTIM
(
trx
,
false
));
trx
->
lock
.
was_chosen_as_deadlock_victim
=
false
;
trx
->
lock
.
was_chosen_as_deadlock_victim
=
false
;
ut_a
(
que_thr_stop
(
thr
));
ut_a
(
que_thr_stop
(
thr
));
...
@@ -5786,7 +5771,6 @@ lock_rec_convert_impl_to_expl_for_trx(
...
@@ -5786,7 +5771,6 @@ lock_rec_convert_impl_to_expl_for_trx(
if
(
!
trx_state_eq
(
trx
,
TRX_STATE_COMMITTED_IN_MEMORY
)
if
(
!
trx_state_eq
(
trx
,
TRX_STATE_COMMITTED_IN_MEMORY
)
&&
!
lock_rec_has_expl
(
LOCK_X
|
LOCK_REC_NOT_GAP
,
&&
!
lock_rec_has_expl
(
LOCK_X
|
LOCK_REC_NOT_GAP
,
block
,
heap_no
,
trx
))
{
block
,
heap_no
,
trx
))
{
DBUG_LOG
(
"ib_lock"
,
"IMPL_TO_EXPL(trx="
<<
trx
<<
")"
);
lock_rec_add_to_queue
(
LOCK_REC
|
LOCK_X
|
LOCK_REC_NOT_GAP
,
lock_rec_add_to_queue
(
LOCK_REC
|
LOCK_X
|
LOCK_REC_NOT_GAP
,
block
,
heap_no
,
index
,
trx
,
true
);
block
,
heap_no
,
index
,
trx
,
true
);
}
}
...
@@ -7207,7 +7191,6 @@ DeadlockChecker::trx_rollback()
...
@@ -7207,7 +7191,6 @@ DeadlockChecker::trx_rollback()
trx_mutex_enter
(
trx
);
trx_mutex_enter
(
trx
);
DBUG_LOG
(
"ib_lock"
,
VICTIM
(
trx
));
trx
->
lock
.
was_chosen_as_deadlock_victim
=
true
;
trx
->
lock
.
was_chosen_as_deadlock_victim
=
true
;
lock_cancel_waiting_and_release
(
trx
->
lock
.
wait_lock
);
lock_cancel_waiting_and_release
(
trx
->
lock
.
wait_lock
);
...
...
storage/innobase/lock/lock0wait.cc
View file @
093e2e4f
...
@@ -262,7 +262,6 @@ lock_wait_suspend_thread(
...
@@ -262,7 +262,6 @@ lock_wait_suspend_thread(
if
(
trx
->
lock
.
was_chosen_as_deadlock_victim
)
{
if
(
trx
->
lock
.
was_chosen_as_deadlock_victim
)
{
trx
->
error_state
=
DB_DEADLOCK
;
trx
->
error_state
=
DB_DEADLOCK
;
DBUG_LOG
(
"ib_lock"
,
"DEADLOCK("
<<
trx
<<
") "
);
trx
->
lock
.
was_chosen_as_deadlock_victim
=
false
;
trx
->
lock
.
was_chosen_as_deadlock_victim
=
false
;
}
}
...
@@ -442,7 +441,6 @@ lock_wait_release_thread_if_suspended(
...
@@ -442,7 +441,6 @@ lock_wait_release_thread_if_suspended(
if
(
trx
->
lock
.
was_chosen_as_deadlock_victim
)
{
if
(
trx
->
lock
.
was_chosen_as_deadlock_victim
)
{
trx
->
error_state
=
DB_DEADLOCK
;
trx
->
error_state
=
DB_DEADLOCK
;
DBUG_LOG
(
"ib_lock"
,
"DEADLOCK("
<<
trx
<<
") "
);
trx
->
lock
.
was_chosen_as_deadlock_victim
=
false
;
trx
->
lock
.
was_chosen_as_deadlock_victim
=
false
;
}
}
...
...
storage/innobase/ut/ut0ut.cc
View file @
093e2e4f
...
@@ -673,39 +673,4 @@ fatal_or_error::~fatal_or_error()
...
@@ -673,39 +673,4 @@ fatal_or_error::~fatal_or_error()
}
// namespace ib
}
// namespace ib
#ifndef DBUG_OFF
static
std
::
string
dbug_str
;
template
<
class
T
>
const
char
*
dbug_print
(
T
&
obj
)
{
std
::
ostringstream
os
;
os
.
str
(
""
);
os
.
clear
();
obj
.
print
(
os
);
dbug_str
=
os
.
str
();
return
dbug_str
.
c_str
();
}
const
char
*
dbug_print
(
ib_lock_t
*
obj
)
{
return
dbug_print
(
*
obj
);
}
const
char
*
dbug_print
(
lock_rec_t
*
obj
)
{
return
dbug_print
(
*
obj
);
}
const
char
*
dbug_print
(
lock_table_t
*
obj
)
{
return
dbug_print
(
*
obj
);
}
const
char
*
dbug_print_lock_mode
(
ib_uint32_t
type_mode
)
{
dbug_str
=
type_mode_string
(
type_mode
);
return
dbug_str
.
c_str
();
}
#endif
/* !DBUG_OFF */
#endif
/* !UNIV_INNOCHECKSUM */
#endif
/* !UNIV_INNOCHECKSUM */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment