storage/innobase/dict/dict0dict: add a RAII class to freeze a dict_sys_t #3529
+52
−57
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.
Description
This replaces a lot of manual freeze() and unfreeze() call. Doing it with RAII is safer and easier.
I did not replace all freeze()/unfreeze() pairs because some callers unfreeze and re-freeze in the middle of a scope. Sometimes, adding a new scope can be added just for such a RAII object. Refactoring that can be done later.
Notes:
Instead of using the global variable
dict_sys
, I decided to pass adict_sys_t
reference parameter, because I believe it will benecessary to eliminate that global variable eventually (in order to
have a per-catalog instance). Hard-coding this global variable here
would generate identical (not better) machine code and would be a
step in the wrong direction.
The new macros
SRW_LOCK_ARGS2
andSRW_LOCK_CALL2
were necessarybecause this is the first time those debug-only parameters are
forwarded from a function that has more parameters (i.e. the
dict_sys_t reference).
Release Notes
Nothing. Internal code change only with no runtime effect.
How can this PR be tested?
No runtime effect.
Basing the PR against the correct MariaDB version
main
branch.PR quality check