Skip to content
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

Upgrade confirmation height table to include cemented frontier #2481

Merged
merged 7 commits into from
Jan 16, 2020

Conversation

wezrule
Copy link
Contributor

@wezrule wezrule commented Jan 14, 2020

This is a preparation step for a confirmation height redesign I am doing. I'm modifying the confirmation height table to also include the hash at that height (cemented frontier). Currently the confirmation height processor starts from a hash in a chain and works downwards until it hits the first cemented block, because there's no other way to reach it. Then it starts traversing the bottom and cementing those blocks. This works fine when storing the receive blocks as we iterate, but this can lead to a lot of memory being used if long chains are traversed and it doesn't scale. It also doesn't play nicely with a bounded memory algorithm, because we would be wasting a lot of read IO traversing accounts many times from the top. I want to start from the bottom (cemented frontier) and work upwards, this limits waste and also cements the bottom most blocks quicker. To do this I need to know what the block hash is at that height though, which is what I am now storing.

Updated some conf heights tests which used multiple nodes, to just use 1 which makes debugging simpler.

Upgrade, this was from a v14 ledger (Edit: Outdated as we now use v17) (I left the later portion of the logs from v14 -> v15 at the top):

[2020-Jan-15 11:27:57.090806]: Database epoch merge upgrade 22 million state blocks upgraded
[2020-Jan-15 11:28:15.294133]: Epoch merge upgrade: Finished state blocks, now doing pending blocks
[2020-Jan-15 11:29:20.603369]: Finished epoch merge upgrade. Preparing vacuum...
[2020-Jan-15 11:29:21.295422]: Preparing v15 to v16 upgrade...
[2020-Jan-15 11:30:13.381820]: Confirmation height frontier set for 200k accounts
[2020-Jan-15 11:31:02.586240]: Confirmation height frontier set for 400k accounts
[2020-Jan-15 11:32:20.382162]: Confirmation height frontier set for 600k accounts
[2020-Jan-15 11:32:57.744189]: Confirmation height frontier set for 800k accounts
[2020-Jan-15 11:33:31.488086]: Confirmation height frontier set for 1000k accounts
[2020-Jan-15 11:34:01.524724]: Finished upgrading confirmation height frontiers
[2020-Jan-15 11:36:36.047500]: Vacuum succeeded.

@wezrule wezrule added documentation This item indicates the need for or supplies updated or expanded documentation rpc nonbreaking change blocker Some future items cannot be completed until this is merged. database structure If the database changes it needs updating in the nanodb repository labels Jan 14, 2020
@wezrule wezrule added this to the V21.0 milestone Jan 14, 2020
@wezrule wezrule self-assigned this Jan 14, 2020
@zhyatt zhyatt requested a review from clemahieu January 14, 2020 15:15
nano/node/lmdb/lmdb.cpp Outdated Show resolved Hide resolved
cryptocode
cryptocode previously approved these changes Jan 15, 2020
cryptocode
cryptocode previously approved these changes Jan 15, 2020
@wezrule wezrule merged commit 31d3026 into nanocurrency:develop Jan 16, 2020
@wezrule wezrule deleted the upgrade_db_cemented_frontier branch January 16, 2020 19:18
wezrule added a commit to wezrule/raiblocks that referenced this pull request Jan 22, 2020
…urrency#2481)

* Upgrade confirmation height table to include cemented frontier

* Stein review comments

* Add //clang-format block around lambda

* Update comment (thanks Gui)

* Upgrade to v17 instead

* Update comments
wezrule added a commit to wezrule/raiblocks that referenced this pull request Jan 22, 2020
…urrency#2481)

* Upgrade confirmation height table to include cemented frontier

* Stein review comments

* Add //clang-format block around lambda

* Update comment (thanks Gui)

* Upgrade to v17 instead

* Update comments
wezrule added a commit that referenced this pull request Jan 24, 2020
* Node telemetry

* Add genesis block

* Don't checkif at the end of the stream with UDP to support compatibility with different message versions

* Add single request and optional blocking

* Formatting

* Use nano locks

