Skip to content

Conversation

@andrelkin
Copy link
Contributor

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

Description

MDEV-38254 re-fixing of MDEV-37686.
(this PR also brings the MDEV-38212 revert commit as a base for the actual patch)

Instead of NULLifying of this member a finer approach is taken to
screen the replicated temporary tables from the slave applier
when it runs within start_new_trans context.

For that all access critical THD::{has,lock,unlock}_temporary_tables
functions are made to check possible start_new_trans condition.
This measure forces start_new_trans executing slave thread to always take
the normal thread access path to a temporary table repository.

This commit also unifies within sql/temporary_tables.cc checking of the
current thread is slave with usage of THD::rgi_slave instead of
THD::slave_thread (last time chosen by MDEV-33426).

Tested with rpl.create_or_replace_mix2 of GTT feature branch.

While it's rather fair to qualify this patch as a work-around (of limited isolation of start_new_trans feature)
its direction is the best we can do practically at the moment for providing isolation.
Checking the small patch may dismiss or soften doubts Jira.
The patch adjusts MDEV-33426 fixes, cosmetically.

Other approaches have been discussed and the tentative winner
between myself and Brandon is an asynchronous start_new_trans (see MDEV-38254 description too).

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.
  • 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.

Instead of `NULL`ifying of this member a finer approach is taken to
screen the replicated temporary tables from the slave applier
when it runs within `start_new_trans` context.

For that *all* access critical `THD::{has,lock,unlock}_temporary_tables`
functions are made to check possible `start_new_trans` condition.
This measure forces `start_new_trans` executing slave thread to always take
the normal thread access path to a temporary table repository.

This commit also unifies with sql/temporary_tables.cc checking of the
current thread is slave with usage of THD::rgi_slave instead of
THD::slave_thread (last time chosen by MDEV-33426).

Tested with rpl.create_or_replace_mix2 of GTT feature branch.
@andrelkin andrelkin requested a review from knielsen December 5, 2025 14:19
@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.

Copy link
Contributor

@bnestere bnestere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @andrelkin,

I agree the patch is more concise and has a reduced scope, which is nice for a workaround. I don't think we need to decide if we want to put it into 12.3 right now though. Perhaps we can put this w/a just into the GTT branch for now, so QA can continue, and then revert MDEV-37686.

And generally to the w/a patch itself, I'd probably use MDEV-38212 as the "owner"; and then throughout the patch/commit, mention TODOs for MDEV-38254 to remove this w/a once a comprehensive fix is done.

@FooBarrior
Copy link
Contributor

FooBarrior commented Dec 5, 2025

It's a bit suspicious that innodb.log_file_size_online and main.lock_sync fail. Maybe a false-positive, of course.

Anyway, the patch works fine for me. Let's keep it in gtt and monitor the QA results.

@knielsen
Copy link
Member

knielsen commented Dec 6, 2025

I'm sorry Andrei, but I have to say this patch is un-reviewable. The problem is that the description is incomprehensible.

What is the actual problem to be addressed? How does the start_new_trans stuff work? Why does start_new_trans have to do anything special for slave threads? Why does this turn up now, with global temporary tables?

And most importantly, have you completely understood all the code you are modifying and all the ways it interacts with other parts of the server?

Brandon, if you have understood the issue in full, maybe you can help write up a good description? (And if you have not, you should not approve the patch...)

@andrelkin
Copy link
Contributor Author

andrelkin commented Dec 7, 2025 via email

Copy link
Contributor

@bnestere bnestere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, after discussing the issue in-person.

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.

8 participants