-
-
Notifications
You must be signed in to change notification settings - Fork 2k
MDEV-16335: Include deadlock detail information in SHOW WARNINGS #4492
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
base: main
Are you sure you want to change the base?
MDEV-16335: Include deadlock detail information in SHOW WARNINGS #4492
Conversation
67920e9 to
19592c6
Compare
63a7517 to
0cf376f
Compare
FooBarrior
left a comment
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.
Looks good to me.
dr-m
left a comment
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.
The test for this functionality is only executed in debug-instrumented builds. I think that new functionality had better tested with all builds, so that the functionality will be better covered. For example, GNU/Linux distributions that package MariaDB themselves will likely not use CMAKE_BUILD_TYPE=Debug at all. We should test what we ship.
storage/innobase/lock/lock0lock.cc
Outdated
| static_cast<size_t>(len), | ||
| lock_latest_err_file); | ||
| ut_ad(deadlock_info_len <= static_cast<size_t>(len)); | ||
| if (deadlock_info[deadlock_info_len - 1] == '\n') |
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.
this will crash if deadlock_info_len is 0
|
You didn't check
|
4f63d11 to
5a59a74
Compare
| static_cast<size_t>(len), | ||
| lock_latest_err_file); | ||
| ut_ad(deadlock_info_len <= static_cast<size_t>(len)); | ||
| if (deadlock_info_len && deadlock_info[deadlock_info_len - 1] == '\n') |
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.
This one is still not resolved:
this will crash if deadlock_info_len is 0
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.
Where would it crash? The dereferencing deadlock_info[deadlock_info_len - 1] is guarded by a check that deadlock_info_len is nonzero.
Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
Signed-off-by: Varun Deep Saini <varun.23bcs10048@ms.sst.scaler.com>
11ae15e to
374a9d7
Compare
Description
Currently, deadlock information is only available globally via
SHOW ENGINE INNODB STATUS, so a client can never be certain that the information shown is for their own session's deadlock.This patch stores deadlock information in the victim transaction's structure when a deadlock is detected, making it accessible via
SHOW WARNINGS.Implementation
deadlock_infofields totrx_lock_tto store per-session deadlock informationDeadlock::report(), copy deadlock info to the victim transaction (only whensrv_print_all_deadlocksis set)convert_error_code_to_mysql(), push deadlock info as a warning viapush_warning_printf()Release Notes
When
innodb_print_all_deadlocks=ON, deadlock detail information is now available per-session viaSHOW WARNINGSafter a deadlock error (ER_LOCK_DEADLOCK).How can this PR be tested?
Basing the PR against the correct MariaDB version
mainbranch.PR quality check