-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix #78179: mysqli/mysqlnd transaction extensions #5877
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
Fix #78179: mysqli/mysqlnd transaction extensions #5877
Conversation
|
Hi, can I get a review of this PR please. |
Well, testing for featured based on version is generally not the best solution, in my opinion. Your changes look plausible to me, but I'm not really an mysqli expert, and wouldn't be able to test with any libmysql-client (I'm working on Windows). Anyhow, I wonder whether that bug hasn't been fixed already; while Andrey closed the ticket as WONTFIX, and said he'd going to revert my commit, he apparently did not. :/ |
|
Thanks for the endorsement. There is a libmysql-client for Windows. I tested it a bit more and it looks still to be fixed without this (I've asked the original reporter to explain https://jira.mariadb.org/browse/MDEV-23141 to check). Maybe its in mysqli rather than mysqlnd? The 5.5.5 hack is still in the mariadb code base. The only other php ext uses of mysql_get_server_version are against a 5.0 version. Well at least this alternate code is here if a revert gets decided upon. |
|
Thanks for the link to the Windows libmysql-client; the other part of the problem is, however, that there isn't any support for building against libmysql-client for Windows. I may have a look at this sometime.
I'm not happy with the version hack in PHP myself. And even without the need for any hack, version comparisons won't really work anymore due to having different systems with individual versioning now. Anyhow, @andreyhristov, what do you think? Should we still remove the MariaDB version detection hack? Or keep it, but apply this PR anyway? |
|
Hi, |
|
I don't like that version hack either, and I'm not against moving it to a PECL hosted mysqlnd plugin. However, even if we do so, version checks can't really work in the long run, since MariaDB apparently does not conform to MySQL versioning, so we either should replace the version checks with more general feature detection (or in this case, as done in this PR), or we should document that mysqlnd doesn't fully support MariaDB. |
|
Hi, I regret the revisited trauma of mentioning this versioning trauma again. I don't think anyone saw it as a good solution, only one needed for MariaDB to maintain/claim some replication compatibility with MySQL. I've managed to reproduce the original problem identified by bug reporter in MDEV-23141 by compiling php against the minimal tarball of mysql with As such, only the mysqli section of this PR is needed to expose the transaction capabilities of MariaDB and the mysqlnd changes are unnecessary (though they look good from a consistency point of view and are covered by existing test cases, you're call however, I'm happy to remove the mysqlnd changes). To ensure that no regressions are caused by MariaDB server against the current php mysqli/mysqlnd drivers I've started this project to integrate into the mariadb.org bb system such that server incompatibilities get detected pre-release and the php project doesn't get asked to account for MariaDB differences. Regardless if we need to produce our own plugin/PECL maintaining existing compatibility for our common user base is a good first goal. Please hold off on merging this for now, I'm pretty sure its right but won't know until mysqli corrections have been made more reliable (SEGV in |
|
Or maybe MariaDB should stop advertising as drop-in replacement :)
Andrey
…On 28.08.20 г. 15:57 ч., Christoph M. Becker wrote:
I don't like that version hack either, and I'm not against moving it to
a PECL hosted mysqlnd plugin. However, even if we do so, version checks
can't really work in the long run, since MariaDB apparently does not
conform to MySQL versioning, so we either should replace the version
checks with more general feature detection (or in this case, as done in
this PR), or we should document that mysqlnd doesn't fully support MariaDB.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5877 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACILHHXAXR4A2O5C6C7VBDSC6SUXANCNFSM4PDHBIJA>.
|
I totally agree and the removal of that now obsolete, incorrect, byline has been going on for a while. Still a few places to remove it from however. |
MariaDB versioning created a mess with regarding testing features based on version. We sidestep the problem here by assuming the extensions are present, and if a syntax error occurs with a SQL mode TRANS_START_READ_WRITE | TRANS_START_READ_ONLY enabled, then output the same warning as before.
794c05f to
113b691
Compare
|
with #6126 merged, thanks @nikic, there's now a more functional mysqli native client implementation to work this on. After a rebase just pushed, testing against MySQL-5.6, 5.7 and 8.0 do pass the mysqli_begin_transaction.phpt test exercised by this change - https://travis-ci.org/github/grooverdan/php-src/builds/728129550 The mysqlnd also passes this test, though as mentioned earlier, the mysqlnd changes in this PR aren't strictly necessary, though it does add to a consistent implementation. With MySQL-5.5 ending its extended support 18 months ago, those that run supportable systems will already be running on a server that supports TRANS_START_READ_{ONLY|WRITE}. Those running older versions won't be intentionally hitting this error message. So we're reducing a server version check from the processing chain for the majority of users. |
nikic
left a comment
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 reasonable to me, thanks!
|
Merged as 740f0f6. |
|
Thanks @nikic |
MariaDB versioning created a mess with regarding testing
features based on version. We sidestep the problem here
by assuming the extensions are present, and if a syntax
error occurs with a SQL mode TRANS_START_READ_WRITE |
TRANS_START_READ_ONLY enabled, then output the same
warning as before.
Test MDEV-23141.php
?php $db = new mysqli("localhost", "root", "", "test"); $db->begin_transaction(MYSQLI_TRANS_START_READ_WRITE); $v = $db->server_version; print "server version $v\n"; $db = new mysqli("127.0.0.1", "dan", "bob", "test", 3306); $db->begin_transaction(MYSQLI_TRANS_START_READ_WRITE); $v = $db->server_version; print "server version $v\n";Test with dbdeployer mysql-5.5.62 on /tmp/mysql_sandbox5562.sock and MariaDB-10.4.13 (fc32 package) on 3306.
So successfully starts a transaction on MariaDb-10.4 and generates the same warning on MySQL-5.5.62