-
Notifications
You must be signed in to change notification settings - Fork 83
Use lmdb database in picocoin #92
base: master
Are you sure you want to change the base?
Conversation
1 similar comment
1 similar comment
Hi, Given the preference expressed in PR #96 to using normal autoconf toolage for linking to external libraries rather than importing a tree / adding a git subtree into the codebase I assume this PR in its current form is not a good idea. |
@aido It's a balance. As a first step we should link externally. If the library proves consensus critical, or versioning through OS proves problematic, we can look at moving in-tree via git subtree or code import. libevent is stable across most modern OS's. lmdb might(?) be different. First step would be to link against external lmdb and change the picocoin code to use lmdb. |
OK Jeff, I'll leave this PR open and play around with it a bit to see if LMDB is a good choice. LMDB allows for the creation of multiple sub-databases so I am thinking of setting up the following sub-databases within a main mainnet/testnet database.
Experimentation going well here: https://github.com/aido/picocoin/tree/liblmdb_test |
2 similar comments
2 similar comments
Looking good so far! |
Yes, it;s coming along nicely. LMDB seems to be quite suitable as a DB choice. I see GitHub has a handy code review feature for each commit to a pull request so feel free to add constructive criticism if it is needed. |
Hi @jgarzik, The latest commit adds a blockheightdb to speed up rebuilding of blkdb on startup. Some of the OSX builds are failing on Travis. Travis builds fail if no output is received in 10 minutes. The blockfile test requires ~228,000 block headers to be loaded into the blockheightdb (193,000 mainnet + ~35,000 testnet). This is taking slightly more than 10 minutes on OSX due mostly to the fact that the Travis OSX VMs are painfully slow compared to the Linux VMs. There is a Travis workaround for this but it is not ideal and will probably cause the build to fail for other reasons anyway. Also, a couple of things I've noticed while testing, not really related to this PR. |
5510a7a
to
f07237d
Compare
1 similar comment
2 similar comments
Hi, The purpose of this pull request is to introduce LMDB databases to picocoin. So in that regard this PR is now complete (although it may still need some tidying up). Travis OSX VMs are really slow at best and sometimes really, really slow. When they are really, really slow some Travis builds timeout, fail and need to be restarted. That is why some of the Travis builds of the most recent commit have failed. These will need to be restarted when Travis OSX is not running really, really slow. |
2 similar comments
2 similar comments
include/ccoin/db/db.h
Outdated
}; | ||
|
||
enum { | ||
MAX_DB_SIZE = 67108864 // Maximum database size in bytes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MAX_DB_SIZE should be set to a more realistic valiue e.g. 17179869184
This will help speed up regenerating blkdb on startup
Speeds up testing a tad. Mainnet headers reduced from 193000 headers to 50000. Testnet headers reduced from 35141 headers to 25000
…nstead of from file Also rename blkdb database to chaindb to avoid confusion with LMDB blockdb
1 similar comment
Taking a fresh look at all the pull requests. Concept ACK -- lmdb is proving to be superior in other projects, so it makes sense to pull it into picocoin as well. |
Hi,
This pull request is the first step in introducing a simple and lightweight key-value database to picocoin:
https://symas.com/products/lightning-memory-mapped-database/
LMDB is written in C, extremely high performance and memory-efficient. It is used in other crypto currency projects such as Monero so seems like a good fit for picocoin.
Along with some other handy features LMDB can have multiple sub-databases. I haven't thought things out fully yet but blkdb could possibly be stored as a sub-database with the blockchain as another sub-database or collection of sub-databases, performance permitting.
This would add another building block to make it easier to use libccoin to build a full node if someone so wishes.