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
Modifications to support use of the DBD::MariaDB driver instead of DBD::mysql #1160
Modifications to support use of the DBD::MariaDB driver instead of DBD::mysql #1160
Conversation
…mysql. It handles UTF-8 by default, and does not need mysql_enable_utf8mb4 or mysql_enable_utf8. Also mods to prevent mysqldump of mysql 8+ for reporting errors about column-statistics being missing from MariaDB databases by disabling column_statistic when the installed mysqldump command would support it.
I have tested:
The same tests need to also be run on a server which is still using the |
I can report that in over 3 months of using I recently reset my main production server, but before I reset it I had checked for this issue and there was not any noticeable issue. I do still see some "rare" aborted connections, but only those for Over these 5 weeks there is only one other warning, which is triggered at Docker startup time:
Thus, at least in my setting: MariaDB 10.4 in a Docker container on the same host as WeBWorK in Docker - the dropped connection issue is no longer occurring, while it was happening with the "older"
|
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 looks good and passed all my tests, but I you should add comments above the $database_dsn
variable in site.conf explaining how to use this, and the describe format that variable should be in.
If we are looking at migrating to DBD::MariaDB then we also need to include this as a required perl module. It is not currently packaged in RedHat 7, so I had to install it from CPAN on my test server. This should be documented somewhere, and probably included in check_modules.pl. |
I am not sure that we should include DBD::MariaDB in check_modules.pl. The way this pull request is set up the system administrator is given the choice to use DBD:MariaDB or DBD::mysql. So what we need is a mechanism to have check_modules.pl check that one of DBD::MariaDB or DBD::mysql is installed. |
I haven't been success running these. On anything that hits the database, I get as an example for
I'm running the following version of mariadb:
The only change I made was in site.conf to set
and then did
I'm sure I have some other setting wrong, but can't figure that out right now. Fortunately, changing it back worked fine. I think overall, if go with this, we need to do a bunch of documentation to allow people to try out. This is probably fine to include as long as it doesn't break old things. |
@pstaabp: Most likely you need to change the line That is unless you have your database setup to be accessed via a different host. In the docker setup the host is db. |
@drgrice1 That did it and I got everything running above, however, I also tested OPL-update and got the error:
Looks like the database handler might need to be altered for MariaDB in this file. |
@pstaabp: You are correct. That is an oversight. @taniwallach: See @pstaabp's comment. You missed a case with the mysql_enable_utf8mb4 settings. |
…or the DBD::mysql driver.
@pstaabp - Thanks for noticing the omission. I think the second commit fixes it. I tested only so far as making sure that an I ran under Docker once with each of the options:
(I used @pstaabp and @drgrice1 - If one of you would please do a quick test of |
Being added. |
Don't forget this. |
Cross posting! |
… 2 drivers. Change a default switch setting for pdflatex.
My fault, I should have recalled the second issue before pushing the changes to my branch. Note also the |
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 think the documentation you added is decent. You might make a comment about case. Your listed formats have lower case dbi, and the examples are upper case. Perhaps point out where case matters (I believe this is only the database name webwork
). Or just make them all consistent to prevent confusion on this matter.
Edit: Case also matters for MariaDB
.
Edit2: Actually it seems the only place where case doesn't matter is for dbi
. So probably just make the case consistent.
I think this pull request looks good other than that.
Sorry, I was not sure, but it was worth trying.
Try something like:
as a manual setting after the regular block in I know you wanted to avoid this, and for Ubuntu 20.04 it apparently is not needed, but it should hopefully work. |
Oh, you meant the database DSN. I was thinking the general network DSN. Sorry. Yeah, that works for general access, but fails when creating a course archive (and probably restoring one). It messes up the parsing of the database_dsn string that is done in the webwork code. The apache2 error.log shows messages about an unknown host |
Wait, this is a problem with this pull request. Course archiving is broken now in general. Even with the mysql driver. I am getting errors like: |
This happens on Ubuntu 20.04 also. |
Anytime you are using the mysql DBD driver course archiving is broken. The MariaDB driver works with this on Ubuntu 20.04. |
I have archived courses with older versions of the code from this PR, but using a "remote" database where The changes in the PR were supposed to replace most of the cases where the database DSN is being parsed, but there are 2 places where that remained necessary.
I'm checking now with the most recent code. |
Note that this just generally fails. I was testing without the mariadb_socket option added in, but with the mysql driver enabled. |
I can archive courses (in Docker WW) with either setting of
when using
I think the problem is
Did archiving work via |
Note the old code in those files had:
so sockets were not covered before either. |
I am not using docker. Sockets aren't the problem. I say again, I am not using the socket option. |
This all worked with the old code without the socket option, and still should. |
This is definitely this pull request that caused this. If I revert back to before this pull request, course archiving works as it should. |
If you revert - getting this code back in will be a mess. Please test on your setup with a network based database DSN setting and look at what changed in the code in the 2 files I just mentioned. I looked at |
That is not what I am saying. I am saying that if I locally revert to before this pull request, then archiving works. I am also saying that this is a big problem that needs to be fixed, or it is possible that this will need to be reverted. |
I agree it needs to be fixed, and dropped other work to work on this now. We need to understand how https://github.com/openwebwork/webwork2/blob/WeBWorK-2.16/lib/WeBWorK/DB/Schema/NewSQL/Std.pm is broken now... At present, the only hint I find of what is wrong is in
from the error message you posted. I think it would help for you to see what is being placed in the temporary config file created by the archiving process in both settings, as well as the command line being executed. Commenting out the
in |
I am not sure what has changed, but before this pull request |
If you change line 285 of DBD::mysql->_OdbcParse($dsn, \%dsn, ['dbi', 'driver', 'database', 'host', 'port']); archiving works again with the default settings in site.conf as you have them with the exception of |
Another things that works is to just use the code you have above for |
By the way, this also works (either way) if the mariadb_socket is added into the dsn. |
Then maybe that is the best approach. We need to make a call on what seem the best solution I did not want to change what was being done for the old driver, as it has case base handling for different ways of writing the database DSN. Until the middle of this PR's review process DSN was set directly and then parsed in many places. Some (archive/unarchive courses) used the "old" driver's I'll happily experiment later or tomorrow with a revised file via Docker and using both driver options. However, I'm not set up to test a
That line should not be active for the "new" driver, but only when $database_driver="mysql". I can't really figure out how to see what is happening on your machine. I think a detailed "trace" of the relevant variables and the values they get along the process may help. Could you post the code of I have
|
I think I see the issue - the new code uses Since we are not building the database DSN by "our standard" in Install instructions and release notes should make it very clear that modifying the DNS too much could break archiving. Maybe we should rewrite the "parser" to allow multiple orders and skipped parameters, now that we are using the format with explicit
so no longer have a need to implicitly assume a fixed order. |
A better fix, but possible very complicated to do would be to get the "raw" settings from |
I found it. The difference is what is on line 274 in Std.pm before this pull request, and what you changed that to on line 281. It was a substitution that stripped of the "dbi:mysql" before the pull request. Now it is a match that does not strip off that part. In sql_single.pm you left it as a substitution. So if you change that back, you get the old behavior back and it works. |
I think that it would be best to do as you suggest, and just use the new code for both drivers and both files. |
I will try to make a PR for this later today or tomorrow, unless you have time to work on it. |
Merge after #1160 - Docker - update to using Ubuntu 20.04 + minor changes related to recent PRs
That seems to be the root bug... But as I posted in #1284 (comment) I did not manage to trigger the issue... |
Modifications to allow use of the
DBD::MariaDB
driver instead ofDBD::mysql
.The
DBD::MariaDB
driver handles UTF-8 by default, and does not needmysql_enable_utf8mb4
ormysql_enable_utf8
and would fail if they were given.These changes are far beyond the initial one mentioned in #1150 (comment) which was needed to allow using the new driver.
See:
Also included modifications to prevent
mysqldump
of mysql 8+ for reporting errors aboutcolumn-statistics
being missing from MariaDB databases by disabling column_statistic when the installedmysqldump
command would support it.See: