Report database server version instead of client binary version#319
Open
JoshuaGoode wants to merge 1 commit into
Open
Report database server version instead of client binary version#319JoshuaGoode wants to merge 1 commit into
JoshuaGoode wants to merge 1 commit into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Author
|
Noting that I have worked with two hosts to use my branch and they are actively reporting the database server version now. May need testing in other setups but works in these live production envs. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes
What changed
This updates runner environment collection so
mysql_versioncomes from the database server when the runner can detect it safely.Before this PR,
mysql_versioncame frommysql --version. That is the local MySQL/MariaDB client binary, not necessarily the database server WordPress used for the test run.The runner now asks the configured test database for
SELECT VERSION()and stores the raw value. If that lookup cannot run safely, it leavesmysql_versionempty and lets the existing reporter displayUnknown.I kept the existing
mysql_versionkey for reporter compatibility. The field name is not ideal, but changing it would turn this into a runner + reporter data migration. I do not think we need that for this fix.Why
As noted in #318, Host Test Results labels this value as "Database Version". When it starts with
mysql Ver ..., it is showing the client program installed where the runner ran. That is not the server WordPress tested against.This is important when comparing MySQL and MariaDB results, or when a failure only appears on one server version. The report should point to the server. The client, as is currently reported, is not useful.
Before this PR, generated env data could contain a value shaped like:
mysql Ver 15.1 Distrib 10.11.11-MariaDBWith this branch, a live submitted report shows:
11.4.8-MariaDB-logHistory
There has been some previous work around this:
MySQL/MariaDB version capture.
mysql_versionpath usingmysql --version.this field to
SELECT VERSION().client-version fetch after the server lookup reportedly broke tests. Unfotunately, no errors or details were provided about what broke.
points back to this runner behavior.
This PR keeps the goal from #176. If detection fails, the runner reports
Unknownthrough the existing reporter behavior. It should not block the test run, and it should not fall back to the client string as it's not appropriate or useful.Avoiding previous issues
The prior attempt's lookup might have been too direct. A failed connection, failed query, missing
mysqli, empty result row, or PHP 8.1+mysqliexception could cause the test to fail.This version has more guards
mysqlisupport before using it.mysqlistrict reporting off for the lookup and restores theprevious report mode afterward.
mysqli_real_connect()with parsed host, port, socket, and IPv6values.
The generated logger in
prepare.phpis still self-contained but it now runs after the generated DB constants exist. The report fallback infunctions.phpuses the same behavior.I intentionally did not add vendor parsing, normalization, a client-version field, reporter changes, or a replacement field. The key stays
mysql_versionand only the value it reports changes to be the proper server value.Testing results
Live report proof:
https://make.wordpress.org/hosting/test-results/r62456/wpcombot-r62456-8-5-11-4-8-mariadb-log/
That report shows Database Version as
11.4.8-MariaDB-log, matching the server version returned by the live database rather than amysql Ver ...client string.Compare that to the client versions seen in the rest of the rest results run. The other results still show client values, so the difference is visible in context. https://make.wordpress.org/hosting/test-results/r62456/
Validation
After hosts update their runner checkout, I would spot-check the next few Host Test Results:
8.0.x,10.x-MariaDB, or11.x-MariaDB-log.mysql Ver ...under "Database Version".Unknown.Reminders / follow-up
https://core.trac.wordpress.org/ticket/58816
After this lands, that Trac ticket can be updated or closed as appropriate.
for report-only flows that may need an explicit DB-version input when DB
credentials are not available.