-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add supported read isolation level to schema interface #22507
Add supported read isolation level to schema interface #22507
Conversation
0cafe50
to
c2e60ac
Compare
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.
Some general things are missing around the deprecation of setUncommitted
method:
The deprecation needs to be added to our changelog:
Lines 13 to 16 in d712ca6
## Deprecations | |
The methods `Db::isOptimizeInnoDBSupported` and `Db::optimizeTables` have been deprecated. Use `Db\Schema::getInstance()->isOptimizeInnoDBSupported` and `Db\Schema::getInstance()->optimizeTables` instead | |
And it would be good to add a test that ensures we don't forget to remove the method with Matomo 6:
matomo/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
Lines 90 to 93 in d712ca6
$this->assertDeprecatedMethodIsRemovedInMatomo6('Piwik\Common', 'getRequestVar'); | |
$this->assertDeprecatedMethodIsRemovedInMatomo6('Piwik\Plugins\Overlay\API', 'getExcludedQueryParameters'); | |
$this->assertDeprecatedMethodIsRemovedInMatomo6('Piwik\Db', 'isOptimizeInnoDBSupported'); | |
$this->assertDeprecatedMethodIsRemovedInMatomo6('Piwik\Db', 'optimizeTables'); |
return $this->setTransactionLevelForNonLockingReads(); | ||
} | ||
|
||
public function setTransactionLevelForNonLockingReads(): bool | ||
{ | ||
if ($this->db->supportsUncommitted === false) { |
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.
Guess it's discussable if the public db property should still be called supportsUncommitted
, when it actually no longer holds that information.
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 agree it's name wrong, on one side as well I'm not exactly sure why it's exposed as public in the first place.
Would you suggest making it private and make this class less leaky, along with a proper deprecation message?
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 guess it's exposed public and set for the DB class, so the check is only performed once per DB connection. As the property shouldn't be used by any plugin I would say we can simply rename it, or make it private and introduce methods to handle that correctly.
We could even consider to handle everything through DB class, instead of using the TransactionLevel class directly.
Thanks for this, I've done these changes now. |
85d1751
to
787b46c
Compare
Description:
TiDB doesn't support
READ_UNCOMMITTED
, I've added this variance to the schema.To make sure it works, a test has been added to the LogAggregator making sure the
supportsUncommitted
doesn't switch tofalse
but insteadtrue
Review