Skip to content

Conversation

@andrelkin
Copy link
Contributor

@andrelkin andrelkin commented Oct 17, 2025

  • The Jira issue number for this PR is: MDEV-______

Description

This PR contains a polished version of PR-4302 comments' p.2 with the idea it to be 10.11+ patch version.

Release Notes

TODO: What should the release notes say about this change?
Include any changed system variables, status variables or behaviour. Optionally list any https://mariadb.com/kb/ pages that need changing.

How can this PR be tested?

TODO: modify the automated test suite to verify that the PR causes MariaDB to behave as intended.
Consult the documentation on "Writing good test cases".

If the changes are not amenable to automated testing, please explain why not and carefully describe how to test manually.

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • [ x] This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

The commit combines
1. a code polishing piece over a part of MDEV-21117 that
   made binlog handlerton always commit first in no 2pc cases and
2. the same rule now applies to the rollback.

The 2nd point fixes the following bug.
Two transactions could binlog their completions in opposite to how it
is done in Engine. That is is rare situations ROLLBACK in Engine could
be scheduled first by 2pc coordinator and thereby to allow for a race in
binlogging of the transaction and whatever might be dependent on it in
execution time.

An added test demonstrates how a "child" (in execution time dependency
sense) transaction could reach binlog before its parent.
The commit combines
1. a code polishing piece over a part of MDEV-21117 that
   made binlog handlerton always commit first in no 2pc cases and
2. the same rule now applies to the rollback.

The 2nd point fixes the following bug.
Two transactions could binlog their completions in opposite to how it
is done in Engine. That is is rare situations ROLLBACK in Engine could
be scheduled first by 2pc coordinator and thereby to allow for a race in
binlogging of the transaction and whatever might be dependent on it in
execution time.

An added test demonstrates (requires to apply
`DEBUG_SYNC(entry->thd, "before_group_commit_queue")` hunk of log.cc
to the BASE) how a "child" (in execution time dependency sense)
transaction can reach binlog before its parent.

The rollback related code of this commit differs from the commit case
in that `binlog_hton::rollback()` has to exist to satisfy its specific
`ha_rollback_to_savepoint()` invoker.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants