aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/berkeleydb/db_bdb.h
Commit message (Collapse)AuthorAgeFilesLines
* Removed Berkeley DB and db switching logicJesus Ramirez2019-09-161-452/+0
|
* testdb: add override keyword where missingstoffu2019-04-171-1/+0
| | | | and delete obsolete BlockchainBDB::get_tx_output_indices along the way
* Update 2019 copyrightbinaryFate2019-03-051-1/+1
|
* blockchain_db: remove a couple unused functionsmoneromooo-monero2018-12-051-18/+0
|
* v8: per byte fee, pad bulletproofs, fixed 11 ring sizemoneromooo-monero2018-09-111-3/+3
|
* blockchain_db: remove unused get_output_key variantmoneromooo-monero2018-07-301-1/+1
| | | | It was actually incorrect, as it would not return commitment
* add --regtest and --fixed-difficulty for regression testingvictorsintnicolaas2018-06-291-0/+2
| | | | | | | on_generateblocks RPC call combines functionality from the on_getblocktemplate and on_submitblock RPC calls to allow rapid block creation. Difficulty is set permanently to 1 for regtest. Makes use of FAKECHAIN network type, but takes hard fork heights from mainchain Default reserve_size in generate_blocks RPC call is now 1. If it is 0, the following error occurs 'Failed to calculate offset for'. Queries hard fork heights info of other network types
* db_lmdb: save pruned and prunable tx data separatelymoneromooo-monero2018-05-231-2/+2
| | | | This bumps DB version to 2, migration code will run for v1 DBs
* Update 2018 copyrightxmr-eric2018-01-261-1/+1
|
* move includes around to lessen overall loadmoneromooo-monero2017-12-161-1/+1
|
* update copyright year, fix occasional lack of newline at line endRiccardo Spagni2017-02-211-1/+1
|
* Use batch transactions when syncingHoward Chu2017-01-141-1/+1
| | | | | Faster throughput while avoiding corruption. I.e., makes running with --db-sync-mode safe more tolerable.
* core: faster find_blockchain_supplementmoneromooo-monero2016-08-311-1/+1
| | | | | | | | | | | | | Since this queries block heights for blocks that may or may not exist, queries for non existing blocks would throw an exception, and that would slow down the loop a lot. 7 seconds to go through a 30 hash list. Fix this by adding an optional return block height to block_exists and using this instead. Actual errors will still throw an exception. This also cuts down on log exception spam.
* move the rct commitments to the output_amounts databasemoneromooo-monero2016-08-281-1/+1
| | | | | | | | | | | | | | | | | | | Since these are needed at the same time as the output pubkeys, this is a whole lot faster, and takes less space. Only outputs of 0 amount store the commitment. When reading other outputs, a fake commitment is regenerated on the fly. This avoids having to rewrite the database to add space for fake commitments for existing outputs. This code relies on two things: - LMDB must support fixed size records per key, rather than per database (ie, all records on key 0 are the same size, all records for non 0 keys are same size, but records from key 0 and non 0 keys do have different sizes). - the commitment must be directly after the rest of the data in outkey and output_data_t.
* remove hf_starting_height dbmoneromooo-monero2016-07-131-2/+0
| | | | | | It's not really needed, it used to be an optimization for when that code was not using the db and needed to recalculate things fast on startup.
* New RPC and daemon command to get output histogrammoneromooo-monero2016-03-261-0/+9
| | | | | | | | | | | | | | | | | This is a list of existing output amounts along with the number of outputs of that amount in the blockchain. The daemon command takes: - no parameters: all outputs with at least 3 instances - one parameter: all outputs with at least that many instances - two parameters: all outputs within that many instances The default starts at 3 to avoid massive spamming of all dust outputs in the blockchain, and is the current minimum mixin requirement. An optional vector of amounts may be passed, to request histogram only for those outputs.
* Use boost::thread instead of std::threadHoward Chu2016-03-111-4/+4
| | | | and all other associated IPC
* Merge pull request #686Riccardo Spagni2016-02-291-1/+1
|\ | | | | | | | | | | | | | | 7db89ed ARMv7: fix unaligned accesses (Howard Chu) 5a07cef Wrap some more actions in a larger read txn (Howard Chu) 8cc7a36 read txn/cursor stuff (Howard Chu) 86a7f2b core: check whether an update is needed straight away (moneromooo-monero) ea5fa5e core: print "update needed" hard fork notifications in red (moneromooo-monero)
| * read txn/cursor stuffHoward Chu2016-02-231-1/+1
| | | | | | | | Could wrap more later.
* | db_bdb: add missing include for std::condition_variablemoneromooo-monero2016-02-201-0/+1
|/
* BlockchainDB/LMDB/BDB: Extract DB txn functions for block add/removewarptangent2016-02-081-0/+4
|
* blockchain_import: Add --drop-hard-fork commandwarptangent2016-02-081-0/+1
|
* Fix hf when import with verify offHoward Chu2016-01-151-0/+1
| | | | Delete the hf tables, so the next open will rescan and regenerate
* fixed copyrights with bad year referencesRiccardo Spagni2015-12-311-1/+1
|
* BlockchainDB: skip fixup check if read-only databasewarptangent2015-12-261-0/+3
|
* Replace tabs with two spaces for consistency with rest of codebasewarptangent2015-12-151-14/+14
| | | | Remove trailing whitespace in same files.
* blockchain_db: fixup missing key images in early DB versionmoneromooo-monero2015-12-061-0/+4
| | | | | | | | | | | Early DB versions did not store key images for inputs if the transaction spending them had no outputs (ie, all fee). This is not correct, as this would allow these outputs to be double spent. This was fixed in 533acc30eda7792c802ea8b6417917fa99b8bc2b a few months ago, but databases having synced blocks 2021612 and 685498 with a faulty version will be missing those key images in the spent keys database. This code checks for this, and adds those key images if they are missing.
* blockchain_db: make the indexing base a BlockchainDB virtual functionmoneromooo-monero2015-12-051-0/+2
|
* Remove some old/obsolete/unused codemoneromooo-monero2015-10-271-12/+0
| | | | git history's here if needed to get any of this back
* db_bdb: add versioning, to detect incompatible format changesmoneromooo-monero2015-10-261-0/+2
|
* Add functions to iterate through blocks, txes, outputs, key imagesmoneromooo-monero2015-10-251-0/+5
|
* hardfork: most state now saved to the DBmoneromooo-monero2015-09-201-0/+10
| | | | | There will be a delay on first load of an existing blockchain as it gets reparsed for this state data.
* blockchain: always select random outs using triangular distributionmoneromooo-monero2015-08-091-2/+0
| | | | | | | It was only used by the older blockchain_storage. We also move the code to the calling blockchain level, to avoid replicating the code in every DB implementation. This also makes the get_random_out method obsolete, and we delete it.
* ** CHANGES ARE EXPERIMENTAL (FOR TESTING ONLY)NoodleDoodleNoodleDoodleNoodleDoodleNoo2015-07-151-10/+162
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bockchain: 1. Optim: Multi-thread long-hash computation when encountering groups of blocks. 2. Optim: Cache verified txs and return result from cache instead of re-checking whenever possible. 3. Optim: Preload output-keys when encoutering groups of blocks. Sort by amount and global-index before bulk querying database and multi-thread when possible. 4. Optim: Disable double spend check on block verification, double spend is already detected when trying to add blocks. 5. Optim: Multi-thread signature computation whenever possible. 6. Patch: Disable locking (recursive mutex) on called functions from check_tx_inputs which causes slowdowns (only seems to happen on ubuntu/VMs??? Reason: TBD) 7. Optim: Removed looped full-tx hash computation when retrieving transactions from pool (???). 8. Optim: Cache difficulty/timestamps (735 blocks) for next-difficulty calculations so that only 2 db reads per new block is needed when a new block arrives (instead of 1470 reads). Berkeley-DB: 1. Fix: 32-bit data errors causing wrong output global indices and failure to send blocks to peers (etc). 2. Fix: Unable to pop blocks on reorganize due to transaction errors. 3. Patch: Large number of transaction aborts when running multi-threaded bulk queries. 4. Patch: Insufficient locks error when running full sync. 5. Patch: Incorrect db stats when returning from an immediate exit from "pop block" operation. 6. Optim: Add bulk queries to get output global indices. 7. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3) 8. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key 9. Optim: Added thread-safe buffers used when multi-threading bulk queries. 10. Optim: Added support for nosync/write_nosync options for improved performance (*see --db-sync-mode option for details) 11. Mod: Added checkpoint thread and auto-remove-logs option. 12. *Now usable on 32-bit systems like RPI2. LMDB: 1. Optim: Added custom comparison for 256-bit key tables (minor speed-up, TBD: get actual effect) 2. Optim: Modified output_keys table to store public_key+unlock_time+height for single transaction lookup (vs 3) 3. Optim: Used output_keys table retrieve public_keys instead of going through output_amounts->output_txs+output_indices->txs->output:public_key 4. Optim: Added support for sync/writemap options for improved performance (*see --db-sync-mode option for details) 5. Mod: Auto resize to +1GB instead of multiplier x1.5 ETC: 1. Minor optimizations for slow-hash for ARM (RPI2). Incomplete. 2. Fix: 32-bit saturation bug when computing next difficulty on large blocks. [PENDING ISSUES] 1. Berkely db has a very slow "pop-block" operation. This is very noticeable on the RPI2 as it sometimes takes > 10 MINUTES to pop a block during reorganization. This does not happen very often however, most reorgs seem to take a few seconds but it possibly depends on the number of outputs present. TBD. 2. Berkeley db, possible bug "unable to allocate memory". TBD. [NEW OPTIONS] (*Currently all enabled for testing purposes) 1. --fast-block-sync arg=[0:1] (default: 1) a. 0 = Compute long hash per block (may take a while depending on CPU) b. 1 = Skip long-hash and verify blocks based on embedded known good block hashes (faster, minimal CPU dependence) 2. --db-sync-mode arg=[[safe|fast|fastest]:[sync|async]:[nblocks_per_sync]] (default: fastest:async:1000) a. safe = fdatasync/fsync (or equivalent) per stored block. Very slow, but safest option to protect against power-out/crash conditions. b. fast/fastest = Enables asynchronous fdatasync/fsync (or equivalent). Useful for battery operated devices or STABLE systems with UPS and/or systems with battery backed write cache/solid state cache. Fast - Write meta-data but defer data flush. Fastest - Defer meta-data and data flush. Sync - Flush data after nblocks_per_sync and wait. Async - Flush data after nblocks_per_sync but do not wait for the operation to finish. 3. --prep-blocks-threads arg=[n] (default: 4 or system max threads, whichever is lower) Max number of threads to use when computing long-hash in groups. 4. --show-time-stats arg=[0:1] (default: 1) Show benchmark related time stats. 5. --db-auto-remove-logs arg=[0:1] (default: 1) For berkeley-db only. Auto remove logs if enabled. **Note: lmdb and berkeley-db have changes to the tables and are not compatible with official git head version. At the moment, you need a full resync to use this optimized version. [PERFORMANCE COMPARISON] **Some figures are approximations only. Using a baseline machine of an i7-2600K+SSD+(with full pow computation): 1. The optimized lmdb/blockhain core can process blocks up to 585K for ~1.25 hours + download time, so it usually takes 2.5 hours to sync the full chain. 2. The current head with memory can process blocks up to 585K for ~4.2 hours + download time, so it usually takes 5.5 hours to sync the full chain. 3. The current head with lmdb can process blocks up to 585K for ~32 hours + download time and usually takes 36 hours to sync the full chain. Averate procesing times (with full pow computation): lmdb-optimized: 1. tx_ave = 2.5 ms / tx 2. block_ave = 5.87 ms / block memory-official-repo: 1. tx_ave = 8.85 ms / tx 2. block_ave = 19.68 ms / block lmdb-official-repo (0f4a036437fd41a5498ee5e74e2422ea6177aa3e) 1. tx_ave = 47.8 ms / tx 2. block_ave = 64.2 ms / block **Note: The following data denotes processing times only (does not include p2p download time) lmdb-optimized processing times (with full pow computation): 1. Desktop, Quad-core / 8-threads 2600k (8Mb) - 1.25 hours processing time (--db-sync-mode=fastest:async:1000). 2. Laptop, Dual-core / 4-threads U4200 (3Mb) - 4.90 hours processing time (--db-sync-mode=fastest:async:1000). 3. Embedded, Quad-core / 4-threads Z3735F (2x1Mb) - 12.0 hours processing time (--db-sync-mode=fastest:async:1000). lmdb-optimized processing times (with per-block-checkpoint) 1. Desktop, Quad-core / 8-threads 2600k (8Mb) - 10 minutes processing time (--db-sync-mode=fastest:async:1000). berkeley-db optimized processing times (with full pow computation) 1. Desktop, Quad-core / 8-threads 2600k (8Mb) - 1.8 hours processing time (--db-sync-mode=fastest:async:1000). 2. RPI2. Improved from estimated 3 months(???) into 2.5 days (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000). berkeley-db optimized processing times (with per-block-checkpoint) 1. RPI2. 12-15 hours (*Need 2AMP supply + Clock:1Ghz + [usb+ssd] to achieve this speed) (--db-sync-mode=fastest:async:1000).
* Experimental BDB workaround optimizationsNoodleDoodleNoodleDoodleNoodleDoodleNoo2015-07-151-0/+3
|
* Optionally allow DB to know expected number of blocks at batch transaction startwarptangent2015-07-111-1/+1
| | | | This will assist in a DB resize check.
* blockchain_db: add a few constmoneromooo-monero2015-05-271-1/+1
|
* Steps toward multiple dbs available -- workingThomas Winget2015-03-251-3/+0
| | | | | | | | | | | There will need to be some more refactoring for these changes to be considered complete/correct, but for now it's working. new daemon cli argument "--db-type", works for LMDB and BerkeleyDB. A good deal of refactoring is also present in this commit, namely Blockchain no longer instantiates BlockchainDB, but rather is passed a pointer to an already-instantiated BlockchainDB on init().
* BerkeleyDB implementation of BlockchainDB seems to be working!Thomas Winget2015-03-171-2/+4
|
* BerkeleyDB Blockchain building, not working yetThomas Winget2015-03-161-2/+4
| | | | | | | | | | Everything except actually *using* BlockchainBDB is wired up, but the db itself is not yet working. Some error about user mem not large enough. I think I know what this error means, but I can't determine the cause. Notes: BerkeleyDB does not allow 0-indexing in its recno type databases, so block numbers *in the database* will be 1-indexed. Modifications to indexing have been made as needed.
* BerkeleyDB BlockchainDB impl copy/paste/modifyThomas Winget2015-03-161-3/+77
| | | | | | LMDB implementation code copy/paste/modified into the Berkeley DB implementation. Need to test if it builds, then if it works, and so on, but the code is all there.
* Initial commit of BDB BlockchainDB implementationThomas Winget2015-03-161-0/+213
Basically verbatim copy of LMDB implementation, but with the guts ripped out and includes changed, etc.