server
server copied to clipboard
MDEV-31062 : Reduce number of wsrep calls to server code from InnoDB
- [x] The Jira issue number for this PR is: MDEV-31062
Description
Thread executing wsrep transaction can't change during transaction execution. Similarly, thread executing high priority brute force (BF) transaction does not change during transaction execution. Therefore, in both cases there is no need to call server code after transaction has initialized.
InnoDB already stores information is this wsrep transaction to trx_t::wsrep and this is checked using trx->is_wsrep() function. Because, brute force transaction is always a wsrep transaction we can extend trx_t::wsrep variable so that value
0 == not wsrep transaction (and not BF) 1 == normal wsrep transaction 2 == high priority BF wsrep transaction 4 == high priority BF transaction is performing unique secondary index scan
These values can be set by calling server code on innobase_trx_init(). After that we can use trx_t::is_wsrep() and new function introduced in this patch trx_t::is_wsrep_BF(). Unique secondary index scan is determined later but it implies BF. Patch introduces new functions wsrep_begin_UK_scan() and wsrep_end_UK_scan() to handle unique secondary index scan.
This change reduces number of call to server code from InnoDB and reduces code bloat on performance critical stages like acquiring record locks. Furthermore, it simplifies code on several locations.
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".
In many cases, this will be as simple as modifying one .test
and one .result
file in the mysql-test/
subdirectory. Without automated tests, future regressions
in the expected behavior can't be automatically detected and verified.
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 and the PR is based against the latest MariaDB development 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
- [ x] I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.