MDEV-37977 InnoDB deadlock report incorrectly reports rolled back transaction number#4679
Open
arcivanov wants to merge 1 commit intoMariaDB:10.11from
Open
MDEV-37977 InnoDB deadlock report incorrectly reports rolled back transaction number#4679arcivanov wants to merge 1 commit intoMariaDB:10.11from
arcivanov wants to merge 1 commit intoMariaDB:10.11from
Conversation
…nsaction number The "WE ROLL BACK TRANSACTION (N)" message in the deadlock report referred to the wrong transaction number. The victim selection loop and the display loop in `Deadlock::report()` traversed the cycle in the same order (`cycle->wait_trx, ..., cycle`) but used misaligned position numbering: - **Victim selection** initialized `victim = cycle` at position 1 *before* the loop, then started iterating from `cycle->wait_trx` at position 2. - **Display loop** started from `cycle->wait_trx` at label `(1)`, with `cycle` displayed last at label `(N)`. This caused `victim_pos` to be off by one relative to the displayed transaction labels. Fix: restructure the victim selection loop to start with `l=0` and `victim=nullptr`, letting the loop handle all transactions uniformly. The first iteration unconditionally picks `cycle->wait_trx` as the initial victim at position 1, matching the display loop. The `thd_deadlock_victim_preference()` call is guarded with a `victim != nullptr` check to skip it on the first iteration (where no prior victim exists to compare against).
a0b993a to
0971dec
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "WE ROLL BACK TRANSACTION (N)" message in the deadlock report referred to the wrong transaction number. The victim selection loop and the display loop in
Deadlock::report()traversed the cycle in the same order (cycle->wait_trx, ..., cycle) but used misaligned position numbering:victim = cycleat position 1 before the loop, then started iterating fromcycle->wait_trxat position 2.cycle->wait_trxat label(1), withcycledisplayed last at label(N).This caused
victim_posto be off by one relative to the displayed transaction labels.Fix: restructure the victim selection loop to start with
l=0andvictim=nullptr, letting the loop handle all transactions uniformly. The first iteration unconditionally pickscycle->wait_trxas the initial victim at position 1, matching the display loop. Thethd_deadlock_victim_preference()call is guarded with avictim != nullptrcheck to skip it on the first iteration (where no prior victim exists to compare against).