Skip to content
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

Reusing data dir #1042

Open
xtianus opened this issue Oct 1, 2024 · 0 comments
Open

Reusing data dir #1042

xtianus opened this issue Oct 1, 2024 · 0 comments

Comments

@xtianus
Copy link

xtianus commented Oct 1, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant