Commit graph

37 commits

Author SHA1 Message Date
Calin Culianu
4c6cc629ca addBlock: fix to prevent redundant add/removal of txo's spent in same block 2019-12-09 10:04:30 +02:00
Calin Culianu
a61beb1f35 tweak 2019-12-09 01:11:34 +02:00
Calin Culianu
a749f16582 use robin hood flat map instead of set in compactifyUtxoSet 2019-12-08 23:48:58 +02:00
Calin Culianu
c6243c489d
some tweaks to conserve memory 2019-12-08 23:15:42 +02:00
Calin Culianu
cb2233c09e msg tweak when closing db and it's busy saving 2019-12-08 22:53:50 +02:00
Calin Culianu
8bb60fcb0d tweak 2019-12-08 22:48:48 +02:00
Calin Culianu
83e11bfd0b
Added some logic to cut down on cost of saving on first synch
On first synch we don't keep track of the difference set for the utxo
set. This should reduce memory consumption.  We just build the working
set.  After first save we then need to keep track of the difference set.

We also reduced the save interval to be infrequent -- every 500000
blocks.  This should also hopefully keep the controller task from
falling behind.

We do save on task end / ctrl-c though.
2019-12-08 22:31:17 +02:00
Calin Culianu
d982252adf nits 2019-12-08 22:16:52 +02:00
Calin Culianu
0c35c4a9fc
Added 'setSaveInterval' to specify save interval, redid backoff logic
The backoff logic on backlogs now favors the closer blocks to present
and delays the father away ones more.

Added the save interval as a programmable constant to storage.  We set
it to 100,000 on full downloads.
2019-12-08 22:07:01 +02:00
Calin Culianu
a9408e1bf6
Some tweaks for correctness and memory consumption + lru cache perf
- Added compactifyUtxoSet to periodically reduce all instances of dupe
QByteArrays to point to the same underlying shared object. This runs
every 33,000 blocks on synch.

- Merged the Hdr and UtxoSet save flags into a single flag, "Blocks"
which means they get saved together. This is crucial for correctness.
Before it could be the case that a different height would be saved for
headers vs utxo set because of the way it worked.

- made the two lru caches try and keep the same key/value pairs
(hopefully shared copies)

- made the LRU::Cache class not use an exception internally on tryGet()
-- this seems to have a positive impact on performance as this function
is called a lot.  Instead, it calls into an internal common function now
called get_nolock_nothrow, upon which everything else is based.

It appears these efforts have reduced memory consumption a bit.  Our
UTXOSet is still pretty heavy.  More work to be done...
2019-12-08 17:21:39 +02:00
Calin Culianu
509a7253c7 testing 2019-12-08 11:45:57 +02:00
Calin Culianu
8e4bed2817 more stabs at rocksdb memory usage 2019-12-08 05:20:40 +02:00
Calin Culianu
00d8139032 tweaks to rocksdb in an attempt to reduce memory usage 2019-12-08 05:02:46 +02:00
Calin Culianu
56dcd08781 reduced lru cache elasticity size in storage.cpp 2019-12-08 03:45:45 +02:00
Calin Culianu
ae3321f882 nit 2019-12-08 03:06:36 +02:00
Calin Culianu
de3f9716d9 added lru cache shrink method 2019-12-08 02:55:45 +02:00
Calin Culianu
96b3b49748 added lru cache for txhash, misc other fixes 2019-12-08 02:36:46 +02:00
Calin Culianu
22b477b34e wip utxo set load 2019-12-08 01:00:40 +02:00
Calin Culianu
8b3f67cd32 wip 2019-12-07 23:30:07 +02:00
Calin Culianu
fa504bd6fb wip 2019-12-07 20:34:19 +02:00
Calin Culianu
ae753e22fc
Refactor the chaintip/chainheight stuff into a single call in the storage
Just a little bit cleaner...
2019-12-07 15:54:56 +02:00
Calin Culianu
c2c17f5e36 nits 2019-12-03 22:47:03 +02:00
Calin Culianu
7f6d025be2 nit: made GetBlockHeaderSize() return int because that's more useful to us 2019-12-03 21:53:32 +02:00
Calin Culianu
c0184427d2 nits 2019-12-03 21:48:10 +02:00
Calin Culianu
8d65e77e2a nits 2019-12-03 19:52:46 +02:00
Calin Culianu
48e5f116d8
More nits in Storage.cpp and other places 2019-12-03 19:09:38 +02:00
Calin Culianu
1d1b681523 nits 2019-12-03 16:02:53 +02:00
Calin Culianu
69f15fa5a4 comment nit 2019-12-03 15:59:36 +02:00
Calin Culianu
4bb5eb0949 wip 2019-12-03 15:41:09 +02:00
Calin Culianu
4d1c7f91ea wip 2019-12-03 13:57:02 +02:00
Calin Culianu
dfaa36cc13
DB format change: added SerializeScalar/DeserializeScalar
This is to support writing raw ints directly to db keys / db values as a
space saving measure.  QDataStream, while platform neutral, adds its own
marker/size bytes to the serialization which we do not need always.

Our DB format is now endian and architecture-specific, but that's ok.
Users can resynch if they switch machine architectures.
2019-12-03 06:38:19 +02:00
Calin Culianu
eeb32a43ec Tweak 2019-12-01 01:20:37 +02:00
Calin Culianu
a7293a9939
Potential bug fixed: Added protection from connecting to wrong bitcoind
We now save the "chain" variable to the meta table.  We also panic if
the headers we are reading from bitcoind are behind what we have (todo:
handle this elegantly if there actually was a reorg?)
2019-11-30 01:33:27 +02:00
Calin Culianu
5842c44a79
Nits, refactorings + added shared HeaderVerifier that lives in Storage 2019-11-30 00:42:33 +02:00
Calin Culianu
b1f5eadb67 nit 2019-11-29 17:15:06 +02:00
Calin Culianu
68eebb00f9
Fixed up a few things, made header save resume from last save pt
And misc. other nits and refactorings in Storage.cpp
2019-11-29 17:11:33 +02:00
Calin Culianu
46b670d813 storage wip 2019-11-29 14:42:17 +02:00