* Fix clang build

* Out of date comments

* Update some names of classes/functions/variables

* Fix for disconnected peer channels & some cleanup

* Remove unnecessary lock requirement in active_transactions::lock. (#2475)

* Remove unnecessarry lock requirement in active_transactions::lock.
This also removes some code-smell around passing in a bool to determine if the lock should actually be acquired.

* Using a timeout counter in line with other test idioms.

* Confirmation solicitor revamp (#2472)

* Optional minimum version when querying representatives from crawler

* Revamping confirmation_solicitor to mimick previous active_transactions behavior

* Use a time-based approach to throttle confirmation requests and block flooding

* Addressing Wesley review

* Remove unusued node.hpp include (thanks wes)

* Simplify logic by using unordered_map::operator[] which calls the default constructor if not found

* Split solicitor add into broadcast+add and bring back the logic to  active_transactions

This brings back rate-limitting logic and modifying election variables to active_transactions only. Timings are also slightly adjusted:

- Only 2 requests required before starting to flood blocks
- Timings for test network

* Rename flag

* Only broadcast OR request confirmation in the same loop for the same election

* Enclose lambda in clang-format off

* Beta network reset #2 (#2476)

* Delete rep_weights_beta.bin

* New genesis

* Change header_magic_number to one never used before

* use v1.1 for actions-aws-cli (#2486)

* The start of CLI tests (#2403)

* The start of CLI tests

* Add needed header file after merge

* Serg review comments

* Websocket bootstrap subscription (#2471)

* Bootstrap attempt ID
* Websocket bootstrap subscription

* Change processed blocks factor for requeued pulls (#2437)

From `processed blocks / 10000` to `processed blocks / 4096` for better processing of largest chains in case of failures

* Upgrade confirmation height table to include cemented frontier (#2481)

* Upgrade confirmation height table to include cemented frontier

* Stein review comments

* Add //clang-format block around lambda

* Update comment (thanks Gui)

* Upgrade to v17 instead

* Update comments

* Request aggregator (#2485)

* Request aggregator

Adds a class that runs in a new thread to pool confirmation requests by endpoint.
This allows a reduction of bandwidth, vote generation, and moves some vote generation out of the I/O threads.

* Use a constant for confirm_ack_hashes_max

* Small code simplification

* Use const transaction

* Disable clang-format for lambdas

* Add missing deadlines and update deadline before poll block

* Use a scoped lock_guard pattern and initialize start in-class

* Misc. fixes and documentation

* use clang-format-8 (#2490)

There is some funkiness with clang-format-9 and lambdas that are not
honored

* Formatting fix so clangformat 8 applies cleanly (#2491)

* Support multiple work peers in the same host (#2477)

* Correct check for peers when creating work

* Support multiple work peers in the same address

* Send cancels despite errors to account for non-conforming implementations

* Add tests using a fake work peer, acting as good, malicious or slow

* Comment

* Formatting

* Fix multiple response error in RPC

* Formatting

* Add extra error handling when specifying port and not address with the RPC (and vice versa)

* Formatting

* Serg comments

* Formatting

* Mask not needed

* Missed file check in for mask removal

* Fix test failures

* Gui suggestions

* Formatting

* Fix assert with test on Windows and some cleanup

* Lower number of nodes in node_telemetry.many_nodes when using sanitizers

Co-authored-by: clemahieu <clemahieu@gmail.com>
Co-authored-by: Guilherme Lawless <guilherme.lawless@gmail.com>
Co-authored-by: Russel Waters <vaelstrom@gmail.com>
Co-authored-by: Sergey Kroshnin <sergiysw@gmail.com>
Co-authored-by: cryptocode <stein@nano.org>
@zhyatt zhyatt added rpc Changes related to Remote Procedure Calls and removed rpc nonbreaking change labels Mar 17, 2020
@zhyatt zhyatt removed the blocker Some future items cannot be completed until this is merged. label Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database structure If the database changes it needs updating in the nanodb repository documentation This item indicates the need for or supplies updated or expanded documentation rpc Changes related to Remote Procedure Calls
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants