Skip to content

Conversation

dr-m
Copy link
Contributor

@dr-m dr-m commented Sep 10, 2025

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

Description

Let InnoDB access some data members of THD directly, instead of invoking non-inline accessor functions. Note: my_thread_id will be used instead of the potentially narrower ulong data type.

Also, let us remove some functions from sql_class.cc that were only being used by InnoDB or RocksDB, for no reason. RocksDB always had access to the internals of THD.

Release Notes

The performance of InnoDB was slightly improved.

How can this PR be tested?

The performance impact has been tested in MDEV-37152 as part of #4252.

The modified code should be well exercised by the default regression tests. No change in behaviour is expected.

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.

I believe that this would benefit the 10.6 branch as well, but there are several other performance fixes that were already omitted from the 10.6 branch.

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.

@dr-m dr-m requested a review from vuvova September 10, 2025 11:55
@dr-m dr-m self-assigned this Sep 10, 2025
@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.

@dr-m
Copy link
Contributor Author

dr-m commented Sep 10, 2025

For the record, a cmake -DPLUGIN_INNOBASE=DYNAMIC build would fail both before and after these changes. Setting cmake -DWITH_WSREP=OFF would fix most of that, but some problems that were introduced in #3022 and a2d3770. Below are some compiler messages for f609dbd for cmake -DPLUGIN_INNOBASE=DYNAMIC -DWITH_WSREP=OFF:

storage/innobase/handler/ha_innodb.cc: In function ‘void innodb_transaction_abort(THD*, bool, dberr_t)’:
storage/innobase/handler/ha_innodb.cc:2073:31: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
 2073 |     if (thd_log_warnings(thd) >= 4)
storage/innobase/handler/ha_innodb.cc: In member function ‘virtual int ha_innobase::check(THD*, HA_CHECK_OPT*)’:
storage/innobase/handler/ha_innodb.cc:15316:17: error: ‘print_check_msg’ was not declared in this scope
15316 |                 print_check_msg(thd, table->s->db.str, table->s->table_name.str,
      |                 ^~~~~~~~~~~~~~~

The first error would actually be fixed by this pull request; thd->variables.log_warnings appears to be fine.

Let us access some data members of THD directly, instead of invoking
non-inline accessor functions. Note: my_thread_id will be used instead
of the potentially narrower ulong data type.

Also, let us remove some functions from sql_class.cc that were only
being used by InnoDB or RocksDB, for no reason. RocksDB always had
access to the internals of THD.

Reviewed by: Sergei Golubchik
Tested by: Saahil Alam
@dr-m dr-m merged commit 9aca89f into 10.11 Sep 16, 2025
14 of 17 checks passed
@dr-m dr-m deleted the MDEV-37619 branch September 16, 2025 12:43
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