Reusing data dir
I'd like to reuse the data dir on multiple runs in order to keep my data.
Currently this can't be done because the DB.newEmbeddedDB() method always tries to initialize a new db in the data folder, which must be empty or I get the error
ch.vorburger.exec.ManagedProcess - : mariadb-install-db.exe: ERROR : Data directory C:\somefolder\mydata is not empty.
Only new or empty existing directories are accepted for --datadir
So I forked the repo and implemented a openEmbeddedDB() method
public static DB openEmbeddedDB(DBConfiguration config) throws ManagedProcessException {
DB db = new DB(config);
db.prepareDirectories();
return db;
}
but I still can't run the database on the same folder twice if I stop my java process with CTRL-C (on windows) because the mariadb.exe process is not stopped by the shutdown hooks and keeps running, preventing a restart of my application with the error
InnoDB: The data file './ibdata1' must be writable
as the mariadb.exe process locks ibdata1.
So I'm wondering if there's a way to reattach to an existing mariadb process that has been previously started. This may be a feature request I guess.
@xtianus Thank You for your interest in this library, and providing this feedback. Would you be interested to contribute a PR which does the needful for you?
#1042 sounds related BTW. Contributions to address this are welcome.
@xtianus @Muta-Jonathan I'm assuming that [your!] the (just) merged #1166 addressed this; please comment to re-open if you disagree.