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
sql-client: add support for mariadb-client #13318
Conversation
@wsnipex do we want to split MySqlClient and MariaDBClient in two different cmake modules or should they just be handled by a single one? |
xbmc/dbwrappers/mysqldataset.cpp
Outdated
#include "mysql/errmsg.h" | ||
#endif | ||
#ifdef HAS_MARIADB |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
xbmc/dbwrappers/mysqldataset.h
Outdated
#include "mysql/mysql.h" | ||
#endif | ||
#ifdef HAS_MARIADB |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
xbmc/dbwrappers/mysqldataset.cpp
Outdated
#include "mysql/errmsg.h" | ||
#endif | ||
#ifdef HAS_MARIADB | ||
#include "mariadb/errmsg.h" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
xbmc/dbwrappers/mysqldataset.h
Outdated
#include "mysql/mysql.h" | ||
#endif | ||
#ifdef HAS_MARIADB | ||
#include "mariadb/mysql.h" |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Is it worth keeping mysql at all? The more they diverge the more issues we'll start seeing so might as well drop mysql if the platforms we support have mariadb |
We should probably prefer mariadb over mysql and use maria if both are found in auto mode(ENABLE_MYSQL != ON). @Paxxi: supporting both shouldn't really cause any overhead for now, so I'd postpone dropping mysql to v19. |
Sounds good to me |
ok, will prefer mariadb over mysql, when auto detect. |
implement the suggestions |
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.
thanks
CMakeLists.txt
Outdated
@@ -179,6 +178,16 @@ core_optional_dep(${optional_deps}) | |||
core_require_dyload_dep(${required_dyload}) | |||
core_optional_dyload_dep(${dyload_optional}) | |||
|
|||
if(ENABLE_MYSQLCLIENT AND ENABLE_MARIADBCLIENT) | |||
MESSAGE(FATAL_ERROR "You can not use MySql and MariaDB at the same time. Disable one by adding -DENABLE_MYSQLCLIENT=OFF or -DENABLE_MARIADBCLIENT=OFF") | |||
endif() |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@Rechi switch to check the MYSQL/MARIADBCLIENT_FOUND. With the ENABLE it is |
Will this commit solve the issue that streamdetails is not saved to sql db anymore? it is working when sqlite (local db) is used so there is something wrong on the mysql site. The debug log showed that it is not saved when using mysql by not calling streamdetails function. I use myself a mariadb server and only streamdetails is not saved. Watchstates, resume points etc. are saved. |
@the-dreamer: simple answer, no |
after one week as backport on Krypton (LE 8.2.2) all is working fine. The failed jenkins-build, was a jenkins problem, not a code problem... (maybe i pushed a second rebase, to fast) |
With current code mysql is the preferred one in autodetection mode instead of mariadb. |
@Rechi sure, about the preferred? |
Sorry only read the code changes and thought of a case which isn't handled correctly, but tested it now and it works as expected. @wsnipex any comment? |
@InuSasha I found an easier way to handle mariadb and mysq in CMakeLists.txt which also allows changing the client without deleting the cmake build files.
edit: had placed the if at a wrong place |
@Rechi your solution does not work in case of selecting mysql (only |
Actually IMO maridb should always be the preferred one, unless you explicitly disable it. |
or the mysql is enabled explicit. Other way, it is very confusing, for builders. |
@Rechi: switched to your suggestion. I am no fully agreed with it, but implemented is better the perfect :). |
Sadly, it's not as simple. You have to consider the user force enabling either mariadb or mysql, which makes it much more complicated. |
@wsnipex you don't like my version where you have to explicitly disable mariadb (if it is installed) to get mysql? |
not especially, because it's unintuitive and inconsistent with other options. |
If mariadb is not found it will check for mysql, so redhat/centos will still work if they did before. |
imho it is confusing and unintuitive if you have mariadb installed but -DENABLE_MARIADBCLIENT=ON fails. Granted that will only happen for distros that have dubious packaging.. |
@InuSasha @wsnipex and I agreed on the following solution
Please update the PR with this and squash it into a single commit. |
|
not in my test. i do not know why...
|
CMakeLists.txt
Outdated
set(ENABLE_MARIADBCLIENT OFF) | ||
endif() | ||
|
||
if(NOT ENABLE_MARIADBCLIENT STREQUAL OFF) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
CMakeLists.txt
Outdated
if(ENABLE_MARIADBCLIENT AND NOT ENABLE_MARIADBCLIENT STREQUAL AUTO AND ENABLE_MYSQLCLIENT AND NOT ENABLE_MYSQLCLIENT STREQUAL AUTO) | ||
MESSAGE(FATAL_ERROR "You can not use MySql and MariaDB at the same time. Disable one by adding -DENABLE_MYSQLCLIENT=OFF or -DENABLE_MARIADBCLIENT=OFF.") | ||
elseif(ENABLE_MYSQLCLIENT AND NOT ENABLE_MYSQLCLIENT STREQUAL AUTO) | ||
set(ENABLE_MARIADBCLIENT OFF) |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
mariadb is a place-in for mysql. only, the search pathes and the include path are changed.
thanks for the patience! |
Since Milhouse #205 and adamg 8.90.4, this patch was added. Unfortunately, the change now prevents Kodi from starting up (on both builds). The log error is: 21:31:09.745 T:139727820420864 ERROR: SQL: [MyMusic70] An unknown error occurred |
Are you sure that this "prevents Kodi from starting up" - missing databases don't usually prevent Kodi from starting. Is Kodi now crashing? The reason your MyMusic70 database has no version is because the migration from your previous MyMusicXX failed - can you enable debug logging, drop MyMusic70 and restart Kodi so that the MyMusicXX migration is attempted once more, then upload the resulting Kodi log to a pastebin site and paste the link. |
I dropped MyMusic69. MyMusic70 was created from scratch by scraping. |
Did you post the wrong log? Your log shows s a version of Kodi from 25 Dec 2017, so presumably LibreELEC is of the same vintage in which case it doesn't include MariaDB support. The log also doesn't create a MyMusic70 database, in fact it doesn't create any database - it does however find and use an existing MyMusic69 database. Let's move the conversation to the forum - until we know what is wrong this is just noise. |
Update from forum: https://forum.kodi.tv/showthread.php?tid=298462&pid=2704269#pid2704269 This MyMusic70 problem may be caused by the mariadb-connector-c having some sort of incompatibility with MySQL when query cache is enabled (query cache is disabled by default in more recent versions of MySQL Server so maybe not a long-term issue). |
Solution is to set |
make it possible to link against mariadb-client instead of mysql
Description
Search explicit for libmariadb and mysql-header under include/mariadb/.
Additional added a test, to protect against using of mysql & mariadb at the same time
Motivation and Context
most distributions switch to mariadb, this follows up.
How Has This Been Tested?
tested on top of LibreELEC master with MariaDB 10.2 and MySQL 5.7 as sql-server.
test-cases:
reallife test on top of KRYTON (LE 8.2.2), is started.
Screenshots (if appropriate):
Types of change
Checklist: