-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Move hash->CBlockIndex BDB into its own database, blkhash.dat #1282
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
Conversation
Good idea. It's bad form to put different stuffs into one database table. |
Not sure whether an entirely separate file is better, or just a separate database within the same file (which bdb also supports). You'd need to implement cross-db transaction in the glue layer anyway before this is safe. |
Rebased on top of #1293 (BDB environment encapsulation) |
Updated to do cross-db transactions. |
This includes #1293 now? |
Yes, see comment above. |
If Reorganize() fails, then its caller, CBlock::SetBestChain(), will call TxnAbort(). Redundant TxnAbort() calls are harmless. The second will return an error return value, with no other side effects. TxnAbort() return values are generally never checked. The impact is nil.
Cleans up and organizes several scattered functions and variables related to the BDB env. Class CDBInit() existed to provide a guaranteed-via-C++-destructor cleanup of the db environment. A formal CDBEnv class provides all of this inside a single wrapper.
blkindex.dat stores all kinds of data, and as such, each key is overloaded to form a namespace. All keys beginning with "blockindex" form the hash->CBlockIndex data that is loaded into mapBlockIndex. This change moves mapBlockIndex data to its own database, custom tailored for the sort of data we wish to store: - BDB type changed from btree to hash - key is uint256 hash, with no prefixes Usage is cleaner, and uses slightly less CPU and disk space than the previous solution.
Closing -- about to reopen a similar but revised pull req. |
… chainparams c5a8adb [Core][Cleanup] Add IsRegTestNet() function in chainparams (random-zebra) Pull request description: This removes many explicit checks `Params().NetworkID() != CBaseChainParams::REGTEST` / `Params().NetworkID() == CBaseChainParams::REGTEST` making the code more readable. ACKs for top commit: Fuzzbawls: ACK c5a8adb Tree-SHA512: ce6373be461c1db87cd48e4046c0c7429a57253a9fbd52d649f65e7ddb0385d0cf87b81f0538b97521f663f8ad79fbcc68f5e2bdbd9ca339ae8599d3d1cc38a6
blkindex.dat stores all kinds of data, and as such, each key is overloaded to
form a namespace. All keys beginning with "blockindex" form the
hash->CBlockIndex data that is loaded into mapBlockIndex.
This change moves mapBlockIndex data to its own database, custom tailored for
the sort of data we wish to store:
Usage is cleaner, and uses slightly less CPU and disk space than the previous
solution.
COMPATIBILITY STATUS: A new block chain must be downloaded, or at least reindexed. As such, may want to delay this change, if other major database changes are planned.
MERGE STATUS: Ready for review and comment, but not ready for immediate upstreaming.