Closed lfoppiano closed 7 years ago
For the issue 1, I think the problem comes when I open the transaction before opening the database (in both single and multi-thread). Does this make sense?
Always open Env and Database as the application starts and keep them open. You maintain consistency by using the same transaction for both databases.
If you need multi-threading and sharing same transaction you need to set the NO_TLS option.
Never close Env or Database before an open transaction, or you will get a SIGSEGV.
Thanks! The transaction is not shared among threads, it's created/destroyed within the method, so it's good like that.
Are this information somewhere in the documentation? If not I can help you updating it ;-)
The lmdb documentation is valid for lmdbjni aswell.
INFO: org.fusesource.lmdbjni.LMDBException: Invalid argument Am getting this exception while setting maxreaders in LMDBJNI...
Env env = new Env(); env.open(LMDB_DIR); env.setMaxReaders(150); db = env.openDatabase("sub");
Env is created and initialized in the given path.. But I cannot set maxreaders in LMDBJNI as exception arises. If I skip setting maxreaders, then also am getting exception
org.fusesource.lmdbjni.LMDBException:MDB_READERS_FULL : Environment maxreaders limit reached at org.fusesource.lmdbjni.Util.checkErrorCode at org.fusesource.lmdbjni.Env.createTransaction at org.fusesource.lmdbjni.Env.createReadTransaction at org.fusesource.lmdbjni.Database.get(Database.java:170)
Kindly resolve this issue as this is banging my head for more than a week... Since am new to java programming... Thanks in advance
@Johny-Kirth it's perhaps recommended to use https://github.com/lmdbjava/lmdbjava instead.
Which exception do you get when setting the max readers?
@Johny-Kirth it's perhaps recommended to use https://github.com/lmdbjava/lmdbjava instead.
Which exception do you get when setting the max readers?
INFO: org.fusesource.lmdbjni.LMDBException: Invalid argument Sep 23, 2019 7:31:29 PM com.adventnet.wms.servercommon.logging.ConsoleLogger write INFO: at org.fusesource.lmdbjni.Util.checkErrorCode(Util.java:44) Sep 23, 2019 7:31:29 PM com.adventnet.wms.servercommon.logging.ConsoleLogger write INFO: at org.fusesource.lmdbjni.Env.setMaxReaders(Env.java:347)
I have two databases attached to the same
Env
:relations
andlookup
, I need to first fetch the values from the lookup (key -> List of ids) and then use the ids to fetch fromrelations
another list of IDs.I wrote the transaction in the external
try-with-resources
because I want to keep the same consistency for the twoget
, however I'm fetching data from two differentdatabases
.Here the piece of code:
When I run it singe or multi-thread, the behaviour is a bit strange. The database is not written from other processes.
I tried several approaches, but I could not really understand whether I'm doing something wrong (not closing resources) or there is any other problems.
byte[] value = lookupDB.get(tx, serialisedIdentifier);
I get the following exception (pointing at the line where theget
is called):Any idea, suggestion?
Thank you in advance