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

Closing an HTreeMap instance also closes the associated DB instance #1020

Open
galfordliu opened this issue May 21, 2023 · 0 comments
Open

Comments

@galfordliu
Copy link

I encountered an unexpected behavior when using MapDB 3.0.9 .

According to the documentation and design of MapDB, closing an HTreeMap instance should not affect the associated DB instance. The HTreeMap should no longer be usable after its close method is called, but the associated DB instance should remain open and usable.

However, I observed that when I close an HTreeMap, the DB instance also gets closed. Specifically, after closing an HTreeMap, calling DB.getAllNames throws an exception indicating that the DB was closed.

Here's a snippet of the code that reproduces the problem:

DB db = DBMaker.memoryDB().make();
HTreeMap<String, String> map = db.hashMap("map").createOrOpen();

// use the map...
map.put("key", "value");

// close the map
map.close();

// this throws an exception, saying that the DB was closed
db.getAllNames();

This behavior does not align with the design of MapDB, and I believe it's a bug. The DB should remain open even after the associated HTreeMap is closed. Please kindly look into this issue. Thank you.

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