Comments (5)
Hi! In what way isn't it working right? Do you have a complete test-case we can try?
from lmdbxx.
The code I wrote above is the one I tired. Could be that I am doing something wrong. The data file on the hard disk does not grow bigger. If I use database handle to write into database 1000000 records the file size is about 20 MB, while if I use cursor_put with 1000000 records and flag MDB_MULTIPLE I get an data file of 12KB, and it is empty when I try and read it. I use the three functions below to test it. Before calling each function I close the application.
I guess the repro steps would be:
- Create database One at first directory.
- Write 1000000 ints into it using databasehandle.put.
- Observe the database size.
- Read the data from the database.
- Create database Two at second directory.
- Write 1000000 ints into it using cursor_put and MDB_MULTIPLE
- Notice that database size is different
- On reading data base it appears to be empty.
I will also attach the functions I use to do this below again it could be just miss usage due to me not understanding something.
LMDB_TESTS.txt
from lmdbxx.
- You don't call
wtxn.commit()
incursorPut()
so nothing is actually committed - Once you fix that, I don't think this line is doing what you think:
std::vector rawData(1000000, std::rand());
All the elements in the array will contain the same value, so you are setting the same key/value over and over again. Try putting this line after that to ensure they are all different values:
for (size_t i = 0; i < rawData.size(); i++) rawData[i] = (int)i;
- Not related, but
*index
after this will likely result in unaligned memory access:
const mdb_size_t* index = reinterpret_cast<mdb_size_t*>(key.data());
... which may or may not matter depending on your processor. An easier approach is described in my C++17 fork of lmdbxx which I suggest you check out since this one isn't maintained: https://github.com/hoytech/lmdbxx/
from lmdbxx.
Hi, thank you for your time. It works now and I will use the C++ 17 fork going forward.
Again, I am sorry I had to bother you with it next time I will be more careful what I am doing.
from lmdbxx.
Don't worry about it, I'm glad you got it working.
from lmdbxx.
Related Issues (20)
- How to get an specific value with lmdb++ HOT 3
- Allow copying of lmdb::dbi instances HOT 2
- Feature Request: remove dependency on pthreads? HOT 4
- How can I save '0' ? HOT 2
- Symbol mdb_env_create() doesn't resolve HOT 1
- No updating value when key exists HOT 1
- Example uses the same dbi instance with a different transaction HOT 2
- Could you tag a new release? HOT 1
- Cursor double free on write tx HOT 1
- I forked this repo for C++17
- mdb_del : Invalid argument for simple deletion HOT 9
- Cursor.get returns key and value concatenated into key variable HOT 10
- Double-free when txn.commit() throws
- Merge into lmdb HOT 5
- problem in lmdb++.h line 1654 HOT 1
- Delete MacPorts Portfile HOT 1
- Querying for different types in key/value pair HOT 1
- thread-local storage is not supported for clang7 HOT 1
- Enhance error messages in exceptions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lmdbxx.