Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Support resuming fast-sync downloads #848

Merged
merged 5 commits into from
Feb 13, 2019

Conversation

ajsutton
Copy link
Contributor

@ajsutton ajsutton commented Feb 13, 2019

PR description

Support resuming fast sync downloads.

When download world state data, skip requesting data that we already have in our local store. To ensure we have all the child nodes continue traversing the trie. Net result is that we still walk the entire trie but only download data we don't already have.

When shutting down Pantheon, don't delete the fast sync data

When starting up, don't fail if the world state pending nodes queue exists. The way we use that RocksDB database, it will actually be treated as empty on reload regardless of existing content. This is due to it using two fields to track the head and tail of the queue - when a new queue is created those are both set to 0 so the queue is empty regardless of what's on disk. Since we're walking the entire trie anyway now we'll identify all the nodes we need anyway.

@ajsutton ajsutton changed the title Skip requesting world state data we already Support resuming fast-sync downloads Feb 13, 2019
Copy link
Contributor

@mbaxter mbaxter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice simple update! Just left a few comments to address before merging.

@@ -25,7 +25,7 @@
// TODO: Determine reasonable defaults here
public static final int DEFAULT_PIVOT_DISTANCE_FROM_HEAD = 500;
public static final float DEFAULT_FULL_VALIDATION_RATE = .1f;
public static final int DEFAULT_FAST_SYNC_MINIMUM_PEERS = 5;
public static final int DEFAULT_FAST_SYNC_MINIMUM_PEERS = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this might've been a change for debugging?

if (existingData.isPresent()) {
pendingRequest.setData(existingData.get());
queueChildRequests(pendingRequest);
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you may need to change the containing for loop to a while loop so that we don't send out smaller than intended requests when we run into known nodes.

@ajsutton ajsutton merged commit 3828dad into PegaSysEng:master Feb 13, 2019
@ajsutton ajsutton deleted the skip-requesting-existing-data branch February 13, 2019 19:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants