-
-
Notifications
You must be signed in to change notification settings - Fork 184
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
3.1.0 - "<path>" is not empty. Only new or empty existing directories are accepted for --datadir #926
Comments
Yeah, looks like the more recent MariaDB version has become "stricter" than the previous one...
But you could easily address this in your own code by first deleting that directory, no? (Or have I misunderstood the problem?) I likely won't myself be making any fix for this corner case. But if you would like to contribute a Pull Request with a "fix" for this (with test coverage), I would be happy to review it. |
@vorburger I am using the db persistently for the backend of a project so that would delete all the data if I understood it correctly, so no can't do that :/ |
Oh, right; I see. In that case, perhaps you would like to further debug what exactly is causing this? It seems a bit unlikely that this is a MariaDB bug, no? (I have not had a closer look.) Is MariaDB4j doing something wrong and e.g. calling mariadb-install-db.exe at a point in time when it should not? (That's just a hunch; I haven't looked at it closely.) Pull Request to change the start-up behavior to be correct for existing DB, if that's indeed the real problem here, would certainly be welcome. |
@vorburger you should be able to reproduce this by simply executing the program twice with the above code. Sorry I can't be much of a help, I directly reverted back the version since I need to work on this project at the moment and time is not really something I got much of currently :/ I may have time next week to look into this in more detail. |
I can recreate in a unit test on Windows. Linux does not exhibit the same behavior. Looking at comments here from 2019: https://mariadb.com/kb/en/mysql_install_dbexe/ It looks like the behavior at one point was to blow the entire directory away? I am wondering if a check got put in at some point to avoid that behavior. I have not had a chance to confirm in code yet. Investigating. |
Found it. So this got changed in June 2020. https://jira.mariadb.org/browse/MDEV-23052 Not a huge fan of how they merge branches into each other, it makes tracing the origin of this change a little difficult. If the installation failed for whatever reason, the data dir could be destroyed, so it looks like they decided to just avoid that issue altogether and force a clean directory on install. Looking at ways we could work around this on windows. |
Great, maybe even never versions of mariadb fix this issue? |
Unfortunately no, even on the latest 11.5, this is the behavior. |
This is a pretty weird issue especially since it's only on windows. What if the data dir is simply not set, where does the data get saved then? |
It will look in config files and then default to |
@TheKnowles Okay as long as that isnt a temp directory I am fine with that, since I don't see another workaround for this. |
The same issue would apply. The datadir is not empty (coming from a parameter or default) and it will kill the install. I need to investigate the upgrade code for windows a little more closely. MariaDB4j could check if the datadir is not empty and run upgrade instead of install. A cursory look at the upgrade code last week looked like it was very service/msi esque heavy. |
@TheKnowles that sounds like it could work! |
@TheKnowles any news? |
Worked fine in versions before 3.1.0 @vorburger , maybe due to mariadb update?
The text was updated successfully, but these errors were encountered: