New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Performance]Cache whether a DB supports transaction level #18691
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks fine. Left a comment for improving the tests
update tests to fit different mysql version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@tsteur do you want to have a last quick view before this is merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the original issue in #18138 I mention this:
We should cache this eg on the $this->db as it's DB dependent as if someone configures different DBs for writer and reader for example then we cannot reuse / cache the same result.
@peterhashair @sgiehl the current solution wouldn't 100% work for us.
We want to cache it per DB (in case writer and reader are somehow different) and also to have better cache when many new instances of this class are created. Otherwise it be only cached in the instance itself. We are creating this class very often so it wouldn't really help.
@tsteur right, so this |
move supportsUncommitted to db level
append $supportsUncommitted to global Db
@peterhashair most tests are now failing with messages like |
append supportsUncommitted
append to mysqli supportsUncommitted
@sgiehl I think that one is good to go? |
From my point of view this looks good to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be still an issue. Also can we add a test for the cache by setting the property on the db
object in a test and then we get expected result or something?
update function
update transaction
revert back to previous change
update cache level key
@sgiehl right, sorry wasn't thinking, update again, if that makes sense. |
update cache
update supportsUncommitted
add some comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment. Otherwise guess it looks good now, as the status backup doesn't seem to be an issue.
Co-authored-by: Stefan Giehl <stefan@matomo.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be good to merge now. @tsteur do you want to have another look before merging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peterhashair @sgiehl I believe there are still few issues. Could we get the these resolved?
remove $supportsUncommitted reset
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't tested it but looks all good to me now 👍
Description:
Fixes: #18138
Cache whether a DB supports transaction on all the DB adapter to improve perfomance.
Review