-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Send proper MariaDB database version to the stats server #25281
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.
This regex and the one from doctrine care for string like "5.5.5-Mariadb-10.0.8-xenial", as the function documentation at doctrine sais. This kind of strings seems to come from a database select for the versio number. But in Joomla framework database package, the mysqli::$server_info is used, which gives string like e.g. "5.5.5-10.1.29-MariaDB", see e.g. here: https://www.php.net/manual/de/mysqli.get-server-info.php#118822. Also in issue #25245 @Quy reported a string like that. So that regex works, because "mariadb-" may appear zero or one time, and the rest after the real version number is ignored, but it might be at least formally not correct and confusing when reading. But this is just my impression, it seems to work so it is ok.
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.
It's going to be fine. If my regex reading skills are OK, it's going to match if there is a "5.5.5-" prefix, a "mariadb-" prefix, or a "5.5.5-mariadb-" prefix, then the version number that is found in the first group after that is extracted into the
$versionPartsarray. What we want is "10.0.8"; "5.5.5-Mariadb-10.0.8-xenial", "5.5.5-10.0.8-MariaDB", and "5.5.5-10.0.8-xenial" will all end up that way.The only other way to do it "right" is going to result in a leaky abstraction (either the plugin has to issue a RDBMS specific query to get the version that way, or the
$connectionresource has to be made available).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.
Right, it will work and return the right version so or so.
Unfortunately I don't have a MariaDB set up yet, so I could test only with code review. Would that be enough?
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 did it blind taking battle tested code from another framework and adapting it, I have exactly one MariaDB server at my disposal and it's on the one client server whose WHM was built with MariaDB enabled by default instead of MySQL (and they don't use Joomla, so clearly I can't abuse that server for testing).
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.
Let's wait and see, if we don't have a 2nd tester tomorrow I can set up a MariaDB. What keeps me from doing it is that I would ha eto specify a special port so it does not use the same as my MySQL currently used. So or so, code review looks good, I am sure it works asd desired.
Uh oh!
There was an error while loading. Please reload this page.
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.
Live server on Linux 3.10.0-957.10.1.el7.x86_64:
System Information: 5.5.60-MariaDB
Stats plugin: 5.5.60
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.
See this comment for possible MariaDB combinations: #25283 (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.
Until some version 5.5.x, MariaDB used the same numbering scheme as MySQL. Later they changed to 10.x.y. For the J4 installation that should be ok, because "5.5.60-MariaDB" is older than minimum version. For this PR here in staging I am not sure, it might be in fact confusing having 5.w.x and also 10.x.y in the statistics. But assuming that we will not allow installation of staging on MariaDB and not allow such old 5.x.y on J4, it should be practically ok. At the end we will maybe increase requirement to 10.4 anyway, as discussed in the other issue.
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.
Having MySQL with 10.x (purely MariaDB) and 5.x (mixed MariaDB and MySQL) and 8.x (purely MySQL) version numbers isn't an issue. Actually, the 5.5.5 string is the worst bit of it all (which accounts for a not-so-insignificant number of the total MySQL stats) because we haven't the slightest idea what MariaDB backend is in use (whereas at least the 10.x ones we can tell the difference, there won't be a problem until MySQL gets to 10.x).
In the case of 5.5.60-MariaDB, there isn't a sane way to distinguish that one with the current architecture (neither in the stats plugin here or at the server level, "mariadb" just isn't an allowed thing right now because there isn't a "mariadb" database driver). It's one of those things we just live with.
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 fully agree.