Writing to LMDB failed

I tried to write data to the lmdb database (referenced caffe / tools / convert_imageset.cpp). There were no errors in the console, but the .mdb file size remains equal to zero. If no data is written to the file, a data and lock file is created. Part of the code I tried is:

scoped_ptr<db::DB> db(db::GetDB("lmdb"));
db->Open(argv[3], db::NEW);
scoped_ptr<db::Transaction> txn(db->NewTransaction());

datum.SerializeToString(&out);
txn->Put(key1, out);
txn->Commit();

I could not understand if something was missing. Any links to how LMBD works will be helpful.

+4
source share
1 answer

Before calling, Putmake sure the key is not empty.
You can use mdb_dumpand print the contents of the database.

+1
source

Source: https://habr.com/ru/post/1620930/


All Articles