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

Use pipeline for world state download #1096

Merged
merged 76 commits into from
Mar 14, 2019

Conversation

ajsutton
Copy link
Contributor

PR description

Switch world state over to using the pipeline framework to parallelise functions better.

ajsutton added 30 commits March 8, 2019 11:02
…ed before all threads finished processing their last entry.
…sume that earlier entries have completed processing by then.
…rvices take an unusually long time to start.
This reverts commit 3515376.
ajsutton added 23 commits March 13, 2019 06:31
…ccess to the same synchronized block anyway. Remove unused parts of WorldDownloadState.
@ajsutton ajsutton marked this pull request as ready for review March 14, 2019 06:49
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.

LGTM

downloadProcessFuture.whenComplete(
(result, error) -> {
if (error != null
&& !(ExceptionUtils.rootCause(error) instanceof CancellationException)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need to check for a CancellationException here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the pipeline was cancelled it's because the download state cancelled so we don't propagate the cancellation or we'll interfere with the clean up doing. Typically that results in the fast sync being considered as failed when shutting down the client so it deletes its state.

I've added a comment explaining that but may also play with a follow up PR to move starting the pipeline into WorldDownloadState so that it winds up managing the future itself and avoid having the logic split over two classes.


assertThat(task.isCompleted()).isFalse();
assertThat(task.isFailed()).isTrue();
verify(downloadState).notifyTaskAvailable();
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you verify checkCompletion wasn't called?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems reasonable.


@Test
public void shouldStoreRootNodeDataInDownloadStateInsteadOfPersisting() {
final Task<NodeDataRequest> rootNode = createTaskWithData(1, 1, 1, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

You could keep the stateRoot and stateRootHash as instance variables next to blockHeader to make it clearer where this value is coming from.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ajsutton ajsutton merged commit b5d025c into PegaSysEng:master Mar 14, 2019
@ajsutton ajsutton deleted the pipeline-world-state branch March 14, 2019 23:09
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