-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDEV-33935 fix deadlock counter #3264
base: 10.6
Are you sure you want to change the base?
Conversation
0ba7ff5
to
e3af139
Compare
6d488f3
to
625d450
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution!
The commit message does not currently explain what is wrong. The MDEV-33935 Description does. I think that it would be better to make source code changes a little more self-contained, not forcing the Jira to be accessed for understanding the problem.
/** Detect deadlock using @ref Deadlock::find_cycle function facility. | ||
@param trx Transaction that is waiting for another transaction | ||
@return a transaction that is part of a cycle, otherwise nullptr | ||
@note the function is not fully idempotent, each call increments a counter */ | ||
static inline trx_t *detect_deadlock(trx_t *trx) | ||
{ | ||
trx_t *res= nullptr; | ||
if ((res = find_cycle(trx)) != nullptr) | ||
lock_sys.deadlocks++; | ||
|
||
return res; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding this function and adjusting both callers of Deadlock::find_cycle()
, it would seem that we can move the lock_sys.deadlocks++
to the beginning of Deadlock::report()
.
--source include/have_innodb.inc | ||
--source include/have_debug_sync.inc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add also include/have_debug.inc
so that the test can be skipped more quickly on a non-debug build.
Even better would be to write this test without DEBUG_SYNC
instrumentation, so that it could run on all target architectures. We only have a few debug instrumented builds, not covering all platforms.
There already exists a test innodb.deadlock_detect
. Could you extend it so that it demonstrates the problem?
Description
Fixed deadlock counter incrementing on every call to cycle finding that was used multiple times during the deadlock detection.
Release Notes
How can this PR be tested?
Basing the PR against the correct MariaDB version
PR quality check